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

using namespace std;

int alg[15];
int baj[15];

int main(){
    int as = 0,bs = 0;
    int tmp;
    for(int i = 0; i < 18; i++){
        cin >> tmp;
        alg[tmp]++;
        as += tmp;
    }
    for(int i = 0; i < 18; i++){
        cin >> tmp;
        baj[tmp]++;
        bs += tmp;
    }
    if(as == bs){
        tmp = 10;
        while(tmp >= 0 && alg[tmp] == baj[tmp]){
            tmp--;
        }
        if(tmp == -1){
            cout << "remis\n";
            return 0;
        }
        as = alg[tmp];
        bs = baj[tmp];
    }
    if(as > bs){
        cout << "Algosia\n";
    } else {
        cout << "Bajtek\n";
    }
    return 0;
}