My program is not getting submitted

include
using namespace std;

int main()
{
int t,n,k,v;
cin>>t;
while(t–)
{

    cin>>n>>k>>v;
    int p,s=0,a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
        
    }
     p=(v*(n+k)-s);
      
   
     if(p/3>0 && (p%3==0))
       cout<<(p/3)<<endl;
       else
       cout<<"-1"<<endl;
    
}

return 0;

}

Problem Link: https://www.codechef.com/problems/AVG

@codestar05
Its not p/3 always .
its p/k and p%k .

Thank you