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

using namespace std;
long long tab[20][2];
int main(){
    long long suma1 = 0, suma2 = 0;
    for(int i = 0; i < 18; i++){
        int j;
        cin>>j;
        tab[j][0]++;
        suma1 += j;
    }
    for(int i = 0; i < 18; i++){
        int j;
        cin>>j;
        tab[j][1]++;
        suma2 += j;
    }
    // for(int i = 0; i <= 10; i++){
    //     cout<<tab[i][0]<<" ";
    // }
    // cout<<"\n";
    // for(int i = 0; i <= 10; i++){
    //     cout<<tab[i][1]<<" ";
    // }
    if(suma1 < suma2){
        cout<<"Bajtek";
    }else{
        if(suma1 > suma2){
            cout<<"Algosia";
        }else{
            for(int i = 17; i >= 0; i--){
                if(tab[i][0] < tab[i][1]){
                    cout<<"Bajtek";
                    return 0;
                }else{
                    if(tab[i][0] > tab[i][1]){
                        cout<<"Algosia";
                        return 0;
                    }
                }
            
            }
            cout<<"remis";
        }
    }
}