Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
for j in range(len(A)):
    a = A[:j] + A[j+1:]
    total = abs(a[0])
    for i in range(0, len(a)-1):
        total += abs(a[i+1] - a[i])
    total += abs(a[-1])
    print(total)
    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
total = abs(A[0]) + abs(A[1]-A[0])
lst = [abs(A[0]) + abs(A[1]-A[0]) - abs(A[1])]
for i in range(1, len(A)-1):
    total += abs(A[i+1] - A[i])
    lst += [abs(A[i+1] - A[i]) + abs(A[i] - A[i-1]) - abs(A[i+1] - A[i-1])]
total += abs(A[-1]) 
lst += [abs(A[-1]) + abs(A[-2]-A[-1])-abs(A[-2])]
for j in lst:
    print(total - j)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
lst = [['#' for j in range(100)] for i in range(50)] + [['.' for j in range(100)] for i in range(50)]
for i in range(A-1):
	a, b = divmod(i, 50)
    lst[a*2][b*2] = '.'
for i in range(B-1):
    a, b = divmod(i, 50)
    lst[-1-a*2][-1-b*2] = '#'
print(100, 100)
for j in lst:
    print(''.join(j))

Fixed submission:
A, B = map(int, input().split())
lst = [['#' for j in range(100)] for i in range(50)] + [['.' for j in range(100)] for i in range(50)]
for i in range(A-1):
    a, b = divmod(i, 50)
    lst[a*2][b*2] = '.'
for i in range(B-1):
    a, b = divmod(i, 50)
    lst[-1-a*2][-1-b*2] = '#'
print(100, 100)
for j in lst:
    print(''.join(j))
Buggy python submission (verdict: Runtime Error):
N = int(input())
dic = {}
for i in range(N):
  s = input()
  if s not in dic:
    dic[s] = 1
  else:
    dic[s] += 1
M = int(input())
for i in range(M):
  s = input()
  if s not in dic:
    dic[s] = -1
  else:
    dic[s] -= 1
