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
52
53
54
55
56
57
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<algorithm>
#include<cmath>
#include<iomanip>

using namespace std;
using ll = long long;
using ull = unsigned long long;

int main()
{
	vector<int>a, b;
	int A = 0, B = 0;
	for (int i = 0; i < 18; i++)
	{
		int x; cin >> x;
		A += x;
		a.push_back(x);
	}
	for (int i = 0; i < 18; i++)
	{
		int x; cin >> x;
		B += x;
		b.push_back(x);
	}
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	bool bl = true;
	if (A > B)
	{
		cout << "Algosia\n";
		bl = false;
	}
	else if (B > A)
	{
		cout << "Bajtek\n";
		bl = false;
	}
	for (int i = 0; i < 18 && bl; i++)
	{
		if (a[17 - i] > b[17 - i])
		{
			cout << "Algosia\n";
			bl = false;
		}
		else if(b[17 - i] > a[17 - i])
		{
			cout << "Bajtek\n";
			bl = false;
		}
	}
	if (bl)cout << "remis\n";
}