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
#include <bits/stdc++.h>
using namespace std;

const int N = 20;
int Scores[N][2];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int sum1 = 0, sum2 = 0, x;
    for(int i = 0; i < 18; i++) {
        cin >> x;
        sum1 += x;
        Scores[x][0]++;
    }
    for(int i = 0; i < 18; i++) {
        cin >> x;
        sum2 += x;
        Scores[x][1]++;
    }
    //0 - Al, 1- Ba, 2 - Re
    int wins = 2;
    if(sum1 == sum2) {
        for(int i = 10; i >= 0; i--) {
            if(Scores[i][0] > Scores[i][1]) {
                wins = 0;
                break;
            } else if(Scores[i][1] > Scores[i][0]) {
                wins = 1;
                break;
            }
        }
    }
    if(wins == 0 || sum1 > sum2)
        cout << "Algosia";
    else if(wins == 1 || sum2 > sum1)
        cout << "Bajtek";
    else
        cout << "remis";
}