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
44
45
46
47
48
49
50
51
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

void out(int x){
	if(x==0)
		cout<<"Algosia\n";
	else if(x==1)
		cout<<"Bajtek\n";
	else
		cout<<"remis\n";
	exit(0);
}

void solve(){
	int s1,s2;
	s1=s2=0;
	vector<int>cnt1,cnt2;
	cnt1=cnt2=vector<int>(11,0);
	for(int i=0,x;i<18;++i){
		cin>>x;
		s1+=x;
		++cnt1[x];
	}
	for(int i=0,x;i<18;++i){
		cin>>x;
		s2+=x;
		++cnt2[x];
	}

	//cout<<s1<<' '<<s2<<'\n';

	if(s1>s2)out(0);
	if(s2>s1)out(1);
	for(int i=10;i>=0;--i){
		//cout<<cnt1[i]<<' '<<cnt2[i]<<'\n';
		if(cnt1[i]==cnt2[i])continue;
		out(cnt1[i]<cnt2[i]);
	}
	out(3);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--)
		solve();
}