Problem: Alice and Bob are playing _One Card Poker_.   One Card Poker is a two-player game using playing cards.  Each card in this game shows an integer between `1` and `13`, inclusive.   The _strength_ of a card is determined by the number written on it, as follows:  Weak `2` < `3` < `4` < `5` < `6` < `7` < `8` < `9` < `10` < `11` < `12` < `13` < `1` Strong  One Card Poker is played as follows:    1. Each player picks one card from the deck. The chosen card becomes the player's hand.   2. The players reveal their hands to each other. The player with the stronger card wins the game.   If their cards are equally strong, the game is drawn.  You are watching Alice and Bob playing the game, and can see their hands.   The number written on Alice's card is A, and the number written on Bob's card is B.   Write a program to determine the outcome of the game.

Submission attempts (in order):
import math

N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]

dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0

for it_N in range(N):
    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
            if it_MA >= a[it_N] and it_MB >= b[it_N]:
                if dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] != math.inf:
                    dp[it_N+1][it_MA][it_MB] = min(dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] + c[it_N], dp[it_N][it_MA][it_MB])
            else:
                dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]

#    for it_MA in range(MA+1):
#        for it_MB in range(MB+1):
#print(it_N+1,it_MA,it_MB,dp[it_N+1][it_MA][it_MB])


ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        print(a,b,dp[N][a][b])
        if a/b == rate and dp[N][a][b] != math.inf:
            if ans == -1:
                ans = dp[N][a][b]
            else:
                ans = min([dp[N][a][b], ans])
print(ans)


a, b = map(int,input().split())
v = ""
if a = b:
    v = "Draw"
elif a == 1 or a > b:
    v = "Alice"
elif b == 1 or a < b:
    v = "Bob"
print(v)


import math

N, Ma, Mb = map(int,input().split())
rate = Ma / Mb
a = [0] * N
b = [0] * N
c = [0] * N
MA = 0
MB = 0
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())
    MA += a[i]
    MB += b[i]

dp = [[[math.inf for i in range(MB+1)] for j in range(MA+1)] for k in range(N+1)]
dp[0][0][0] = 0

for it_N in range(N):
    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
            if it_MA >= a[it_N] and it_MB >= b[it_N]:
                if dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] != math.inf:
                    dp[it_N+1][it_MA][it_MB] = min(dp[it_N][it_MA-a[it_N]][it_MB-b[it_N]] + c[it_N], dp[it_N][it_MA][it_MB])
            else:
                dp[it_N+1][it_MA][it_MB]=dp[it_N][it_MA][it_MB]

    for it_MA in range(MA+1):
        for it_MB in range(MB+1):
#            print(it_N+1,it_MA,it_MB,dp[it_N+1][it_MA][it_MB])


ans = -1
for a in range(1, MA+1):
    for b in range(1, MB+1):
        print(a,b,dp[N][a][b])
        if a/b == rate and dp[N][a][b] != math.inf:
            if ans == -1:
                ans = dp[N][a][b]
            else:
                ans = min([dp[N][a][b], ans])
print(ans)


a, b = map(int,input().split())
v = ""
if a == b:
    v = "Draw"
elif a == 1:
    v = "Alice"
elif b == 1:
    v = "Bob"
elif a > b:
    v = "Alice"
else:
    v = "Bob"

print(v)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted