Whats wrong with my solution. (Bench Press Problem Code: BENCHP)

#include
#include
#include
#include
#include
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define ln ‘\n’
typedef long long ll;

int arr[long(1e5)];

void solve()
{
ll n, w, wr;
cin >> n >> w >> wr;

for(int i=0; i<n; i++)
	cin >> arr[i];

if(wr >= w) {
	cout << "YES" << ln;
	return;
}

unordered_map<int, int> freq;
for(int i=0; i<n; i++) 
	freq[arr[i]]++;



ll sum = wr;
for(pair<int, int> i : freq) {
	sum += i.first * ((i.second / 2) * 2);
}

if(sum >= w)
	cout << "YES" << ln;
else
	cout << "NO" << ln;

}

int main()
{

#ifndef ONLINE_JUDGE
freopen(“inputf.in”, “r”, stdin);
freopen(“outputf.in”, “w”, stdout);
#endif

ll t;
cin >> t;
while(t--)	
solve();

return 0;

}

Hey,
I don’t know much about c programming. But, I think the problem lies here int arr[long(1e5)]; you’ve defined it globally. You should define it locally.
Correct me if I’m wrong.
All the best.

Array must be local and limited to size n. You may define the array of size n locally