Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if((a*b)%2==1):
  print("Odd")
else:
  print("Even")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if(ab%2==1):
  print("odd")
else:
  print("even")
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())

flag=False

for i in range(N+1):
  for j in range(N+1):
    if(9000*i+4000*j==Y-1000*N):
      flag=True
      x=i
      y=j
      z=N-i-j
      
if(flag==True and z>=0):
  print(str(x)+" "+str(y)+" "+str(z))
else:
  print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N,Y=map(int,input().split())

flag=False

for i in range(N+1):
  for j in range(N+1):
    if(9000*i+4000*j==Y-1000*N):
      flag=True
      x=i
      y=j
      z=N-i-j
      
if(flag=True and z>=0):
  print(str(x)+" "+str(y)+" "+str(z))
else:
  print("-1 -1 -1")
Problem p03493 (python)

Fixed submission:
n=int(input())
print(n%9)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
count=0
ans=a[0]
for i in range(n):
  count=0
  while(a[i]%2==0):
    a[i]=a[i]//2
    count+=1
  ans=min(ans,count)
  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
 
count=0
ans=a[0]
for i in range(n):
  count=0
  while(a[i]%2==0):
    a[i]=a[i]//2
    count+=1
  ans=max(ans,count)
  
print(ans)
Problem p02642 (python)

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

A.sort()
A.append(-1)

x = A[0]
if x != 1:
    flag = True
    for a in A:
        if a % x != 0:
            flag = False
    if flag:
        print(0)
        exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A[:-1]):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

A.sort()
A.append(-1)

x = A[0]
flag = True
for a in A:
    if a % x != 0:
        flag = False
if flag:
    print(0)
    exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))

A.sort()

x = A[0]
flag = True
for a in A:
    if a % x != 0:
        flag = False
if flag:
    print(0)
    exit()

used = [False] * A[-1]
ans = 0
for idx, a in enumerate(A):
    if used[a - 1]:
        continue
    if idx < n and a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)
Problem p02678 (python)

Fixed submission:
n, m = map(int, input().split())
edges = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

from collections import deque

q = deque()

prev = [-1] * n

q.append(0)
while q:
    v = q.popleft()
    for e in edges[v]:
        if prev[e] != -1:
            continue
        prev[e] = v
        q.append(e)

