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
#include <bits/stdc++.h>
using namespace std;
int a, sumaA, sumaB;
int wynA[11];
int wynB[11];

int main() {

    for (int i = 0; i < 18; i++) {
        cin >> a;
        wynA[a]++;
    }
    for (int i = 0; i < 18; i++) {
        cin >> a;
        wynB[a]++;
    }
    
    for (int i = 1; i <= 10; i++) {
        sumaA += wynA[i]*i;
        sumaB += wynB[i]*i;
    }
    if (sumaA > sumaB) cout << "Algosia";
    else if (sumaA < sumaB) cout << "Bajtek";
    else {
        for (int i = 10; i >= 1; i--) {
            if (wynA[i] > wynB[i]) {
                cout << "Algosia";
                return 0;
            }
            if (wynA[i] < wynB[i]) {
                cout << "Bajtek";
                return 0;
            }
        }
        cout << "remis";
    }
}