#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
struct MyStruct
{
	int key, val;
};
struct less_than_key
{
	inline bool operator() (const MyStruct& struct1, const MyStruct& struct2)
	{
		return (struct1.val < struct2.val);
	}
};
int main()
{
	int A[18], B[18], suma = 0, sumb = 0;
	for (int i = 0; i < 18; i++)
	{
		scanf("%d", A + i);
		suma += A[i];
	}
	for (int i = 0; i < 18; i++)
	{
		scanf("%d", B + i);
		sumb += B[i];
	}
	int k = 17;
	sort(A, A + 18);
	sort(B, B + 18);
	while (k >= 0 && suma == sumb)
	{
		suma += A[k];
		sumb += B[k];
		k--;
	}
	if (suma > sumb)
	{
		printf("Algosia");
	}
	else if (sumb > suma)
	{
		printf("Bajtek");
	}
	else
	{
		printf("remis");
	}
	return 0;
}
        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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60  | #include <cstdio> #include <algorithm> #include <map> #include <vector> using namespace std; struct MyStruct { int key, val; }; struct less_than_key { inline bool operator() (const MyStruct& struct1, const MyStruct& struct2) { return (struct1.val < struct2.val); } }; int main() { int A[18], B[18], suma = 0, sumb = 0; for (int i = 0; i < 18; i++) { scanf("%d", A + i); suma += A[i]; } for (int i = 0; i < 18; i++) { scanf("%d", B + i); sumb += B[i]; } int k = 17; sort(A, A + 18); sort(B, B + 18); while (k >= 0 && suma == sumb) { suma += A[k]; sumb += B[k]; k--; } if (suma > sumb) { printf("Algosia"); } else if (sumb > suma) { printf("Bajtek"); } else { printf("remis"); } return 0; }  | 
            
        
                    English