Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(N)]

answer = []
for i in range(N):
  for j in range(i + 1, N):
    x1, x2 = min(XY[i][0], XY[j][0]), max(XY[i][0], XY[j][0])
    y1, y2 = min(XY[i][1], XY[j][1]), max(XY[i][1], XY[j][1])
    
    cnt = 0
    for n in range(N):
      x3, y3 = XY[n]
      if x1 <= x3 <= x2 and y1 <= y3 <= y2:
        cnt += 1
    if cnt == K:
      answer.append((x2 - x1) * (y2 - y1))
print(min(answer))

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

XY.sort()
#print("XY:", XY)

answer = []
for i in range(N):
  for k in range(K, N + 1):
    if i + k - 1 >= N:
      break
    dx = XY[i + k - 1][0] - XY[i][0]
    Y = []
    for x, y in XY[i: i + k]:
      Y.append(y)
    Y.sort()
    lenY = len(Y)
    for j in range(k):
      if j + K - 1 == lenY:
        break
      dy = Y[j + K - 1] - Y[j]
      answer.append(dx * dy)

print(min(answer))
Buggy python submission (verdict: Runtime Error):
N = int(input())

for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h + 1):
      if 1 / h + 1 / n < 4 / N:
        w = 1 / (4 / N - 1 / h - 1 / n)
        if w.is_integer() w > 0:
          print(h, n, int(w))
          exit()

Fixed submission:
N = int(input())

for h in range(1, 3501):
  for n in range(h, 3501):
    if (4 * h * n - N * n - h * N) == 0:
      continue
    w = (N * h * n) / (4 * h * n - N * n - h * N)
    if w.is_integer() and 1 <= w < 3501:
      print(h, n, int(w))
      exit()

Buggy python submission (verdict: Runtime Error):
N = int(input())
  
for h in range(1, 3501):
  if 1 / h < 4 / N:
    for n in range(1, h):
      w = 1 / (4 / N - 1 / h - 1 / n)
      if w > 3500:
        break
      if w.is_integer():
        print(h, n, int(w))
        exit()

Fixed submission:
N = int(input())

for h in range(1, 3501):
  for n in range(h, 3501):
    if (4 * h * n - N * n - h * N) == 0:
      continue
    w = (N * h * n) / (4 * h * n - N * n - h * N)
    if w.is_integer() and 1 <= w < 3501:
      print(h, n, int(w))
      exit()
Buggy python submission (verdict: Runtime Error):
A,B,C,D,E,F=map(int,input().split())

water=[0]*3001
if 100*A<3001: water[100*A]=100*A
if 100*B<3001: water[100*B]=100*B
for i in range(3001):
  if water[i]>0:
    if i+100*A<3001: water[i+100*A]=i+100*A
    if i+100*B<3001: water[i+100*B]=i+100*B
for i in range(1,3001):
  if water[i]==0:
    water[i]=water[i-1]
#print(water)

suger=[0]*3001
suger[C]=C
suger[D]=D
for i in range(3001):
  if suger[i]>0:
    if i+C<3001: suger[i+C]=i+C
    if i+D<3001: suger[i+D]=i+D
for i in range(1,3001):
  if suger[i]==0:
    suger[i]=suger[i-1]
#print(suger)

