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
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
    long long s2 = 0;
    long long s1 = 0;
    std::vector<int> v1, v2;
    long long a;
    for (int i = 0; i < 18; i++)
    {
        std::cin >> a;
        s1 += a;
        v1.push_back(a);
    }
    for (int i = 0; i < 18; i++)
    {
        std::cin >> a;  
        s2 += a;
        v2.push_back(a);
    }
    if (s1 > s2)
    {
        std::cout << "Algosia";
        return 0;
    }
    if (s2 > s1)
    {
        std::cout << "Bajtek";
        return 0;
    }
    std::sort(v1.begin(), v1.end());
    std::sort(v2.begin(), v2.end());
    for (int i = 17; i >= 0; i--)
    {
        //std::cout<<v1[i]<<" "<<v2[i]<<"\n";
        if (v1[i] > v2[i])
        {
            std::cout << "Algosia";
            return 0;
        }
        if (v2[i] > v1[i])
        {
            std::cout << "Bajtek";
            return 0;
        }
    }
    std::cout<<"remis";
}