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
#include <iostream>
#include <string>
#include <vector>

using namespace std;

string solve(const vector<int>& sum, const vector<vector<int>>& cnt)
{
	if (sum[0] != sum[1])
		return sum[0] > sum[1] ? "Algosia" : "Bajtek";

	for (int i = 10; i >= 0; --i)
	{
		if (cnt[0][i] != cnt[1][i])
			return cnt[0][i] > cnt[1][i] ? "Algosia" : "Bajtek";
	}

	return "remis";
}

int main()
{
	vector<int> sum(2);
	vector<vector<int>> cnt(2, vector<int>(11));

	int a;

	for (int i = 0; i < 2; ++i)
	{
		for (int j = 0; j < 18; ++j)
		{
			cin >> a;

			sum[i] += a;
			++cnt[i][a];
		}
	}

	string res = solve(sum, cnt);

	cout << res << endl;

	return 0;
}