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
// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n = 2, m = 18;
	vector<vector<int>> a(n, vector<int>(m));
	for(auto &x: a | ranges::views::join){
		cin >> x;
	}
	if(accumulate(a[0].begin(), a[0].end(), 0LL) != accumulate(a[1].begin(), a[1].end(), 0LL)){
		accumulate(a[0].begin(), a[0].end(), 0LL) > accumulate(a[1].begin(), a[1].end(), 0LL) ? cout << "Algosia\n" : cout << "Bajtek\n";
		return 0;
	}
	array<array<int, 11>, 2> cnt{};
	for(auto i = 0; i < n; ++ i){
		for(auto j = 0; j < m; ++ j){
			++ cnt[i][a[i][j]];
		}
	}
	for(auto x = 10; x >= 0; -- x){
		if(cnt[0][x] != cnt[1][x]){
			cnt[0][x] > cnt[1][x] ? cout << "Algosia\n" : cout << "Bajtek\n";
			return 0;
		}
	}
	cout << "remis\n";
	return 0;
}

/*

*/