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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;

typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<long long> VL;
typedef vector<vector<long long>> VVL;

typedef vector<char> VC;
typedef vector<vector<char>> VVC;
typedef vector<bool> VB;
typedef vector<vector<bool>> VVB;

typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<pair<int, int>> VPI;
typedef vector<pair<long long, long long>> VPL;

#define LINE '\n'
#define SPACE ' '
#define PB push_back
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(x) x.begin(), x.end()

string getWinner(VI algo, VI bajt, int n) 
{
    VI ct_a(11), ct_b(11);
    FOR(i, 0, n) {
        ct_a[algo[i]]++;
        ct_b[bajt[i]]++;
    }

    for(int i = 10; i >= 0; i--) {
        if(ct_a[i] > ct_b[i]) return "Algosia";
        else if(ct_a[i] < ct_b[i]) return "Bajtek";
    }

    return "remis";
}

void solve()
{
    int n = 18;

    VI algo(n), bajt(n);
    int a_sum = 0, b_sum = 0;
    FOR(i, 0, n)
    {
        cin >> algo[i];
        a_sum += algo[i];
    }

    FOR(i, 0, n)
    {
        cin >> bajt[i];
        b_sum += bajt[i];
    }

    if (a_sum > b_sum)
    {
        cout << "Algosia" << LINE;
    }
    else if (a_sum < b_sum)
    {
        cout << "Bajtek" << LINE;
    }
    else
    {
        cout << getWinner(algo, bajt, n) << LINE;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t = 1;
    // cin >> t;

    while (t--)
        solve();
}