Getting wrong answer in oct lunctime 2020

https://www.codechef.com/problems/COPAR
can anyone tell me where i am doing wrong
code in cpp:
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;

int32_t main(){
#ifndef ONLINE_JUDGE
freopen(“input.txt”,“r”,stdin);
freopen(“output.txt”,“w”,stdout);
#endif

int t;
cin>>t;
while(t--){
	int n;
	cin>>n;
	vector<int>a(n);
	rep(i,0,n){
	cin>>a[i];
}

#main logic
rep(i,0,n-1){
bool f=true;
for(int j=0;j<i+1;j++){
for(int k=i+1;k<n;k++){
#i am finding gcd of every kth element withevery jth element that it is 1 or not
if(__gcd(a[j],a[k])>=2){
f=false;
break;
}
}
if(f){
cout<<i+1<<’\n’;
break;
}
}
if(f)
break;
}
}
}

kindly bother to format your code before posting it on a public forum

means?

i have done few changes can u look now @cubefreak777

You have made it even worse, better share the link of your submission
PS. This is what I mean by formatting

CODE
#include <bits/stdc++.h>
#define ar array 
using namespace std;
const int mxN = 1e5 ;
vector<ar<int,2>>P[mxN+1] ; 
void solve(){
  int n ;cin >> n  ;
  vector<int>a(n);
  for(int &x:a)
    cin >> x ;
  map<int,int>p,s ;
  for(int i=0;i<n;i++)
    for(ar<int,2> x: P[a[i]])  
      s[x[0]]+=x[1] ;  
  bool ok=1 ;
  int sn=0,dn=0  ;
  for(int i=0;i<n;i++){
    for(ar<int,2> x: P[a[i]]){
      if(p[x[0]]==0)
        sn++ ;
      p[x[0]]+=x[1]; s[x[0]]-=x[1] ;
      if(s[x[0]]==0)
        dn++ ;
    }    
    if(sn == dn){
      cout << i+1 << '\n' ;
      return ;
    }
  }
}
signed main() {
  P[1].push_back({1,1}) ;
  for(int i=2;i<mxN;i++){
    int a =i ;
    for(int d=2;d*d<=i;d++){
      if(a%d)
        continue ;
      ar<int,2>x={d,0} ;
      for(;a%d<1;a/=d)
        ++x[1] ;
      P[i].push_back(x) ;
    }
    if(a>1)P[i].push_back({a,1}) ;
  }
  int t ;
	cin >> t ;
	while(t--)
		solve();
}

@cubefreak777
plz go through the link: https://codeshare.io/5N8mqd