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

using namespace std;
int lpm[18], lpb[18], sumlpm = 0, sumlpb = 0, sumlzm = 0, sumlzb = 0;
bool winner = false;

int main(){
    cin >> lpm[0] >> lpm[1] >> lpm[2] >> lpm[3] >> lpm[4] >> lpm[5] >> lpm[6] >> lpm[7] >> lpm[8] >> lpm[9] >> lpm[10] >> lpm[11] >> lpm[12] >> lpm[13] >> lpm[14] >> lpm[15] >> lpm[16] >> lpm[17];
    cin >> lpb[0] >> lpb[1] >> lpb[2] >> lpb[3] >> lpb[4] >> lpb[5] >> lpb[6] >> lpb[7] >> lpb[8] >> lpb[9] >> lpb[10] >> lpb[11] >> lpb[12] >> lpb[13] >> lpb[14] >> lpb[15] >> lpb[16] >> lpb[17];
    for (int i = 0; i < 18; i++) {
        sumlpm += lpm[i];
        sumlpb += lpb[i];
    }
    if(sumlpm > sumlpb){
        cout << "Algosia";
    } else if (sumlpb > sumlpm){
        cout << "Bajtek";
    } else {
        for (int i = 10; i > 0 && !winner; i--){
            for(int j = 0; j < 18; j++){
                if(i == lpm[j]){
                    sumlzm++;
                }
                if(i == lpb[j]){
                    sumlzb++;
                }
            }
            if (sumlzm > sumlzb){
                cout << "Algosia";
                winner = true;
            } else if (sumlzm < sumlzb){
                cout << "Bajtek";
                winner = true;
            } else {
                sumlzm = 0;
                sumlzb = 0;
            }
        }
        if(!winner) {
            cout << "remis";
        }
    }
}