I submitted the following solution for the Dragon Bool Problem and I checked it for many cases and it gives correct answer however codechef always gives wrong answer notice to me.Please Help.
int main()
{
using namespace std;
int nCase,nSoints[101]={0},nSofloats[101]={0},ci,cf,ni,nf,k,l,ans[100]={0},pupa3=0,ppp;
cin>>nCase;
ppp=nCase;
while(nCase>0)
{
cin>>ni;
cin>>nf;
for(int i=0;i<ni;i++)
{
cin>>ci;
cin>>k;
nSoints[k]+=ci;
}
for(int j=0;j<nf;j++)
{
cin>>cf;
cin>>l;
nSofloats[l]+=cf;
}
for(int m=0;m<101;m++)
{
if((nSoints[m]-nSofloats[m])<=0)
{
ans[pupa3]+=(nSoints[m]-nSofloats[m]);
}
nSoints[m]=0;
nSofloats[m]=0;
}
pupa3++;
nCase--;
}
for(int klm=0;klm<ppp;klm++)
{
cout<<ans[klm]*(-1)<<endl;
}
}