LADDU question. Could anyone help in finding where am I going wrong?

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	   int a;string origin;
	   cin>>a>>origin;int sum=0;int b=0;
	   while(a--)
	   {
	       string str;cin>>str;
	       if(str=="CONTEST_WON")
	       {
	       int cw;cin>>cw;
	       if(cw>20)
	       sum=300;
	       else
	       sum=300+(20-cw);
	       }
	       if(str=="TOP_CONTRIBUTOR")
	       {
	           sum+=300;
	       }
	       if(str=="BUG_FOUND")
	       {
	           int bg;cin>>bg;
	           sum+=bg;
	       }
	       if(str=="CONTEST_HOSTED")
	       {
	           sum+=50;
	       }
	   b=sum;
	   }
	   if(origin=="INDIAN")
	       cout<<b/200<<endl;
	   else
	       cout<<b/400<<endl;
	}
	return 0;
}

You might want to recheck the case: “Contest won”

1 Like
       if(cw>20)
       sum=300;   //Change it to --> sum += 300;
       else
       sum=300+(20-cw); //Change this too --> sum += 300+(20-cw);

Yes check that contest won case

if block brackets

yes it working now . Thanks!

thank you!