1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

string wa = "Algosia\n", wb = "Bajtek\n";
vector<short> a, b;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	int n = 18, sum = 0;
	for (int i=0; i<n; i++){
		int t; cin >> t;
		sum += t;
		a.pb(t);
	}
	for (int i=0; i<n; i++){
		int t; cin >> t;
		sum -= t;
		b.pb(t);
	}
	
	if (sum != 0){
		cout << (sum > 0 ? wa : wb);
		return 0;
	}

	sort(a.begin(),a.end(),greater<int>());
	sort(b.begin(),b.end(),greater<int>());
	
	
	for (int i=0; i<n; i++){
		if (a[i] == b[i]) continue;
		cout << (a[i] > b[i] ? wa : wb);
		return 0;
	}
	cout << "remis\n";
	return 0;

}