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
#include <iostream>
using namespace std;

int counter[2][11];
int sum[2];
int res;

int main(){
    ios::sync_with_stdio(false);
    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 18; ++j){
            cin >> res;
            sum[i] += res;
            counter[i][res]++;
        }
    }
    if(sum[0] != sum[1]){
        if(sum[0] > sum[1])
            cout << "Algosia";
        else
            cout << "Bajtek";
        return 0;
    }

    for(int i = 10; i >= 0; --i){
        if(counter[0][i] != counter[1][i]){
            if(counter[0][i] > counter[1][i])
                cout << "Algosia";
            else
                cout << "Bajtek";
            return 0;
        }
    }

    cout << "remis";

    return 0;
}