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
#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

array<int, 19> A,B;

int main()
{
    for(int i=1;i<19;i++) {
        cin >> A[i];
        A[0]+=A[i];
    }
    for(int i=1;i<19;i++) {
        cin >> B[i];
        B[0]+=B[i];
    }
    sort(&A[1],A.end(), greater<int>());
    sort(&B[1],B.end(), greater<int>());
    if(A>B) {
        cout << "Algosia\n";
    } else if (A<B) {
        cout << "Bajtek\n";
    } else {
        cout << "remis\n";
    }

    
}