I am not able to understand why is this code giving me TLE, can anyone please explain.
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int activities;
string origin;
cin>>activities;
cin>>origin;
long long int ans = 0;
while(activities--){
string contest;
cin>>contest;
if(contest == "CONTEST_WON"){
int x;
cin>>x;
ans += 300;
if(x<=20)
ans += (20-x);
}
else if(contest == "TOP_CONTRIBUTOR"){
ans += 300;
}
else if(contest == "BUG_FOUND"){
int x;
cin>>x;
ans += x;
}
else if(contest == "CONTEST_HOSTED"){
ans += 50;
}
}
if(origin == "INDIAN"){
cout<<ans/200<<endl;
}
else cout<<ans/400<<endl;
}
return 0;
}