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
43
44
45
46
47
48
49
50
#include <bits/stdc++.h>
using namespace std;

const char *results[] = { "Algosia", "remis", "Bajtek" };
const int N = 18;
const int L = 11;
int aCounter[L] = { 0 };
int bCounter[L] = { 0 };
int main() {
//	ifstream cin("tests/0a.in");

	cin.tie(NULL);
	cout.tie(NULL);
	ios_base::sync_with_stdio(false);

	int sumA = 0;
	int sumB = 0;
	int tmp;
	for (int i = 0; i < N; i++) {
		cin >> tmp;
		sumA += tmp;
		aCounter[tmp]++;
	}
	for (int i = 0; i < N; i++) {
		cin >> tmp;
		sumB += tmp;
		bCounter[tmp]++;
	}

	int resultIndex = 1;
	if (sumA > sumB) {
		resultIndex = 0;
	} else if (sumA < sumB) {
		resultIndex = 2;
	} else {
		for (int i = L - 1; i >= 0; i--) {
			if (aCounter[i] > bCounter[i]) {
				resultIndex = 0;
				break;
			} else if (aCounter[i] < bCounter[i]) {
				resultIndex = 2;
				break;
			}
		}
	}

	cout << results[resultIndex] << endl;

	return 0;
}