#include <iostream>
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int wynik[2] = {0};
    int czastkowe[2][11];
    int liczba = 0;
    for(int i = 0; i < 11; i++) {
        czastkowe[0][i] = 0;
        czastkowe[1][i] = 0;
    }
    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < 18; j++) {
            std::cin >> liczba;
            wynik[i] += liczba;
            czastkowe[i][liczba]++;
        }
    }
    if(wynik[0] > wynik[1]) std::cout << "Algosia";
    else if(wynik[1] > wynik[0]) std::cout << "Bajtek";
    else {
        for(int i = 10; i >= 0; i--) {
            //if(czastkowe[0][i] == czastkowe[1][i]) continue;
            if(czastkowe[0][i] > czastkowe[1][i]) {
                std::cout << "Algosia";
                break;
            }
            if(czastkowe[0][i] < czastkowe[1][i]) {
                std::cout << "Bajtek";
                break;
            }
            if(i == 0) std::cout << "remis";
        }
    }
    return 0;
}
        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  | #include <iostream> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int wynik[2] = {0}; int czastkowe[2][11]; int liczba = 0; for(int i = 0; i < 11; i++) { czastkowe[0][i] = 0; czastkowe[1][i] = 0; } for(int i = 0; i < 2; i++) { for(int j = 0; j < 18; j++) { std::cin >> liczba; wynik[i] += liczba; czastkowe[i][liczba]++; } } if(wynik[0] > wynik[1]) std::cout << "Algosia"; else if(wynik[1] > wynik[0]) std::cout << "Bajtek"; else { for(int i = 10; i >= 0; i--) { //if(czastkowe[0][i] == czastkowe[1][i]) continue; if(czastkowe[0][i] > czastkowe[1][i]) { std::cout << "Algosia"; break; } if(czastkowe[0][i] < czastkowe[1][i]) { std::cout << "Bajtek"; break; } if(i == 0) std::cout << "remis"; } } return 0; }  | 
            
        
                    English