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

int main() {
    int size = 18;
    vector<int> alg(size), baj(size);
    for (int i = 0; i < size; i++) {
        cin >> alg[i];
    }
    for (int i = 0; i < size; i++) {
        cin >> baj[i];
    }
    int sumA = reduce(alg.begin(), alg.end());
    int sumB = reduce(baj.begin(), baj.end());
    
    if (sumA > sumB) {
        cout << "Algosia";
    }
    if (sumB > sumA) {
        cout << "Bajtek";
    }
    if (sumA == sumB) {
        for (int check = 10; check >= 0; check--) {
            int maxA = 0;
            int maxB = 0;
            for (int i = 0; i < size; i++) {
                if (alg[i] == check) {
                    maxA++;
                }
                if (baj[i] == check) {
                    maxB++;
                }
            }
            if (maxA > maxB) {
                cout << "Algosia";
                return 0;
            }
            if (maxB > maxA) {
                cout << "Bajtek";
                return 0;
            }
        }
    }
    cout << "remis";
    return 0;
}