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

#define MAGICZNE_ZAKLECIE std::ios::sync_with_stdio(0);\
    cin.tie(0);\
    cout.tie(0);

#define player0 "Algosia"
#define player1 "Bajtek"
#define draw "remis"

int main() {
    MAGICZNE_ZAKLECIE;

    int score[2][18];
    for (int i: {0, 1}) {
        for (int j = 0; j < 18; j++) {
            cin >> score[i][j];
        }
    }

    {
        int sum[2] = {0 ,0};
        for (int i: {0, 1}) {
            for (int j = 0; j < 18; j++) {
                sum[i] += score[i][j];
            }
        }
        if (sum[0] != sum[1]) {
            cout << ((sum[0] > sum[1]) ? player0 : player1);
            return 0;
        }
    }

    for (int h = 10; h >= 0;  h--) {
        int count[2] = {0, 0};
        for (int i: {0, 1}) {
            for (int j = 0; j < 18; j++) {
                count[i] += score[i][j] == h;
            }
        }
        if (count[0] != count[1]) {
            cout << ((count[0] > count[1]) ? player0 : player1);
            return 0;
        }
    }


    cout << draw;
}