unique and easy solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\nlong mod = 1e9+7;\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n\n        map<long long ,long long>mp1;\n        for(long long i : nums1){\n            long long n = (i)%mod*(i)%mod;\n            n=n%mod;\n\n\n            mp1[n]++;\n        }\n        map<long long ,long long>mp2;\n        for(long long i : nums2){\n            long long n = (i)%mod * (i)%mod;\n            n=n%mod;\n\n            mp2[n]++;\n        }\n        int res = 0;\n\n        int i = 0;\n        while(i<nums2.size()){\n\n            int j = i+1;\n            while(j<nums2.size()){\n\n                long long n = (nums2[i])%mod*(nums2[j])%mod;\n                n=n%mod;\n\n                if(mp1.find(n)!=mp1.end()){\n\n                    res = res + mp1[n];\n                }\n\n\n                j++;\n            }\n            i++;\n        }\n        \n       \n        i = 0;\n        while(i<nums1.size()){\n            int j = i+1;\n            while(j<nums1.size()){\n\n                long long int n = (nums1[i])%mod*(nums1[j])%mod;\n                n=n%mod;\n\n                if(mp2.find(n)!=mp2.end()){\n                    res = res + mp2[n];\n                }\n                j++;\n            }\n            i++;\n        }\n        return res;\n        \n    }\n};\n```
['C++']