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
#include <cstdio>
#include <iostream>
#include <sstream>
#include <vector>

int main() {
    std::string line;
    std::getline(std::cin, line);

    std::istringstream iss(line);
    std::vector<int> punkty_alg;
    std::vector<int> punkty_baj;

    int num;
    while (iss >> num) {
        if (num < 0 || num > 10) {
            printf("error [0,10] \n");
            return 1;
        }
        punkty_alg.push_back(num);
    }
    if (punkty_alg.size() != 18) {
        printf("error size \n");
        return 1;
    }

    std::getline(std::cin, line);
    std::istringstream iss2(line);

    while (iss2 >> num) {
        if (num < 0 || num > 10) {
            printf("error [0,10] \n");
            return 1;
        }
        punkty_baj.push_back(num);
    }
    if (punkty_baj.size() != 18) {
        printf("error size \n");
        return 1;
    }

    int sum_alg = 0;
    int sum_baj = 0;
    int clumbs_alg[] = { 0,0,0,0,0,0,0,0,0,0 };
    int clumbs_baj[] = { 0,0,0,0,0,0,0,0,0,0 };

    for (int i = 0; i < punkty_alg.size(); i++) {
        clumbs_alg[punkty_alg[i]]++;
        clumbs_baj[punkty_baj[i]]++;

        sum_alg += punkty_alg[i];
        sum_baj += punkty_baj[i];
    }

    if (sum_alg > sum_baj) {
        printf("Algosia");
    } else if (sum_alg < sum_baj) {
        printf("Bajtek");
    } else {
        for (int i = 9; i >= 0; i--){
            if (clumbs_alg[i] > clumbs_baj[i]) {
                printf("Algosia");
                return 0;
            } else if (clumbs_alg[i] < clumbs_baj[i]) {
                printf("Bajtek");
                return 0;
            }
        }
        printf("Remis");
    }

    return 0;
}