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

using namespace std;

#define retif(cond) if (cond) return

#define A cout << "Algosia\n", 0
#define B cout << "Bajtek\n", 0

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

    int s[2] = {};
    int c[2][16] = {};

    for (int i : {0, 1}) {
        for (int j = 0; j < 18; ++j) {
            int x;
            cin >> x;
            s[i] += x;
            ++c[i][x];
        }
    }
    retif(s[0] > s[1]) A;
    retif(s[0] < s[1]) B;
    for (int i = 10; i > 0; --i) {
        retif(c[0][i] > c[1][i]) A;
        retif(c[0][i] < c[1][i]) B;
    }
    cout << "remis\n";

    return 0;
}