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
#include <iostream>
#include <algorithm>
int main()
{
    int A[18],B[18];
    int a,b;
    for (int i=0;i<18;i++){std::cin>>A[i];
        a=a+A[i];
    }
    for (int i=0;i<18;i++){std::cin>>B[i];
        b=b+B[i];
    }
    if(a<b){std::cout<<"Algosia";}
    if(a>b){std::cout<<"Bajtosia";}
    if(a==b){std::sort(A, A+18);
        std::sort(B, B+18);
        int i=17;
        while(a==b and i!=-1){a=a+A[i];
            b=b+B[i];
            i=i-1;

        }
       if(a<b){std::cout<<"Algosia";}
       if(a>b){std::cout<<"Bajtosia";}
       if(a==b){std::cout<<"remis";} }
    

        
    

    return 0;
}