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
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define x first
#define y second
const int maxN=1e2+10;
int sum1, sum2, input1[maxN], input2[maxN];
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    for(int i=0;i<18;i++)
    {
        cin>>input1[i];
        sum1+=input1[i];
    }
    for(int i=0;i<18;i++)
    {
        cin>>input2[i];
        sum2+=input2[i];
    }
    if(sum1>sum2)
    {
        cout<<"Algosia\n";
        return 0;
    } 
    if(sum1<sum2)
    {
        cout<<"Bajtek\n";
        return 0;
    }
    sort(input1, input1+18);
    sort(input2, input2+18);
    for(int i=17;i>=0;i--)
    {
        if(input2[i]!=input1[i])
        {
            if(input1[i]<input2[i])
            {
                cout<<"Bajtek\n";
                return 0;
            }else
            {
                cout<<"Algosia\n";
                return 0;
            }
        }
    }
    cout<<"remis\n";
}