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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//zadanie kto wygral potyczki algorytmiczne
#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define pb push_back
#define ll long long
const char nl = '\n';
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define forab(i, a, b) for (int i=a; i<(b); i++)
#define st first
#define nd second
#define mp make_pair
typedef vector<int> vi;
typedef vector<ll> vl;

const int n = 18;
const int d = 10;

int A = 0, B = 0;
vi ca(d + 1), cb(d + 1);


int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);

    //wczytanie algosi
    for(int i = 0; i < n; ++i){
        int x; cin >> x;
        ca[x]++;
        A += x;
    }

    //wczytanie bajtka
    for(int i = 0; i < n; ++i){
        int x; cin >> x;
        cb[x]++;
        B += x;
    }

    //ify
    //cout << "test2";
    if(A > B){
        cout << "Algosia" << nl;
        return 0;
    } else
    if(A < B){
        cout << "Bajtek" << nl;
        return 0;
    }
    //cout << A <<nl;
    //cout << B <<nl;

    //petla sprawdzajaca
    for(int i = d-1; i >= 0; --i){
        //debug
        //cout << ca[i] << nl;
        //cout << cb[i] << nl;
        
        if(ca[i] > cb[i]){
            cout << "Algosia" << nl;
            return 0;
        } else
        if(ca[i] < cb[i]){
            cout << "Bajtek" << nl;
            return 0;
        }
    }
    cout << "remis" << nl;
    return 0;
}