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

int main(){
    int n=18;
    vector<int> a(n),b(n);
    int sum1=0,sum2=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum1+=a[i];
    }
    for(int i=0;i<n;i++){
        cin>>b[i];
        sum2+=b[i];
    }
    if(sum1>sum2)
        return cout<<"Algosia",0;
    if(sum2>sum1)
        return cout<<"Bajtek",0;
    sort(a.begin(),a.end(),greater<int>());
    sort(b.begin(),b.end(),greater<int>());

    for(int i=0;i<n;i++){
        if(a[i]>b[i])
            return cout<<"Algosia",0;
        if(b[i]>a[i])
            return cout<<"Bajtek",0;
    }
    cout<<"remis";
}