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>
using namespace std;

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

  vector<int> a(18), b(18);
  for(int& i : a) cin >> i;
  for(int& i : b) cin >> i;

  int s_a = accumulate(a.begin(), a.end(), 0);
  int s_b = accumulate(b.begin(), b.end(), 0);

  sort(a.begin(), a.end(), greater<int>());
  sort(b.begin(), b.end(), greater<int>());

  if(s_a != s_b)
    cout << (s_a > s_b ? "Algosia" : "Bajtek") << "\n";
  else if(a != b)
    cout << (a > b ? "Algosia" : "Bajtek") << "\n";
  else
    cout << "remis\n";

  return 0;
}