I did what most of the other coders in C++ did.
1- I stored ab+c and d(e+f) in two separate arrays and to count the occurence of them i used a dictionary.
2 - Finally i did binary on each element of abc after sorting def and counted using dictionary.
Please tell how to get my solution AC.
link to my solution using dictionary: https://ideone.com/MkhicR