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
#include <stdio.h>
#include <algorithm>
#include <numeric>

using namespace std;
int A[18];
int B[18];

struct CustomCompare
{
    bool operator ()(const int& a, const int& b)
    {
        return a > b;
    }
};

int main() {
    for (int i=0;i<18;++i) {
        scanf("%d",&A[i]);
    }
    for (int i=0;i<18;++i) {
        scanf("%d",&B[i]);
    }
    sort(A, A+18, CustomCompare());
    sort(B, B+18, CustomCompare());
    int sumA = 0;
    int sumB = 0;
    for (int i=0;i<18;++i) {
        sumA += A[i];
    }
    for (int i=0;i<18;++i) {
        sumB += B[i];
    }
    if (sumA > sumB) {
        printf("Algosia\n");
        return 0;
    } else if (sumB > sumA) {
        printf("Bajtek\n");
        return 0;
    } else {
        int i = 0;
        while(i<18) {
            if (A[i] > B[i]) {
                printf("Algosia\n");
                return 0;
            } else if (B[i] > A[i]) {
                printf("Bajtek\n");
                return 0;
            } 
            ++i;
        }
    }
    printf("remis\n");
    return 0;
}