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
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("sse,sse2,abm,mmx,sse3,tune=native")
using namespace std;
typedef long long lld;
typedef pair<int, int> pii;
typedef pair<lld, lld> pll;
#define ff first
#define dd second
#define mp make_pair
#define pb push_back
#define sz size()
#define For(i, s, a) for(int i = s; i < a; ++i)
#define all(x) (x).begin(), (x).end()
#define make_unique(x) (x).erase(unique(all(x)), (x).end())

int a[11], b[11];

int rd(int *x) {
    int ct = 0;
    For (i, 0, 18) {
        int g;
        scanf("%d", &g);
        x[g]++;
        ct += g;
    }
    return ct;
}

bool finished(int sma, int smb) {
    if (sma > smb) {
        puts("Algosia");
        return 1;
    }
    if (smb > sma) {
        puts("Bajtek");
        return 1;
    }
    return 0;
}

int main(void) {
    int sma = rd(a), smb = rd(b);
    if (finished(sma, smb))
        return 0;
    For (i, 0, 10) {
        sma = a[10 - i];
        smb = b[10 - i];
        if (finished(sma, smb))
            return 0;
    }
    puts("remis");
}