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

int a[3][20];
int suma[3];

int main(){

  string result[3] = {"Algosia", "Bajtek", "remis"};

  for(int i = 0 ; i < 2 ; i++){
    for(int j = 0 ; j < 18 ; j++){
      cin >> a[i][j];
      suma[i] += a[i][j];
    }
  }
  if(suma[0] > suma[1]){
    cout << result[0] << endl;
  }else if(suma[0] < suma[1]){
    cout << result[1] << endl;
  }else{
    sort(a[0], a[0] + 18);
    sort(a[1], a[1] + 18);
    int iterator = 17;
    while(iterator >= 0 && a[0][iterator] == a[1][iterator]){
      iterator--;
    }
    if(iterator == -1){
      cout << result[2] << endl;
    }else if(a[0][iterator] > a[1][iterator]){
      cout << result[0] << endl;
    }else{
      cout << result[1] << endl;
    }
  }
  
}