C++ || Easy Explanation ||O(N^2)
//        long long temp,t,help are used to keep the product within limits (prevent overflow)\n        \n// The idea is to store all the squares in a map(not se
//        long long temp,t,help are used to keep the product within limits (prevent overflow)\n        \n// The idea is to store all the squares in a map(not set because duplicates may be present an dnot even multiset because we won\'t get the number of times the duplicates appears)\n        \n//         Use nested loop then and check which pairs product is present as square in another map  and add its occurences\n        \n    int numTriplets(vector<int>& nums1, vector<int>& nums2) \n    {\n            map<long long,int> st1,st2;             \n            long long temp,t;\n            for(int i=0;i<nums1.size();i++)\n            {\n                    t=nums1[i];\n                    temp=t*t;\n                   \n                    \n                    \n                     st1[t*t]++;\n            }\n                   \n            for(int i=0;i<nums2.size();i++)\n            {\n                    t=nums2[i];\n                    temp=t*t;\n                   \n                    \n                     st2[t*t]++;\n            }\n            \n            int cnt=0;\n            long long help1,help2;\n           for(int i=0;i<nums1.size();i++)\n           {\n                   for(int j=i+1;j<nums1.size();j++)\n                   {\n                           help1=nums1[i];\n                           help2=nums1[j];\n                           temp=help1*help2;\n                          \n                           if(st2.find(temp)!=st2.end())\n                           {\n                                   cnt+=st2[temp];\n                           }\n                   }\n           }\n            \n             for(int i=0;i<nums2.size();i++)\n           {\n                   for(int j=i+1;j<nums2.size();j++)\n                   {\n                           help1=nums2[i];\n                           help2=nums2[j];\n                           temp=help1*help2;\n                           \n                           \n                           if(st1.find(temp)!=st1.end())\n                           {\n                                   cnt+=st1[temp];\n                           }\n                   }\n           }\n            return cnt;\n    }
['C']