Help me in solving DIVIDEMAKEEQ problem

My issue

I am facing run time error. I run my code on vscode and it gives the right outpute

My code

#include <bits/stdc++.h>
using namespace std;

int gcd(int a, int b)
{
    if (b == 0)
        return a;

    return gcd(b, a % b);
}
// Function to find gcd of array of 
// numbers 
int findGCD(int arr[], int n) 
{ 
  int result = arr[0]; 
  for (int i = 1; i < n; i++) 
  { 
    result = gcd(arr[i], result); 
  
    if(result == 1) 
    { 
    return 1; 
    } 
  } 
  return result; 
}

int main() {
	// your code goes here

}

Learning course: Number theory
Problem Link: Luigi and Uniformity Practice Problem in Number theory - CodeChef

@rbk2760
your logic is not right.
plzz refer my c++ code for better understanding of the logic

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int a[n];
	    int g;
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	        if(i==0)
	        g=a[0];
	        else
	        g=__gcd(g,a[i]);
	    }
	    int ans=0;
	    for(int i=0;i<n;i++)
	    {
	        if(a[i]!=g)
	        ans++;
	    }
	    cout<<ans<<endl;
	}

}