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

class User
{
    std::string name;
    int sum = 0;
    int stats[11] = {0};

public:
    User(std::string name)
    {
        this->name = name;
    }

    void add(int task)
    {
        this->stats[10 - task] += 1;
        this->sum += task;
    }

    void print()
    {
        std::cout << this->name << " Sum: " << this->sum << '\n';
        for (int i = 0; i < 11; i++)
        {
            std::cout << this->stats[i] << ' ';
        }
        std::cout << '\n';
    }

    int cmp(User &u)
    {
        if (this->sum != u.sum)
            return this->sum - u.sum;
        int i = 0;
        while (i < 11 && this->stats[i] == u.stats[i])
        {
            i++;
        }
        if (i < 11)
            return this->stats[i] - u.stats[i];
        return 0;
    }
};

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int x;
    int r;
    std::string res;
    User al("Algosia");
    for (int i = 0; i < 18; i++)
    {
        std::cin >> x;
        al.add(x);
    }
    User ba("Bajtek");
    for (int i = 0; i < 18; i++)
    {
        std::cin >> x;
        ba.add(x);
    }
    r = al.cmp(ba);
    if (r > 0)
        res = "Algosia";
    else if (r == 0)
        res = "remis";
    else
        res = "Bajtek";

    std::cout << res << '\n';
}