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
import sys
from collections import Counter

def get_winner_name(a_pts, b_pts):
    if a_pts > b_pts:
        return "Algosia"
    else:
        return "Bajtek"

if __name__ == "__main__":
    lines = [ line for line in sys.stdin]
    algosia = [ int(x) for x in lines[0].split(" ") ]
    bajtek = [ int(x) for x in lines[1].split(" ")]

    algosia_score = sum(algosia)
    bajtek_score = sum(bajtek)
    if algosia_score == bajtek_score:
        # decide draw - count 10s, 9s
        ascores = Counter(algosia)
        bscores = Counter(bajtek)
        for i in range(10,0,-1):
            a_cnt = ascores.get(i,0)
            b_cnt = bscores.get(i,0)
            if a_cnt != b_cnt:
                print(get_winner_name(a_cnt, b_cnt))
                sys.exit(0)
        print("remis")

    else:
        print(get_winner_name(algosia_score, bajtek_score))