Suppose we have a deck with $52$ cards, as usual in four suits with ranks $2,3,\ldots, 10, J, Q, K, A$. Suppose we take two $2$'s aside, so that we have $50$ cards left. Then we take two times two random cards more aside, so that we have stacks of cards with two cards each. Call them stack 1 and stack 2. So in total we have put $6$ cards aside, the initial two $2$'s, and two separate stacks consisting of two cards each.
Then we draw five cards more, lets call them community cards.
Now how many ways are there that any of the two stacks together with the community cards contain two cards of the same rank higher than $2$, where as a further restriction at least one of the cards must be from the stack?
We count ways in such a way that the order among the stacks, and the community cards does not matter. This question came up in connection with the game of poker (the Texas Hold'em variant), to phrase this problem in poker language: Suppose we have a pocket pair with $2$'s, and we play against two opponents. How many ways are there that any opponent hits a pair higher than mine.
To give an example. If we have the following distribution
Community cards: 7 J K K 2 Stack 1: J 3 Stack 2: A 4
Then Stack 1 can form the higher pair J J. If for example Stack 1 contains 5 3 instead of J 3, then there is no higher pair among the stack. Note that the pair K K in the community cards does not count, as one requirement is that at least one card from the stacks must be used. Furthermore we cannot form a pair from the two stack, i.e. just Stack 1 + Community cards, or Stack 2 + Community cards.
I have computed it for the case of one stack (or one opponent), but I run into trouble when trying to count the possibilites for two opponets (all my calculations must be wrong as when I determine the probability it gives me wrong results).