Find the number of quadraples (a,b,c,d) from 4 respective arrays such that a+b+c+d=0
Well, you are going about it wrong.

As a wise man once said: If in doubt, sort.


Read all four lists.
Sort them.
Calculate the smallest and biggest value which can be compensated by the lists after the first m.
Iterate over those elements of the first list which can be compensated according to 3.


Iterate over those elements of the second list which can be compensated according to 3, keeping in mind your choice for 4.


Repeat step 5 for the third list, keeping in mind your choice for 5.


Add the number of elements in the last list which can compensate the previous choices to the result.







Aside from that:


Your indentation is very haphazard.
using namespace std; is a good way to shoot yourself in your own foot, and makes any toolchain-change unpredictable.
Dynamically-sized automatic arrays aren't C++, they are C99+. Try for std::vector or such.
return 0; is implicit for main in C++.


My own solution, which can still easily be optimized further. Don't peek before you have it.