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
#include <bits/stdc++.h>

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

  std::vector<int> A(18), B(18);

  for (auto &x : A)
    std::cin >> x;
  for (auto &x : B)
    std::cin >> x;

  int res_A = std::reduce(A.begin(), A.end());
  int res_B = std::reduce(B.begin(), B.end());

  std::sort(A.begin(), A.end(), std::greater<int>());
  std::sort(B.begin(), B.end(), std::greater<int>());

  if (res_A > res_B || (res_A == res_B && A > B))
    std::cout << "Algosia\n";
  else if (res_A < res_B || (res_A == res_B && A < B))
    std::cout << "Bajtek\n";
  else
    std::cout << "remis\n";
}