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

using namespace std;

const char* algosia = "Algosia";
const char* bajtek = "Bajtek";
const char* remis = "remis";

int a_sum = 0, b_sum = 0;
vector<int> a_counter(11, 0);
vector<int> b_counter(11, 0);

const char* who_won() {
	if (a_sum > b_sum) return algosia;
	if (b_sum > a_sum) return bajtek;
	for (int i = 10; i > 0; i--) {
		if (a_counter[i] > b_counter[i]) return algosia;
		if (b_counter[i] > a_counter[i]) return bajtek;
	}
	return remis;
}

int main() {

	int d;
	for(int i = 0; i < 18; i++) {
		scanf("%d", &d);
		a_sum += d;
		a_counter[d]++;
	}
	for (int i = 0; i < 18; i++) {
		scanf("%d", &d);
		b_sum += d;
		b_counter[d]++;
	}

	printf("%s\n", who_won());
}