print(max(list(dic.values()))

Fixed submission:
from collections import Counter  

blue = []
red = []
N = int(input())
for i in range(N):
    blue.append(input())
M = int(input())
for j in range(M):
    red.append(input())
b = Counter(blue)
r = Counter(red)
print(max([0] + [b[x] - r[x] for x in b]))
Buggy python submission (verdict: Runtime Error):
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i = int(input())
print(x[i])

Fixed submission:
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

i = int(input())
print(x[i-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(n ** 0.5) + 1
j = 1
for i in range(2, m):
  if n % i ==0:
    j = n // i
print(i+j -2)

Fixed submission:
n = int(input())
m = int( n ** 0.5) + 1
a,b = 1, 0
for i in range(2, m):
    if n % i == 0:
        a = n // i
        b = i
if b !=0:
    print(a + b - 2)
else:
    print(n - 1)
Buggy python submission (verdict: Runtime Error):
arr ={"Sunny":"Cloudy","Cloudy":"Rainy","Rainy":""Cloudy"}
S = input()
print(arr[S])

Fixed submission:
arr = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(arr[input()])

Buggy python submission (verdict: Runtime Error):
arr ={"Sunny":"Cloudy","Cloudy":"Rain","Rain":""Cloudy"}
S = input()
print(arr[S])

Fixed submission:
arr = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(arr[input()])
Buggy python submission (verdict: Runtime Error):
inport math
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
else:
  print(math.ceil(h*w/2))

Fixed submission:
import math
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
else:
  print(math.ceil(h*w/2))

Buggy python submission (verdict: Runtime Error):
inport math
h,w=map(int,input().split())
print(math.ceil(h*w/2))

Fixed submission:
import math
h,w=map(int,input().split())
if h==1 or w==1:
  print(1)
else:
  print(math.ceil(h*w/2))
Buggy python submission (verdict: Runtime Error):
import math
a,b,c=map(int,input.split())
if math.sqrt(a)+math.sqrt(b)<math.sqrt(c):
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input.split())
if math.sqrt(a)+math.sqrt(b)<math.sqrt(c):
  print('Yes')
else:
  print('No')

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b>0 and 4*a*b<(c-a-b)**2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,b,r=map(int,input().split())
alist=[]
count=0

while len(alist)<n:
  for i in range(b):
    alist.append('b')
  for i in range(r):
    alist.append('r')

del alist[n:]

for i in alist:
  if i=='b':
    count+=1

print(count)


Fixed submission:
n,b,r=map(int,input().split())

ans=n//(b+r)*b
sur=n%(b+r)
ans+=min(sur,b)
print(ans)
Buggy python submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')


Fixed submission:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

for _ in range(N):
    b = int(input())
    for y in range(3):
        for x in range(3):
            if A[y][x] == b:
                A[y][x] = -1

for y in range(3):
    f = True
    for x in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

f = True
for x in range(3):
    if A[x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

f = True
for x in range(3):
    if A[2 - x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

print('No')

Buggy python submission (verdict: Runtime Error):
A=[list(map(int,input().split())) for i in range(3)]
n=int(input())

for i in range(n):
  o=int(input())
  for x in range(3):
    for y in range(3):
      if o == A[x][y]:
        A[x][y]=-1
for x in range(3):
  if A[x][0]==-1:
    f=True
    for y in range(3):
      if A[x][y]!=-1:
        f=False
    if f:
      print('Yes')
      exit()
for y in range(3):
  if A[0][y] == -1:
    f=True
    for x in range(3):
      if A[y][[x] != -1:
        f=False
    if f:
      print('Yes')
      exit()
f=True
for i in range(3):
  if A[i][i]!=-1:
    f=False
if f:
  print('Yes')
f=True
for i in range(1,3):
  if A[-i][-i]!=-1:
    f=False
if f:
  print('Yes')

Fixed submission:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())

for _ in range(N):
    b = int(input())
    for y in range(3):
        for x in range(3):
            if A[y][x] == b:
                A[y][x] = -1

for y in range(3):
    f = True
    for x in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

for x in range(3):
    f = True
    for y in range(3):
        if A[y][x] != -1:
            f = False
    if f:
        print('Yes')
        exit()

f = True
for x in range(3):
    if A[x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

f = True
for x in range(3):
    if A[2 - x][x] != -1:
        f = False
if f:
    print('Yes')
    exit()

print('No')
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())

t=[-1]*N
for i in range(m):
  s,c=map(int,input().split())
  s-=1
  if t[s] != -1 and t[s] != c:
    print(-1)
    exit()
  t[s]=c

if n != 1:
  if t[0] == 0:
    print(-1)
    exit()
  if t[0] == -1:
    t[0]=1
  for i in range(1,n):
    if t[i] == -1:
      t[i] = 0
else:
  if t[0] == -1:
    t[0] = 0
print(''.join(map(str,t)))

Fixed submission:
n,m=map(int,input().split())

t=[-1]*n
for i in range(m):
  s,c=map(int,input().split())
  s-=1
  if t[s] != -1 and t[s] != c:
    print(-1)
    exit()
  t[s]=c

if n != 1:
  if t[0] == 0:
    print(-1)
    exit()
  if t[0] == -1:
    t[0]=1
  for i in range(1,n):
    if t[i] == -1:
      t[i] = 0
else:
  if t[0] == -1:
    t[0] = 0
print(''.join(map(str,t)))
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
  print("draw")
elif a=1 or a>b
  print("Alice")
elif b=1:
  print("Bob")
else:
  print("Bob")

Fixed submission:
a, b = map(int, input().split())
if a==b:
  ans = 'Draw'
elif a==1:
  ans = 'Alice'
elif b==1:
  ans = 'Bob'
elif a>b:
  ans = 'Alice'
else:
  ans = 'Bob'
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())
print(int((a+b)＊h//2))

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
h = int(input())
print((a+b)＊h//2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
a= int(input())
b= int(input())
k= int(input())
h= int(input())
h=2＊k
print((a+b)＊h/2)

Fixed submission:
a=int(input())
b=int(input())
h=int(input())
ans=(a+b)*h/2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
n,k,x,y=int(input())
if n>=k:
  l=n-k
  print(k＊x+l＊y)
else:
  print(n＊x)

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n>k:
  print(k * x + (n - k) * y)
else:
  print(n * x)

Buggy python submission (verdict: Runtime Error):
N,K,X,Y=int(input())
if N>=K+1:
  print(int(K＊X+(N-K)＊Y))
else:
  print(int(N＊X))

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if n>k:
  print(k * x + (n - k) * y)
else:
  print(n * x)
Buggy python submission (verdict: Runtime Error):
t=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a=int(input())
print(t[a])

Fixed submission:
t=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a=int(input())
print(t[a-1])
Buggy python submission (verdict: Runtime Error):
from decimal import * 
a,b,c = map(int, input().split())
if Decimal(a)**0.5+Decimal(b)**0.5 < Decimal(c)**0.5:
    print('Yes')
else:
    print('No')

Fixed submission:
from decimal import * 
a,b,c = map(int, input().split())
if Decimal(a) ** Decimal('0.5')+Decimal(b) ** Decimal('0.5') < Decimal(c) ** Decimal('0.5'):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n,m =map(int, input().split())
a =[list(input().split()) for i in range(m)]
ends = [0]*n
was = [0]*n
for num, kekka in a:
    num=int(num)-1
    if kekka=='AC':
        ends[num]=1
    else:
        if ends[num]!=1:
            was[num]+=1
for i in range(n):
    if end[i]==0:
        was[i]=0
print(sum(ends), sum(was))

Fixed submission:
n,m =map(int, input().split())
a =[list(input().split()) for i in range(m)]
ends = [0]*n
was = [0]*n
for num, kekka in a:
    num=int(num)-1
    if kekka=='AC':
        ends[num]=1
    else:
        if ends[num]!=1:
            was[num]+=1
for i in range(n):
    if ends[i]==0:
        was[i]=0
print(sum(ends), sum(was))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
a = sorted(list(map(int, input().split())))

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
    
def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

ans=0
mod = 10**9+7
a=a[::-1]
for i in range(n-k+1):
    ans += (a[i] * comb(n-i-1, k-1, mod))%mod
a=a[::-1]
for i in range(n-k+1):
    ans -= (a[i] * comb(n-i-1, k-1, mod))%mod


print(ans%mod)

Fixed submission:
n,k = map(int, input().split())
a = sorted(list(map(int, input().split())))
ans=0
mod = 10**9+7

factorial = [1]
inverse = [1]
for i in range(1, n+2):
    factorial.append(factorial[-1] * i % mod)
    inverse.append(pow(factorial[-1], mod - 2, mod))
 
def comb(n, r, mod):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % mod

a=a[::-1]
for i in range(n-k+1):
    ans += (a[i] * comb(n-i-1, k-1, mod))%mod
a=a[::-1]
for i in range(n-k+1):
    ans -= (a[i] * comb(n-i-1, k-1, mod))%mod


print(ans%mod)
Buggy python submission (verdict: Runtime Error):
n=input()
a = input()+input()
print(a[::2]+a[1::2])

Fixed submission:
n=input()
ans=''
for i,j in zip(*input().split()):
    ans+=i+j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n=int(input())
a=[int(input())]
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a[::-1], t)
    if b==0:
        a.append(t)
    else:
        a[-b]=t
print(len(a))

Fixed submission:
import bisect
from collections import deque
n=int(input())
a=deque([int(input())])
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a, t)
    if b==0:
        a.appendleft(t)
    else:
        a[b-1]=t
    #print(a)
print(len(a))

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input())]
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a[::-1], t)
    if b==0:
        a.append(t)
    else:
        a[-b]=t
print(len(a))

Fixed submission:
import bisect
from collections import deque
n=int(input())
a=deque([int(input())])
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a, t)
    if b==0:
        a.appendleft(t)
    else:
        a[b-1]=t
    #print(a)
print(len(a))
Buggy python submission (verdict: Runtime Error):
n,k=map(int, input().split())
a=[(i+1)*(i+2)//2 for i in range(n-2)]
if k>a[-1]:
    print(-1)
else:
    for i in range(n):
        if a[i]>=k:
            break
    count=i+2+a[i]-k
    print(count)
    for j in range(i+2):
        print(1,j+2)
    for j in range(a[i]-k):
        print(j+2,j+3)

Fixed submission:
n,k=map(int, input().split())
a=(n-1)*(n-2)//2
from itertools import permutations, combinations,combinations_with_replacement,product
moto=list(range(2,n+1))
ku=list(combinations(moto,2))

if k>a:
    print(-1)
else:
    print(n-1+a-k)
    for j in range(n-1):
        print(1,j+2)
    for j in range(a-k):
        print(*ku[j])
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
s=list(map(int, input().split()))
t=list(map(int, input().split()))
dp=[[0]*(n+1) for _ in range(m+1)]
for i in range(m+1):
    dp[i][0]=1
for i in range(n+1):
    dp[0][i]=1
for i in range(m):
    for j in range(n):
        if s[j]==t[i]:
            dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%(10**9+7)
        else:
            dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]-dp[i][j]
print(dp[-1][-1]%(10**9+7))

Fixed submission:
n,m=map(int, input().split())
s=list(map(int, input().split()))
t=list(map(int, input().split()))
dp=[[0]*(n+1) for _ in range(m+1)]
for i in range(m+1):
    dp[i][0]=1
for i in range(n+1):
    dp[0][i]=1
for i in range(m):
    for j in range(n):
        if s[j]==t[i]:
            dp[i+1][j+1]=(dp[i][j+1]+dp[i+1][j])%(10**9+7)
        else:
            dp[i+1][j+1]=dp[i][j+1]+dp[i+1][j]-dp[i][j]
print(dp[-1][-1]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,m=map(int, input().split())
a=sorted(map(int, input().split()))
for i in range(m):
    x,y=map(int, input().split())
    t=bisect.bisect_left(a,y)
    a=a[:t]+[y]*x+a[t:]
    a=a[-n:]
print(sum(a))

Fixed submission:
from collections import Counter
n,m=map(int, input().split())
a=list(map(int, input().split()))
c=Counter(a)
for i in range(m):
    x,y=map(int, input().split())
    c[y]+=x
ans=0
for i in sorted(c, reverse=True):
    if n>c[i]:
        ans+=c[i]*i
        n-=c[i]
    else:
        ans+=n*i
        n=0
    if n<=0:break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n,m=map(int, input().split())
a=list(map(int, input().split()))
b=[list(map(int, input().split())) for i in range(m)]
b.sort(key=lambda x:x[1])
c=Counter(a)
for x,y in b:
    for i in sorted(c):
        if y<=i or x==0:break
        if c[i]>x:
            c[i]-=x
            c[y]+=x
            x=0
        else:
            c[y]+=c[i]
            x-=c[i]
            del c[i]
ans=0
for i in c:
    ans+=c[i]*i
print(ans)

Fixed submission:
from collections import Counter
n,m=map(int, input().split())
a=list(map(int, input().split()))
c=Counter(a)
for i in range(m):
    x,y=map(int, input().split())
    c[y]+=x
ans=0
for i in sorted(c, reverse=True):
    if n>c[i]:
        ans+=c[i]*i
        n-=c[i]
    else:
        ans+=n*i
        n=0
    if n<=0:break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,n=map(int, input().split())
count=0
for i in range(3001):
    for j in range(3001):
        if n-i*a-b*j<0:break
        if (n-i*a-b*j)%c==0:
            count+=1
print(count)

Fixed submission:
a,b,c,n=map(int, input().split())
count=0
for i in range(3001):
    for j in range(3001):
        if n-i*a-b*j<0:break
        if (n-i*a-b*j)%c==0:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
count=0
for i in range(1, int(n**0.5)+1):
    if  n%i==0:
        if i==n%((n//i)-1):
            count+=(n//i)-1
print(count)

Fixed submission:
n=int(input())
count=0
if n==1:count=0
else:
    for i in range(1, int(n**0.5)+1):
        if  n%i==0:
            if i==n%((n//i)-1):
                count+=(n//i)-1
print(count)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
count=0
for i in range(1, math.ceil(int(n**0.5))+1):
    if  n%i==0:
        if i==n%((n//i)-1):
            count+=(n//i)-1
print(count)

Fixed submission:
n=int(input())
count=0
if n==1:count=0
else:
    for i in range(1, int(n**0.5)+1):
        if  n%i==0:
            if i==n%((n//i)-1):
                count+=(n//i)-1
print(count)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
    a,b=input().split()
    if b=='JPY':ans+=int(a)
    else:ans+=int(a)*380000
print(ans)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
    a,b=input().split()
    if b=='JPY':ans+=int(a)
    else:ans+=float(a)*380000
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
mt=[0,2,5,5,4,5,6,3,7,6]
a=sorted(map(int, input().split()))
dp=['']*(n+1)
dp[0]='*'
for i in range(n+1):
    if not dp[i]:continue
    for j in a:
        if i+mt[j]<n+1:
            dp[i+mt[j]]=str(j)+dp[i]
print(''.join(sorted(dp[-1][:-1])[::-1]))

Fixed submission:
a,b=map(int, input().split())
if b%a==0:print(a+b)
else:print(b-a)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())
hon=[2,5,5,4,5,6,3,7,6]
a=list(map(int, input().split()))
s=sorted(set([hon[i-1] for i in a]))
x=s[0]*s[1]+1
dp=[[-100]*(x+1) for i in range(len(s)+1)]
for i in range(1,len(s)+1):
    for j in range(x+1):
        if j%s[i-1]==0:
            dp[i][j]=max(dp[i][j],j//s[i-1])
        for k in range(1,j+1):
            if (j-k)%s[i-1]==0:
                dp[i][j]=max(dp[i][j],(j-k)//s[i-1]+dp[i-1][k])
ans=[]
if n>x:
    ans+=[min(s)]*-(-(n-x)//min(s))
    n=n+(-(n-x)//min(s))*min(s)
from itertools import product
for i in product(s,repeat=dp[-1][n]):
    if sum(i)==n:break
ans+=list(i)
import bisect
ansf=[]
for i in ans:
    t=9-hon[::-1].index(i)
    bisect.insort_left(ansf,t)
print(*ansf[::-1],sep='')

Fixed submission:
n,m=map(int, input().split())
mt=[0,2,5,5,4,5,6,3,7,6]
a=sorted(map(int, input().split()))[::-1]
dp=[-1]*(n+1)
dp[0]=0
for i in range(n+1):
    if dp[i]==-1:continue
    for j in a:
        if i+mt[j]<n+1:
            dp[i+mt[j]]=max(dp[i]*10+j,dp[i+mt[j]])
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
from scipy.special import comb
print(comb(10**4, 100, exact=True)%(10**9+7))


Fixed submission:
n,k=map(int, input().split())
if -(-n//2)>=k:print('YES')
else:print('NO')
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,k=map(int, input().split())
a=np.int64(list(map(int, input().split()))+[10**8]*(k+1))
dp=np.ones(n+k+10)*1000
dp[0]=0
s=np.arange(k)+1
for i in range(n+1):
    dp[s+i]=np.minimum(dp[s+i],dp[i]+np.abs(a[s+i]-a[i]))
print(int(dp[n-1]))

Fixed submission:
n,k=map(int, input().split())
a=list(map(int, input().split()))
dp=[0]*n
for i in range(1,n):
    m=10**9
    for j in range(max(0,i-k),i):
        m=min(m,dp[j]+abs(a[j]-a[i]))
    dp[i]=m
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*3 for i in range(n)]
dp[0]=a[0]
for i in range(1,n):
    for j in range(n):
        dp[i][j]=max(dp[i-1][(j+1)%3]+a[i][(j+1)%3],dp[i-1][(j+2)%3]+a[i][(j+2)%3])
print(max(dp[-1]))

Fixed submission:
n=int(input())
x=[list(map(int, input().split())) for i in range(n)]
dp=[[0]*3 for i in range(n+1)]
for i in range(n):
    for j in range(3):
        dp[i+1][j]=max(dp[i][(j+1)%3],dp[i][(j+2)%3])+x[i][j]
print(max(dp[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(float, input().split()))
dp=[[0]*(n+1) for i in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(n):
        if dp[i][j]==0:continue
        dp[i+1][j+1]+=dp[i][j]*a[i]
        dp[i+1][j]+=dp[i][j]*(1-a[i])
print(sum(dp[-1][n//2+1:]))

Fixed submission:
n=int(input())
a=list(map(float, input().split()))
dp=[[0]*(n+1) for i in range(n+1)]
dp[0][0]=1
for i in range(n):
    for j in range(n):
        if dp[i][j]==0:continue
        dp[i+1][j+1]+=dp[i][j]*a[i]
        dp[i+1][j]+=dp[i][j]*(1-a[i])
print(sum(dp[-1][n//2+1:]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,k=map(int,input().split())
t=np.int32(sorted(map(int,input().split())))
dp=np.ones((k+t.max()),dtype='int32')*-1
dp[:t[0]]=0
for i in range(k):
    dp[t+i]=np.maximum((dp[i]+1)%2,dp[t+i])
print(['Second','First'][dp[k]%2])

Fixed submission:
n,k=map(int,input().split())
t=sorted(map(int,input().split()))
dp=[-float('inf')]*(k+1)
dp[:t[0]]=[0]*t[0]
for i in range(k):
    for j in range(n):
        if i+t[j]<k+1:
            dp[i+t[j]]=max(dp[i+t[j]],(dp[i]+1)%2)
print(['Second','First'][dp[-1]%2])