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
#include <iostream>
#include <vector>

using namespace std;


int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int suma_a, suma_b;
	suma_a = suma_b = 0;
	vector<int> occur_a(11, 0);
	vector<int> occur_b(11, 0);
	for (int i = 0; i < 18; i++) {
		int a;
		cin >> a;
		suma_a += a;
		occur_a[a]++;
	}
	for (int i = 0; i < 18; i++) {
		int a;
		cin >> a;
		suma_b += a;
		occur_b[a]++;
	}
	if (suma_a > suma_b) {
		cout << "Algosia" << "\n";
		return 0;
	} else if (suma_b > suma_a) {
		cout << "Bajtek" << "\n";
		return 0;
	}
	int i = 10;
	while (i > 0) {
		if (occur_a[i] > occur_b[i]) {
			cout << "Algosia" << "\n";
			return 0;
		} else if (occur_a[i] < occur_b[i]) {
			cout << "Bajtek" << "\n";
			return 0;
		}
		i--;
	}
	cout << "remis" << "\n";
	return 0;
}