tmp=0
for i in water:
  w=i
  s=suger[w//100*E]
  if w+s<=F and w+s>0:
    if s/(w+s)*100>tmp:
      tmp=s/(w+s)*100
      mw=w
      ms=s
print(mw+ms,ms)

Fixed submission:
A,B,C,D,E,F = map(int,input().split())

water = [0] * (F//100 + 1)
water[0] = 1
for i in range(F//100 + 1):
  if water[i]:
    if i + A < F//100 + 1: water[i+A] = 1
    if i + B < F//100 + 1: water[i+B] = 1
water[0] = 0
#print(water)

suger = [0] * (F + 1)
suger[0] = 1
for i in range(F + 1):
  if suger[i]:
    if i + C < F + 1: suger[i+C] = 1
    if i + D < F + 1: suger[i+D] = 1
#print(suger)

max_sol = -1
answer = [0, 0]
for i in range(len(water)):
  if water[i] == 0:
    continue
  #print(i)
  for j in range(len(suger)):
    if suger[j] and i*100 + j <= F and j / (i*100 + j) <= E / (100 + E):
        if max_sol < 100 * j / (i*100 + j):
          max_sol = 100 * j / (i*100 + j)
          answer = [i*100 + j, j]
print(*answer)

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

water=[0]*3001
water[100*A]=100*A
water[100*B]=100*B
for i in range(3001):
  if water[i]>0:
    if i+100*A<3001: water[i+100*A]=i+100*A
    if i+100*B<3001: water[i+100*B]=i+100*B
for i in range(1,3001):
  if water[i]==0:
    water[i]=water[i-1]
#print(water)

suger=[0]*3001
suger[C]=C
suger[D]=D
for i in range(3001):
  if suger[i]>0:
    if i+C<3001: suger[i+C]=i+C
    if i+D<3001: suger[i+D]=i+D
for i in range(1,3001):
  if suger[i]==0:
    suger[i]=suger[i-1]
#print(suger)

tmp=0
for i in water:
  w=i
  s=suger[w//100*E]
  if w+s<=F and w+s>0:
    if s/(w+s)*100>tmp:
      tmp=s/(w+s)*100
      mw=w
      ms=s
print(mw+ms,ms)

Fixed submission:
A,B,C,D,E,F = map(int,input().split())

water = [0] * (F//100 + 1)
water[0] = 1
for i in range(F//100 + 1):
  if water[i]:
    if i + A < F//100 + 1: water[i+A] = 1
    if i + B < F//100 + 1: water[i+B] = 1
water[0] = 0
#print(water)

suger = [0] * (F + 1)
suger[0] = 1
for i in range(F + 1):
  if suger[i]:
    if i + C < F + 1: suger[i+C] = 1
    if i + D < F + 1: suger[i+D] = 1
#print(suger)

max_sol = -1
answer = [0, 0]
for i in range(len(water)):
  if water[i] == 0:
    continue
  #print(i)
  for j in range(len(suger)):
    if suger[j] and i*100 + j <= F and j / (i*100 + j) <= E / (100 + E):
        if max_sol < 100 * j / (i*100 + j):
          max_sol = 100 * j / (i*100 + j)
          answer = [i*100 + j, j]
print(*answer)
Buggy python submission (verdict: Time Limit Exceeded):
# readline比較用

import itertools
import sys
# input = sys.stdin.buffer.readline

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

W = [[10**10 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  a, b, c = map(int, input().split())
  W[a][b], W[b][a] = c, c
#print(W)
  
for k in range(N+1):
  for i in range(N+1):
    for j in range(N+1):
      W[i][j] = min(W[i][j], W[i][k] + W[k][j])
#print(W)

answer = 10**10
for v in itertools.permutations(r, R):
  tmp = 0
  for i in range(1, R):
    tmp += W[v[i]][v[i-1]]
  answer = min(answer, tmp)
print(answer)

Fixed submission:
import itertools
import sys
input = sys.stdin.buffer.readline

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

W = [[10**10 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
  a, b, c = map(int, input().split())
  W[a][b], W[b][a] = c, c
#print(W)
  
for k in range(N+1):
  for i in range(N+1):
    for j in range(N+1):
      W[i][j] = min(W[i][j], W[i][k] + W[k][j])
#print(W)

answer = 10**10
for v in itertools.permutations(r, R):
  tmp = 0
  for i in range(1, R):
    tmp += W[v[i]][v[i-1]]
  answer = min(answer, tmp)
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(input()) for _ in range(N)]
T=list(set(T))
#print(T)

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

ans=T[0]
for i in range(N):
  #print(ans)
  ans=ans*T[i]//gcd(ans,T[i])
print(ans)

Fixed submission:
N=int(input())
T=[int(input()) for _ in range(N)]
T=list(set(T))
N=len(T)
#print(T)

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

ans=T[0]
for i in range(N):
  #print(ans)
  ans=ans*T[i]//gcd(ans,T[i])
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
T=[int(input()) for _ in range(N)]
T=list(set(T))
print(T)

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

ans=T[0]
for i in range(N):
  #print(ans)
  ans=ans*T[i]//gcd(ans,T[i])
print(ans)

Fixed submission:
N=int(input())
T=[int(input()) for _ in range(N)]
T=list(set(T))
N=len(T)
#print(T)

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

ans=T[0]
for i in range(N):
  #print(ans)
  ans=ans*T[i]//gcd(ans,T[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

check = [0] * (M + 1)

answer = []
for n in range(N):
  tmp = []
  for ai in A:
    for aij in ai:
      if check[aij] == 0:
        tmp.append(aij)
        break
  #print(tmp)
  counter = list(Counter(tmp).items())
  counter.sort(key = lambda x: -x[1])  
  answer.append(counter[0][1])
  check[counter[0][0]] = 1
  
print(min(answer))

Fixed submission:
from collections import Counter

N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

check = [0] * (M + 1)

answer = []
for _ in range(M):
  tmp = []
  for ai in A:
    for aij in ai:
      if check[aij] == 0:
        tmp.append(aij)
        break
  #print(tmp)
  counter = list(Counter(tmp).items())
  counter.sort(key = lambda x: -x[1])  
  answer.append(counter[0][1])
  check[counter[0][0]] = 1
  
print(min(answer))
Buggy python submission (verdict: Runtime Error):
import collections

N=int(input())
A=list(map(int,input().split()))

B=collections.deque([])
for i,a in enumerate(A):
  if i%2==0:
    B.append(a)
  else:
    B.appendleft(a)
if N%2==1:
  B=B[::-1]

print(" ".join(map(str,B)))

Fixed submission:
import collections

N=int(input())
A=list(map(int,input().split()))

B=collections.deque([])
for i in range(N):
  if i%2==0:
    B.append(A[i])
  else:
    B.appendleft(A[i])
#print(B)
B=list(B)
#print(B)
if N%2==1:
  B=B[::-1]

print(" ".join(map(str,B)))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

B=[]
for i,a in enumerate(A):
  if i%2==0:
    B.append(a)
  else:
    B.insert(0,a)
if N%2==1:
  B=B[::-1]

print(" ".join(map(str,B)))

Fixed submission:
import collections

N=int(input())
A=list(map(int,input().split()))

B=collections.deque([])
for i in range(N):
  if i%2==0:
    B.append(A[i])
  else:
    B.appendleft(A[i])
#print(B)
B=list(B)
#print(B)
if N%2==1:
  B=B[::-1]

print(" ".join(map(str,B)))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))

B=[]
for a in A:
  B.append(a)
  B=B[::-1]
print(" ".join(map(str,B)))

Fixed submission:
import collections

N=int(input())
A=list(map(int,input().split()))

B=collections.deque([])
for i in range(N):
  if i%2==0:
    B.append(A[i])
  else:
    B.appendleft(A[i])
#print(B)
B=list(B)
#print(B)
if N%2==1:
  B=B[::-1]

print(" ".join(map(str,B)))
Buggy python submission (verdict: Runtime Error):
print(int(input().replace(" ","",3))


Fixed submission:
a,b,c=input().split()
print("YES" if int(a+b+c)%4==0 else "NO")
Buggy python submission (verdict: Runtime Error):
a,b=map(input().split())
if a==b:
  print("H")
else:
  print("D")

Fixed submission:
a,b=input().split()
if a==b:
  print("H")
else:
  print("D")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

T = ["SS", "SW", "WS", "WW"]

for t in T:
  for i in range(1, N-1):
    if (t[i] == "S" and S[i] == "o") or (t[i] == "W" and S[i] == "x"):
        t += t[i-1]
    else:
        t += "S" if t[i-1] == "W" else "W"
  #print(t)
  
  flag = 1
  if (t[0] == "S" and S[0] == "o") or (t[0] == "W" and S[0] == "x"):
    if t[-1] != t[1]: flag = 0
  else:
    if t[-1] == t[1]: flag = 0
  if (t[-1] == "S" and S[-1] == "o") or (t[-1] == "W" and S[-1] == "x"):
    if t[-2] != t[0]: flag = 0
  else:
    if t[-2] == t[0]: flag = 0
  if flag:
    print(t)
    exit()
print(-1)

Fixed submission:
N = int(input())
S = input()

T = [["S", "S"], ["S", "W"], ["W", "S"], ["W", "W"]]

for t in T:
  for i in range(1, N-1):
    if (t[i] == "S" and S[i] == "o") or (t[i] == "W" and S[i] == "x"):
        t.append(t[i-1])
    else:
        t.append("S" if t[i-1] == "W" else "W")
  #print(t)
  
  flag = 1
  if (t[0] == "S" and S[0] == "o") or (t[0] == "W" and S[0] == "x"):
    if t[-1] != t[1]: flag = 0
  else:
    if t[-1] == t[1]: flag = 0
  if (t[-1] == "S" and S[-1] == "o") or (t[-1] == "W" and S[-1] == "x"):
    if t[-2] != t[0]: flag = 0
  else:
    if t[-2] == t[0]: flag = 0
  if flag:
    print("".join(t))
    exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline

N, Ma, Mb = map(int, input().split())
ABC = [list(map(int, input().split())) for _ in range(N)]

sumA = sum([ABC[i][0] for i in range(N)])
sumB = sum([ABC[i][1] for i in range(N)])

INF = 10 ** 15
dp = [[INF for j in range(sumA + 1)] for i in range(sumB + 1)]
dp[0][0] = 0

for a, b, c in ABC:
  for i in range(sumA, -1, -1):
    for j in range(sumB, -1, -1):
      if dp[i][j] != INF:
        dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)

answer = INF
for i in range(1, sumA + 1):
  for j in range(1, sumB + 1):
    if dp[i][j] != INF and i / j == Ma / Mb:
      answer = min(answer, dp[i][j])
      
print(answer if answer != INF else -1)

Fixed submission:
import sys
input = sys.stdin.buffer.readline

N, Ma, Mb = map(int, input().split())
ABC = [list(map(int, input().split())) for _ in range(N)]

INF = 10 ** 15
dp = [[INF for j in range(401)] for i in range(401)]
dp[0][0] = 0

for a, b, c in ABC:
  for i in range(400, -1, -1):
    for j in range(400, -1, -1):
      if dp[i][j] != INF:
        dp[i + a][j + b] = min(dp[i + a][j + b], dp[i][j] + c)

answer = INF
for i in range(1, 401):
  for j in range(1, 401):
    if dp[i][j] != INF and i / j == Ma / Mb:
      answer = min(answer, dp[i][j])
      
print(answer if answer != INF else -1)
Buggy python submission (verdict: Runtime Error):
print(" ".jpin(input().split(",")))

Fixed submission:
print(" ".join(input().split(",")))
Buggy python submission (verdict: Runtime Error):
import math

N=int(input())
A=[int(input()) for _ in range(N)]
#print(A)

B=0
for a in A:
  B^=a

C=[]
D=[0]*30
for a in A:
  C.append(bin(a^(a-1))[2:])
#print(C)
for c in C:
  D[len(c)]=1
#print(D)

ans=0
while B:
  #print(B,bin(B))
  if D[len(bin(B)[2:])]:
    B^=2**len(bin(B)[2:])-1
    ans+=1
  else:
    ans=-1
    break
print(ans)  

Fixed submission:
import math

N=int(input())
A=[int(input()) for _ in range(N)]
#print(A)

B=0
for a in A:
  B^=a

C=[]
D=[0]*100
for a in A:
  C.append(bin(a^(a-1))[2:])
#print(C)
for c in C:
  D[len(c)]=1
#print(D)

ans=0
while B:
  #print(B,bin(B))
  if D[len(bin(B)[2:])]:
    B^=2**len(bin(B)[2:])-1
    ans+=1
  else:
    ans=-1
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
H,W=map(int,input().split())
A=[]
for i in range(H):
  A.append(input())
#print(A)

sw=0
for i in range(H):
  tmp=0
  for j in range(W-1):
    if A[i][j]=="#" and A[i][j+1]==".":
      tmp=1
    if tmp==1 and A[i][j]=="." and A[i][j+1]=="#":
      sw=1
#print(sw)

if sw==1:
  print("Impossible")
else:
  l=[]
  r=[]
  for i in range(H):
    ll=0
    for j in range(W-1):
      if A[i][j]=="." and A[i][j+1]=="#":
        ll=j+1
        break
    l.append(ll)
    
    rr=W-1
    for j in range(W-1):
      if A[i][j]=="#" and A[i][j+1]==".":
        rr=j
        break
    r.append(rr)
#  print(l)
#  print(r)

  sw2=0
  for i in range(len(r)-1):
    if r[i]!=l[i+1]:
      sw2=1
  print("Impossible" if sw2==1 else "Possible")
Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)

if "C" in S and "F" in S:
  print("No")
else:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")



Fixed submission:
S=input()
N=len(S)

if "C" in S and "F" in S:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")
else: 
  print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)

c=S.index("C")
S=S[::-1]
f=N-S.index("F")-1
#print(c,f)

print("Yes" if c<f else "No")

Fixed submission:
S=input()
N=len(S)

if "C" in S and "F" in S:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")
else: 
  print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
N=len(S)

c=S.index("C")
S=S[::-1]
f=N-S.index("F")-1
#print(c,f)

print("Yes" if c<f else "No")



Fixed submission:
S=input()
N=len(S)

if "C" in S and "F" in S:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")
else: 
  print("No")
Buggy python submission (verdict: Runtime Error):
a=set(list(input.split()))
print(len(list(a)))

Fixed submission:
a=list(input().split())
print(len(set(a)))

Buggy python submission (verdict: Runtime Error):
a=set(list(input.split()))
print(len(a))

Fixed submission:
a=list(input().split())
print(len(set(a)))

Buggy python submission (verdict: Runtime Error):
a=set(input.split())
print(len(a))

Fixed submission:
a=list(input().split())
print(len(set(a)))
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
print(k*((k-1)**(n-1))

Fixed submission:
n,k=map(int,input().split())
print(k*((k-1)**(n-1)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A = [(a, i) for i, a in enumerate(A, 1)]
A.sort()

n2i = [0] * (N + 1)
for a, i in A:
    n2i[a] = i

def num2index(a):
    print(a)
    if a == 0:
        return 1
    else:
        return n2i[a] + 1

bit = [0] * (N + 1)

def bit_add(bit, i, x):
    while i <= N:
        bit[i] += x
        i += i & - i

def bit_sum(bit, i):
    res = 0
    while i:
        res += bit[i]
        i -= i & -i
    return res
    
def bit_find_prev(i):
    if bit_sum(bit, i - 1) == 0:
        return 0
    else:
        ok = i - 1
        ng = 0
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if bit_sum(bit, ok) - bit_sum(bit, mid):
                ng = mid
            else:
                ok = mid
        return ok

def bit_find_next(i):
    if bit_sum(bit, N) - bit_sum(bit, i) == 0:
        return N + 1
    else:
        ok = N
        ng = i
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            if bit_sum(bit, mid) - bit_sum(bit, ng):
                ok = mid
            else:
                ng = mid
        return ok
    
answer = 0
for a, i in A:
    bit_add(bit, i, 1)
    #print(i, bit_find_prev(i), bit_find_next(i))
    answer += (bit_find_next(i) - i) * (i - bit_find_prev(i)) * a

print(answer)

Fixed submission:
import sys
input = sys.stdin.buffer.readline

N = int(input())
A = list(map(int, input().split()))

left = [0] * N
tmp = []
for i, a in enumerate(A):
    cnt = 1
    while tmp:
        aa, c = tmp.pop()
        if aa < a:
            tmp.append((aa, c))
            break
        else:
            cnt += c
    tmp.append((a, cnt))
    left[i] = cnt
A =A [::-1]
right = [0] * N
tmp = []
for i, a in enumerate(A):
    cnt = 1
    while tmp:
        aa, c = tmp.pop()
        if aa < a:
            tmp.append((aa, c))
            break
        else:
            cnt += c
    tmp.append((a, cnt))
    right[i] = cnt
right = right[::-1]

A = A[::-1]
answer = 0
for i in range(N):
    answer += left[i] * right[i] * A[i]
    
print(answer)
Buggy python submission (verdict: Runtime Error):
import collections

S=input()
N=len(S)
D=collections.deque([])

for i in range(N):
  if S[i]=="B":
    D.pop()
  else:
    D.append(S[i])
    
print("".join(list(D)))

Fixed submission:
import collections

S=input()
N=len(S)
D=collections.deque([])

for i in range(N):
  if S[i]=="B":
    if len(D):
      D.pop()
  else:
    D.append(S[i])
print("".join(list(D)))
Buggy python submission (verdict: Runtime Error):
N,L=map(int,input())
S=[input() for _ in range(N)]
S.sort()
print("".join(S))

Fixed submission:
N,L=map(int,input().split())
S=[input() for _ in range(N)]
S.sort()
print("".join(S))
Buggy python submission (verdict: Runtime Error):
s = input()
if s[3] == s[4] and s[5] == s[6]:
  print("Yes")
else:
  print("No")

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
P, N = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
mn = arr[-1] - arr[0]
for i in range(N):
    val = arr.pop(0)
    arr.append(val + P)
    mn = min([mn, arr[-1] - arr[0]])
print(mn)


Fixed submission:
P, N = list(map(int, input().split()))
arr = list(map(int, input().split()))
mn = 100000000
l, r = 0, len(arr) - 1
for i in range(N):
    if (arr[r] - arr[l]) < mn:
        mn = arr[r] - arr[l]
    arr[l] += P
    l = (l + 1) % N
    r = (r + 1) % N
print(mn)
Buggy python submission (verdict: Runtime Error):
w, a, b = list(map(int, input().split()))
if b > (a + w):
  print(b - (a + w))
else:
  print(0)

Fixed submission:
res = {
  ('H', 'H'): 'H',
  ('H', 'D'): 'D',
  ('D', 'H'): 'D',
  ('D', 'D'): 'H'
}
print(res[tuple(input().split())])
Buggy python submission (verdict: Runtime Error):
print(int(not(bool(x))))

Fixed submission:
if input() == "1":
  print(0)
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
values = [a*c, a*d, b*c, b*d]
print(max(values))

Fixed submission:
inputs = input().split(" ")
a = int(inputs[0])
b = int(inputs[1])
c = int(inputs[2])
d = int(inputs[3])

values = [a*c, a*d, b*c, b*d]
print(max(values))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

a = list(map(int, input().split()))

s = sum(a)

a.sort()

if a[m - 1] * a * m >= s:
    print("Yes")
else:
    print("No")


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

a = list(map(int, input().split()))

s = sum(a)

a.sort(reverse=True)

if a[m - 1] >= s / (4*m):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << endl
#define print10(ele) cout << fixed << setprecision(10) << (ele) << endl

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  string s;
  cin >> s;
  int ans = 0;
  REP(i, 4) {
    if (s[i] == '+')
      ans++;
    else
      ans--;
  }
  print(ans);
  return 0;
}

Fixed submission:
s = input()

ans = 0

for i in range(4):
    if s[i] == '+':
        ans += 1
    else:
        ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
import math

# n, k = map(int, input().split())

a = list(map(int, input().split()))
n -= 1
k -= 1
ans = (n + k - 1) // k

print(ans)


Fixed submission:
import math

n, k = map(int, input().split())

a = list(map(int, input().split()))
n -= 1
k -= 1
ans = math.ceil(n / k)

print(ans)
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define rall(c) c.end(), c.begin()
#define INF (int)1e9
#define MOD 1000000007
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef map<int, int> MPII;
typedef set<int> SETI;

const int mxN = 2e5;
int a[mxN];

int sum(vector<int> v)
{
    int s = 0;
    for (int i = 0; i < v.size(); ++i)
    {
        s += v[i];
    }
    return s;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vi v(n);
    for (auto &x : v)
        cin >> x;

    int t;
    cin >> t;

    int s = sum(v);
    map<int, int> m;
    for (auto x : v)
        if (m.find(x) != m.end())
            m[x] += 1;
        else
            m[x] = 1;
    while (t--)
    {
        int b, c;
        cin >> b >> c;
        if (m.find(c) != m.end())
            m[c] += m[b];
        else
            m[c] = m[b];
        s += ((c - b) * m[b]);
        m[b] = 0;
        cout << s << "\n";
    }

    return 0;
}

Fixed submission:
from collections import Counter
n = int(input())
ar = list(map(int, input().split()))

t = int(input())
c = Counter(ar)
s = sum(ar)
for i in range(t):
    a, b = list(map(int, input().split()))
    if b in c:
        c[b] += c[a]
    else:
        c[b] = c[a]
    s += ((b-a)*c[a])
    print(s)
    c[a] = 0
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k= map(int, input().split())
for i in range(a, b+1):
    if i < a+k or b-i+1 <= k:
        print(i)    


Fixed submission:
a, b, k= map(int, input().split())
if a+k >= b-k:
    for i in range(a, b+1):
        if i < a+k or b-i+1 <= k:
            print(i)
else:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)