https://www.codechef.com/submit/BUILDB

#include
using namespace std;
int main(){
int t;
cin>>t;
while(t–){
long long n,r;
cin>>n>>r;
long long a[n],b[n],tension=0;
for(long long i=0;i<n;i++){
cin>>a[i];
}
for(long long i=0;i<n;i++){
cin>>b[i];
}
for(long long i=0;i<n;i++){
if(i==0){
tension+=b[i];
}else{
tension+=b[i];
long long diff = (a[i]-a[i-1])*r;
tension = tension -diff;
}
}
cout<<tension<<"\n";
}
}

i am getting correct output but wrong answer in chodechef compilier can anyone help?

Because your code passes the pretest (for small test cases). You need to figure out boundary cases as well. Test cases can be misleading sometimes, so make it a rule of thumb to test your code on your own random test cases. Secondly the link you have shared directs to codechef ide. Try to submit your code on pastebin or ideon and share that link. And at last try to mention your approach in your text , so that it is easy for anyone to figure out if there is any logical error .( it saves time)