My issue
My code
#include <iostream>
#include<algorithm>
#include<cmath>
using namespace std;
#define ll long long int
ll gcd(ll a,ll b){
if(a>b){
if(a%b==0){
return b;
}
else gcd(a-b,b);
}
else {
if(a<b){
if(b%a==0){
return a;}
}
else{ gcd(a,b-a); }
}
ll lcd(ll c,ll d){
ll e=abs(c*d)/gcd(c,d);
return e;}
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
ll n;
cin>>n;
ll a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
ll ans=0;
for(ll i=0;i<n;i++){
for(ll j=i+1;j<n;j++){
if(gcd(a[i],a[j])==lcd(a[i],a[j])){
ans++;
}
}
}
cout<<ans<<endl;
}
return 0;
}
Problem Link: EQPAIR Problem - CodeChef