1734029 | CodeChef

what’s a mistake in my code:

#include <bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;

int main(){
fastIO;
// input values
int m,n;
cin>>n,m;
map<string,string> naam_desh;
map<string,int> winner_chef;
map<string,int> winner_country;
for(int i=0;i<n;i++){
string name,country;
cin>>name>>country;
naam_desh.insert(make_pair(name,country));
}
for(int j=0;j<m;j++){
string subject;
cin>>subject;
winner_chef[subject]++;
winner_country[naam_desh[subject]]++;
}

//main code

int count=0;
string chef;
for(auto i=winner_chef.begin();i!=winner_chef.end();i++){
    if(i->second > count){
        count = i->second;
        chef = i->first;
    }
}

count=0;
string desh;
for(auto i=winner_country.begin();i!=winner_country.end();i++){
    if(i->second > count){
        count = i->second;
        desh = i->first;
    }
}

cout<<desh<<endl;
cout<<chef<<endl;


return 0;

}

Can u please tell what problem you are facing?

1 Like

actually i am getting no output…

my output is just blank…

1 Like

okay i figured it out…
:slight_smile: