08_Map_★★_Ice_Cream_Sales

Max Score = 100


# 0001, 2024-10-15 13:18:44, PPPP----P (55%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    map<int,string> tmp;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
        }
    }
    for(auto x:c)
    {
        tmp[x.second] = x.first;
    }
    map<int,string>::iterator it = tmp.end();
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: "<<(--it)->second;
    }
    return 0;
}
# 0002, 2024-10-15 13:19:37, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    map<int,string> tmp;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
        }
    }
    for(auto x:c)
    {
        tmp[x.second] = x.first;
    }
    map<int,string>::iterator it = tmp.end();
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: *"<<sum<<"\nTop sales: "<<(--it)->second;
    }
    return 0;
}
# 0003, 2024-10-15 13:20:00, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    map<int,string> tmp;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
        }
    }
    for(auto x:c)
    {
        tmp[x.second] = x.first;
    }
    map<int,string>::iterator it = tmp.end();
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sale: "<<(--it)->second;
    }
    return 0;
}
# 0004, 2024-10-15 13:22:32, PPPP----P (55%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,int> c;
    map<int,string> tmp;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn;
            }else{
                c[x] = nn;
            }
        }
    }
    for(auto x:c)
    {
        tmp[x.second] = x.first;
    }
    map<int,string>::iterator it = tmp.end();
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: "<<(--it)->second;
    }
    return 0;
}
# 0005, 2024-10-15 13:25:50, PPPP----P (55%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn,maxx = 0;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn;
            }else{
                c[x] = nn;
            }
        }
    }
    string ans;
    for(map<string,int>::iterator it = c.begin();it != c.end();it++)
    {
        if(it->second > maxx)
        {
            maxx = it->second;
            ans = it->first;
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: "<<ans;
    }
    return 0;
}
# 0006, 2024-10-15 13:29:32, PPPP----P (55%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn,maxx = 0;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn;
            }else{
                c[x] = nn;
            }
            if(c[x] > maxx)
            {
                maxx = c[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0007, 2024-10-15 13:31:09, -P------P (22%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn;
            }else{
                c[x] = nn;
            }
            if(c[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0008, 2024-10-15 13:32:29, -P------P (22%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn;
            }else{
                c[x] = nn;
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0009, 2024-10-15 13:34:49, -P------P (22%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += nn*mp[x];
            }else{
                c[x] = nn*mp[x];
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0010, 2024-10-15 13:35:16, -P------P (22%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += (nn*mp[x]);
            }else{
                c[x] = nn*mp[x];
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0011, 2024-10-15 13:38:17, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    int n,m,nn;
    map<string,double> mp;
    map<string,double> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += (nn*mp[x]);
            }else{
                c[x] = nn*mp[x];
            }
            if(c[x] > maxx)
            {
                maxx = c[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0012, 2024-10-15 13:40:07, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m,nn;
    map<string,double> mp;
    map<string,double> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>nn;
        if(mp.find(x)!=mp.end())
        {
            sum += (nn*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += (nn*mp[x]);
            }else{
                c[x] = nn*mp[x];
            }
            if(c[x] > maxx)
            {
                maxx = c[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0013, 2024-10-15 13:44:32, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second*mp[ans.first] == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0014, 2024-10-15 13:45:26, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(auto ans:c)
        {
            if(ans.second*mp[ans.first] == maxx)
            {
                cout<<ans.first<<" ";
            }
        }
    }
    return 0;
}
# 0015, 2024-10-15 13:48:02, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(map<string,int>::iterator it = c.begin();it != c.end();it++)
        {
            if(it->second*mp[it->first] == maxx)
            {
                cout<<it->first<<" ";
            }
        }
    }
    return 0;
}
# 0016, 2024-10-15 13:48:36, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;
int main ()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    map<string,double> mp;
    map<string,int> c;
    string x;
    double p,sum = 0,maxx = 0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>p;
        mp[x] = p;
    }
    cin>>m;
    for(int i=0;i<m;i++)
    {
        cin>>x>>p;
        if(mp.find(x)!=mp.end())
        {
            sum += (p*mp[x]);
            if(c.find(x)!=c.end())
            {
                c[x] += p;
            }else{
                c[x] = p;
            }
            if(c[x]*mp[x] > maxx)
            {
                maxx = c[x]*mp[x];
            }
        }
    }
    if(sum<=0)
    {
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<sum<<"\nTop sales: ";
        for(map<string,int>::iterator it = c.begin();it != c.end();it++)
        {
            if(it->second*mp[it->first] == maxx)
            {
                cout<<it->first<<" ";
            }
        }
    }
    return 0;
}

# 0017, 2024-10-15 13:27:51, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,double>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        double sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        ans += x.second.first * x.second.second;
        if(x.second.second > mx.second){
            mx.first = x.first;
            mx.second = x.second.second;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0018, 2024-10-15 13:29:01, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        ans += x.second.first * x.second.second;
        if(x.second.second > mx.second){
            mx.first = x.first;
            mx.second = x.second.second;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0019, 2024-10-15 13:31:37, -P-----PP (33%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    long double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(cost > mx.second){
            mx.first = name;
            mx.second = sells;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0020, 2024-10-15 13:31:47, -P-----PP (33%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;
        
        ans += cost * sells;
        if(cost > mx.second){
            mx.first = name;
            mx.second = sells;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0021, 2024-10-15 13:32:28, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0022, 2024-10-15 13:32:56, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    long double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0023, 2024-10-15 13:34:53, --------- (0%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    long long int n; cin >> n;
    map<string,pair<long double,long long int>> mp;
    for(long long int i=0;i<n;i++){
        string str; cin >> str;
        long double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    long long int m; cin >> m;
    for(long long int i=0;i<m;i++){
        string str; cin >> str;
        long long int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    long double ans = 0;
    pair<string,long double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        long double cost = x.second.first;
        long long int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }

        cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0024, 2024-10-15 13:35:05, --------- (0%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<long double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        long double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    long double ans = 0;
    pair<string,long double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        long double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }

        cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0025, 2024-10-15 13:35:26, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    long long int n; cin >> n;
    map<string,pair<long double,long long int>> mp;
    for(long long int i=0;i<n;i++){
        string str; cin >> str;
        long double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    long long int m; cin >> m;
    for(long long int i=0;i<m;i++){
        string str; cin >> str;
        long long int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    long double ans = 0;
    pair<string,long double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        long double cost = x.second.first;
        long long int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }

        // cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0026, 2024-10-15 13:36:27, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(sells >= mx.second){
            mx.first = name;
            mx.second = sells;
        }
        // cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0027, 2024-10-15 13:38:51, PPPP----P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(sells > mx.second){
            mx.first = name;
            mx.second = sells;
        }
        else if(sells == mx.second){
            mx.first += ' ' + name;
        }
        // cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}
# 0028, 2024-10-15 13:40:04, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n; cin >> n;
    map<string,pair<double,int>> mp;
    for(int i=0;i<n;i++){
        string str; cin >> str;
        double cost; cin >> cost;
        mp[str] = {cost,0};
    }

    int m; cin >> m;
    for(int i=0;i<m;i++){
        string str; cin >> str;
        int sells; cin >> sells;
        if(mp.find(str) != mp.end()) mp[str].second += sells;
            
    }

    double ans = 0;
    pair<string,double> mx = {"",0};
    for(auto x : mp){
        string name = x.first;
        double cost = x.second.first;
        int sells = x.second.second;

        ans += cost * sells;
        if(cost*sells > mx.second){
            mx.first = name;
            mx.second = cost*sells;
        }
        else if(cost*sells == mx.second){
            mx.first += ' ' + name;
        }
        // cout << name << " " << cost << " " << sells << "\n";
    }

    if(ans == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << ans << "\n";
        cout << "Top sales: " << mx.first;
    }

    return 0;
}

# 0029, 2024-10-15 13:11:19, PPPPPPPP- (88%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum,MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            if (SaleRef.find(Name) != Data.end()) // check if exist
            {
                SaleRef[Name] = SaleRef[Name] + cnt;
            }
            else
            {
                SaleRef[Name] = cnt;
            }
        }
    }
    for (auto c : SaleRef) // name and amount
    {
        Data[c.first] = Data[c.first] * c.second;
        MaxNum = max(MaxNum, Data[c.first]);
        saleSum += Data[c.first];
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        for (auto c : Data)
        {
            if (c.second == MaxNum)
            {
                cout << c.first << " ";
            }
        }
    }
}
# 0030, 2024-10-15 13:16:16, PPPPPPPP- (88%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    for (int i = 0; i < num; i++)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            if (SaleRef.find(Name) != Data.end()) // check if exist
            {
                SaleRef[Name] = SaleRef[Name] + cnt;
            }
            else
            {
                SaleRef[Name] = cnt;
            }
        }
    }
    for (auto c : SaleRef) // name and amount
    {
        Data[c.first] = Data[c.first] * c.second;
        MaxNum = max(MaxNum, Data[c.first]);
        saleSum += Data[c.first];
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : Data)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0031, 2024-10-15 13:33:03, PPPPPPPP- (88%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            if (SaleRef.find(Name) != Data.end()) // check if exist
            {
                SaleRef[Name] = SaleRef[Name] + cnt;
            }
            else
            {
                SaleRef[Name] = cnt;
            }
        }
    }
    for (auto c : SaleRef) // name and amount
    {
        //cout << "New Sale " << c.first << " " << Data[c.first] << " * " << c.second << " = " << Data[c.first] * c.second << endl;
        Data[c.first] = Data[c.first] * c.second;
        MaxNum = max(MaxNum, Data[c.first]);
        saleSum += Data[c.first];
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : Data)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0032, 2024-10-15 13:36:48, PPPPPPPP- (88%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            if (SaleRef.find(Name) != Data.end()) // check if exist
            {
                SaleRef[Name] = SaleRef[Name] + cnt;
            }
            else
            {
                SaleRef[Name] = cnt;
            }
        }
    }
    if (Salefound)
        for (auto c : SaleRef) // name and amount
        {
            // cout << "New Sale " << c.first << " " << Data[c.first] << " * " << c.second << " = " << Data[c.first] * c.second << endl;
            Data[c.first] = Data[c.first] * c.second;
            MaxNum = max(MaxNum, Data[c.first]);
            saleSum += Data[c.first];
        }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : Data)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0033, 2024-10-15 13:41:41, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0034, 2024-10-15 13:45:45, PPPPPPPP- (88%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            if (SaleRef.find(Name) != Data.end()) // check if exist
            {
                SaleRef[Name] = SaleRef[Name] + cnt;
            }
            else
            {
                SaleRef[Name] = cnt;
            }
        }
    }
    for (auto c : SaleRef) // name and amount
    {
        // cout << "New Sale " << c.first << " " << Data[c.first] << " * " << c.second << " = " << Data[c.first] * c.second << endl;
        Data[c.first] = Data[c.first] * c.second;
        MaxNum = max(MaxNum, Data[c.first]);
        saleSum += Data[c.first];
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : Data)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0035, 2024-10-15 13:46:46, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0036, 2024-10-15 13:56:41, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";

        for (auto c : SaleRef)
        {
            cout << c.second << " ";
        }
    }
}
# 0037, 2024-10-15 13:57:04, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0038, 2024-10-15 13:58:37, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                cout << c.second << " ";
            }
        }
    }
}
# 0039, 2024-10-15 13:59:03, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        vector<string> Out;
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                Out.emplace_back(c.first);
            }
        }
        sort(Out.begin(), Out.end());
        for (auto c : Out)
        {
            cout << c << " ";
        }
    }
}
# 0040, 2024-10-15 13:59:38, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string, double> Data;
map<string, double> SaleRef;
int main()
{
    double num, cnt, saleSum = 0, MaxNum = 0;
    bool Salefound = false;
    string Name;
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        Data[Name] = cnt;
    }
    cin >> num;
    while (num--)
    {
        cin >> Name;
        cin >> cnt;
        double newSale;
        if (Data.find(Name) != Data.end()) // check if ice cream
        {
            Salefound = true;
            SaleRef[Name] += Data[Name] * cnt;
            MaxNum = max(MaxNum, SaleRef[Name]);
            saleSum += Data[Name] * cnt;
        }
    }
    if (!Salefound)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << saleSum << endl;
        cout << "Top sales: ";
        for (auto c : SaleRef)
        {
            if (c.second == MaxNum)
            {
                cout << c.first << " ";
            }
        }
    }
}

# 0041, 2024-10-15 13:26:56, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=INT_MIN;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second==maxPrice)cout<<x.first<<" ";

        }
    }    
    return 0;
}
# 0042, 2024-10-15 13:29:16, Compilation error (0%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=INT_MIN;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }

    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second==maxPrice)cout<<x.first<<" ";

        }
    }    
    return 0;
}
# 0043, 2024-10-15 13:29:29, --PPP---P (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=INT_MIN;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    if(sell.empty())cout<<"";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second==maxPrice)cout<<x.first<<" ";

        }
    }    
    return 0;
}
# 0044, 2024-10-15 13:29:44, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=INT_MIN;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second==maxPrice)cout<<x.first<<" ";

        }
    }    
    return 0;
}
# 0045, 2024-10-15 13:42:34, PPPPPPPPP (100%)

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

int main() {
    map<string, double> icecream;
    map<string, double> sell;
    string name;
    double price, maxPrice = -numeric_limits<double>::max();
    int n, m, amount;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> name >> price;
        icecream[name] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> name >> amount;
        if (icecream.find(name) != icecream.end()) {
            price = amount * icecream[name];
            sell[name] += price;
        }
    }

    if (sell.empty()) {
        cout << "No ice cream sales";
    } else {
        double total = 0;
        for (auto x : sell) {
            total += x.second;
            maxPrice = max(maxPrice, x.second);  // Update maxPrice with total sales of each item
        }
        cout << "Total ice cream sales: " << total << endl;

        // Collect all ice creams with the highest sales
        vector<string> topSales;
        for (auto x : sell) {
            if (x.second == maxPrice) {
                topSales.push_back(x.first);
            }
        }

        // Sort the ice cream names in alphabetical order
        sort(topSales.begin(), topSales.end());

        cout << "Top sales: ";
        for (const auto &iceCreamName : topSales) {
            cout << iceCreamName << " ";
        }
    }

    return 0;
}
# 0046, 2024-10-15 13:45:24, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    set<string> top;
    string name;
    double price,maxPrice=-1;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    /*for(auto x:sell){
        cout<<x.first<<": "<<x.second<<endl;
    }*/
    
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
            if(x.second==maxPrice) top.insert(x.first);
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:top){
            cout<<x<<" ";
        }
    }    
    return 0;
}
# 0047, 2024-10-15 13:47:55, Compilation error (0%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    set<string> top;
    string name;
    double price,maxPrice=-1;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    /*for(auto x:sell){
        cout<<x.first<<": "<<x.second<<endl;
    }*/
    
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
            if(x.second==maxPrice) top.insert(x.first);
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
            sort(top.begin(),top.end());
        for(auto x:top){
            cout<<x<<" ";
        }
    }    
    return 0;
}
# 0048, 2024-10-15 13:48:29, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    vector<string> top;
    string name;
    double price,maxPrice=-1;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
            maxPrice=max(maxPrice,price);
        }
    }
    /*for(auto x:sell){
        cout<<x.first<<": "<<x.second<<endl;
    }*/
    
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
            if(x.second==maxPrice) top.push_back(x.first);
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
            sort(top.begin(),top.end());
        for(auto x:top){
            cout<<x<<" ";
        }
    }    
    return 0;
}
# 0049, 2024-10-15 13:48:42, PPPPPPPPP (100%)

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

int main() {
    map<string, double> icecream;
    map<string, double> sell;
    string name;
    double price, maxPrice = -numeric_limits<double>::max();
    int n, m, amount;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> name >> price;
        icecream[name] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++) {
        cin >> name >> amount;
        if (icecream.find(name) != icecream.end()) {
            price = amount * icecream[name];
            sell[name] += price;
        }
    }

    if (sell.empty()) {
        cout << "No ice cream sales";
    } else {
        double total = 0;
        for (auto x : sell) {
            total += x.second;
            maxPrice = max(maxPrice, x.second);  // Update maxPrice with total sales of each item
        }
        cout << "Total ice cream sales: " << total << endl;

        cout << "Top sales: ";
        for (auto x : sell) {
            if (x.second == maxPrice) {
                cout << x.first << " ";
            }
        }
    }

    return 0;
}
# 0050, 2024-10-15 13:51:37, -PP-P---P (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=-1;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
        }
    }
    /*for(auto x:sell){
        cout<<x.first<<": "<<x.second<<endl;
    }*/
    
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
            maxPrice=max(maxPrice,x.second);
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            cout<<x.first<<" ";
        }
    }    
    return 0;
}
# 0051, 2024-10-15 13:52:57, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> icecream;
    map<string,double> sell;
    string name;
    double price,maxPrice=-1;
    int n,m,amount;
    bool c=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name>>price;
        icecream[name]=price;
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>name>>amount;
        if(icecream.find(name)!=icecream.end()){
            price=amount*(icecream[name]);
            sell[name]+=price;
        }
    }
    /*for(auto x:sell){
        cout<<x.first<<": "<<x.second<<endl;
    }*/
    
    if(sell.empty())cout<<"No ice cream sales";
    else{
        double total=0;
        for(auto x:sell){
            total+=x.second;
            maxPrice=max(maxPrice,x.second);
        }
            cout<<"Total ice cream sales: "<<total<<endl;
            cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second==maxPrice)
            cout<<x.first<<" ";
        }
    }    
    return 0;
}

# 0052, 2024-10-15 13:26:00, -P------- (11%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        total += p;
        product[goods].second = total;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
    }

    
}
# 0053, 2024-10-15 13:34:01, -PPP----P (44%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        total += p;
        product[goods].second = total;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        cout << "Top sales: " << sale[0].second;
    }

    
}
# 0054, 2024-10-15 13:34:12, -P------- (11%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        total += p;
        product[goods].second = total;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.begin(),sale.end());
        cout << "Top sales: " << sale[0].second;
    }

    
}
# 0055, 2024-10-15 13:34:21, -PPP----P (44%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        total += p;
        product[goods].second = total;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        cout << "Top sales: " << sale[0].second;
    }

    
}
# 0056, 2024-10-15 13:42:39, -P------- (11%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        printvec(sale);
        cout << "Top sales: " << sale[0].second;
    }

    
}
# 0057, 2024-10-15 13:42:52, PPPP---PP (66%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        cout << "Top sales: " << sale[0].second;
    }

    
}
# 0058, 2024-10-15 13:48:00, PPPP---PP (66%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        cout << "Top sales: " << sale[0].second << " ";
        for(int i=1; i<sale.size();i++){
            if(sale[i].first == sale[i-1].first){
                cout << sale[i].second << " ";
            }else{
                break;
            }
        }
    }

    
}
# 0059, 2024-10-15 13:48:12, PPPP---PP (66%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        cout << "Top sales: " << sale[0].second << " ";
        for(int i=1; i<sale.size();i++){
            if(sale[i].first == sale[i-1].first){
                cout << sale[i].second << " ";
            }else{
                break;
            }
        }
    }

    
}
# 0060, 2024-10-15 13:48:47, PPPP---PP (66%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        cout << "Top sales: " << sale[0].second << " ";
        for(int i=1; i<sale.size();i++){
            if(sale[i].first == sale[i-1].first){
                cout << sale[i].second;
            }else{
                break;
            }
        }
    }

    
}
# 0061, 2024-10-15 13:48:58, PPPP---PP (66%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        cout << "Top sales: " << sale[0].second << " ";
        for(int i=1; i<sale.size();i++){
            if(sale[i].first == sale[i-1].first){
                cout << sale[i].second << " ";
            }else{
                break;
            }
        }
    }

    
}
# 0062, 2024-10-15 14:01:17, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

void printvec(vector<pair<double,string>> v){
    for(auto &e : v){
        cout << e.second << " " << e.first << endl;
    }
}

int main(){
    map<string,pair<double,double>> product;
    int n;
    cin >> n;
    string goods;
    double price;
    for(int i=0; i<n;i++){
        cin >> goods >> price;
        product[goods] = {price,0};
    }
    int m;
    cin >> m;
    int count;
    double total = 0;
    bool found = false;
    for(int i=0; i<m;i++){
        cin >> goods >> count;
        double p = product[goods].first*count;
        product[goods].second += p;
        total += p;
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> sale;
        for(auto p : product){
            sale.push_back({p.second.second,p.first});
        }
        sort(sale.rbegin(),sale.rend());
        //printvec(sale);
        vector<string> v;
        v.push_back(sale[0].second);
        for(int i=1; i<sale.size();i++){
            if(sale[i].first == sale[i-1].first){
                v.push_back(sale[i].second);
            }else{
                break;
            }
        }
        sort(v.begin(),v.end());
        cout << "Top sales: ";
        for(int i=0; i<v.size();i++){
            cout << v[i] << " ";
        }
    }

    
}

# 0063, 2024-10-15 13:40:05, xxxxxxxxx (0%)

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

// int main()
// {
//     int n;
//     cin>>n;
//     string T;
//     double S;
//     map<string,double> tim;
//     map<string,double> sale;



// }



int main()
{
    int n,m;
    cin>>n;
    string keptim1;
    double kepraka1;
    string kepsale2;
    double kepraka2;
    vector<pair<string,double>> tim;
    vector<pair<string,double>> sale;
    vector<pair<string,double>> mecaretim;

    pair<string,double> kepair1;
    pair<string,double> kepair2;


    for(int i=0;i<n;i++){
        cin>>keptim1>>kepraka1;
        kepair1=make_pair(keptim1,kepraka1);
        tim.push_back(kepair1);
    }

    cin>>m;
    for(int i=0;i<m;i++){
        cin>>kepsale2>>kepraka2;
        kepair1=make_pair(kepsale2,kepraka2);
        tim.push_back(kepair2);
    }

    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){

           if(sale[i]==tim[j]){
            mecaretim.push_back(sale[i]);
           }

            }
        }
    






    for(const auto pair : mecaretim) {
        cout<< pair.first << pair.second <<endl;
    }


}
# 0064, 2024-10-15 13:44:37, -P------- (11%)

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

// int main()
// {
//     int n;
//     cin>>n;
//     string T;
//     double S;
//     map<string,double> tim;
//     map<string,double> sale;

// Ice Cream Sales
// Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// Input data
// The first line is the integer N
// N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// Line N+2 is the integer M
// M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// Output data
// If no ice cream was sold, display the message No ice cream sales.
// If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// Example
// input 
// 5
// Magnum 50
// Cornetto 25
// PaddlePop 15.50
// AsianDelight 20
// Calippo 15
// 3
// Cookie 20
// MamaTomYum 3
// MangoSheet 10

// Output
// No ice cream sales

// input
// 5
// Magnum 50
// Cornetto 25
// PaddlePop 15.50
// AsianDelight 20
// Calippo 15.00
// 7
// Magnum 5
// Magnum 5
// Cookie 20
// MamaTomYum 3
// PaddlePop 3
// Cornetto 20
// AsianDelight 1
// output
// Total ice cream sales: 1066.5
// Top sales: Cornetto Magnum

// }



// int main()
// {
//     int n,m;
//     cin>>n;
//     string keptim1;
//     double kepraka1;
//     string kepsale2;
//     double kepraka2;
//     vector<pair<string,double>> tim;
//     vector<pair<string,double>> sale;
//     vector<pair<string,double>> mecaretim;

//     pair<string,double> kepair1;
//     pair<string,double> kepair2;


//     for(int i=0;i<n;i++){
//         cin>>keptim1>>kepraka1;
//         kepair1=make_pair(keptim1,kepraka1);
//         tim.push_back(kepair1);
//     }

//     cin>>m;
//     for(int i=0;i<m;i++){
//         cin>>kepsale2>>kepraka2;
//         kepair1=make_pair(kepsale2,kepraka2);
//         tim.push_back(kepair2);
//     }

//     for(int i=0;i<m;i++){
//         for(int j=0;j<n;j++){

//            if(sale[i]==tim[j]){
//             mecaretim.push_back(sale[i]);
//            }

//             }
//         }
    


//     for(const auto pair : mecaretim) {
//         cout<< pair.first << pair.second <<endl;
//     }


// }


#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;
    map<string, double> iceCreamSales;

    
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        
        double totalSales = 0.0;
        for (auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }

        
        double maxSales = 0.0;
        vector<string> topIceCreams;
        for (auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }

        
        sort(topIceCreams.begin(), topIceCreams.end());

       
        cout << "Total ice cream sales: " << fixed << setprecision(2) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " ";
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0065, 2024-10-15 13:46:03, PP------- (22%)

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

// int main()
// {
//     int n;
//     cin>>n;
//     string T;
//     double S;
//     map<string,double> tim;
//     map<string,double> sale;

// Ice Cream Sales
// Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// Input data
// The first line is the integer N
// N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// Line N+2 is the integer M
// M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// Output data
// If no ice cream was sold, display the message No ice cream sales.
// If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// Example
// input 
// 5
// Magnum 50
// Cornetto 25
// PaddlePop 15.50
// AsianDelight 20
// Calippo 15
// 3
// Cookie 20
// MamaTomYum 3
// MangoSheet 10

// Output
// No ice cream sales

// input
// 5
// Magnum 50
// Cornetto 25
// PaddlePop 15.50
// AsianDelight 20
// Calippo 15.00
// 7
// Magnum 5
// Magnum 5
// Cookie 20
// MamaTomYum 3
// PaddlePop 3
// Cornetto 20
// AsianDelight 1
// output
// Total ice cream sales: 1066.5
// Top sales: Cornetto Magnum

// }



// int main()
// {
//     int n,m;
//     cin>>n;
//     string keptim1;
//     double kepraka1;
//     string kepsale2;
//     double kepraka2;
//     vector<pair<string,double>> tim;
//     vector<pair<string,double>> sale;
//     vector<pair<string,double>> mecaretim;

//     pair<string,double> kepair1;
//     pair<string,double> kepair2;


//     for(int i=0;i<n;i++){
//         cin>>keptim1>>kepraka1;
//         kepair1=make_pair(keptim1,kepraka1);
//         tim.push_back(kepair1);
//     }

//     cin>>m;
//     for(int i=0;i<m;i++){
//         cin>>kepsale2>>kepraka2;
//         kepair1=make_pair(kepsale2,kepraka2);
//         tim.push_back(kepair2);
//     }

//     for(int i=0;i<m;i++){
//         for(int j=0;j<n;j++){

//            if(sale[i]==tim[j]){
//             mecaretim.push_back(sale[i]);
//            }

//             }
//         }
    


//     for(const auto pair : mecaretim) {
//         cout<< pair.first << pair.second <<endl;
//     }


// }


#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;
    map<string, double> iceCreamSales;

    
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        
        double totalSales = 0.0;
        for (auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }

        
        double maxSales = 0.0;
        vector<string> topIceCreams;
        for (auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }

        
        sort(topIceCreams.begin(), topIceCreams.end());

       
        cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " ";
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0066, 2024-10-15 13:49:45, -P------- (11%)

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

// // int main()
// // {
// //     int n;
// //     cin>>n;
// //     string T;
// //     double S;
// //     map<string,double> tim;
// //     map<string,double> sale;

// // Ice Cream Sales
// // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // Input data
// // The first line is the integer N
// // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // Line N+2 is the integer M
// // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // Output data
// // If no ice cream was sold, display the message No ice cream sales.
// // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // Example
// // input 
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15
// // 3
// // Cookie 20
// // MamaTomYum 3
// // MangoSheet 10

// // Output
// // No ice cream sales

// // input
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15.00
// // 7
// // Magnum 5
// // Magnum 5
// // Cookie 20
// // MamaTomYum 3
// // PaddlePop 3
// // Cornetto 20
// // AsianDelight 1
// // output
// // Total ice cream sales: 1066.5
// // Top sales: Cornetto Magnum

// // }



// // int main()
// // {
// //     int n,m;
// //     cin>>n;
// //     string keptim1;
// //     double kepraka1;
// //     string kepsale2;
// //     double kepraka2;
// //     vector<pair<string,double>> tim;
// //     vector<pair<string,double>> sale;
// //     vector<pair<string,double>> mecaretim;

// //     pair<string,double> kepair1;
// //     pair<string,double> kepair2;


// //     for(int i=0;i<n;i++){
// //         cin>>keptim1>>kepraka1;
// //         kepair1=make_pair(keptim1,kepraka1);
// //         tim.push_back(kepair1);
// //     }

// //     cin>>m;
// //     for(int i=0;i<m;i++){
// //         cin>>kepsale2>>kepraka2;
// //         kepair1=make_pair(kepsale2,kepraka2);
// //         tim.push_back(kepair2);
// //     }

// //     for(int i=0;i<m;i++){
// //         for(int j=0;j<n;j++){

// //            if(sale[i]==tim[j]){
// //             mecaretim.push_back(sale[i]);
// //            }

// //             }
// //         }
    


// //     for(const auto pair : mecaretim) {
// //         cout<< pair.first << pair.second <<endl;
// //     }


// // }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip>

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

   
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;

    
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }

//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
        
//         double totalSales = 0.0;
//         for (auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }

        
//         double maxSales = 0.0;
//         vector<string> topIceCreams;
//         for (auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear();
//                 topIceCreams.push_back(sale.first);
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }

        
//         sort(topIceCreams.begin(), topIceCreams.end());

       
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " ";
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }

//     return 0;
// }


#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip> 

using namespace std;

int main() {
    int N, M;
    cin >> N;

    
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;
    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }
    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        double totalSales = 0.0;
        for (const auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }
        double maxSales = 0.0;
        vector<string> topIceCreams;

        for (const auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear(); 
                topIceCreams.push_back(sale.first); 
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }
        sort(topIceCreams.begin(), topIceCreams.end());

        
        cout << "Total ice cream sales: " << fixed << setprecision(2) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " "; 
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0067, 2024-10-15 13:50:07, PP------- (22%)

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

// // int main()
// // {
// //     int n;
// //     cin>>n;
// //     string T;
// //     double S;
// //     map<string,double> tim;
// //     map<string,double> sale;

// // Ice Cream Sales
// // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // Input data
// // The first line is the integer N
// // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // Line N+2 is the integer M
// // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // Output data
// // If no ice cream was sold, display the message No ice cream sales.
// // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // Example
// // input 
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15
// // 3
// // Cookie 20
// // MamaTomYum 3
// // MangoSheet 10

// // Output
// // No ice cream sales

// // input
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15.00
// // 7
// // Magnum 5
// // Magnum 5
// // Cookie 20
// // MamaTomYum 3
// // PaddlePop 3
// // Cornetto 20
// // AsianDelight 1
// // output
// // Total ice cream sales: 1066.5
// // Top sales: Cornetto Magnum

// // }



// // int main()
// // {
// //     int n,m;
// //     cin>>n;
// //     string keptim1;
// //     double kepraka1;
// //     string kepsale2;
// //     double kepraka2;
// //     vector<pair<string,double>> tim;
// //     vector<pair<string,double>> sale;
// //     vector<pair<string,double>> mecaretim;

// //     pair<string,double> kepair1;
// //     pair<string,double> kepair2;


// //     for(int i=0;i<n;i++){
// //         cin>>keptim1>>kepraka1;
// //         kepair1=make_pair(keptim1,kepraka1);
// //         tim.push_back(kepair1);
// //     }

// //     cin>>m;
// //     for(int i=0;i<m;i++){
// //         cin>>kepsale2>>kepraka2;
// //         kepair1=make_pair(kepsale2,kepraka2);
// //         tim.push_back(kepair2);
// //     }

// //     for(int i=0;i<m;i++){
// //         for(int j=0;j<n;j++){

// //            if(sale[i]==tim[j]){
// //             mecaretim.push_back(sale[i]);
// //            }

// //             }
// //         }
    


// //     for(const auto pair : mecaretim) {
// //         cout<< pair.first << pair.second <<endl;
// //     }


// // }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip>

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

   
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;

    
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }

//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
        
//         double totalSales = 0.0;
//         for (auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }

        
//         double maxSales = 0.0;
//         vector<string> topIceCreams;
//         for (auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear();
//                 topIceCreams.push_back(sale.first);
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }

        
//         sort(topIceCreams.begin(), topIceCreams.end());

       
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " ";
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }

//     return 0;
// }


#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip> 

using namespace std;

int main() {
    int N, M;
    cin >> N;

    
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;
    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }
    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        double totalSales = 0.0;
        for (const auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }
        double maxSales = 0.0;
        vector<string> topIceCreams;

        for (const auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear(); 
                topIceCreams.push_back(sale.first); 
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }
        sort(topIceCreams.begin(), topIceCreams.end());

        
        cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " "; 
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0068, 2024-10-15 13:52:12, -P------- (11%)

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

// // int main()
// // {
// //     int n;
// //     cin>>n;
// //     string T;
// //     double S;
// //     map<string,double> tim;
// //     map<string,double> sale;

// // Ice Cream Sales
// // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // Input data
// // The first line is the integer N
// // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // Line N+2 is the integer M
// // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // Output data
// // If no ice cream was sold, display the message No ice cream sales.
// // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // Example
// // input 
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15
// // 3
// // Cookie 20
// // MamaTomYum 3
// // MangoSheet 10

// // Output
// // No ice cream sales

// // input
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15.00
// // 7
// // Magnum 5
// // Magnum 5
// // Cookie 20
// // MamaTomYum 3
// // PaddlePop 3
// // Cornetto 20
// // AsianDelight 1
// // output
// // Total ice cream sales: 1066.5
// // Top sales: Cornetto Magnum

// // }



// // int main()
// // {
// //     int n,m;
// //     cin>>n;
// //     string keptim1;
// //     double kepraka1;
// //     string kepsale2;
// //     double kepraka2;
// //     vector<pair<string,double>> tim;
// //     vector<pair<string,double>> sale;
// //     vector<pair<string,double>> mecaretim;

// //     pair<string,double> kepair1;
// //     pair<string,double> kepair2;


// //     for(int i=0;i<n;i++){
// //         cin>>keptim1>>kepraka1;
// //         kepair1=make_pair(keptim1,kepraka1);
// //         tim.push_back(kepair1);
// //     }

// //     cin>>m;
// //     for(int i=0;i<m;i++){
// //         cin>>kepsale2>>kepraka2;
// //         kepair1=make_pair(kepsale2,kepraka2);
// //         tim.push_back(kepair2);
// //     }

// //     for(int i=0;i<m;i++){
// //         for(int j=0;j<n;j++){

// //            if(sale[i]==tim[j]){
// //             mecaretim.push_back(sale[i]);
// //            }

// //             }
// //         }
    


// //     for(const auto pair : mecaretim) {
// //         cout<< pair.first << pair.second <<endl;
// //     }


// // }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip>

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

   
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;

    
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }

//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
        
//         double totalSales = 0.0;
//         for (auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }

        
//         double maxSales = 0.0;
//         vector<string> topIceCreams;
//         for (auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear();
//                 topIceCreams.push_back(sale.first);
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }

        
//         sort(topIceCreams.begin(), topIceCreams.end());

       
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " ";
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }

//     return 0;
// }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip> 

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

    
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }
//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
//         double totalSales = 0.0;
//         for (const auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }
//         double maxSales = 0.0;
//         vector<string> topIceCreams;

//         for (const auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear(); 
//                 topIceCreams.push_back(sale.first); 
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }
//         sort(topIceCreams.begin(), topIceCreams.end());

        
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " "; 
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }
//     return 0;
// }

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip> // for setprecision

using namespace std;

int main() {
    int N, M;
    cin >> N;

    // Map to store the price of each ice cream by its name
    map<string, double> iceCreamPrices;

    // Input the ice cream price data
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    // Map to store the total sales amount for each ice cream
    map<string, double> iceCreamSales;

    // Input the sales data
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;

        // Only add to sales if the product is an ice cream in our list
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }

    // Check if any ice cream was sold
    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        // Calculate the total ice cream sales
        double totalSales = 0.0;
        for (const auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }

        // Find the ice cream(s) with the highest sales
        double maxSales = 0.0;
        vector<string> topIceCreams;

        for (const auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear(); // Clear previous top ice creams
                topIceCreams.push_back(sale.first); // Add the new top one
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first); // Add another top seller
            }
        }

        // Sort the top selling ice creams in lexicographical order
        sort(topIceCreams.begin(), topIceCreams.end());

        // Output the total sales and top-selling ice cream names
        cout << "Total ice cream sales: " << fixed << setprecision(2) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " "; // Add space between names
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0069, 2024-10-15 13:52:32, PP------- (22%)

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

// // int main()
// // {
// //     int n;
// //     cin>>n;
// //     string T;
// //     double S;
// //     map<string,double> tim;
// //     map<string,double> sale;

// // Ice Cream Sales
// // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // Input data
// // The first line is the integer N
// // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // Line N+2 is the integer M
// // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // Output data
// // If no ice cream was sold, display the message No ice cream sales.
// // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // Example
// // input 
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15
// // 3
// // Cookie 20
// // MamaTomYum 3
// // MangoSheet 10

// // Output
// // No ice cream sales

// // input
// // 5
// // Magnum 50
// // Cornetto 25
// // PaddlePop 15.50
// // AsianDelight 20
// // Calippo 15.00
// // 7
// // Magnum 5
// // Magnum 5
// // Cookie 20
// // MamaTomYum 3
// // PaddlePop 3
// // Cornetto 20
// // AsianDelight 1
// // output
// // Total ice cream sales: 1066.5
// // Top sales: Cornetto Magnum

// // }



// // int main()
// // {
// //     int n,m;
// //     cin>>n;
// //     string keptim1;
// //     double kepraka1;
// //     string kepsale2;
// //     double kepraka2;
// //     vector<pair<string,double>> tim;
// //     vector<pair<string,double>> sale;
// //     vector<pair<string,double>> mecaretim;

// //     pair<string,double> kepair1;
// //     pair<string,double> kepair2;


// //     for(int i=0;i<n;i++){
// //         cin>>keptim1>>kepraka1;
// //         kepair1=make_pair(keptim1,kepraka1);
// //         tim.push_back(kepair1);
// //     }

// //     cin>>m;
// //     for(int i=0;i<m;i++){
// //         cin>>kepsale2>>kepraka2;
// //         kepair1=make_pair(kepsale2,kepraka2);
// //         tim.push_back(kepair2);
// //     }

// //     for(int i=0;i<m;i++){
// //         for(int j=0;j<n;j++){

// //            if(sale[i]==tim[j]){
// //             mecaretim.push_back(sale[i]);
// //            }

// //             }
// //         }
    


// //     for(const auto pair : mecaretim) {
// //         cout<< pair.first << pair.second <<endl;
// //     }


// // }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip>

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

   
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;

    
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }

//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
        
//         double totalSales = 0.0;
//         for (auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }

        
//         double maxSales = 0.0;
//         vector<string> topIceCreams;
//         for (auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear();
//                 topIceCreams.push_back(sale.first);
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }

        
//         sort(topIceCreams.begin(), topIceCreams.end());

       
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " ";
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }

//     return 0;
// }


// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip> 

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

    
//     map<string, double> iceCreamPrices;
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;
//     map<string, double> iceCreamSales;
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }
//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
//         double totalSales = 0.0;
//         for (const auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }
//         double maxSales = 0.0;
//         vector<string> topIceCreams;

//         for (const auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear(); 
//                 topIceCreams.push_back(sale.first); 
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first);
//             }
//         }
//         sort(topIceCreams.begin(), topIceCreams.end());

        
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " "; 
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }
//     return 0;
// }

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip> // for setprecision

using namespace std;

int main() {
    int N, M;
    cin >> N;

    // Map to store the price of each ice cream by its name
    map<string, double> iceCreamPrices;

    // Input the ice cream price data
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    // Map to store the total sales amount for each ice cream
    map<string, double> iceCreamSales;

    // Input the sales data
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;

        // Only add to sales if the product is an ice cream in our list
        if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
            iceCreamSales[name] += quantity * iceCreamPrices[name];
        }
    }

    // Check if any ice cream was sold
    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        // Calculate the total ice cream sales
        double totalSales = 0.0;
        for (const auto &sale : iceCreamSales) {
            totalSales += sale.second;
        }

        // Find the ice cream(s) with the highest sales
        double maxSales = 0.0;
        vector<string> topIceCreams;

        for (const auto &sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear(); // Clear previous top ice creams
                topIceCreams.push_back(sale.first); // Add the new top one
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first); // Add another top seller
            }
        }

        // Sort the top selling ice creams in lexicographical order
        sort(topIceCreams.begin(), topIceCreams.end());

        // Output the total sales and top-selling ice cream names
        cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            if (i > 0) cout << " "; // Add space between names
            cout << topIceCreams[i];
        }
        cout << endl;
    }

    return 0;
}
# 0070, 2024-10-15 13:55:21, -P------- (11%)

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

int main(){
    int n,each;
    cin>>n;
    string name;
    double cost,total=0,maxx=0,keep;
    map<string,double> info;
    map<string,double> sale;
    for(int i=0; i<n; i++){
        cin>>name>>cost;
        info[name]=cost;
    }
    int m;
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>name>>each;
        if(info.find(name) != info.end()){
            total+=each*info[name];
            keep=each*info[name];
            if(sale.find(name) != sale.end()){
                keep=(sale[name]+each)*info[name];
                sale[name]=keep;
            }
            else{
                sale[name]=keep;
            }
            if(keep>maxx){
                maxx=keep;
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
    }
    else{
        //cout<<"max is"<<maxx<<endl;
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &a : sale){
            if(a.second==maxx){
                cout<<a.first<<' ';
            }
        }
    }
    for(auto &a : sale){
        cout<<a.first<<' '<<a.second<<endl;
    }



}
# 0071, 2024-10-15 13:56:38, PPPPP--PP (77%)

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

// // // int main()
// // // {
// // //     int n;
// // //     cin>>n;
// // //     string T;
// // //     double S;
// // //     map<string,double> tim;
// // //     map<string,double> sale;

// // // Ice Cream Sales
// // // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // // Input data
// // // The first line is the integer N
// // // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // // Line N+2 is the integer M
// // // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // // Output data
// // // If no ice cream was sold, display the message No ice cream sales.
// // // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // // Example
// // // input 
// // // 5
// // // Magnum 50
// // // Cornetto 25
// // // PaddlePop 15.50
// // // AsianDelight 20
// // // Calippo 15
// // // 3
// // // Cookie 20
// // // MamaTomYum 3
// // // MangoSheet 10

// // // Output
// // // No ice cream sales

// // // input
// // // 5
// // // Magnum 50
// // // Cornetto 25
// // // PaddlePop 15.50
// // // AsianDelight 20
// // // Calippo 15.00
// // // 7
// // // Magnum 5
// // // Magnum 5
// // // Cookie 20
// // // MamaTomYum 3
// // // PaddlePop 3
// // // Cornetto 20
// // // AsianDelight 1
// // // output
// // // Total ice cream sales: 1066.5
// // // Top sales: Cornetto Magnum

// // // }



// // // int main()
// // // {
// // //     int n,m;
// // //     cin>>n;
// // //     string keptim1;
// // //     double kepraka1;
// // //     string kepsale2;
// // //     double kepraka2;
// // //     vector<pair<string,double>> tim;
// // //     vector<pair<string,double>> sale;
// // //     vector<pair<string,double>> mecaretim;

// // //     pair<string,double> kepair1;
// // //     pair<string,double> kepair2;


// // //     for(int i=0;i<n;i++){
// // //         cin>>keptim1>>kepraka1;
// // //         kepair1=make_pair(keptim1,kepraka1);
// // //         tim.push_back(kepair1);
// // //     }

// // //     cin>>m;
// // //     for(int i=0;i<m;i++){
// // //         cin>>kepsale2>>kepraka2;
// // //         kepair1=make_pair(kepsale2,kepraka2);
// // //         tim.push_back(kepair2);
// // //     }

// // //     for(int i=0;i<m;i++){
// // //         for(int j=0;j<n;j++){

// // //            if(sale[i]==tim[j]){
// // //             mecaretim.push_back(sale[i]);
// // //            }

// // //             }
// // //         }
    


// // //     for(const auto pair : mecaretim) {
// // //         cout<< pair.first << pair.second <<endl;
// // //     }


// // // }


// // #include <iostream>
// // #include <map>
// // #include <vector>
// // #include <string>
// // #include <algorithm>
// // #include <iomanip>

// // using namespace std;

// // int main() {
// //     int N, M;
// //     cin >> N;

   
// //     map<string, double> iceCreamPrices;
// //     for (int i = 0; i < N; ++i) {
// //         string name;
// //         double price;
// //         cin >> name >> price;
// //         iceCreamPrices[name] = price;
// //     }

// //     cin >> M;
// //     map<string, double> iceCreamSales;

    
// //     for (int i = 0; i < M; ++i) {
// //         string name;
// //         int quantity;
// //         cin >> name >> quantity;
// //         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
// //             iceCreamSales[name] += quantity * iceCreamPrices[name];
// //         }
// //     }

// //     if (iceCreamSales.empty()) {
// //         cout << "No ice cream sales" << endl;
// //     } else {
        
// //         double totalSales = 0.0;
// //         for (auto &sale : iceCreamSales) {
// //             totalSales += sale.second;
// //         }

        
// //         double maxSales = 0.0;
// //         vector<string> topIceCreams;
// //         for (auto &sale : iceCreamSales) {
// //             if (sale.second > maxSales) {
// //                 maxSales = sale.second;
// //                 topIceCreams.clear();
// //                 topIceCreams.push_back(sale.first);
// //             } else if (sale.second == maxSales) {
// //                 topIceCreams.push_back(sale.first);
// //             }
// //         }

        
// //         sort(topIceCreams.begin(), topIceCreams.end());

       
// //         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
// //         cout << "Top sales: ";
// //         for (size_t i = 0; i < topIceCreams.size(); ++i) {
// //             if (i > 0) cout << " ";
// //             cout << topIceCreams[i];
// //         }
// //         cout << endl;
// //     }

// //     return 0;
// // }


// // #include <iostream>
// // #include <map>
// // #include <vector>
// // #include <string>
// // #include <algorithm>
// // #include <iomanip> 

// // using namespace std;

// // int main() {
// //     int N, M;
// //     cin >> N;

    
// //     map<string, double> iceCreamPrices;
// //     for (int i = 0; i < N; ++i) {
// //         string name;
// //         double price;
// //         cin >> name >> price;
// //         iceCreamPrices[name] = price;
// //     }

// //     cin >> M;
// //     map<string, double> iceCreamSales;
// //     for (int i = 0; i < M; ++i) {
// //         string name;
// //         int quantity;
// //         cin >> name >> quantity;
// //         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
// //             iceCreamSales[name] += quantity * iceCreamPrices[name];
// //         }
// //     }
// //     if (iceCreamSales.empty()) {
// //         cout << "No ice cream sales" << endl;
// //     } else {
// //         double totalSales = 0.0;
// //         for (const auto &sale : iceCreamSales) {
// //             totalSales += sale.second;
// //         }
// //         double maxSales = 0.0;
// //         vector<string> topIceCreams;

// //         for (const auto &sale : iceCreamSales) {
// //             if (sale.second > maxSales) {
// //                 maxSales = sale.second;
// //                 topIceCreams.clear(); 
// //                 topIceCreams.push_back(sale.first); 
// //             } else if (sale.second == maxSales) {
// //                 topIceCreams.push_back(sale.first);
// //             }
// //         }
// //         sort(topIceCreams.begin(), topIceCreams.end());

        
// //         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
// //         cout << "Top sales: ";
// //         for (size_t i = 0; i < topIceCreams.size(); ++i) {
// //             if (i > 0) cout << " "; 
// //             cout << topIceCreams[i];
// //         }
// //         cout << endl;
// //     }
// //     return 0;
// // }

// #include <iostream>
// #include <map>
// #include <vector>
// #include <string>
// #include <algorithm>
// #include <iomanip> // for setprecision

// using namespace std;

// int main() {
//     int N, M;
//     cin >> N;

//     // Map to store the price of each ice cream by its name
//     map<string, double> iceCreamPrices;

//     // Input the ice cream price data
//     for (int i = 0; i < N; ++i) {
//         string name;
//         double price;
//         cin >> name >> price;
//         iceCreamPrices[name] = price;
//     }

//     cin >> M;

//     // Map to store the total sales amount for each ice cream
//     map<string, double> iceCreamSales;

//     // Input the sales data
//     for (int i = 0; i < M; ++i) {
//         string name;
//         int quantity;
//         cin >> name >> quantity;

//         // Only add to sales if the product is an ice cream in our list
//         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
//             iceCreamSales[name] += quantity * iceCreamPrices[name];
//         }
//     }

//     // Check if any ice cream was sold
//     if (iceCreamSales.empty()) {
//         cout << "No ice cream sales" << endl;
//     } else {
//         // Calculate the total ice cream sales
//         double totalSales = 0.0;
//         for (const auto &sale : iceCreamSales) {
//             totalSales += sale.second;
//         }

//         // Find the ice cream(s) with the highest sales
//         double maxSales = 0.0;
//         vector<string> topIceCreams;

//         for (const auto &sale : iceCreamSales) {
//             if (sale.second > maxSales) {
//                 maxSales = sale.second;
//                 topIceCreams.clear(); // Clear previous top ice creams
//                 topIceCreams.push_back(sale.first); // Add the new top one
//             } else if (sale.second == maxSales) {
//                 topIceCreams.push_back(sale.first); // Add another top seller
//             }
//         }

//         // Sort the top selling ice creams in lexicographical order
//         sort(topIceCreams.begin(), topIceCreams.end());

//         // Output the total sales and top-selling ice cream names
//         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
//         cout << "Top sales: ";
//         for (size_t i = 0; i < topIceCreams.size(); ++i) {
//             if (i > 0) cout << " "; // Add space between names
//             cout << topIceCreams[i];
//         }
//         cout << endl;
//     }

//     return 0;
// }

#include<iostream>
#include<map>
#include<string>
using namespace std;

int main(){
    int n,each;
    cin>>n;
    string name;
    double cost,total=0,maxx=0,keep;
    map<string,double> info;
    map<string,double> sale;
    for(int i=0; i<n; i++){
        cin>>name>>cost;
        info[name]=cost;
    }
    int m;
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>name>>each;
        if(info.find(name) != info.end()){
            total+=each*info[name];
            keep=each*info[name];
            if(sale.find(name) != sale.end()){
                keep=(sale[name]+each)*info[name];
                sale[name]=keep;
            }
            else{
                sale[name]=keep;
            }
            if(keep>maxx){
                maxx=keep;
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
    }
    else{
        //cout<<"max is"<<maxx<<endl;
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &a : sale){
            if(a.second==maxx){
                cout<<a.first<<' ';
            }
        }
    }


}
# 0072, 2024-10-15 13:58:35, PPPPPPPPP (100%)

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

// // // // int main()
// // // // {
// // // //     int n;
// // // //     cin>>n;
// // // //     string T;
// // // //     double S;
// // // //     map<string,double> tim;
// // // //     map<string,double> sale;

// // // // Ice Cream Sales
// // // // Write a program that reads the prices of different ice creams, followed by the sales of different products in the store, to find and display the total sales of ice creams and the ice cream with the highest sales.
// // // // Input data
// // // // The first line is the integer N
// // // // N The next line is the price data of the ice cream, consisting of the name of the ice cream, followed by the price (real number), separated by spaces.
// // // // Line N+2 is the integer M
// // // // M The next line is the sale of the product, consisting of the name of the ice cream, followed by the quantity sold, separated by spaces.
// // // // Output data
// // // // If no ice cream was sold, display the message No ice cream sales.
// // // // If ice cream was sold, find and display the total sales of the ice cream on one line, followed by a list of the names of the ice creams with the highest sales on another line. If there are more than one name, display the names in dictionary order. (See the display format in the example)


// // // // Example
// // // // input 
// // // // 5
// // // // Magnum 50
// // // // Cornetto 25
// // // // PaddlePop 15.50
// // // // AsianDelight 20
// // // // Calippo 15
// // // // 3
// // // // Cookie 20
// // // // MamaTomYum 3
// // // // MangoSheet 10

// // // // Output
// // // // No ice cream sales

// // // // input
// // // // 5
// // // // Magnum 50
// // // // Cornetto 25
// // // // PaddlePop 15.50
// // // // AsianDelight 20
// // // // Calippo 15.00
// // // // 7
// // // // Magnum 5
// // // // Magnum 5
// // // // Cookie 20
// // // // MamaTomYum 3
// // // // PaddlePop 3
// // // // Cornetto 20
// // // // AsianDelight 1
// // // // output
// // // // Total ice cream sales: 1066.5
// // // // Top sales: Cornetto Magnum

// // // // }



// // // // int main()
// // // // {
// // // //     int n,m;
// // // //     cin>>n;
// // // //     string keptim1;
// // // //     double kepraka1;
// // // //     string kepsale2;
// // // //     double kepraka2;
// // // //     vector<pair<string,double>> tim;
// // // //     vector<pair<string,double>> sale;
// // // //     vector<pair<string,double>> mecaretim;

// // // //     pair<string,double> kepair1;
// // // //     pair<string,double> kepair2;


// // // //     for(int i=0;i<n;i++){
// // // //         cin>>keptim1>>kepraka1;
// // // //         kepair1=make_pair(keptim1,kepraka1);
// // // //         tim.push_back(kepair1);
// // // //     }

// // // //     cin>>m;
// // // //     for(int i=0;i<m;i++){
// // // //         cin>>kepsale2>>kepraka2;
// // // //         kepair1=make_pair(kepsale2,kepraka2);
// // // //         tim.push_back(kepair2);
// // // //     }

// // // //     for(int i=0;i<m;i++){
// // // //         for(int j=0;j<n;j++){

// // // //            if(sale[i]==tim[j]){
// // // //             mecaretim.push_back(sale[i]);
// // // //            }

// // // //             }
// // // //         }
    


// // // //     for(const auto pair : mecaretim) {
// // // //         cout<< pair.first << pair.second <<endl;
// // // //     }


// // // // }


// // // #include <iostream>
// // // #include <map>
// // // #include <vector>
// // // #include <string>
// // // #include <algorithm>
// // // #include <iomanip>

// // // using namespace std;

// // // int main() {
// // //     int N, M;
// // //     cin >> N;

   
// // //     map<string, double> iceCreamPrices;
// // //     for (int i = 0; i < N; ++i) {
// // //         string name;
// // //         double price;
// // //         cin >> name >> price;
// // //         iceCreamPrices[name] = price;
// // //     }

// // //     cin >> M;
// // //     map<string, double> iceCreamSales;

    
// // //     for (int i = 0; i < M; ++i) {
// // //         string name;
// // //         int quantity;
// // //         cin >> name >> quantity;
// // //         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
// // //             iceCreamSales[name] += quantity * iceCreamPrices[name];
// // //         }
// // //     }

// // //     if (iceCreamSales.empty()) {
// // //         cout << "No ice cream sales" << endl;
// // //     } else {
        
// // //         double totalSales = 0.0;
// // //         for (auto &sale : iceCreamSales) {
// // //             totalSales += sale.second;
// // //         }

        
// // //         double maxSales = 0.0;
// // //         vector<string> topIceCreams;
// // //         for (auto &sale : iceCreamSales) {
// // //             if (sale.second > maxSales) {
// // //                 maxSales = sale.second;
// // //                 topIceCreams.clear();
// // //                 topIceCreams.push_back(sale.first);
// // //             } else if (sale.second == maxSales) {
// // //                 topIceCreams.push_back(sale.first);
// // //             }
// // //         }

        
// // //         sort(topIceCreams.begin(), topIceCreams.end());

       
// // //         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
// // //         cout << "Top sales: ";
// // //         for (size_t i = 0; i < topIceCreams.size(); ++i) {
// // //             if (i > 0) cout << " ";
// // //             cout << topIceCreams[i];
// // //         }
// // //         cout << endl;
// // //     }

// // //     return 0;
// // // }


// // // #include <iostream>
// // // #include <map>
// // // #include <vector>
// // // #include <string>
// // // #include <algorithm>
// // // #include <iomanip> 

// // // using namespace std;

// // // int main() {
// // //     int N, M;
// // //     cin >> N;

    
// // //     map<string, double> iceCreamPrices;
// // //     for (int i = 0; i < N; ++i) {
// // //         string name;
// // //         double price;
// // //         cin >> name >> price;
// // //         iceCreamPrices[name] = price;
// // //     }

// // //     cin >> M;
// // //     map<string, double> iceCreamSales;
// // //     for (int i = 0; i < M; ++i) {
// // //         string name;
// // //         int quantity;
// // //         cin >> name >> quantity;
// // //         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
// // //             iceCreamSales[name] += quantity * iceCreamPrices[name];
// // //         }
// // //     }
// // //     if (iceCreamSales.empty()) {
// // //         cout << "No ice cream sales" << endl;
// // //     } else {
// // //         double totalSales = 0.0;
// // //         for (const auto &sale : iceCreamSales) {
// // //             totalSales += sale.second;
// // //         }
// // //         double maxSales = 0.0;
// // //         vector<string> topIceCreams;

// // //         for (const auto &sale : iceCreamSales) {
// // //             if (sale.second > maxSales) {
// // //                 maxSales = sale.second;
// // //                 topIceCreams.clear(); 
// // //                 topIceCreams.push_back(sale.first); 
// // //             } else if (sale.second == maxSales) {
// // //                 topIceCreams.push_back(sale.first);
// // //             }
// // //         }
// // //         sort(topIceCreams.begin(), topIceCreams.end());

        
// // //         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
// // //         cout << "Top sales: ";
// // //         for (size_t i = 0; i < topIceCreams.size(); ++i) {
// // //             if (i > 0) cout << " "; 
// // //             cout << topIceCreams[i];
// // //         }
// // //         cout << endl;
// // //     }
// // //     return 0;
// // // }

// // #include <iostream>
// // #include <map>
// // #include <vector>
// // #include <string>
// // #include <algorithm>
// // #include <iomanip> // for setprecision

// // using namespace std;

// // int main() {
// //     int N, M;
// //     cin >> N;

// //     // Map to store the price of each ice cream by its name
// //     map<string, double> iceCreamPrices;

// //     // Input the ice cream price data
// //     for (int i = 0; i < N; ++i) {
// //         string name;
// //         double price;
// //         cin >> name >> price;
// //         iceCreamPrices[name] = price;
// //     }

// //     cin >> M;

// //     // Map to store the total sales amount for each ice cream
// //     map<string, double> iceCreamSales;

// //     // Input the sales data
// //     for (int i = 0; i < M; ++i) {
// //         string name;
// //         int quantity;
// //         cin >> name >> quantity;

// //         // Only add to sales if the product is an ice cream in our list
// //         if (iceCreamPrices.find(name) != iceCreamPrices.end()) {
// //             iceCreamSales[name] += quantity * iceCreamPrices[name];
// //         }
// //     }

// //     // Check if any ice cream was sold
// //     if (iceCreamSales.empty()) {
// //         cout << "No ice cream sales" << endl;
// //     } else {
// //         // Calculate the total ice cream sales
// //         double totalSales = 0.0;
// //         for (const auto &sale : iceCreamSales) {
// //             totalSales += sale.second;
// //         }

// //         // Find the ice cream(s) with the highest sales
// //         double maxSales = 0.0;
// //         vector<string> topIceCreams;

// //         for (const auto &sale : iceCreamSales) {
// //             if (sale.second > maxSales) {
// //                 maxSales = sale.second;
// //                 topIceCreams.clear(); // Clear previous top ice creams
// //                 topIceCreams.push_back(sale.first); // Add the new top one
// //             } else if (sale.second == maxSales) {
// //                 topIceCreams.push_back(sale.first); // Add another top seller
// //             }
// //         }

// //         // Sort the top selling ice creams in lexicographical order
// //         sort(topIceCreams.begin(), topIceCreams.end());

// //         // Output the total sales and top-selling ice cream names
// //         cout << "Total ice cream sales: " << fixed << setprecision(1) << totalSales << endl;
// //         cout << "Top sales: ";
// //         for (size_t i = 0; i < topIceCreams.size(); ++i) {
// //             if (i > 0) cout << " "; // Add space between names
// //             cout << topIceCreams[i];
// //         }
// //         cout << endl;
// //     }

// //     return 0;
// // }

// #include<iostream>
// #include<map>
// #include<string>
// using namespace std;

// int main(){
//     int n,each;
//     cin>>n;
//     string name;
//     double cost,total=0,maxx=0,keep;
//     map<string,double> info;
//     map<string,double> sale;
//     for(int i=0; i<n; i++){
//         cin>>name>>cost;
//         info[name]=cost;
//     }
//     int m;
//     cin>>m;
//     for(int i=0; i<m; i++){
//         cin>>name>>each;
//         if(info.find(name) != info.end()){
//             total+=each*info[name];
//             keep=each*info[name];
//             if(sale.find(name) != sale.end()){
//                 keep=(sale[name]+each)*info[name];
//                 sale[name]=keep;
//             }
//             else{
//                 sale[name]=keep;
//             }
//             if(keep>maxx){
//                 maxx=keep;
//             }
//         }
//     }
//     if(total==0){
//         cout<<"No ice cream sales";
//     }
//     else{
//         //cout<<"max is"<<maxx<<endl;
//         cout<<"Total ice cream sales: "<<total<<endl;
//         cout<<"Top sales: ";
//         for(auto &a : sale){
//             if(a.second==maxx){
//                 cout<<a.first<<' ';
//             }
//         }
//     }


// }

#include<iostream>
#include<map>
#include<string>
using namespace std;

int main(){
    int n,each;
    cin>>n;
    string name;
    double cost,total=0,maxx=0,keep;
    map<string,double> info;
    map<string,double> sale;
    for(int i=0; i<n; i++){
        cin>>name>>cost;
        info[name]=cost;
    }
    int m;
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>name>>each;
        if(info.find(name) != info.end()){
            keep=each*info[name];
            total+=keep;
            if(sale.find(name) != sale.end()){
                sale[name]+=keep;
            }
            else{
                sale[name]=keep;
            }
            if(sale[name]>maxx){
                maxx=sale[name];
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
    }
    else{
        //cout<<"max is"<<maxx<<endl;
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &a : sale){
            if(a.second==maxx){
                cout<<a.first<<' ';
            }
        }
    }
    



}

# 0073, 2024-10-15 13:31:49, -PP-----P (33%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    double totalSales;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }

    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        int mx = 0;
        for (auto k: soldList) {
            revo.push_back(make_pair(-k.second, k.first));
            sum += priceList[k.first] * k.second;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto r: revo) {
            cout << r.second << ' ';
        }
    }
    
}
# 0074, 2024-10-15 13:32:34, -PP-----P (33%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    double totalSales;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }

    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        int mx = 0;
        for (auto k: soldList) {
            revo.push_back(make_pair(-k.second, k.first));
            sum += priceList[k.first] * k.second;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            count++; if (count > 2) break;
            cout << r.second << ' ';
        }
    }
    
}
# 0075, 2024-10-15 13:36:47, -PPPPPPPP (88%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    double totalSales;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }

    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        double mx = 0;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(-temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (-r.first == mx) cout << r.second << ' ';
        }
    }
    
}
# 0076, 2024-10-15 13:37:23, -PPPPPPPP (88%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    double totalSales;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }

    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        double mx = -99;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(-temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (-r.first == mx) cout << r.second << ' ';
        }
    }
    
}
# 0077, 2024-10-15 13:44:08, -PPPPPPPP (88%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }


    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        double mx = 0;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(-temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (-r.first == mx) cout << r.second << ' ';
        }
    }   
}
# 0078, 2024-10-15 13:48:28, -PPPPPPPP (88%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }
    double sum = 0;
    vector<pair<int, string>> revo;
    double mx = 0;
    for (auto k: soldList) {
        double temp_sum = priceList[k.first] * k.second;
        mx = max(mx, temp_sum);
        revo.push_back(make_pair(-temp_sum, k.first));
        sum += temp_sum;
    }
    if (sum == 0) cout << "No ice cream sales" << endl; 
    else {
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (-r.first == mx) cout << r.second << ' ';
        }   
    }
}
# 0079, 2024-10-15 13:50:40, -PPP---PP (55%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }


    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<int, string>> revo;
        double mx = 0;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.rbegin(), revo.rend());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (r.first == mx) cout << r.second << ' ';
        }
    }   
}
# 0080, 2024-10-15 13:51:34, PPPP---PP (66%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }


    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<double, string>> revo;
        double mx = 0;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.rbegin(), revo.rend());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (r.first == mx) cout << r.second << ' ';
        }
    }   
}
# 0081, 2024-10-15 13:52:20, PPPPPPPPP (100%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    map<string, double> priceList;
    map<string, int> soldList;
    int i; cin >> i;
    double price; string iceCream;
    while (i--) {
        cin >> iceCream >> price;
        priceList[iceCream] = price;
    }
    int sold; cin >> sold;
    double totalSales;
    int amount; string item;
    while (sold--) {
        cin >> item >> amount;
        if (priceList.find(item) != priceList.end()){
            if (soldList.find(item) == soldList.end()) {
                 soldList[item] = 0;
            }
            soldList[item] += amount;
        }
    }

    if (soldList.empty()) cout << "No ice cream sales" << endl;
    else {
        double sum = 0;
        vector<pair<double, string>> revo;
        double mx = -99;
        for (auto k: soldList) {
            double temp_sum = priceList[k.first] * k.second;
            mx = max(mx, temp_sum);
            revo.push_back(make_pair(-temp_sum, k.first));
            sum += temp_sum;
        }
        sort(revo.begin(), revo.end());
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int count = 0;
        for (auto r: revo) {
            if (-r.first == mx) cout << r.second << ' ';
        }
    }
    
}

# 0082, 2024-10-15 13:41:35, -PP-PPP-P (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0083, 2024-10-15 13:43:03, -PP-PPP-P (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales ";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0084, 2024-10-15 13:43:15, --P-PPP-P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "Nah";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0085, 2024-10-15 13:43:27, -PP-PPP-P (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0086, 2024-10-15 13:43:41, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        //cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0087, 2024-10-15 13:43:53, -PP-PPP-P (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0088, 2024-10-15 13:46:54, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales:" << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0089, 2024-10-15 13:47:05, -PP-PPP-P (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[1].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}
# 0090, 2024-10-15 13:47:33, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,amount;
    string name;
    double price,total=0;
    map<string,double> pricelist;
    map<string,int> selllist;
    vector<pair<string,double>> sales;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> name >> price;
        pricelist.insert({name,price});
    }
    cin >> m;
    for(i=0;i<m;i++){
        cin >> name >> amount;
        if(pricelist.find(name)!=pricelist.end()){
            if(selllist.find(name)==selllist.end()){
                selllist.insert({name,amount});
            }
            else{
                selllist[name]=selllist[name]+amount;
            }
        }
    }
    auto it=selllist.begin();
    for(i=0;i<selllist.size();i++){
        sales.push_back({(*it).first,((*it).second)*(*(pricelist.find((*it).first))).second});
        it++;
    }
    sort(sales.begin(),sales.end(),[](const pair<string,double> &a, const pair<string,double> &b){
        if(a.second==b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });
    if(sales.size()==0){
        cout << "No ice cream sales";
    }
    else{
        for(i=0;i<sales.size();i++){
            total=total+sales[i].second;
        }
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales:";
        i=0;
        while(1){
            if(sales[i].second<sales[0].second){
                break;
            }
            cout << " " << sales[i].first;
            i++;
            if(i==sales.size()){
                break;
            }
        }
    }
}

# 0091, 2024-10-15 13:25:44, Compilation error (0%)

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    string iceCreamNames[100];
    double iceCreamPrices[100];

  
    for (int i = 0; i < N; ++i) {
        cin >> ws; 
        getline(cin, iceCreamNames[i], ' '); 
        cin >> iceCreamPrices[i]; 
    }

    cin >> M;

   
    double totalSales = 0;
    string soldIceCreams[100];
    int soldQuantities[100] = {0};
    int soldCount = 0; 

   
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> ws;
        getline(cin, product, ' '); 
        cin >> quantity;

       กรีมหรือไม่
        for (int j = 0; j < N; ++j) {
            if (iceCreamNames[j] == product) {
                totalSales += iceCreamPrices[j] * quantity; 
                soldQuantities[j] += quantity; 
                if (soldQuantities[j] == quantity) {
                    soldIceCreams[soldCount++] = product; 
                }
                break;
            }
        }
    }

    if (soldCount == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << totalSales << endl;

        int maxSalesIndex = 0;
        for (int i = 1; i < N; ++i) {
            if (soldQuantities[i] > soldQuantities[maxSalesIndex]) {
                maxSalesIndex = i;
            }
        }


        cout << iceCreamNames[maxSalesIndex] << endl;

      
        for (int i = 0; i < N; ++i) {
            if (soldQuantities[i] == soldQuantities[maxSalesIndex] && i != maxSalesIndex) {
                cout << iceCreamNames[i] << endl;
            }
        }
    }

    return 0;
}
# 0092, 2024-10-15 13:26:02, Compilation error (0%)

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    string iceCreamNames[100];
    double iceCreamPrices[100];

  
    for (int i = 0; i < N; ++i) {
        cin >> ws; 
        getline(cin, iceCreamNames[i], ' '); 
        cin >> iceCreamPrices[i]; 
    }

    cin >> M;

   
    double totalSales = 0;
    string soldIceCreams[100];
    int soldQuantities[100] = {0};
    int soldCount = 0; 

   
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> ws;
        getline(cin, product, ' '); 
        cin >> quantity;

       กรีมหรือไม่
        for (int j = 0; j < N; ++j) {
            if (iceCreamNames[j] == product) {
                totalSales += iceCreamPrices[j] * quantity; 
                soldQuantities[j] += quantity; 
                if (soldQuantities[j] == quantity) {
                    soldIceCreams[soldCount++] = product; 
                }
                break;
            }
        }
    }

    if (soldCount == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << totalSales << endl;

        int maxSalesIndex = 0;
        for (int i = 1; i < N; ++i) {
            if (soldQuantities[i] > soldQuantities[maxSalesIndex]) {
                maxSalesIndex = i;
            }
        }


        cout << iceCreamNames[maxSalesIndex] << endl;

      
        for (int i = 0; i < N; ++i) {
            if (soldQuantities[i] == soldQuantities[maxSalesIndex] && i != maxSalesIndex) {
                cout << iceCreamNames[i] << endl;
            }
        }
    }

    return 0;
}
# 0093, 2024-10-15 13:26:39, -P------x (11%)

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    string iceCreamNames[100];
    double iceCreamPrices[100];

  
    for (int i = 0; i < N; ++i) {
        cin >> ws; 
        getline(cin, iceCreamNames[i], ' '); 
        cin >> iceCreamPrices[i]; 
    }

    cin >> M;

   
    double totalSales = 0;
    string soldIceCreams[100];
    int soldQuantities[100] = {0};
    int soldCount = 0; 

   
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> ws;
        getline(cin, product, ' '); 
        cin >> quantity;

        for (int j = 0; j < N; ++j) {
            if (iceCreamNames[j] == product) {
                totalSales += iceCreamPrices[j] * quantity; 
                soldQuantities[j] += quantity; 
                if (soldQuantities[j] == quantity) {
                    soldIceCreams[soldCount++] = product; 
                }
                break;
            }
        }
    }

    if (soldCount == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << totalSales << endl;

        int maxSalesIndex = 0;
        for (int i = 1; i < N; ++i) {
            if (soldQuantities[i] > soldQuantities[maxSalesIndex]) {
                maxSalesIndex = i;
            }
        }


        cout << iceCreamNames[maxSalesIndex] << endl;

      
        for (int i = 0; i < N; ++i) {
            if (soldQuantities[i] == soldQuantities[maxSalesIndex] && i != maxSalesIndex) {
                cout << iceCreamNames[i] << endl;
            }
        }
    }

    return 0;
}
# 0094, 2024-10-15 13:29:39, PPPP----x (44%)

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    string iceCreamNames[100];
    double iceCreamPrices[100];

  
    for (int i = 0; i < N; ++i) {
        cin >> ws; 
        getline(cin, iceCreamNames[i], ' '); 
        cin >> iceCreamPrices[i]; 
    }

    cin >> M;

   
    double totalSales = 0;
    string soldIceCreams[100];
    int soldQuantities[100] = {0};
    int soldCount = 0; 

   
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> ws;
        getline(cin, product, ' '); 
        cin >> quantity;

        for (int j = 0; j < N; ++j) {
            if (iceCreamNames[j] == product) {
                totalSales += iceCreamPrices[j] * quantity; 
                soldQuantities[j] += quantity; 
                if (soldQuantities[j] == quantity) {
                    soldIceCreams[soldCount++] = product; 
                }
                break;
            }
        }
    }

    if (soldCount == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: "<< totalSales << endl;

        int maxSalesIndex = 0;
        for (int i = 1; i < N; ++i) {
            if (soldQuantities[i] > soldQuantities[maxSalesIndex]) {
                maxSalesIndex = i;
            }
        }


        cout << "Top sales: "<< iceCreamNames[maxSalesIndex] << endl;

      
        for (int i = 0; i < N; ++i) {
            if (soldQuantities[i] == soldQuantities[maxSalesIndex] && i != maxSalesIndex) {
                cout <<iceCreamNames[i] << endl;
            }
        }
    }

    return 0;
}
# 0095, 2024-10-15 13:30:18, PPPP----x (44%)

#include <iostream>
#include <string>
using namespace std;

int main() {
    int N, M;
    cin >> N;

   
    string iceCreamNames[100];
    double iceCreamPrices[100];

  
    for (int i = 0; i < N; ++i) {
        cin >> ws; 
        getline(cin, iceCreamNames[i], ' '); 
        cin >> iceCreamPrices[i]; 
    }

    cin >> M;

   
    double totalSales = 0;
    string soldIceCreams[100];
    int soldQuantities[100] = {0};
    int soldCount = 0; 

   
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> ws;
        getline(cin, product, ' '); 
        cin >> quantity;

        for (int j = 0; j < N; ++j) {
            if (iceCreamNames[j] == product) {
                totalSales += iceCreamPrices[j] * quantity; 
                soldQuantities[j] += quantity; 
                if (soldQuantities[j] == quantity) {
                    soldIceCreams[soldCount++] = product; 
                }
                break;
            }
        }
    }

    if (soldCount == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: "<< totalSales << endl;

        int maxSalesIndex = 0;
        for (int i = 1; i < N; ++i) {
            if (soldQuantities[i] > soldQuantities[maxSalesIndex]) {
                maxSalesIndex = i;
            }
        }


        cout << "Top sales: "<< iceCreamNames[maxSalesIndex] << endl;

      
        for (int i = 0; i < N; ++i) {
            if (soldQuantities[i] == soldQuantities[maxSalesIndex] && i != maxSalesIndex) {
                cout << "Top sales: "<<iceCreamNames[i] << endl;
            }
        }
    }

    return 0;
}
# 0096, 2024-10-15 13:34:36, PP------- (22%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    // เก็บราคาของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    // เก็บยอดขายของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> product >> quantity;

        // เช็คว่าเป็นไอศกรีมหรือไม่
        if (iceCreamPrices.find(product) != iceCreamPrices.end()) {
            iceCreamSales[product] += quantity * iceCreamPrices[product];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        // คำนวณยอดขายรวม
        double totalSales = 0;
        for (const auto& sale : iceCreamSales) {
            totalSales += sale.second;
        }

        // หายอดขายสูงสุด
        double maxSales = 0;
        vector<string> topIceCreams;
        for (const auto& sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }

        // เรียงชื่อไอศกรีมตามลำดับพจนานุกรม
        sort(topIceCreams.begin(), topIceCreams.end());

        // แสดงผลลัพธ์
        cout << fixed << setprecision(1);
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales:";
        for (const string& name : topIceCreams) {
            cout << " " << name;
        }
        cout << endl;
    }

    return 0;
}
# 0097, 2024-10-15 13:34:55, PP------- (22%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    // เก็บราคาของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    // เก็บยอดขายของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> product >> quantity;

        // เช็คว่าเป็นไอศกรีมหรือไม่
        if (iceCreamPrices.find(product) != iceCreamPrices.end()) {
            iceCreamSales[product] += quantity * iceCreamPrices[product];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        // คำนวณยอดขายรวม
        double totalSales = 0;
        for (const auto& sale : iceCreamSales) {
            totalSales += sale.second;
        }

        // หายอดขายสูงสุด
        double maxSales = 0;
        vector<string> topIceCreams;
        for (const auto& sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }

        // เรียงชื่อไอศกรีมตามลำดับพจนานุกรม
        sort(topIceCreams.begin(), topIceCreams.end());

        // แสดงผลลัพธ์
        cout << fixed << setprecision(1);
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        for (const string& name : topIceCreams) {
            cout << " " << name;
        }
        cout << endl;
    }

    return 0;
}
# 0098, 2024-10-15 13:37:56, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    // เก็บราคาของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    // เก็บยอดขายของไอศกรีมแต่ละชนิด
    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> product >> quantity;

        // เช็คว่าเป็นไอศกรีมหรือไม่
        if (iceCreamPrices.find(product) != iceCreamPrices.end()) {
            iceCreamSales[product] += quantity * iceCreamPrices[product];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        // คำนวณยอดขายรวม
        double totalSales = 0;
        for (const auto& sale : iceCreamSales) {
            totalSales += sale.second;
        }

        // หายอดขายสูงสุด
        double maxSales = 0;
        vector<string> topIceCreams;
        for (const auto& sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }

        // เรียงชื่อไอศกรีมตามลำดับพจนานุกรม
        sort(topIceCreams.begin(), topIceCreams.end());

        // แสดงผลลัพธ์
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales:";
        for (const string& name : topIceCreams) {
            cout << " " << name;
        }
        cout << endl;
    }

    return 0;
}
# 0099, 2024-10-15 13:39:59, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;

    map<string, double> iceCreamSales;
    for (int i = 0; i < M; ++i) {
        string product;
        int quantity;
        cin >> product >> quantity;

        if (iceCreamPrices.find(product) != iceCreamPrices.end()) {
            iceCreamSales[product] += quantity * iceCreamPrices[product];
        }
    }

    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        double totalSales = 0;
        for (const auto& sale : iceCreamSales) {
            totalSales += sale.second;
        }

        double maxSales = 0;
        vector<string> topIceCreams;
        for (const auto& sale : iceCreamSales) {
            if (sale.second > maxSales) {
                maxSales = sale.second;
                topIceCreams.clear();
                topIceCreams.push_back(sale.first);
            } else if (sale.second == maxSales) {
                topIceCreams.push_back(sale.first);
            }
        }
        sort(topIceCreams.begin(), topIceCreams.end());

        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales:";
        for (const string& name : topIceCreams) {
            cout << " " << name;
        }
        cout << endl;
    }

    return 0;
}

# 0100, 2024-10-15 13:31:30, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold,sum=0,e=0;
    cin>>n;
    string name;
    double price,max=0,c;
    map<string,double> icecream,sales;
    map<double,string> top;
    while(n--){
        cin>>name>>price;
        icecream[name]=price;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        c=sold*icecream[name];
        sales[name]+=c;
        sum+=c;
        if(c>max) max=c;
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0101, 2024-10-15 13:34:17, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold,e=0;
    cin>>n;
    string name;
    double p,max=0,c,sum=0;
    map<string,double> price,sales;
    map<double,string> top;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        c=sold*price[name];
        sales[name]+=c;
        sum+=c;
        if(c>max) max=c;
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0102, 2024-10-15 13:41:30, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold,e=0;
    cin>>n;
    string name;
    double p,max=0,c=0,sum=0;
    map<string,double> price,sales;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        c=sold*price[name];
        sales[name]+=c;
        sum+=c;
        if(c>max) max=c;
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0103, 2024-10-15 13:44:17, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold,e=0;
    cin>>n;
    string name;
    double p,max=0,c=0,sum=0;
    map<string,double> price,sales;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        if(price.find(name)!=price.end()){
            c=sold*price[name];
            sales[name]+=c;
            sum+=c;
            if(c>max) max=c;
        }
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0104, 2024-10-15 13:53:13, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold;
    cin>>n;
    string name;
    double p,max=0,c=0,sum=0;
    map<string,double> price,sales;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        if(price.count(name)){
            c=sold*price[name];
            sales[name]+=c;
            sum+=c;
            if(c>max) max=c;
        }
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0105, 2024-10-15 13:54:53, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold;
    cin>>n;
    string name;
    double p,max=0,c=0,sum=0;
    map<string,double> price,sales;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        if(price.count(name)){
            c=sold*price[name];
            sales[name]+=c;
            sum+=c;
            if(c>max) max=c;
        }
    }
    if(max==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}
# 0106, 2024-10-15 13:55:39, PPPPPPPPP (100%)

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

int main(){
  int n,amout;
  map<string,pair<double,double>> list;
  double max_sale = 0,price,all_sale = 0;
  string id;
  cin >> n;
  while(n--){
    cin>> id >> price;
    list[id].first = price;
  }
  cin >> n;
  while(n--){
    cin >> id >> amout;
    if(!list.count(id))continue;
    list[id].second += list[id].first*amout;
  }
  for(auto &x:list){
    if(x.second.second > max_sale)max_sale = x.second.second;
    all_sale +=x.second.second;
  }
  if(max_sale){
    cout << "Total ice cream sales: "<< all_sale << endl;
    cout << "Top sales:";
    for(auto &x:list){
      if(x.second.second == max_sale)cout <<" "<< x.first;
    }
  }
  else{
    cout << "No ice cream sales";
  }
  
}
# 0107, 2024-10-15 14:02:18, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m,sold;
    cin>>n;
    string name;
    double p,max=0,c=0,sum=0;
    map<string,double> price,sales;
    while(n--){
        cin>>name>>p;
        price[name]=p;
        sales[name]=0;
    }
    cin>>m;
    while(m--){
        cin>>name>>sold;
        if(price.count(name)){
            c=sold*price[name];
            sales[name]+=c;
            sum+=c;
            if(sales[name]>max) max=sales[name];
        }
    }
    if(sum==0) cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(pair e:sales){
            if(e.second==max) cout<<e.first<<" ";
        }
    }
}

# 0108, 2024-10-15 13:27:10, -PPPP---T (44%)

#include <iostream>
#include <map>

using namespace std;

map<string, double> m,sumice;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    int maxx = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        for(auto a : m){
            if(a.first == icecream2){
                sum += m[icecream2]*amount;
                sumice[icecream2] += m[icecream2]*amount;
                m[icecream2]*amount > maxx ? maxx =  m[icecream2]*amount : maxx = maxx;
            }
        }
    }
    // for(auto a : sumice){
    //     cout << a.first << " " << a.second << '\n';
    // } 
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        bool first = 1;
        for(auto a : sumice){
            if(a.second == maxx) cout << a.first << " ";
        }        
    }
    
}
# 0109, 2024-10-15 13:34:16, -PPPP---P (55%)

#include <iostream>
#include <map>

using namespace std;

map<string, double> m,sumice;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    int maxx = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
        m[icecream2]*amount > maxx ? maxx =  m[icecream2]*amount : maxx = maxx;
                
    }
    
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        bool first = 1;
        for(auto a : sumice){
            if(a.second == maxx) cout << a.first << " ";
        }        
    }
    
}
# 0110, 2024-10-15 13:36:43, -PPPP---P (55%)

#include <iostream>
#include <map>

using namespace std;

map<string, double> m,sumice;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    int maxx = -1e3;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
        if(maxx < m[icecream2]*amount) maxx = m[icecream2]*amount;
                
    }
    
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : sumice){
            if(a.second == maxx) cout << a.first << " ";
        }        
    }
    
}
# 0111, 2024-10-15 13:42:21, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

map<string, double> m,sumice;
vector<string> v;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    int maxx = -1e3;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
        if(maxx < m[icecream2]*amount) maxx = m[icecream2]*amount;
                
    }
    for(auto a : sumice) if(a.second == maxx) v.push_back(a.first);

    sort(v.begin(), v.end());
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : v) cout << a << " ";
    }
    
}
# 0112, 2024-10-15 13:46:40, -PPPPPPPP (88%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

map<string, double> m,sumice;
vector<string> v;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
    }

    int maxx = -1e3;
    for(auto a : sumice) if(maxx < a.second) maxx = a.second;    

    for(auto a : sumice) if(a.second == maxx) v.push_back(a.first);

    sort(v.begin(), v.end());
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : v) cout << a << " ";
    }
    
}
# 0113, 2024-10-15 13:48:14, -PPPPPPPP (88%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

map<string, double> m,sumice;
vector<string> v;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
    }

    int maxx = -1e3;
    for(auto a : sumice) if(maxx < a.second) maxx = a.second;    

    for(auto a : sumice) if(a.second == maxx) v.push_back(a.first);

    sort(v.begin(), v.end());
    if(sum == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : v) cout << a << " ";
    }
    
}
# 0114, 2024-10-15 13:49:09, -PPPPPPPP (88%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

map<string, double> m,sumice;
vector<string> v;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
    }

    int maxx = -1e3;
    for(auto a : sumice) if(maxx < a.second) maxx = a.second;    

    for(auto a : sumice) if(a.second == maxx) v.push_back(a.first);

    sort(v.begin(), v.end());
    if(sum > 0){
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : v) cout << a << " ";
    }else{
        cout << "No ice cream sales";
    }
}
# 0115, 2024-10-15 13:52:50, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

map<string, double> m,sumice;
vector<string> v;
int main(){
    int a;
    cin >> a;
    for(int i=0; i<a; i++){
        string icecream;
        double price;
        cin >> icecream >> price;
        m[icecream] = price;
    }
    
    int b;
    cin >> b;
    double sum = 0;
    for(int i=0; i<b; i++){
        string icecream2;
        double amount;
        cin >> icecream2 >> amount;
        
        sum += m[icecream2]*amount;
        sumice[icecream2] += m[icecream2]*amount;
    }

    double maxx = -1e3;
    for(auto a : sumice) if(maxx < a.second) maxx = a.second;    

    for(auto a : sumice) if(a.second == maxx) v.push_back(a.first);

    sort(v.begin(), v.end());
    if(sum > 0){
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales: ";
        for(auto a : v) cout << a << " ";
    }else{
        cout << "No ice cream sales";
    }
}

# 0116, 2024-10-15 13:22:29, -P------- (11%)

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

int main() {
	// your code goes here
map<string,double> m;
double t1,t2,thb;
string ice;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
map<string,double> m2;
string ice2;
int thb2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
double sum = 0;
vector<pair<double,string>> v;
for(auto it : m) {
    m[it.first] = it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
set<string> s;
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
for(auto it : s) {
    cout<<it<<" ";
}
}
# 0117, 2024-10-15 13:23:23, PPPPPPPPP (100%)

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

int main() {
	// your code goes here
map<string,double> m;
double t1,t2,thb;
string ice;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
map<string,double> m2;
string ice2;
int thb2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
double sum = 0;
vector<pair<double,string>> v;
for(auto it : m) {
    m[it.first] = it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
set<string> s;
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
cout<<"Top sales: ";
for(auto it : s) {
    cout<<it<<" ";
}
}
# 0118, 2024-10-15 13:25:16, PPPPPPPPP (100%)

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

int main() {
map<string,double> m,m2;
vector<pair<double,string>> v;
double t1,t2,thb,thb2,sum = 0;
set<string> s;
string ice,ice2;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
for(auto it : m) {
    m[it.first] = it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
cout<<"Top sales: ";
for(auto it : s) {
    cout<<it<<" ";
}
}
# 0119, 2024-10-15 13:27:00, PPPPPPPPP (100%)

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

int main() {
map<string,double> m,m2;
vector<pair<double,string>> v;
double t1,t2,thb,thb2,sum = 0;
set<string> s;
string ice,ice2;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
for(auto it : m) {
    m[it.first] = it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
cout<<"Top sales: ";
for(auto it : s) {
    cout<<it<<" ";
}
}
# 0120, 2024-10-15 13:35:16, --------- (0%)

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

int main() {
map<string,double> m,m2;
vector<pair<double,string>> v;
double t1,t2,thb,thb2,sum = 0;
set<string> s;
string ice,ice2;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
for(auto it : m) {
    m[it.first] += it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
cout<<"Top sales: ";
for(auto it : s) {
    cout<<it<<" ";
}
}
# 0121, 2024-10-15 13:35:27, PPPPPPPPP (100%)

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

int main() {
map<string,double> m,m2;
vector<pair<double,string>> v;
double t1,t2,thb,thb2,sum = 0;
set<string> s;
string ice,ice2;
cin>>t1;
while(t1--) {
    cin>>ice>>thb;
    m[ice] = thb;
}
cin>>t2;
while(t2--) {
    cin>>ice2>>thb2;
    m2[ice2] += thb2;
}
for(auto it : m) {
    m[it.first] = it.second*m2[it.first];
    sum += m[it.first];
    v.push_back(make_pair(m[it.first],it.first));
}
sort(v.rbegin(),v.rend());
if(sum == 0) {
    cout<<"No ice cream sales";
    return 0;
}
cout<<"Total ice cream sales: "<<sum<<'\n';
for(int i = 0 ; i < v.size() ; i++) {
    if(v[i].first == v[0].first) s.insert(v[i].second);
}
cout<<"Top sales: ";
for(auto it : s) {
    cout<<it<<" ";
}
}

# 0122, 2024-10-15 13:28:33, -P------T (11%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		
		for(auto &x:sumice){
			if(x.second == *max_element(check.begin(), check.end())){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}
# 0123, 2024-10-15 13:29:35, PPPPPPPPT (88%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		cout<<"Top sales: ";
		
		for(auto &x:sumice){
			if(x.second == *max_element(check.begin(), check.end())){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}
# 0124, 2024-10-15 13:33:36, PPPPPPPPT (88%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		cout<<"Top sales: ";
		
		for(auto &x:sumice){
			if(x.second == *max_element(check.begin(), check.end())){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}
# 0125, 2024-10-15 13:37:44, -PPPP---P (55%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	double max = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
		if(max < ice[nn] * xx){
			max = ice[nn] * xx;
		}
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		cout<<"Top sales: ";
		
		for(auto &x:sumice){
			if(x.second == max){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}
# 0126, 2024-10-15 13:39:48, -PPPP---P (55%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	double max = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
		if(max < (ice[nn] * xx)) {
			max = ice[nn] * xx;
		}
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		cout<<"Top sales: ";
		
		for(auto &x:sumice){
			if(x.second == max){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}
# 0127, 2024-10-15 13:41:59, PPPPPPPPP (100%)

#include<bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin>>n;
	
	map<string, double> ice;
	
	map<string, double> sumice;
	
	while(n--){
		string nice;
		double p;
		cin>>nice>>p;
		
		ice[nice] = p;
		sumice[nice] = 0;
	}
	
	double sum = 0;
	
	double max = 0;
	
	int m;
	cin>>m;
	while(m--){
		string nn;
		double xx;
		cin>>nn>>xx;
		
		sum += ice[nn] * xx;
		sumice[nn] += ice[nn] * xx;
		if(max < sumice[nn]) {
			max = sumice[nn];
		}
	}
	
	vector<double> check;
	for(auto &ss:sumice){
		check.push_back(ss.second);
	}
	
	if(sum == 0){
		cout<<"No ice cream sales";
	}
	else{
		cout<<"Total ice cream sales: "<<sum<<endl;
		cout<<"Top sales: ";
		
		for(auto &x:sumice){
			if(x.second == max){
				cout<<x.first<<' ';
			}
		}
		
	}
	
	return 0;
}

# 0128, 2024-10-15 13:48:32, -P------- (11%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, int> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }

    cin >> m;

    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            for (auto sale : sales) {
                if (sale.second == ice)
                {
                    sold = true;
                    sale.first -= icecraem[ice] * amount;
                    sum += sale.first;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += -icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << -sum << endl;
        for (auto sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second;
            }
        }
    }
    
    

}
# 0129, 2024-10-15 13:51:57, -P------- (11%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, double> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }

    cin >> m;

    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            for (auto &sale : sales) {
                if (sale.second == ice)
                {
                    sold = true;
                    sale.first -= icecraem[ice] * amount;
                    sum += -icecraem[ice] * amount;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += -icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << -sum << endl;
        for (auto &sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second << " ";
            }
        }
    }
}
# 0130, 2024-10-15 13:53:13, PP---PPP- (55%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, double> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }

    cin >> m;

    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            for (auto &sale : sales) {
                if (sale.second == ice)
                {
                    sold = true;
                    sale.first -= icecraem[ice] * amount;
                    sum += -icecraem[ice] * amount;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += -icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << -sum << endl << "Top sales: ";
        for (auto &sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second << " ";
            }
        }
    }
}
# 0131, 2024-10-15 13:55:30, PP---PPP- (55%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, double> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }

    cin >> m;

    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            for (auto &sale : sales) {
                if (sale.second == ice)
                {
                    sold = true;
                    sale.first -= icecraem[ice] * amount;
                    sum += icecraem[ice] * amount;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for (auto &sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second << " ";
            }
        }
    }
}
# 0132, 2024-10-15 13:57:37, PPPPPPPPP (100%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, double> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }

    cin >> m;

    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            for (auto &sale : sales) {
                if (sale.second == ice)
                {
                    sold = true;
                    sale.first -= icecraem[ice] * amount;
                    sum += icecraem[ice] * amount;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sold = true;
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for (auto &sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second << " ";
            }
        }
    }
}
# 0133, 2024-10-15 13:58:49, PPPPPPPPP (100%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main(){

    int n, m;
    map<string, double> icecraem;
    vector<pair<double, string>> sales;
    string ice;
    double price, amount, sum = 0;
    bool sold = false;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> ice >> price;
        icecraem[ice] = price;
    }
    
    cin >> m;
    for (int i = 0; i < m; i++)
    {
        cin >> ice >> amount;
        if (icecraem.find(ice) != icecraem.end())
        {
            bool found = false;
            sold = true;
            for (auto &sale : sales) {
                if (sale.second == ice)
                {
                    sale.first -= icecraem[ice] * amount;
                    sum += icecraem[ice] * amount;
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                sales.push_back(make_pair(-icecraem[ice] * amount, ice));
                sum += icecraem[ice] * amount;
            }
        }
    }
    if (!sold)
    {
        cout << "No ice cream sales";
    }
    else
    {
        sort(sales.begin(), sales.end());
        double max = sales[0].first;
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for (auto &sale : sales)
        {
            if (sale.first == max)
            {
                cout << sale.second << " ";
            }
        }
    }
}

# 0134, 2024-10-15 13:45:16, PPPP---PP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (int i = 0; i < v.size(); i++){
            int max = v[0].first;
            if (v[i].first==max){
                cout<<v[i].second<<" ";
            }
            else{
                break;
            }
            
        }
        
    }

}
# 0135, 2024-10-15 13:46:45, PPPP---PP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                        break;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (int i = 0; i < v.size(); i++){
            int max = v[0].first;
            if (v[i].first==max){
                cout<<v[i].second<<" ";
            }
            else{
                break;
            }
            
        }
        
    }

}
# 0136, 2024-10-15 13:47:26, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                        break;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (int i = 0; i < v.size(); i++){
            int max = v[0].first;
            if (v[i].first==max){
            }
            else{
                break;
            }
            
        }
        
    }

}
# 0137, 2024-10-15 13:47:51, PPPP---PP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                        break;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (int i = 0; i < v.size(); i++){
            int max = v[0].first;
            if (v[i].first==max){
                cout<<v[i].second;
            }
            else{
                break;
            }
            
        }
        
    }

}
# 0138, 2024-10-15 13:51:01, PPPP---PP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                        break;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    string out;
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (int i = 0; i < v.size(); i++){
            int max = v[0].first;
            if (v[i].first==max){
                out = out+v[i].second+" ";
            }
            else{
                break;
            }
            
        }
        out.pop_back();
        cout<<out<<endl;
    }

}
# 0139, 2024-10-15 14:02:04, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice_sale;
    int in;
    cin>>in;
    string cmd;
    double d;
    while (in--){
        cin>>cmd;
        cin>>d;
        ice_sale[cmd]=d;
    }
    int k;
    double temp,total=0;
    vector<pair<int,string>> v;
    set<string> s;
    cin>>k;
    while (k--){
        cin>>cmd>>d;
        temp=total;
        total += (ice_sale[cmd])*d;
        if (temp!=total){
            if (s.count(cmd)){
                for (auto &a:v){
                    if (a.second==cmd){
                        a.first+=(ice_sale[cmd])*d;
                        break;
                    }
                    
                }
                
            }
            else{
                v.push_back(make_pair((ice_sale[cmd])*d,cmd));
            }
        }
        s.insert(cmd);
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end()); 
    vector<pair<string,int>> v2;
    int max = v[0].first;
    for (int i = 0; i < v.size(); i++){
        if (v[i].first==max){
            v2.push_back(make_pair(v[i].second,v[i].first));
        }
        
    }
    sort(v2.begin(),v2.end());

    string out;
    if (total==0){
        cout<<"No ice cream sales"<<endl;
    }
    else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for (auto b:v2){
            out=out+b.first+" ";
        }
        out.pop_back();
        cout<<out<<endl;
    }

}

# 0140, 2024-10-15 13:40:47, Compilation error (0%)

#include <iostream>
#include <map>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic[tmp_name] > 0)
            sales[tmp_name] = sales[tmp_name] + (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Total sales: ";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << i.first << " ";
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}
# 0141, 2024-10-15 13:41:06, -P------- (11%)

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic[tmp_name] > 0)
            sales[tmp_name] = sales[tmp_name] + (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Total sales: ";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << i.first << " ";
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}
# 0142, 2024-10-15 13:46:20, -P------- (11%)

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    if (a.second == b.second)
        return a.first > b.first;
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic[tmp_name] > 0)
            sales[tmp_name] = sales[tmp_name] + (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Total sales: ";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << i.first << " ";
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}
# 0143, 2024-10-15 13:48:57, -P------- (11%)

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    if (a.second == b.second)
        return a.first < b.first;
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic.find(tmp_name) != ic.end())
            sales[tmp_name] = sales[tmp_name] + (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Total sales: ";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << i.first << " ";
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}
# 0144, 2024-10-15 13:49:43, -P------- (11%)

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    if (a.second == b.second)
        return a.first < b.first;
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic.find(tmp_name) != ic.end())
            sales[tmp_name] = sales[tmp_name] + (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Total sales:";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << " " << i.first;
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}
# 0145, 2024-10-15 13:55:59, PPPPPPPPP (100%)

#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

bool get_max_price(std::pair<std::string, double> &a, std::pair<std::string, double> &b) {
    if (a.second == b.second)
        return a.first < b.first;
    return a.second > b.second;
}

int main() {
    int ic_cnt;
    std::cin >> ic_cnt;

    std::map<std::string, double> ic;

    for (int i = 0; i < ic_cnt; ++i) {
        std::string tmp_name;
        double tmp_price;

        std::cin >> tmp_name >> tmp_price;

        ic[tmp_name] = tmp_price;
    }

    int sales_cnt;
    std::cin >> sales_cnt;

    std::map<std::string, double> sales;
    double total_price = 0;

    for (int i = 0; i < sales_cnt; ++i) {
        std::string tmp_name;
        double tmp_amt;

        std::cin >> tmp_name >> tmp_amt;

        if (ic.find(tmp_name) != ic.end())
            sales[tmp_name] += (tmp_amt * ic[tmp_name]);
    }

    std::vector<std::pair<std::string, double>> to_vec;

    for (auto i : sales) {
        total_price += i.second;
        to_vec.push_back(i);
    }

    std::sort(to_vec.begin(), to_vec.end(), get_max_price);

    if (to_vec.size() > 0) {
        std::cout << "Total ice cream sales: " << total_price << std::endl;
        std::cout << "Top sales:";

        for (auto i : to_vec) {
            if (to_vec[0].second == i.second)
                std::cout << " " << i.first;
            else
                break;
        }
    } else {
        std::cout << "No ice cream sales";
    }
}

# 0146, 2024-10-15 13:38:43, -PPPPPPPT (77%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double n,m;
    double total=0;
    map<string,double> ice;
    map<string,double> x;
    cin>>n;
    string str;
    double a;
    for(int i=0;i<n;++i)
    {
        cin>>str>>a;
        ice[str] = a;
    }
    cin>>m;
    string s;
    double cost;
    for(int j=0;j<m;++j)
    {
        cin>>s>>cost;
        for(auto &i:ice)
        {
            if(s==i.first)
            {
                total+=i.second*cost;
                x[i.first] += i.second*cost;
            }
        }
    }
    double mx=-1;
    vector<pair<int,string>> vec;
    vector<string> ans;
    for(auto &m:x) 
    {   
        vec.push_back(make_pair(m.second,m.first));
        if(m.second>mx) mx=m.second;
    }
    sort(vec.rbegin(),vec.rend());
    if(total==0) cout<<"No ice cream sales";
    else 
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &v:vec) 
        {
            if(v.first==mx) 
            {
                //cout<<v.second<<" ";
                ans.push_back(v.second);
            }
        }
        sort(ans.begin(),ans.end());
        for(auto &a:ans) cout<<a<<" ";
    }
    return 0;
}
# 0147, 2024-10-15 13:44:37, PPPP---PT (55%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double n,m;
    double total=0;
    map<string,double> ice;
    map<string,double> sum;
    cin>>n;
    string str;
    double a;
    for(int i=0;i<n;++i)
    {
        cin>>str>>a;
        ice[str] = a;
    }
    cin>>m;
    string s;
    double cost;
    for(int j=0;j<m;++j)
    {
        cin>>s>>cost;
        for(auto &i:ice)
        {
            if(s==i.first)
            {
                total+=i.second*cost;
                sum[i.first] += i.second*cost;
            }
        }
    }
    double mx=-1;
    for(auto &i:sum) if(i.second>mx) mx = i.second;
    if(total==0) cout<<"No ice cream sales";
    else 
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &m:sum)
        {
            if(m.second==mx) cout<<m.first<<endl;
        }
    }
    return 0;
}
# 0148, 2024-10-15 13:45:16, PPPPPPPPT (88%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double n,m;
    double total=0;
    map<string,double> ice;
    map<string,double> sum;
    cin>>n;
    string str;
    double a;
    for(int i=0;i<n;++i)
    {
        cin>>str>>a;
        ice[str] = a;
    }
    cin>>m;
    string s;
    double cost;
    for(int j=0;j<m;++j)
    {
        cin>>s>>cost;
        for(auto &i:ice)
        {
            if(s==i.first)
            {
                total+=i.second*cost;
                sum[i.first] += i.second*cost;
            }
        }
    }
    double mx=-1;
    for(auto &i:sum) if(i.second>mx) mx = i.second;
    if(total==0) cout<<"No ice cream sales";
    else 
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &m:sum)
        {
            if(m.second==mx) cout<<m.first<<" ";
        }
    }
    return 0;
}
# 0149, 2024-10-15 13:48:33, PPPPPPPPT (88%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    double n,m;
    double total=0;
    map<string,double> ice;
    map<string,double> sum;
    cin>>n;
    string str;
    double a;
    for(int i=0;i<n;++i)
    {
        cin>>str>>a;
        ice[str] = a;
    }
    cin>>m;
    string s;
    double cost;
    for(int j=0;j<m;++j)
    {
        cin>>s>>cost;
        for(auto &i:ice)
        {
            if(s==i.first)
            {
                total+=i.second*cost;
                sum[i.first] += i.second*cost;
            }
        }
    }
    double mx=-1;
    for(auto &i:sum) if(i.second>mx) mx = i.second;
    if(total==0) cout<<"No ice cream sales";
    else 
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &m:sum)
        {
            if(m.second==mx) cout<<m.first<<" ";
        }
    }
    return 0;
}
# 0150, 2024-10-15 13:56:39, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    double n,m;
    double total=0;
    map<string,double> ice;
    map<string,double> sum;
    cin>>n;
    string str;
    double a;
    for(int i=0;i<n;++i)
    {
        cin>>str>>a;
        ice[str] = a;
    }
    cin>>m;
    string s;
    double cost;
    for(int j=0;j<m;++j)
    {
        cin>>s>>cost;
        if(ice.find(s)!=ice.end())
        {
            if(sum.find(s)==sum.end())
            {
                sum[s]=0;
            }
            sum[s]+=cost*ice[s];
        }
    }
    double mx=-1;
    for(auto &m:sum)
    {
        total+=m.second;
        if(m.second>mx) mx = m.second;
    }
    
    for(auto &i:sum) if(i.second>mx) mx = i.second;
    if(total==0) cout<<"No ice cream sales";
    else 
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &m:sum)
        {
            if(m.second==mx) cout<<m.first<<" ";
        }
    }
    return 0;
}

# 0151, 2024-10-15 13:12:02, Compilation error (0%)

#include <bits/stdc++.h>
int main(){
  cout << "No ice cream sales";
}
# 0152, 2024-10-15 13:12:18, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
int main(){
  cout << "No ice cream sales";
}
# 0153, 2024-10-15 13:45:23, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n1,n2;
  cin >> n1;
  string goods;
  double price;
  map <string,double> m;
    for(int i = 0; i < n1; i++){
        cin >> goods >> price;
         m[goods] = price;
    }
    double mx = 0;
    cin >> n2;
    string buy;
    double nums;
    vector <pair<string,double>> v;
    double ans = 0;
    
    for(int i = 0; i < n2 ; i++){
        cin >> buy;
        cin >> nums;
        v.push_back(make_pair(buy,nums));
        mx = max(v[i].second,mx);
        if(m[buy] > 0){
           ans += m[buy] * v[i].second;
        }
    }
    string top;
    for(int i = 0; i < v.size() ; i++){
        if(v[i].second == mx && m[v[i].first] > 0){
            top = v[i].first;
        }
    }




    if(ans == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales : " << ans;
        cout << "Top sale: " << top;
    }
    
}
# 0154, 2024-10-15 13:45:44, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
int main(){
  int n1,n2;
  cin >> n1;
  string goods;
  double price;
  map <string,double> m;
    for(int i = 0; i < n1; i++){
        cin >> goods >> price;
         m[goods] = price;
    }
    double mx = 0;
    cin >> n2;
    string buy;
    double nums;
    vector <pair<string,double>> v;
    double ans = 0;
    
    for(int i = 0; i < n2 ; i++){
        cin >> buy;
        cin >> nums;
        v.push_back(make_pair(buy,nums));
        mx = max(v[i].second,mx);
        if(m[buy] > 0){
           ans += m[buy] * v[i].second;
        }
    }
    string top;
    for(int i = 0; i < v.size() ; i++){
        if(v[i].second == mx && m[v[i].first] > 0){
            top = v[i].first;
        }
    }




    if(ans == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales : " << ans << endl;
        cout << "Top sale: " << top;
    }
    
}
# 0155, 2024-10-15 14:03:09, PPPPPPPPP (100%)

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

int main() {
    int n1, n2;
    cin >> n1;
    string goods;
    double price;
    map<string, double> m;
    for(int i = 0; i < n1; i++) {
        cin >> goods >> price;
        m[goods] = price;
    }

    cin >> n2;
    string buy;
    double nums;
    map<string, double> v; 
    double ans = 0; 

    for(int i = 0; i < n2; i++) {
        cin >> buy >> nums;
        if(m[buy] > 0) {
            double sale_amount = m[buy] * nums;
            v[buy] += sale_amount;  
            ans += sale_amount;           
        }
    }

    if(ans == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        double mx = 0;
        string top;

        for(auto &item : v) {
            if(item.second > mx) {
                mx = item.second;
                top = item.first;
            } else if(item.second == mx) {
                top += " " + item.first;  
            }
        }

        cout << "Total ice cream sales: " << ans << endl;
        cout << "Top sales: " << top << endl;
    }

    return 0;
}

# 0156, 2024-10-15 13:44:37, -PPPPPPPP (88%)

#include <bits/stdc++.h>

using namespace std;

string findMax(map<string, double> add) {
    auto itr = add.begin();

    string max = (*itr).first;

    for (auto a : add) {
        if (add[a.first] > add[max]) {
            max = a.first;
        }
    }

    return max;
}

int main() {
    int a;
    cin >> a;

    map<string, double> data1;

    for (int i = 0; i < a; i++) {
        string name;
        double price;
        cin >> name >> price;
        data1[name] = price;
    }

    map<string, double> data2;

    int b;
    cin >> b;

    map<string, double> add;

    int k = 0;
    double sum = 0.0;
    for (int i = 0; i < b; i++) {
        string name2;
        double price2;
        cin >> name2 >> price2;

        if (data1.find(name2) != data1.end()) {
            k += 1;
            add[name2] += (price2 * data1[name2]);
            sum += price2 * data1[name2];
        }
    }

    if (k == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int k = add[findMax(add)];
        for (auto v : add) {
            if (v.second == k) {
                cout << v.first << " ";
            }
        }
    }
}
# 0157, 2024-10-15 13:47:16, -PPPPPPPP (88%)

#include <bits/stdc++.h>

using namespace std;

string findMax(map<string, double> add) {
    auto itr = add.begin();

    string max = (*itr).first;

    for (auto a : add) {
        if (add[a.first] > add[max]) {
            max = a.first;
        }
    }

    return max;
}

int main() {
    int a;
    cin >> a;

    map<string, double> data1;

    for (int i = 0; i < a; i++) {
        string name;
        double price;
        cin >> name >> price;
        data1[name] = price;
    }

    map<string, double> data2;

    int b;
    cin >> b;

    map<string, double> add;

    int k = 0;
    double sum = 0.0;
    for (int i = 0; i < b; i++) {
        string name2;
        double price2;
        cin >> name2 >> price2;

        if (data1.find(name2) != data1.end()) {
            k += 1;
            add[name2] += (price2 * data1[name2]);
            sum += price2 * data1[name2];
        }
    }

    if (sum == 0.0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int k = add[findMax(add)];
        for (auto v : add) {
            if (v.second == k) {
                cout << v.first << " ";
            }
        }
    }
}
# 0158, 2024-10-15 13:47:39, -PPPPPPPP (88%)

#include <bits/stdc++.h>

using namespace std;

string findMax(map<string, double> add) {
    auto itr = add.begin();

    string max = (*itr).first;

    for (auto a : add) {
        if (add[a.first] > add[max]) {
            max = a.first;
        }
    }

    return max;
}

int main() {
    int a;
    cin >> a;

    map<string, double> data1;

    for (int i = 0; i < a; i++) {
        string name;
        double price;
        cin >> name >> price;
        data1[name] = price;
    }

    map<string, double> data2;

    int b;
    cin >> b;

    map<string, double> add;

    int k = 0;
    double sum = 0.0;
    for (int i = 0; i < b; i++) {
        string name2;
        double price2;
        cin >> name2 >> price2;

        if (data1.find(name2) != data1.end()) {
            k += 1;
            add[name2] += (price2 * data1[name2]);
            sum += price2 * data1[name2];
        }
    }

    if (k == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int k = add[findMax(add)];
        for (auto v : add) {
            if (v.second == k) {
                cout << v.first << " ";
            }
        }
    }
}
# 0159, 2024-10-15 13:49:22, -PPPPPPPP (88%)

#include <bits/stdc++.h>

using namespace std;

string findMax(map<string, double> add) {
    auto itr = add.begin();

    string max = (*itr).first;

    for (auto a : add) {
        if (add[a.first] > add[max]) {
            max = a.first;
        }
    }

    return max;
}

int main() {
    int a;
    cin >> a;

    map<string, double> data1;

    for (int i = 0; i < a; i++) {
        string name;
        double price;
        cin >> name >> price;
        data1[name] = price;
    }

    map<string, double> data2;

    int b;
    cin >> b;

    map<string, double> add;

    int k = 0;
    double sum = 0.0;
    for (int i = 0; i < b; i++) {
        string name2;
        double price2;
        cin >> name2 >> price2;

        if (data1.find(name2) != data1.end()) {
            k += 1;
            add[name2] += (price2 * data1[name2]);
            sum += price2 * data1[name2];
        }
    }

    if (k == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        int g = add[findMax(add)];
        for (auto v : add) {
            if (v.second == g) {
                cout << v.first << " ";
            }
        }
    }
}
# 0160, 2024-10-15 13:50:57, PPPPPPPPP (100%)

#include <bits/stdc++.h>

using namespace std;

string findMax(map<string, double> add) {
    auto itr = add.begin();

    string max = (*itr).first;

    for (auto a : add) {
        if (add[a.first] > add[max]) {
            max = a.first;
        }
    }

    return max;
}

int main() {
    int a;
    cin >> a;

    map<string, double> data1;

    for (int i = 0; i < a; i++) {
        string name;
        double price;
        cin >> name >> price;
        data1[name] = price;
    }

    map<string, double> data2;

    int b;
    cin >> b;

    map<string, double> add;

    int k = 0;
    double sum = 0.0;
    for (int i = 0; i < b; i++) {
        string name2;
        double price2;
        cin >> name2 >> price2;

        if (data1.find(name2) != data1.end()) {
            k += 1;
            add[name2] += (price2 * data1[name2]);
            sum += price2 * data1[name2];
        }
    }

    if (k == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        double g = add[findMax(add)];
        for (auto v : add) {
            if (v.second == g) {
                cout << v.first << " ";
            }
        }
    }
}

# 0161, 2024-10-15 13:20:57, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    string name;
    double price, total = 0.0;
    int qty;
    map<string, double> prices, sales;
    
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
        sales[name] = 0.0;
    }
    
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> qty;
        if (prices.find(name) != prices.end()) {
            sales[name] += prices[name] * qty;
            total += prices[name] * qty;
        }
    }
    
    if (total == 0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    
    vector<string> top;
    double max_sale = 0.0;
    for (const auto& s : sales) {
        if (s.second > max_sale) {
            max_sale = s.second;
            top.clear();
            top.push_back(s.first);
        } else if (s.second == max_sale) {
            top.push_back(s.first);
        }
    }
    
    sort(top.begin(), top.end());
    
    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales: ";
    for (size_t i = 0; i < top.size(); i++) {
        cout << top[i];
        if (i < top.size() - 1) cout << " ";
    }
    cout << endl;
    
    return 0;
}
# 0162, 2024-10-15 13:29:17, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int N, M;
    string name;
    double price, total = 0.0;
    int qty;
    map<string, double> prices, sales;

    cin >> N;
    while (N--) {
        cin >> name >> price;
        prices[name] = price;
        sales[name] = 0.0;
    }

    cin >> M;
    while (M--) {
        cin >> name >> qty;
        if (prices.count(name)) {
            sales[name] += prices[name] * qty;
            total += prices[name] * qty;
        }
    }

    if (total == 0) {
        cout << "No ice cream sales\n";
        return 0;
    }

    vector<string> top;
    double max = 0.0;
    for (const auto& s : sales) {
        if (s.second > max) {
            max = s.second;
            top = {s.first};
        } else if (s.second == max) {
            top.push_back(s.first);
        }
    }

    sort(top.begin(), top.end());

    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total << '\n';
    cout << "Top sales: ";
    for (size_t i = 0; i < top.size(); i++) {
        cout << top[i] << (i < top.size() - 1 ? " " : "");
    }
    cout << '\n';

    return 0;
}
# 0163, 2024-10-15 13:30:45, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
    int N, M;
    string name;
    double price, total = 0.0;
    int qty;
    map<string, double> prices, sales;

    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
    }

    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> qty;
        if (prices.find(name) != prices.end()) {
            sales[name] += prices[name] * qty;
            total += prices[name] * qty;
        }
    }

    if (total == 0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    vector<string> top;
    double max_sale = 0.0;
    for (const auto& s : sales) {
        if (s.second > max_sale) {
            max_sale = s.second;
            top.clear();
            top.push_back(s.first);
        } else if (s.second == max_sale) {
            top.push_back(s.first);
        }
    }

    sort(top.begin(), top.end());

    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales:";
    for (const auto& s : top) {
        cout << " " << s;
    }
    cout << endl;

    return 0;
}
# 0164, 2024-10-15 13:41:07, -P------- (11%)

#include <bits/stdc++.h>

using namespace std;

int main() {
    string x;
    int n, m, z, mx = INT_MAX;
    map <string , int> s;
    double y, sum = 0;
    map<string, double> mp;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> x >> y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin >> x >> z;
        if(mp.find(x) != mp.end()){
            sum += mp[x]*z;
            s[x] += mp[x]*z;
            mx = max(mx,s[x]);
        }
    }
    if(sum == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for(auto e : s){
            if(e.second == mx) cout << e.first << " ";
        }
    }
}
# 0165, 2024-10-15 13:41:37, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0166, 2024-10-15 13:41:39, Compilation error (0%)

#include<iostream>
#include<string>
#include<map>
using namespace std;
int main(){
    map <string,float>ice,sell;
    int sum=0;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string list; float price;
        cin>>list>>price;
        ice[list]=price;
    }
    int ask;
    cin>>ask;
    for(int i=0;i<ask;i++){
        string buy; int num;
       cin>>buy>>num;
       if(ice.count(buy)>0){sum+=ice[buy]*num;}
    }

    if(sum==0){cout<<"No ice cream sales";}
    else{cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: "};

}
# 0167, 2024-10-15 13:51:06, -P------- (11%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
int main(){
    map <string,float>ice,sell;
    int sum=0;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string list; float price;
        cin>>list>>price;
        ice[list]=price;
    }
    int ask;
    cin>>ask;
    for(int i=0;i<ask;i++){
        string buy; int num;
       cin>>buy>>num;
       auto x=ice.find(buy); if(x!=ice.end()){sell[buy]+=ice[buy]*num;}
       if(ice.count(buy)>0){sum+=ice[buy]*num;}
    }
    float max=0;
    set <string> menu;
   for(auto v:sell){
    if(max==v.second) menu.insert(v.first);
   }
    if(sum==0){cout<<"No ice cream sales";}
    else{cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";}

}
# 0168, 2024-10-15 13:52:44, -P------- (11%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;
int main(){
    map <string,float>ice,sell;
    int sum=0;
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string list; float price;
        cin>>list>>price;
        ice[list]=price;
    }
    int ask;
    cin>>ask;
    for(int i=0;i<ask;i++){
        string buy; int num;
       cin>>buy>>num;
       auto x=ice.find(buy); if(x!=ice.end()){sell[buy]+=ice[buy]*num;}
       if(ice.count(buy)>0){sum+=ice[buy]*num;}
    }
    float max=0;
    set <string> menu;
   for(auto v:sell){
    if(max==v.second) menu.insert(v.first);
   }
    if(sum==0){cout<<"No ice cream sales";}
    else{cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";}
    for(auto m:menu) cout << m << ' ';

}
# 0169, 2024-10-15 13:55:25, Compilation error (0%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;

int main() {
    map<string, float> ice;
    map<string, float> sell;
    float sum = 0;
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) {
        string list;
        float price;
        cin >> list >> price;
        ice[list] = price;
    }

    int ask;
    cin >> ask;
    
    for (int i = 0; i < ask; i++) {
        string buy;
        int num;
        cin >> buy >> num;

        if (ice.count(buy) > 0) {
            sell[buy] += ice[buy] * num;
            sum += ice[buy] * num;
        }
    }

    float maxSale = 0;
    set<string> topIceCreams;

    for (auto &v : sell) {
        if (v.second > maxSale) {
            maxSale = v.second;
            topIceCreams.clear();
            topIceCreams.insert(v.first);
        } else if (v.second == maxSale) {
            topIceCreams.insert(v.first);
# 0170, 2024-10-15 13:55:50, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;

int main() {
    map<string, float> ice;
    map<string, float> sell;
    float sum = 0;
    int n;

    cin >> n;
    for (int i = 0; i < n; i++) {
        string list;
        float price;
        cin >> list >> price;
        ice[list] = price;
    }

    int ask;
    cin >> ask;
    
    for (int i = 0; i < ask; i++) {
        string buy;
        int num;
        cin >> buy >> num;

        if (ice.count(buy) > 0) {
            sell[buy] += ice[buy] * num;
            sum += ice[buy] * num;
        }
    }

    float maxSale = 0;
    set<string> topIceCreams;

    for (auto &v : sell) {
        if (v.second > maxSale) {
            maxSale = v.second;
            topIceCreams.clear();
            topIceCreams.insert(v.first);
        } else if (v.second == maxSale) {
            topIceCreams.insert(v.first);
        }
    }

    if (sum == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto &m : topIceCreams) {
            cout << m << " ";
        }
        cout << endl;
    }

    return 0;
}

# 0171, 2024-10-15 13:31:30, Compilation error (0%)

#include<iostream>
#include<map>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    map<string, float> menu;
    vector<string> item;
    string menu_name; float price; int amount;
    int n; cin >> n;

    for(int i=1; i<=n; i++){
        cin >> menu_name >> price;
        item.push_back(menu_name);
        menu.insert({menu_name, price});
    }

    // Input all priceto check
    map<string, float> dat;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> menu_name >> amount;
        if(menu.find(menu_name) == menu.end()){
            continue;
        }
        if(dat.find(menu_name) == dat.end()){
            dat.insert({menu_name, amount*menu[menu_name]});
        }else{
            dat[menu_name]+=amount*menu[menu_name];
        }
    }

    // find 
    float total = 0;
    for(auto e: item){
        total+=dat[e];
    }

    if(dat.empty()){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: " << top_name << endl;
    }
    return 0;
}
# 0172, 2024-10-15 13:31:54, --P----P- (22%)

#include<iostream>
#include<map>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    map<string, float> menu;
    vector<string> item;
    string menu_name; float price; int amount;
    int n; cin >> n;

    for(int i=1; i<=n; i++){
        cin >> menu_name >> price;
        item.push_back(menu_name);
        menu.insert({menu_name, price});
    }

    // Input all priceto check
    map<string, float> dat;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> menu_name >> amount;
        if(menu.find(menu_name) == menu.end()){
            continue;
        }
        if(dat.find(menu_name) == dat.end()){
            dat.insert({menu_name, amount*menu[menu_name]});
        }else{
            dat[menu_name]+=amount*menu[menu_name];
        }
    }

    // find 
    float total = 0;
    for(auto e: item){
        total+=dat[e];
    }

    if(dat.empty()){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: " << "Magnum" << endl;
    }
    return 0;
}
# 0173, 2024-10-15 13:42:34, P-PPPPPPP (88%)

#include<iostream>
#include<map>
#include<vector>
#include<utility>
#include<cmath>
using namespace std;
int main(){
    map<string, float> menu;
    vector<string> item;
    // vector<pair<string, int>> item_last;
    string menu_name; float price; int amount;
    int n; cin >> n;

    for(int i=1; i<=n; i++){
        cin >> menu_name >> price;
        item.push_back(menu_name);
        menu.insert({menu_name, price});
    }

    // Input all priceto check
    map<string, float> dat;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> menu_name >> amount;
        if(menu.find(menu_name) == menu.end()){
            continue;
        }
        if(dat.find(menu_name) == dat.end()){
            dat.insert({menu_name, amount*menu[menu_name]});
        }else{
            dat[menu_name]+=amount*menu[menu_name];
        }
    }

    // find top price
    float total = 0;
    for(auto e: item){
        total+=dat[e];
    }
    vector<pair<float, string>> top;
    for(auto e: dat){
        top.push_back({e.second, e.first});
    }
    // find max price
    float mx_price = 0;
    for(auto e: top){
        mx_price = max(mx_price, e.first);
    }


    if(dat.empty()){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        // Show price that equal mx_price
        for(auto e: top){
            if(e.first == mx_price){
                cout << e.second << " ";
            }
        }
    }
    return 0;
}
# 0174, 2024-10-15 13:44:16, P-PPPPPPP (88%)

#include<iostream>
#include<map>
#include<vector>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    map<string, float> menu;
    vector<string> item;
    // vector<pair<string, int>> item_last;
    string menu_name; float price; int amount;
    int n; cin >> n;

    for(int i=1; i<=n; i++){
        cin >> menu_name >> price;
        item.push_back(menu_name);
        menu.insert({menu_name, price});
    }

    // Input all priceto check
    map<string, float> dat;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> menu_name >> amount;
        if(menu.find(menu_name) == menu.end()){
            continue;
        }
        if(dat.find(menu_name) == dat.end()){
            dat.insert({menu_name, amount*menu[menu_name]});
        }else{
            dat[menu_name]+=amount*menu[menu_name];
        }
    }

    // find top price
    float total = 0;
    for(auto e: item){
        total+=dat[e];
    }
    vector<pair<string, float>> top;
    for(auto e: dat){
        top.push_back({e.first, e.second});
    }
    sort(top.begin(), top.end());
    // find max price
    float mx_price = 0;
    for(auto e: top){
        mx_price = max(mx_price, e.second);
    }


    if(dat.empty()){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        // Show price that equal mx_price
        for(auto e: top){
            if(e.second == mx_price){
                cout << e.first << " ";
            }
        }
    }
    return 0;
}
# 0175, 2024-10-15 13:50:58, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<vector>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
    map<string, float> menu;
    vector<string> item;
    bool isOk = false;
    // vector<pair<string, int>> item_last;
    string menu_name; float price; int amount;
    int n; cin >> n;

    for(int i=1; i<=n; i++){
        cin >> menu_name >> price;
        item.push_back(menu_name);
        menu.insert({menu_name, price});
    }

    // Input all priceto check
    map<string, float> dat;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> menu_name >> amount;
        if(menu.find(menu_name) == menu.end()){
            continue;
        }
        isOk = true;
        if(dat.find(menu_name) == dat.end()){
            dat.insert({menu_name, amount*menu[menu_name]});
        }else{
            dat[menu_name]+=amount*menu[menu_name];
        }
    }

    // find top price
    float total = 0;
    for(auto e: item){
        total+=dat[e];
    }
    vector<pair<string, float>> top;
    for(auto e: dat){
        top.push_back({e.first, e.second});
    }
    sort(top.begin(), top.end());
    // find max price
    float mx_price = 0;
    for(auto e: top){
        mx_price = max(mx_price, e.second);
    }


    if(!isOk){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        // Show price that equal mx_price
        for(auto e: top){
            if(e.second == mx_price){
                cout << e.first << " ";
            }
        }
    }
    return 0;
}

# 0176, 2024-10-15 13:24:08, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string, double> products;
    int n, num;
    map<string, double>check;
    double sale, sum = 0, each, max = 0;
    string ice;
    cin >> n;
    while (n--)
    {
        cin >> ice >> sale;
        products[ice] = sale;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> num;
        each = products[ice] * num;
        if (each > max)
        {
            max = each;
        }
        if(check.find(ice)!=check.end())
        {
            check[ice]+=each;
        }
        else
        {
            check[ice]=each;
        }
        sum += each;
    }
    if (sum == 0)
        cout << "No ice cream sales";
    else
    {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: " ;
        for(auto x:check)
        {
            if(x.second==max)
                cout << x.first << " " ;
        }
    }
}
# 0177, 2024-10-15 13:32:22, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string, double> products;
    map<string, double> check;
    double n,num,sale, sum = 0, each, max = 0;
    string ice;
    cin >> n;
    while (n--)
    {
        cin >> ice >> sale;
        products[ice] = sale;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> num;
        each = products[ice] * num;
        if (each > max)
        {
            max = each;
        }
        if (check.find(ice) != check.end())
        {
            check[ice] += each;
        }
        else
        {
            check[ice] = each;
        }
        sum += each;
    }
    if (sum == 0)
        cout << "No ice cream sales";
    else
    {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto x : check)
        {
            if (x.second == max)
                cout << x.first << " ";
        }
    }
}
# 0178, 2024-10-15 13:35:10, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string, double> products;
    int n, num;
    map<string, double> check;
    double sale, sum = 0, each, max = 0;
    string ice;
    cin >> n;
    while (n--)
    {
        cin >> ice >> sale;
        products[ice] = sale;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> num;
        if (products.find(ice) != products.end())
        {
            each = products[ice] * num;
            if (each > max)
            {
                max = each;
            }
            if (check.find(ice) != check.end())
            {
                check[ice] += each;
            }
            else
            {
                check[ice] = each;
            }
            sum += each;
        }
    }
    if (sum == 0)
        cout << "No ice cream sales";
    else
    {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto x : check)
        {
            if (x.second == max)
                cout << x.first << " ";
        }
    }
}
# 0179, 2024-10-15 13:39:01, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string, double> products;
    int n, num;
    map<string, double> check;
    double sale, sum = 0, each, max = 0;
    string ice;
    cin >> n;
    while (n--)
    {
        cin >> ice >> sale;
        products[ice] = sale;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> num;
        if (products.find(ice) != products.end())
        {
            each = products[ice] * num;
            check[ice] += each;
            if (check[ice] > max)
            {
                max = each;
            }
            sum += each;
        }
    }
    if (sum == 0)
        cout << "No ice cream sales";
    else
    {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto x : check)
        {
            if (x.second == max)
                cout << x.first << " ";
        }
    }
}
# 0180, 2024-10-15 13:55:17, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main()
{
    map<string, double> products;
    int n, num;
    map<string, double> check;
    set<string> ans;
    double sale, sum = 0, each, max = 0;
    string ice;
    cin >> n;
    while (n--)
    {
        cin >> ice >> sale;
        products[ice] = sale;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> num;
        if (products.find(ice) != products.end())
        {
            if (check.find(ice) != check.end())
                check[ice] += num;
            else
            {
                check[ice] = num;
            }
        }
    }
    if (check.empty())
        cout << "No ice cream sales";
    else
    {
        for (auto x : check)
        {
            sum += products[x.first] * x.second;
            //cout << products[x.first] << "*" << x.second << endl;
            if(products[x.first]*x.second>max)
            {
                max=products[x.first]*x.second;
                ans.clear();
                ans.insert(x.first);
            }
            else if(products[x.first]*x.second==max)
            {
                ans.insert(x.first);
            }
        }
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for (auto x : ans)
        {
            cout << x << " ";
        }
    }
}

# 0181, 2024-10-15 13:54:09, P-PPPPPPP (88%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n, m;
    double totalSale = 0;
    cin >> n;
    map<string, double> priceMap;
    map<string, double> saleMap;
    for(int i = 0; i<n; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        
        priceMap[ic] = value;
    }

    cin >> m;
    for(int i = 0; i<m; i++){
        string ic;
        int value;
        cin >> ic;
        cin >> value;
        if(priceMap.find(ic) != priceMap.end()){
            totalSale += (*priceMap.find(ic)).second*value;
            if(saleMap.find(ic) != saleMap.end()){
                saleMap[ic] = (*saleMap.find(ic)).second + (*priceMap.find(ic)).second*value;
            }
            else{
                saleMap[ic] = (*priceMap.find(ic)).second*value;
            }
        }
        else{
            saleMap[ic] = 0;
        }
        
    }

    cout << "Total ice cream sales: " << totalSale << endl;


    double max = 0;
    for(auto e : saleMap){
        if(e.second > max){
            max = e.second;
        }
        //cout << e.first << " " << e.second << endl;
    }
    cout << "Top sales:";
    for(auto e : saleMap){
        if(e.second == max){
            cout << " " << e.first;
        }
    }
}
# 0182, 2024-10-15 13:54:44, P-PPPPPPP (88%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n, m;
    double totalSale = 0;
    cin >> n;
    map<string, double> priceMap;
    map<string, double> saleMap;
    for(int i = 0; i<n; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        
        priceMap[ic] = value;
    }

    cin >> m;
    for(int i = 0; i<m; i++){
        string ic;
        int value;
        cin >> ic;
        cin >> value;
        if(priceMap.find(ic) != priceMap.end()){
            totalSale += (*priceMap.find(ic)).second*value;
            if(saleMap.find(ic) != saleMap.end()){
                saleMap[ic] = (*saleMap.find(ic)).second + (*priceMap.find(ic)).second*value;
            }
            else{
                saleMap[ic] = (*priceMap.find(ic)).second*value;
            }
        }
        else{
            saleMap[ic] = 0;
        }
        
    }

    cout << "Total ice cream sales: " << totalSale << endl;


    double max = 0;
    for(auto e : saleMap){
        if(e.second > max){
            max = e.second;
        }
        //cout << e.first << " " << e.second << endl;
    }
    cout << "Top sales:";
    for(auto e : saleMap){
        if(e.second == max){
            cout << " " << e.first;
        }
    }
}
# 0183, 2024-10-15 13:55:51, P-PPPPPPP (88%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n, m;
    double totalSale = 0;
    cin >> n;
    map<string, double> priceMap;
    map<string, double> saleMap;
    for(int i = 0; i<n; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        
        priceMap[ic] = value;
    }

    cin >> m;
    for(int i = 0; i<m; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        if(priceMap.find(ic) != priceMap.end()){
            totalSale += (*priceMap.find(ic)).second*value;
            if(saleMap.find(ic) != saleMap.end()){
                saleMap[ic] = (*saleMap.find(ic)).second + (*priceMap.find(ic)).second*value;
            }
            else{
                saleMap[ic] = (*priceMap.find(ic)).second*value;
            }
        }
        else{
            saleMap[ic] = 0;
        }
        
    }

    cout << "Total ice cream sales: " << totalSale << endl;


    double max = 0;
    for(auto e : saleMap){
        if(e.second > max){
            max = e.second;
        }
        //cout << e.first << " " << e.second << endl;
    }
    cout << "Top sales:";
    for(auto e : saleMap){
        if(e.second == max){
            cout << " " << e.first;
        }
    }
}
# 0184, 2024-10-15 14:00:51, P-PPPPPPP (88%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n, m;
    double totalSale = 0;
    cin >> n;
    map<string, double> priceMap;
    map<string, double> saleMap;
    for(int i = 0; i<n; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        
        priceMap[ic] = value;
    }

    cin >> m;
    for(int i = 0; i<m; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        if(priceMap.find(ic) != priceMap.end()){
            totalSale += (*priceMap.find(ic)).second*value;
            if(saleMap.find(ic) != saleMap.end()){
                saleMap[ic] = (*saleMap.find(ic)).second + (*priceMap.find(ic)).second*value;
            }
            else{
                saleMap[ic] = (*priceMap.find(ic)).second*value;
            }
        }
        else{
            saleMap[ic] = 0;
        }
        
    }

    cout << "Total ice cream sales: " << totalSale << endl;


    if(totalSale == 0){
        cout << "No ice cream sales" << endl;
    }
    else{
        double max = 0;
        for(auto e : saleMap){
            if(e.second > max){
                max = e.second;
            }
            //cout << e.first << " " << e.second << endl;
        }
        cout << "Top sales:";
        for(auto e : saleMap){
            if(e.second == max){
                cout << " " << e.first;
            }
        }
    }
}
# 0185, 2024-10-15 14:01:29, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n, m;
    double totalSale = 0;
    cin >> n;
    map<string, double> priceMap;
    map<string, double> saleMap;
    for(int i = 0; i<n; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        
        priceMap[ic] = value;
    }

    cin >> m;
    for(int i = 0; i<m; i++){
        string ic;
        double value;
        cin >> ic;
        cin >> value;
        if(priceMap.find(ic) != priceMap.end()){
            totalSale += (*priceMap.find(ic)).second*value;
            if(saleMap.find(ic) != saleMap.end()){
                saleMap[ic] = (*saleMap.find(ic)).second + (*priceMap.find(ic)).second*value;
            }
            else{
                saleMap[ic] = (*priceMap.find(ic)).second*value;
            }
        }
        else{
            saleMap[ic] = 0;
        }
        
    }

    


    if(totalSale == 0){
        cout << "No ice cream sales" << endl;
    }
    else{
        cout << "Total ice cream sales: " << totalSale << endl;
        double max = 0;
        for(auto e : saleMap){
            if(e.second > max){
                max = e.second;
            }
            //cout << e.first << " " << e.second << endl;
        }
        cout << "Top sales:";
        for(auto e : saleMap){
            if(e.second == max){
                cout << " " << e.first;
            }
        }
    }
}

# 0186, 2024-10-15 13:21:04, -PPPP---P (55%)

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

int main() {
    int n;
    string menu;
    float price, sales, total = 0, max = -1;
    map <string, pair<float, float>> icecream; //menu    price  sum_menu
    cin >> n;
    while (n--) {
        cin >> menu >> price;
        icecream[menu] = make_pair(price, 0);
    }
    cin >> n;
    while (n--) {
        cin >> menu >> sales;
        if (icecream.find(menu) != icecream.end()) {
            float sum_menu = icecream[menu].first * sales; // sum_menu = price * sale
            icecream[menu].second += sum_menu;
            total += sum_menu;
            if (max < sum_menu) {
                max = sum_menu;
            }
        }
    }
    
    if (total == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto &a : icecream) {
            if (a.second.second == max) {
                cout << a.first << " ";
            }
        }
        //Cornetto Magnum
    }
}
# 0187, 2024-10-15 13:23:51, -PPPP---P (55%)

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

int main() {
    int n;
    string menu;
    float price, sales, total = 0, max = -1;
    map <string, pair<float, float>> icecream; //menu    price  sum_menu
    cin >> n;
    while (n--) {
        cin >> menu >> price;
        icecream[menu] = {price, 0};
    }
    cin >> n;
    while (n--) {
        cin >> menu >> sales;
        if (icecream.find(menu) != icecream.end()) {
            float sum_menu = (icecream[menu].first) * sales; // sum_menu = price * sale
            icecream[menu].second += sum_menu;
            total += sum_menu;
            if (max < sum_menu) {
                max = sum_menu;
            }
        }
    }
    //cout << max;
    if (total == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto &a : icecream) {
            if (a.second.second >= max) {
                cout << a.first << " ";
            }
        }
    }
}
# 0188, 2024-10-15 13:25:53, -PPPP---P (55%)

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

int main() {
    int n, m;
    string menu;
    float price, sales, total = 0, max = -1;
    map <string, pair<float, float>> icecream;//menu   price sum_menu
    cin >> n;
    while (n--) {
        cin >> menu >> price;
        icecream[menu] = {price, 0};
    }

    cin >> m;
    while (m--) {
        cin >> menu >> sales;
        if (icecream.find(menu) != icecream.end()) {
            float sum_menu = (icecream[menu].first) * sales;
            icecream[menu].second += sum_menu;
            total += sum_menu;
            if (sum_menu > max) {
                max = sum_menu;
            }
        }
    }

    if (total == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto i : icecream) {
            if (i.second.second >= max) {
                cout << i.first << " ";
            }
        }
    }
}
/*
5
Magnum 50
Cornetto 25
PaddlePop 15.50
AsianDelight 20
Calippo 15.00
7
Magnum 5
Magnum 5
Cookie 20
MamaTomyum 3
PaddlePop 3
Cornetto 20
AsianDelight 1
*/
# 0189, 2024-10-15 13:29:57, -PPPP---P (55%)

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

int main() {
    int n;
    string menu;
    float price, sales, total = 0, max = -1;
    map <string, pair<float, float>> icecream; //menu    price  sum_menu
    cin >> n;
    while (n--) {
        cin >> menu >> price;
        icecream[menu] = {price, 0};
    }
    cin >> n;
    while (n--) {
        cin >> menu >> sales;
        if (icecream.find(menu) != icecream.end()) {
            float sum_menu = (icecream[menu].first) * sales; // sum_menu = price * sale
            icecream[menu].second += sum_menu;
            total += sum_menu;
            if (max < sum_menu) {
                max = sum_menu;
            }
        }
    }
    //cout << max;
    if (total == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto &a : icecream) {
            if (a.second.second >= max) {
                cout << a.first << " ";
            }
        }
    }
}
# 0190, 2024-10-15 13:32:09, PPPPPPPPP (100%)

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

int main() {
    int n;
    string menu;
    float price, sales, total = 0, max = -1;
    map <string, pair<float, float>> icecream; //menu    price  sum_menu
    cin >> n;
    while (n--) {
        cin >> menu >> price;
        icecream[menu] = {price, 0};
    }
    cin >> n;
    while (n--) {
        cin >> menu >> sales;
        if (icecream.find(menu) != icecream.end()) {
            float sum_menu = (icecream[menu].first) * sales; // sum_menu = price * sales
            icecream[menu].second += sum_menu;
            total += sum_menu;
            if (max < icecream[menu].second) {
                max = icecream[menu].second;
            }
        }
    }
    //cout << max;
    if (total == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto &a : icecream) {
            if (a.second.second >= max) {
                cout << a.first << " ";
            }
        }
    }
}

# 0191, 2024-10-15 13:30:15, -PPPPPPPP (88%)

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

int main()
{
    unordered_map<string, int> priceMap;
    map<string, int> cntMap;
    int n, m, sum = 0, mx = 0;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string product;
        double price;

        cin >> product >> price;
        priceMap[product] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        string product;
        int num;

        cin >> product >> num;
        if (priceMap.find(product) != priceMap.end())
        {
            if (cntMap.find(product) == cntMap.end())
            {
                cntMap[product] = 0;
            }

            sum += priceMap[product] * num;
            cntMap[product] += priceMap[product] * num;
            
            if (cntMap[product] > mx)
            {
                mx = cntMap[product];
            }
        }
    }

    if (sum == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << sum << "\n";
        cout << "Top sales:";

        for (auto &x : cntMap)
        {
            if (x.second == mx)
            {
                cout << " " << x.first;
            }
        }
    }

    return 0;
}
# 0192, 2024-10-15 13:31:18, -PPPPPPPP (88%)

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

int main()
{
    unordered_map<string, int> priceMap;
    map<string, int> cntMap;
    int n, m, mx = 0;
    double sum = 0;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string product;
        double price;

        cin >> product >> price;
        priceMap[product] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        string product;
        int num;

        cin >> product >> num;
        if (priceMap.find(product) != priceMap.end())
        {
            if (cntMap.find(product) == cntMap.end())
            {
                cntMap[product] = 0;
            }

            sum += priceMap[product] * num;
            cntMap[product] += priceMap[product] * num;

            if (cntMap[product] > mx)
            {
                mx = cntMap[product];
            }
        }
    }

    if (sum == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << sum << "\n";
        cout << "Top sales:";

        for (auto &x : cntMap)
        {
            if (x.second == mx)
            {
                cout << " " << x.first;
            }
        }
    }

    return 0;
}
# 0193, 2024-10-15 13:33:13, -PPPPPPPP (88%)

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

int main()
{
    unordered_map<string, double> priceMap;
    map<string, double> cntMap;
    int n, m, mx = 0;
    double sum = 0;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string product;
        double price;

        cin >> product >> price;
        priceMap[product] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        string product;
        int num;

        cin >> product >> num;
        if (priceMap.find(product) != priceMap.end())
        {
            if (cntMap.find(product) == cntMap.end())
            {
                cntMap[product] = 0;
            }

            sum += priceMap[product] * num;
            cntMap[product] += priceMap[product] * num;

            if (cntMap[product] > mx)
            {
                mx = cntMap[product];
            }
        }
    }

    if (sum == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << sum << "\n";
        cout << "Top sales:";

        for (auto &x : cntMap)
        {
            if (x.second == mx)
            {
                cout << " " << x.first;
            }
        }
    }

    return 0;
}
# 0194, 2024-10-15 13:33:44, PPPPPPPPP (100%)

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

int main()
{
    unordered_map<string, double> priceMap;
    map<string, double> cntMap;
    double sum = 0, mx = 0;
    int n, m;

    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string product;
        double price;

        cin >> product >> price;
        priceMap[product] = price;
    }

    cin >> m;
    for (int i = 0; i < m; i++)
    {
        string product;
        int num;

        cin >> product >> num;
        if (priceMap.find(product) != priceMap.end())
        {
            if (cntMap.find(product) == cntMap.end())
            {
                cntMap[product] = 0;
            }

            sum += priceMap[product] * num;
            cntMap[product] += priceMap[product] * num;

            if (cntMap[product] > mx)
            {
                mx = cntMap[product];
            }
        }
    }

    if (sum == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << sum << "\n";
        cout << "Top sales:";

        for (auto &x : cntMap)
        {
            if (x.second == mx)
            {
                cout << " " << x.first;
            }
        }
    }

    return 0;
}

# 0195, 2024-10-15 13:41:04, P-PP---PP (55%)

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<pair<string,double>> list;
    vector<pair<double,string>> total;
    vector<pair<string,int>> orders;
    int M, N, order;
    string goods;
    double price, totalsales=0;
    cin >> M;
    for(int i=0; i<M; i++) {
        cin >> goods >> price;
        list.push_back(make_pair(goods,price));
        total.push_back(make_pair(0,goods));
    }
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> goods >> order;
        orders.push_back(make_pair(goods, order));
    }

    for(int i=0; i<orders.size(); i++) {
        for(int j=0; j<goods.size(); j++) {
            if(orders[i].first==list[j].first) {
                total[j].first += orders[i].second  * list[j].second;
            }
        }
    }
    sort(total.begin(), total.end());
    //for(int i=0; i<total.size(); i++) {
    //    cout << total[i].first << " " << total[i].second << endl;
    //}

    for(int i=0; i<total.size(); i++) {
        totalsales += total[i].first;
    }
    
    cout << "Total ice cream sales: " << totalsales << endl << "Top sales:";

    for(int i=total.size()-1; i>=0; i--) {
        cout << " " << total[i].second;
        if(total[i].first > total[i-1].first) break;
    }
    

}
# 0196, 2024-10-15 13:42:36, -P------- (11%)

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<pair<string,double>> list;
    vector<pair<double,string>> total;
    vector<pair<string,int>> orders;
    int M, N, order;
    string goods;
    double price, totalsales=0;
    cin >> M;
    for(int i=0; i<M; i++) {
        cin >> goods >> price;
        list.push_back(make_pair(goods,price));
        total.push_back(make_pair(0,goods));
    }
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> goods >> order;
        orders.push_back(make_pair(goods, order));
    }

    for(int i=0; i<orders.size(); i++) {
        for(int j=0; j<goods.size(); j++) {
            if(orders[i].first==list[j].first) {
                total[j].first += orders[i].second  * list[j].second;
            }
        }
    }
    sort(total.begin(), total.end());
    //for(int i=0; i<total.size(); i++) {
    //    cout << total[i].first << " " << total[i].second << endl;
    //}

    if(totalsales!=0) { 
        for(int i=0; i<total.size(); i++) {
            totalsales += total[i].first;
        }
        
        cout << "Total ice cream sales: " << totalsales << endl << "Top sales:";

        for(int i=total.size()-1; i>=0; i--) {
            cout << " " << total[i].second;
            if(total[i].first > total[i-1].first) break;
        }
    }else cout << "No ice cream sales";

}
# 0197, 2024-10-15 13:44:08, PPPP---PP (66%)

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<pair<string,double>> list;
    vector<pair<double,string>> total;
    vector<pair<string,int>> orders;
    int M, N, order;
    string goods;
    double price, totalsales=0;
    cin >> M;
    for(int i=0; i<M; i++) {
        cin >> goods >> price;
        list.push_back(make_pair(goods,price));
        total.push_back(make_pair(0,goods));
    }
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> goods >> order;
        orders.push_back(make_pair(goods, order));
    }

    for(int i=0; i<orders.size(); i++) {
        for(int j=0; j<goods.size(); j++) {
            if(orders[i].first==list[j].first) {
                total[j].first += orders[i].second  * list[j].second;
            }
        }
    }
    sort(total.begin(), total.end());
    //for(int i=0; i<total.size(); i++) {
    //    cout << total[i].first << " " << total[i].second << endl;
    //}
 
    for(int i=0; i<total.size(); i++) {
        totalsales += total[i].first;
    }

    if(totalsales!=0) {
        cout << "Total ice cream sales: " << totalsales << endl << "Top sales:";

        for(int i=total.size()-1; i>=0; i--) {
            cout << " " << total[i].second;
            if(total[i].first > total[i-1].first) break;
        }
    }else cout << "No ice cream sales";

}
# 0198, 2024-10-15 13:49:00, PPPPPPPPP (100%)

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<pair<string,double>> list;
    vector<pair<double,string>> total;
    vector<pair<string,int>> orders;
    int M, N, order;
    string goods;
    double price, totalsales=0;
    cin >> M;
    for(int i=0; i<M; i++) {
        cin >> goods >> price;
        list.push_back(make_pair(goods,price));
        total.push_back(make_pair(0,goods));
    }
    cin >> N;
    for(int i=0; i<N; i++) {
        cin >> goods >> order;
        orders.push_back(make_pair(goods, order));
    }

    for(int i=0; i<orders.size(); i++) {
        for(int j=0; j<goods.size(); j++) {
            if(orders[i].first==list[j].first) {
                total[j].first += orders[i].second  * list[j].second;
            }
        }
    }
    sort(total.begin(), total.end());
    //for(int i=0; i<total.size(); i++) {
    //    cout << total[i].first << " " << total[i].second << endl;
    //}
 
    for(int i=0; i<total.size(); i++) {
        totalsales += total[i].first;
    }

    if(totalsales!=0) {
        cout << "Total ice cream sales: " << totalsales << endl << "Top sales:";

        int top=0;
        for(int i=total.size()-1; i>=0; i--) {
            top++;
            if(total[i].first > total[i-1].first) break;
        }
        for(int i=total.size()-top; i<=total.size()-1; i++) {
            cout << " " << total[i].second;
        }

    }else cout << "No ice cream sales";

}

# 0199, 2024-10-15 13:33:37, PPPPPPPPT (88%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main (){
    int N; cin >> N;
    vector<pair<double,string>> sale;
    map<string, double> menu;
    string flavor;
    double cost;
    for (int i = 0; i < N; i++)
    {
        cin>> flavor;
        cin>> cost;
        menu[flavor] = cost;
        sale.push_back(make_pair(0.0,flavor));
    }


    int M; cin >> M;
    string order;
    int quantity;
    double income=0;
    for (int i = 0; i < M; i++)
    {
        cin>> order;
        cin>> quantity;
        income+=(menu[order]*quantity);
        for (auto &a : sale)
        {
            if (order==a.second)
            {
                a.first-=(menu[order]*quantity);
            }
            
        }
    }
    sort(sale.begin(),sale.end());
    if (income!=0)
    {
        cout << "Total ice cream sales: " << income << endl;
        cout << "Top sales: " ;
        double k= sale[0].first;
        for (auto p :sale)
        {
            if (p.first==k)
            {
                cout << p.second << ' ';
            }
            
        }
        
    }else{
        cout << "No ice cream sales" << endl;
    }
    
}
# 0200, 2024-10-15 13:33:46, PPPPPPPPT (88%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main (){
    int N; cin >> N;
    vector<pair<double,string>> sale;
    map<string, double> menu;
    string flavor;
    double cost;
    for (int i = 0; i < N; i++)
    {
        cin>> flavor;
        cin>> cost;
        menu[flavor] = cost;
        sale.push_back(make_pair(0.0,flavor));
    }


    int M; cin >> M;
    string order;
    int quantity;
    double income=0;
    for (int i = 0; i < M; i++)
    {
        cin>> order;
        cin>> quantity;
        income+=(menu[order]*quantity);
        for (auto &a : sale)
        {
            if (order==a.second)
            {
                a.first-=(menu[order]*quantity);
            }
            
        }
    }
    sort(sale.begin(),sale.end());
    if (income!=0)
    {
        cout << "Total ice cream sales: " << income << endl;
        cout << "Top sales: " ;
        double k= sale[0].first;
        for (auto p :sale)
        {
            if (p.first==k)
            {
                cout << p.second << ' ';
            }
            
        }
        
    }else{
        cout << "No ice cream sales" << endl;
    }
    
}
# 0201, 2024-10-15 13:41:41, PPPPPPPPT (88%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main (){
    int N; cin >> N;
    vector<pair<double,string>> sale;
    map<string, double> menu;
    string flavor;
    double cost;
    for (int i = 0; i < N; i++)
    {
        cin>> flavor;
        cin>> cost;
        menu[flavor] = cost;
        sale.push_back(make_pair(0.0,flavor));
    }


    int M; cin >> M;
    string order;
    int quantity;
    double income=0;
    for (int i = 0; i < M; i++)
    {
        cin>> order;
        cin>> quantity;
        if (quantity<0)
        {
            continue;
        }
        
        income+=(menu[order]*quantity);
        for (auto &a : sale)
        {
            if (order==a.second)
            {
                a.first-=(menu[order]*quantity);
            }
            
        }
    }
    sort(sale.begin(),sale.end());
    if (income!=0)
    {
        cout << "Total ice cream sales: " << income << endl;
        cout << "Top sales: " ;
        double k= sale[0].first;
        for (auto p :sale)
        {
            if (p.first==k)
            {
                cout << p.second << ' ';
            }
            
        }
        
    }else{
        cout << "No ice cream sales" << endl;
    }
    
}
# 0202, 2024-10-15 14:03:18, PPPPPPPPP (100%)

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
int main (){
    int N; cin >> N;
    vector<pair<double,string>> sale;
    map<string, pair<double,int>> menu;
    string flavor;
    double cost;
    for (int i = 0; i < N; i++)
    {
        cin>> flavor;
        cin>> cost;
        menu[flavor] = make_pair(cost,i);
        sale.push_back(make_pair(0.0,flavor));
    }


    int M; cin >> M;
    string order;
    int quantity;
    double income=0;
    for (int i = 0; i < M; i++)
    {
        cin>> order;
        cin>> quantity;
        income+=(menu[order].first*quantity);
        if (order==sale[menu[order].second].second)
        {
            sale[menu[order].second].first-=(menu[order].first*quantity);
        }    
    }
    sort(sale.begin(),sale.end());
    if (income!=0)
    {
        cout << "Total ice cream sales: " << income << endl;
        cout << "Top sales: " ;
        double k= sale[0].first;
        for (auto p :sale)
        {
            if (p.first==k)
            {
                cout << p.second << ' ';
            }
            
        }
        
    }else{
        cout << "No ice cream sales" << endl;
    }
}

# 0203, 2024-10-15 13:26:55, PPPP----P (55%)

#include <iostream>
#include <map>
#include <cmath>
int main(){
    int n , m;
    std::cin >> n ;
    std::map<std::string,double> list;
    std::map<std::string,int> buy;
    for(int i = 0 ; i < n ; i++){
        std::string flavor;
        double price;
        std::cin >> flavor >> price;
        list.insert({flavor,price});
    }
    std::cin >> m ;
    int max = 0;
    double sell = 0;
    std::string top_sell = "none";
    for(int i = 0 ; i < m ; i++){
        std::string flavor_want;
        int how_much ;
        std::cin >> flavor_want >> how_much;

        if(list.count(flavor_want)){
            sell += (list[flavor_want]*how_much);
            if(how_much>max){
                top_sell = flavor_want;
                max = how_much;
            }
        }
    }
    if(sell==0){
        std::cout <<"No ice cream sales"<<std::endl;
    }else{
        std::cout << "Total ice cream sales: " << std::round(sell*10)/10 << std::endl;
        std::cout << "Top sales: " << top_sell;
    }

}
# 0204, 2024-10-15 13:27:31, P-PP----P (44%)

#include <iostream>
#include <map>
#include <cmath>
int main(){
    int n , m;
    std::cin >> n ;
    std::map<std::string,double> list;
    std::map<std::string,int> buy;
    for(int i = 0 ; i < n ; i++){
        std::string flavor;
        double price;
        std::cin >> flavor >> price;
        list.insert({flavor,price});
    }
    std::cin >> m ;
    int max = 0;
    double sell = 0;
    std::string top_sell = "none";
    for(int i = 0 ; i < m ; i++){
        std::string flavor_want;
        int how_much ;
        std::cin >> flavor_want >> how_much;

        if(list.count(flavor_want)){
            sell += (list[flavor_want]*how_much);
            if(how_much>max){
                top_sell = flavor_want;
                max = how_much;
            }
        }
    }
    if(sell==0){
        // std::cout <<"No ice cream sales"<<std::endl;
    }else{
        std::cout << "Total ice cream sales: " << std::round(sell*10)/10 << std::endl;
        std::cout << "Top sales: " << top_sell;
    }

}
# 0205, 2024-10-15 13:37:12, PPPP----P (55%)

#include <iostream>
#include <map>
#include <cmath>
#include <vector>
int main(){
    int n , m;
    std::cin >> n ;
    std::map<std::string,double> list;
    std::map<std::string,int> buy;
    std::vector<std::string> top_sell;
    for(int i = 0 ; i < n ; i++){
        std::string flavor;
        double price;
        std::cin >> flavor >> price;
        list.insert({flavor,price});
    }
    std::cin >> m ;
    int max = 0;
    double sell = 0;
    for(int i = 0 ; i < m ; i++){
        std::string flavor_want;
        int how_much ;
        std::cin >> flavor_want >> how_much;
        if(buy.count(flavor_want)){
            buy[flavor_want]+=how_much;
        }else{
            buy.insert({flavor_want , how_much});
        }
        
    }
    for(auto i : buy){
        if(list.count(i.first)){
            sell += (list[i.first]*i.second);
            if(i.second>max){
                top_sell.clear();
                top_sell.push_back(i.first);
                max = i.second;
            }else if(i.second==max){
                top_sell.push_back(i.first);
            }
        }
    }
    if(sell==0){
        std::cout <<"No ice cream sales"<<std::endl;
    }else{
        std::cout << "Total ice cream sales: " << std::round(sell*10)/10 << std::endl;
        std::cout << "Top sales:" ;
        for(std::string i : top_sell){
            std::cout << " " << i;
        }
    }

}
# 0206, 2024-10-15 13:45:26, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <cmath>
#include <vector>
int main(){
    int n , m;
    std::cin >> n ;
    std::map<std::string,double> list;
    std::map<std::string,double> buy;
    std::vector<std::string> top_sell;
    for(int i = 0 ; i < n ; i++){
        std::string flavor;
        double price;
        std::cin >> flavor >> price;
        list.insert({flavor,price});
    }
    std::cin >> m ;
    int max = 0;
    double sell = 0;
    for(int i = 0 ; i < m ; i++){
        std::string flavor_want;
        int how_much ;
        std::cin >> flavor_want >> how_much;
        if(buy.count(flavor_want)){
            buy[flavor_want]+=how_much;
        }else{
            buy.insert({flavor_want , how_much});
        }
        
    }
    for(auto i : buy){
        i.second =  i.second*list[i.first];
        sell += i.second;
            if(i.second>max){
                top_sell.clear();
                top_sell.push_back(i.first);
                max = i.second;
            }else if(i.second==max){
                top_sell.push_back(i.first);
            }
        
    }
    if(sell==0){
        std::cout <<"No ice cream sales"<<std::endl;
    }else{
        std::cout << "Total ice cream sales: " << std::round(sell*10)/10.0 << std::endl;
        std::cout << "Top sales:" ;
        for(std::string i : top_sell){
            std::cout << " " << i;
        }
    }

}

# 0207, 2024-10-15 13:38:58, -PPPPPPPP (88%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,maxx=0;
    cin >> n;
    double total=0;
    map<string,pair<double,int>> icecream;
    for(int i{0} ; i<n ; i++){
       string name;
       double prize;
       cin >> name >> prize;
       icecream[name].first = prize;
    }
    cin >> n;
    bool canSale = false;
    for(int i{0} ; i<n ; i++){
       string name;
       int amount;
       cin >> name >> amount;
       auto it = icecream.find(name);
       if(it != icecream.end()){
            icecream[name].second += amount;
            canSale = true;
       }
    }
    for(auto &s : icecream){
        s.second.first = s.second.second*s.second.first;
        if(s.second.first > maxx) maxx = s.second.first;
        total += s.second.first;
    }
    if(!canSale) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto s : icecream){
            if(s.second.first == maxx)
            cout << s.first << " ";
        }
    }

}
# 0208, 2024-10-15 13:47:02, -PPPPPPPP (88%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,maxx=0;
    cin >> n;
    double total=0;
    map<string,pair<double,int>> icecream;
    for(int i{0} ; i<n ; i++){
       string name;
       double prize;
       cin >> name >> prize;
       icecream[name].first = prize;
    }
    cin >> n;
    bool canSale = false;
    for(int i{0} ; i<n ; i++){
       string name;
       int amount;
       cin >> name >> amount;
       auto it = icecream.find(name);
       if(it != icecream.end()){
            icecream[name].second += amount;
            canSale = true;
       }
    }
    for(auto &s : icecream){
        s.second.first = s.second.second*s.second.first;
        if(s.second.first > maxx) maxx = s.second.first;
        total += s.second.first;
    }
    if(!canSale) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << total << endl;
        if(total != 0){
        cout << "Top sales: ";
        for(auto s : icecream){
            if(s.second.first == maxx) cout << s.first << " ";
        }
        }
    }

}
# 0209, 2024-10-15 13:47:27, -PPPPPPPP (88%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,maxx=0;
    cin >> n;
    double total=0;
    map<string,pair<double,int>> icecream;
    for(int i{0} ; i<n ; i++){
       string name;
       double prize;
       cin >> name >> prize;
       icecream[name].first = prize;
    }
    cin >> n;
    bool canSale = false;
    for(int i{0} ; i<n ; i++){
       string name;
       int amount;
       cin >> name >> amount;
       auto it = icecream.find(name);
       if(it != icecream.end()){
            icecream[name].second += amount;
            canSale = true;
       }
    }
    for(auto &s : icecream){
        s.second.first = s.second.second*s.second.first;
        if(s.second.first > maxx) maxx = s.second.first;
        total += s.second.first;
    }
    if(total==0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << total << endl;
        if(total != 0){
        cout << "Top sales: ";
        for(auto s : icecream){
            if(s.second.first == maxx) cout << s.first << " ";
        }
        }
    }

}
# 0210, 2024-10-15 13:50:03, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    double total=0,maxx=0;
    map<string,pair<double,int>> icecream;
    for(int i{0} ; i<n ; i++){
       string name;
       double prize;
       cin >> name >> prize;
       icecream[name].first = prize;
    }
    cin >> n;
    bool canSale = false;
    for(int i{0} ; i<n ; i++){
       string name;
       int amount;
       cin >> name >> amount;
       auto it = icecream.find(name);
       if(it != icecream.end()){
            icecream[name].second += amount;
            canSale = true;
       }
    }
    for(auto &s : icecream){
        s.second.first = s.second.second*s.second.first;
        if(s.second.first > maxx) maxx = s.second.first;
        total += s.second.first;
    }
    if(!canSale) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto s : icecream){
            if(s.second.first == maxx) cout << s.first << " ";
        }
    }

}

# 0211, 2024-10-15 13:11:23, Compilation error (0%)

hello mama
# 0212, 2024-10-15 13:45:29, PPPP----P (55%)

#include<iostream>
#include<map>
#include<vector>
using namespace std;

int main(){
    int n;
    cin>>n;
    string taste;
    double price;
    map<string, double> total;
    for(int i =0;i<n;i++){
        cin>>taste>>price;
        total[taste] = price;
    }
    int m;
    cin>>m;
    cin.ignore();
    string want;
    double piece;
    double sum = 0;
    map<string ,double>sale;
    for(int i =0;i<m;i++){
        cin>>want>>piece;
        if(total.find(want) != total.end()){
            sum += (total[want] * piece);
            sale[want] += piece;
        }
    }
    
    if(sum == 0){
        cout<<"No ice cream sales"<<endl;
        return 0;
    }
    cout<<"Total ice cream sales: " << sum<<endl;
    
    double maxSales = 0;
    for (auto &e : sale) {
        if (e.second > maxSales) {
            maxSales = e.second;
        }
    }

    cout << "Top sales: ";
    for (auto &e : sale) {
        if (e.second == maxSales) {
            cout << e.first << endl;
        }
    }
    
}
# 0213, 2024-10-15 13:51:58, Compilation error (0%)

#include<iostream>
#include<map>
#include<vector>
using namespace std;

int main(){
    int n;
    cin>>n;
    string taste;
    double price;
    map<string, double> total;
    for(int i =0;i<n;i++){
        cin>>taste>>price;
        total[taste] = price;
    }
    int m;
    cin>>m;
    cin.ignore();
    string want;
    double piece;
    double sum = 0;
    map<string ,double>sale;
    for(int i =0;i<m;i++){
        cin>>want>>piece;
        if(total.find(want) != total.end()){
            sale[want] += total[want] * piece;
            sum += total[want] * piece;
        }
    }
    
    if(sum == 0){
        cout<<"No ice cream sales"<<endl;
        return 0;
    }
    cout<<"Total ice cream sales: " << sum<<endl;
    double maxSales = 0;
    for (auto &e : sale) {
        if (e.second > maxSales) {
            maxSales = e.second;
        }
    }
    vector<string> topSales;
    for (auto &e : sale) {
        if (e.second == maxSales) {
            topSales.push_back(e.first);
        }
    }
    sort(topSales.begin(), topSales.end());
    cout << "Top sales: ";
    
    for (int i = 0; i < topSales.size(); i++) {
        cout << topSales[i];
        if (i != topSales.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}
# 0214, 2024-10-15 13:52:26, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    cin>>n;
    string taste;
    double price;
    map<string, double> total;
    for(int i =0;i<n;i++){
        cin>>taste>>price;
        total[taste] = price;
    }
    int m;
    cin>>m;
    cin.ignore();
    string want;
    double piece;
    double sum = 0;
    map<string ,double>sale;
    for(int i =0;i<m;i++){
        cin>>want>>piece;
        if(total.find(want) != total.end()){
            sale[want] += total[want] * piece;
            sum += total[want] * piece;
        }
    }
    
    if(sum == 0){
        cout<<"No ice cream sales"<<endl;
        return 0;
    }
    cout<<"Total ice cream sales: " << sum<<endl;
    double maxSales = 0;
    for (auto &e : sale) {
        if (e.second > maxSales) {
            maxSales = e.second;
        }
    }
    vector<string> topSales;
    for (auto &e : sale) {
        if (e.second == maxSales) {
            topSales.push_back(e.first);
        }
    }
    sort(topSales.begin(), topSales.end());
    cout << "Top sales: ";
    
    for (int i = 0; i < topSales.size(); i++) {
        cout << topSales[i];
        if (i != topSales.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}

# 0215, 2024-10-15 13:19:52, PPPP---PP (66%)

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

int main(){
    int n;
    cin >> n;
    unordered_map<string,double> mp;
    string s;
    double x;
    for(int i=0;i<n;i++){
        cin >> s >> x;
        mp[s] = x;
    }

    int m;
    cin >> m;
    double res = 0;
    unordered_map<string,double> sales;
    priority_queue<pair<double,string>> pq;
    for(int i=0;i<m;i++){
        cin >> s >> x;
        if(mp[s]){
            res += mp[s] * x;
            sales[s] += mp[s] * x;
            if(!pq.empty()&&pq.top().second == s){
                pq.pop();
            }
            pq.push({sales[s],s});
        }
    }
    

    if(sales.size() == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales:  " << res << "\nTop sales: " << pq.top().second;
    }
}
# 0216, 2024-10-15 13:20:29, PPPP---PP (66%)

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

int main(){
    int n;
    cin >> n;
    unordered_map<string,double> mp;
    string s;
    double x;
    for(int i=0;i<n;i++){
        cin >> s >> x;
        mp[s] = x;
    }

    int m;
    cin >> m;
    double res = 0;
    unordered_map<string,double> sales;
    priority_queue<pair<double,string>> pq;
    for(int i=0;i<m;i++){
        cin >> s >> x;
        if(mp[s]){
            res += mp[s] * x;
            sales[s] += mp[s] * x;
            if(!pq.empty()&&pq.top().second == s){
                pq.pop();
            }
            pq.push({sales[s],s});
        }
    }
    
    if(sales.size() == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << res << "\nTop sales: " << pq.top().second;
    }
}
# 0217, 2024-10-15 13:22:15, PPPP---PP (66%)

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

int main(){
    int n;
    cin >> n;
    unordered_map<string,double> mp;
    string s;
    double x;
    for(int i=0;i<n;i++){
        cin >> s >> x;
        mp[s] = x;
    }

    int m;
    cin >> m;
    double res = 0;
    unordered_map<string,double> sales;
    priority_queue<pair<double,string>> pq;
    for(int i=0;i<m;i++){
        cin >> s >> x;
        if(mp[s]){
            res += mp[s] * x;
            sales[s] += mp[s] * x;
            pq.push({sales[s],s});
        }
    }
    
    if(sales.size() == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << res << "\nTop sales: " << pq.top().second;
    }
}
# 0218, 2024-10-15 13:43:52, PPPPPPPPP (100%)

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

bool cmp(const pair<double,string>&lhs,const pair<double,string>&rhs){
    if(lhs.first == rhs.first){
        return lhs.second < rhs.second;
    }
    return lhs.first > rhs.first;
}

int main(){
    int n;
    cin >> n;
    unordered_map<string,double> mp;
    string s;
    double x;
    for(int i=0;i<n;i++){
        cin >> s >> x;
        mp[s] = x;
    }

    int m;
    cin >> m;
    double res = 0;
    unordered_map<string,double> sales;
    for(int i=0;i<m;i++){
        cin >> s >> x;
        if(mp[s]){
            res += mp[s] * x;
            sales[s] += mp[s] * x;
        }
    }

    if(sales.size() == 0){
        cout << "No ice cream sales";
    }
    else{
        vector<pair<double,string>> v;
        for(auto&it:sales){
            v.push_back({it.second,it.first});
        }
        sort(v.begin(),v.end(),cmp);
        cout << "Total ice cream sales: " << res << "\nTop sales: ";
        double mx = v[0].first;
        for(int i=0;i<v.size();i++){
            if(v[i].first >= mx){
                cout << v[i].second << " ";
            }
            else{
                break;
            }
        }
    }
}

# 0219, 2024-10-15 13:39:11, PPPP---PP (66%)

#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>

bool compareVector(std::pair<std::string, float> p1, std::pair<std::string, float> p2)
{
    return p1.second > p2.second;
}

int main(int argc, char const *argv[])
{
    unsigned n;
    std::cin >> n;

    /*name , price*/
    std::map<std::string, float> productList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        float price;
        std::cin >> name >> price;
        productList[name] = price;
    }

    std::cin >> n;
    float total = 0;
    std::vector<std::pair<std::string, float>> saleList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        unsigned amount;
        std::cin >> name >> amount;
        if (productList.find(name) != productList.end())
        {
            total += productList[name] * amount;
            auto itr = saleList.begin();
            for (; itr != saleList.end(); itr++)
            {
                auto &sale = *itr;
                if (sale.first == name)
                {
                    sale.second += productList[name] * amount;
                    break;
                }
            }
            if (itr == saleList.end())
            {
                saleList.push_back({name, productList[name] * amount});
            }
        }
    }

    if (total)
    {
        std::cout << "Total ice cream sales: " << total << std::endl;
        std::cout << "Top sales: ";

        std::sort(saleList.begin(), saleList.end(), compareVector);
        float max = saleList[0].second;
        for (auto sale : saleList)
        {
            if (sale.second == max)
            {
                std::cout << sale.first << ' ';
            }
            else
            {
                break;
            }
        }
    }
    else
    {
        std::cout << "No ice cream sales" << std::endl;
    }

    return 0;
}
# 0220, 2024-10-15 13:40:02, PPPP---PP (66%)

#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>

bool compareVector(std::pair<std::string, double> p1, std::pair<std::string, double> p2)
{
    return p1.second > p2.second;
}

int main(int argc, char const *argv[])
{
    unsigned n;
    std::cin >> n;

    /*name , price*/
    std::map<std::string, double> productList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        double price;
        std::cin >> name >> price;
        productList[name] = price;
    }

    std::cin >> n;
    double total = 0;
    std::vector<std::pair<std::string, double>> saleList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        unsigned amount;
        std::cin >> name >> amount;
        if (productList.find(name) != productList.end())
        {
            total += productList[name] * amount;
            auto itr = saleList.begin();
            for (; itr != saleList.end(); itr++)
            {
                auto &sale = *itr;
                if (sale.first == name)
                {
                    sale.second += productList[name] * amount;
                    break;
                }
            }
            if (itr == saleList.end())
            {
                saleList.push_back({name, productList[name] * amount});
            }
        }
    }

    if (total)
    {
        std::cout << "Total ice cream sales: " << total << std::endl;
        std::cout << "Top sales: ";

        std::sort(saleList.begin(), saleList.end(), compareVector);
        double max = saleList[0].second;
        for (auto sale : saleList)
        {
            if (sale.second == max)
            {
                std::cout << sale.first << ' ';
            }
            else
            {
                break;
            }
        }
    }
    else
    {
        std::cout << "No ice cream sales" << std::endl;
    }

    return 0;
}
# 0221, 2024-10-15 13:43:35, PPPPPPPPP (100%)

#include <iostream>
#include <string>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>

bool compareVector(std::pair<std::string, float> p1, std::pair<std::string, float> p2)
{
    if (p1.second == p2.second)
    {
        return p1.first < p2.first;
    }
    else
    {
        return p1.second > p2.second;
    }
}

int main(int argc, char const *argv[])
{
    unsigned n;
    std::cin >> n;

    /*name , price*/
    std::map<std::string, float> productList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        float price;
        std::cin >> name >> price;
        productList[name] = price;
    }

    std::cin >> n;
    float total = 0;
    std::vector<std::pair<std::string, float>> saleList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        unsigned amount;
        std::cin >> name >> amount;
        if (productList.find(name) != productList.end())
        {
            total += productList[name] * amount;
            auto itr = saleList.begin();
            for (; itr != saleList.end(); itr++)
            {
                auto &sale = *itr;
                if (sale.first == name)
                {
                    sale.second += productList[name] * amount;
                    break;
                }
            }
            if (itr == saleList.end())
            {
                saleList.push_back({name, productList[name] * amount});
            }
        }
    }

    if (total)
    {
        std::cout << "Total ice cream sales: " << total << std::endl;
        std::cout << "Top sales: ";

        std::sort(saleList.begin(), saleList.end(), compareVector);
        float max = saleList[0].second;
        for (auto sale : saleList)
        {
            if (sale.second == max)
            {
                std::cout << sale.first << ' ';
            }
            else
            {
                break;
            }
        }
    }
    else
    {
        std::cout << "No ice cream sales" << std::endl;
    }

    return 0;
}
# 0222, 2024-10-15 13:52:17, PPPPPPPPP (100%)

#include <iostream>
#include <string>
#include <map>
#include <utility>

int main(int argc, char const *argv[])
{
    unsigned n;
    std::cin >> n;

    /*name , price , totalSale*/
    std::map<std::string, std::pair<float, float>> productList;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        float price;
        std::cin >> name >> price;
        productList[name] = {price, 0};
    }

    std::cin >> n;
    float total = 0;
    float topSale = 0;
    for (unsigned i = 0; i < n; i++)
    {
        std::string name;
        unsigned amount;
        std::cin >> name >> amount;
        if (productList.find(name) != productList.end())
        {
            total += productList[name].first * amount;
            productList[name].second += productList[name].first * amount;
            if (productList[name].second > topSale)
            {
                topSale = productList[name].second;
            }
        }
    }

    if (total)
    {
        std::cout << "Total ice cream sales: " << total << std::endl;
        std::cout << "Top sales: ";
        for (auto sale : productList)
        {
            if (sale.second.second == topSale)
            {
                std::cout << sale.first << ' ';
            }
        }
    }
    else
    {
        std::cout << "No ice cream sales" << std::endl;
    }

    return 0;
}

# 0223, 2024-10-15 13:17:50, Compilation error (0%)

.
# 0224, 2024-10-15 13:54:32, PPPP---PP (66%)

#include <bits/stdc++.h>
using namespace std;
struct compareByVal
{
    bool operator()(const std::pair<string, int> &a, const std::pair<string, int> &b) const
    {
        return a.second < b.second;
    }
};
int main()
{
    map<string, double> ice;
    map<string, double> maxice;
    double sum = 0;
    int n, m;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        string a;
        double b;
        cin >> a >> b;
        ice[a] = b;
    }
    cin >> m;
    for (int i = 0; i < m; ++i)
    {
        string a;
        double b;
        cin >> a >> b;
        if (ice.find(a) != ice.end())
        {
            sum += b * ice[a];
            maxice[a] += (b * ice[a]);
        }
    }
    auto maxSale = max_element(maxice.begin(), maxice.end(), compareByVal());
    if (sum == 0)
    {
        cout << "No ice cream sales ";
        return 0;
    }
    cout << "Total ice cream sales: " << sum<<endl;
    if(maxSale != maxice.end()){
        cout << "Top sales: " << maxSale->first<< endl;
    }
}
# 0225, 2024-10-15 13:59:04, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
struct compareByVal
{
    bool operator()(const std::pair<string, int> &a, const std::pair<string, int> &b) const
    {
        return a.second < b.second;
    }
};
int main()
{
    map<string, double> ice;
    map<string, double> maxice;
    double sum = 0;
    int n, m;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        string a;
        double b;
        cin >> a >> b;
        ice[a] = b;
    }
    cin >> m;
    for (int i = 0; i < m; ++i)
    {
        string a;
        double b;
        cin >> a >> b;
        if (ice.find(a) != ice.end())
        {
            sum += b * ice[a];
            maxice[a] += (b * ice[a]);
        }
    }

    if (sum == 0)
    {
        cout << "No ice cream sales ";
        return 0;
    }
    double maxVal = 0;
    vector<string> topSales;
    for (const auto &item : maxice)
    {
        if (item.second > maxVal)
        {
            maxVal = item.second;
            topSales.clear();
            topSales.push_back(item.first);
        }
        else if (item.second == maxVal)
        {
            topSales.push_back(item.first);
        }
    }
    sort(topSales.begin(), topSales.end());
    cout << "Total ice cream sales: " << sum << endl;
    cout << "Top sales: ";
    for (size_t i = 0; i < topSales.size(); ++i)
    {
        if (i > 0)
            cout << " ";
        cout << topSales[i];
    }
    cout << endl;

    return 0;
}

# 0226, 2024-10-15 13:32:51, -P------- (11%)

#include<iostream>
#include <iomanip>
#include<cmath>
#include<algorithm>
#include<tuple>

#include<vector>
using namespace std;

int main(){
    int n;
    cin >> n;
  string name ; 
  double price ; 
  
  vector<tuple<double, string, double>>  products;
  for (int i = 0; i <n; ++i)
  {
    cin >>name;
    cin >> price;
    products.push_back(make_tuple(0.0,name,price));
  
  }
  int k;
  
   cin >> k;

  int x;
  for (int i = 0; i  <  k ; ++i)
  { 
    cin >> name;
    cin >> x;
    for (auto & p : products){
      if (get<1>(p) == name)
      {
        get<0>(p) -= get<2>(p)*x;
        break;
      }
      
    }
  }
  
   
  sort(products.begin(), products.end());
  int j = 0;
  bool nosale  = true;
  for(auto & p : products) {
    if (get<0>(p) == 0)
    {
      break;
    }
    
    cout << get<1>(p) <<" " <<-get<0>(p) <<endl;
    nosale = false ;
    if ( ++j == 1)
    {
      break;
    }
    
  }
  if (nosale)
  {
    /* code */cout << "No ice cream sales";
  
    
}
}
# 0227, 2024-10-15 13:43:17, -P----P-- (22%)

#include<iostream>
#include <iomanip>
#include<cmath>
#include<algorithm>
#include<tuple>

#include<vector>
using namespace std;

int main(){
    int n;
    cin >> n;
  string name ; 
  double price ; 
  
  vector<tuple<double, string, double>>  products;
  for (int i = 0; i <n; ++i)
  {
    cin >>name;
    cin >> price;
    products.push_back(make_tuple(0.0,name,price));
  
  }
  int k;
  
   cin >> k;

  int x;
  for (int i = 0; i  <  k ; ++i)
  { 
    cin >> name;
    cin >> x;
    for (auto & p : products){
      if (get<1>(p) == name)
      {
        get<0>(p) -= get<2>(p)*x;
        break;
      }
      
    }
  }
  
   
  sort(products.begin(), products.end());
  int j = 0;
  bool nosale  = true;
  double sum = 0 ;
  for(auto & p : products) {
    
    if (get<0>(p) == 0)
    {
      break;
    } else {
        sum -= get<0>(p);
    }

  }
  if (sum != 0){
    cout<<"Total ice cream sales: " << sum <<endl;
  cout <<"Top sales: ";

  }


  for(auto & p : products) {
    
     if (sum == 0)
    {
      break;
    }
    cout << get<1>(p)<< " " ;
    nosale = false ;
    if ( ++j == 2)
    {
      break;
    }
    
  }
  if (nosale)
  {
    /* code */cout << "No ice cream sales";
  
    
}
}
# 0228, 2024-10-15 13:51:14, PPPPPPPPP (100%)

#include<iostream>
#include <iomanip>
#include<cmath>
#include<algorithm>
#include<tuple>

#include<vector>
using namespace std;

int main(){
    int n;
    cin >> n;
  string name ; 
  double price ; 
  
  vector<tuple<double, string, double>>  products;
  for (int i = 0; i <n; ++i)
  {
    cin >>name;
    cin >> price;
    products.push_back(make_tuple(0.0,name,price));
  
  }
  int k;
  
   cin >> k;

  int x;
  for (int i = 0; i  <  k ; ++i)
  { 
    cin >> name;
    cin >> x;
    for (auto & p : products){
      if (get<1>(p) == name)
      {
        get<0>(p) -= get<2>(p)*x;
        break;
      }
      
    }
  }
  
   
  sort(products.begin(), products.end());
  int j = 0;
  bool nosale  = true;
  double sum = 0 ;
  for(auto & p : products) {
    
    if (get<0>(p) == 0)
    {
      break;
    } else {
        sum -= get<0>(p);
    }

  }
  if (sum != 0){
    cout<<"Total ice cream sales: " << sum <<endl;
  cout <<"Top sales: ";

  }

double o = get<0>(products[0]) ;
  for(auto & p : products) {
    
     if (sum == 0)
    {
      break;
    }
    
    
    if (get<0>(p) > o)
    {
      break;
    } else {
    cout << get<1>(p)<< " " ;
    nosale = false ;
    }
    x = get<0>(p);
    
  }
  if (nosale)
  {
    /* code */cout << "No ice cream sales";
  
    
}
}

# 0229, 2024-10-15 13:47:08, -P------- (11%)

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

int main () {

    map<string , double> m ;
    int k ; 
    string name ;
    double sold ;
    cin >> k ;

    while (k--) {
        cin >> name >> sold ;
        m[name] = sold ;
    }

    cin >> k ;
    double count , ans = 0;
    map<string , int> sum ;

    while (k--) {
        cin >> name >> count ;
        sum[name] += count ;
        
        if (m.find(name) != m.end()) {
            ans += m[name] * count ;
        }
        
    }

    double maxint = 0 ;
    string namemax ;
    
    for (auto &e : sum) {
        if (m.find(e.first) != m.end()) {
            double q = sum[e.first] * m[e.first] ; 
            if (q > maxint) { 
                maxint = q ;
                namemax = e.first ; 
            } else if (q == maxint) {
                namemax += " " + e.first ; 
            }
        }
    }



    if (ans == 0) {
        cout << "No ice cream sales" ;
    } else {
        cout << "ToTal ice cream sales: " << ans << endl ;
        cout << "Top sale: " << namemax ;
    }
}
# 0230, 2024-10-15 13:47:39, -P------- (11%)

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

int main () {

    map<string , double> m ;
    int k ; 
    string name ;
    double sold ;
    cin >> k ;

    while (k--) {
        cin >> name >> sold ;
        m[name] = sold ;
    }

    cin >> k ;
    double count , ans = 0;
    map<string , int> sum ;

    while (k--) {
        cin >> name >> count ;
        sum[name] += count ;
        
        if (m.find(name) != m.end()) {
            ans += m[name] * count ;
        }
        
    }

    double maxint = 0 ;
    string namemax ;
    
    for (auto &e : sum) {
        if (m.find(e.first) != m.end()) {
            double q = sum[e.first] * m[e.first] ; 
            if (q > maxint) { 
                maxint = q ;
                namemax = e.first ; 
            } else if (q == maxint) {
                namemax += " " + e.first ; 
            }
        }
    }



    if (ans == 0) {
        cout << "No ice cream sales" ;
    } else {
        cout << "ToTal ice cream sales: " << ans << endl ;
        cout << "Top sales: " << namemax ;
    }
}
# 0231, 2024-10-15 13:48:27, PPPPPPPPP (100%)

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

int main () {

    map<string , double> m ;
    int k ; 
    string name ;
    double sold ;
    cin >> k ;

    while (k--) {
        cin >> name >> sold ;
        m[name] = sold ;
    }

    cin >> k ;
    double count , ans = 0;
    map<string , int> sum ;

    while (k--) {
        cin >> name >> count ;
        sum[name] += count ;
        
        if (m.find(name) != m.end()) {
            ans += m[name] * count ;
        }
        
    }

    double maxint = 0 ;
    string namemax ;
    
    for (auto &e : sum) {
        if (m.find(e.first) != m.end()) {
            double q = sum[e.first] * m[e.first] ; 
            if (q > maxint) { 
                maxint = q ;
                namemax = e.first ; 
            } else if (q == maxint) {
                namemax += " " + e.first ; 
            }
        }
    }



    if (ans == 0) {
        cout << "No ice cream sales" ;
    } else {
        cout << "Total ice cream sales: " << ans << endl ;
        cout << "Top sales: " << namemax ;
    }
}

# 0232, 2024-10-15 13:25:59, -PP-----P (33%)

#include<iostream>
#include<map>
#include<set>
using namespace std;

int main()
{
    cin.tie(0)->ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<string,float> stock;
    float total = 0;
    for(int i=1;i<=n;i++)
    {
        string a;
        float b;
        cin>>a>>b;
        stock[a] = b;
    }
    int m;
    cin>>m;
    bool check = 0;
    set<pair<float,string>> check_top;
    for(int i=1;i<=m;i++)
    {
        string a;
        float b;
        cin>>a>>b;
        auto it = stock.find(a);
        if(it != stock.end())
        {
            check_top.insert({b * stock[a],a});
            total += b * stock[a];
            check = 1;
        }
    }
    if(check == 1)
    {
        cout<<"Total ice cream sales: "<<total<<'\n';
        cout<<"Top sales: ";
        int i = 0;
        for(auto a : check_top)
        {
            if(i == 1)break;
            cout<<a.second<<'\n';
            i ++;
        }
    }
    else
    {
        cout<<"No ice cream sales";
    }
}
/*

5
Magnum 50
Cornetto 25
PaddlePop 15.50
AsianDelight 20
Calippo 15
3
Cookie 20
MamaTomYum 3
MangoSheet 10


*/
# 0233, 2024-10-15 13:36:27, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<set>
using namespace std;

int main()
{
    cin.tie(0)->ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<string,float> stock;
    float total = 0;
    for(int i=1;i<=n;i++)
    {
        string a;
        float b;
        cin>>a>>b;
        stock[a] = b;
    }
    int m;
    cin>>m;
    bool check = 0;
    // multiset<pair<float,string>> check_top;
    map<string,float> check_top = {};
    float maxx = -1;
    for(int i=1;i<=m;i++)
    {
        string a;
        float b;
        cin>>a>>b;
        auto it = stock.find(a);
        if(it != stock.end())
        {
            // check_top.insert({b * stock[a],a});
            check_top[a] += b * stock[a];
            total += b * stock[a];
            check = 1;
        }
    }
    for(auto a : check_top)
    {
        if(maxx < a.second)
        {
            maxx = a.second;
        }
    }
    if(check == 1)
    {
        cout<<"Total ice cream sales: "<<total<<'\n';
        cout<<"Top sales: ";
        for(auto a : check_top)
        {
            if(a.second == maxx)
            {
                cout<<a.first<<' ';
            }
        }
    }
    else
    {
        cout<<"No ice cream sales";
    }
}
/*

5
Magnum 50
Cornetto 25
PaddlePop 15.50
AsianDelight 20
Calippo 15
3
Cookie 20
MamaTomYum 3
MangoSheet 10


*/
# 0234, 2024-10-15 13:43:45, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<set>
using namespace std;
int main(){
    cin.tie(0)->ios::sync_with_stdio(false);
    int n;
    cin>>n;
    map<string,float> stock;
    float total = 0;
    for(int i=1;i<=n;i++){
        string a;
        float b;
        cin>>a>>b;
        stock[a] = b;
    }
    int m;
    cin>>m;
    bool check = 0;
    map<string,float> check_top = {};
    float maxx = -1;
    for(int i=1;i<=m;i++){
        string a;
        float b;
        cin>>a>>b;
        auto it = stock.find(a);
        if(it != stock.end()){
            check_top[a] += b * stock[a];
            total += b * stock[a];
            check = 1;
        }
    }
    for(auto a : check_top){
        if(maxx < a.second)maxx = a.second;
    }
    if(check == 1){
        cout<<"Total ice cream sales: "<<total<<'\n';
        cout<<"Top sales: ";
        for(auto a : check_top){
            if(a.second == maxx)cout<<a.first<<' ';
        }
    }
    else cout<<"No ice cream sales";
}

# 0235, 2024-10-15 13:22:35, -PPPP---P (55%)

#include <bits/stdc++.h>

using namespace std;
typedef double db;

map<string,db> price;
int main(){
    int n; cin >> n;
    while(n--){
        string x; db y; cin >> x >> y;
        price[x] = y;
    }
    int m; cin >> m;
    db max = 0;
    // string max_ice;
    set<string> max_ice;
    // vector<pair<string,db>> pri;
    map<string,db> pri;
    db total = 0;
    while(m--){
        string ice; db z;
        cin >> ice >> z;
        db plus = price[ice] * z;
        pri[ice] += plus;
        if(plus > max){
            max = plus;
        }
        total += plus;
    }
    for(auto [a,b] : pri){
        if(b == max){
            max_ice.insert(a);
        }
    }
    if(total != 0){
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: " ;
        for(auto a : max_ice) cout << a << ' ';
        cout << '\n';   
    }
    else{
        cout << "No ice cream sales";
    }
    
}
# 0236, 2024-10-15 13:27:44, --------- (0%)

#include <bits/stdc++.h>

using namespace std;
typedef double db;

map<string,db> price;
int main(){
    int n; cin >> n;
    while(n--){
        string x; db y; cin >> x >> y;
        price[x] = y;
    }
    int m; cin >> m;
    db max = 0;
    // string max_ice;
    set<string> max_ice;
    // vector<pair<string,db>> pri;
    map<string,db> pri;
    db total = 0;
    while(m--){
        string ice; db z;
        cin >> ice >> z;
        db plus = price[ice] * z;
        pri[ice] += plus;
        // if(plus > max){
        //     max = plus;
        // }
        total += plus;
    }
    for(auto [a,b] : pri){
        if(b > max){
            max = b;
        }
    }

    for(auto [a,b] : pri){
        cout << a << ' ' << b << '\n';
        if(b == max){
            max_ice.insert(a);
        }
    }
    if(total != 0){
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: " ;
        for(auto a : max_ice) cout << a << ' ';
        cout << '\n';   
    }
    else{
        cout << "No ice cream sales";
    }
    
}
# 0237, 2024-10-15 13:28:00, PPPPPPPPP (100%)

#include <bits/stdc++.h>

using namespace std;
typedef double db;

map<string,db> price;
int main(){
    int n; cin >> n;
    while(n--){
        string x; db y; cin >> x >> y;
        price[x] = y;
    }
    int m; cin >> m;
    db max = 0;
    // string max_ice;
    set<string> max_ice;
    // vector<pair<string,db>> pri;
    map<string,db> pri;
    db total = 0;
    while(m--){
        string ice; db z;
        cin >> ice >> z;
        db plus = price[ice] * z;
        pri[ice] += plus;
        // if(plus > max){
        //     max = plus;
        // }
        total += plus;
    }
    for(auto [a,b] : pri){
        if(b > max){
            max = b;
        }
    }

    for(auto [a,b] : pri){
        // cout << a << ' ' << b << '\n';
        if(b == max){
            max_ice.insert(a);
        }
    }
    if(total != 0){
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: " ;
        for(auto a : max_ice) cout << a << ' ';
        cout << '\n';   
    }
    else{
        cout << "No ice cream sales";
    }
    
}

# 0238, 2024-10-15 13:31:31, -PPPPPPPP (88%)

#include<map>
#include<set>
#include<vector>
#include<iostream>
using namespace std;

int main() {
    map<string, double> M;
    map<string, double> Order;
    map<string, double> Top;
    string I;
    int N, Max = 0;
    double price, sum = 0;
    cin >> N;
    while(N--) {
        cin >> I >> price;
        M[I] = price;
    }
    cin >> N;
    while(N--) {
        cin >> I >> price;
        if(Order.find(I) == Order.end())
            Order[I] = 0;
        Order[I] += price;
    }
    for(auto & kv : Order) {
        if(M.find(kv.first) != M.end()) {
            double P = M[kv.first] * Order[kv.first];
            if(P > Max) {
                Max = P;
            }
            Top[kv.first] = P;
            sum += P;
        }
    }
    if(sum == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto &kv : Top) {
            if(kv.second == Max) {
                cout << kv.first << " ";
            }
        }
    }

    return 0;
}
# 0239, 2024-10-15 13:36:15, -PPPPPPPP (88%)

#include<map>
#include<set>
#include<vector>
#include<iostream>
using namespace std;

int main() {
    map<string, double> M;
    map<string, double> Order;
    map<string, double> Top;
    string I;
    int N, Max = 0;
    double price, sum = 0;
    cin >> N;
    while(N--) {
        cin >> I >> price;
        M[I] = price;
    }
    cin >> N;
    while(N--) {
        cin >> I >> price;
        if(Order.find(I) == Order.end())
            Order[I] = 0;
        Order[I] += price;
    }
    for(auto & kv : Order) {
        if(M.find(kv.first) != M.end()) {
            double P = M[kv.first] * Order[kv.first];
            if(P > Max) {
                Max = P;
            }
            Top[kv.first] = P;
            sum += P;
        }
    }
    if(sum == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto &kv : Top) {
            if(kv.second == Max) {
                cout << kv.first << " ";
            }
        }
    }

    return 0;
}
# 0240, 2024-10-15 13:41:24, PPPPPPPPP (100%)

#include<map>
#include<set>
#include<iostream>
using namespace std;

int main() {
    map<string, double> M;
    map<string, double> Order;
    map<string, double> Top;
    string I;
    double price, sum = 0, N, Max = 0;
    cin >> N;
    while(N--) {
        cin >> I >> price;
        M[I] = price;
    }
    cin >> N;
    while(N--) {
        cin >> I >> price;
        if(Order.find(I) == Order.end())
            Order[I] = 0;
        Order[I] += price;
    }
    for(auto & kv : Order) {
        if(M.find(kv.first) != M.end()) {
            double P = M[kv.first] * Order[kv.first];
            if(P > Max) Max = P;
            Top[kv.first] = P;
            sum += P;
        }
    }
    if(sum == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto &kv : Top) {
            if(kv.second == Max) cout << kv.first << " ";
        }
    }
    return 0;
}

# 0241, 2024-10-15 13:25:55, -PP-----P (33%)

#include<iostream>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    double price;
    map<string,double> list;
    cin >> n;
    string name; 
    for(int i = 0; i < n; i++){
        cin >> name >> price;
        list[name] = price;
    }
    vector<pair<double,string>> top;
    int m; cin >> m;
    double total = 0.0;
    string n1; int num;
    for(int i = 0; i < m; i++){
        cin >> n1 >> num;
        if(list.find(n1) != list.end()){
            total = total + (list[n1]*num);
            top.push_back(make_pair((list[n1]*num),n1));
            sort(top.begin(),top.end());
        }
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: " << (top[0].second) << endl;
    }
}
# 0242, 2024-10-15 13:34:40, -P------- (11%)

#include<iostream>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int n;
    double price;
    map<string,double> list;
    cin >> n;
    string name; 
    for(int i = 0; i < n; i++){
        cin >> name >> price;
        list[name] = price;
    }
    vector<pair<double,string>> top;
    int m; cin >> m;
    double total = 0.0;
    string n1; int num;
    double maxtotal = 0;
    map <string, double> mapnametotal;
    for (int i = 0; i < m; i++) {
        cin >> n1 >> num;
        if (list.find(n1) != list.end()) {
            mapnametotal[name] += list[name] * num;
            maxtotal = max(maxtotal, mapnametotal[name]);
            total += list[name] * num;
        }
    }
    if(total == 0){
        cout << "No ice cream sales";
    }else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto itr = mapnametotal.begin(); itr != mapnametotal.end(); itr++) {
            if ((*itr).second == maxtotal) {
                cout << (*itr).first << ' ';
            }
        }
    }
}
# 0243, 2024-10-15 13:37:14, PPPPPPPPP (100%)

#include<iostream>
#include <map>
using namespace std;
int main () {
    int N;
    cin >> N;
    string name;
    double price;
    map <string, double> mapnameprice;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        mapnameprice[name] = price;
    }
    int M;
    cin >> M;
    double number;
    double total = 0;
    double maxtotal = 0;
    map <string, double> mapnametotal;
    for (int i = 0; i < M; i++) {
        cin >> name >> number;
        if (mapnameprice.find(name) != mapnameprice.end()) {
            mapnametotal[name] += mapnameprice[name] * number;
            maxtotal = max(maxtotal, mapnametotal[name]);
            total += mapnameprice[name] * number;
        }
    }
    if (total != 0) {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto itr = mapnametotal.begin(); itr != mapnametotal.end(); itr++) {
            if ((*itr).second == maxtotal) {
                cout << (*itr).first << ' ';
            }
        }
    }
    else {
        cout << "No ice cream sales";
    }
    
}

# 0244, 2024-10-15 13:56:27, P-PP--PPP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> m ,mtotal;
    int n ;
    cin >> n ;
    while(n--){
        string nameice ;
        double price ;
        cin >> nameice >> price ;
        m[nameice] = price ;
        mtotal[nameice] = 0 ;
    }
    
    int k  ;
    double total = 0;
    cin >> k ; 
    while( k-- ){
        string name ;
        double jumnuan ;
        cin >> name >> jumnuan;
        
        if( mtotal.find(name) != m.end()){
            total += m[name] * jumnuan ;
            mtotal[name] +=  m[name] * jumnuan ;
        }

    }
    vector<pair<double,string>> v ;
    for( auto e : mtotal){
       v.push_back(make_pair(-e.second,e.first));
    }
    sort( v.begin(),v.end() );
    if( total != 0 ){
        cout << "Total ice cream sales: "<< total << "\n" << "Top sales: ";
        cout << v[0].second << " " ;
        int i = 0 ;
        while(v[i].first == v[i+1].first ){
            cout << v[i+1].second;
            i++;
        }
        
    }
    

}
# 0245, 2024-10-15 13:57:11, PPPP--PPP (77%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> m ,mtotal;
    int n ;
    cin >> n ;
    while(n--){
        string nameice ;
        double price ;
        cin >> nameice >> price ;
        m[nameice] = price ;
        mtotal[nameice] = 0 ;
    }
    
    int k  ;
    double total = 0;
    cin >> k ; 
    while( k-- ){
        string name ;
        double jumnuan ;
        cin >> name >> jumnuan;
        
        if( mtotal.find(name) != m.end()){
            total += m[name] * jumnuan ;
            mtotal[name] +=  m[name] * jumnuan ;
        }

    }
    vector<pair<double,string>> v ;
    for( auto e : mtotal){
       v.push_back(make_pair(-e.second,e.first));
    }
    sort( v.begin(),v.end() );
    if( total != 0 ){
        cout << "Total ice cream sales: "<< total << "\n" << "Top sales: ";
        cout << v[0].second << " " ;
        int i = 0 ;
        while(v[i].first == v[i+1].first ){
            cout << v[i+1].second;
            i++;
        }
        
    }else{
        cout << "No ice cream sales";
    }
    

}
# 0246, 2024-10-15 14:00:50, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> m ,mtotal;
    int n ;
    cin >> n ;
    while(n--){
        string nameice ;
        double price ;
        cin >> nameice >> price ;
        m[nameice] = price ;
        mtotal[nameice] = 0 ;
    }
    
    int k  ;
    double total = 0;
    cin >> k ; 
    while( k-- ){
        string name ;
        double jumnuan ;
        cin >> name >> jumnuan;
        
        if( mtotal.find(name) != m.end()){
            total += m[name] * jumnuan ;
            mtotal[name] +=  m[name] * jumnuan ;
        }

    }
    vector<pair<double,string>> v ;
    for( auto e : mtotal){
       v.push_back(make_pair(-e.second,e.first));
    }
    sort( v.begin(),v.end() );
    if( total != 0 ){
        cout << "Total ice cream sales: "<< total << "\n" << "Top sales: ";
        cout << v[0].second << " " ;
        int i = 0 ;
        while(v[i].first == v[i+1].first ){
            cout << v[i+1].second<<" ";
            i++;
        }
        
    }else{
        cout << "No ice cream sales";
    }
    

}

# 0247, 2024-10-15 13:27:31, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    map<string, float> icecream;
    map<string, float> total_icecream_buy;
    int max_sell = 0;
    int total_item, total_buy;
    float price;
    float total_money = 0;
    string name;
    cin >> total_item;
    for (int i = 0; i < total_item; i++)
    {
        cin >> name >> price;
        icecream[name] = price;
    }
    cin >> total_buy;
    for (int i = 0; i < total_buy; i++)
    {
        cin >> name >> price;
        total_money += icecream[name] * price;
        if (icecream[name] * price > max_sell)
        {
            max_sell = icecream[name] * price;
        }
        if (icecream[name] * price == 0)
            continue;
        total_icecream_buy[name] += icecream[name] * price;
    }
    if (total_money == 0)
    {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    else
    {
        cout << "Total ice cream sales: " << total_money << endl;
        cout << "Top sales: ";
        for (auto x : total_icecream_buy)
        {
            if (x.second == max_sell)
            {
                cout << x.first << " ";
            }
        }
    }
}
# 0248, 2024-10-15 13:36:07, -PPPPPPPP (88%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    map<string, float> icecream;
    map<string, float> total_icecream_buy;
    int max = 0;
    int total_item, total_buy;
    float price;
    float total_money = 0;
    string name;
    cin >> total_item;
    for (int i = 0; i < total_item; i++)
    {
        cin >> name >> price;
        icecream[name] = price;
    }
    cin >> total_buy;
    for (int i = 0; i < total_buy; i++)
    {
        cin >> name >> price;
        total_money += icecream[name] * price;
        if (icecream[name] * price == 0)
            continue;
        total_icecream_buy[name] += icecream[name] * price;
    }
    if (total_money == 0)
    {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    else
    {
        cout << "Total ice cream sales: " << total_money << endl;
        cout << "Top sales: ";
        for (auto x : total_icecream_buy)
        {
            if (x.second > max)
            {
                max = x.second;
            }
        }
        for (auto x : total_icecream_buy)
        {
            if (x.second == max)
            {
                cout << x.first << " ";
            }
        }
    }
}
# 0249, 2024-10-15 13:41:42, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    map<string, double> icecream;
    map<string, double> total_icecream_buy;
    double max = 0;
    int total_item, total_buy;
    double price;
    double total_money = 0;
    string name;
    cin >> total_item;
    for (int i = 0; i < total_item; i++)
    {
        cin >> name >> price;
        icecream[name] = price;
    }
    cin >> total_buy;
    for (int i = 0; i < total_buy; i++)
    {
        cin >> name >> price;
        total_money += icecream[name] * price;
        if (icecream[name] * price == 0)
            continue;
        total_icecream_buy[name] += icecream[name] * price;
    }
    if (total_money == 0)
    {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    else
    {
        cout << "Total ice cream sales: " << total_money << endl;
        cout << "Top sales: ";
        for (auto x : total_icecream_buy)
        {
            if (x.second > max)
            {
                max = x.second;
            }
        }
        for (auto x : total_icecream_buy)
        {
            if (x.second == max)
            {
                cout << x.first << " ";
            }
        }
    }
}

# 0250, 2024-10-15 13:54:27, TTTTTTTTT (0%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){

map<string,double> ic;
map<string,double> tops;
int n;
cin>>n;
while (n--) {
    string a;
    double b;
    cin>>a>>b;
    ic[a]=b;
    tops[a]=0;
}

double total=0;
cin>>n;
while(n--){
    string a;
    int b;
    cin>>a>>b;
    if(ic.count(a)){
        total+=ic[a]*b;
        tops[a]+=ic[a]*b;
    }
}

if(total==0){
    cout<<"No ice cream sales";
}
else {cout<<"Total ice cream sales: "<<total<<endl;

vector<pair<double,string>> tp;
for (auto i=ic.begin(); i!=ic.end();i++){
    tp.push_back( {i->second , i->first });
}
sort(tp.begin(),tp.end());
cout<<"Top sales: ";
for (int j=0;j<tp.size();j++){
if(tp[j].first==tp[tp.size()-1].first){
cout<<tp[j].second<<" ";
}
}
}
}
# 0251, 2024-10-15 13:54:41, TTTTTTTTT (0%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){

map<string,double> ic;
map<string,double> tops;
int n;
cin>>n;
while (n--) {
    string a;
    double b;
    cin>>a>>b;
    ic[a]=b;
    tops[a]=0;
}

double total=0;
cin>>n;
while(n--){
    string a;
    int b;
    cin>>a>>b;
    if(ic.count(a)){
        total+=ic[a]*b;
        tops[a]+=ic[a]*b;
    }
}

if(total==0){
    cout<<"No ice cream sales";
}
else {cout<<"Total ice cream sales: "<<total<<endl;

vector<pair<double,string>> tp;
for (auto i=ic.begin(); i!=ic.end();i++){
    tp.push_back( {i->second , i->first });
}
sort(tp.begin(),tp.end());
cout<<"Top sales: ";
for (int j=0;j<tp.size();j++){
if(tp[j].first==tp[tp.size()-1].first){
cout<<tp[j].second<<" ";
}
}
}
}
# 0252, 2024-10-15 13:56:51, PPPPPPPPP (100%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main(){

map<string,double> ic;
map<string,double> tops;
int n,k;
cin>>n;
while (n--) {
    string a;
    double b;
    cin>>a>>b;
    ic[a]=b;
    tops[a]=0;
}

double total=0;
cin>>k;
while(k--){
    string a;
    int m;
    cin>>a>>m;
    if(ic.count(a)){
        total+=ic[a]*m;
        tops[a]+=ic[a]*m;
    }
}

if(total==0){
    cout<<"No ice cream sales";
}
else {cout<<"Total ice cream sales: "<<total<<endl;

vector<pair<double,string>> tp;
for (auto i=tops.begin(); i!=tops.end();i++){
    tp.push_back( {i->second , i->first });
}
sort(tp.begin(),tp.end());
cout<<"Top sales: ";

for (int j=0;j<tp.size();j++){
if(tp[j].first==tp[tp.size()-1].first){
cout<<tp[j].second<<" ";
}
}
}
}

# 0253, 2024-10-15 13:36:40, TTTTTTTTT (0%)

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

int main(){
    int n, m;
    cin>>n;

    map<string, float> ice;
    vector<pair<float, string>> ice_sale;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin>>name>>price;
        ice[name] = price;
    }

    cin>>m;
    float total=0;
    for(int i=0; i<m; i++){
        string name;
        int count;
        cin>>name>>count;

        if(ice.find(name) != ice.end()){
            bool f=false;

            for(int i=0; i<ice_sale.size(); i++){
                if(ice_sale[i].second == name){
                    f=true;
                    ice_sale[i].first += count*ice[name];
                    break;
                }
            }
            if(!f) ice_sale.push_back({count*ice[name], name});
            total += count*ice[name];
        }
    }

    if(total>0){
        sort(ice_sale.begin(), ice_sale.end(), [](auto a, auto b){
            return (a.first == b.first)?a.second<b.second:a.first>b.first;
        });
        
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: ";
        for(int i=0; i<ice_sale.size(); i++){
            //cout << ice_sale[i].first << ' ' << ice_sale[i].second << '\n';
            if(ice_sale[i].first == ice_sale[0].first){
                cout << ice_sale[i].second << ' ';
                continue;
            }
            break;
        }
        return 0;
    }
    cout<<"No ice cream sales";
}
# 0254, 2024-10-15 13:42:36, TTTTTTTTT (0%)

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

int main(){
    int n, m;
    cin>>n;

    map<string, float> ice;
    vector<pair<float, string>> ice_sale;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin>>name>>price;
        ice[name] = price;
    }

    cin>>m;
    float total=0;
    for(int i=0; i<m; i++){
        string name;
        int count;
        cin>>name>>count;

        if(ice.find(name) != ice.end()){
            bool f=false;
            float sum = count*ice[name];
            for(int i=0; i<ice_sale.size(); i++){
                if(ice_sale[i].second == name){
                    f=true;
                    ice_sale[i].first += sum;
                    break;
                }
            }
            if(!f) ice_sale.push_back({sum, name});
            total += sum;
        }
    }

    if(total>0){
        sort(ice_sale.begin(), ice_sale.end(), [](auto a, auto b){
            return (a.first == b.first)?a.second<b.second:a.first>b.first;
        });
        
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: ";
        for(int i=0; i<ice_sale.size(); i++){
            //cout << ice_sale[i].first << ' ' << ice_sale[i].second << '\n';
            if(ice_sale[i].first == ice_sale[0].first){
                cout << ice_sale[i].second << ' ';
                continue;
            }
            break;
        }
        return 0;
    }
    cout<<"No ice cream sales";
}
# 0255, 2024-10-15 13:42:48, PPPPPPPPP (100%)

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

int main(){
    int n, m;
    cin>>n;

    map<string, float> ice;
    vector<pair<float, string>> ice_sale;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin>>name>>price;
        ice[name] = price;
    }

    cin>>m;
    float total=0;
    for(int i=0; i<m; i++){
        string name;
        int count;
        cin>>name>>count;

        if(ice.find(name) != ice.end()){
            bool f=false;
            float sum = count*ice[name];
            for(int i=0; i<ice_sale.size(); i++){
                if(ice_sale[i].second == name){
                    f=true;
                    ice_sale[i].first += sum;
                    break;
                }
            }
            if(!f) ice_sale.push_back({sum, name});
            total += sum;
        }
    }

    if(total>0){
        sort(ice_sale.begin(), ice_sale.end(), [](auto a, auto b){
            return (a.first == b.first)?a.second<b.second:a.first>b.first;
        });
        
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: ";
        for(int i=0; i<ice_sale.size(); i++){
            //cout << ice_sale[i].first << ' ' << ice_sale[i].second << '\n';
            if(ice_sale[i].first == ice_sale[0].first){
                cout << ice_sale[i].second << ' ';
                continue;
            }
            break;
        }
        return 0;
    }
    cout<<"No ice cream sales";
}

# 0256, 2024-10-15 13:45:39, Compilation error (0%)

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

struct Icecream
{
    string flavor;
    double price;
};


int main(){

    ios_base::sync_with_stdio(0); cin.tie(0);

    int M, N;
    string flavor;
    double price, number;
    cin >> N;
    vector<Icecream> strored;

    for(int i = 0 ; i < N ; i++)
    {
        /* code */
        cin >> flavor >> price;
        strored.push_back({flavor,price});
    }
    
    cin >> M;
    vector<Icecream> orders;
        for(int i = 0 ; i < M ; i++)
    {
        /* code */
        cin >> flavor >> number;
        orders.push_back({flavor, number});
    }

    set<Icecream> Total;
    double Maxprice = LLONG_MAX;
    double totalprice = 0;
    for(auto &database: strored){
        
        double sumprice = 0;
        for(auto &order:orders){

            if(database.flavor == order.flavor){
                sumprice += (database.price * order.price);
            }else{
                continue;
            }
        }

        Total.insert({database.flavor, sumprice});
        totalprice += sumprice;
    }

    cout << "Total ice cream sales: "<< endl;

    cout << "Top sales: ";
    for(auto &x:Total){
        if(x.price == Maxprice){
            cout << x.flavor << " ";
        }
    }



    return 0;
}
# 0257, 2024-10-15 13:52:02, Compilation error (0%)

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

struct Icecream
{
    string flavor;
    double price;
};

bool cmp()


int main(){

    ios_base::sync_with_stdio(0); cin.tie(0);

    int M, N;
    string flavor;
    double price, number;
    cin >> N;
    vector<Icecream> strored;

    for(int i = 0 ; i < N ; i++)
    {
        /* code */
        cin >> flavor >> price;
        strored.push_back({flavor,price});
    }
    
    cin >> M;
    vector<Icecream> orders;
        for(int i = 0 ; i < M ; i++)
    {
        /* code */
        cin >> flavor >> number;
        orders.push_back({flavor, number});
    }

    vector<Icecream> Total;
    double Maxprice = -1e9;
    double totalprice = 0;
    bool flag = 0;
    for(auto &database: strored){
        
        double sumprice = 0;
        for(auto &order:orders){

            if(database.flavor == order.flavor){
                sumprice += (database.price * order.price);
                flag = true;
            }else{
                continue;
            }

            
        }

        Total.push_back({database.flavor, sumprice});
        totalprice += sumprice;
        Maxprice = max(Maxprice, sumprice);
    }

    sort(Total.begin(), Total.end(),cmp);\

    if(flag == true){

    cout << "Total ice cream sales: "<< totalprice << endl;

    cout << "Top sales: ";
    for(auto &x:Total){
        if(x.price == Maxprice){
            cout << x.flavor << " ";
        }
    }

    }else{
        cout << "No ice cream sales";
    }


    return 0;
}
# 0258, 2024-10-15 13:54:29, PPPPPPPPP (100%)

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

struct Icecream
{
    string flavor;
    double price;
};

bool cmp(Icecream &a, Icecream&b){
    return a.flavor < b.flavor;
}


int main(){

    ios_base::sync_with_stdio(0); cin.tie(0);

    int M, N;
    string flavor;
    double price, number;
    cin >> N;
    vector<Icecream> strored;

    for(int i = 0 ; i < N ; i++)
    {
        /* code */
        cin >> flavor >> price;
        strored.push_back({flavor,price});
    }
    
    cin >> M;
    vector<Icecream> orders;
        for(int i = 0 ; i < M ; i++)
    {
        /* code */
        cin >> flavor >> number;
        orders.push_back({flavor, number});
    }

    vector<Icecream> Total;
    double Maxprice = -1e9;
    double totalprice = 0;
    bool flag = 0;
    for(auto &database: strored){
        
        double sumprice = 0;
        for(auto &order:orders){

            if(database.flavor == order.flavor){
                sumprice += (database.price * order.price);
                flag = true;
            }else{
                continue;
            }

            
        }

        Total.push_back({database.flavor, sumprice});
        totalprice += sumprice;
        Maxprice = max(Maxprice, sumprice);
    }

    sort(Total.begin(), Total.end(),cmp);\

    if(flag == true){

    cout << "Total ice cream sales: "<< totalprice << endl;

    cout << "Top sales: ";
    for(auto &x:Total){
        if(x.price == Maxprice){
            cout << x.flavor << " ";
        }
    }

    }else{
        cout << "No ice cream sales";
    }


    return 0;
}

# 0259, 2024-10-15 13:57:21, Compilation error (0%)

#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    map<string, pair<double, double>> ice_cream;
    string ice;
    double price;
    while(n--){
        cin >> ice >> price;
        map[ice] = make_pair<0, price>;
    }
    cin >> n;
    int total = 0;
    while(n--){
        cin >> ice >> price;
        if(ice_cream.find(ice) != ice_cream.end()) {ice_cream[ice].first += ice_cream[ice].second*price; total += ice_cream[ice].second*price;}
    }
    double max = 0;
    vector<string> v;
    for(auto kv : ice_cream){
        if(kv.second.first > max){
            max = kv.second.first;
            v.clear();
            v.push_back(kv.first);
        }else if(kv.second.first == max) v.push_back(kv.first);
    }
    if(max == 0) cout << "No ice cream sales";
    else {cout << "Total ice cream sales: " << total << endl << "Top sales: ";
    for(auto e : v) cout << e << ' ';}
}
# 0260, 2024-10-15 14:01:48, -PPPPPPPP (88%)

#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    map<string, pair<double, double>> ice_cream;
    string ice;
    double price;
    while(n--){
        cin >> ice >> price;
        ice_cream[ice] = make_pair(0.0, price);
    }
    cin >> n;
    int total = 0;
    while(n--){
        cin >> ice >> price;
        if(ice_cream.find(ice) != ice_cream.end()) {ice_cream[ice].first += ice_cream[ice].second*price; total += ice_cream[ice].second*price;}
    }
    double max = 0;
    vector<string> v;
    for(auto kv : ice_cream){
        if(kv.second.first > max){
            max = kv.second.first;
            v.clear();
            v.push_back(kv.first);
        }else if(kv.second.first == max) v.push_back(kv.first);
    }
    if(max == 0) cout << "No ice cream sales";
    else {
        cout << "Total ice cream sales: " << total << endl << "Top sales: ";
        for(auto e : v) cout << e << ' ';
    }
}
# 0261, 2024-10-15 14:02:34, PPPPPPPPP (100%)

    #include <iostream>
    #include <map>
    #include <vector>

    using namespace std;

    int main(){
        int n;
        cin >> n;
        map<string, pair<double, double>> ice_cream;
        string ice;
        double price;
        while(n--){
            cin >> ice >> price;
            ice_cream[ice] = make_pair(0.0, price);
        }
        cin >> n;
        double total = 0;
        while(n--){
            cin >> ice >> price;
            if(ice_cream.find(ice) != ice_cream.end()) {ice_cream[ice].first += ice_cream[ice].second*price; total += ice_cream[ice].second*price;}
        }
        double max = 0;
        vector<string> v;
        for(auto kv : ice_cream){
            if(kv.second.first > max){
                max = kv.second.first;
                v.clear();
                v.push_back(kv.first);
            }else if(kv.second.first == max) v.push_back(kv.first);
        }
        if(max == 0) cout << "No ice cream sales";
        else {
            cout << "Total ice cream sales: " << total << endl << "Top sales: ";
            for(auto e : v) cout << e << ' ';
        }
    }

# 0262, 2024-10-15 13:19:20, -P------- (11%)

#include <iostream>
#include <map>

using namespace std;

int main(){
    int n, m, count = 0;
    string icecream, product;
    double price, sale;
    map<string, double> all_ice, all_pro;
    cin >> n;
    while (n--){
        cin >> icecream >> price;
        all_ice[icecream] = price;
    }
    cin >> m;
    while (m--){
        cin >> product >> sale;
        all_ice[product] = sale;
    }
    for (auto p: all_pro){
        for (auto i: all_ice){
            if (p != i){
                count++;
            }
        }
    }
    if (count == all_pro.size()){
        cout << "No ice cream sales" << endl;
    }
}
# 0263, 2024-10-15 13:48:20, PPPPPPPPP (100%)

#include <iostream>
#include <map>

using namespace std;

int main(){
    int n, m, maxxy = 0;
    string icecream, product;
    double price, sale, sum = 0;
    map<string, double> all_ice;
    map<string, int> all_pro;
    cin >> n;
    while (n--){
        cin >> icecream >> price;
        all_ice[icecream] = price;
    }
    cin >> m;
    while (m--){
        cin >> product >> sale;
        if (all_ice.find(product) != all_ice.end()){
            sum += all_ice[product] * sale;
            all_pro[product] += all_ice[product] * sale;
            maxxy = max(maxxy, all_pro[product]);
        }
    }
    if(sum == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << sum <<endl;
        cout << "Top sales: ";
        for(auto e: all_pro){
            if(e.second == maxxy) cout << e.first << " ";
        }
        cout << endl;
    }
}

# 0264, 2024-10-15 13:24:18, --------- (0%)

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    map<string,double> map;
    vector<pair<double,string>> v;
    int N,M,num;
    string item;
    double price,total=0,max=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>item>>price;
        map[item]=price;
    }
    cin>>M;
    for(int i=0;i<M;i++){
        cin>>item>>num;
        bool found=0;
        if(map.find(item)!=map.end()){
            for(auto itr=v.begin();itr!=v.end();itr++){
                if((*itr).second==item){
                    (*itr).first+=map[item]*num;
                    found=1;
                    break;
                }    
            }
            if(!found)v.push_back(make_pair(map[item]*num,item));
        }
    }
    cout<<v.size();
    for(pair p: v){
        if(p.first>max)max=p.first;
        total+=p.first;
    }
    if(total==0){
        cout<<"No ice cream sales";
    }else{
        sort(v.begin(),v.end(),greater());
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales:";
        sort(v.begin(),v.end());
        for(pair p:v){
            if(p.first==max){
                cout<<' '<<p.second;
            }
        }
    }
}
# 0265, 2024-10-15 13:26:05, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    map<string,double> map;
    vector<pair<double,string>> v;
    int N,M,num;
    string item;
    double price,total=0,max=0;
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>item>>price;
        map[item]=price;
    }
    cin>>M;
    for(int i=0;i<M;i++){
        cin>>item>>num;
        bool found=0;
        if(map.find(item)!=map.end()){
            for(auto itr=v.begin();itr!=v.end();itr++){
                if((*itr).second==item){
                    (*itr).first+=map[item]*num;
                    found=1;
                    break;
                }    
            }
            if(!found)v.push_back(make_pair(map[item]*num,item));
        }
    }
    for(pair p: v){
        if(p.first>max)max=p.first;
        total+=p.first;
    }
    if(total==0){
        cout<<"No ice cream sales";
    }else{
        sort(v.begin(),v.end(),greater());
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales:";
        sort(v.begin(),v.end());
        for(pair p:v){
            if(p.first==max){
                cout<<' '<<p.second;
            }
        }
    }
}

# 0266, 2024-10-15 13:51:53, PPPPPPPPP (100%)

#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <set>
using namespace std ;

bool func(pair<string, pair<double, double>>& a, pair<string, pair<double, double>>& b) {
  return a.second.first > b.second.first ;
}

int main() {
  int n ;
  cin >> n ;

  map<string, pair<double, double>> ice ;
  string name ; double price ;
  for (int i = 0 ; i < n ; i++) {
    cin >> name >> price ;
    ice[name] = {0, price} ;
  }

  int m ;
  cin >> m ; 

  double sum = 0 ; int dd ;
  for (int i = 0 ; i < m ; i++) {
    cin >> name >> dd ;
    if (ice.find(name) != ice.end()) {
      double tmp = (ice[name].second)*dd ;
      ice[name].first += tmp ;
      sum += tmp ;
    }
  }

  double max = 0 ;
  for (auto a : ice) {
    if (a.second.first >= max) {
      max = a.second.first ;
    }
  }

  if (max == 0) { cout << "No ice cream sales" ;}
  else {

    cout << "Total ice cream sales: " << sum << endl ;
    cout << "Top sales: " ;
    bool fst = false ;
    for (auto a : ice) {
      if (a.second.first == max) {
        cout << a.first << " " ;
      }
    }
  }
}
# 0267, 2024-10-15 13:52:54, PPPPPPPPP (100%)

#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <set>
using namespace std ;

int main() {
  int n ;
  cin >> n ;

  map<string, pair<double, double>> ice ;
  string name ; double price ;
  for (int i = 0 ; i < n ; i++) {
    cin >> name >> price ;
    ice[name] = {0, price} ;
  }

  int m ;
  cin >> m ; 

  double sum = 0 ; int dd ;
  for (int i = 0 ; i < m ; i++) {
    cin >> name >> dd ;
    if (ice.find(name) != ice.end()) {
      double tmp = (ice[name].second)*dd ;
      ice[name].first += tmp ;
      sum += tmp ;
    }
  }

  double max = 0 ;
  for (auto a : ice) {
    if (a.second.first >= max) {
      max = a.second.first ;
    }
  }

  if (max == 0) { cout << "No ice cream sales" ;}
  else {

    cout << "Total ice cream sales: " << sum << endl ;
    cout << "Top sales: " ;
    for (auto a : ice) {
      if (a.second.first == max) {
        cout << a.first << " " ;
      }
    }
  }
}

# 0268, 2024-10-15 14:00:23, -PP-----P (33%)

#include<bits/stdc++.h>
using  namespace std;
int main(){
    int n;
    cin>> n;

    map<string, double> ice, icesale;
    map<double, vector<string>> profit;
    while(n--){
        string name;
        double price;
        cin>> name>> price;
        ice[name]=price;
    }
    int m;
    cin>> m;
    while(m--){
        string name;
        double sale;
        cin>> name>> sale;
        if(ice.find(name)==ice.end()) continue;
        double cal;
        auto itr=icesale.find(name);
        if(itr!=icesale.end()){
            icesale[name]=(*itr).second+sale;
        }
        else{
            icesale[name]=sale;
        }
    }
    for(auto itr:icesale){
        auto name=itr.first;
        auto sale=itr.second;
        auto price=(*(ice.find(name))).second;
        sale=sale*price;
        profit[sale].push_back(name);
    }
    if(profit.empty()){
        cout<<"No ice cream sales";
        return 0;
    }
    auto itr=profit.end();
    --itr;
    cout<< "Total ice cream sales: "<< (*itr).first<< endl;
    cout<< "Top sales: ";
    for(auto e:(*itr).second){
        cout<< e<< " ";
    }
    return 0;
}
# 0269, 2024-10-15 14:02:35, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using  namespace std;
int main(){
    int n;
    cin>> n;

    map<string, double> ice, icesale;
    map<double, vector<string>> profit;
    while(n--){
        string name;
        double price;
        cin>> name>> price;
        ice[name]=price;
    }
    int m;
    cin>> m;
    while(m--){
        string name;
        double sale;
        cin>> name>> sale;
        if(ice.find(name)==ice.end()) continue;
        double cal;
        auto itr=icesale.find(name);
        if(itr!=icesale.end()){
            icesale[name]=(*itr).second+sale;
        }
        else{
            icesale[name]=sale;
        }
    }
    double sum=0;
    for(auto itr:icesale){
        auto name=itr.first;
        auto sale=itr.second;
        auto price=(*(ice.find(name))).second;
        sale=sale*price;
        profit[sale].push_back(name);
        sum+=sale;
    }
    if(profit.empty()){
        cout<<"No ice cream sales";
        return 0;
    }
    auto itr=profit.end();
    --itr;
    cout<< "Total ice cream sales: "<< sum<< endl;
    cout<< "Top sales: ";
    for(auto e:(*itr).second){
        cout<< e<< " ";
    }
    return 0;
}

# 0270, 2024-10-15 13:46:01, -PPP----P (44%)

#include<iostream>
#include<map>
using namespace std;
int main(){
    int n =0,max = 0; cin >> n;
    map<string,int> topsale;  //จำนวน / ชื่อ
    double sum;
    bool check = false;
    string s;
    double value,amount;
    map<string,double> l1,l2;
    while(n--){
        cin >> s >> value;
        l1[s] = value; 
        l2[s] = 0;
        topsale[s] = 0;
    } // recieved input
    cin >> n;
    while(n--){
        cin >> s >> amount;
        if(l1.find(s) != l1.end()){
            if(amount >= max) max = amount;
            check = true;
            auto itr = l1.find(s);
            topsale[s] += amount;            
            l2[s] += (*itr).second * amount;
        }

    }
    if(!check){
        cout << "No ice cream sales" << endl;
        return 0;
    }
    else{
        for(auto c = l2.begin();c!=l2.end();++c) sum += (*c).second;
        cout <<"Total ice cream sales: "<< sum << endl;
        for(auto c = topsale.begin();c!=topsale.end();++c){
            if((*c).second == max) { 
                cout << "Top sales: " << (*c).first << endl;
                return 0;
            }
        }
    }
}
# 0271, 2024-10-15 13:55:23, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;
int main(){
    double n =0,max = 0; cin >> n;
    map<string,int> topsale;  //จำนวน / ชื่อ
    double sum;
    bool check = false;
    string s;
    double value,amount;
    map<string,double> l1,l2;
    while(n--){
        cin >> s >> value;
        l1[s] = value; 
        l2[s] = 0;
        topsale[s] = 0;
    } // recieved input
    cin >> n;
    while(n--){
        cin >> s >> amount;
        if(l1.find(s) != l1.end()){
            check = true;
            auto itr = l1.find(s);
            topsale[s] += amount;            
            l2[s] += (*itr).second * amount;
            auto temp = l2.find(s);
            if((*temp).second > max) max = (*temp).second;
        }

    }
    if(!check){
        cout << "No ice cream sales" << endl;
        return 0;
    }
    else{
        for(auto c = l2.begin();c!=l2.end();++c) sum += (*c).second;
        cout <<"Total ice cream sales: "<< sum << endl;
        cout <<"Top sales: ";
        for(auto c = l2.begin();c!=l2.end();++c){
            if((*c).second == max ) cout << (*c).first << " ";
        }
        
    }
}

# 0272, 2024-10-15 13:22:00, --------- (0%)

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

unordered_map<string,double> ump;

map<string,double> mp;

int main(){

    int n;

    cin >> n;

    for(int i=0;i<n;i++){

        string str;

        double price;

        cin >> str >> price;

        ump[str] = price;

    }

    double sum = 0, mx = -100;

    int m;

    cin >> m;

    for(int i=0;i<m;i++){

        string name;

        double num;

        cin >> name >> num;

        if(mp.find(name)!=mp.end()){

            mp[name] += ump[name]*num;

        }else{

            mp[name] = ump[name]*num;

        }

        mx = max(mp[name],mx);

    }

    vector<string> v;

    for(auto x : mp){

        if(x.second == mx)v.push_back(x.first);

        sum += x.second;

    }

    cout << mx << '\n';

    if(sum != 0){
        
        cout << "Total ice cream sales: " << sum << '\n' << "Top sales: ";

        for(auto x : v){

            cout << x << ' ';
            
        }

    }

    else cout << "No ice cream sales";

    return 0;
}
# 0273, 2024-10-15 13:22:58, PPPPPPPPP (100%)

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

unordered_map<string,double> ump;

map<string,double> mp;

int main(){

    int n;

    cin >> n;

    for(int i=0;i<n;i++){

        string str;

        double price;

        cin >> str >> price;

        ump[str] = price;

    }

    double sum = 0, mx = -100;

    int m;

    cin >> m;

    for(int i=0;i<m;i++){

        string name;

        double num;

        cin >> name >> num;

        if(mp.find(name)!=mp.end()){

            mp[name] += ump[name]*num;

        }else{

            mp[name] = ump[name]*num;

        }

        mx = max(mp[name],mx);

    }

    vector<string> v;

    for(auto x : mp){

        if(x.second == mx)v.push_back(x.first);

        sum += x.second;

    }

    //cout << mx << '\n';

    if(sum != 0){
        
        cout << "Total ice cream sales: " << sum << '\n' << "Top sales: ";

        for(auto x : v){

            cout << x << ' ';
            
        }

    }

    else cout << "No ice cream sales";

    return 0;
}

# 0274, 2024-10-15 13:46:40, PPPPP--PP (77%)

#include<iostream>
#include<map>
#include<string>
using namespace std;

int main(){
    int n,each;
    cin>>n;
    string name;
    double cost,total=0,maxx=0,keep;
    map<string,double> info;
    map<string,double> sale;
    for(int i=0; i<n; i++){
        cin>>name>>cost;
        info[name]=cost;
    }
    int m;
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>name>>each;
        if(info.find(name) != info.end()){
            total+=each*info[name];
            keep=each*info[name];
            if(sale.find(name) != sale.end()){
                keep=(sale[name]+each)*info[name];
                sale[name]=keep;
            }
            else{
                sale[name]=keep;
            }
            if(keep>maxx){
                maxx=keep;
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
    }
    else{
        //cout<<"max is"<<maxx<<endl;
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &a : sale){
            if(a.second==maxx){
                cout<<a.first<<' ';
            }
        }
    }


}
# 0275, 2024-10-15 13:57:43, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<string>
using namespace std;

int main(){
    int n,each;
    cin>>n;
    string name;
    double cost,total=0,maxx=0,keep;
    map<string,double> info;
    map<string,double> sale;
    for(int i=0; i<n; i++){
        cin>>name>>cost;
        info[name]=cost;
    }
    int m;
    cin>>m;
    for(int i=0; i<m; i++){
        cin>>name>>each;
        if(info.find(name) != info.end()){
            keep=each*info[name];
            total+=keep;
            if(sale.find(name) != sale.end()){
                sale[name]+=keep;
            }
            else{
                sale[name]=keep;
            }
            if(sale[name]>maxx){
                maxx=sale[name];
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
    }
    else{
        //cout<<"max is"<<maxx<<endl;
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        for(auto &a : sale){
            if(a.second==maxx){
                cout<<a.first<<' ';
            }
        }
    }
    



}

# 0276, 2024-10-15 13:33:21, -PPPP---P (55%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n;
    cin >> n;
    string icecream;
    double price;
    map<string, double> info;
    for(int i=0; i<n; i++){
        cin >> icecream;
        cin >> price;
        info[icecream]=price;
    }
    int m;
    cin >> m;
    string want;
    int total;
    double sales=0;
    map<string, double> s;
    double MAX=0;
    for(int i=0; i<m; i++){
        cin >> want;
        cin >> total;
        if(info.find(want)!=info.end()){
            double tt=info[want]*total;
            sales+= tt;
            s[want]+=tt;
            if(MAX<tt) MAX=tt;
        }
    }
    if(sales!=0){
        cout << "Total ice cream sales: " << sales << endl;
        cout << "Top sales: ";
        for(auto i=s.begin(); i!=s.end(); i++){
            if((*i).second==MAX) cout << (*i).first << " ";
        }
    }
    else cout << "No ice cream sales";
}
# 0277, 2024-10-15 13:34:26, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;

int main(){
    int n;
    cin >> n;
    string icecream;
    double price;
    map<string, double> info;
    for(int i=0; i<n; i++){
        cin >> icecream;
        cin >> price;
        info[icecream]=price;
    }
    int m;
    cin >> m;
    string want;
    int total;
    double sales=0;
    map<string, double> s;
    double MAX=0;
    for(int i=0; i<m; i++){
        cin >> want;
        cin >> total;
        if(info.find(want)!=info.end()){
            double tt=info[want]*total;
            sales+= tt;
            s[want]+=tt;
            if(MAX<s[want]) MAX=s[want];
        }
    }
    if(sales!=0){
        cout << "Total ice cream sales: " << sales << endl;
        cout << "Top sales: ";
        for(auto i=s.begin(); i!=s.end(); i++){
            if((*i).second==MAX) cout << (*i).first << " ";
        }
    }
    else cout << "No ice cream sales";
}

# 0278, 2024-10-15 13:40:49, -PP-----P (33%)

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    double n;
    cin >> n;
    map<string, double> p;

    string ice;
    double price;
    for (double i = 0; i < n; i++) {
        cin >> ice >> price;
        p[ice] = price;
    }

    double m;
    cin >> m;

    string sale;
    double num;

    double t;
    double total = 0;

    map<string, double> sales;

    for (double i = 0; i < m; i++) {
        cin >> sale >> num;
        if (p.find(sale) != p.end()) {
            t = p[sale] * num;
            total += t;
            sales[sale] += t;
        }
    }

    set<string> ans;

    if (total != 0) {
        cout << "Total ice cream sales: " << total << endl;

        vector<pair<double, string>> sorted_sales;
        for (const auto& s : sales) {
            sorted_sales.push_back({s.second, s.first});
        }

        sort(sorted_sales.rbegin(), sorted_sales.rend());

        cout << "Top sales: ";
        for (int i = 0; i < min(2, (int)sorted_sales.size()); i++) {
            ans.insert(sorted_sales[i].second);
            for(auto ii : ans) {
                cout << ii << " ";
            }
        }
        cout << endl;
    } else {
        cout << "No ice cream sales" << endl;
    }

    return 0;
}
# 0279, 2024-10-15 13:52:43, PPPPPPPPP (100%)

#include <bits/stdc++.h>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    map<string,double> mp1;
    map<string, double> mp2;
    int n;
    cin >> n;
    while (n--){
        string a;
        double b;
        cin >> a >> b;
        mp1[a] = b;
        mp2[a] = 0;
    }
    double total = 0;
    cin >> n;
    while (n--){
        string a;
        int b;
        cin >> a >> b;
        if (mp1.count(a)){
            total += mp1[a]*b;
            mp2[a] += mp1[a]*b;
        }
    }
    if (total == 0) cout << "No ice cream sales";
    else{
        cout << "Total ice cream sales: " << total << "\n";
        vector<pair<double,string>> ans;
        for (auto it = mp2.begin(); it != mp2.end(); it++)
            ans.push_back({it->second, it->first});
        sort(ans.begin(), ans.end());
        cout << "Top sales: ";
        for (int i=0;i<ans.size();i++)
            if (ans[i].first == ans[ans.size()-1].first)
                cout << ans[i].second << " ";
    }

    return 0;
}

# 0280, 2024-10-15 13:32:50, P-PPPPPPP (88%)

#include<iostream>
#include<map>
#include<vector>

using namespace std;

int main()
{
    string a,e;
    double b,f , total =0 , max = 0;
    int n,m,i;
    map<string,double> c , sell;
    vector<pair<string,int>> d;
    map<double,string> rc;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> a >> b;
        c[a] = b;
        sell[a] =0;
        rc[b] = a;
    }

    cin >> m;
    for(i=0;i<m;i++)
    {
        cin >> e >> f;
        d.push_back(make_pair(e,f));
    }

    for(auto &k : d)
    {
        if(c.find(k.first) != c.end())
        {
            sell[k.first] += k.second * c[k.first];
        }
    }

    for(auto &j : sell)
    {
        total += j.second;
        if(j.second > max)
        {
            max = j.second;
        }
    }

    cout << "Total ice cream sales: " <<total << endl;
    cout << "Top sales: ";

    for(auto &l: sell)
    {
        if(l.second == max)
        {
            cout << l.first << ' ';
        }
    }


}
# 0281, 2024-10-15 13:35:35, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<vector>

using namespace std;

int main()
{
    string a,e;
    double b,f , total =0 , max = 0;
    int n,m,i;
    map<string,double> c , sell;
    vector<pair<string,int>> d;
    map<double,string> rc;
    bool check = false;
    cin >> n;
    for(i=0;i<n;i++)
    {
        cin >> a >> b;
        c[a] = b;
        sell[a] =0;
        rc[b] = a;
    }

    cin >> m;
    for(i=0;i<m;i++)
    {
        cin >> e >> f;
        d.push_back(make_pair(e,f));
    }

    for(auto &k : d)
    {
        if(c.find(k.first) != c.end())
        {
            sell[k.first] += k.second * c[k.first];
            check = true;
        }
    }

    if(check)
    {
        for(auto &j : sell)
        {  
            total += j.second;
            if(j.second > max)
            {
                max = j.second;
            }
        }

        cout << "Total ice cream sales: " <<total << endl;
        cout << "Top sales: ";

        for(auto &l: sell)
        {
            if(l.second == max)
            {
                cout << l.first << ' ';
            }
        }
    }
    else
    {
        cout << "No ice cream sales";
    }
}

# 0282, 2024-10-15 13:26:41, Compilation error (0%)

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

int main(){
  int n,amout;
  map<string,pair<double,double>> list;
  double max_sale = 0,price,all_sale = 0;
  string id;
  cin >> n;
  while(n--){
    cin>> id >> price;
    list[id].first = price;
  }
  cin >> n;
  while(n--){
    cin >> id >> amout;
    if(!list.count(id))continue;
    list[id].second += list[id].first*amout;
  }
  for(auto &x:list){
    if[x.second.second > max_sale]max_sale = x.second.second;
    all_sale +=x.second.second;
  }
  if(max_sale){
    cout << "Total ice cream sales: "<< all_sale << endl;
    cout << "Top sales:";
    for(auto &x:list){
      if(x.second.second == max_sale)cout <<" "<< x.first;
    }
  }
  else{
    cout << "No ice cream sales";
  }
  
}
# 0283, 2024-10-15 13:27:06, PPPPPPPPP (100%)

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

int main(){
  int n,amout;
  map<string,pair<double,double>> list;
  double max_sale = 0,price,all_sale = 0;
  string id;
  cin >> n;
  while(n--){
    cin>> id >> price;
    list[id].first = price;
  }
  cin >> n;
  while(n--){
    cin >> id >> amout;
    if(!list.count(id))continue;
    list[id].second += list[id].first*amout;
  }
  for(auto &x:list){
    if(x.second.second > max_sale)max_sale = x.second.second;
    all_sale +=x.second.second;
  }
  if(max_sale){
    cout << "Total ice cream sales: "<< all_sale << endl;
    cout << "Top sales:";
    for(auto &x:list){
      if(x.second.second == max_sale)cout <<" "<< x.first;
    }
  }
  else{
    cout << "No ice cream sales";
  }
  
}

# 0284, 2024-10-15 13:12:29, -PPPPPPPP (88%)

#include<iostream>
#include<map>
#include<vector>
using namespace std;

struct sale
{
	float price, total = 0;
};

int main()
{
	map<string, sale> mp;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string A;
		sale B;
		cin >> A >> B.price;
		mp[A] = B;
	}

	int m, ans = 0;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		string A;
		float B;
		cin >> A >> B;
		if (mp.find(A) != mp.end())
		{
			mp[A].total += mp[A].price * B;
			ans += mp[A].price * B;
		}
	}

	if (ans == 0)
	{
		cout << "No ice cream sales\n";
		return 0;
	}
	
	cout << "Total ice cream sales: " << ans << '\n';
	float mak = 0;
	for (auto it = mp.begin(); it != mp.end(); it++)
	{
		sale temp = it->second;
		if (mak < temp.total)
		{
			mak = temp.total;
		}
	}

	cout << "Top sales: ";
	for (auto it = mp.begin(); it != mp.end(); it++)
	{
		sale temp = it->second;
		if (mak == temp.total)
		{
			cout << it->first << ' ';
		}
	}
}
# 0285, 2024-10-15 13:14:44, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<vector>
using namespace std;

struct sale
{
	float price, total = 0;
};

int main()
{
	map<string, sale> mp;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		string A;
		sale B;
		cin >> A >> B.price;
		mp[A] = B;
	}

	float m, ans = 0;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		string A;
		float B;
		cin >> A >> B;
		if (mp.find(A) != mp.end())
		{
			mp[A].total += mp[A].price * B;
			ans += mp[A].price * B;
		}
	}

	if (ans == 0)
	{
		cout << "No ice cream sales\n";
		return 0;
	}
	
	cout << "Total ice cream sales: " << ans << '\n';
	float mak = 0;
	for (auto it = mp.begin(); it != mp.end(); it++)
	{
		sale temp = it->second;
		if (mak < temp.total)
		{
			mak = temp.total;
		}
	}

	cout << "Top sales: ";
	for (auto it = mp.begin(); it != mp.end(); it++)
	{
		sale temp = it->second;
		if (mak == temp.total)
		{
			cout << it->first << ' ';
		}
	}
}

# 0286, 2024-10-15 13:56:49, -P------- (11%)

#include <iostream>
#include <map>
#include <vector>
#include <utility>

using namespace std;

int main() {
    int a1, a2;

    map<string, double> itim_lists, top_sales;
    vector<pair<string, int>> sales;
    //input
    cin >> a1;
    for (int i=0; i < a1; ++i) {
        string name;
        double price;

        cin >> name >> price;
        itim_lists.emplace(name, price);
    }
    cin >> a2;
    for (int i=0; i < a2; ++i) {
        string name;
        int price;

        cin >> name >> price;
        sales.push_back(make_pair(name, price));
    } 
    //process
    double total = 0;

    for (auto e : sales) {
        string main = e.first;

        if (itim_lists.find(main) != itim_lists.end()) {
            total += itim_lists[main] * e.second;

            if (top_sales.find(main) != top_sales.end()) {
                top_sales[main] += top_sales[main];
            } else {
                top_sales.emplace(main, total);
            }
        }
    }

    double max_price = -1;
    for (auto e : top_sales) {
        if (max_price < e.second) {
            max_price = e.second;
        } 
    }
    
    //output
    if (total == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";

        cout << max_price;

        // for (auto e : top_sales) {
        //     if (e.second == max_price) {
        //         cout << e.first << " ";
        //     }
        // }
    }

    return 0;
}
# 0287, 2024-10-15 13:59:59, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
#include <utility>

using namespace std;

int main() {
    int a1, a2;

    map<string, double> itim_lists, top_sales;
    vector<pair<string, int>> sales;
    //input
    cin >> a1;
    for (int i=0; i < a1; ++i) {
        string name;
        double price;

        cin >> name >> price;
        itim_lists.emplace(name, price);
    }
    cin >> a2;
    for (int i=0; i < a2; ++i) {
        string name;
        int price;

        cin >> name >> price;
        sales.push_back(make_pair(name, price));
    } 
    //process
    double total = 0;

    for (auto e : sales) {
        string main = e.first;

        if (itim_lists.find(main) != itim_lists.end()) {
            total += itim_lists[main] * e.second;

            if (top_sales.find(main) != top_sales.end()) {
                top_sales[main] += top_sales[main];
            } else {
                top_sales.emplace(main, (itim_lists[main] * e.second));
            }
        }
    }

    double max_price = -1;
    for (auto e : top_sales) {
        if (max_price < e.second) {
            max_price = e.second;
            // cout << max_price << endl;
        } 
    }
    
    //output
    if (total == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";

        for (auto e : top_sales) {
            if (e.second == max_price) {
                cout << e.first << " ";
            }
        }
    }

    return 0;
}

# 0288, 2024-10-15 13:21:54, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
map<string,double> dat;
map<string,double> CC;
int main(){
    int n;
    cin>>n;
    while (n--)
    {
        string name;
        double yod;
        cin>>name>>yod;
        dat[name] = yod;
    }
    int m;
    cin>>m;
    double total = 0;
    while (m--)
    {
        string input;
        double s;
        cin>>input>>s;
        CC[input] += s;
        if(dat.find(input) != dat.end()){
            total += dat[input]*s;
        }
    }
    vector<pair<string,double>> result;
    for(auto e : CC){
        result.push_back({e.first,e.second});
    }
    sort(result.begin(),result.end(), [](auto a, auto b){
        if(a.second == b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });

    if(total == 0){
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<total<<endl;
        double prev = result[0].second;
        for (int i = 0; i < result.size(); i++)
        {   if(result[i].second != prev){
            break;
        }else{
            cout<<result[i].first<<" ";
            prev = result[i].second;
        }
        }
        
    }
}
# 0289, 2024-10-15 13:25:43, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
map<string,double> dat;
map<string,double> CC;
int main(){
    int n;
    cin>>n;
    while (n--)
    {
        string name;
        double yod;
        cin>>name>>yod;
        dat[name] = yod;
    }
    int m;
    cin>>m;
    double total = 0;
    while (m--)
    {
        string input;
        double s;
        cin>>input>>s;
        CC[input] += s*dat[input];
        if(dat.find(input) != dat.end()){
            total += dat[input]*s;
        }
    }
    vector<pair<string,double>> result;
    for(auto e : CC){
        result.push_back({e.first,e.second});
    }
    sort(result.begin(),result.end(), [](auto a, auto b){
        if(a.second == b.second){
            return a.first < b.first;
        }
        return a.second > b.second;
    });

    if(total == 0){
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales: ";
        double prev = result[0].second;
        for(auto p : result){
            if(p.second != prev){
                break;
                
            }else{
              cout<<p.first<<" ";
              prev = p.second;
            }
            
        }
        
    }
}

# 0290, 2024-10-15 13:46:14, PPPP---PP (66%)

#include<iostream>
#include<map>
#include<vector>
using namespace std;
int main()
{
    int n;cin>>n;
    double price;
    string name;
    vector <tuple<string,double,double>> v;
    for(int i=0;i<n;i++)
    {
        cin>>name>>price;
        v.push_back({name,price,0.0});
    }
    cin>>n;
    double amount=0,sum=0,max=0;
    vector<string> topSales;
    for(int i=0;i<n;i++){
        cin>>name>>amount;
        for(int j=0;j<size(v);j++)
        {
            if(get<0>(v[j]) == name)
            {
                get<2>(v[j]) +=get<1>(v[j])*amount;
                sum+=get<1>(v[j])*amount;
            }
        }
    }
    for(int i=0;i<size(v);i++){
        if(get<2>(v[i]) > max)
        {
            topSales={get<0>(v[i])};
            max = get<2>(v[i]);
        }
        else if(get<2>(v[i]) == max)
        topSales.push_back(get<0>(v[i]));
    }
    if(max==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(string e: topSales)
            cout<<e<<' ';
    }
}
# 0291, 2024-10-15 13:48:05, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int n;cin>>n;
    double price;
    string name;
    vector <tuple<string,double,double>> v;
    for(int i=0;i<n;i++)
    {
        cin>>name>>price;
        v.push_back({name,price,0.0});
    }
    cin>>n;
    double amount=0,sum=0,max=0;
    vector<string> topSales;
    for(int i=0;i<n;i++){
        cin>>name>>amount;
        for(int j=0;j<size(v);j++)
        {
            if(get<0>(v[j]) == name)
            {
                get<2>(v[j]) +=get<1>(v[j])*amount;
                sum+=get<1>(v[j])*amount;
            }
        }
    }
    for(int i=0;i<size(v);i++){
        if(get<2>(v[i]) > max)
        {
            topSales={get<0>(v[i])};
            max = get<2>(v[i]);
        }
        else if(get<2>(v[i]) == max)
        topSales.push_back(get<0>(v[i]));
    }
    sort(topSales.begin(),topSales.end());
    if(max==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(string e: topSales)
            cout<<e<<' ';
    }
}

# 0292, 2024-10-15 13:21:52, P-PPPPPPP (88%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    cout<<"Total ice cream sales: "<<sum<<endl;
    cout<<"Top sales: ";
    for(auto e:s){
        if(e.second==mx)cout<<e.first<<" ";
    }
}
# 0293, 2024-10-15 13:22:49, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0294, 2024-10-15 13:57:08, -P------- (11%)

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

#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define sz(x) (int)x.size()
#define arr_sz(x) (int)sizeof(x)/size(x[0])

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n; cin >> n;
    string name;
    ld cost;
    map<string,ld> icecream;
    for(ll i=0 ; i<n ; i++){
        cin >> name >> cost;
        icecream[name] = cost;
    }
    
    ll m; cin >> m;
    map<string,ld> order;
    for(ll i=0 ; i<m ; i++){
        cin >> name >> cost;
        if(icecream.find(name) != icecream.end()){
            order[name] += icecream[name]*cost;
        }
    }

    if(sz(order)==0) cout << "No ice cream sales" << endl;
    else{
        ld sum=0;
        ld max=-DBL_MAX;

        vt<string> top;
        for(auto it = order.begin() ; it!=order.end() ; it++){
            sum += it->second;
            if(it->second > max){
                max = it->second;
                top.clear();
                top.pb(it->first);
            }
            if(it->second == max){
                top.pb(it->first);
            }
        }
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for(auto t:top) cout << t << " ";
        cout << endl;
    }

    return 0;
}
# 0295, 2024-10-15 14:00:23, PPPPPPPPP (100%)

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

#define ll long long
#define ld long double
#define vt vector
#define pb push_back
#define sz(x) (int)x.size()
#define arr_sz(x) (int)sizeof(x)/size(x[0])

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    ll n; cin >> n;
    string name;
    ld cost;
    map<string,ld> icecream;
    for(ll i=0 ; i<n ; i++){
        cin >> name >> cost;
        icecream[name] = cost;
    }
    
    ll m; cin >> m;
    map<string,ld> order;
    for(ll i=0 ; i<m ; i++){
        cin >> name >> cost;
        if(icecream.find(name) != icecream.end()){
            order[name] += icecream[name]*cost;
        }
    }

    if(sz(order)==0) cout << "No ice cream sales" << endl;
    else{
        ld sum=0;
        ld max=-DBL_MAX;

        vt<string> top;
        for(auto it = order.begin() ; it!=order.end() ; it++){
            sum += it->second;
            if(it->second == max){
                top.pb(it->first);
            }
            if(it->second > max){
                max = it->second;
                top.clear();
                top.pb(it->first);
            }
        }
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for(auto t:top) cout << t << " ";
        cout << endl;
    }

    return 0;
}

# 0296, 2024-10-15 13:37:11, PPPPPP--P (77%)

#include <iostream>
#include <utility>
#include <map>
using namespace std;
int main() {
    int N;cin >> N;
    map<string,pair<double,double> > list;
    string icecream;
    double price;
    double total=0;
    while(N--){
        cin >> icecream;
        cin >> price;
        pair<double,double> temp = make_pair(price,0);
        list[icecream] = temp;
    }

    int M;cin >> M;
    int amount;
    while(M--){
        cin >> icecream;
        cin >> amount;
        list[icecream].second += list[icecream].first * amount;
        total += list[icecream].first * amount;
    }
    double max = list[icecream].second;
    if(max !=0){
    for(auto I:list){if(I.second.second>max)max = I.second.second;}
    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales:";
    for(auto I:list){
        if(I.second.second==max) cout << ' ' << I.first ;
        }
    }
    else cout << "No ice cream sales";
}
# 0297, 2024-10-15 13:41:27, PPPPPPPPP (100%)

#include <iostream>
#include <utility>
#include <map>
using namespace std;
int main() {
    int N;cin >> N;
    map<string,pair<double,double> > list;
    string icecream;
    double price;
    double total=0;
    while(N--){
        cin >> icecream;
        cin >> price;
        pair<double,double> temp = make_pair(price,0);
        list[icecream] = temp;
    }

    int M;cin >> M;
    int amount;
    while(M--){
        cin >> icecream;
        cin >> amount;
        list[icecream].second += list[icecream].first * amount;
        total += list[icecream].first * amount;
    }
    double max = 0;
    for(auto I:list){if(I.second.second>max)max = I.second.second;}
    if(max !=0){
    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales:";
    for(auto I:list){
        if(I.second.second==max) cout << ' ' << I.first ;
        }
    }
    else cout << "No ice cream sales";
}

# 0298, 2024-10-15 13:41:41, PxPPPPPPP (88%)

#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
#include <utility>
#include <set>

using namespace std;

int main() {
	map<string, double> prices;
	map<string, bool> check;

	string name;
	int n, m;
	double price;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> name >> price;
		prices[name] = price;
		check[name] = true;
	}

	cin >> m;
	int amount;
	double sum = 0;
	map<string, int> stored;
	set<string> sales;
	for (int i = 0; i < m; i++) {
		cin >> name >> amount;
		//if there's this ice cream name
		if (check[name]) {
			sum += prices[name] * amount;
			stored[name] += amount;
			sales.insert(name);
		}
	}

	//price computing
	vector<pair<double, string>> result;
	for (auto n : sales) {
		result.push_back({ stored[n] * prices[n], n });
	}

	sort(result.begin(), result.end());
	set<string> ans;
	double temp = result[result.size() - 1].first;
	for (int i = result.size() - 1; i >= 0; i--) {
		if (result[i].first != temp) break;
		ans.insert(result[i].second);
	}
	//answer
	if (sales.size() == 0) {
		cout << "No ice cream sales";
	}
	else {
		cout << "Total ice cream sales: " << sum << endl;
		cout << "Top sales: ";
		for (auto i : ans) cout << i << " ";
	}
	return 0;
}
# 0299, 2024-10-15 13:44:27, PPPPPPPPP (100%)

#include <vector>
#include <algorithm>
#include <map>
#include <iostream>
#include <utility>
#include <set>

using namespace std;

int main() {
	map<string, double> prices;
	map<string, bool> check;

	string name;
	int n, m;
	double price;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> name >> price;
		prices[name] = price;
		check[name] = true;
	}

	cin >> m;
	int amount;
	double sum = 0;
	map<string, int> stored;
	set<string> sales;
	for (int i = 0; i < m; i++) {
		cin >> name >> amount;
		//if there's this ice cream name
		if (check[name]) {
			sum += prices[name] * amount;
			stored[name] += amount;
			sales.insert(name);
		}
	}

	//price computing
	vector<pair<double, string>> result;
	for (auto n : sales) {
		result.push_back({ stored[n] * prices[n], n });
	}

	sort(result.begin(), result.end());
	set<string> ans;
	double temp;
	if(result.size()) temp = result[result.size() - 1].first;
	for (int i = result.size() - 1; i >= 0; i--) {
		if (result[i].first != temp) break;
		ans.insert(result[i].second);
	}
	//answer
	if (sales.size() == 0) {
		cout << "No ice cream sales";
	}
	else {
		cout << "Total ice cream sales: " << sum << endl;
		cout << "Top sales: ";
		for (auto i : ans) cout << i << " ";
	}
	return 0;
}

# 0300, 2024-10-15 13:32:15, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<string>
#include<vector>
using namespace std;

int main()
{
    int n,buy;
    string name;
    double price,total=0,max=0;
    map<string,double> ice;
    map<string,double> ice_buy;
    cin>>n;
    while(n--)
    {
        cin>>name>>price;
        ice[name]=price;
    }
    cin>>n;
    while(n--)
    {
        cin>>name>>buy;
        if(ice.find(name)!=ice.end())
        {
            if(ice_buy.find(name)==ice_buy.end())
            {
                ice_buy[name]=0;
            }
            ice_buy[name]+=ice[name]*buy;
        }
    }
    for(auto &itr : ice_buy)
    {
        total+=itr.second;
        if(max<itr.second)
        {
            max=itr.second;
        }
    }
    if(total==0)
    {
        cout<<"No ice cream sales";
    }
    else
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales:";
        for(auto &itr : ice_buy)
        {
            if(max==itr.second)
            {
                cout<<" "<<itr.first;
            }
        }
    }
    return 0;
}
# 0301, 2024-10-15 13:32:33, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<string>
using namespace std;

int main()
{
    int n,buy;
    string name;
    double price,total=0,max=0;
    map<string,double> ice;
    map<string,double> ice_buy;
    cin>>n;
    while(n--)
    {
        cin>>name>>price;
        ice[name]=price;
    }
    cin>>n;
    while(n--)
    {
        cin>>name>>buy;
        if(ice.find(name)!=ice.end())
        {
            if(ice_buy.find(name)==ice_buy.end())
            {
                ice_buy[name]=0;
            }
            ice_buy[name]+=ice[name]*buy;
        }
    }
    for(auto &itr : ice_buy)
    {
        total+=itr.second;
        if(max<itr.second)
        {
            max=itr.second;
        }
    }
    if(total==0)
    {
        cout<<"No ice cream sales";
    }
    else
    {
        cout<<"Total ice cream sales: "<<total<<endl;
        cout<<"Top sales:";
        for(auto &itr : ice_buy)
        {
            if(max==itr.second)
            {
                cout<<" "<<itr.first;
            }
        }
    }
    return 0;
}

# 0302, 2024-10-15 13:47:52, -P------- (11%)

#include<iostream>
#include<map>
using namespace std;

int main(){

map<string,double> info;
map<string,int> count;
int n;cin>>n;
string temp1;
double temp2;
for(int i=0;i<n;i++){
    cin>>temp1>>temp2;
    info[temp1]=temp2;
    count[temp1]=0;
}
int m;cin>>m;
double total=0;
bool sale=false;
double number;
for(int i=0;i<m;i++){
    cin>>temp1;
    
    cin>>number;
    
    if(info.find(temp1)!=info.end()) {
        total+=info[temp1]*number;
        count[temp1]+=number*info[temp1];
        sale=true;
    }
}
if(!sale){
    cout<<"No ice cream sales";
    return 0;
}

cout<<"Total ice cream sales: "<<total<<endl;
double max=0;
cout<<"each sale-----"<<endl;
for(auto &b:count){
    
    if(b.second>max){ max=b.second;
        
    }
}

cout<<"Top sales: ";
for(auto &b:count){
    if(b.second==max) {
        cout<<b.first<<' ';
    }
}





}
# 0303, 2024-10-15 13:49:01, PPPPPPPPP (100%)

#include<iostream>
#include<map>
using namespace std;

int main(){

map<string,double> info;
map<string,int> count;
int n;cin>>n;
string temp1;
double temp2;
for(int i=0;i<n;i++){
    cin>>temp1>>temp2;
    info[temp1]=temp2;
    count[temp1]=0;
}
int m;cin>>m;
double total=0;
bool sale=false;
double number;
for(int i=0;i<m;i++){
    cin>>temp1;
    
    cin>>number;
    
    if(info.find(temp1)!=info.end()) {
        total+=info[temp1]*number;
        count[temp1]+=number*info[temp1];
        sale=true;
    }
}
if(!sale){
    cout<<"No ice cream sales";
    return 0;
}

cout<<"Total ice cream sales: "<<total<<endl;
double max=0;

for(auto &b:count){
    
    if(b.second>max){ 
        max=b.second;
    }
}

cout<<"Top sales: ";
for(auto &b:count){
    if(b.second==max) {
        cout<<b.first<<' ';
    }
}





}

# 0304, 2024-10-15 13:35:46, PPxPx--Px (44%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<string,float> mp,mp1;
    string s;
    for(int i=0;i<n;i++)
    {
        string s;
        float f;
        cin >> s >> f;
        mp[s] = f;
    }
    int m;
    cin >> m;
    priority_queue<pair<float,string>> pq;
    set<string> st;
    for(int i=0;i<m;i++)
    {
        string in;
        float b;
        cin >> in >> b;
        if(mp[in]!=0.0) {
            mp1[in] += mp[in] * b; 
            st.insert(in);
        }
    }
    float tt =0;
    
    for(auto x : st)
    {
        tt += mp1[x];
        pq.push({mp1[x],x});
    }
    
    if(pq.empty())
    {
        cout << "No ice cream sales";
        return 0;
    }
    float tp;
    
    cout << "Total ice cream sales: " << tt <<"\n" << "Top sales: ";
    tp = pq.top().first;
    
    while(1)
    {
            if(pq.top().first == tp) cout << pq.top().second<< " "; 
            else break;
            pq.pop();
    }
        
    
}
# 0305, 2024-10-15 13:37:08, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0306, 2024-10-15 14:01:27, PPPPPPPPT (88%)

#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
double ma(double in[],int n){
    double re=0;
    for(int i=0;i<n;i++)
    {
        if(re<in[i])re=in[i];
    }
    return re;

}

int main(){
    int N=0;
    double re=0;
    std::cin>>N;
    std::string nameh[N];
    double pri[N];
    for(int i=0;i<N;i++)
    {
        std::cin>>nameh[i]>>pri[i];
    }
    int M=0;
    double sle[N];
    for(int i=0;i<N;i++)
    {
        sle[i]=0;
    }
    std::cin>>M;
    std::string names[M];
    double pris[M];
    bool ch=false;
    for(int i=0;i<M;i++)
    {
        std::cin>>names[i]>>pris[i];
        for(int j=0;j<N;j++)
        {
            if(names[i]==nameh[j])
            {
                if(sle[j]==0)sle[j]=pris[i]*pri[j];
                else sle[j]+=pris[i]*pri[j];
                re+=(pri[j]*pris[i]);
                ch=true;
            }
        }
    }
    if(ch){
        std::cout<<"Total ice cream sales: "<<re<<std::endl;
        std::cout<<"Top sales:";
        int c=0;
        for(int i=0;i<N;i++)
        {
            double maxi=ma(sle,N);
            if(sle[i]==maxi) c++;
        }
        std::vector<std::string> maxs;
        int d=0;
        for(int i=0;i<N;i++)
        {
            double maxi=ma(sle,N);
            if(sle[i]==maxi) maxs.push_back(nameh[i]),d++;
        }
        sort(maxs.begin(),maxs.end());
        for (int i = 0; i < d; i++)
        {
            std::cout<<" "<<maxs[i];
        }
        
        
    }
    else std::cout<<"No ice cream sales";


}
# 0307, 2024-10-15 14:03:02, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include <algorithm>
#include <vector>
double ma(double in[],int n){
    double re=0;
    for(int i=0;i<n;i++)
    {
        if(re<in[i])re=in[i];
    }
    return re;

}

int main(){
    int N=0;
    double re=0;
    std::cin>>N;
    std::string nameh[N];
    double pri[N];
    for(int i=0;i<N;i++)
    {
        std::cin>>nameh[i]>>pri[i];
    }
    int M=0;
    double sle[N];
    for(int i=0;i<N;i++)
    {
        sle[i]=0;
    }
    std::cin>>M;
    std::string names[M];
    double pris[M];
    bool ch=false;
    for(int i=0;i<M;i++)
    {
        std::cin>>names[i]>>pris[i];
        for(int j=0;j<N;j++)
        {
            if(names[i]==nameh[j])
            {
                if(sle[j]==0)sle[j]=pris[i]*pri[j];
                else sle[j]+=pris[i]*pri[j];
                re+=(pri[j]*pris[i]);
                ch=true;
            }
        }
    }
    if(ch){
        std::cout<<"Total ice cream sales: "<<re<<std::endl;
        std::cout<<"Top sales:";
        std::vector<std::string> maxs;
        double maxi=ma(sle,N);
        for(int i=0;i<N;i++)
        {
            if(sle[i]==maxi) maxs.push_back(nameh[i]);
        }
        sort(maxs.begin(),maxs.end());
        for (int i = 0; i < maxs.size(); i++)
        {
            std::cout<<" "<<maxs[i];
        }
        
        
    }
    else std::cout<<"No ice cream sales";


}

# 0308, 2024-10-15 13:56:21, --------- (0%)

#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>

using namespace std;

int main(){

map<string , double> items ;
map<string,int> in;

int n ; cin >> n;
double cost;
string name;
while(n--){
    cin >>name;
    cin >> cost;
    items[name] = cost;
    cout << "yes"<< endl;
}
cin >> n;
int num;
while(n--){
    cin >> name;
    cin >> num;
    if(in.find(name) == in.end())in[name] = 0;
    in[name] += num;
}

map<string,double> sales;
vector<string> max = {""};
double total = 0;
int sum =0;
for(auto & i : in){
    auto x = items.find(i.first);
    if(x != items.end()){
        if(sales.find(i.first) == sales.end())sales[i.first]=0;

        sales[i.first] += items[i.first] * i.second ;
        //cout << i.first << " += " << items[i.first] * i.second << endl;
    }
    if(max.size()==0)max.push_back(i.first);
    if(sales[max[0]] < sales[i.first]){max.clear(); max.push_back(i.first) ;}
    else if(sales[max[0]] == sales[i.first] && max[0]!=i.first){max.push_back(i.first);}

}

//////////total////////////
for(auto & i : sales){
    total += i.second;
}

if(total == 0)cout << "No ice cream sales" << endl;
else{ cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales: " ;
   for(auto & i : max)cout <<i<<' '; 
}



return 0;
}
# 0309, 2024-10-15 13:57:22, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<set>

using namespace std;

int main(){

map<string , double> items ;
map<string,int> in;

int n ; cin >> n;
double cost;
string name;
while(n--){
    cin >>name;
    cin >> cost;
    items[name] = cost;
    //cout << "yes"<< endl;
}
cin >> n;
int num;
while(n--){
    cin >> name;
    cin >> num;
    if(in.find(name) == in.end())in[name] = 0;
    in[name] += num;
}

map<string,double> sales;
vector<string> max = {""};
double total = 0;
int sum =0;
for(auto & i : in){
    auto x = items.find(i.first);
    if(x != items.end()){
        if(sales.find(i.first) == sales.end())sales[i.first]=0;

        sales[i.first] += items[i.first] * i.second ;
        //cout << i.first << " += " << items[i.first] * i.second << endl;
    }
    if(max.size()==0)max.push_back(i.first);
    if(sales[max[0]] < sales[i.first]){max.clear(); max.push_back(i.first) ;}
    else if(sales[max[0]] == sales[i.first] && max[0]!=i.first){max.push_back(i.first);}

}

//////////total////////////
for(auto & i : sales){
    total += i.second;
}

if(total == 0)cout << "No ice cream sales" << endl;
else{ cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales: " ;
   for(auto & i : max)cout <<i<<' '; 
}



return 0;
}

# 0310, 2024-10-15 13:38:12, TTTTTTTTT (0%)

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

int main(){
    int n, m;
    cin>>n;

    map<string, float> ice;
    vector<pair<float, string>> ice_sale;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin>>name>>price;
        ice[name] = price;
    }

    cin>>m;
    float total=0;
    for(int i=0; i<m; i++){
        string name;
        int count;
        cin>>name>>count;

        if(ice.find(name) != ice.end()){
            bool f=false;

            for(int i=0; i<ice_sale.size(); i++){
                if(ice_sale[i].second == name){
                    f=true;
                    ice_sale[i].first += count*ice[name];
                    break;
                }
            }
            if(!f) ice_sale.push_back({count*ice[name], name});
            total += count*ice[name];
        }
    }

    if(total>0){
        sort(ice_sale.begin(), ice_sale.end(), [](auto a, auto b){
            return (a.first == b.first)?a.second<b.second:a.first>b.first;
        });
        
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: ";
        for(int i=0; i<ice_sale.size(); i++){
            //cout << ice_sale[i].first << ' ' << ice_sale[i].second << '\n';
            if(ice_sale[i].first == ice_sale[0].first){
                cout << ice_sale[i].second << ' ';
                continue;
            }
            break;
        }
        return 0;
    }
    cout<<"No ice cream sales";
}
# 0311, 2024-10-15 13:43:39, PPPPPPPPP (100%)

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

int main(){
    int n, m;
    cin>>n;

    map<string, float> ice;
    vector<pair<float, string>> ice_sale;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin>>name>>price;
        ice[name] = price;
    }

    cin>>m;
    float total=0;
    for(int i=0; i<m; i++){
        string name;
        int count;
        cin>>name>>count;

        if(ice.find(name) != ice.end()){
            bool f=false;

            for(int i=0; i<ice_sale.size(); i++){
                if(ice_sale[i].second == name){
                    f=true;
                    ice_sale[i].first += count*ice[name];
                    break;
                }
            }
            if(!f) ice_sale.push_back({count*ice[name], name});
            total += count*ice[name];
        }
    }

    if(total>0){
        sort(ice_sale.begin(), ice_sale.end(), [](auto a, auto b){
            return (a.first == b.first)?a.second<b.second:a.first>b.first;
        });
        
        cout << "Total ice cream sales: " << total << '\n';
        cout << "Top sales: ";
        for(int i=0; i<ice_sale.size(); i++){
            //cout << ice_sale[i].first << ' ' << ice_sale[i].second << '\n';
            if(ice_sale[i].first == ice_sale[0].first){
                cout << ice_sale[i].second << ' ';
                continue;
            }
            break;
        }
        return 0;
    }
    cout<<"No ice cream sales";
}

# 0312, 2024-10-15 13:25:43, PPPPPPPPP (100%)

#include <vector>
#include <set>
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;


int main()
{
    map<string, double> icecreams;
    string in1; double in2;
    int i; cin >> i;
    while(i--){
        cin >> in1 >> in2;
        icecreams[in1] = in2;
    }
    map<string, double> sales;
    set<string> topsales;
    cin >> i;
    while(i--){
        cin >> in1 >> in2;
        if(sales.find(in1) == sales.end())sales[in1] = in2;
        else sales[in1] += in2;
    }
    double totalicesales = 0, maxsales = 0, x;
    for(auto p:icecreams){
        if(sales.find(p.first)!=sales.end()) {
            x= sales[p.first]*p.second;
            totalicesales += x;
            if(x > maxsales) maxsales = x;
        }
    }
    for(auto p:icecreams){
        if(sales.find(p.first)!=sales.end()) {
            x= sales[p.first]*p.second;
            if(x==maxsales) topsales.insert(p.first);
        }
    }
    if(!topsales.empty()){
    cout << "Total ice cream sales: " << totalicesales << endl << "Top sales: ";
    for(auto s:topsales){
        cout << s << " ";
    }}
    else cout << "No ice cream sales";
}
# 0313, 2024-10-15 13:27:59, PPPPPPPPP (100%)

#include <vector>
#include <set>
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;


int main()
{
    map<string, double> icecreams;
    string in1; double in2;
    int i; cin >> i;
    while(i--){
        cin >> in1 >> in2;
        icecreams[in1] = in2;
    }
    map<string, double> sales;
    map<string, double> icecreamsale;
    set<string> topsales;
    cin >> i;
    while(i--){
        cin >> in1 >> in2;
        if(sales.find(in1) == sales.end())sales[in1] = in2;
        else sales[in1] += in2;
    }
    double totalicesales = 0, maxsales = 0, x;
    for(auto p:icecreams){
        if(sales.find(p.first)!=sales.end()) {
            x= sales[p.first]*p.second;
            totalicesales += x;
            icecreamsale[p.first] = x;
            if(x > maxsales) maxsales = x;
        }
    }
    for(auto p:icecreamsale){
            if(p.second==maxsales) topsales.insert(p.first);
    }
    if(!topsales.empty()){
    cout << "Total ice cream sales: " << totalicesales << endl << "Top sales: ";
    for(auto s:topsales){
        cout << s << " ";
    }}
    else cout << "No ice cream sales";
}

# 0314, 2024-10-15 13:48:10, -P------- (11%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<string,double> a;
    map<string,double> maxi;
    double price;
    string ic;
    double num;
    double sum=0;
    double buag=0;
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>ic>>price;
        a[ic]=price;
    }
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>ic>>num;
        if(a.find(ic)!=a.end())
        {
            maxi[ic]+=num*a[ic];
            if(buag<=maxi[ic])
            {
                buag=maxi[ic];
                cout<<"1";
            }
            sum+=num*a[ic];
        }
    }
    if(buag==0)
    {
        cout<<"No ice cream sales";
        return 0;
    }
    cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
    for(auto x:maxi)
    {
        if(x.second==buag)
        {
            cout<<x.first<<" ";
        }
    }
}
# 0315, 2024-10-15 13:50:30, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    map<string,double> a;
    map<string,double> maxi;
    double price;
    string ic;
    double num;
    double sum=0;
    double buag=0;
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>ic>>price;
        a[ic]=price;
    }
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>ic>>num;
        if(a.find(ic)!=a.end())
        {
            maxi[ic]+=num*a[ic];
            if(buag<=maxi[ic])
            {
                buag=maxi[ic];
            }
            sum+=num*a[ic];
        }
    }
    if(buag==0)
    {
        cout<<"No ice cream sales";
        return 0;
    }
    cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
    for(auto x:maxi)
    {
        if(x.second==buag)
        {
            cout<<x.first<<" ";
        }
    }
}

# 0316, 2024-10-15 13:35:58, P-PPPPPPP (88%)

#include <iostream>
#include <map>
#include <tuple>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;

    string iceCream;
    float price, sales;
    map<string, float> iceCreamList;
    for (int i = 0; i < n; i++) {
        cin >> iceCream >> price;
        iceCreamList[iceCream] = price;
    }

    int m;
    cin >> m;

    map<string, float> salesList;
    float totalSales = 0;
    for (int i = 0; i < m; i++) {
        cin >> iceCream >> sales;
        if (iceCreamList.find(iceCream) != iceCreamList.end()) {
            salesList[iceCream] += iceCreamList[iceCream] * sales;
        }
    }

    if (salesList.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        for (auto salesInfo : salesList) {
            totalSales += salesInfo.second;
        }
    } cout << "Total ice cream sales: " << totalSales << endl;

    set<pair<float, string>> topSales;
    float highestSalesPrice = 0.0;
    for (auto salesInfo : salesList) {
        highestSalesPrice = max(highestSalesPrice, salesInfo.second);
    }

    for (auto itr = salesList.rbegin(); itr != salesList.rend(); itr++) {
        auto salesInfo = *itr;
        if (salesInfo.second == highestSalesPrice) {
            topSales.insert(make_pair(salesInfo.second, salesInfo.first));
        }
    }
    
    cout << "Top sales: ";
    for (auto salesInfo : topSales) {
        cout << salesInfo.second << ' ';
    } cout << endl;
}
# 0317, 2024-10-15 13:37:08, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <tuple>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;

    string iceCream;
    float price, sales;
    map<string, float> iceCreamList;
    for (int i = 0; i < n; i++) {
        cin >> iceCream >> price;
        iceCreamList[iceCream] = price;
    }

    int m;
    cin >> m;

    map<string, float> salesList;
    float totalSales = 0;
    for (int i = 0; i < m; i++) {
        cin >> iceCream >> sales;
        if (iceCreamList.find(iceCream) != iceCreamList.end()) {
            salesList[iceCream] += iceCreamList[iceCream] * sales;
        }
    }

    if (salesList.empty()) {
        cout << "No ice cream sales" << endl;
    } else {
        for (auto salesInfo : salesList) {
            totalSales += salesInfo.second;
        }
     cout << "Total ice cream sales: " << totalSales << endl;

    set<pair<float, string>> topSales;
    float highestSalesPrice = 0.0;
    for (auto salesInfo : salesList) {
        highestSalesPrice = max(highestSalesPrice, salesInfo.second);
    }

    for (auto itr = salesList.rbegin(); itr != salesList.rend(); itr++) {
        auto salesInfo = *itr;
        if (salesInfo.second == highestSalesPrice) {
            topSales.insert(make_pair(salesInfo.second, salesInfo.first));
        }
    }
    
    cout << "Top sales: ";
    for (auto salesInfo : topSales) {
        cout << salesInfo.second << ' ';
    } cout << endl;
    }
}

# 0318, 2024-10-15 13:34:19, PPPP---PP (66%)

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

int main() {
    int n1; cin >> n1;
    map<string, double> m, ans;
    for(int i = 0;i < n1;i++) {
        string s; double x; cin >> s >> x;
        m[s] = x;
    }

    int n2; double sum = 0; cin >> n2; 
    for(int i = 0;i < n2;i++) {
        string s; double x; cin >> s >> x;
        if(m[s] != 0) {
            ans[s] += (m[s] * x);
            sum += (m[s] * x);
        }
    }

    vector<pair<double,string>> v;
    for(auto it = ans.begin();it != ans.end();it++) {
        v.push_back({it->second, it->first});
    }
    sort(v.rbegin(), v.rend());

    if(sum == 0) {
        cout << "No ice cream sales";
    } else {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        double maxx = v[0].first;
        for(int i = 0;i < v.size();i++) {
            if(v[i].first != maxx) break;
            cout << v[i].second << " ";
        }
        cout << endl;
    }
    
    return 0;
}
# 0319, 2024-10-15 13:35:11, PPPPPPPPP (100%)

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

    int main() {
        int n1; cin >> n1;
        map<string, double> m, ans;
        for(int i = 0;i < n1;i++) {
            string s; double x; cin >> s >> x;
            m[s] = x;
        }

        int n2; double sum = 0; cin >> n2; 
        for(int i = 0;i < n2;i++) {
            string s; double x; cin >> s >> x;
            if(m[s] != 0) {
                ans[s] += (m[s] * x);
                sum += (m[s] * x);
            }
        }

        vector<pair<double,string>> v;
        for(auto it = ans.begin();it != ans.end();it++) {
            v.push_back({it->second, it->first});
        }
        sort(v.rbegin(), v.rend());

        if(sum == 0) {
            cout << "No ice cream sales";
        } else {
            cout << "Total ice cream sales: " << sum << endl;
            cout << "Top sales: ";
            double maxx = v[0].first;
            for(int i = v.size() - 1;i >= 0;i--) {
                if(v[i].first != maxx) continue;
                cout << v[i].second << " ";
            }
            // for (int i = 0;i < v.size();i++) {
            //     if (v[i].first != maxx) break;
            //     cout << v[i].second << " ";
            // }
            cout << endl;
        }
        
        return 0;
    }

# 0320, 2024-10-15 13:42:46, P-PPPPPPP (88%)

#include <bits/stdc++.h>

using namespace std;

int main() {
  map<string, pair<double, double>> i_tim;

  int n;
  cin >> n;
  double price, tang, total = 0;
  string name;

  while (n--) {
    cin >> name >> price;
    i_tim[name] = {0, price};
  }

  int m;
  cin >> m;

  while (m--) {
    cin >> name >> tang;
    i_tim[name].first += tang * i_tim[name].second;
    total += tang * i_tim[name].second;
  }

  vector<pair<double, string>> just_sort;
  auto it = i_tim.begin();

  while (it != i_tim.end()) {
    just_sort.push_back({it->second.first, it->first});
    ++it;
  }
  sort(just_sort.begin(),just_sort.end(),
       [](auto &a, auto &b) { return a.first > b.first; });

  if (total == 0) cout << "No ice cream sales";
  else cout << "Total ice cream sales: " << total << endl << "Top sales: " ;

  double mx = just_sort[0].first;
  for (auto itt : just_sort) {
    if (itt.first != mx) break;
    cout << itt.second << ' ';
  }
}
# 0321, 2024-10-15 13:43:53, PPPPPPPPP (100%)

#include <bits/stdc++.h>

using namespace std;

int main() {
  map<string, pair<double, double>> i_tim;

  int n;
  cin >> n;
  double price, tang, total = 0;
  string name;

  while (n--) {
    cin >> name >> price;
    i_tim[name] = {0, price};
  }

  int m;
  cin >> m;

  while (m--) {
    cin >> name >> tang;
    i_tim[name].first += tang * i_tim[name].second;
    total += tang * i_tim[name].second;
  }

  vector<pair<double, string>> just_sort;
  auto it = i_tim.begin();

  while (it != i_tim.end()) {
    just_sort.push_back({it->second.first, it->first});
    ++it;
  }
  sort(just_sort.begin(),just_sort.end(),
       [](auto &a, auto &b) { return a.first > b.first; });

  if (total == 0) cout << "No ice cream sales";
  else {cout << "Total ice cream sales: " << total << endl << "Top sales: " ;

  double mx = just_sort[0].first;
  for (auto itt : just_sort) {
    if (itt.first != mx) break;
    cout << itt.second << ' ';
  }}
}

# 0322, 2024-10-15 13:31:00, P-PPPPPPP (88%)

#include <iostream>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    map<string, float> Sell;
    map<string, float> Sold;
    float total = 0;

    int nums;
    cin >> nums;
    for (int i = 0; i < nums; i++) {
        string a;
        float b;
        cin >> a >> b;
        Sell[a] = b;
    }

    int buy_num;
    cin >> buy_num;

    for (int i = 0; i < buy_num; i++) {
        string a;
        float b;
        cin >> a >> b;
        if (Sell.find(a) != Sell.end()) {
            total += Sell[a] * b;

            if (Sold.find(a) != Sold.end()) {
                Sold[a] += Sell[a] * b;
            } else {
                Sold[a] = Sell[a] * b;
            }
        }
    }

    set<string> max_price;

    float max = 0;
    for (auto & b : Sold) {
        if (b.second > max) {
            max = b.second;
        }
    }

    for (auto &b : Sold) {
        if (b.second == max) {
            max_price.insert(b.first);
        }
    }

    if (total > 0) {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";

        for (auto & name : max_price) {
            cout << name << " ";
        }
    } else {
        cout << "No ice cream sales" << total << endl;
    }
}
# 0323, 2024-10-15 13:31:50, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main() {
    map<string, float> Sell;
    map<string, float> Sold;
    float total = 0;

    int nums;
    cin >> nums;
    for (int i = 0; i < nums; i++) {
        string a;
        float b;
        cin >> a >> b;
        Sell[a] = b;
    }

    int buy_num;
    cin >> buy_num;

    for (int i = 0; i < buy_num; i++) {
        string a;
        float b;
        cin >> a >> b;
        if (Sell.find(a) != Sell.end()) {
            total += Sell[a] * b;

            if (Sold.find(a) != Sold.end()) {
                Sold[a] += Sell[a] * b;
            } else {
                Sold[a] = Sell[a] * b;
            }
        }
    }

    set<string> max_price;

    float max = 0;
    for (auto & b : Sold) {
        if (b.second > max) {
            max = b.second;
        }
    }

    for (auto &b : Sold) {
        if (b.second == max) {
            max_price.insert(b.first);
        }
    }

    if (total > 0) {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";

        for (auto & name : max_price) {
            cout << name << " ";
        }
    } else {
        cout << "No ice cream sales" << endl;
    }
}

# 0324, 2024-10-15 13:32:36, PPPPPPPPP (100%)

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

int main() {
    map<string,double> icecreame;
    string ice;
    map <string,double> top;
    double count,max,sales = 0,price;
    int n;
    cin >> n;
    while (n--)
    {
        cin >> ice >> count;
        icecreame[ice] = count;
        top[ice] = 0;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> count;
        if (icecreame.find(ice) != icecreame.end()){
        price = icecreame[ice] * count;
        sales += price;
        top[ice] += price;
        }
    }
    for (auto &q : top) if (q.second > max) max = q.second;
    if (sales != 0) {
        cout << "Total ice cream sales: " << sales << endl;
        cout << "Top sales: ";
        for (auto &q : top) if (q.second == max) cout << q.first << " ";
    }else cout << "No ice cream sales";
}
# 0325, 2024-10-15 13:51:21, PPPPPPPPP (100%)

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

int main() {
    map<string,pair<double,double>> icecreame;
    string ice;
    double count,max,sales = 0;
    int n;
    cin >> n;
    while (n--)
    {
        cin >> ice >> count;
        icecreame[ice].first = count;
        icecreame[ice].second = 0;
    }
    cin >> n;
    while (n--)
    {
        cin >> ice >> count;
        if (icecreame.find(ice) != icecreame.end()){
        count = icecreame[ice].first * count;
        sales += count;
        icecreame[ice].second += count;
        if (icecreame[ice].second > max) max = icecreame[ice].second;
        }
    }
    if (sales != 0) {
        cout << "Total ice cream sales: " << sales << endl;
        cout << "Top sales: ";
        for (auto &q : icecreame) if (q.second.second == max) cout << q.first << " ";
    }else cout << "No ice cream sales";
}

# 0326, 2024-10-15 13:55:13, PPPPPPPPP (100%)

#include <iostream>
#include <string>
#include <map>
#include <set>

int main(){

  int N,M,amount;
  double price,total = 0;
  std::string name; 
  std::map<std::string,double> pricing;
  std::map<std::string,double> saleslist;
  std::cin >> N;
  for(int i = 0; i < N; i++){
    std::cin >> name >> price;
    pricing.insert({name,price});
    saleslist.insert({name,0});
  }
  std::cin >> M;
  for(int i = 0; i < M; i++){
    std::cin >> name >> amount;
    if(pricing.find(name) != pricing.end()){
      total += pricing[name]*amount;
      auto ptr = saleslist.find(name);
      (*ptr).second += pricing[name]*amount;
    }
  }
  
  double highest = 0;
  for(auto itr = saleslist.begin(); itr != saleslist.end(); itr++){
    highest = std::max(highest,(*itr).second);
  }
  std::set<std::string> top;
  for(auto itr = saleslist.begin(); itr != saleslist.end(); itr++){
    if((*itr).second == highest){
      top.insert((*itr).first);
    }
  }

  if(total == 0){
    std::cout  << "No ice cream sales";
  }else{
    std::cout << "Total ice cream sales: " << total << std::endl;
    std::cout << "Top sales:";
    for(auto itr = top.begin(); itr != top.end(); itr++){
      std::cout <<  " " << *itr;
    }
  }

  return 0;
}

# 0327, 2024-10-15 13:36:06, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vt vector

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    
    int n;
    map<string, float> itemPrice;
    map<string, float> sales;
    string itemName;
    float price;

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> itemName >> price;
        itemPrice[itemName] = price;
    }

    cin >> n;
    int itemAmount;
    double totalSales = 0;

    for (int i = 0; i < n; i++) {
        cin >> itemName >> itemAmount;
        if (itemPrice.find(itemName) != itemPrice.end()) {
            float itemSales = itemPrice[itemName] * itemAmount;
            totalSales += itemSales;
            sales[itemName] += itemSales;
        }
    }

    if (totalSales != 0) {
        cout << "Total ice cream sales: " << totalSales << endl;
    } else {
        cout << "No ice cream sales";
        return 0;
    }

    float maxSales = 0;
    vt<string> topSellers;

    for (auto &entry : sales) {
        if (entry.second > maxSales) {
            maxSales = entry.second;
            topSellers.clear();
            topSellers.push_back(entry.first);
        } else if (entry.second == maxSales) {
            topSellers.push_back(entry.first);
        }
    }

    if (!topSellers.empty()) {
        cout << "Top sales: ";
        for (int i = 0; i < topSellers.size(); ++i) {
            if (i > 0) cout << " ";
            cout << topSellers[i];
        }
        cout << endl;
    }

    return 0;
}

# 0328, 2024-10-15 13:25:23, PPPPPPPPP (100%)

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

int main(){
    int n;
    map<string, double> data;
    cin >> n;
    string name;
    double price;
    for(int i = 0; i < n; i++){
        cin >> name >> price;
        data[name] = price;
    }

    int find;
    cin >> find;
    double total = 0;
    map<string, int> total_sale;
    string a;
    int b;
    for(int i = 0; i < find; i++){
        cin >> a;
        cin >> b;
        if(total_sale.find(a) == total_sale.end()){
            total_sale[a] = b * data[a];
            total += (data[a] * b);
        }else{
            total_sale[a] += (b * data[a]);
            total += (data[a] * b);
        }
    }
    if(total == 0){
        cout << "No ice cream sales";
        return 0;
    }

    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales: ";

    int max = -999;
    vector<string> f;
    for(auto itr : total_sale){
        if(itr.second > max){
            f = {itr.first};
            max = itr.second;
        }else if(itr.second == max){
            f.push_back(itr.first);
            max = itr.second;
        }
    }
    sort(f.begin(), f.end());
    for(int i = 0; i< f.size(); i++){
        cout << f[i] << " ";
    }
}

# 0329, 2024-10-15 13:06:35, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
   map<string,float>sale;
   float maxx=INT_MIN;
int main()
{
    int n;
    map<string,float>m;
    cin >> n;
    for (int i = 0 ; i < n ; i++)
    {
        string tmp1;
        float tmp2;
        cin >> tmp1 >> tmp2;
        m[tmp1]=tmp2;
    }
    int n2;
    cin >> n2;
      vector<string>v;
    for (int i = 0 ; i < n2 ; i++)
    {
        string tmp1;
        float tmp2;
        cin >> tmp1 >> tmp2;
        if (m.find(tmp1)!=m.end())
        {
            sale[tmp1]+=m[tmp1]*tmp2;
        }
    }
   // cout << sale["Cornetto"];
    for (auto itr = sale.begin() ; itr!=sale.end() ; itr++)
        {
            if (itr->second>=maxx)
            {
                if (itr->second>maxx)
                {
                    v.clear();
                    maxx=itr->second;
                    v.push_back(itr->first);
                }
                else if (itr->second==maxx)
                {
                    maxx=itr->second;
                    v.push_back(itr->first);
                }
                
            }
        }
        sort(v.begin(),v.end());
    if (sale.empty())
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: ";
        float anss=0;
        for (auto itr = sale.begin() ; itr!=sale.end() ; itr++)
        {
            anss+=itr->second;
        }
        cout << anss << endl << "Top sales: ";
        for (auto x : v)
        {
            cout << x << " ";
        }
    }
}

# 0330, 2024-10-15 13:38:48, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0331, 2024-10-15 13:28:10, PPPPPPPPP (100%)

#include "bits/stdc++.h"

using namespace std;

int main(){
   int n; cin >> n;
   map<string,float> icecream,sell;
   for(int i = 0 ; i < n ; i++){
    string product; cin >> product;
    float price; cin >> price;
    icecream[product] = price;
   } 
   int buy ; cin >> buy;
   for(int i = 0 ; i < buy ; i++){
    string product; cin >> product;
    int time; cin >> time;
    auto itr = icecream.find(product);
    if(itr!=icecream.end()) sell[product]+=icecream[product]*time;
   }
   if(sell.empty()){
    cout << "No ice cream sales" ;
    return 0;
   }
   float sum = 0;
   float mx = 0;
   for(auto v:sell){
    if(mx<v.second) mx = v.second;
    sum+=v.second;
   }
   set <string> menu;
   for(auto v:sell){
    if(mx==v.second) menu.insert(v.first);
   }
   cout << "Total ice cream sales: " << sum << endl;
   cout << "Top sales: ";
   for(auto m:menu) cout << m << ' ';
}

# 0332, 2024-10-15 13:38:19, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main() {
    int n;
    cin>>n;
    map<string,float> IceCream;
    map<string,float> Sales;
    for(int i=0 ; i<n ; i++) {
        string Flavor;
        float Price;
        cin>>Flavor>>Price;
        IceCream[Flavor] = Price;
    }

    int m;
    cin>>m;
    string MostPop;
    vector<string> TopSales;
    float mx = 0;
    float Total = 0;
    for(int i=0 ; i<m ; i++) {
        string Flavor;
        int Quant;
        cin>>Flavor>>Quant;
        auto it1 = IceCream.find(Flavor);
        if(it1 != IceCream.end()) {
            Total += Quant * IceCream[Flavor];
            auto it2 = Sales.find(Flavor);
            if(it2 == Sales.end()) {
                Sales[Flavor] = Quant * IceCream[Flavor];
            }
            else {
                Sales[Flavor] += Quant * IceCream[Flavor];
            }
            mx = max(mx, Sales[Flavor]);
        }
    }
    for(auto & a : Sales) {
        if(a.second == mx) {
            TopSales.push_back(a.first);
        }
    }

    if(Sales.size() == 0) {
        cout<<"No ice cream sales";
    }
    else {
        cout<<"Total ice cream sales: "<<Total<<endl;
        cout<<"Top sales: ";
        for(auto & a : TopSales) {
            cout<<a<<" ";
        }
    }
}

# 0333, 2024-10-15 13:33:57, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main() {
    int n; cin >> n;
    map<string, double> list;
    string type;
    double price;
    while(n--) {
        cin >> type >> price;
        list[type] = price;
    }

    int m; cin >> m;
    map<string, int> sales;
    string typeSale;
    int num;
    while(m--) {
        cin >> typeSale >> num;
        if(sales.find(typeSale) == sales.end()) {
            sales[typeSale] = num;
        } else {
            sales[typeSale] += num;
        }
    }
    double total = 0;
    bool stt = false;
    vector<pair<string, int>> eachSales;
    for(auto p : sales) {
        auto itr = list.find(p.first);
        if(itr != list.end()) {
            double eachSale = p.second*(*itr).second;
            total += eachSale;
            eachSales.push_back(make_pair(p.first, eachSale));
            stt = true;
        }
    }

    vector<string> maxSales;
    int max = 0;
    for(auto k : eachSales) {
        if(k.second > max) {
            max = k.second;
        }
    }

    for(auto i : eachSales) {
        if(i.second == max) {
            maxSales.push_back(i.first);
        }
    }

    if(stt) {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(int i = 0; i < maxSales.size(); ++i) {
            cout << maxSales[i] << " ";
        }
    } else {
        cout << "No ice cream sales";
    }
}

# 0334, 2024-10-15 13:39:17, PPPPPPPPP (100%)

#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>

int main() {
  std::unordered_map<std::string, double> icecream_cost;
  std::unordered_map<std::string, int> icecream_sales;

  std::string name;
  double cost, total_sales{0};
  int sales, amount;

  std::cin >> amount;

  for (int i{0}; i < amount; ++i) {
    std::cin >> name >> cost;
    icecream_cost[name] = cost;
  }

  std::cin >> amount;
  for (int i{0}; i < amount; ++i) {
    std::cin >> name >> sales;
    if (icecream_cost.find(name) != icecream_cost.end()) {
      icecream_sales[name] += sales;
      total_sales += icecream_cost[name] * sales;
    }
  }

  std::vector<std::pair<std::string, int>> unsorted_sales(
      icecream_sales.begin(), icecream_sales.end());

  std::sort(unsorted_sales.begin(), unsorted_sales.end(),
            [&icecream_cost](std::pair<std::string, int> &elm1,
                             std::pair<std::string, int> &elm2) {
              return (elm1.second * icecream_cost.at(elm1.first) ==
                      elm2.second * icecream_cost.at(elm2.first))
                         ? elm1.first < elm2.first
                         : elm1.second * icecream_cost.at(elm1.first) >
                               elm2.second * icecream_cost.at(elm2.first);
            });

  if (unsorted_sales.empty() || unsorted_sales.front().second == 0)
    std::cout << "No ice cream sales\n";

  else {
    std::cout << "Total ice cream sales: " << total_sales << "\n";
    std::cout << "Top sales: ";
    for (const auto &elm : unsorted_sales) {
      if (unsorted_sales.front().second *
              icecream_cost[unsorted_sales.front().first] !=
          elm.second * icecream_cost[elm.first]) {
        break;
      }

      std::cout << " " << elm.first;
    }
    std::cout << "\n";
  }
}

# 0335, 2024-10-15 13:38:59, PPPPPPPPP (100%)

#include<iostream>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
int main(){
    map<string,double> price;
    map<string,double> out;
   // vector<double> out;
    double m,n,s,sum=0,p,MAX=1;
    cin>>n;
    string ice;
    while(n--){
        cin>>ice>>s;
        price[ice]=s;
        out[ice]=0;
        }
    cin>>m;
    while(m--){
        cin>>ice>>p;
        auto f=price.find(ice);
        if(f != price.end()){
            sum+=price[ice]*p;
            out[ice] +=price[ice]*p;
        }
    }if(sum==0)
    cout<<"No ice cream sales";
    else{
    cout<<"Total ice cream sales: "<<sum<<endl;
    cout<<"Top sales: ";
    for(auto i:out)
        MAX=max(i.second,MAX);
    for(auto i:out){
        if(i.second==MAX) cout<<i.first<<" ";
    }
    }
}

# 0336, 2024-10-15 13:36:10, PPPPPPPPP (100%)

#include <cmath>
#include <iostream>
#include <set>
#include <string>
#include <unordered_map>
using namespace std;

int main(int argc, const char **argv) {
    int n, q, unit;
    cin >> n;
    unordered_map<string, pair<float, float>> ice2price;
    pair<float, set<string>> ans = {-1, {""}};
    string name;
    float price, total = 0;
    for (int i = 0; i < n; i++) {
        cin >> name >> price;
        ice2price[name].first = price;
        ice2price[name].second = 0.0F;
    }
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> name >> unit;
        if (ice2price.find(name) == ice2price.end()) continue;
        auto cur = &ice2price[name];
        cur->second += cur->first * unit;
    }
    for (auto &ice : ice2price) {
        if (ice.second.second > ans.first) {
            ans.first = ice.second.second;
            ans.second = {ice.first};
        } else if (ice.second.second == ans.first) {
            ans.second.insert(ice.first);
        }
        total += ice.second.second;
    }
    if (total == 0) {
        cout << "No ice cream sales";
        return 0;
    }
    cout << "Total ice cream sales: " << total;
    cout << "\nTop sales:";
    for (auto &i : ans.second)
        cout << ' ' << i;
    return 0;
}

# 0337, 2024-10-15 13:22:02, PPPPPPPPP (100%)

#include <iostream>
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <vector>
#include <map>

using namespace std;

int main(){
    int n;
    cin>>n;
    map<string,double> rec;
    map<string,int> amount;
    int max_sale=0;
    set<string> max_food;
    for(int i=0;i<n;i++){
        string food;
        double price;
        cin>>food>>price;
        rec[food]=price;
        amount[food]=0;
    }

    double total=0;

    int m;
    cin>>m;
    for(int i=0;i<m;i++){
        string food;
        double sale;
        cin>>food>>sale;
        if(rec.find(food)!=rec.end()){
            total+=sale*(rec[food]);
            amount[food]+=sale*rec[food];
            if(amount[food]>max_sale){
                max_sale=amount[food];
                max_food={food};
            }else if(amount[food]==max_sale){
                max_food.insert(food);
            }
        }
    }
    if(total==0){
        cout<<"No ice cream sales";
        return 0;
    }
    cout<<"Total ice cream sales: "<<total<<endl;
    cout<<"Top sales: ";
    for(auto i:max_food){
    cout<<i<<" ";}
}

# 0338, 2024-10-15 13:50:01, PPPPPPPPP (100%)

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

int main()
{
    map<string, float> icecream_price;

    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string name;
        float price;
        cin >> name >> price;

        icecream_price[name] = price;
    }

    map<string, int> sale;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string name;
        int num;
        cin >> name >> num;

        if (icecream_price.find(name) == icecream_price.end())
        {
            continue;
        }

        if (sale.find(name) == sale.end())
        {
            sale[name] = num;
        }
        else
        {
            sale[name] += num;
        }
    }

    if (sale.size() == 0)
    {
        cout << "No ice cream sales";
        exit(0);
    }

    map<string, float> total;
    float total_sale = 0;

    for (auto s : sale)
    {
        float price = s.second * icecream_price[s.first];
        if (total.find(s.first) == total.end())
        {
            total[s.first] = price;
        }
        else
        {
            total[s.first] += price;
        }
        total_sale += price;
    }

    vector<pair<float, string>> output;

    for (auto t : total)
    {
        output.push_back(make_pair(-t.second, t.first));
    }

    sort(output.begin(), output.end());

    cout << "Total ice cream sales: " << total_sale << endl;
    cout << "Top sales: ";
    for (auto out : output)
    {
        if (out.first > output[0].first)
        {
            break;
        }
        cout << out.second << " ";
    }
}

# 0339, 2024-10-15 13:35:29, PPPPPPPPP (100%)

#include<bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
    map<string,pair<double,double>> sales;
    int n,s;
    cin >> n;
    string name;
    double price,total=0;
    while(n--){
        cin >> name >> price;
        sales[name]={price,0};
    }
    cin >> n;
    while(n--){
        cin >> name >> s;
        if(sales.find(name)!=sales.end()){
            double r=sales[name].first*s;
            sales[name].second+=r;
            total+=r;
        }
    }
    if(total==0){
        cout << "No ice cream sales" << endl;
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> x;
        for(auto &p:sales){
            x.push_back({-p.second.second,p.first});
        }
        sort(x.begin(),x.end());
        cout << "Top sales: " << x[0].second << ' ';
        for(int i=1;i<x.size();i++){
            if(x[i].first!=x[i-1].first){
                break;
            }
            cout << x[i].second << ' ';
        }
    }
}

# 0340, 2024-10-15 13:55:59, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<set>

using namespace std ;

int main()
{
    int round ; cin >> round ;

    map<string , double> ice_cream ;

    string order_name ;
    double price ;

    for(int i = 0 ; i < round ; i++) {
        cin >> order_name >> price ;

        ice_cream[order_name] = price ;
    }

    cin >> round ;

    double total_price = 0 ;
    int order ;
    
    int check = 0 ;
    double max_price = 0 ;

    map<string , double> ice_cream_total ;

    for(int i = 0 ; i < round ; i++) {
        cin >> order_name >> order ;

        if(ice_cream.find(order_name) != ice_cream.end()) {
            check = 1 ;
            ice_cream_total[order_name] += order * ice_cream[order_name] ;
            total_price += order * ice_cream[order_name] ;
        }
    }

    for(auto & i : ice_cream_total) {
        if(i.second > max_price) {
            max_price = i.second ;
        }
    }

    if(check == 0) cout << "No ice cream sales" << endl ;
    else {
        cout << "Total ice cream sales: " << total_price << endl ;

        cout << "Top sales: " ;

        for(auto i : ice_cream_total) {
            if(i.second == max_price) cout << i.first << " " ;
        }
    }
}

# 0341, 2024-10-15 13:22:49, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    map<string, float> ice;
    for(int i=0; i<n; i++){
        string name;
        float price;
        cin >> name >> price;
        ice[name] = price;
    }
    int m;
    float got = 0;
    cin >> m;
    map<string, float> sale;
    for(int i=0; i<m; i++){
        string name;
        int amount;
        cin >> name >> amount;
        auto x = ice.find(name);
        if(x != ice.end()){
            got += (amount * x->second);
            sale[name] += amount*x->second;
        }
    }
    if(got == 0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << got << "\n";
        float top = 0;
        vector<string> nama;
        for(auto [name, price]: sale){
            if(price > top){ 
                nama.clear();
                nama.push_back(name);
                top = price;
            }else if(price == top){
                nama.push_back(name);
            }
        }
        cout << "Top sales:";
        for(auto s: nama){
            cout << " " << s;
        }
    }
}

# 0342, 2024-10-15 13:22:25, PPPPPPPPP (100%)

#include<iostream>
#include<map>

using namespace std;

int main(){
    int n;cin >> n;
    map<string,double> product;

    while (n--)
    {
        string tag; cin >> tag;
        double cost; cin >> cost;
        product[tag] = cost;
    }

    int m ; cin >> m;

    map<string , double> sale_list;

    while (m--)
    {
        string buy_list; cin >> buy_list;
        int amount ; cin >> amount; 

        if(product.find(buy_list) == product.end()){
            sale_list[buy_list] = 0;
        }

        sale_list[buy_list] += (product[buy_list] * amount); 
    }

    double total = 0;

    for(auto e : sale_list){
        total += e.second;
    }

    if(total == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        double max = 0;
        
        for(auto e : sale_list){
            if(max < e.second){
                max = e.second;
            }
        }
        
        cout << "Top sales: ";
        for(auto e : sale_list){
            if(max == e.second){
                cout << e.first << ' ';
            }
        }
    }
}

# 0343, 2024-10-15 13:22:43, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main(){

    map<string , double> icecream;

    map<string , double> sales;

    int n;

    cin >> n;

    for(int i = 0 ; i < n ; i++){

        string name;

        double price;

        cin >> name >> price;

        icecream[name] = price;

        sales[name] = 0;

    }

    cin >> n;

    double max = 0;

    double money = 0;

    for(int i = 0 ; i < n ; i++){

        string name;

        double amount;

        cin >> name >> amount;

        if(icecream.find(name) != icecream.end()){

            sales[name] = sales[name] + ( amount * icecream[name] );

        }

    }

    for(auto x : sales){

        if(x.second > max)

            max = x.second;

        money = money + x.second;

    }

    if(money == 0){

        cout << "No ice cream sales";

        return 0;

    }

    cout << "Total ice cream sales: " << money << endl;

    cout << "Top sales: ";

    for(auto x : sales){

        if(x.second == max){

            cout << x.first << " ";

        }

    }





}

# 0344, 2024-10-15 13:08:54, PPPPPPPPP (100%)

#include<bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
    map<string,pair<double,double>> sales;
    int n,s;
    cin >> n;
    string name;
    double price,total=0;
    while(n--){
        cin >> name >> price;
        sales[name]={price,0};
    }
    cin >> n;
    while(n--){
        cin >> name >> s;
        if(sales.find(name)!=sales.end()){
            double r=sales[name].first*s;
            sales[name].second+=r;
            total+=r;
        }
    }
    if(total==0){
        cout << "No ice cream sales" << endl;
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        vector<pair<double,string>> x;
        for(auto &p:sales){
            x.push_back({-p.second.second,p.first});
        }
        sort(x.begin(),x.end());
        cout << "Top sales: " << x[0].second << ' ';
        for(int i=1;i<x.size();i++){
            if(x[i].first!=x[i-1].first){
                break;
            }
            cout << x[i].second << ' ';
        }
    }
}

# 0345, 2024-10-15 13:21:12, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <unordered_map>
#include <vector>
using namespace std;

int main() {
    int n, m;
    cin >> n;

    map<string, float> sale;
    unordered_map<string, float> map;
    string id;
    float price;
    for(int i = 0; i < n; i++) {
        cin >> id >> price;
        map[id] = price;
    }

    int x;
    float sum = 0;
    cin >> m;
    for(int i = 0; i < m; i++) {
        cin >> id >> x;

        if(map.find(id) != map.end()) {
            sum += x * map[id];
            sale[id] += x * map[id];
        }
    }

    float Max = -1;
    for(auto &[k,v]: sale) {
        if(v > Max) {
            Max = v;
        }
    }

    if(Max == -1) {
        cout << "No ice cream sales\n";
        return 0;
    }

    cout << "Total ice cream sales: " << sum << '\n';
    cout << "Top sales: ";
    for(auto &[k, v]: sale) {
        if(v == Max) cout << k << ' ';
    }
    cout << '\n';
    return 0;
}

# 0346, 2024-10-15 13:28:59, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0347, 2024-10-15 13:51:46, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0348, 2024-10-15 13:36:28, PPPPPPPPP (100%)

#include<map>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    map<string,double> cum;
    map<string,double> each;
    int n,m;
    cin>>n;
    cin.ignore();
    string ice;
    double price;
    for(int i=0;i<n;i++){
        cin>>ice>>price;
        cin.ignore();
        cum[ice]=price;
        each[ice]=0;
    }
    cin>>m;
    cin.ignore();
    double sum=0;
    for(int i=0;i<m;i++){
        cin>>ice>>price;
        cin.ignore();
        if(cum.find(ice)!=cum.end()){
            auto &x=each;
            x[ice]+=price*cum[ice];
            sum+=price*cum[ice];
        }
    }
    if(sum==0) cout<<"No ice cream sales";
    else {cout<<"Total ice cream sales: "<<sum<<endl;
    double Max=0;
    vector<string> ans;
    for(auto y:each){
        if(y.second>Max){
            Max=y.second;
        }
    }
    for(auto y:each){
        if(y.second==Max){
            ans.push_back(y.first);
        }
    }
    sort(ans.begin(),ans.end());
    cout<<"Top sales:";
    for(auto x:ans){
        cout<<" "<<x;
    }}
}

# 0349, 2024-10-15 13:28:46, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0350, 2024-10-15 13:32:15, PPPPPPPPP (100%)

#include <iostream>
#include <set>
#include <map>

std::map<std::string, double> priceOfIceCream;
std::map<std::string, double> totalSale;
int totalProduct, totalPurchase, purchase;
double productPrice, moneyEarned;
std::string productName;

int main()
{
  std::cin >> totalProduct;
  while (totalProduct--)
  {
    std::cin >> productName >> productPrice;
    priceOfIceCream[productName] = productPrice;
  }
  /*
  for (auto iter = priceOfIceCream.begin(); iter != priceOfIceCream.end(); iter++)
  {
    std::cout << iter->first << ' ' << iter->second << "\n";
  }
  std::cout << "=====\n";
  */
  std::cin >> totalPurchase;
  while(totalPurchase--)
  {
    std::cin >> productName >> purchase;
    moneyEarned += priceOfIceCream[productName] * purchase;
    totalSale[productName] += priceOfIceCream[productName] * purchase;
  }
  /*
  for (auto iter = totalSale.begin(); iter != totalSale.end(); iter++)
  {
    std::cout << iter->first << ' ' << iter->second << "\n";
  }
  */
  
  if (moneyEarned == 0)
  {
    std::cout << "No ice cream sales";
    return 0;
  }
  std::cout << "Total ice cream sales: " << moneyEarned << "\n" << "Top sales: ";
  
  double highestSale = -1;
  std::set<std::string> toPrint;
  toPrint.clear();
  for (auto iter = totalSale.begin(); iter != totalSale.end(); iter++)
  {
    if (iter->second > highestSale)
    {
      toPrint.clear();
      toPrint.insert(iter->first);
      highestSale = iter->second;
    }
    else if (iter->second == highestSale)
    {
      toPrint.insert(iter->first);
    }
  }
  
  for (auto x : toPrint)
  {
    std::cout << x << " ";
  }
}

# 0351, 2024-10-15 13:46:37, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>

using namespace std;

int main() {
    int N; cin >> N;
    map <string, double> menu;
    map <string, double> total_sale;
    string name; double price;

    while (N--) {
        cin >> name >> price;
        menu[name] = price; 
        total_sale[name] = 0;
    }

    set <string> bestseller;
    int M; cin >> M;
    double sum = 0, max = 0; int count = 0;
    string temp;
    while (M--) {
        cin >> temp >> count;
        total_sale[temp] += menu[temp] * count;
        sum += menu[temp] * count;
        if (total_sale[temp] > max) {
            max = total_sale[temp];
            bestseller.clear();
            bestseller.insert(temp);
        } else if (total_sale[temp] == max) {
            bestseller.insert(temp);
        }
    }

    if (sum == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << sum << endl; 
        cout << "Top sales: ";
        for (auto s : bestseller) {
            cout << s << ' ';
        }
    }
}

# 0352, 2024-10-15 13:31:09, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  int n,m;
  cin >> n;

  map<string, pair<int,double>> ices;


  for (int i = 0; i < n; i++){
    string name;
    double price;
    cin >> name >> price;

    ices[name] = make_pair(0,price);
  }

  cin >> m;

  for (int i = 0; i < m; i++){
    string name;
    double num;
    cin >> name >> num;
    if (ices.find(name) != ices.end()){
        ices[name] = make_pair(ices[name].first + num , ices[name].second);
    }
  }

  double sum = 0;
  double max = 0;
  for (auto i : ices){
      sum += i.second.second * i.second.first;
      if (i.second.second * i.second.first > max){
        max = i.second.second * i.second.first;
      }
  }

  if (sum > 0){
      cout << "Total ice cream sales: " << sum << endl;

      vector<string> top;
      for (auto i : ices){
        if (i.second.second * i.second.first == max){
          top.push_back(i.first);
        }
      }

      if (top.size() > 0){
        sort(top.begin(), top.end());
        cout << "Top sales: ";
        for (int i = 0; i < top.size(); i++){
          cout << top[i] << ' ';
        }
      }
    }
    else {
      cout << "No ice cream sales";
    }
}

# 0353, 2024-10-15 13:41:50, PPPPPPPPP (100%)

#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<cmath>
#include<map>
using namespace std;
int main()
{
    int m,n;
    cin>>m;
    string menu,order;
    float price,amount;
    map<string,float> map1;
    map<string,float> map2; //เก็บยอดขายแต่ละicecream


    for(int i=0;i<m;i++){
        cin>>menu>>price;
        map1[menu] = price;
        map2[menu] = 0;
    }

    cin>>n;
    double total = 0;
    for(int i=0;i<n;i++){
        cin>>order>>amount;
        if(map1.count(order)){
            total += amount*map1[order];
            map2[order] += amount*map1[order];

        }
    }

    if(total == 0){
        cout<<"No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << "\n";

        vector<pair<double,string>> out;
        for (auto beg = map2.begin(); beg != map2.end(); beg++)
            out.push_back({beg->second, beg->first});

        sort(out.begin(), out.end());

        cout << "Top sales: ";
        for (int i=0;i<out.size();i++)
            if (out[i].first == out[out.size()-1].first)
                cout << out[i].second << " ";
    }

    return 0;

}

# 0354, 2024-10-15 13:30:48, PPPPPPPPP (100%)

#include <bits/stdc++.h>

#define f first
#define s second
#define ll long long
#define pii pair<int, int>

using namespace std;

map<string,float> icream, sales;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int n, q;
    cin >> n;
    string ic;
    float cost;
    for(int i = 0; i < n; i++) {
        cin >> ic >> cost;
        icream[ic] = cost;
    }

    cin >> n;
    float mx = -1, sum = 0;
    for(int i = 0; i < n ; i++) {
        cin >> ic >> q;
        if(icream.find(ic) != icream.end()) {
            sales[ic] += q * icream[ic];
            sum += q * icream[ic];
            mx = max(mx,sales[ic]);
        }
    }

    if(mx == -1) {
        cout << "No ice cream sales";
    } else {
        cout << "Total ice cream sales: " << sum << '\n';
        cout << "Top sales:";
        for(auto it : sales) {
            if(it.s == mx) {
                cout << " " << it.f;
            }
        }
    }

    return 0;
}

# 0355, 2024-10-15 13:45:51, PPPPPPPPP (100%)

#include <iostream>
#include <map>
using namespace std;
int main () {
    int N;
    string ic;
    float cost;
    cin >> N;
    map<string,float> iclist,salemap;
    while (N--) {
        cin >> ic >> cost;
        iclist[ic]=cost;
    }
    bool sale=false;
    int m;
    cin >> m;
    string product;
    float n,totalsale=0.0,topsale=0.0;
    map<string,int> nsale;
    while (m--) {
        cin >> product >> n;
        if (iclist.find(product)!=iclist.end()) {
        if (nsale.find(product)!=nsale.end()) {
            nsale[product]+=n;
        }
        else nsale[product]=n;
        sale=true;
        totalsale+=iclist[product]*n;
        }
    }
    if (sale) {
        map<string,float> answer;
        cout << "Total ice cream sales: "<< totalsale << endl;
        cout << "Top sales: ";
        for (auto p:nsale) {
            answer[p.first]=p.second*iclist[p.first];
            if (answer[p.first]>topsale) topsale=answer[p.first];
        }
        for (auto p:answer) {
            if (p.second==topsale) {
                cout << p.first << " ";
            }
        }
    }
    else cout << "No ice cream sales" << endl;
}

# 0356, 2024-10-15 13:56:21, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;

int main(){
    int n;
    cin>>n;
    map<string,double> ma,mb;
    for(int i=0;i<n;i++){
        string t;
        double u;
        cin>>t>>u;
        ma[t]=u;
    }
    cin>>n;
    double total=0;
    for(int i=0;i<n;i++){
        string t;
        double u;
        cin>>t>>u;
        if(ma.find(t)!=ma.end()){
            mb[t]+=u*ma[t];
            total+=u*ma[t];
        }
    }
    set<string> top;
    double maxprice=0;
    for(auto it:mb){
        if(it.second>maxprice){
            maxprice=it.second;
            top.clear();
            top.insert(it.first);
        }else if( it.second==maxprice){
            top.insert(it.first);
        }
    }

    if(total==0){
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<total<<'\n';
        cout<<"Top sales: ";
        for(auto it:top){
            cout<<it<<' ';
        }

    }
}

# 0357, 2024-10-15 13:40:08, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0358, 2024-10-15 13:29:52, PPPPPPPPP (100%)

#include <iostream>
#include <map>
using namespace std;

int main() {
    int n;
    cin>>n;
    map<string,double> menu;
    map<string,double> order;
    string name;
    double price;
    for (int i=0 ; i<n ; i++) {
        cin>>name>>price;
        menu[name] = price;
        order[name] = 0;
    }

    int m;
    cin>>m;
    double amount;
    for (int i=0 ; i<m ; i++) {
        cin>>name>>amount;
        if (order.find(name) != order.end()) {
            order[name] += menu[name]*amount;
        }
    }

    double total_sale=0.0, top_sale=0.0;
    string top_name;
    for (auto j=order.begin() ; j!=order.end() ; j++) {
        total_sale += j->second;
        if (top_sale<j->second) {
            top_sale=j->second;
            top_name=j->first;
        }
    }

    if (total_sale==0) {
        cout<<"No ice cream sales";
    } else {
        cout<<"Total ice cream sales: "<<total_sale<<endl;
        cout<<"Top sales:";
        for (auto c : order) {
            if (c.second==top_sale) {
                cout<<" "<<c.first;
            }
        }
    }

}

# 0359, 2024-10-15 13:29:28, PPPPPPPPP (100%)

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

int main()
{
    int N;
    cin >> N;

    string icecreamName;
    double icecreamPrice;
    map<string, double> icecreamPrices;
    map<string, double> icecreamBought;
    for (int i = 0; i < N; i++)
    {
        cin >> icecreamName >> icecreamPrice;
        icecreamPrices[icecreamName] = icecreamPrice;
        icecreamBought[icecreamName] = 0;
    }

    int M;
    cin >> M;

    string nameToFind;
    double quantity, total = 0, maxPrice = 0;
    for (int i = 0; i < M; i++)
    {
        cin >> nameToFind >> quantity;
        map<string, double>::iterator foundIcecream = icecreamBought.find(nameToFind);
        if (foundIcecream != icecreamBought.end())
        {
            double calculatedPrice = icecreamPrices.find(nameToFind)->second * quantity;
            foundIcecream->second += calculatedPrice;
            maxPrice = max(maxPrice, foundIcecream->second);
            total += calculatedPrice;
        }   
    }

    if (total == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << total << endl;
        // find top sales;
        cout << "Top sales: ";
        for (auto topSales : icecreamBought)
        {
            if (topSales.second >= maxPrice) cout << topSales.first << " ";
        }

    }
    return 0;
}

# 0360, 2024-10-15 13:36:11, PPPPPPPPP (100%)

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

int main(){
    map<string,double> price;
    map<string,int> a;
    int n;
    cin >> n;
    while(n--){
        double p;string name;
        cin >> name >> p;
        price[name] = p;
    }
    int m,top{0};double sum{0};
    cin >> m;
    while(m--){
        string name;int amount;
        cin >> name >> amount;
        if(price[name]!=0){
            a[name] += price[name]*amount;
            if(a[name]>top) top = a[name];
            sum += price[name]*amount;
        }
    }
    if(sum==0){
        cout << "No ice cream sales";
        return 0;
    }
    cout << "Total ice cream sales: " << sum << '\n' << "Top sales:";
    for(auto i:a){
        if(i.second==top) cout << ' ' << i.first;
    }
}

# 0361, 2024-10-15 13:24:18, PPPPPPPPP (100%)


#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}

# 0362, 2024-10-15 13:34:42, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <utility>
#include <vector>
using namespace std;
int main () {
    vector <pair <string,double>> iceprice;
    int m;
    cin >> m;
    for (int i=0;i<m;i++) {
        string ice;
        double price;
        cin >> ice >> price;
        iceprice.push_back(make_pair(ice,price));
    }
    map <string,double> sale;
    int n;
    cin >> n;
    for (int i=0;i<n;i++) {
        string menu;
        double sell;
        cin >> menu >> sell;
        sale[menu] += sell;
    }
    map <string,double> eachsaleprice;
    for (auto each : sale) {
        for (int i=0;i<iceprice.size();i++) {
            if (iceprice[i].first==each.first) {
                eachsaleprice[each.first] = iceprice[i].second*sale[each.first];
            }
        }
    }
    double total = 0 , most = 0;
    for (auto each : eachsaleprice) {
        total += eachsaleprice[each.first];
        if (eachsaleprice[each.first]>most) most = eachsaleprice[each.first];
    }
    if (total == 0) {
        cout << "No ice cream sales";
        return 0;
    }
    cout << "Total ice cream sales: " << total << endl;
    cout << "Top sales: ";
    for (auto each : eachsaleprice) {
        if (eachsaleprice[each.first] == most) cout << each.first << ' ';
    }
}

# 0363, 2024-10-15 13:20:58, PPPPPPPPP (100%)

#include <iostream>
#include <map>
using namespace std;

int main(){
    int i,m,n;
    double cost,most=0,total=0;
    string tast;
    map<string,double> layer,sale;
    cin >> n;
    for(i=0;i<n;++i){
        cin >> tast >> cost;
        layer[tast]=cost;
    }
    cin >> m;
    for(i=0;i<m;++i){
        cin >> tast >> cost;
        if(sale.find(tast)!=sale.end()){
            sale[tast]+=cost;
        }else{
            sale[tast]=cost;
        }
    }
    for(auto j : sale){
        if(layer.find(j.first)!=sale.end()){
            sale[j.first]=j.second*layer[j.first];
            total += sale[j.first];
            if(sale[j.first]>most){
                most=sale[j.first];
            }
        }
    }
    if(total==0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto j : sale){
            if(j.second==most){
                cout << j.first << " ";
            }
        }
    }

    return 0;
}

# 0364, 2024-10-15 13:58:02, PPPPPPPPP (100%)

#include<bits/stdc++.h>

using namespace std;

int main() {
    map<string,float> m;

    int num1;
    cin >> num1;
    float in;
    string in1;
    vector<pair<string,float>> v;
    vector<string> ff;

    for(int i = 0; i< num1;i++){
        cin >> in1 >> in;
        m.insert(pair<string,double>(in1 , in));
        v.push_back(make_pair(in1,0));
    }


    cin >> num1;
    float total_sum = 0;
    float max = 0;
    
    for(int i = 0; i< num1;i++){
        cin >> in1 >> in;
        double ice = m[in1]*in;
        total_sum = ice + total_sum;
        for(auto &e: v){
            if(e.first == in1){e.second = e.second + ice;
            break;}
        }

    }

    for(auto e : v){
    if( e.second > max){
            ff.clear();
            ff.push_back(e.first);
            max = e.second;
        } else if(e.second == max){
            ff.push_back(e.first);
        }
    }


    if(total_sum == 0){
        cout<<"No ice cream sales";
        return 0;}

    cout << "Total ice cream sales: " << total_sum<<endl;
    cout << "Top sales: ";

    sort(ff.begin(),ff.end());

    for(auto e: ff){cout << e << " ";}

    

    
}

# 0365, 2024-10-15 13:19:08, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
map<string,double>price;
map<string,double>sell;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        string a;
        double b;
        cin>>a>>b;
        price[a] = b;
    }
    double check = 0 ;
    double all = 0 ;
    cin>>n;
    double best = 0;
    for(int i=0;i<n;i++){
        string a;
        double b;
        cin>>a>>b;
        sell[a]+=b;
        if(price.find(a)!=price.end()){
            best = max(best,sell[a]*price[a]);
            all+=b*price[a];
        }
    }
    if(best==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<all<<endl;
        cout<<"Top sales: ";
        for(auto x:sell){
            if(x.second*price[x.first]==best){
                cout<<x.first<<" ";
            }
        }
    }
}

# 0366, 2024-10-15 13:18:21, PPPPPPPPP (100%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    map <string, double> list, total;
    int n, m;
    cin >> n;
    while(n--){
        string good;
        double price;
        cin >> good >> price;
        list[good] = price;
        total[good] = 0;
    }
    bool check = false;
    double sum = 0;
    cin >> m;
    while(m--){
        string good;
        double cnt;
        cin >> good >> cnt;
        if(list.find(good) != list.end()){
            total[good] += (list[good] * cnt);
            sum += (list[good] * cnt);
        }
    }
    double mx = -1e9;
    set <string> mxPro;
    for(auto &kv : total){
        if(mx < kv.second){
            mx = kv.second;
            mxPro.clear();
            mxPro.insert(kv.first);
        }
        else if(mx == kv.second) mxPro.insert(kv.first);
    }

    if(sum == 0) cout << "No ice cream sales" << endl;
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for(auto &e : mxPro) cout << e << ' ';
    }

    return 0;
}

# 0367, 2024-10-15 13:12:04, PPPPPPPPP (100%)

#include <iostream>
#include <map>
using namespace std;

int main() {
    int n,m;
    cin >> n;
    double price,top = 0,sum = 0;
    string cream;
    map <string , double> menu;
    map <string , double> total;
    while (n--) {
        cin >> cream >> price;
        menu[cream] = price;
    }
    cin >> m;
    while (m--) {
        cin >> cream >> price;
        if (total.find(cream) != total.end()) {
            total[cream] = total[cream] + price*menu[cream];
            top = max(top,total[cream]);
        } else if (menu.find(cream) != menu.end()){
            total[cream] = price*menu[cream];
            top = max(top,total[cream]);
            
        }
        
    }
    if (total.empty()) {
        cout << "No ice cream sales";
    } else {
        for (auto c: total) {
            sum += c.second;
        }
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: " ;
        for (auto c: total) {
            if (c.second == top) {
                cout << c.first << " ";
            }
        }
    }
    
}

# 0368, 2024-10-15 13:52:22, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std; 
int main()
{ 
  int a,b; 
  cin>>a; 
  float mx=0,sum=0; 
  set<string> mxx; 
  unordered_map<string ,float>m; 
  unordered_map<string ,int>mp; 
  for(int i=0;i<a;++i)
  { 
    string temp; 
    float p; 
    cin>>temp>>p; 
    m[temp]=p; 
  } 
  
  cin>>b; 
  for(int i=0;i<b;++i)
  { 
    string temp; 
    int n; 
    cin>>temp>>n; 
    mp[temp]+=n; 
  } 
  
  for(auto i:mp)
  { 
    string temp = i.first; 
    int n=i.second; 
    if(m.find(temp)!=m.end())
    { 
      sum+=m[temp]*n; 
      if((m[temp]*n)>mx)
      { 
        mx=m[temp]*n; 
        mxx.clear();
        mxx.insert(temp); 
      } 
      else if((m[temp]*n)==mx)
      { 
        mxx.insert(temp); 
      } 
    } 
  } 
  
  if(sum==0)
    cout<<"No ice cream sales"; 
  else
  {
    cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: "; 
    for(auto i:mxx)
      cout<<i<<" "; 
  } 
}

# 0369, 2024-10-15 13:43:34, PPPPPPPPP (100%)

#include<iostream>
#include<map>
#include<algorithm>
using namespace std;

int main(){
    int n;cin>>n;
    map<string , double> ice;
    string tx;double in;
    for(int i=0;i<n;i++){
        cin>>tx>>in;
        ice.insert({tx,in});
    }
    int m;cin>>m;
    map<string , double> sell;
    map<string , double> ans;
    double an = 0.0,mx=-1;
    for(int i=0;i<m;i++){
        cin>>tx>>in;
        //sell.insert({tx,in});
        if(ice.find(tx)!=ice.end()){
            an += in * ice.at(tx);
          //  cout<<in<<"*"<<ice.at(tx)<<" = "<<an<<endl;
            if(ans.find(tx)!=ans.end()){
                ans[tx]+=in * ice.at(tx);
                mx=max(mx,ans[tx]);
            }else{
                ans[tx]=in * ice.at(tx);
                mx=max(mx,ans[tx]);
            }
            
        }
    }
    
    if(an!=0){
        cout<<"Total ice cream sales: "<<an<<endl<<"Top sales: ";
        for(auto x:ans){
            if(x.second==mx)cout<<x.first<<" ";
        }
    }else{
        cout<<"No ice cream sales";
    }
    // for(auto x:ice){
    //     cout<<x.first<<" "<<x.second<<"\n";
    // }for(auto x:sell){
    //     cout<<x.first<<" "<<x.second<<"\n";
    // }

    return 0;
}

# 0370, 2024-10-15 13:30:42, PPPPPPPPP (100%)

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

int main() {
    int n ; cin >> n ;
    map<string, float> menu ;
    map<string, float> sales ;
    for(int i = 0 ; i < n ; i++) {
        string icecream ; cin >> icecream ;
        float price ;  cin >> price ;
        menu[icecream] = price ;
        sales[icecream] = 0 ;
    }
    cin >> n ;
    float sum = 0, max = 0 ;
    string Top ;
    for(int i = 0 ; i < n ; i++) {
        string order ; cin >> order ;
        int quan ; cin >> quan ;
        auto temp = menu[order] ;
        if(menu.find(order) != menu.end()) {
            sales[order] += quan * temp ;
            sum += quan * temp ;
        }
    }
    for(auto itr : sales) {
        if(itr.second > max) {
            max = itr.second ;
        }
    }
    if(max == 0) {
        cout << "No ice cream sales" ;
        return 0 ;
    }
    cout << "Total ice cream sales: " << sum << endl ;
    cout << "Top sales: " ;
    for(auto itr : sales) {
        if(itr.second == max) {
            cout << itr.first << " " ;
        }
    }
}

# 0371, 2024-10-15 13:44:36, PPPPPPPPP (100%)

#include <iostream>
#include <map>
using namespace std;
int main(){
    int n,m;
    double money=0;
    map<string ,double> mem;
    map<string ,double> mem2;
    map<string ,double> ans;

    cin>>n;
    while(n--){
        string s;
        double num;
        cin>>s>>num;
        mem[s] = num;
    }

    cin>>m;
    while(m--){
        string s;
        double num;
        cin>>s>>num;
        mem2[s] += num;
        
    }

    for(auto i : mem2){
        auto it = mem.find(i.first);
        if(it != mem.end()){
            ans[i.first] = i.second * it->second;
        }
    }

    //   for(auto i : ans){
    //    cout<<i.first<<" "<<i.second<<endl;
    // }

    if(ans.empty()){
        cout<<"No ice cream sales"<<endl;
        return 0;
    }
    double max_value=0;
    for(auto i : ans){
        if(max_value < i.second)
            max_value=i.second;
        money+= i.second;
    }
    cout<<"Total ice cream sales: "<<money<<endl;
    cout<<"Top sales: ";
    for(auto i : ans){
        if(i.second == max_value) cout<<i.first<<' ';
    }
    return 0;
}
/*
5
Magnum 50
Cornetto 25
PaddlePop 15.50
AsianDelight 20
Calippo 15
3
Cookie 20
MamaTomYum 3
MangoSheet 10
*/

# 0372, 2024-10-15 13:31:31, PPPPPPPPP (100%)

#include<iostream>
#include<string>
#include<map>
#include<set>
using namespace std;

int main(){
    int n;
    cin>>n;
    map<string,double> ma,mb;
    for(int i=0;i<n;i++){
        string t;
        double u;
        cin>>t>>u;
        ma[t]=u;
    }
    cin>>n;
    double total=0;
    for(int i=0;i<n;i++){
        string t;
        double u;
        cin>>t>>u;
        if(ma.find(t)!=ma.end()){
            mb[t]+=u*ma[t];
            total+=u*ma[t];
        }
    }
    set<string> top;
    double maxprice=0;
    for(auto it:mb){
        if(it.second>maxprice){
            maxprice=it.second;
            top.clear();
            top.insert(it.first);
        }else if( it.second==maxprice){
            top.insert(it.first);
        }
    }

    if(total==0){
        cout<<"No ice cream sales";
    }else{
        cout<<"Total ice cream sales: "<<total<<'\n';
        cout<<"Top sales: ";
        for(auto it:top){
            cout<<it<<' ';
        }

    }
}

# 0373, 2024-10-15 13:45:46, PPPPPPPPP (100%)

#include <iostream>
#include <map>
#include <algorithm>
using namespace std;

int main(){
    int n,m;
    int i,j,k;
    string str;
    double num;
    map<string,double> sales;
    map<string,double> result;

    cin >> n;
    for(i=0;i<n;i++){
        cin >> str >> num;
        sales[str]=num;
    }

    double sum=0;
    cin >> m;
    for(i=0;i<m;i++){
        cin >> str >> num;
        if(sales.find(str)!=sales.end()){
            sum+=sales[str]*num;
            if(result.find(str)!=result.end()){
                result[str]+=sales[str]*num;
            }
            else{
                result[str]=sales[str]*num;
            }
        }
    }

    double max=0;
    for(auto& it:result){
        if(it.second>max){
            max=it.second;
        }
    }

    if(sum==0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        for(auto& it:result){
            if(it.second==max){
                cout << it.first << " ";
            }
        }
    }
}

# 0374, 2024-10-15 13:30:46, PPPPPPPPP (100%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a;
    float mx=0,sum=0;
    set<string> mxx;
    unordered_map<string ,float>m;
    unordered_map<string ,int>mp;
    for(int i=0;i<a;++i){
        string temp;
        float p;
        cin>>temp>>p;
        m[temp]=p;
    }
    cin>>b;
    for(int i=0;i<b;++i){ string temp;
        int n;
        cin>>temp>>n;
        mp[temp]+=n;
        }
    for(auto i:mp){
        string temp = i.first;
        int n=i.second;
        if(m.find(temp)!=m.end()){
            sum+=m[temp]*n;
            if((m[temp]*n)>mx){
                mx=m[temp]*n;
                mxx.clear();
                mxx.insert(temp);
            }
            else if((m[temp]*n)==mx){
               mxx.insert(temp);
            }
        }

    }
    if(sum==0)cout<<"No ice cream sales";
    else{cout<<"Total ice cream sales: "<<sum<<endl<<"Top sales: ";
        for(auto i:mxx)cout<<i<<" ";
    }
    
}

Max Score = 88


# 0375, 2024-10-15 13:52:03, PPPPPPPPT (88%)

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include <algorithm>

using namespace std;
int main(){
    map <string , double> icePrice;
    map <string , double> iceSales;
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>:: iterator itP = icePrice.begin();
    
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;

    }

    n = 0;
    cin >> n;
    double totalSales = 0;
    for(int i = 0 ; i < n ; i++){
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        //check if ice cream exists
        itP = icePrice.begin();
        while( itP != icePrice.end()){
            if(stemp == itP->first){
                iceSales[stemp] += icePrice[stemp]*itemp;
                totalSales += icePrice[stemp]*itemp;
            }
            itP++;
        }
    }

    double maxSales = 0;
    it = iceSales.begin();
    while(it!=iceSales.end()){
        if( it->second > maxSales){maxSales = it->second;}
        it++;
    }

    it = iceSales.begin();
    vector<string> topSales;
    while(it!=iceSales.end()){
        if( it->second == maxSales){
            topSales.push_back(it->first);
        }
        it++;
    }

    

    if(totalSales == 0){
        cout << "No ice cream sales";
    }else{
        cout<< "Total ice cream sales: " << totalSales << endl;
        sort( topSales.begin() , topSales.end());
        cout << "Top sales: ";
        for(int i = 0 ; i < topSales.size() ; i++){
                if( i!=0 ){ cout << " ";}
                cout << topSales[i];
        }
    }
}
# 0376, 2024-10-15 13:52:35, PPPPPPPPT (88%)

#include<iostream>
#include<map>
#include<string>
#include<vector>
#include <algorithm>

using namespace std;
int main(){
    map <string , double> icePrice;
    map <string , double> iceSales;
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>:: iterator itP = icePrice.begin();
    
    int n;
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;

    }

    n = 0;
    cin >> n;
    double totalSales = 0;
    for(int i = 0 ; i < n ; i++){
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        //check if ice cream exists
        itP = icePrice.begin();
        while( itP != icePrice.end()){
            if(stemp == itP->first){
                iceSales[stemp] += icePrice[stemp]*itemp;
                totalSales += icePrice[stemp]*itemp;
            }
            itP++;
        }
    }

    double maxSales = 0;
    it = iceSales.begin();
    while(it!=iceSales.end()){
        if( it->second > maxSales){maxSales = it->second;}
        it++;
    }

    it = iceSales.begin();
    vector<string> topSales;
    while(it!=iceSales.end()){
        if( it->second == maxSales){
            topSales.push_back(it->first);
        }
        it++;
    }

    

    if(totalSales == 0){
        cout << "No ice cream sales";
    }else{
        cout<< "Total ice cream sales: " << totalSales << endl;
        sort( topSales.begin() , topSales.end());
        cout << "Top sales: ";
        for(int i = 0 ; i < topSales.size() ; i++){
                if( i!=0 ){ cout << " ";}
                cout << topSales[i];
        }
    }
}
# 0377, 2024-10-15 13:54:51, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice;
    map<string, double> iceSales;
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;
    vector<string> topSales;

    int n = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
            }
            itP++;
        }
    }

    if (icePrice.size() != 0)
    {
        
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second == maxSales)
            {
                topSales.push_back(it->first);
            }
            it++;
        }
    }

    if (totalSales == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        sort(topSales.begin(), topSales.end());
        cout << "Top sales: ";
        for (int i = 0; i < topSales.size(); i++)
        {
            if (i != 0)
            {
                cout << " ";
            }
            cout << topSales[i];
        }
    }
}
# 0378, 2024-10-15 13:58:23, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice;
    map<string, double> iceSales;
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;

    int n = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
            }
            itP++;
        }
    }
 
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
    

    if (totalSales == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        while(it != iceSales.end()){

            if( it->second == maxSales){
                cout << it->first << " ";
            }

            it++;
        }
    }
}
# 0379, 2024-10-15 13:59:21, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice = {};
    map<string, double> iceSales = {};
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;

    int n = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
            }
            itP++;
        }
    }
 
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
    

    if (totalSales == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        while(it != iceSales.end()){

            if( it->second == maxSales){
                cout << it->first << " ";
            }

            it++;
        }
    }
}
# 0380, 2024-10-15 14:00:17, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice = {};
    map<string, double> iceSales = {};
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;

    int n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
            }
            itP++;
        }
    }
 
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
    

    if (totalSales == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        while(it != iceSales.end()){

            if( it->second == maxSales){
                cout << it->first << " ";
            }

            it++;
        }
    }
}
# 0381, 2024-10-15 14:01:15, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice = {};
    map<string, double> iceSales = {};
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;

    int n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
                break;
            }else{
                itP++;
            }
        }
    }
 
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
    

    if (totalSales == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        while(it != iceSales.end()){

            if( it->second == maxSales){
                cout << it->first << " ";
            }

            it++;
        }
    }
}
# 0382, 2024-10-15 14:02:51, PPPPPPPPT (88%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    map<string, double> icePrice = {};
    map<string, double> iceSales = {};
    map<string, double>::iterator it = iceSales.begin();
    map<string, double>::iterator itP = icePrice.begin();
    double maxSales = 0;

    int n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        icePrice[stemp] = itemp;
        iceSales[stemp] = 0;
    }

    n = 0;
    cin >> n;
    if( n < 0){ n=0; }
    double totalSales = 0;
    for (int i = 0; i < n; i++)
    {
        string stemp = "";
        double itemp = 0;
        cin >> stemp >> itemp;

        // check if ice cream exists
        itP = icePrice.begin();
        while (itP != icePrice.end())
        {
            if (stemp == itP->first)
            {
                iceSales[stemp] += icePrice[stemp] * itemp;
                totalSales += icePrice[stemp] * itemp;
                break;
            }else{
                itP++;
            }
        }
    }
 
        it = iceSales.begin();
        while (it != iceSales.end())
        {
            if (it->second > maxSales)
            {
                maxSales = it->second;
            }
            it++;
        }

        it = iceSales.begin();
    

    if (totalSales <= 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        while(it != iceSales.end()){

            if( it->second == maxSales){
                cout << it->first << " ";
            }

            it++;
        }
    }
}

# 0383, 2024-10-15 13:41:04, -P------- (11%)

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

int main()
{
    int ice_sale;
    cin >> ice_sale;
    string sale_flavor;
    double sale_price;
    map<string, double> sale;
    set<string> allflavor;
    map<string, double> buy;
    for(int i = 0; i < ice_sale; ++i)
    {
        cin >> sale_flavor;
        cin >> sale_price;
        sale[sale_flavor] = sale_price;
        allflavor.insert(sale_flavor);
    }

    int ice_buy;
    cin >> ice_buy;
    string buy_flavor;
    double amount;
    double sum = 0;
    int max = 0;
    for(int i = 0; i < ice_buy; ++i)
    {
        cin >> buy_flavor;
        cin >> amount;
        //buy[buy_flavor] = amount;
        if(allflavor.find(buy_flavor) != allflavor.end())
        {
            sum = sum + (sale[buy_flavor] * amount);
            buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
            if(max < buy[buy_flavor])
            {
                max =  buy[buy_flavor];
            }
        }
        //buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
    }
    if(sum != 0)
    {
    cout << "Total ice cream sales: " << sum << endl;;
    }
    else
    cout << "No ice cream sales" << endl;
    for(auto a : buy)
    {
        if(a.second == max)
        cout << a.first << endl;
    }
}
# 0384, 2024-10-15 13:42:07, -P------- (11%)

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

int main()
{
    int ice_sale;
    cin >> ice_sale;
    string sale_flavor;
    double sale_price;
    map<string, double> sale;
    set<string> allflavor;
    map<string, double> buy;
    for (int i = 0; i < ice_sale; ++i)
    {
        cin >> sale_flavor;
        cin >> sale_price;
        sale[sale_flavor] = sale_price;
        allflavor.insert(sale_flavor);
    }

    int ice_buy;
    cin >> ice_buy;
    string buy_flavor;
    double amount;
    double sum = 0;
    int max = 0;
    for (int i = 0; i < ice_buy; ++i)
    {
        cin >> buy_flavor;
        cin >> amount;
        // buy[buy_flavor] = amount;
        if (allflavor.find(buy_flavor) != allflavor.end())
        {
            sum = sum + (sale[buy_flavor] * amount);
            buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
            if (max < buy[buy_flavor])
            {
                max = buy[buy_flavor];
            }
        }
        // buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
    }
    if (sum != 0)
    {
        cout << "Total ice cream sales: " << sum << endl;
        for (auto a : buy)
        {
            if (a.second == max)
                cout << a.first << ' ';
        }
    }
    else
        cout << "No ice cream sales" << endl;
}
# 0385, 2024-10-15 13:42:59, -PPP---PP (55%)

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

int main()
{
    int ice_sale;
    cin >> ice_sale;
    string sale_flavor;
    double sale_price;
    map<string, double> sale;
    set<string> allflavor;
    map<string, double> buy;
    for (int i = 0; i < ice_sale; ++i)
    {
        cin >> sale_flavor;
        cin >> sale_price;
        sale[sale_flavor] = sale_price;
        allflavor.insert(sale_flavor);
    }

    int ice_buy;
    cin >> ice_buy;
    string buy_flavor;
    double amount;
    double sum = 0;
    int max = 0;
    for (int i = 0; i < ice_buy; ++i)
    {
        cin >> buy_flavor;
        cin >> amount;
        // buy[buy_flavor] = amount;
        if (allflavor.find(buy_flavor) != allflavor.end())
        {
            sum = sum + (sale[buy_flavor] * amount);
            buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
            if (max < buy[buy_flavor])
            {
                max = buy[buy_flavor];
            }
        }
        // buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
    }
    if (sum != 0)
    {
        cout << "Total ice cream sales: " << sum << endl;
        for (auto a : buy)
        {
            if (a.second == max)
                cout << "Top sales: " << a.first << ' ';
        }
    }
    else
        cout << "No ice cream sales" << endl;
}
# 0386, 2024-10-15 13:44:57, -PPPPPPPP (88%)

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

int main()
{
    int ice_sale;
    cin >> ice_sale;
    string sale_flavor;
    double sale_price;
    map<string, double> sale;
    set<string> allflavor;
    map<string, double> buy;
    for (int i = 0; i < ice_sale; ++i)
    {
        cin >> sale_flavor;
        cin >> sale_price;
        sale[sale_flavor] = sale_price;
        allflavor.insert(sale_flavor);
    }

    int ice_buy;
    cin >> ice_buy;
    string buy_flavor;
    double amount;
    double sum = 0;
    int max = 0;
    for (int i = 0; i < ice_buy; ++i)
    {
        cin >> buy_flavor;
        cin >> amount;
        if (allflavor.find(buy_flavor) != allflavor.end())
        {
            sum = sum + (sale[buy_flavor] * amount);
            buy[buy_flavor] = sale[buy_flavor] * amount + buy[buy_flavor];
            if (max < buy[buy_flavor])
            {
                max = buy[buy_flavor];
            }
        }
    }
    if (sum != 0)
    {
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: " ;
        for (auto a : buy)
        {
            if (a.second == max)
                cout << a.first << ' ';
        }
    }
    else
        cout << "No ice cream sales" << endl;
}

# 0387, 2024-10-15 13:48:26, -PPPPPPPP (88%)

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main(){
    
    map<string, vector<double>> data;
    vector<string> names;

    int num;
    cin >> num;

    string name;
    double price;
    for(int i = 0; i < num; i++){
        cin >> name >> price;
        data[name].push_back(price); 
        names.push_back(name);
        data[name].push_back(0);
    }

    cin >> num;

    set<string> sales_order;
    int max = 0;
    double amount, total = 0;
    for(int i = 0; i < num; i++){
        cin >> name >> amount;
        if(find(names.begin(), names.end(), name) != names.end()){
            total += amount*data[name][0];
            data[name][1] += amount*data[name][0];
            if(data[name][1] > max){
                max = data[name][1];
            }            
        }
    }
    
    for(auto it : data){
        if(it.second[1] == max){
            sales_order.insert(it.first);
        }
    }

    if(total == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto s : sales_order){
            cout << s << " ";
        }
    }
        
}
# 0388, 2024-10-15 13:50:37, -PPPPPPPP (88%)

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <sstream>
#include <vector>

using namespace std;

int main(){
    
    map<string, vector<double>> data;
    vector<string> names;

    int num;
    cin >> num;

    string name;
    double price;
    for(int i = 0; i < num; i++){
        cin >> name >> price;
        data[name].push_back(price); 
        names.push_back(name);
        data[name].push_back(0);
    }

    cin >> num;
    cin.ignore();

    set<string> sales_order;
    string line;
    int max = 0;
    double amount, total = 0;
    for(int i = 0; i < num; i++){
        getline(cin, line);
        istringstream iss(line);
        iss >> name;
        iss >> amount;
        if(find(names.begin(), names.end(), name) != names.end()){
            total += amount*data[name][0];
            data[name][1] += amount*data[name][0];
            if(data[name][1] > max){
                max = data[name][1];
            }            
        }
    }
    
    for(auto it : data){
        if(it.second[1] == max){
            sales_order.insert(it.first);
        }
    }

    if(total == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto s : sales_order){
            cout << s << " ";
        }
    }
        
}
# 0389, 2024-10-15 13:51:16, -PPPPPPPP (88%)

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <sstream>
#include <vector>

using namespace std;

int main(){
    
    map<string, vector<double>> data;
    vector<string> names;

    int num;
    cin >> num;

    string name;
    double price;
    for(int i = 0; i < num; i++){
        cin >> name >> price;
        data[name].push_back(price); 
        names.push_back(name);
        data[name].push_back(0);
    }

    cin >> num;
    cin.ignore();

    set<string> sales_order;
    string line;
    int max = 0;
    double amount, total = 0;
    for(int i = 0; i < num; i++){
        getline(cin, line);
        istringstream iss(line);
        iss >> name;
        iss >> amount;
        if(find(names.begin(), names.end(), name) != names.end()){
            total += amount*data[name][0];
            data[name][1] += amount*data[name][0];
            if(data[name][1] > max){
                max = data[name][1];
            }            
        }
    }
    
    for(auto it : data){
        if(it.second[1] == max){
            sales_order.insert(it.first);
        }
    }

    if(total == 0){
        cout << "No ice cream sales";
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto s : sales_order){
            cout << s << " ";
        }
    }
        
}

# 0390, 2024-10-15 13:33:03, --PPPPPPP (77%)

#include <iostream>
#include <map>

using namespace std;

int main() {
    int amount1,amount2;
    cin >> amount1;
    string name;
    float price;

    map<string,float> ic;
    map<string,float> ic2;
    map<string,float> ic3;

    for (int i = 0; i < amount1; i++) {
        cin >> name >> price;

        ic[name] = price;
        ic2[name] = 0;
        ic3[name] = 0;
    }

    cin >> amount2;

    for (int i = 0; i < amount2; i++) {
        cin >> name >> price;

        auto it = ic.find(name);

        if (it != ic.end()) {
            ic2[name] = ic2.at(name) + price;
        }

    }

    for(auto itr = ic2.begin(); itr != ic2.end(); itr++) {
        ic3[itr->first] = ic.at(itr->first) * ic2.at(itr->first);
    }

    float sum = 0;
    int most = 0;

    for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
        sum += itr->second;

        if (itr->second > most) {
            most = itr->second;
        }
    }

    cout << "Total ice cream sales: " << sum << endl;

    cout << "Top sales: ";

    for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
        if (itr->second == most) {
            cout << itr->first << " ";
        }

    }
    cout << endl;

}
# 0391, 2024-10-15 13:34:01, -PPPPPPPP (88%)

#include <iostream>
#include <map>

using namespace std;

int main() {
    int amount1,amount2;
    cin >> amount1;
    string name;
    float price;

    map<string,float> ic;
    map<string,float> ic2;
    map<string,float> ic3;

    for (int i = 0; i < amount1; i++) {
        cin >> name >> price;

        ic[name] = price;
        ic2[name] = 0;
        ic3[name] = 0;
    }

    cin >> amount2;

    for (int i = 0; i < amount2; i++) {
        cin >> name >> price;

        auto it = ic.find(name);

        if (it != ic.end()) {
            ic2[name] = ic2.at(name) + price;
        }

    }

    for(auto itr = ic2.begin(); itr != ic2.end(); itr++) {
        ic3[itr->first] = ic.at(itr->first) * ic2.at(itr->first);
    }

    float sum = 0;
    int most = 0;

    for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
        sum += itr->second;

        if (itr->second > most) {
            most = itr->second;
        }
    }

    if (sum == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        
        cout << "Top sales: ";

        for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
            if (itr->second == most) {
                cout << itr->first << " ";
            }

        }
        cout << endl;
    }
    

    

}
# 0392, 2024-10-15 13:39:04, -PPPPPPPP (88%)

#include <iostream>
#include <map>

using namespace std;

int main() {
    int amount1,amount2;
    cin >> amount1;
    string name;
    float price;

    map<string,float> ic;
    map<string,float> ic2;
    map<string,float> ic3;

    for (int i = 0; i < amount1; i++) {
        cin >> name >> price;

        ic[name] = price;
        ic2[name] = 0;
        ic3[name] = 0;
    }

    cin >> amount2;

    for (int i = 0; i < amount2; i++) {
        cin >> name >> price;

        auto it = ic.find(name);

        if (it != ic.end()) {
            ic2[name] = ic2.at(name) + price;
        }

    }

    for(auto itr = ic2.begin(); itr != ic2.end(); itr++) {
        ic3[itr->first] = ic.at(itr->first) * ic2.at(itr->first);
    }

    float sum = 0;
    int most = 0;

    for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
        sum += itr->second;

        if (itr->second > most) {
            most = itr->second;
        }
    }

    if (sum == 0) {
        cout << "No ice cream sales" << endl;
    }
    else {
        cout << "Total ice cream sales: " << sum << endl;
        
        cout << "Top sales: ";

        for (auto itr = ic3.begin(); itr != ic3.end(); itr++) {
            if (itr->second == most) {
                cout << itr->first << " ";
            }

        }
        cout << endl;
    }
    

    

}

# 0393, 2024-10-15 13:59:11, Compilation error (0%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string a;
    int t1,t2,b;
    map<string,double> m1,m2;
    cin>>t1;
    while(t1--){
        cin>>a>>b;
        m1[a]=b;
    }
    cin>>t2;
    while(t2--){
        cin>>a>>b;
        m2[a]+=b;
    }
    set<pair<double,string>> s;
    double sum=0,xam=0;
    for(auto i : m2){
        m2[i.first] = m1[i.first]*m2[i.first];
        xam = max(xam,m2[i.first]);
        sum += m2[i.first];
        s.insert(make_pair(m2[i.first],i.first));
    }
    for(auto i:s){
        if(sum=0)
    }
}
# 0394, 2024-10-15 14:02:19, -PPPPPPPP (88%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    string a;
    int t1,t2,b;
    map<string,double> m1,m2;
    cin>>t1;
    while(t1--){
        cin>>a>>b;
        m1[a]=b;
    }
    cin>>t2;
    while(t2--){
        cin>>a>>b;
        m2[a]+=b;
    }
    set<pair<double,string>> s;
    double sum=0,xam=0;
    for(auto i : m2){
        m2[i.first] = m1[i.first]*m2[i.first];
        xam = max(xam,m2[i.first]);
        sum += m2[i.first];
        s.insert(make_pair(m2[i.first],i.first));
    }
    if(sum==0){
            cout<<"No ice cream sales"<<endl;
            return 0;
        }
    cout<<"Total ice cream sales: "<<sum<<endl;
    cout<<"Top sales: ";
    for(auto i:s){
        if(i.first==xam){
            cout<<i.second<<' ';
        }
    }
}

# 0395, 2024-10-15 13:50:20, PPPPPPPPT (88%)

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x, y;
    cin >> x;

    map<string, float> m;
    vector<pair<string, float>> v;

    while(x--)
    {
        string a;
        float b;

        cin >> a >> b;
        
        m[a] = b;
    }
    cin >> y;
    while (y--)
    {
        string a;
        float b;

        cin >> a >> b;

        v.push_back(make_pair(a, b));
    }

    float sum = 0;

    map<string, float> anw;

    float Max = 0;

    for(auto e : m)
    {
        float d = 0;
        for(auto r : v)
        {
            if(e.first == r.first)
            {
                d += e.second * r.second;
                sum += e.second * r.second;
                //cout << e.first << " " << r.first << " " << sum << endl;
            }
        }
        //cout << d << " " << e.first<< endl;
        Max = max(d, Max);
        anw[e.first] = d;
    }

    if(sum == 0)
    {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    cout << "Total ice cream sales: " << sum << endl;
    cout << "Top sales: ";

    //auto itr = anw.end();
    //auto &j = *(--itr);

    //cout << j.first << endl;

    for(auto t = anw.begin(); t != anw.end(); t++)
    {
        auto &k = *t;

        if(k.second != Max)
        {
            //cout << k.second << " " << j.first << endl;
            continue;
        }
        cout << k.first << " ";
    }
    
    return 0;
}
# 0396, 2024-10-15 13:50:42, PPPPPPPPT (88%)

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int x, y;
    cin >> x;

    map<string, float> m;
    vector<pair<string, float>> v;

    while(x--)
    {
        string a;
        float b;

        cin >> a >> b;
        
        m[a] = b;
    }
    cin >> y;
    while (y--)
    {
        string a;
        float b;

        cin >> a >> b;

        v.push_back(make_pair(a, b));
    }

    float sum = 0;

    map<string, float> anw;

    float Max = 0;

    for(auto e : m)
    {
        float d = 0;
        for(auto r : v)
        {
            if(e.first == r.first)
            {
                d += e.second * r.second;
                sum += e.second * r.second;
                //cout << e.first << " " << r.first << " " << sum << endl;
            }
        }
        //cout << d << " " << e.first<< endl;
        Max = max(d, Max);
        anw[e.first] = d;
    }

    if(sum == 0)
    {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    cout << "Total ice cream sales: " << sum << endl;
    cout << "Top sales: ";

    //auto itr = anw.end();
    //auto &j = *(--itr);

    //cout << j.first << endl;

    for(auto t = anw.begin(); t != anw.end(); t++)
    {
        auto &k = *t;

        if(k.second != Max)
        {
            //cout << k.second << " " << j.first << endl;
            continue;
        }
        cout << k.first << " ";
    }
    
    return 0;
}

# 0397, 2024-10-15 13:48:47, -PPPPPPPP (88%)

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    vector<string> item;
    vector<double> pricee;
    vector<string> item1;
    vector<double> pricee1;
    int m_total = 0 ;
    int m;
    int x;
    string k;
    double price;
    cin >> x;
    while(x>0){
        cin >> k;
        item.push_back(k);
        cin >> price;
        pricee.push_back(price);
        x--;
    }
    int y;
    cin >> y;
    while(y>0){
        cin >> k;
        cin >> m;
        item1.push_back(k);
        pricee1.push_back(m);
        y--;
        }
        int count = 0;
        for(int i = 0 ; i<item.size();i++){
            for(int j=0;j<item1.size();j++){
                if(item1[j] == item[i] ){
                    m_total += pricee1[j];
                    count++;
                }
            }
        pricee[i] *= m_total;
        m_total = 0;
        }
        // for(int i = 0 ; i< item.size();i++){
        //     cout << item[i] <<" "<<pricee[i] << endl;
        // }
        double total = 0;
        for(int i = 0 ;i<pricee.size();i++){
            total += pricee[i];
        }
        vector<string> item2;
        //sort(pricee.begin(),pricee.end());
        int max = pricee[0];
        for(int i=0 ; i<pricee.size();i++){
            if(pricee[i] > max ){
                max = pricee[i];
            }
        }
        for(int i=0 ; i<pricee.size();i++){
            if(pricee[i] == max ){
                item2.push_back(item[i]);
            }
        }
        sort(item2.begin(),item2.end());
        if(count == 0){
            cout << "No ice cream sales";
        }
        else{
            cout << "Total ice cream sales: " << total <<endl;
            cout << "Top sales: ";
            for(int i=0;i<item2.size();i++){
                cout << item2[i] <<" ";
            }
        }
    }

Max Score = 77


# 0398, 2024-10-15 13:58:38, --PPP---P (44%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ic;
    multiset<pair<double,string>> dupe,temp,ans;
    int n,m;
    cin >> n;
    string s;
    double mx = 0,c,sum = 0;
    while(n--){
        cin >> s >> c;
        ic[s] = c;
    }
    cin >> m;
    while(m--){
        cin >> s >> n;
        if(ic.find(s) != ic.end()){
            sum += n*ic[s];
            dupe.insert(make_pair(n*ic[s]*-1,s));
        }
    }
    temp = dupe;
    for(auto x:temp){
        if(dupe.count(x)>1){
        dupe.erase(x);
        }
        else ans.insert(make_pair(x.first*temp.count(x),x.second));
        mx = max(abs(x.first*temp.count(x)),mx);
    }
    if(sum){
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto x:ans)if(abs(x.first) == mx)cout << x.second << ' ';
    }
    //for(auto x:ans)cout << abs(x.first) << ' ' << x.second << endl;
    
}
# 0399, 2024-10-15 13:59:11, -PPPP---P (55%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ic;
    multiset<pair<double,string>> dupe,temp,ans;
    int n,m;
    cin >> n;
    string s;
    double mx = 0,c,sum = 0;
    while(n--){
        cin >> s >> c;
        ic[s] = c;
    }
    cin >> m;
    while(m--){
        cin >> s >> n;
        if(ic.find(s) != ic.end()){
            sum += n*ic[s];
            dupe.insert(make_pair(n*ic[s]*-1,s));
        }
    }
    temp = dupe;
    for(auto x:temp){
        if(dupe.count(x)>1){
        dupe.erase(x);
        }
        else ans.insert(make_pair(x.first*temp.count(x),x.second));
        mx = max(abs(x.first*temp.count(x)),mx);
    }
    if(sum){
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto x:ans)if(abs(x.first) == mx)cout << x.second << ' ';
    }
    else cout << "No ice cream sales";
    //for(auto x:ans)cout << abs(x.first) << ' ' << x.second << endl;
    
}
# 0400, 2024-10-15 14:00:39, -PPPPPP-P (77%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ic;
    multiset<pair<double,string>> dupe,temp;
    set<pair<double,string>> ans;
    int n,m;
    cin >> n;
    string s;
    double mx = 0,c,sum = 0;
    while(n--){
        cin >> s >> c;
        ic[s] = c;
    }
    cin >> m;
    while(m--){
        cin >> s >> n;
        if(ic.find(s) != ic.end()){
            sum += n*ic[s];
            dupe.insert(make_pair(n*ic[s]*-1,s));
        }
    }
    temp = dupe;
    for(auto x:temp){
        ans.insert(make_pair(x.first*temp.count(x),x.second));
        mx = max(abs(x.first*temp.count(x)),mx);
    }
    if(sum){
        cout << "Total ice cream sales: " << sum << endl << "Top sales: ";
        for(auto x:ans)if(abs(x.first) == mx)cout << x.second << ' ';
    }
    else cout << "No ice cream sales";
    //for(auto x:ans)cout << abs(x.first) << ' ' << x.second << endl;
    
}

# 0401, 2024-10-15 13:58:00, P-PPPPPP- (77%)

#include <bits/stdc++.h>
using namespace std;
main(){
    map<string,double> a,b;
    double tts=0,p;
    string c;
    int n,m;
    cin >> n;
    map<string,double>::iterator it,t;
    vector<double> mx;
    for(int i=0;i<n;i++){
        cin >> c >> p;
        a.insert(pair<string,double>(c,p));
    }
    cin >> m;
    for(int i=0;i<m;i++){
        cin >> c >> p;
        it = b.find(c);
        if(it!=b.end()) b.find(c)->second+=p;
        else b.insert(pair<string,double>(c,p));
    }
    for(it=b.begin();it!=b.end();it++){
        tts+=a.find(it->first)->second*it->second;
        a.find(it->first)->second*=it->second;
        mx.push_back(a.find(it->first)->second);        
    }
    sort(mx.begin(),mx.end(),greater());
    if(tts==0) cout << "No ice cream sales";
    else {
        cout << "Total ice cream sales: " << tts << "\n" << "Top sales: ";
        for(it = a.begin();it!=a.end();it++){
            if(it->second==mx[0]){
                cout << it->first << ' ';
            }
        }
    }
}

Max Score = 66


# 0402, 2024-10-15 13:35:06, -PPPP--PP (66%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice;
    map<string,double> sale;
    set<string> result;
    double max=0;
    int n;cin>>n;
    double sum=0;
    string s_tmp;
    double n_tmp;
    for(int i=0;i<n;i++){
        cin>>s_tmp>>n_tmp;
        ice[s_tmp]=n_tmp;
    }
    int m;cin>>m;
    for(int i=0;i<m;i++){
        cin>>s_tmp>>n_tmp;
        if(ice.find(s_tmp)!=ice.end()){
            sum+=ice[s_tmp]*n_tmp;
            if(sale.find(s_tmp)!=ice.end()){
                sale[s_tmp]+=ice[s_tmp]*n_tmp;
            }
            else{
                sale[s_tmp]=ice[s_tmp]*n_tmp;
            }
            if(ice[s_tmp]*n_tmp==max){
                result.insert(s_tmp);
            }
            else if(ice[s_tmp]*n_tmp>max){
                max=ice[s_tmp]*n_tmp;
                result.clear();
                result.insert(s_tmp);
            }
        }
    }
    for(auto item : sale){
        if(sale[item.first]==max){
            result.insert(item.first);
        }
    }
    if(result.empty()){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales:";
        for(auto item : result){
            cout<<" "<<item;
        }
    }

}
# 0403, 2024-10-15 13:36:56, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice;
    map<string,double> sale;
    set<string> result;
    double max=0;
    int n;cin>>n;
    double sum=0;
    string s_tmp;
    double n_tmp;
    for(int i=0;i<n;i++){
        cin>>s_tmp>>n_tmp;
        ice[s_tmp]=n_tmp;
    }
    int m;cin>>m;
    for(int i=0;i<m;i++){
        cin>>s_tmp>>n_tmp;
        if(ice.find(s_tmp)!=ice.end()){
            sum+=ice[s_tmp]*n_tmp;
            if(sale.find(s_tmp)!=ice.end()){
                sale[s_tmp]+=ice[s_tmp]*n_tmp;
            }
            else{
                sale[s_tmp]=ice[s_tmp]*n_tmp;
            }
            if(ice[s_tmp]*n_tmp>max){
                max=ice[s_tmp]*n_tmp;
            }
        }
    }
    for(auto item : sale){
        if(sale[item.first]==max){
            result.insert(item.first);
        }
    }
    if(result.empty()){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales:";
        for(auto item : result){
            cout<<" "<<item;
        }
    }

}
# 0404, 2024-10-15 13:37:51, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice;
    map<string,double> sale;
    set<string> result;
    double max=0;
    int n;cin>>n;
    double sum=0;
    string s_tmp;
    double n_tmp;
    for(int i=0;i<n;i++){
        cin>>s_tmp>>n_tmp;
        ice[s_tmp]=n_tmp;
    }
    int m;cin>>m;
    for(int i=0;i<m;i++){
        cin>>s_tmp>>n_tmp;
        if(ice.find(s_tmp)!=ice.end()){
            sum+=ice[s_tmp]*n_tmp;
            if(sale.find(s_tmp)!=ice.end()){
                sale[s_tmp]+=ice[s_tmp]*n_tmp;
            }
            else{
                sale[s_tmp]=ice[s_tmp]*n_tmp;
            }
            if(ice[s_tmp]*n_tmp>max){
                max=ice[s_tmp]*n_tmp;
            }
        }
    }
    for(auto item : sale){
        if(sale[item.first]==max){
            result.insert(item.first);
        }
    }
    if(result.empty()){
        cout<<"No ice cream sales";
    }
    else{
        cout<<fixed<<setprecision(0);
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales:";
        for(auto item : result){
            cout<<" "<<item;
        }
    }

}
# 0405, 2024-10-15 13:54:10, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice;
    map<string,double> sale;
    set<string> result;
    double max=0;
    int n;cin>>n;
    double sum=0;
    string s_tmp;
    double n_tmp;
    for(int i=0;i<n;i++){
        cin>>s_tmp>>n_tmp;
        ice[s_tmp]=n_tmp;
    }
    int m;cin>>m;
    for(int i=0;i<m;i++){
        cin>>s_tmp>>n_tmp;
        if(ice.find(s_tmp)!=ice.end()){
            sum+=ice[s_tmp]*n_tmp;
            if(sale.find(s_tmp)!=ice.end()){
                sale[s_tmp]+=ice[s_tmp]*n_tmp;
            }
            else{
                sale[s_tmp]=ice[s_tmp]*n_tmp;
            }
            if(ice[s_tmp]*n_tmp>max){
                max=ice[s_tmp]*n_tmp;
            }
        }
    }
    for(auto item : sale){
        if(sale[item.first]==max){
            result.insert(item.first);
        }
    }
    if(result.empty()){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales:";
        for(auto item : sale){
            if(sale[item.first]==max)
            cout<<" "<<item.first;
        }
    }

}
# 0406, 2024-10-15 13:58:03, -PPPP---P (55%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    map<string,double> ice;
    map<string,double> sale;
    set<string> result;
    double max=0;
    int n;cin>>n;
    double sum=0;
    string s_tmp;
    double n_tmp;
    for(int i=0;i<n;i++){
        cin>>s_tmp>>n_tmp;
        ice[s_tmp]=n_tmp;
    }
    int m;cin>>m;
    for(int i=0;i<m;i++){
        cin>>s_tmp>>n_tmp;
        if(ice.find(s_tmp)!=ice.end()){
            sum+=ice[s_tmp]*n_tmp;
            if(sale.find(s_tmp)!=ice.end()){
                sale[s_tmp]+=ice[s_tmp]*n_tmp;
            }
            else{
                sale[s_tmp]=ice[s_tmp]*n_tmp;
            }
            if(ice[s_tmp]*n_tmp>max){
                max=ice[s_tmp]*n_tmp;
            }
        }
    }
    for(auto item : sale){
        if(sale[item.first]==max){
            result.insert(item.first);
        }
    }
    if(result.empty()){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales:";
        for(auto item : sale){
            if(sale[item.first]==max)
            cout<<" "<<item.first;
        }
    }

}

# 0407, 2024-10-15 13:52:46, -xPPP--PP (55%)

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

int main(){
    int N ;
    cin>>N ;
    map<string,double> icream_map ;
    string name ; 
    double price ;
    for(int i = 0 ; i<N ; i++){
        cin>>name>>price ;
        icream_map[name] = price ;
    }

    double sum = 0 ;
    int M ;
    cin>>M ;
    vector<pair<int,string>> icream_cansell ;
    for(int i = 0 ; i<M ; i++){
        string name_input ; 
        int amount ;
        cin>>name_input>>amount ;
        if(icream_map.find(name_input) != icream_map.end()){
            sum += icream_map[name_input]*amount ;
            //first time
            if(find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) == icream_cansell.end()){
                icream_cansell.push_back(make_pair(amount,name_input)) ;
            }
            else{
                int pos = find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) - icream_cansell.begin() ;
                icream_cansell[pos].first += amount ;
            }
        }
    }
    sort(icream_cansell.begin(),icream_cansell.end()) ;

    vector<pair<double,string>> icream_list_sell ;
    for(auto e : icream_cansell){
        int total_price = e.first*icream_map[e.second] ;
        icream_list_sell.push_back(make_pair(total_price,e.second)) ;
    }
    sort(icream_list_sell.begin(),icream_list_sell.end()) ;

    int max_price = icream_list_sell[icream_list_sell.size()-1].first ;

    if(sum == 0){
        cout<<"No ice cream sales"<<endl ;
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl ;
        cout<<"Top sales: " ;
        for(auto e : icream_list_sell){
            if(e.first == max_price){
                cout<<e.second<<" " ;
            }
            
        }
    }
}
# 0408, 2024-10-15 13:55:44, -PPPP--PP (66%)

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

int main(){
    int N ;
    cin>>N ;
    map<string,double> icream_map ;
    string name ; 
    double price ;
    for(int i = 0 ; i<N ; i++){
        cin>>name>>price ;
        icream_map[name] = price ;
    }

    double sum = 0 ;
    int M ;
    cin>>M ;
    vector<pair<int,string>> icream_cansell ;
    for(int i = 0 ; i<M ; i++){
        string name_input ; 
        int amount ;
        cin>>name_input>>amount ;
        if(icream_map.find(name_input) != icream_map.end()){
            sum += icream_map[name_input]*amount ;
            //first time
            if(find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) == icream_cansell.end()){
                icream_cansell.push_back(make_pair(amount,name_input)) ;
            }
            else{
                int pos = find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) - icream_cansell.begin() ;
                icream_cansell[pos].first += amount ;
            }
        }
    }
    if(icream_cansell.size() == 0){
        cout<<"No ice cream sales" ;
        return 0 ;
    }
    sort(icream_cansell.begin(),icream_cansell.end()) ;

    vector<pair<double,string>> icream_list_sell ;
    for(auto e : icream_cansell){
        int total_price = e.first*icream_map[e.second] ;
        icream_list_sell.push_back(make_pair(total_price,e.second)) ;
    }
    sort(icream_list_sell.begin(),icream_list_sell.end()) ;

    int max_price = icream_list_sell[icream_list_sell.size()-1].first ;

    
    cout<<"Total ice cream sales: "<<sum<<endl ;
    cout<<"Top sales: " ;
    for(auto e : icream_list_sell){
        if(e.first == max_price){
            cout<<e.second<<" " ;
        }
        
    }
}
# 0409, 2024-10-15 13:59:11, -PPPP--PP (66%)

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

int main(){
    int N ;
    cin>>N ;
    map<string,double> icream_map ;
    string name ; 
    double price ;
    for(int i = 0 ; i<N ; i++){
        cin>>name>>price ;
        icream_map[name] = price ;
    }

    double sum = 0 ;
    int M ;
    cin>>M ;
    vector<pair<int,string>> icream_cansell ;
    for(int i = 0 ; i<M ; i++){
        string name_input ; 
        int amount ;
        cin>>name_input>>amount ;
        if(icream_map.find(name_input) != icream_map.end()){
            sum += icream_map[name_input]*amount ;
            //first time
            if(find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) == icream_cansell.end()){
                icream_cansell.push_back(make_pair(amount,name_input)) ;
            }
            else{
                int pos = find(icream_cansell.begin(),icream_cansell.end(),make_pair(amount,name_input)) - icream_cansell.begin() ;
                icream_cansell[pos].first += amount ;
            }
        }
    }
    if(icream_cansell.size() == 0){
        cout<<"No ice cream sales" ;
        return 0 ;
    }
    sort(icream_cansell.begin(),icream_cansell.end()) ;

    vector<pair<double,string>> icream_list_sell ;
    for(auto e : icream_cansell){
        int total_price = e.first*icream_map[e.second] ;
        icream_list_sell.push_back(make_pair(total_price,e.second)) ;
    }
    sort(icream_list_sell.begin(),icream_list_sell.end()) ;

    int max_price = icream_list_sell[icream_list_sell.size()-1].first ;

    
    cout<<"Total ice cream sales: "<<sum<<endl ;
    cout<<"Top sales: " ;
    for(auto e : icream_list_sell){
        if(e.first == max_price){
            cout<<e.second<<" " ;
        }
    }
}

# 0410, 2024-10-15 13:33:52, PP---PPPT (55%)

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

int main(){
    vector<pair<string,double>> vp1,vp2;
    int n,m;
    string s;
    double d,total=0,max=-1e9;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s>>d;
        vp1.push_back(make_pair(s,d));
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>s>>d;
        vp2.push_back(make_pair(s,d));
    }
    double price[m];
    // for(auto i:vp1) cout<<i.first<<" "<<i.second<<endl;
    // cout<<endl<<"---";
    // for(auto i:vp2) cout<<i.first<<" "<<i.second<<endl;
    sort(vp2.begin(),vp2.end());
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            //cout<<vp2[i].first<<" "<<vp1[j].first<<endl;
            if(vp2[i].first==vp1[j].first){
                total+=vp2[i].second*vp1[j].second;
                //cout<<total<<endl;
                price[i]+=vp2[i].second*vp1[j].second;
            }
        }
    }
    for(int i=0;i<m;i++){
        for(int j=i+1;j<m;j++){
            if(vp2[i].first==vp2[j].first){
                price[i]+=price[j];
                price[j]=0;
                if(price[i]>=max) max=price[i];
            }
        }
    }
    if(total==0) cout<<"No ice cream sales";
    else {
        cout<<"Total ice cream sales:  "<<total<<endl<<"Top sales: ";
        for(int i=0;i<m;i++){
            if(price[i]==max) cout<<vp2[i].first<<" ";
            //cout<<vp2[i].first<<" "<<vp2[i].second<<" "<<price[i]<<endl;
        }
    }
    return 0;
}
# 0411, 2024-10-15 13:39:26, PPPP-PP-T (66%)

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

int main(){
    vector<pair<string,double>> vp1,vp2;
    int n,m;
    string s;
    double d,total=0,max=-1e9;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s>>d;
        vp1.push_back(make_pair(s,d));
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>s>>d;
        vp2.push_back(make_pair(s,d));
    }
    double price[m];
    // for(auto i:vp1) cout<<i.first<<" "<<i.second<<endl;
    // cout<<endl<<"---";
    // for(auto i:vp2) cout<<i.first<<" "<<i.second<<endl;
    sort(vp2.begin(),vp2.end());
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            //cout<<vp2[i].first<<" "<<vp1[j].first<<endl;
            if(vp2[i].first==vp1[j].first){
                total+=vp2[i].second*vp1[j].second;
                //cout<<total<<endl;
                price[i]+=vp2[i].second*vp1[j].second;
            }
        }
    }
    for(int i=0;i<m;i++){
        for(int j=i+1;j<m;j++){
            if(vp2[i].first==vp2[j].first){
                price[i]+=price[j];
                price[j]=0;
            }
        }
    }
    for(int i=0;i<m;i++){
        if(price[i]>=max) max=price[i];
    }
    if(total==0) cout<<"No ice cream sales";
    else {
        cout<<"Total ice cream sales:  "<<total<<endl<<"Top sales: ";
        for(int i=0;i<m;i++){
            if(price[i]==max) cout<<vp2[i].first<<" ";
            //cout<<vp2[i].first<<" "<<vp2[i].second<<" "<<price[i]<<endl;
        }
    }
    //cout<<max;
    return 0;
}

Max Score = 55


# 0412, 2024-10-15 13:10:59, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    while(n--) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    while(m--) {
        string good;
        int time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell;
            sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0413, 2024-10-15 13:14:56, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        int time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell;
            sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0414, 2024-10-15 13:17:56, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        int time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell;
            sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0415, 2024-10-15 13:22:50, -P------- (11%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell;
            sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales:" << total << endl;
        cout << "Top sales:";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0416, 2024-10-15 13:23:11, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell;
            sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0417, 2024-10-15 13:31:05, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0418, 2024-10-15 13:46:37, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0419, 2024-10-15 13:46:55, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++) {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price; 
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string,double> sales;
    for (int i = 0; i < m; i++) {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end()) {
            double sell = time*list[good];
            total += sell;
            if (sell > salesmax) {
                salesmax = sell;
            }
            if (sales.find(good) == sales.end()) {
                sales[good] = sell;
            } else {
                sales[good] += sell;
            }
        }
    }
    if (sales.size() == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales) {
            if (e.second == salesmax) {
                cout << e.first << " ";
            }
        }
    }
}
# 0420, 2024-10-15 13:54:55, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++)
    {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price;
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string, double> sales;
    for (int i = 0; i < m; i++)
    {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end())
        {
            double sell = time * list[good];
            total += sell;
            if (sell > salesmax)
            {
                salesmax = sell;
            }

            sales[good] += sell;
        }
    }
    if (sales.size() == 0)
    {
        cout << "No ice cream sales" << endl;
    }
    else
    {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales)
        {
            if (e.second == salesmax)
            {
                cout << e.first << " ";
            }
        }
    }
}
# 0421, 2024-10-15 13:55:03, -PPPP---P (55%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++)
    {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price;
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string, double> sales;
    for (int i = 0; i < m; i++)
    {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end())
        {
            double sell = time * list[good];
            total += sell;
            if (sell > salesmax)
            {
                salesmax = sell;
            }
            sales[good] += sell;
        }
    }
    if (sales.size() == 0)
    {
        cout << "No ice cream sales" << endl;
    }
    else
    {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales)
        {
            if (e.second == salesmax)
            {
                cout << e.first << " ";
            }
        }
    }
}
# 0422, 2024-10-15 13:57:47, Compilation error (0%)

#include <iostream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    map<string, double> list;
    for (int i = 0; i < n; i++)
    {
        string good;
        double price;
        cin >> good >> price;
        list[good] = price;
    }
    int m;
    cin >> m;
    double total = 0;
    double salesmax = 0;
    map<string, double> sales;
    for (int i = 0; i < m; i++)
    {
        string good;
        double time;
        cin >> good >> time;
        if (list.find(good) != list.end())
        {
            double sell = time * list[good];
            total += sell;
            if (sell > salesmax)
            {
                salesmax = sell;
            }
            sales[good] += sell;
        }
    }
    sort(sales.begin(),sales.end());
    if (sales.size() == 0)
    {
        cout << "No ice cream sales" << endl;
    }
    else
    {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto e : sales)
        {
            if (e.second == salesmax)
            {
                cout << e.first << " ";
            }
        }
    }
}

# 0423, 2024-10-15 13:37:34, PP------- (22%)

#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<tuple<string, double, double>> ice;

    for (int i = 0; i < n; ++i) {
        string name;
        double price;
        cin >> name >> price;
        ice.push_back(make_tuple(name, price, 0.0));
    }

    int m;
    cin >> m;
    map<string, int> salesData;

    for (int i = 0; i < m; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        salesData[name] += quantity;
    }

    double totalSales = 0.0;

    for (const auto& entry : salesData) {
        string flavor = entry.first;
        int quantity = entry.second;

        for (int j = 0; j < ice.size(); ++j) {
            if (get<0>(ice[j]) == flavor) {
                double sales = quantity * get<1>(ice[j]);
                get<2>(ice[j]) += sales;
                totalSales += sales;
                break;
            }
        }
    }

    if (totalSales == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << fixed << setprecision(1);
        cout << "Total ice cream sales: " << totalSales << endl;

        double maxSales = 0.0;
        for (const auto& entry : ice) {
            maxSales = max(maxSales, get<2>(entry));
        }

        vector<string> topFlavors;
        for (const auto& entry : ice) {
            if (get<2>(entry) == maxSales) {
                topFlavors.push_back(get<0>(entry));
            }
        }

        sort(topFlavors.begin(), topFlavors.end());

        cout << "Top sales: ";
        for (size_t i = 0; i < topFlavors.size(); ++i) {
            cout << topFlavors[i];
            if (i < topFlavors.size() - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}
# 0424, 2024-10-15 13:42:35, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

int main() {
    int N, M;
    string name;
    double price;
    int quantity;
    map<string, double> prices;
    map<string, double> sales;

    // Read ice cream prices
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
    }

    // Read sales data
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> quantity;
        if (prices.find(name) != prices.end()) {
            sales[name] += prices[name] * quantity;
        }
    }

    // Check if there were any ice cream sales
    if (sales.empty()) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    // Calculate total sales and find the highest sales
    double total_sales = 0.0;
    double max_sales = 0.0;
    for (const auto& item : sales) {
        total_sales += item.second;
        max_sales = max(max_sales, item.second);
    }

    // Find all ice creams with the highest sales
    vector<string> top_sellers;
    for (const auto& item : sales) {
        if (item.second == max_sales) {
            top_sellers.push_back(item.first);
        }
    }

    // Sort top sellers alphabetically
    sort(top_sellers.begin(), top_sellers.end());

    // Output results
    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total_sales << endl;
    cout << "Top sales: ";
    for (size_t i = 0; i < top_sellers.size(); i++) {
        cout << top_sellers[i];
        if (i < top_sellers.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;

    return 0;
}
# 0425, 2024-10-15 13:44:12, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <iomanip>

using namespace std;

int main() {
    int N, M;
    string name;
    double price;
    int quantity;
    map<string, double> prices;
    map<string, double> sales;
    set<string> ice_cream_names;

    // Read ice cream prices
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
        ice_cream_names.insert(name);
    }

    // Read sales data
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> quantity;
        if (prices.find(name) != prices.end()) {
            sales[name] += prices[name] * quantity;
        }
    }

    // Calculate total sales and find the highest sales
    double total_sales = 0.0;
    double max_sales = 0.0;
    for (const auto& item : sales) {
        total_sales += item.second;
        max_sales = max(max_sales, item.second);
    }

    // Check if there were any ice cream sales
    if (total_sales == 0.0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    // Find all ice creams with the highest sales
    set<string> top_sellers;
    for (const auto& name : ice_cream_names) {
        if (sales[name] == max_sales) {
            top_sellers.insert(name);
        }
    }

    // Output results
    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total_sales << endl;
    cout << "Top sales: ";
    bool first = true;
    for (const auto& seller : top_sellers) {
        if (!first) cout << " ";
        cout << seller;
        first = false;
    }
    cout << endl;

    return 0;
}
# 0426, 2024-10-15 13:49:50, PPPP----P (55%)

#include <iostream>
#include <string>
#include <map>
#include <set>
#include <cmath>

using namespace std;

int main() {
    int N, M;
    string name;
    double price;
    int quantity;
    map<string, double> prices;
    map<string, int> sales_quantity;
    
    // Read ice cream prices
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
    }
    
    // Read sales data
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> quantity;
        sales_quantity[name] += quantity;
    }
    
    // Calculate total sales and find the highest sales
    double total_sales = 0.0;
    int max_quantity = 0;
    for (const auto& item : sales_quantity) {
        if (prices.find(item.first) != prices.end()) {
            total_sales += prices[item.first] * item.second;
            max_quantity = max(max_quantity, item.second);
        }
    }
    
    // Check if there were any ice cream sales
    if (total_sales == 0.0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    
    // Find all ice creams with the highest sales quantity
    set<string> top_sellers;
    for (const auto& item : sales_quantity) {
        if (prices.find(item.first) != prices.end() && item.second == max_quantity) {
            top_sellers.insert(item.first);
        }
    }
    
    // Output results
    
    cout << "Total ice cream sales: " << total_sales << endl;
    cout << "Top sales:";
    for (const auto& seller : top_sellers) {
        cout << " " << seller;
    }
    cout << endl;
    
    return 0;
}
# 0427, 2024-10-15 13:53:20, PP------- (22%)

#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int N, M;
    string name;
    double price;
    int quantity;
    map<string, double> prices;
    map<string, int> sales_quantity;
    map<string, double> sales_revenue;
    
    // Read ice cream prices
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> name >> price;
        prices[name] = price;
    }
    
    // Read sales data
    cin >> M;
    for (int i = 0; i < M; i++) {
        cin >> name >> quantity;
        if (prices.find(name) != prices.end()) {
            sales_quantity[name] += quantity;
            sales_revenue[name] += quantity * prices[name];
        }
    }
    
    // Calculate total sales and find the highest sales revenue
    double total_sales = 0.0;
    double max_revenue = 0.0;
    for (const auto& item : sales_revenue) {
        total_sales += item.second;
        max_revenue = max(max_revenue, item.second);
    }
    
    // Check if there were any ice cream sales
    if (total_sales == 0.0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    
    // Find all ice creams with the highest sales revenue
    vector<string> top_sellers;
    for (const auto& item : sales_revenue) {
        if (fabs(item.second - max_revenue) < 1e-9) {  // Compare doubles with tolerance
            top_sellers.push_back(item.first);
        }
    }
    
    // Sort top sellers alphabetically
    sort(top_sellers.begin(), top_sellers.end());
    
    // Output results
    cout << fixed << setprecision(1);
    cout << "Total ice cream sales: " << total_sales << endl;
    cout << "Top sales:";
    for (const auto& seller : top_sellers) {
        cout << " " << seller;
    }
    cout << endl;
    
    return 0;
}
# 0428, 2024-10-15 13:58:07, PP------- (22%)

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <iomanip>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;

    // Read ice cream price data
    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    int M;
    cin >> M;

    // Read sales data
    map<string, int> sales;
    for (int i = 0; i < M; ++i) {
        string name;
        int quantity;
        cin >> name >> quantity;
        sales[name] += quantity; // Accumulate sales quantities
    }

    // Calculate total sales and find highest selling ice cream
    double totalIceCreamSales = 0.0;
    map<string, double> iceCreamSales;

    for (const auto& sale : sales) {
        const string& productName = sale.first;
        int quantitySold = sale.second;

        if (iceCreamPrices.find(productName) != iceCreamPrices.end()) {
            // This product is an ice cream
            double price = iceCreamPrices[productName];
            double salesAmount = price * quantitySold;
            iceCreamSales[productName] = salesAmount; // Track ice cream sales
            totalIceCreamSales += salesAmount; // Update total sales
        }
    }

    // Output results
    if (totalIceCreamSales == 0.0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << fixed << setprecision(1);
        cout << "Total ice cream sales: " << totalIceCreamSales << endl;

        // Find the ice cream(s) with the highest sales
        double maxSales = 0.0;
        vector<string> topIceCreams;

        for (const auto& entry : iceCreamSales) {
            if (entry.second > maxSales) {
                maxSales = entry.second;
                topIceCreams.clear();
                topIceCreams.push_back(entry.first);
            } else if (entry.second == maxSales) {
                topIceCreams.push_back(entry.first);
            }
        }

        // Sort top-selling ice creams in dictionary order
        sort(topIceCreams.begin(), topIceCreams.end());

        cout << "Top sales: ";
        for (size_t i = 0; i < topIceCreams.size(); ++i) {
            cout << topIceCreams[i];
            if (i < topIceCreams.size() - 1) {
                cout << " ";
            }
        }
        cout << endl;
    }

    return 0;
}

# 0429, 2024-10-15 13:34:23, PPPP----P (55%)

#include <iostream>
#include <set>
#include <string>
#include<map>

using namespace std;

int main(){
    map<string,double> m;
    string name,name_top_sale;
    double n,price,num,sum, num_top_sale;
    num_top_sale=0;
    sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>price;
        m[name]=price;
    }

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>num;
        if(m.find(name)!=m.end()){
            sum+=num*(*m.find(name)).second;
            if(num>num_top_sale){
                num_top_sale=num;
                name_top_sale=name;
            }
        }
    }

    if(sum==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: "<<name_top_sale;
    }
}
# 0430, 2024-10-15 13:37:59, -PP-----P (33%)

#include <iostream>
#include <set>
#include <string>
#include<map>

using namespace std;

int main(){
    map<string,double> m;
    string name,name_top_sale;
    double n,price,num,sum, num_top_sale;
    num_top_sale=0;
    sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>price;
        m[name]=price;
    }

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>num;
        if(m.find(name)!=m.end()){
            sum+=num*(*m.find(name)).second;
            if(num>num_top_sale){
                num_top_sale=num;
                name_top_sale+=name+" ";
            }
        }
    }

    if(sum==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: "<<name_top_sale;
    }
}
# 0431, 2024-10-15 13:38:21, -PP-----P (33%)

#include <iostream>
#include <set>
#include <string>
#include<map>

using namespace std;

int main(){
    map<string,double> m;
    string name,name_top_sale;
    double n,price,num,sum, num_top_sale;
    num_top_sale=0;
    sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>price;
        m[name]=price;
    }

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>num;
        if(m.find(name)!=m.end()){
            sum+=num*(*m.find(name)).second;
            if(num>=num_top_sale){
                num_top_sale=num;
                name_top_sale+=name+" ";
            }
        }
    }

    if(sum==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: "<<name_top_sale;
    }
}
# 0432, 2024-10-15 13:41:55, -PP-P--PP (55%)

#include <iostream>
#include <set>
#include <string>
#include<map>

using namespace std;

int main(){
    map<string,double> m;
    set<string> s_top_sales;
    string name,name_top_sale;
    double n,price,num,sum, num_top_sale;
    num_top_sale=0;
    sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>price;
        m[name]=price;
    }

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>num;
        if(m.find(name)!=m.end()){
            sum+=num*(*m.find(name)).second;
            if(num*(*m.find(name)).second>=num_top_sale){
                num_top_sale=num*(*m.find(name)).second;
                s_top_sales.insert(name);
            }
        }
    }

    if(sum==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto s : s_top_sales){
            cout<<s<<" ";
        }
    }
}
# 0433, 2024-10-15 13:58:17, -PPPP---P (55%)

#include <iostream>
#include <set>
#include <string>
#include<map>

using namespace std;

int main(){
    map<string,double> m, m_num;
    set<string> s_top_sales;
    string name,name_top_sale;
    double n,price,num,sum, num_top_sale,check;
    num_top_sale=0;
    sum=0;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>price;
        m[name]=price;
    }

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>name;
        cin>>num;
        if(m.find(name)!=m.end()){
            sum+=num*(*m.find(name)).second;
            
            if(m.find(name)!=m.end()){
                m_num[name]+=num*(*m.find(name)).second;
                check=(*m.find(name)).second;
            }
            else{
                m_num[name]=num*(*m.find(name)).second;
                check=(*m.find(name)).second;
            }

            if(num*(*m.find(name)).second>=num_top_sale){
                num_top_sale=num*(*m.find(name)).second;
            }
        }
    }

    if(sum==0){
        cout<<"No ice cream sales";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto m_n : m_num){
            if(m_n.second==num_top_sale){
                s_top_sales.insert(m_n.first);
            }
        }
        for(auto s: s_top_sales){
            cout<<s<<" ";
        }
    }
}

# 0434, 2024-10-15 13:54:31, -PP-P--PP (55%)

#include <iostream>
#include <map>
#include <set>
using namespace std;

int main(){
    map<string, double> menu;
    int n; 
    cin >> n; 
    
    string icecream;
    double price;
    double total = 0.0; 
    
    while (n--) {
        cin >> icecream >> price;
        menu[icecream] = price;
    }

    int k; 
    cin >> k; 
    
    int p;
    string buy;
    map<string, int> sales;
    double topssale = 0.0;
    set<string> maxsell; 
    while (k--) {
        cin >> buy >> p;
        
        if (menu.find(buy) == menu.end()) {
            total += 0;
        } else {
            sales[buy] = p;
            total += menu[buy] * sales[buy];
            if (menu[buy] * sales[buy] >= topssale){
                topssale = menu[buy] * sales[buy];
                maxsell.insert(buy);
            }
        }   
    }

    if(total == 0){
        cout << "No ice cream sales" << endl;
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: " ; 
        for (auto e : maxsell){
            cout << e << " ";
        }

    }

}
# 0435, 2024-10-15 13:59:50, -PP-P--PP (55%)

#include <iostream>
#include <map>
#include <set>
using namespace std;

int main(){
    map<string, double> menu;
    int n; 
    cin >> n; 
    
    string icecream;
    double price;
    double total = 0.0; 
    
    while (n--) {
        cin >> icecream >> price;
        menu[icecream] = price;
    }

    int k; 
    cin >> k; 
    
    int p;
    string buy;
    map<string, int> sales;
    double topssale = 0.0;
    set<string> maxsell; 
    
    while (k--) {
        cin >> buy >> p;
        
        if (menu.find(buy) == menu.end()) {
            total += 0;
        } else {
            sales[buy] = p;
            double current_sales = menu[buy] * sales[buy];
            total += current_sales;

            if (current_sales > topssale) {
                topssale = current_sales; 
                maxsell.insert(buy); 
            } else if (current_sales == topssale) {
                maxsell.insert(buy); 
            }
        }   
    }

    if(total == 0){
        cout << "No ice cream sales" << endl;
    }
    else{
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: "; 
        for (auto e : maxsell) {
            cout << e << " ";
        }
        cout << endl;
    }

    return 0;
}

# 0436, 2024-10-15 14:04:17, PPPP----P (55%)

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

int main(){
    int n, m;
    map<string, double> price;
    map<string, int> count;
    double total = 0;
    cin >> n;
    for(int i=0;i<n;i++){
        double b;
        string a;
        cin >> a >> b;
        price.insert({a,b});
    }
    cin >> m;
    for(int i=0;i<m;i++){
        int b;
        string a;
        cin >> a >> b;
        auto it = price.find(a);
        auto id = count.find(a);
        if(it!=price.end()){
            total += it->second * b;
            if(id!=count.end()){
                id->second += b;
            }else{
                count.insert({a,b});
            }
        }
    }
    if(total==0){
        cout << "No ice cream sales";
    }else{
        cout << "Total ice cream sales: " << total << "\n" << "Top sales: ";
        int maxx = 0;
        for(auto it:count){
            if(it.second > maxx) maxx= it.second;
        }
        vector<string> x;
        for(auto it:count){
            if(it.second == maxx) x.push_back(it.first);
        }
        sort(x.begin(),x.end());
        for(int i=0;i<x.size();i++)
            cout << x[i] << ' ';
    }
}

# 0437, 2024-10-15 13:56:07, -PPP---PP (55%)

#include<iostream>
#include<vector>
#include<string>
#include<tuple>
#include<algorithm>
using namespace std;

int main() {
    int a;
    cin >> a;
    vector<pair<string, double>> menu;
    string b;
    double c;
    for (int i = 0; i < a; i++) {
        cin >> b >> c;
        menu.push_back({b, c});
    }
    int d;
    cin >> d;
    vector<tuple<string, double, double>> order; 
    string e;
    double g;
    for (int i = 0; i < d; i++) {
        cin >> e >> g;
        order.push_back({e, 0.0, g}); 
    }
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < a; j++) {
            if (get<0>(order[i]) == menu[j].first) {
                double sum = get<2>(order[i]) * menu[j].second; 
                get<1>(order[i]) = sum; 
                break; 
            }
        }
    }
    sort(order.begin(), order.end(), [](auto &left, auto &right) {
        return get<1>(left) > get<1>(right); 
    });
    int y = order.size();
    double total = 0;
    for (int i = 0; i < y; i++) {
        total += get<1>(order[i]);
    }
    if (total == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << total << endl;
    }
    double maxSales = get<1>(order[0]);
    if (total != 0) {
        cout << "Top sales: ";
        for (int i = 0; i < y; i++) {
            if (get<1>(order[i]) == maxSales) {
                cout << get<0>(order[i]) << " "; 
            } 
        }
        cout << endl;
    }
    return 0;
}

# 0438, 2024-10-15 13:59:46, PPPP----P (55%)

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

int main() {
    int N; cin >> N;
    map<string, double> data;

    for (int i = 0; i < N; i++) {
        string name;
        double price;
        cin >> name >> price;
        data[name] = price;
    }

    int M; cin >> M;
    map<string, int> bill;

    for (int i = 0; i < M; i++) {
        string order;
        int quantity;
        cin >> order >> quantity;

        if (data.find(order) != data.end()) {
            bill[order] += quantity;
        }
    }
    
    double total = 0;
    if (bill.empty()) {
        cout << "No ice cream sales" << endl;
    }
    else {
        int best = 0;
        vector<string> bestseller;

        for (const auto& sale : bill) {
            double saleamount = sale.second * data[sale.first];
            total += saleamount;

            if (sale.second > best) {
                best = sale.second;
                bestseller.clear();
                bestseller.push_back(sale.first);
            } else if (sale.second == best) {
                bestseller.push_back(sale.first);
            }
        }

        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        
        sort(bestseller.begin(), bestseller.end());
        for (const string& name : bestseller) {
           cout << name << ' ';
        }
    }

    return 0;
}

Max Score = 44


# 0439, 2024-10-15 13:32:46, PPPP----- (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string name; double price;
    map<string,double> sales;
    map<int,string> top;
    for(int i = 0;i<n;i++){
        cin >> name >> price;
        sales[name] = price;
    }

    int m; cin >> m;
    map<string,double> userbuy;
    for(int i =0;i<m;i++){
        cin >> name >> price;
        if(userbuy.find(name)==userbuy.end()){
        userbuy[name] = price;
        top[price] = name;}

        else{
            userbuy[name] += price;
            auto k = userbuy.find(name);
            double j = (*k).second;

            top[j+price] = name;
        }
    }
    double sum = 0;
    
    for(auto kv:userbuy){
        if(sales.find(kv.first) != sales.end()){
            auto itr = sales.find(kv.first);
            sum += kv.second * (*itr).second;
        }
    }
    if(sum == 0) cout <<"No ice cream sales" << endl;
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        auto itr = top.end();
        itr--;
        cout << (*itr).second;

    }
}
# 0440, 2024-10-15 13:34:53, PPPP----- (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string name; double price;
    map<string,double> sales;
    map<int,string> top;
    for(int i = 0;i<n;i++){
        cin >> name >> price;
        sales[name] = price;
    }

    int m; cin >> m;
    map<string,double> userbuy;
    for(int i =0;i<m;i++){
        cin >> name >> price;
        if(userbuy.find(name)==userbuy.end()){
        userbuy[name] = price;
        top[price] = name;}

        else{
            userbuy[name] += price;
            auto k = userbuy.find(name);
            double j = (*k).second;

            top[j+price] = name;
        }
    }
    double sum = 0;
    
    for(auto kv:userbuy){
        if(sales.find(kv.first) != sales.end()){
            auto itr = sales.find(kv.first);
            sum += kv.second * (*itr).second;
        }
    }
    if(sum == 0) cout <<"No ice cream sales" << endl;
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        auto itr = top.end();
        itr--;
        cout << (*itr).second << " ";
        double previous = (*itr).first;
        while(true){
            itr--;
            if((*itr).first == previous) cout <<(*itr).second;
            else break;
            
        }
    }
}
# 0441, 2024-10-15 13:40:03, PPPP----- (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    string name; double price;
    map<string,double> sales;
    map<int,string> top;
    set<string> toppp;
    for(int i = 0;i<n;i++){
        cin >> name >> price;
        sales[name] = price;
    }

    int m; cin >> m;
    map<string,double> userbuy;
    for(int i =0;i<m;i++){
        cin >> name >> price;
        if(userbuy.find(name)==userbuy.end()){
        userbuy[name] = price;
        top[price] = name;}

        else{
            userbuy[name] += price;
            auto k = userbuy.find(name);
            double j = (*k).second;

            top[j+price] = name;
        }
    }
    double sum = 0;
    
    for(auto kv:userbuy){
        if(sales.find(kv.first) != sales.end()){
            auto itr = sales.find(kv.first);
            sum += kv.second * (*itr).second;
        }
    }
    if(sum == 0) cout <<"No ice cream sales" << endl;
    else{
        cout << "Total ice cream sales: " << sum << endl;
        cout << "Top sales: ";
        auto itr = top.end();
        itr--;
        toppp.insert((*itr).second);
        double previous = (*itr).first;
        while(true){
            --itr;
            if((*itr).first == previous) toppp.insert((*itr).second);
            else break;
            
        }
        for(auto z : toppp) cout << z << " ";
    }
}

# 0442, 2024-10-15 13:47:48, --PP----P (33%)

#include <bits/stdc++.h>

using namespace std;

int main() {
    map<string, double> pops;    
    map<string, double> buying;   
    int num;                    
    double price;               
    string icetype;            

    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> icetype >> price;
        pops.insert({icetype, price});
    }


    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> icetype >> price;  
        buying.insert({icetype, price});
    }

    double totalSum = 0;       
    double highestSaleAmount = 0; 
    string highestSaleItem;      

    for (const auto& item : buying) {
        auto buy = pops.find(item.first);
        if (buy != pops.end()) {
            double saleAmount = (item.second) * (buy->second); 
            totalSum += saleAmount; 
            
            if (saleAmount > highestSaleAmount) {
                highestSaleAmount = saleAmount;
                highestSaleItem = item.first; 
            }
        }
    }

    cout << "Total ice cream sales: " << totalSum << endl;
    if (!highestSaleItem.empty()) {
        cout << "Top sales: " << highestSaleItem << endl;
    } else {
        cout << "No ice cream sales" << endl;
    }

    return 0;
}
# 0443, 2024-10-15 13:53:05, --PPP---P (44%)

#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

int main() {
    map<string, double> pops;    
    map<string, double> buying;   
    
    int num;                    
    double price;                 
    string icetype;             

    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> icetype >> price;
        pops.insert({icetype, price});
    }

    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> icetype >> price; 
        buying.insert({icetype, price});
    }

    double totalSum = 0;       
    double highestSaleAmount = 0; 
    vector<string> highestSaleItems; 

    for (const auto& item : buying) {
        auto buy = pops.find(item.first);
        if (buy != pops.end()) {
            double saleAmount = (item.second) * (buy->second);
            totalSum += saleAmount; 

            if (saleAmount > highestSaleAmount) {
                highestSaleAmount = saleAmount;
                highestSaleItems.clear(); 
                highestSaleItems.push_back(item.first); 
            } else if (saleAmount == highestSaleAmount) {
                highestSaleItems.push_back(item.first); 
            }
        }
    }
    cout << "Total ice cream sales: " << totalSum << endl;
    if (!highestSaleItems.empty()) {
        cout << "Top sales: ";
        for (const auto& item : highestSaleItems) {
            cout << item << " ";
        }
    } else {
        cout << "No ice cream sales" << endl;
    }

    return 0;
}

# 0444, 2024-10-15 13:34:40, -PP-P---P (44%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    double ans;
    map<string, double> ice;
    set<string> tops;
    int n;cin>>n;
    for (int i = 0; i < n; i++)
    {
        string s;cin>>s;
        double d;cin>>d;
        ice[s]=d;
    }
    int t;cin>>t;
    for (int i = 0; i < t; i++)
    {
        string s;cin>>s;
        double d;cin>>d;
        if (ice.find(s)!=ice.end())
        {
            ans+=ice[s]*d;
            tops.insert(s);
        }
    }
    if (tops.empty())
    {
        cout<<"No ice cream sales";
    }
    else
    {
        cout<<"Total ice cream sales: "<<ans<<"\n";
        cout<<"Top sales: ";
    }
    for (auto t : tops)
    {
        cout<<t<<" ";
    }
}

Max Score = 33


# 0445, 2024-10-15 13:40:19, --------T (0%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    float ans = 0;
    map <string,float> p;
    string name;
    float price;
    int n;
    cin >> n;
    vector<pair<float,string>> each;
    for(int i = 0; i < n;i++){
        cin >> name;
        cin >> price;
        p[name] = price;
        each.push_back(make_pair(0,name));
    }

    int m;
    cin >> m;
    int buy;
    for(int i = 0; i < m;i++){
        cin >> name;
        cin >> buy;
        if(p.find(name) != p.end()){
            ans += p[name]*buy;
        }
        for(auto e : each){
            if(e.second == name){
                e.first += p[name]*buy;
            }
        }        
    }
    for(auto p:each){
        cout << p.first << ' ' << p.second << "@" ;
    }
    cout <<"Total ice cream sales: "<< ans <<endl;
    cout <<"Top sales: ";
    int i = 0;
    while(each[i].first == each[i+1].first){
        cout << each[i].first << " " << each[i+1].first;
        i++;
    }
    cout << each[i].first;
}
# 0446, 2024-10-15 13:45:04, -xP----PT (22%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    float ans = 0;
    map <string,float> p;
    string name;
    float price;
    int n;
    cin >> n;
    vector<pair<float,string>> each;
    for(int i = 0; i < n;i++){
        cin >> name;
        cin >> price;
        p[name] = price;
        each.push_back(make_pair(0,name));
    }

    int m;
    cin >> m;
    int buy;
    for(int i = 0; i < m;i++){
        cin >> name;
        cin >> buy;
        if(p.find(name) != p.end()){
            ans += p[name]*buy;
        }
        for(auto &e : each){
            if(e.second == name){
                e.first += p[name]*buy;
            }
        }        
    }

    cout <<"Total ice cream sales: "<< ans <<endl;
    cout <<"Top sales: ";
    int i = 0;
    while(each[i].first == each[i+1].first){
        cout << each[i].second << " ";
        i++;
    }
    cout << each[i].second;
}
# 0447, 2024-10-15 13:48:06, -PP----PT (33%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    float ans = 0;
    map <string,float> p;
    string name;
    float price;
    int n;
    cin >> n;
    vector<pair<float,string>> each;
    for(int i = 0; i < n;i++){
        cin >> name;
        cin >> price;
        p[name] = price;
        each.push_back(make_pair(0,name));
    }

    int m;
    cin >> m;
    int buy;
    for(int i = 0; i < m;i++){
        cin >> name;
        cin >> buy;
        if(p.find(name) != p.end()){
            ans += p[name]*buy;
        }
        for(auto &e : each){
            if(e.second == name){
                e.first += p[name]*buy;
            }
        }        
    }

    
    int i = 0;
    if(each[i].first == 0){
        cout <<"No ice cream sales";
    }
    else{
        cout <<"Total ice cream sales: "<< ans <<endl;
        cout <<"Top sales: ";
        while(each[i].first == each[i+1].first){
            cout << each[i].second << " ";
            i++;
        }
        cout << each[i].second;
    }

    
}

# 0448, 2024-10-15 13:31:40, --------- (0%)

#include <iostream>
#include <map>

using namespace std;

int main()
{
    map<string, int> ice;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string tempk;
        int tempv;
        ice[tempk] = tempv;
    }
    
    
}
# 0449, 2024-10-15 13:50:01, -PP-----P (33%)

#include <iostream>
#include <map>

using namespace std;

int main()
{
    map<string, float> ice;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        string tempk;
        float tempv;
        cin >> tempk >> tempv;

        ice[tempk] = tempv;
    }
    int m, sale = 0, chek = 0;
    string ms;
    cin >> m;
    for (int i = 0; i < m; i++)
    {
        string sl;
        int am;
        cin>> sl >> am;
        if (ice.find(sl) != ice.end())
        {
            ice[sl] = ice[sl] * am;
            chek++;
            if (ice[sl] > sale)
            {
                sale = ice[sl];
                ms = sl;
            }
        }
    }

    if (chek == 0)
    {
        cout << "No ice cream sales";
    }
    else
    {
        cout << "Total ice cream sales: " << sale << endl;
        cout << "Top sales: " << ms;
    }
    
}

# 0450, 2024-10-15 13:40:20, -PP-----P (33%)

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

int main(){
    bool found = false;
    int n;
    cin >> n;
    string ice[n]; float ices[n];
    for(int i=0; i<n; i++){
        cin >> ice[i] >> ices[i];
    }

    int m;
    cin >> m;
    string sale[m]; float sales[m];
    for(int i=0; i<m; i++){
        cin >> sale[i] >> sales[i];
    }
    /*for(int i=0; i<n; i++){
        cout << ice[i] << ' ' << ices[i] << ' ';
    }
    cout << endl;
    cout << "---" << endl;
    for(int i=0; i<m; i++){
        cout << sale[i] << ' ' << sales[i] << ' ';
    }
    cout << endl;*/

    set<string> topsale;
    float total = 0;
    int top = sales[0];
    for(int i=0; i<m; i++){
        for(int j=0; j<n; j++){
            if(sale[i]==ice[j] && sales[i]>=top){
                topsale.insert(sale[i]);
                top = sales[i];
                found = true;
            }
            if(sale[i]==ice[j]){
                total += sales[i]*ices[j];
            }
        }
    }

    if(total!=0){
        cout << "Total ice cream sales: " << total << endl;
    }
    if(found){
        cout << "Top sales: ";
        for(auto e:topsale){
            cout << e << ' ';
        }
    }
    else{
        cout << "No ice cream sales" << endl;
    }
}
# 0451, 2024-10-15 13:51:22, -PP-----P (33%)

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

int main(){
    int n;
    cin >> n;
    string ice[n]; float ices[n];
    for(int i=0; i<n; i++){
        cin >> ice[i] >> ices[i];
    }

    int m;
    cin >> m;
    string sale[m]; float sales[m];
    for(int i=0; i<m; i++){
        cin >> sale[i] >> sales[i];
    }
    /*for(int i=0; i<n; i++){
        cout << ice[i] << ' ' << ices[i] << ' ';
    }
    cout << endl;
    cout << "---" << endl;
    for(int i=0; i<m; i++){
        cout << sale[i] << ' ' << sales[i] << ' ';
    }
    cout << endl;*/

    set<string> topsale;
    float total = 0;
    int top = sales[0];
    for(int i=0; i<m; i++){
        for(int j=0; j<n; j++){
            if(sale[i]==ice[j] && sales[i]>=top){
                topsale.insert(sale[i]);
                top = sales[i];
            }
            if(sale[i]==ice[j]){
                total += sales[i]*ices[j];
            }
        }
    }

    if(total!=0){
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for(auto e:topsale){
            cout << e << ' ';
        }
    }
    else{
        cout << "No ice cream sales" << endl;
    }
}

Max Score = 22


# 0452, 2024-10-15 13:29:42, --------- (0%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
using namespace std;

int main() {
    int N, M;
    cin >> N;
    
    if (N == 0) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    map<string, double> sales;
    string productName;
    double saleAmount;

    for (int i = 0; i < N; ++i) {
        cin >> productName >> saleAmount;
        sales[productName] += saleAmount;
    }

    cin >> M;

    for (int i = 0; i < M; ++i) {
        cin >> productName >> saleAmount;
        sales[productName] += saleAmount;
    }

    double totalSales = 0.0;
    double maxSales = 0.0;
    for (const auto &entry : sales) {
        totalSales += entry.second;
        if (entry.second > maxSales) {
            maxSales = entry.second;
        }
    }

    cout << fixed << setprecision(1) << "Total ice cream sales: " << totalSales << endl;

    cout << "Top sales:";
    for (const auto &entry : sales) {
        if (entry.second == maxSales) {
            cout << " " << entry.first;
        }
    }
    cout << endl;

    return 0;
}
# 0453, 2024-10-15 13:41:27, PP------- (22%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    map<string, double> prices;
    string productName;
    double price;

    for (int i = 0; i < N; ++i) {
        cin >> productName >> price;
        prices[productName] = price;
    }

    cin >> M;

    map<string, double> sales;
    string soldProduct;
    int quantitySold;

    for (int i = 0; i < M; ++i) {
        cin >> soldProduct >> quantitySold;
        if (prices.find(soldProduct) != prices.end()) {
            sales[soldProduct] += prices[soldProduct] * quantitySold;
        }
    }

    if (sales.empty()) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    double totalSales = 0.0;
    double maxSales = 0.0;
    for (const auto& entry : sales) {
        totalSales += entry.second;
        if (entry.second > maxSales) {
            maxSales = entry.second;
        }
    }

    cout << fixed << setprecision(1) << "Total ice cream sales: " << totalSales << endl;

    vector<string> topProducts;
    for (const auto& entry : sales) {
        if (entry.second == maxSales) {
            topProducts.push_back(entry.first);
        }
    }

    sort(topProducts.begin(), topProducts.end());

    cout << "Top sales:";
    for (const string& product : topProducts) {
        cout << " " << product;
    }
    cout << endl;

    return 0;
}
# 0454, 2024-10-15 13:46:48, PP------- (22%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    map<string, double> prices;
    string productName;
    double price;

    for (int i = 0; i < N; ++i) {
        cin >> productName >> price;
        prices[productName] = price;
    }

    cin >> M;

    map<string, double> sales;
    string soldProduct;
    int quantitySold;

    for (int i = 0; i < M; ++i) {
        cin >> soldProduct >> quantitySold;
        if (prices.find(soldProduct) != prices.end()) {
            sales[soldProduct] += prices[soldProduct] * quantitySold;
        }
    }

    if (sales.empty()) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    double totalSales = 0.0;
    double maxSales = 0.0;
    for (const auto& entry : sales) {
        totalSales += entry.second;
        if (entry.second > maxSales) {
            maxSales = entry.second;
        }
    }

    cout << fixed << setprecision(1) << "Total ice cream sales: " << totalSales << endl;

    vector<string> topProducts;
    for (const auto& entry : sales) {
        if (entry.second == maxSales) {
            topProducts.push_back(entry.first);
        }
    }

    sort(topProducts.begin(), topProducts.end());

    cout << "Top sales:";
    for (const string& product : topProducts) {
        cout << " " << product;
    }
    cout << endl;

    return 0;
}
# 0455, 2024-10-15 13:50:08, PP------- (22%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N, M;
    cin >> N;

    map<string, double> prices;
    string productName;
    double price;

    for (int i = 0; i < N; ++i) {
        cin >> productName >> price;
        prices[productName] = price;
    }

    cin >> M;

    map<string, double> sales;
    string soldProduct;
    int quantitySold;

    for (int i = 0; i < M; ++i) {
        cin >> soldProduct >> quantitySold;
        if (prices.find(soldProduct) != prices.end()) {
            sales[soldProduct] += prices[soldProduct] * quantitySold;
        }
    }

    if (sales.empty()) {
        cout << "No ice cream sales" << endl;
        return 0;
    }

    double totalSales = 0.0;
    double maxSales = 0.0;
    for (const auto& entry : sales) {
        totalSales += entry.second;
        if (entry.second > maxSales) {
            maxSales = entry.second;
        }
    }

    cout << fixed << setprecision(1) << "Total ice cream sales: " << totalSales << endl;

    vector<string> topProducts;
    for (const auto& entry :sales) {
        if (entry.second == maxSales) {
            topProducts.push_back(entry.first);
        }
    }
    
    sort(topProducts.begin(), topProducts.end());

    cout << "Top sales:";
    for(const string& product : topProducts) {
        cout << " " << product;
    }
    cout << endl;

    return 0;
}

# 0456, 2024-10-15 13:26:39, -P------- (11%)

#include <iostream>
#include <map>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n;
    int k;

    string product;
    double price;

    string findproduct;
    int amount;


    cin >> n;

    map<string, double> sales;
    map<string, int> total;

    while(n--){
        cin >> product;
        cin >> price;

        sales[product] = price;
    }

    cin >> k;

    while(k--){
        cin >> findproduct;
        cin >> amount;

        total[findproduct] = amount;
    }
    int totals; 
    bool found = false;

    map <int, string> order; 

    for(auto pair : sales){
        for(auto key : total){ // ก้อนหา
            if(key.first == pair.first){
                // cout << "hello" << endl;
                totals = key.second * pair.second;
                found = true;

                order[totals] =  key.first;
            }
        }
    }

    cout << order[0];
    // cout << totals << endl; 
    if(!found){
        cout << "No ice cream sales" ;
    }
}
# 0457, 2024-10-15 13:50:48, --P-----P (22%)

#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int n;
    int k;

    string product;
    double price;

    string findproduct;
    int amount;

    cin >> n;

    map<string, double> sales;
    map<string, int> total;

    // Input products and their prices
    while(n--){
        cin >> product;
        cin >> price;
        sales[product] = price;
    }

    cin >> k;

    // Input sales and aggregate quantities
    while(k--){
        cin >> findproduct;
        cin >> amount;
        total[findproduct] += amount;  // Aggregate quantities
    }

    vector< pair<double, string> > order;  // Vector to store sales data
    double all = 0;  // Variable to sum up all sales

    // Calculate total sales
    for(auto pair : sales){
        if(total.find(pair.first) != total.end()){
            double totals = total[pair.first] * pair.second;
            order.push_back({totals, pair.first});  // Add to vector
            all += totals;  // Sum total sales
        }
    }

    // Output total sales
    cout << "Total ice cream sales: " << all << endl;

    // Sort the sales vector in descending order based on totals
    sort(order.begin(), order.end(), greater<pair <double, string> >());

    // Output top sales
    cout << "Top sales: ";
    for(int i = 0; i < min(2, (int)order.size()); i++){
        cout << order[i].second << " ";  // Print top products
    }
    
    // Handle case when no sales were found
    if(order.empty()){
        cout << "No ice cream sales";
    }

    return 0;
}
# 0458, 2024-10-15 13:59:04, --P-----P (22%)

#include <iostream>
#include <map>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n; // Number of products
    int k; // Number of sales

    string product;
    double price;

    string findproduct;
    int amount;

    cin >> n;

    map<string, double> sales; 
    map<string, int> total;    


    while (n--) {
        cin >> product >> price;
        sales[product] = price;
    }

    cin >> k;

    // Reading the sales data
    while (k--) {
        cin >> findproduct >> amount;
        total[findproduct] += amount;
    }

    double totals;
    bool found = false;


    map<double, string, greater<double> > order;

    vector<double> final; // to hold the total sales amounts for output


    for (const auto& pair : sales) {
        if (total.find(pair.first) != total.end()) { // check if the product was sold
            totals = total[pair.first] * pair.second;
            final.push_back(totals);
            found = true;
            order[totals] = pair.first; 
        }
    }


    cout << "Total ice cream sales: ";
    double all = 0;
    for (double amount : final) {
        all += amount;
    }
    cout << all << endl;


    cout << "Top sales: ";
    if (found) {
        for (const auto& pair : order) {
            cout << pair.second << " ";
        }
    } else {
        cout << "No ice cream sales";
    }
    
    return 0;
}
# 0459, 2024-10-15 13:59:53, Compilation error (0%)

#include <iostream>
#include <map>
#include <vector>
#include <string>

using namespace std;

int main() {
    int n; // Number of products
    int k; // Number of sales

    string product;
    double price;

    string findproduct;
    int amount;

    cin >> n;

    map<string, double> sales; // Map to hold product sales price
    map<string, int> total;     // Map to hold total sold quantities

    // Reading product names and their prices
    while (n--) {
        cin >> product >> price;
        sales[product] = price;
    }

    cin >> k;

    // Reading the sales data
    while (k--) {
        cin >> findproduct >> amount;
        total[findproduct] += amount;
    }

    double totals;
    bool found = false;

    // Vector to hold pairs of total sales amounts and product names
    vector<pair<double, string>> order;

    // Calculate total sales
    for (const auto& pair : sales) {
        if (total.find(pair.first) != total.end()) { // Check if the product was sold
            totals = total[pair.first] * pair.second;
            order.push_back(make_pair(totals, pair.first)); // Store total sales with product name
            found = true;
        }
    }

    // Sort by total sales in descending order
    sort(order.begin(), order.end(), greater<pair<double, string>>());

    // Calculate total ice cream sales
    cout << "Total ice cream sales: ";
    double all = 0;
    for (const auto& amount : order) {
        all += amount.first; // Total sales amount
    }
    cout << all << endl;

    // Output top sales
    cout << "Top sales: ";
    if (found) {
        for (const auto& pair : order) {
            cout << pair.second << " ";
        }
    } else {
        cout << "No ice cream sales";
    }
    
    return 0;
}

# 0460, 2024-10-15 13:54:25, -P------P (22%)

#include <iostream>
#include <set>
using namespace std;

int main(){
    int n1;
    double total = 0;
    cin >> n1;
    string menu[n1];
    double prize[n1];
    for (int i = 0; i < n1; i++)
    {
        cin >> menu[i];
        cin >> prize[i];
    }
    int n2;
    cin >> n2;
    string order[n2];
    double num[n2];
    int count[n1] = {0};
    for (int i = 0; i < n2; i++)
    {
        cin >> order[i];
        cin >> num[i];
    }
    for (int i = 0; i < n2; i++)
    {
        for (int j = 0; j < n2; j++)
        {
            if (order[i] == menu[j])
            {
                count[j]++;
                double temp1 = prize[i];
                double temp2 = num[i];
                double temp3 = temp1 * temp2;
                total += temp3;
                
            }
        }
    }
    
    int max = count[0];
    
    if (total != 0)
    {
        cout << "Total ice cream sales: " << total << endl;
        set<string> top;
        cout << "Top sales: ";
        for (int i = 0; i < n1; i++)
        {
            if (count[i] >= max)
            {
                max = count[i];
                top.insert(menu[i]);
            }
        }
        for (string i : top)
        {
            cout << i << " ";
        }
    }
    else
    {
        cout << "No ice cream sales";
    }
       
}

# 0461, 2024-10-15 13:54:06, -P------P (22%)

#include <iostream>
using namespace std ;

int main() {
    int n , m , index , cost_total = 0 , top = 0 ; 
    cin >> n ;
    string sell_li[n] ;
    int sell_co[n] , cost[n] ;
    for(int i = 0 ; i < n ; i++) {
        cin >> sell_li[i] >> sell_co[i] ;
    }
    cin >> m ;
    string buy_li[m] ;  
    int buy_co[m] ;      
    for (int i = 0 ; i < m ; i++) {
        cin >> buy_li[i] >> buy_co[i] ;
    }
    for(int i = 0 ; i < m ; i++) {
        for(int j = 0 ; j < n ; j++) {
            if(buy_li[i] == sell_li[j]) {
                cost[j] += (buy_co[i] * sell_co[j]) ;
            }
        }
    }
    for(int i = 0 ; i < n ; i++) {
        if(top < cost[i]) {
            top = cost[i] ;
        }
        cost_total += cost[i] ;
    }
    if(cost_total > 0) {
        cout << "Total ice cream sales: " << cost_total << endl ;
        cout << "Top sales: " ;
        for(int i = 0 ; i < n ; i++) {
            if(cost[i] == top) {
                cout << sell_li[i] << " " ;
            }
        }
    }
    else {
        cout << "No ice cream sales" ;
    }
    return 0 ;
}

Max Score = 11


# 0462, 2024-10-15 13:25:09, Compilation error (0%)

#include <bits/stdc++.h>

using namespace std;

int main() {
int n;
bool w=false;
float a;
string g;
float sum=0;
map<string, float> s;
map<string,float> asd;
int m;
cin>>n;
for(int i=0;i<n;i++){
  cin>>g>>a;
  s[g] =a;
  
  
  
}
cin>>m;
for(int i=0;i<m;i++){
  cin>>g>>a;
  if(s.find(g)!=s.end()){
   
    if(asd.find(g)==asd.end()){
      asd[g]=s[g]*a;
    }else{
      asd[g]+=s[g]*a;
    }
    sum+=s[g]*a;
  }
  
  
}

if(asd.size()==0){
  cout<<"No ice cream sales";
}else{
  cout<<"Total ice cream sales: "
  cout<<sum;
  
}
  
  
  
  
  
  
return 0;
}
# 0463, 2024-10-15 13:27:44, -P------- (11%)

#include <bits/stdc++.h>

using namespace std;

int main() {
int n;
bool w=false;
float a;
string g;
float sum=0;
map<string, float> s;
map<string,float> asd;
int m;
cin>>n;
for(int i=0;i<n;i++){
  cin>>g>>a;
  s[g] =a;
  
  
  
}
cin>>m;
for(int i=0;i<m;i++){
  cin>>g>>a;
  if(s.find(g)!=s.end()){
   
    if(asd.find(g)==asd.end()){
      asd[g]=s[g]*a;
    }else{
      asd[g]+=s[g]*a;
    }
    sum+=s[g]*a;
  }
  
  
}

if(asd.size()==0){
  cout<<"No ice cream sales";
}else{
  cout<<"Total ice cream sales: "
 ; cout<<sum;
  
}
  
  
  
  
  
  
return 0;
}
# 0464, 2024-10-15 13:51:47, Compilation error (0%)

#include <bits/stdc++.h>

using namespace std;

int main() {
int n;
bool w=false;
float a;
string g;
float sum=0;
map<string, float> s;
map<string,float> asd;
int m;
cin>>n;
for(int i=0;i<n;i++){
  cin>>g>>a;
  s[g] =a;
  
  
  
}
cin>>m;
for(int i=0;i<m;i++){
  cin>>g>>a;
  if(s.find(g)!=s.end()){
   
    if(asd.find(g)==asd.end()){
      asd[g]=s[g]*a;
    }else{
      asd[g]+=s[g]*a;
    }
    sum+=s[g]*a;
  }
  
  
}
float k
for (auto e:asd){
  if(e.second>k)k=e.second;
}
  if(e.second==k)


if(asd.size()==0){
  cout<<"No ice cream sales";
}else{
  cout<<"Total ice cream sales: "
 ; cout<<sum;
 for (auto e:asd){
  if(e.second==k)cout<<" "<<e.first;
}
  
}
  
  
  
  
  
  
return 0;
}
# 0465, 2024-10-15 13:52:02, Compilation error (0%)

#include <bits/stdc++.h>

using namespace std;

int main() {
int n;
bool w=false;
float a;
string g;
float sum=0;
map<string, float> s;
map<string,float> asd;
int m;
cin>>n;
for(int i=0;i<n;i++){
  cin>>g>>a;
  s[g] =a;
  
  
  
}
cin>>m;
for(int i=0;i<m;i++){
  cin>>g>>a;
  if(s.find(g)!=s.end()){
   
    if(asd.find(g)==asd.end()){
      asd[g]=s[g]*a;
    }else{
      asd[g]+=s[g]*a;
    }
    sum+=s[g]*a;
  }
  
  
}
float k
for (auto e:asd){
  if(e.second>k)k=e.second;
}
  


if(asd.size()==0){
  cout<<"No ice cream sales";
}else{
  cout<<"Total ice cream sales: "
 ; cout<<sum;
 for (auto e:asd){
  if(e.second==k)cout<<" "<<e.first;
}
  
}
  
  
  
  
  
  
return 0;
}
# 0466, 2024-10-15 13:53:58, -P------- (11%)

#include <bits/stdc++.h>

using namespace std;

int main() {
int n;
bool w=false;
float a;
string g;
float sum=0;
map<string, float> s;
map<string,float> asd;
int m;
cin>>n;
for(int i=0;i<n;i++){
  cin>>g>>a;
  s[g] =a;
  
  
  
}
cin>>m;
for(int i=0;i<m;i++){
  cin>>g>>a;
  if(s.find(g)!=s.end()){
   
    if(asd.find(g)==asd.end()){
      asd[g]=s[g]*a;
    }else{
      asd[g]+=s[g]*a;
    }
    sum+=s[g]*a;
  }
  
  
}
float k=-1;
for (auto e:asd){
  if(e.second>k)k=e.second;
}
  


if(asd.size()==0){
  cout<<"No ice cream sales";
}else{
  cout<<"Total ice cream sales: "
 ; cout<<sum;
 cout<<"Top sales";
 for (auto e:asd){
  if(e.second==k)cout<<" "<<e.first;
}
  
}
  
  
  
  
  
  
return 0;
}

# 0467, 2024-10-15 13:12:57, Compilation error (0%)

#include <iostream>
using namespacestd;

int main(){
  cout << "No ice cream sale";
}
# 0468, 2024-10-15 13:13:07, --------- (0%)

#include <iostream>
using namespace std;

int main(){
  cout << "No ice cream sale";
}
# 0469, 2024-10-15 13:13:20, --------- (0%)

#include <iostream>
using namespace std;

int main(){
  cout << "No icecream sale";
}
# 0470, 2024-10-15 13:13:35, --------- (0%)

#include <iostream>
using namespace std;

int main(){
  cout << "No icecream sales";
}
# 0471, 2024-10-15 13:13:48, -P------- (11%)

#include <iostream>
using namespace std;

int main(){
  cout << "No ice cream sales";
}

# 0472, 2024-10-15 13:11:10, --------- (0%)

#include<iostream>
using namespace std;
int main() {
    
}
# 0473, 2024-10-15 13:14:24, -P------- (11%)

#include<iostream>
using namespace std;
int main() {
    cout << "No ice cream sales" ;
}

# 0474, 2024-10-15 13:42:06, -P------- (11%)

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <tuple>
#include <utility>
#include <set>
#include <map>
using namespace std;
int main (){
    map<string , float> ice;
int n,m,sale;
float cost;
string flavor;
cin >> n;
    while (n--){
    cin >> flavor >> cost;
    ice[flavor] = cost;
    }
    map<string,int> numsale;
    cin >> m;
    while(m--){
        cin >> flavor >> sale;
        numsale[flavor] = sale;
    }
    if(numsale[flavor] != ice[flavor]  ){
        cout << "No ice cream sales";
    }
}

# 0475, 2024-10-15 14:04:07, -P------T (11%)

#include<iostream>
#include<vector>
#include<set>
#include<utility>
#include<map>

void maus ( std::map<std::string , int> a , int b ){
    for ( auto c = a.begin() ; c != a.end() ; c++ ){
        if ( (*c).second == b ){
            std::cout << " " << (*c).first ;
        }
    }
}

int priceice ( std::map<std::string , int > a , std::string b , int c ) {
    int d = 0 ;
    auto bb = a.find(b) ;
    if ( bb != a.end() ){
        d = (*bb).second * c ;
    }
    return d ;
}

int main () {
    int a = 0 ;
    std::cin >> a ;
    std::map<std::string , int > ice ;
    for ( int x = 0  ; x < a ; x++ ){
        std::string k = "" ; int kv = 0 ;
        std::cin >> k >> kv ;
        ice[k] = kv ;
    }
    std::set<int> c = {} ;
    int sum = 0 ;
    std::cin >> a ;
    std::map< std::string , int > buy ;
    for ( int x = 0  ; x < a ; x++ ){
        std::string k = "" ; int kv = 0 ;
        std::cin >> k >> kv ;
        if ( ice.find( k ) != ice.end() ){
            c.insert( kv ) ;
            buy[k] = kv ;
        }
        sum = sum + priceice( ice , k , kv ) ;
    }
    auto gg = c.end() ;
    if ( sum == 0 ){
        std::cout << "No ice cream sales" ;
    }else{
        std::cout << "Total ice cream sales: " << sum << std::endl ;
        std::cout << "Top sales: " ;
        maus( buy , *gg ) ;
    }
}

# 0476, 2024-10-15 13:11:34, -P------- (11%)

#include<iostream>
#include<map>
using namespace std;
int main(){
    cout<<"No ice cream sales";
}

# 0477, 2024-10-15 13:44:05, -P------- (11%)

#include <iostream>
#include <map>

using namespace std;
int main(){
    int n;
    cin >> n;
    map<string,double> icecream;
    string ice ;
    double price;
    for(int i = 0 ; i < n ; i++){
        cin >> ice;
        cin >> price;
        icecream[ice] = price;
    }
    ice = "";
    int m;
    cin >> m;
    int y;  //ขายไอติมไปกี่อัน
    map <string,int> sell;
    for(int i = 0 ; i< m ; i++){
        cin >> ice;
        cin >> y;
        sell[ice] = y;
    }
    
    cout << "No ice cream sales";
    /*for(auto & s : icecream){
        cout << s.first << " " << s.second << endl;
    }*/
}

# 0478, 2024-10-15 14:00:46, -P------- (11%)

#include <bits/stdc++.h>
using namespace std;
int main() {
    map<string,double> m;
    int N;
    cin >> N;
    string ice;
    double price;
    for (int i = 0; i < N; i++) {
        cin >> ice >> price;
        m[ice] = price;
    }
    int M;
    cin >> M;
    vector<pair<string,int>> v;
    string name;
    int num;
    for (int i = 0; i < M; i++) {
        cin >> name >> num;
        if (m.find(name) == m.end()) {
            continue;
        }
        v.push_back(make_pair(name,num));
    }
    vector<pair<string,double>> v2;
    double max = 0;
    double total = 0;
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < m.size(); j++) {
            auto itr = m.find(v[i].first);
            if (itr != m.end()) {
                if (v[i].first == (*itr).first) {
                    double a = 0;
                    a = v[i].second*(*itr).second;
                    v2.push_back(make_pair(v[i].first,a));
                    if (a > max) {
                        max = a;
                    }
                    total += a;
                }
            }
        } 
    }
    if (v2.size() == 0) {
        cout << "No ice cream sales";
    }
    else {
        cout << "Total ice cream sales: " << total << endl;
        cout << "Top sales: ";
        for (auto top: v2) {
            if (top.second == max) {
                cout << top.first << " ";
            }
        }
    }
}

# 0479, 2024-10-15 14:01:58, -P------- (11%)

#include <iostream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    map<string, double> ice;
    int n;
    cin >> n;
    
    string x;
    double y;
    while (n--) {
        cin >> x >> y;
        ice[x] = y;
    }
    
    string w;
    double z;
    int m;
    int sell = 0;
    cin >> m;
    while (m--) {
        cin >> w >> z ;
        auto itr = ice.find(w);
        if (itr != ice.end()) {
            itr->second *= z;
            sell += itr->second;
        }
    }
    
    auto top = max_element(ice.begin(), ice.end(),
                                [](const pair<string, int>& p1, const pair<string, int>& p2) {
                                    return p1.second < p2.second;
                                });
                                
    if (sell!=0) {
        cout << "Top ice cream sales: " << sell << endl;
        cout << "Top sales : "<< top->first << endl;
    } else {
        cout << "No ice cream sales" << endl;
    }
}

# 0480, 2024-10-15 13:12:10, -P------- (11%)

#include <iostream>

using namespace std;

int main(){
    int N;
    cout << "No ice cream sales";
}

Max Score = 0


# 0481, 2024-10-15 13:26:14, Compilation error (0%)

#include
# 0482, 2024-10-15 13:32:12, --------- (0%)

#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
int main(){
    map<string,double>m;
    int n,mm;
    cin>>n;
    string s;
    int ss;
    for(int i=0;i<n;i++){
        cin>>s>>ss;
        m.insert(pair<string,double>(s, ss));
    }
    double sum=0;
    cin>>mm;
    for(int i=0; i<mm;i++){
        cin>>s>>ss;
        auto itr = m.find(s);
        if(itr!=m.end()){
            sum+=itr->second;
        }
    }
    cout<<sum;
    return 0;
}
# 0483, 2024-10-15 13:50:09, xxxxxxxxx (0%)

#include<iostream>
#include<algorithm>
#include<map>
#include<vector>
using namespace std;
int main(){
    int n,m;
    cin>>n;
    string s[n];
    double a[n];
    double b[n];
    for(int i=0;i<n;i++){
        cin>>s[i]>>a[i];
        b[i]=0;
    }
    string s1[m];
    int a1[m];
    double sum=0;
    for(int i=0;i<n;i++){
        cin>>s1[i]>>a1[i];
        for(int j=0;j<n;j++){
            if(s1[i]==s[j]){
                b[j]+= a1[i]*a[j];
            }
        }
    }
    for(int i=0;i<n;i++){
        sum+=b[i];
    }
    if(sum==0){
        cout<<"No ice cream sales"<<"\n";
    }
    else{
        cout<<"Total ice cream sales: "<<sum<<"\n";
    }
    
    int mx=*max_element(b,b+n);
    for(int i=0;i<n;i++){
        if(mx==b[i]){
            cout<<"Top sales: "<<s[i];
            return 0;
        }
    }
    return 0;
}

# 0484, 2024-10-15 13:49:20, Compilation error (0%)

```c++
#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}
```
# 0485, 2024-10-15 13:49:31, Compilation error (0%)

```c++
#include <bits/stdc++.h>
using namespace std;
int main(){
    string x;
    int n,m,z,mx=INT_MIN;
    map<string,int> s;
    double y,sum=0;
    map<string,double> mp;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x>>y;
        mp.insert({x,y});
    }
    cin>>m;
    while(m--){
        cin>>x>>z;
        if(mp.find(x)!=mp.end()){
            sum+=mp[x]*z;
            s[x]+=mp[x]*z;
            mx=max(mx,s[x]);
        }
    }
    if(sum==0)cout<<"No ice cream sales";
    else{
        cout<<"Total ice cream sales: "<<sum<<endl;
        cout<<"Top sales: ";
        for(auto e:s){
            if(e.second==mx)cout<<e.first<<" ";
        }
    }
}
```

# 0486, 2024-10-15 13:17:23, Compilation error (0%)

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

int main()
{
  cout << "Hello World";
  return 0;
}
# 0487, 2024-10-15 13:17:34, --------- (0%)

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

int main()
{
  cout << "Hello World";
  return 0;
}

# 0488, 2024-10-15 13:47:36, Compilation error (0%)

#incldue<iostream>
using namespace std;
int main(){
  cout << "hello"<<endl;
}
# 0489, 2024-10-15 13:48:25, Compilation error (0%)

#incldue<iostream>
using namespace std;
int main(){
  cout << "No ice cream sales"<<endl;
}

# 0490, 2024-10-15 13:30:36, Compilation error (0%)

#include <iostream>
using namespace std;
int main() {
  
  cout << 1330
}
# 0491, 2024-10-15 13:30:57, --------- (0%)

#include <iostream>
using namespace std;
int main() {
  
  cout << 1330;
}

# 0492, 2024-10-15 13:46:22, Compilation error (0%)

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    string a;
    double b;
    map<string, double> m1;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        m1[a] = b;
    }
    map<string, double> m2;
    int m;
    cin >> m;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        // m2[a] = b;
        // auto itr = m1.begin();
        for(auto itr = m1.begin(); itr!=m1.end(); itr++){
            if((*itr).first==a){
                m2[a] = m2[a] + b;
            }
        }
    }
    for(auto itr = m1.begin(); itr !=m1.end();itr++){
        if(m2.find((*itr).first)!=m2.end()){
            (*itr).second = (*itr).second * 

        }
        // for(auto itl = m2.begin(); itl !=m2.end();itl++){
        //     if((*itr).first == (*itl).first){
        //         (*itr).second =* (*itl).second;
        //     }
        //     if()
        // }
        
    }
    for(auto itr = m2.begin(); itr !=m2.end();itr++){
        cout << endl << (*itr).first << " " << (*itr).second << endl;

    }
    return 0;
}
# 0493, 2024-10-15 13:53:19, --------- (0%)

#include<iostream>
using namespace std;
int main(){
  cout << "Hello world";
  return 0;
}

# 0494, 2024-10-15 13:16:50, Compilation error (0%)

.

# 0495, 2024-10-15 13:10:50, --------- (0%)

#include<iostream>
#include<map>

using namespace std;

int main()
{
  
}

# 0496, 2024-10-15 13:11:21, --------- (0%)

#include <iostream>
#include <set>
using namespace std;
int main() {
    double k , input ;
    int count = 0 ;
    cin >> k ;
    set<double> num ;
    while (cin >> input) {
        num.insert(input) ;
    }
    for (double e : num) {
        if (e < k/2) {
            if (num.find(k-e) != num.end()) {
                count++ ;
            }
        } else break ;
    }
    cout << count ;
}

# 0497, 2024-10-15 13:53:12, Compilation error (0%)

ok

# 0498, 2024-10-15 13:31:01, Compilation error (0%)

#include <iostream>
#include <map>
#include <string>
#include <iomanip>  // for setprecision

using namespace std;

int main() {
    int N, M;
    cin >> N;
    
    // Map to store the price of each ice cream
    map<string, double> iceCreamPrices;
    
    for (int i = 0; i < N; i++) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }
    
    cin >> M;
    
   
    map<string, int> iceCreamSales;
    double totalSales = 0;
    
    for (int i = 0; i < M; i++) {
        string name;
        int quantity;
        cin >> name >> quantity;
        
        iceCreamSales[name] += quantity;
        

        totalSales += quantity * iceCreamPrices[name];
    }
    
    if (iceCreamSales.empty()) {
        cout << "No ice cream sales" << endl;
        return 0;
    }
    
    
    int maxSales = 0;
    for (const auto& sale : iceCreamSales) {
        if (sale.second > maxSales) {
            maxSales = sale.second;
        }
    }
    
    
    cout << fixed << setprecision(2);
    cout << "Total ice cream sales: " << totalSales << endl;
    
   
    cout << "Top sales: ";
    bool first = true;
    for (const auto& sale : iceCreamSales) {
        if (sale.second == maxSales) {
            if (!first) {
                cout << " ";
            }
            cout << sale.first;
            first = false;
        }
    }
    cout << endl;

# 0499, 2024-10-15 13:11:09, --------- (0%)

#include <iostream>

using namespace std;

int main()
{
  cout << "Hello World";
}

# 0500, 2024-10-15 13:08:42, Compilation error (0%)

#include <iostream>

//ยังไม่ได้เรียนค่ะะ ;^;

# 0501, 2024-10-15 13:08:17, Compilation error (0%)

#include<iostream>

# 0502, 2024-10-15 13:55:35, --------- (0%)

#include<iostream>

using namespace std;

int main()

{

    cout << "Hello World C++";

   

    return 0;

}

# 0503, 2024-10-15 13:28:32, --------- (0%)

#include <iostream>
using namespace std;
int main(){
  cout << "hello world";
}

# 0504, 2024-10-15 13:08:16, --------- (0%)

#include<iostream>

using namespace std;

int main(){
  cout << "sorry";
  return 0;
}

# 0505, 2024-10-15 13:17:24, Compilation error (0%)

;

# 0506, 2024-10-15 13:50:54, Compilation error (0%)

#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, M;
    cin >> N;

    map<string, double> iceCreamPrices;
    for (int i = 0; i < N; ++i) {
        string name;
        double price;
        cin >> name >> price;
        iceCreamPrices[name] = price;
    }

    cin >> M;
้
    map<string, int> iceCreamSales;
    double totalSales = 0;
    for (int i = 0; i < M; ++i) {
        string item;
        int quantity;
        cin >> item >> quantity;
        if (iceCreamPrices.count(item)) {
            iceCreamSales[item] += quantity;
            totalSales += iceCreamPrices[item] * quantity;
        }
    }

    vector<pair<string, int>> topSales;
    for (auto& sale : iceCreamSales) {
        topSales.push_back(sale);
    }
    sort(topSales.begin(), topSales.end()); 

    if (totalSales == 0) {
        cout << "No ice cream sales" << endl;
    } else {
        cout << "Total ice cream sales: " << totalSales << endl;
        cout << "Top sales: ";
        bool first = true;
        for (auto& sale : topSales) {
            if (!first) {
                cout << " ";
            }
            cout << sale.first;
            first = false;
        }
        cout << endl;
    }

    return 0;
}

# 0507, 2024-10-15 13:19:17, Compilation error (0%)

#include <iostream>

# 0508, 2024-10-15 13:50:46, Compilation error (0%)

#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
	int menucnt;
	cin >> menucnt;
	map<string ,int> menus;
	string tempstr; int tempint;
	for(int i=menucnt; i>0; i--){
		cin >> tempstr >> tempint;
		menus[tempstr]=tempint;
	}
	/*
	int ordercnt;
	cin >> ordercnt;
	map<string, int> orders;
	for(int i=ordercnt; i>0; i--){
		cin >> tempstr >> tempint;
		orders[tempstr]=tempint;
	}
	*/
	string test; cin >> test;
	if(menus.at(test)==std::out_of_range){
		cout << "OUt of rangge\n";
	}
	//cout << menus[out] << '\n';
	//cout << menus[out] *15 << '\n';
}

# 0509, 2024-10-15 13:14:46, Compilation error (0%)

d

# 0510, 2024-10-15 13:11:13, Compilation error (0%)

#include <iostream>
#include <set>

using namespace std;

int main() {
    int k;
    set<int> s;
    cin >> k >> s;
    int count = 0;

    for (int i=0; i<s; i++;) {
         if (s[0] + s[i] == k) {
            count += 1;
         }
    }
}

# 0511, 2024-10-15 13:22:43, Compilation error (0%)

lkegjl;jlfka

# 0512, 2024-10-15 13:07:21, Compilation error (0%)

a

# 0513, 2024-10-15 13:09:23, Compilation error (0%)

#include <iostream>

# 0514, 2024-10-15 13:12:40, Compilation error (0%)

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

int main(
  )

# 0515, 2024-10-15 13:54:21, Compilation error (0%)

shsheheh

# 0516, 2024-10-15 14:01:15, --------- (0%)

#include <iostream>
#include <map>
#include <string>

using namespace std;

int main() {
    map < string, int > menu {};

    int N;
    cin >> N;

    for (int i = 0; i < N; i++){
        string tag;
        int prize;
        cin >> tag >> prize;
        menu.insert(make_pair(tag,prize));
    }

    cout << menu["Magnum"] << endl;

}

# 0517, 2024-10-15 13:12:06, TTTTTTTTT (0%)

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int i, sum, n;
    n = 0;
    sum = 0;
    while (i != -1)
    {
        int i;
        cin >> i;
        if (i == -1)
        {
            break;
        }
        sum = sum + i;
        n++;
cout << sum<<endl;
    }
    if (n != 0)
    {
        int avg = (sum) / n;
        cout << round(avg * 100) / 100;
    }else{
        cout << "No Data";
    }
}

# 0518, 2024-10-15 13:11:47, --------- (0%)

#include <bits/stdc++.h>

using namespace std;

int main(){
    string s, x, z, w;
    double y;
    vector<string> a, c;
    vector<double> b, bb;
    vector<bool> d;
    while(getline(cin,s)){
        if(s == "END") break;
        stringstream ss(s);
        ss >> x;
        ss >> y;
        a.push_back(x);
        b.push_back(y);
        bb.push_back(0);
        d.push_back(false);
    }

    getline(cin,z);
    stringstream ss(z);
    while(ss>>w){
        c.push_back(w);
    }

    bool ch = false;
    for(int i=0;i<c.size();i++){
        for(int j=0;j<a.size();j++){
            if(c[i]==a[j]){
                bb[j] += b[j];
                ch = true;
                d[j] = true;
                break;
            }
        }
    }

    if(ch){
        for(int i=0;i<3;i++){
            auto p = max_element(bb.begin(),bb.end());
            int q = distance(bb.begin(),p);
            if(d[q]==true){
                cout << a[q] << ' ' << bb[q] << endl;
                a.erase(a.begin()+q);
                bb.erase(bb.begin()+q);
                d.erase(d.begin()+q);
            }
        }
    }else {cout << "No Sales";}
}

# 0519, 2024-10-15 13:51:22, --------- (0%)

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

int main(){
    int n;
    cin >> n;
    int input , count = 0;
    set<int> data;
    while (cin >> input){
        data.insert(input);
    }
    for (auto a : data){
        if (data.find(n - a) != data.end() && a < n - a){
            ++count;
        }
    }
    cout << count;
    
}

# 0520, 2024-10-15 13:50:52, Compilation error (0%)

#include<iostream>
using namespace std;

int main(){
  cout>>"hello";
}

# 0521, 2024-10-15 13:08:41, Compilation error (0%)

#include<iostream>

# 0522, 2024-10-15 13:23:15, Compilation error (0%)

#include<iostream>
#include<map>

using namespace std ;

//08_Map_★★_Ice_Cream_Sales
int(){
    int N;
    cin >> N;
    
    


}

# 0523, 2024-10-15 13:17:31, --------- (0%)

#include<iostream>
using namespace std;
int main(){
  
}

# 0524, 2024-10-15 13:29:32, xxxxxxxxx (0%)

#include<iostream>
using namespace std;
int main(){
    string line;
    getline(cin,line);
    int num = 0;
    int time[3] = {stoi(line.substr(0,2)),stoi(line.substr(3,2)),stoi(line.substr(6,2))}; 
    char clock[4][6] = {'0'};
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 6; j++){
            if(j <= 1){//hour
                if(j == 0){
                    int temp = time[0]/10;
                    if(i == 0 & i == 1) clock[i][j] = ' ';
                    else if(temp == 1 ) clock[3][j] = '1';
                    else if(temp == 2 ) clock[2][j] = '1';
                }else{// j == '1';
                    int temp = time[0]%10;
                    if(temp >= 8){
                        clock[i][j] = '1';
                        temp -= 8;
                    }else if(temp >= 4){
                        clock[i][j] = '1';
                        temp -= 4;
                    }else if(temp >= 2){
                        clock[i][j] = '1';
                        temp -= 2;
                    }else if(temp >= 1){
                        clock[i][j] = '1';
                        temp -= '1';
                    }
                }
            }else if (j <= 3){//min
            
            }else if (j){//sec

            }         
        }
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 6; j++){
            cout << clock[i][j];
        }
        cout << '\n';
    }
}

# 0525, 2024-10-15 13:42:21, xxxxxxxxx (0%)

#include <bits/stdc++.h>
using namespace std;
int main(){
    set<int> s;
    int sum,cnt=0,x;
    cin>>sum;
    while(cin>>x)s.insert(x);
    auto it1=s.begin(),it2=s.end();it2--;
    for(auto e:s){
        if((*it1)+(*it2)>sum)it2--;
        else if((*it1)+(*it2)<sum)it1++;
        else if((*it1)+(*it2)==sum && it1!=it2){cnt++;it2--;}
    }
    cout<<cnt;
}