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

#define loop(i, a, b) for(int i = a; i <= b; i++)

int main() {
  constexpr int n = 18;
  vector<vector<int>> cnt(2, vector<int>(11, 0));
  vector<int> s(2);

  loop(i, 0, 1) {
    loop(j, 0, n-1) {
      int x; cin >> x;
      ++cnt[i][10 - x];
      s[i] += x;
    }
  }

  if(s[0] > s[1]) cout << "Algosia\n";
  else if(s[0] < s[1]) cout << "Bajtek\n";
  else if(cnt[0] > cnt[1]) cout << "Algosia\n";
  else if(cnt[0] < cnt[1]) cout << "Bajtek\n";
  else cout << "remis\n";

}