Help me in solving CAMPON problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--) {
	    int D;
	    cin>>D;
	        int d[D],p[D];
	    for(int i=0;i<D;i++) {
	        cin>>d[i]>>p[i];
	    }
	    int q;
	    cin>>q;
	        int dead[q],req[q];
	    for(int i=0;i<q;i++) {
	        cin>>dead[i]>>req[i];
	    }
	    int sum=0;
	    for(int i=0;i<q;i++) {
	        if(dead[i]<d[i]) {
	            cout<<"Go Sleep"<<endl;
	            sum+=p[i];
	        }
	        else if(dead[i]==d[i]) {
	            if(p[i]>=req[i]) {
	        cout<<"Go Camp"<<endl;
	        }
	        else {
	        cout<<"Go Sleep"<<endl;
	        }
	        sum+=p[i];
	        }
	        else if(dead[i]>d[i]) {
	            sum+=p[i];
	        if(sum>=req[i]) {
	        cout<<"Go Camp"<<endl;
	        }
	        else {
	        cout<<"Go Sleep"<<endl;
	        }
	        }
	    }
	}
	return 0;
}

Problem Link: CAMPON Problem - CodeChef

@yashu_12
your logic was not complete and also made some extra conditions that making the coding wrong i have made some changes in your code u cover all the conditions i hope u will get it.
#include<bits/stdc++.h>
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–) {
int D;
cin>>D;
int d[D],p[D];
for(int i=0;i<D;i++) {
cin>>d[i]>>p[i];
}
int numberofprb_atdate[32]={0};
int q;
cin>>q;
int dead[q],req[q];
for(int i=0;i<q;i++) {
cin>>dead[i]>>req[i];
}
int sm=0;
for(int i=1,j=0;i<=31;i++)
{
if(i==d[j])
{
sm+=p[j];
numberofprb_atdate[i]=sm;
j++;
}
else
{
numberofprb_atdate[i]=sm;
}
}
for(int i=0;i<q;i++) {
if(numberofprb_atdate[dead[i]]>=req[i])
cout<<“Go Camp”;
else
cout<<“Go Sleep”;
cout<<endl;
}
}
return 0;
}

Thanks for help!
it successfully work.