BENCHP ! NEED HELP ! Partially correct

My code is partially correct, Can someone tell what is the problem?

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

int main()
{
int T;
cin>>T;
while(T–){
int N,W,wr;
cin>>N>>W>>wr;
int a[N];

    unordered_map<int,int> m;

    for(int i=0;i<N;i++)
    {
        cin>>a[i];
        m[a[i]]++;
    }
    
    if(wr>=W){
        cout<<"YES\n";

    }
    else if(W>wr){
        int sum=0;
        for(auto itr:m){
            if(itr.second%2==0){
            sum+= itr.first*itr.second;
            }
            else{
                sum+=itr.first*(itr.second-1);
            }
        }

        if(sum+wr>=W){
            cout<<"YES\n";
        }else{
            cout<<"NO\n";
        }
        

    }

}




return 0;

}

Use long long instead of int to avoid overflow

Thank you so muchh, these silly mistakes cost me 2 questions unsubmitted last night.

use this code instead. with sum, unorder_map long long

https://www.codechef.com/viewsolution/45700143