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
#include<bits/stdc++.h>

using namespace std;

int main () {
	int a=0,b=0;
	int ar[11]={}, br[11]={};
	for (int i = 0; i < 18; ++i) {
		int temp;
		cin>>temp;
		a+=temp;
		ar[10-temp]++;
	}
	for (int i = 0; i < 18; ++i) {
		int temp;
		cin>>temp;
		b+=temp;
		br[10-temp]++;
	}
	/*printf("%.3d %.3d \n", a, b);
	for (int i = 0; i < 10; i++) {
		printf("%.2d %.2d \n", ar[i], br[i]);
	}*/
	if (a>b) cout<<"Algosia\n";
	else if (b>a) cout<<"Bajtek\n";
	else {
		int i = 0;
		while (ar[i]==br[i]) {
			++i;
			if (i==9) break;
		}
		//cout<<i<<endl;
		if (ar[i]>br[i]) cout<<"Algosia\n";
		else if (br[i]>ar[i]) cout<<"Bajtek\n";
		else cout<<"remis\n";
	}
	return 0;
}