C++ Solution || Brute Force
Code\ncpp []\nclass Solution {\npublic:\n    // Update the function to use long long for calculations\n    int solve(vector<int>& nums1, vector<int>& nums2) {\n
# Code\n```cpp []\nclass Solution {\npublic:\n    // Update the function to use long long for calculations\n    int solve(vector<int>& nums1, vector<int>& nums2) {\n        int count = 0;\n\n        for (int i = 0; i < nums1.size(); i++) {\n            long long target = (long long)nums1[i] * nums1[i]; // Square of nums1[i]\n\n            for (int j = 0; j < nums2.size(); j++) {\n                for (int k = j + 1; k < nums2.size(); k++) {\n                    if (target == (long long)nums2[j] * nums2[k]) { // Compare using long long\n                        count++;\n                    }\n                }\n            }\n        }\n\n        return count;\n    }\n\n    int numTriplets(vector<int>& nums1, vector<int>& nums2) {\n        return solve(nums1, nums2) + solve(nums2, nums1);\n    }\n};\n\n```
['C++']