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

int main()
{
    int al = 0;
    int al_l[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    int ba = 0;
    int ba_l[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
    
    for (int i = 0; i < 18; i++) {
        int p;
        scanf("%d", &p);
        al_l[10-p]++;
        al += p;
    }
    for (int i = 0; i < 18; i++) {
        int p;
        scanf("%d", &p);
        ba_l[10-p]++;
        ba += p;
    }
    
    if (ba == al) {
        for (int i = 0; i < 18; i++) {
            if (al_l[i] > ba_l[i]) {
                printf("Algosia");
                return 0;
            }
            else if (ba_l[i] > al_l[i]) {
                printf("Bajtek");
                return 0;
            }
        }
        printf("remis");
        return 0;
    }
    
    else if (ba < al) {
        printf("Algosia");
    }
    else if (al < ba) {
        printf("Bajtek");
    }

    return 0;
}