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
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = a; i < b;++i)
#define pb emplace_back
using namespace std;
int main(){
    int s = 0,s1 = 0;
    vector<int> V(11,0),V1(11,0);
    FOR(i,0,18){
        int x;
        cin>>x;
        s+=x;
        V[x]++;
    }
    FOR(i,0,18){
        int x;
        cin>>x;
        s1+=x;
        V1[x]++;
    }
    reverse(V.begin(),V.end());
    reverse(V1.begin(),V1.end());
    if(s > s1 || (s == s1 && V > V1)){
        cout<<"Algosia";
        return 0;
    }
    if(s1 > s || (s == s1 && V1 > V)){
        cout<<"Bajtek";
        return 0;
    }
    cout<<"remis";
}