What I read, built and learned, as it happens. Newest first.
allreadingprojectlearningproblemwriting
Count pairs i<j with a_i+a_j=x and a_i*a_j=y for many queries. A scan per query is n*q, too slow. Let a,b = a[i],a[j], so b = x-a and y = a*(x-a), which gives a^2 - x*a + y = 0. The roots are (x +- sqrt(x^2-4y))/2, so each query has at most one value pair. Count with a frequency map: k*(k-1)/2 if the roots are equal, c_u*c_v if not. Accepted.