RTE on ANUMALA

On problem ANUMALA I am getting run time error. The program works on my computer, and I tested it against large test cases too. I do not think that it is a memory error. Can somebody please help me find the source of the runtime error? thank you.

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl "\n"
using namespace std;

int t, n, a;
multiset<ll> sums;
vector<ll> prevsums;
long long arr[20];
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> t;

	while(t--) {
		sums.clear();
		prevsums.clear();
		cin >> n;
		for(int i = 0;i < pow(2, n);i ++) {
			cin >> a;
			sums.insert(a);
		}
		sums.erase(sums.begin());
		arr[0] = *sums.begin();
		prevsums.pb(arr[0]);
		sums.erase(sums.begin());
		if(n == 1) goto print;

		arr[1] = *sums.begin();
		sums.erase(sums.begin());
		prevsums.pb(arr[1]);
		if(n == 2) goto print;

		prevsums.pb(arr[0] + arr[1]);
		sums.erase(sums.find(arr[0] + arr[1]));
		arr[2] = *sums.begin();
		if(n == 3) goto print;

		for(int i = 3;i < n;i ++) {
			int s = prevsums.size();
			for(int j = 0;j < s;j ++) {
				prevsums.push_back(prevsums[j] + arr[i - 1]);
				sums.erase(sums.find(prevsums[j] + arr[i - 1]));
			}
			prevsums.pb(arr[i - 1]);
			sums.erase(sums.find(arr[i - 1]));

			arr[i] = *sums.begin();
		}

		print:
		cout << arr[0];
		for(int i = 1;i < n;i ++) {
			cout << " " << arr[i];
		}
		cout << endl;
	}
}

Use long long for ‘a’.

Thank you very much! My solution worked now.