We can solve this problem using the Principle of Inclusion-Exclusion (PIE).

First, let's find the total number of ways the children can choose their ice cream flavors. Each child has 3 options, so there are 3^6 = 729 possible outcomes.

Next, let's find the number of ways no flavor is selected by exactly two children. To do this, we can use the complement rule and subtract from the total number of outcomes the number of ways all flavors are selected by at most one child.

There are C(6,0) ways to choose no child for the first flavor, C(5,0) ways to choose no child for the second flavor, and C(4,0) ways to choose no child for the third flavor. So the number of ways all flavors are selected by at most one child is:

C(6,0) * C(5,0) * C(4,0) = 1

Therefore, the number of ways no flavor is selected by exactly two children is:

3^6 - 1 = 728

However, this includes the cases where some flavor is selected by exactly three children or by all six children. We need to subtract these cases to avoid double-counting.

Let A be the set of outcomes where flavor 1 is selected by exactly three children, and let B and C be the sets of outcomes where flavors 2 and 3, respectively, are selected by exactly three children. We can use the formula for the size of the union of three sets to find the number of outcomes in which some flavor is selected by exactly three children:

|A ∪ B ∪ C| = |A| + |B| + |C| - |A ∩ B| - |A ∩ C| - |B ∩ C| + |A ∩ B ∩ C|

Each of |A|, |B|, and |C| can be found using the following reasoning: There are C(6,3) ways to choose 3 children to select the given flavor, and for each choice, there are 2 options for the remaining 3 children (they can choose either of the other 2 flavors). So:

|A| = C(6,3) * 2^3 = 160

|B| = C(6,3) * 2^3 = 160

|C| = C(6,3) * 2^3 = 160

To find |A ∩ B|, we need to choose 3 children to select flavor 1 and 3 children to select flavor 2, and then the remaining child can select either flavor 1 or flavor 2. So:

|A ∩ B| = C(6,3) * C(3,3) * 2 = 40

Similarly, |A ∩ C| = 40 and |B ∩ C| = 40.

To find |A ∩ B ∩ C|, we need to choose 3 children to select each of the 3 flavors. This can be done in C(6,3) ways:

|A ∩ B ∩ C| = C(6,3) = 20

Substituting these values into the formula for the size of the union of three sets, we get:

|A ∪ B ∪ C| = 160 + 160 + 160 - 40 - 40 - 40 + 20 = 360

Therefore, the number of ways some flavor is selected by exactly two children is:

728 - 360 = 368

So there are 368 ways the children can choose their ice cream flavors so that some flavor of ice cream is selected by exactly two children.