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

int sum(const std::vector<int>& vec) {
    int sum = 0;
    for (int num : vec) {
        sum += num;
    }
    return sum;
}

int sumOfElements(const std::vector<int>& vec, const int& n) {
    int sum = 0;
    for (int num : vec) {
        if (num == n) sum++;
    }
    return sum;
}

std::string whoWin(const std::vector<int>& vecA, const std::vector<int>& vecB) {
    int sumA = sum(vecA);
    int sumB = sum(vecB);

    if (sumA > sumB) return "Algosia";
    else if (sumA < sumB) return "Bajtek";
    else {
        for (int n = 10; n > 0; n--) {
            if (sumOfElements(vecA, n) > sumOfElements(vecB, n)) return "Algosia";
            else if (sumOfElements(vecA, n) < sumOfElements(vecB, n)) return "Bajtek";
        }
        return "remis";
    }
}


int main()
{
    std::vector<int> vecA, vecB;
    std::string input;

    std::getline(std::cin, input);
    std::istringstream stream(input);

    int liczba;
    while (stream >> liczba) {
        vecA.push_back(liczba);
    }

    std::getline(std::cin, input);
    std::istringstream stream2(input);

    while (stream2 >> liczba) {
        vecB.push_back(liczba);
    }
   
    
    std::cout << whoWin(vecA, vecB);
}