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

using namespace std;

int main(){
	int a1=0,b1=0,t;
	bool c = 0;
	int a[10];
	int b[10];

	fill(a,a+10,0);
	fill(b,b+10,0);
	for(int i = 18; i != 0; i--){
	cin >> t;
	a1 += t;
	a[t-1]++;
	}
	for(int i = 18; i != 0; i--){
	cin >> t;
	b1 += t;
	b[t-1]++;
	}
	if(a1 > b1)cout << "Algosia";
	else if(b1 > a1)cout << "Bajtek";
	else{ for(int i=9;i>=0;i++){
		if(a[i] > b[i]){
			cout << "Algosia";
			c = 1;
			break;
		}
		else if(b[i] > a[i]){
			cout << "Bajtek";
			c = 1;
			break;
		}
		}
		if(c==0)cout<<"remis";
	}
}