**A**

print `a * d - b * c`

**B**

If you encounter `o`

increment score else decrement. If at any point score becomes negative then set it to zero.

**C**

Maximum answer can be 3 because if the diagonals passing through the two points don't intersect then you can move by one distance to change the parity of that point and make the diagonals intersect after which answer will be 1 + 2 = 3. Now you only need to check if answer is 1, 2 or 3.

**D**

Use the standard definition of expected value which is equal to value of event multiplied by it's probability.

**E**

Standard BFS. Just make sure when you revisit an alphabet don't add points containing that alphabets again to queue else your code will timeout.

**F**

Use meet in the middle technique. Divide the vector into two vectors of equal size(size can differ at max by one if size is odd). Now find all possible sums for both vectors using recursion or bitmask. Sort those two possible sum lists. At last, use two pointers or binary search to find the closest sum to `T`

.