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
#include <iostream>
using namespace std;

int algosia_sum [12];
int bajtek_sum [12];

const char *msg[] = {"Bajtek\n", "Algosia\n", "remis\n"};

int main()
{
	int ret = 0;
	for(int i = 0; i < 18; i++) {
		int s = 0;
		cin >> s;
		algosia_sum[s]++;
		algosia_sum[11]+=s;
	}
	for(int i = 0; i < 18; i++) {
		int s = 0;
		cin >> s;
		bajtek_sum[s]++;
		bajtek_sum[11]+=s;
	}
	int i = 11;
	for(; i >= 0; i--) {
		if(bajtek_sum[i] != algosia_sum[i]) {
			ret = bajtek_sum[i] < algosia_sum[i];
			break;
		}
	}
	if(i < 0)
		ret = 2;

	cout<<msg[ret];
	return 0;
}