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

using namespace std;
constexpr int M = 12;
int ile1[M];
int ile2[M];
int main(){
	cin.tie(0)->sync_with_stdio(0);
	int suma1 = 0;
	int suma2 = 0;
	for(int i=1; i<=18; i++){
		int temp;
		cin>>temp;
		ile1[temp]++;
		suma1+=temp;
	}
	for(int i=1; i<=18; i++){
		int temp;
		cin>>temp;
		ile2[temp]++;
		suma2+=temp;
	}
	if(suma1 > suma2){
		cout<<"Algosia"<<endl;
		return 0;
	}
	if(suma2 > suma1){
		cout<<"Bajtek"<<endl;
		return 0;
	}
	for(int i=10; i>=0; i--){
		if(ile1[i] > ile2[i]){
			cout<<"Algosia"<<endl;
			return 0;
		}
		if(ile2[i] > ile1[i]){
			cout<<"Bajtek"<<endl;
			return 0;
		}
	}
	cout<<"remis"<<endl;
	return 0;
}