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;
using ll=long long;
const ll inf=1e18;

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    vector<ll>A,B;
    ll sA=0,sB=0;
    for(int i=0;i<18;i++)
    {
        ll k;cin>>k;
        sA+=k;A.push_back(k);
    }
    for(int i=0;i<18;i++)
    {
        ll k;cin>>k;
        sB+=k;B.push_back(k);
    }
    if(sA>sB)cout<<"Algosia";
    else if(sA<sB)cout<<"Bajtek";
    else
    {
        sort(begin(A),end(A),greater<>{});
        sort(begin(B),end(B),greater<>{});
        if(A>B)cout<<"Algosia";
        else cout<<"Bajtek";
    }
}