print("Yes")
for val in prev[1:]:
    print(val + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for i in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

from collections import deque

q = deque()

prev = [-1] * n

q.append(0)
while q:
    v = q.popleft()
    for e in edges[v]:
        if prev[e] != -1:
            continue
        prev[e] = v
        q.append(e)

print("Yes")
for val in prev[1:]:
    print(val + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for i in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

from collections import deque

q = deque()

prev = [-1] * n

q.append(0)
while q:
    v = q.pop()
    for e in edges[v]:
        if prev[e] != -1:
            continue
        prev[e] = v
        q.append(e)

print("Yes")
for val in prev[1:]:
    print(val + 1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
edges = [[] for i in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)

from collections import deque

q = deque()

prev = [-1] * n

q.append(0)
while q:
    v = q.pop()
    for e in edges[v]:
        if prev[e] != -1:
            continue
        prev[e] = v
        q.append(e)

print("Yes")
for val in prev[1:]:
    print(val + 1)
Problem p02732 (python)

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

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
# print(cnt)

total = 0
for val in cnt.values():
    if val >= 2:
        total += val*(val-1)//2

for i in range(n):
    diff = 0
    if a[i] in cnt:
        y = (cnt[a[i]]-1)*cnt[a[i]]//2
        x = (cnt[a[i]]-1)*(cnt[a[i]]-2)//2
        diff = y - x
    print(total - diff)
        
        

# for i in range(n):
#     flag = False
#     if a[i] in cnt:
#         cnt[a[i]] -= 1
#         flag = True
#     # print(cnt)
#     ans = 0
#     for val in cnt.values():
#         if val >= 2:
#             ans += val*(val-1)//2
#     print(ans)
#     if flag:
#         cnt[a[i]] += 1

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

from collections import defaultdict

cnt = defaultdict(int)
for i in range(n):
    cnt[a[i]] += 1
# print(cnt)

for key, val in list(cnt.items()):
    if val < 2:
        cnt.pop(key)
print(cnt)

total = 0
for val in cnt.values():
        if val >= 2:
            total += val*(val-1)//2

for i in range(n):
    if a[i] in cnt:
        y = (cnt[a[i]]-1)*cnt[a[i]]//2
        x = (cnt[a[i]]-1)*(cnt[a[i]]-2)//2
        diff = y - x
    print(total - diff)
        
        

# for i in range(n):
#     flag = False
#     if a[i] in cnt:
#         cnt[a[i]] -= 1
#         flag = True
#     # print(cnt)
#     ans = 0
#     for val in cnt.values():
#         if val >= 2:
#             ans += val*(val-1)//2
#     print(ans)
#     if flag:
#         cnt[a[i]] += 1
Problem p02768 (python)

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

MOD = 10 ** 9 + 7

def comb(n, r):
    ret = 1
    for i in range(r):
        ret *= n - i
        ret %= MOD
    for i in range(r):
        ret *= pow(i+1, MOD-2, MOD)
        ret %= MOD

    return ret % MOD
    

ans = pow(2, n, MOD) - 1 - comb(n, a) - comb(n, b)
ans %= MOD
print(ans)

Buggy submission (verdict: Runtime Error):
def prepare(N, MOD):
    fac = [None] * (N+2)
    finv = [None] * (N+2)
    inv = [None] * (N+2)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, N+1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD
    return fac, finv

def combination(N, K, fac, finv, MOD):
    if N < K:
        return 0
    if N < 0 or K < 0:
        return 0
    else:
        return fac[N] * (finv[K] * finv[N - K] % MOD) % MOD

n, a, b = map(int, input().split())

MOD = 10 ** 9 + 7
fac, finv = prepare(n, MOD)
ans = 2**n-1 - combination(n, a, fac, finv, MOD) - combination(n, b, fac, finv, MOD)
print(ans)
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
pS = [tuple(map(str, input().split())) for _ in range(M)]

AC = [False] * (N+1)
WA = [0] * (N+1)

pena = 0
for p, s in pS:
    p = int(p)
    if AC[p]:
        continue
    if s == 'WA':
        WA[p] += 1
    else:
        AC[p] = True
        pena += WA[p]
ac = sum(AC)
print(ac, pena)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
pS = [tuple(map(str, input().split())) for _ in range(M)]

ac = 0
wa = 0

x = 1
i = 0
while x <= N:
    if i >= M:
        break
    if pS[i][0] != str(x):
        x += 1
        continue
    if pS[i][1] == 'WA':
        wa += 1
        i += 1
    if pS[i][1] == 'AC':
        ac += 1
        x += 1
        i += 1

print(ac, wa)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
pS = [tuple(map(str, input().split())) for _ in range(M)]

if M == 0:
    print(0, 0)
    exit()

ac = 0
wa = 0

x = 1
i = 0
while x <= N:
    if pS[i][0] != str(x):
        x += 1
        continue
    if pS[i][1] == 'WA':
        wa += 1
        i += 1
    if pS[i][1] == 'AC':
        ac += 1
        x += 1
        i += 1

print(ac, wa)
Problem p02803 (python)

Fixed submission:
from collections import deque

H, W = map(int, input().split())
c = [input() for i in range(H)]

INF = -1

def bfs():
    dist = [[INF for i in range(W)] for j in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        # if p[0] == gx and p[1] == gy:
        #     break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == INF:
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    ret = -1
    for i in range(H):
        ret = max(ret, max(dist[i]))
    return ret

ans = -1
for i in range(H):
    for j in range(W):
            sx, sy = i, j
            if c[sx][sy] == '#':
                continue
            ans = max(ans, bfs())
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
# sx, sy = map(int, input().split())
# gx, gy = map(int, input().split())
# sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
c = [input() for i in range(H)]

dist = [[float('inf') for i in range(W)] for j in range(H)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

def bfs():
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == float('inf'):
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    return dist[gx][gy]

sx, sy, gx, gy = 2, 0, 0, 4
print(bfs())
ans = []
for i in range(H):
    for j in range(W):
        sx, sy = i, j
        for k in range(H):
            for l in range(W):
                gx, gy = k, l
                ans.append(bfs())

# print(ans)
ans = [i for i in ans if i != float('inf')]
print(max(ans))
Problem p02917 (python)

Fixed submission:
N = int(input())
b = list(map(int,input().split()))

a = []
a.append(b[-1])
for i in range(1,N-1):
    a.append(min(b[-i], b[-(i+1)]))
a.append(max(b[0], a[N-2]))

print(sum(a))

Buggy submission (verdict: Runtime Error):
N = int(input())
b = list(map(int,input().split()))

a = []
a.append(b[-1])
for i in range(1,N-1):
    a.append(min(b[-i], b[-(i+1)]))
a.append(max(b[0], b[1]))

print(sum(a))
Problem p02918 (python)

Fixed submission:
N, K = map(int, input().split())
S = input()

score = 0
for i in range(N-1):
    if (S[i] == S[i+1]):
        score += 1
ans = min(score+2*K, N-1)

print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()

score = 0
for i in range(N-1):
    if (S[i] == S[i+1]):
        score += 1
    ans = min(score+2*K, N-1)

print(ans)
Problem p02924 (python)

Fixed submission:
N = int(input())

if N == 1:
    print(0)
else:
    print((1+(N-1))*(N-1)//2)

Buggy submission (verdict: Runtime Error):
N = int(input())

arr = [i+1 for i in range(N)]

print((arr[0]+arr[-2])*(N-1)//2)
Problem p02960 (python)

Fixed submission:
S = input()

l = len(S)
MOD = 10**9+7
dp = [[0 for i in range(13)] for j in range(l+1)]
dp[0][0] = 1
for i in range(l):
    if S[i] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(k*10+j)%13] += dp[i][k] % MOD
    else:
        for k in range(13):
            dp[i+1][(k*10+int(S[i]))%13] += dp[i][k] % MOD

print(dp[-1][5] % MOD)

Buggy submission (verdict: Runtime Error):
S = input()

l = len(S)
MOD = 10**9+7
dp = [[0 for i in range(13)] for j in range(l+1)]
dp[0][0] = 1
for i in range(l):
    if S[i] == '?':
        for j in range(10):
            for k in range(13):
                dp[i+1][(k*10+j)%13] += dp[i][k] % MOD
    else:
        for k in range(13):
            dp[i+1][(k*10+int(S[i-1]))%13] += dp[i][k] % MOD

print(dp[-1][5] % MOD)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
lcm_num = lcm
A, B, C, D = map(int, input().split())

lcm_num = lcm(C, D)

if A%C == 0:
    cnt_c = A//C - 1
else:
    cnt_c = A//C

if A%D == 0:
    cnt_d = A//D - 1
else:
    cnt_d = A//D

if A%(lcm_num) == 0:
    cnt_cd = A//(lcm_num) - 1
else:
    cnt_cd = A//(lcm_num)



num = (B//C)+(B//D)-(B//(lcm_num)) - (cnt_c + cnt_d - cnt_cd)
print(B-A+1-num)

Buggy submission (verdict: Runtime Error):
, B, C, D = map(int, input().split())

if A%C == 0:
    cnt_c = A//C - 1
else:
    cnt_c = A//C

if A%D == 0:
    cnt_d = A//D - 1
else:
    cnt_d = A//D

if A%(C*D) == 0:
    cnt_cd = A//(C*D) - 1
else:
    cnt_cd = A//(C*D)

num = (B//C)+(B//D)-(B//(C*D)) - (cnt_c + cnt_d - cnt_cd)
print(B-A+1-num)

Buggy submission (verdict: Runtime Error):
, B, C, D = map(int, input().split())

if A%C == 0:
    cnt_c = A//C - 1
else:
    cnt_c = A//C

if A%D == 0:
    cnt_d = A//D - 1
else:
    cnt_d = A//D

if A%(C*D) == 0:
    cnt_cd = A//(C*D) - 1
else:
    cnt_cd = A//(C*D)

num = (B//C)+(B//D)-(B//(C*D)) - (cnt_c + cnt_d - cnt_cd)
print(B-A+1-num)
Problem p03037 (python)

Fixed submission:
N,M=map(int,input().split())
L=[]
R=[]
for i in range(M):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r)
max_l=max(L)
min_r=min(R)
if min_r-max_l>=0:
    print(min_r-max_l+1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
G=[]
a=[]
S=[]
for i in range(M):
    l,r=map(int,input().split())
    a=[x for x in range(l,r+1)]
    G.append(a)
for i in range(M-1):
    G_diff=set(G[i]).intersection(set(G[i+1]))
print(len(G_diff))
Problem p03044 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    u,v,w=map(int,input().split())
    edges[u-1].append((v-1,w))
    edges[v-1].append((u-1,w))

dist=[-1 for _ in range(N)]
def measure(src):
    for v,w in edges[src]:
        if dist[v]==-1:
            dist[v]=dist[src]+w
            measure(v)

dist[0]=0
measure(0)

for i in range(N):
    if dist[i]%2:
        print(1)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10*5)

N=int(input())
edges=[[] for _ in range(N)]
for _ in range(N-1):
    u,v,w=map(int,input().split())
    edges[u-1].append((v-1,w))
    edges[v-1].append((u-1,w))

dist=[-1 for _ in range(N)]
def measure(src):
    for v,w in edges[src]:
        if dist[v]==-1:
            dist[v]=dist[src]+w
            measure(v)

dist[0]=0
measure(0)

for i in range(N):
    if dist[i]%2:
        print(1)
    else:
        print(0)
Problem p03061 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
from fractions import gcd
gcd_l=[0]
gcd_r=[0]
for i in range(N):
    gcd_l.append(gcd(gcd_l[i],A[i]))
    gcd_r.append(gcd(gcd_r[i],A[-(i+1)]))
gcd_r=gcd_r[::-1]
ans=[]
for i in range(N):
    ans.append(gcd(gcd_l[i],gcd_r[i+1]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
from functools import reduce
from fractions import gcd
tmp=[]
for i in range(N):
    A.remove(i)
    tmp.append(reduce(gcd,A))
print(max(tmp))
Problem p03068 (python)

Fixed submission:
N=int(input())
S=list(input())
K=int(input())
for i in range(N):
    if S[i]!=S[K-1]:
        S[i]='*'
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
K=int(input())
cnt=0
for i in range(N):
    if S[i]!=S[K]:
        cnt+=1
print(cnt)
Problem p03069 (python)

Fixed submission:
from itertools import accumulate
N=int(input())
S=input()
black=[0]*N
white=[0]*N
for i,s in enumerate(S):
        if s=='#':
                black[i]=1
        else:
                white[i]=1
black = [0] + black
black = list(accumulate(black))
white = [0] + white[::-1]
white = list(accumulate(white))[::-1]
ans=[]
for i in range(N+1):
        ans.append(black[i]+white[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
N=int(input())
S=input()
black=[0]*N
white=[0]*N
for i,s in enumerate(S):
        if s=='#':
                black[i]=1
        else:
                white[i]=1
ans=[]
for i in range(N+1):
        ans.append(black[i]+white[i])
print(min(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
S_ptn1=S[::-1]
cnt=0
cnt_ptn1=0
for i in range(N-1):
    if S[i]=='#' and S[i+1]=='.':
        S[i+1]='#'
        cnt+=1
for i in range():
    if S_ptn1[i]=='.' and S_ptn1[i+1]=='#':
        S[i+1]='.'
        cnt_ptn1+=1
if cnt<cnt_ptn1:
    print(cnt)
else:
    print(cnt_ptn1)
Problem p03102 (python)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    tmp=0
    A=list(map(int,input().split()))
    for j in range(M):
        tmp+=A[j]*B[j]
    tmp+=C
    if tmp>0:
        cnt+=1
    else:
        cnt+=0
print(cnt)

Buggy submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
cnt=0
for i in range(N):
    tmp=0
    A=list(map(int,input().split())
    for j in range(M):
        tmp+=A[j]*B[j]
    tmp+=C
    if tmp>0:
        cnt+=1
    else:
        cnt+=0
print(cnt)

Buggy submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split())
cnt = 0
for i in range(N):
    tmp=0
    A=list(map(int,input().split())
    for j in range(M):
        tmp+=A[j]*B[j]
    tmp+=C
    if tmp>0:
        cnt+=1
    else:
        cnt+=0
print(cnt)
Problem p03105 (python)

Fixed submission:
A,B,C=map(int,input().split())
cnt=0
for i in range(C):
    B-=A
    if B>=0:
        cnt+=1
    else:
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
cnt=0
for i in range(C):
    if B-=A>=0:
        cnt+=1
    else:
        break
print(cnt)
Problem p03110 (python)

Fixed submission:
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(float(x))
    U.append(u)
    if U[i]=='BTC':
        X[i]=380000*X[i]
print(sum(X))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(float(x))
    U.append(u)
    if U[i]=='BTC':
        X[i]=380000*x
print(sum(X))

Buggy submission (verdict: Runtime Error):
N=int(input())
X=[]
U=[]
for i in range(N):
    x,u=input().split()
    X.append(int(x))
    U.append(u)
    if u=='BTC':
        X[i]=380000*x
print(sum(X))
Problem p03126 (python)

Fixed submission:
N,M=map(int,input().split())
S=set(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
S=(range(1,M+1))
for i in range(N):
    K,*A=map(int,input().splirt())
    S&=set(A)
print(len(S))
Problem p03163 (python)

Fixed submission:
N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    w_tmp, v_tmp = map(int, input().split())
    weight.append(w_tmp)
    value.append(v_tmp)

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(W+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j - weight[i]] + value[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])

Buggy submission (verdict: Runtime Error):
N, W = map(int, input().split())
weight = []
value = []
for _ in range(N):
    w_tmp, v_tmp = map(int, input().split())
    weight.append(w_tmp)
    value.append(v_tmp)

dp = [[0 for i in range(W+1)] for j in range(N+1)]
for i in range(W+1):
    dp[0][i] = 0

for i in range(N):
    for j in range(W+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j], dp[i][j - weight[i]] + v[i])
        else:
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])

print(dp[N][W])
Problem p03206 (python)

Fixed submission:
D=int(input())
if D==25:
    print('Christmas')
elif D==24:
    print('Christmas Eve')
elif D==23:
    print('Christmas Eve Eve')
elif D==22:
    print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
D=int(input())
if D=25:
    print('Christmas')
elif D=24:
    print('Christmas Eve')
elif D=23:
    print('Christmas Eve Eve')
elif D=22:
    print('Christmas Eve Eve Eve')
Problem p03238 (python)

Fixed submission:
N = int(input())
if N==1:
    print('Hello World')
else:
    A=int(input())
    B=int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
if input()=='1':
    print('Hello World')
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
if input()=='1':
    print(Hello World)
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
if input()='1':
    print(Hello World)
else input()=='2':
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
if input()='1':
    print(Hello World)
else:
    A=int(input())
    B=int(input())
    print(A+B)
Problem p03239 (python)

Fixed submission:
N,Time=map(int,input().split())
C=[]
T=[]
for _ in range(N):
    c,t=map(int,input().split())
    C.append(c)
    T.append(t)

tmp=[]
for i in range(N):
    if T[i]<=Time:
        tmp.append(C[i])
if tmp==[]:
    print('TLE')
else:
    print(min(tmp))

Buggy submission (verdict: Runtime Error):
N,Time=map(int,input().split())
C=[]
T=[]
for _ in range(N):
    c,t=map(int,input().split())
    C.append(c)
    T.append(t)

tmp=[]
for i in range(N):
    if T[i]<=Time:
        tmp.append(C[i])
print(min(tmp))

if tmp==[]:
    print('TLE')
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
even=[]
odd=[]
for i in range(n):
    if i%2==0:
        even.append(v[i])
    else:
        odd.append(v[i])
E=Counter(even).most_common()
O=Counter(odd).most_common()
E.append([0,0])
O.append([0,0])
if E[0][0]!=O[0][0]:
    print(n-(E[0][1]+O[0][1]))
else:
    print(min(n-(E[1][1]+O[0][1]),n-(E[0][1]+O[1][1])))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
from collections import Counter
even=[]
odd=[]
for i in range(n):
    if i%2==0:
        even.append(v[i])
    else:
        odd.append(v[i])
E=Counter(even).most_common()
O=Counter(odd).most_common()
if E[0][0]!=O[0][0]:
    print(n-(E[0][1]+O[0][1]))
else:
    print(min(n-(E[1][1]+O[0][1]),n-(E[0][1]+O[1][1])))
Problem p03262 (python)

Fixed submission:
from functools import reduce
from fractions import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i+1] - x[i])

print(reduce(gcd, diff))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

N, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i+1] - x[i])

print(reduce(gcd, diff))