Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A123 = sum(list(map(int, input().split())))
print('bust' if A123 > 21, else 'win')

Fixed submission:
A123 = sum(list(map(int, input().split())))
print('bust' if A123 > 21 else 'win')
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=map(int, input().split())
B=[0]*N
C=''

for i in range(N):
    B[A[i]-1]=i+1

for i in range(N):
    C+=str(B[i])+' '

print(C[0:-1])

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
C=''
 
for i in range(N):
    B[A[i]-1]=i+1
 
for i in range(N):
    C+=str(B[i])+' '
 
print(C[0:-1])

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

import math

if N%2==0:
    for i in range(math.ceil(N/2)):
        B+=str(A.index(i+1)+1)+' '
        C+=str(A.index(N//2+i+1)+1)+' '
    print(B+C[0:-1])
else:
    for i in range(math.ceil(N/2)):
        B+=str(A.index(i+1)+1)+' '
        C+=str(A.index(N//2+i+1)+1)+' '
    print(B+C[2:-1])    

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
C=''
 
for i in range(N):
    B[A[i]-1]=i+1
 
for i in range(N):
    C+=str(B[i])+' '
 
print(C[0:-1])

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

C=''

for i in range(N):
    C+=str(A.index(i+1)+1)+' '
print(C[0:-1])

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
C=''
 
for i in range(N):
    B[A[i]-1]=i+1
 
for i in range(N):
    C+=str(B[i])+' '
 
print(C[0:-1])

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

B=[0]*N
C=''

for i in range(N):
    B[i]=A.index(i+1)
    B[i]+=1
    C+=str(B[i])+' '
print(C[0:-1])

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=[0]*N
C=''
 
for i in range(N):
    B[A[i]-1]=i+1
 
for i in range(N):
    C+=str(B[i])+' '
 
print(C[0:-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
B = [int(input()) for i in range(N)]
C = [int(input()) for i in range(N-1)]

ans = 0

for i in range(N):
  ans += B[A[i]-1]
  if i >0 and A[i] - A[i-1] ==1:
    ans += C[A[i]-2]
        
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
ans = 0
 
for i in range(N):
  ans += B[A[i]-1]
  if i >0 and A[i] - A[i-1] ==1:
    ans += C[A[i]-2]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
x = 0

for i in range(3):
  if S[i] == T[i]
  	x = x +1
  else:
  	x = x

print(x)



Fixed submission:
S = input()
T = input()
x = 0
 
for i in range(3):
  if S[i] == T[i]:
  	x = x + 1
  else:
  	x = x
print(x)
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(math.ceil((B-1)/(A-1))

Fixed submission:
import math
A, B = map(int, input().split())
print(math.ceil((B-1)/(A-1)))
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

H.reverse()
ans = [0 for i in range(N-1)]
val = 0
for i in range(N-2):
  if H[i] <= H[i+1]:
    val +=1
  else:
    ans[i] = val
    val = 0

print(max(ans))

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

H.reverse()
ans = 0
val = 0
for i in range(N-1):
    if H[i] <= H[i+1]:
        val +=1
        ans = max(ans,val)
        #print(ans)
    else:
        ans = max(ans,val)
        val = 0
        #print(ans)

#print(H)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()

cnt=0

for i in range(1,N+1):
    if len(str(i)) %2 != 0:
        cnt+=1
print(cnt)

Fixed submission:
N = int(input())
 
cnt=0
 
for i in range(1,N+1):
    if len(str(i)) %2 != 0:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
N, D=map(int, input().split())
print(math.ceil(N/(2*D+1))

Fixed submission:
import math
N, D =map(int, input().split())
print(math.ceil(N/(2*D+1)))
Buggy python submission (verdict: Runtime Error):
S = input()
x = list(set(S))
print("Yes" if len(set(S)) == 2 and len(S.remove(x[0])) == 2 and len(S.remove(x[1])) == 2 else "No")


Fixed submission:
S = input()
x = list(set(S))
print("Yes" if len(set(S)) == 2 and S.count(x[0]) == 2 and S.count(x[1]) == 2 else "No")

Buggy python submission (verdict: Runtime Error):
S = input()
x = list(set(S))
print("Yes" if len(set(S)) == 2 and len(S.remove(x[0])) == 2 and len(S.remove(x[0])) == 2 else "No")

Fixed submission:
S = input()
x = list(set(S))
print("Yes" if len(set(S)) == 2 and S.count(x[0]) == 2 and S.count(x[1]) == 2 else "No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
d=list(map(int, input().split()))

d=sorted(d)
ans=0
 
for i in range(10**7):
    if d[int(N/2-1)] < i and i <= d[int(N/2)]:
        ans +=1
 
print(ans)

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

d=sorted(d)
ans= d[int(N/2)] - d[int(N/2-1)]

print(ans)
Buggy python submission (verdict: Runtime Error):
N=input()
W=list(map(int, input().split()))

sum1,sum2=0,0
ans=0
dif=1000

for i in range(N):
    sum1=sum(W[0:i])
    sum2=sum(W[i:])
    now = abs(sum1-sum2)
    if dif > now:
        dif =now

print(dif)

Fixed submission:
N=int(input())
W=list(map(int, input().split()))
 
sum1,sum2=0,0
ans=0
dif=1000
 
for i in range(N):
    sum1=sum(W[0:i])
    sum2=sum(W[i:])
    now = abs(sum1-sum2)
    if dif > now:
        dif =now
 
print(dif)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
q = [list(map(int, input().split())) for i in range(m)]
ans = 0

for s in range(2**n): #スイッチのon/offの状態の総当たり（2**n通り）
    judge = True
    for i in range(m): #電球1つずつに対して
        cnt=0
        for j in range(1,len(q[i])): #sの総当たりでqに当てはまるものを探す。kはforを1からにすれば無視できる。
            w=q[i][j]
            if s >> (w-1) &1 ==1: #sをw-1回シフトさせて(w-1)個目のスイッチがonか判定
                cnt+=1 #onになっているスイッチの個数をカウント
        if cnt % 2 != p[i]: #スイッチの個数を2で割った余りがpiに等しいか判定
            judge = False
    if judge:
        ans += 1

print(ans)

Fixed submission:
n,m = map(int,input().split())
q = [list(map(int, input().split())) for i in range(m)]
p= list(map(int, input().split()))
ans = 0
 
for s in range(2**n): #スイッチのon/offの状態の総当たり（2**n通り）
    judge = True
    for i in range(m): #電球1つずつに対して
        cnt=0
        for j in range(1,len(q[i])): #sの総当たりでqに当てはまるものを探す。kはforを1からにすれば無視できる。
            w=q[i][j]
            if s >> (w-1) &1 ==1: #sをw-1回シフトさせて(w-1)個目のスイッチがonか判定
                cnt+=1 #onになっているスイッチの個数をカウント
        if cnt % 2 != p[i]: #スイッチの個数を2で割った余りがpiに等しいか判定
            judge = False
    if judge:
        ans += 1
 
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int, input().split())
L = []
R = []
for i in range(M):
    l, r = input().split()
    L.append(int(l))
    R.append(r)


x = min(R)-max(L)


print(0 if x <0 else x+1)

Fixed submission:
N,M=map(int, input().split())
L = []
R = []
for i in range(M):
    l, r = input().split()
    L.append(int(l))
    R.append(int(r))


x = min(R)-max(L)


print(0 if x <0 else x+1)
Buggy python submission (verdict: Runtime Error):
N K =map(int, input().split())

print(N-K+1)

Fixed submission:
N,K =map(int, input().split())
 
print(N-K+1)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
ans =0
for i in range(1,10**5):
  if S.count('0') ==0 or S.count('1') ==0:
      break
  for j in range(1,10**5):
      if S[j] != S[j-1]:
          S= S[0:j-1]+S[j+1:]
          ans +=2
          break
    
print(ans)

Fixed submission:
S=input()

ans = min(S.count('0'), S.count('1'))

print(ans*2)
Buggy python submission (verdict: Runtime Error):
N = input()
L = map(int, input().split())
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")


Fixed submission:
N = int(input())
L = list(map(int, input().split()))
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = map(int, input().split())
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = map(int, input().split())
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
z = 0
for i in range(N-1):
    z = z + y[i]
print("Yes" if Lmax < z else "No")

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
x = sorted(L)
Lmax = max(L)
y = x[0:-1]
ysum = sum(y)
print("Yes" if Lmax < ysum else "No")
Buggy python submission (verdict: Time Limit Exceeded):
# sys.stdin.readline()
import sys
input = sys.stdin.readline

N,K=map(int, input().split())
h=list(map(int, input().split()))
 
# dpの最小値を変更する関数
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
      
f_inf = float('inf')
dp = [f_inf]*N
dp[0]=0
#dp[1]=abs(h[1]-h[0])
 
#配るDP
for i in range(N-1):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j]=chmin(abs(h[i]-h[i+j])+dp[i],dp[i+j])
    
print(dp[-1])

Fixed submission:
# sys.stdin.readline()
import sys
input = sys.stdin.readline

N,K=map(int, input().split())
h=list(map(int, input().split()))
import numpy as np 
      
f_inf = float('inf')
dp = [f_inf]*N
dp[0]=0
# hの配列を作る。
h = np.array(h)
 
#配るDP
for i in range(1,N):
    # start は負になることはない。
    start = max(0, i-K)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
    
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
h=list(map(int, input().split()))
 
# dpの最小値を変更する関数
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
      
f_inf = float('inf')
dp = [f_inf]*N
dp[0]=0
#dp[1]=abs(h[1]-h[0])
 
#配るDP
for i in range(N-1):
    for j in range(1,K+1):
        if i+j < N:
            dp[i+j]=chmin(abs(h[i]-h[i+j])+dp[i],dp[i+j])
    
print(dp[-1])

Fixed submission:
# sys.stdin.readline()
import sys
input = sys.stdin.readline

N,K=map(int, input().split())
h=list(map(int, input().split()))
import numpy as np 
      
f_inf = float('inf')
dp = [f_inf]*N
dp[0]=0
# hの配列を作る。
h = np.array(h)
 
#配るDP
for i in range(1,N):
    # start は負になることはない。
    start = max(0, i-K)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
    
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().input())

print('Yes' if A%2 !=0 and B%2 !=0 else 'No')

Fixed submission:
A,B = map(int, input().split())
 
print('Yes' if A%2 !=0 and B%2 !=0 else 'No')
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
N, X = map(int, input().slpit())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

Fixed submission:
import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
N, X = map(int, input().slpit())
x = [int(input()) for i in range(N)]

for i in range(N):
    x[i] = abs(x[i]-X)

x = sorted(x)[::-1]
cnt = 0

for i in range(N):
    cnt = math.gcd(cnt, x[i])

print(cnt)

Fixed submission:
import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce
N, X = map(int, input().split())
x = [int(input()) for i in range(N)]
 
 
x.insert(0,X)
x = sorted(x)
 
y = [0]*N
 
for i in range(N):
    y[i] = x[i+1]-x[i]
 
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
 
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
 
print(gcd(*y))

Fixed submission:
import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)

Buggy python submission (verdict: Runtime Error):
import fractions
from functools import reduce
N, X = map(int, input().split())
x = [int(input()) for i in range(N)]


x.insert(0,X)
x = sorted(x)

y = [0 for i in range(N)]

for i in range(N):
    y[i] = x[i+1]-x[i]

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

print(gcd(*y))

Fixed submission:
import math
from functools import reduce
N, X = map(int, input().split())
x = list(map(int,input().split()))
 
for i in range(N):
    x[i] = abs(x[i]-X)
 
x = sorted(x)[::-1]
cnt = 0
 
for i in range(N):
    cnt = math.gcd(cnt, x[i])
 
print(cnt)
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:
        print(i)
    elif i > B-K:
        print(i)

Fixed submission:
A,B,K=map(int, input().split())

if K>(B-A)/2:
    for i in range(A,B+1):
        print(i)
else:
    for i in range(A,A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)
Buggy python submission (verdict: Runtime Error):
N=int(input())
D,X=map(int, input().spilt())
A=[int(input()) for i in range(N)]

ans=0

for i in range(len(A)):
    ans += (D-1)//A[i]+1
print(ans+X) 

Fixed submission:
N=int(input())
D,X=map(int,input().split())
A=[int(input()) for _ in range(N)]
 
ans=0
 
for i in range(len(A)):
    ans = ans + (D-1)//A[i]+1
print(ans+X)
Buggy python submission (verdict: Runtime Error):
N=int(intput())

print(N//3)

Fixed submission:
N=int(input())
 
print(N//3)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=list(map(string, input().slipt()))

if 'Y' in S:
  print('Four')
else:
  print('Three')

Fixed submission:
N=int(input())
S=list(input().split())
 
if 'Y' in S:
  print('Four')
else:
  print('Three')
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=[input() for _ in range(N)]
cnt=[0]*N
cnt2=[]
flag=0

for i in range(N):
    if S[i][0]=='M':
        cnt[0]+=1
    elif S[i][0]=='A':
        cnt[1]+=1
    elif S[i][0]=='R':
        cnt[2]+=1
    elif S[i][0]=='C':
        cnt[3]+=1
    elif S[i][0]=='H':
        cnt[4]+=1

for i in range(N):
    if cnt[i]!=0:
        cnt2.append(cnt[i])
        
import math
import itertools
ans=0

for v in itertools.combinations(cnt2, 3):
    ans+=v[0]*v[1]*v[2]

print(ans)

Fixed submission:
N=int(input())
S=[input() for _ in range(N)]
cnt=[0]*N
cnt2=[]
flag=0

if len(S)>1:
    for i in range(N):
        if S[i][0]=='M':
            cnt[0]+=1
        elif S[i][0]=='A':
            cnt[1]+=1
        elif S[i][0]=='R':
            cnt[2]+=1
        elif S[i][0]=='C':
            cnt[3]+=1
        elif S[i][0]=='H':
            cnt[4]+=1

for i in range(N):
    if cnt[i]!=0:
        cnt2.append(cnt[i])
        
import math
import itertools
ans=0

for v in itertools.combinations(cnt2, 3):
    ans+=v[0]*v[1]*v[2]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[input() for _ in range(N)]

cnt=[]
ans=0
for i in range(N):
    if S[i][0]=='M':
        cnt.append('M')
    elif S[i][0]=='A':
        cnt.append('A')
    elif S[i][0]=='R':
        cnt.append('R')
    elif S[i][0]=='C':
        cnt.append('C')
    elif S[i][0]=='H':
        cnt.append('H')
        
import math
import itertools
c_list = list(itertools.combinations(cnt, 3))

for v in itertools.combinations(cnt, 3):
    if len(set(v))==3:
        ans+=1

print(ans)


Fixed submission:
N=int(input())
S=[input() for _ in range(N)]
cnt=[0]*N
cnt2=[]
flag=0

if len(S)>1:
    for i in range(N):
        if S[i][0]=='M':
            cnt[0]+=1
        elif S[i][0]=='A':
            cnt[1]+=1
        elif S[i][0]=='R':
            cnt[2]+=1
        elif S[i][0]=='C':
            cnt[3]+=1
        elif S[i][0]=='H':
            cnt[4]+=1

for i in range(N):
    if cnt[i]!=0:
        cnt2.append(cnt[i])
        
import math
import itertools
ans=0

for v in itertools.combinations(cnt2, 3):
    ans+=v[0]*v[1]*v[2]

print(ans)
Buggy python submission (verdict: Runtime Error):
c = [[int(input()) for i in range(3)] for i in range(3)]

if c[0][0]+c[1][0]-2*c[2][0]+c[0][1]+c[1][1]-2*c[2][1]-2*c[0][2]-2*c[1][2]+4*c[2][2] == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
c = [list(map(int, input().split())) for i in range(3)]

if c[0][0]+c[1][0]-2*c[2][0]+c[0][1]+c[1][1]-2*c[2][1]-2*c[0][2]-2*c[1][2]+4*c[2][2] == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [input().split() for _ in range(N)]
flag = 0
 
if N >1: 
  for i in range(N-1):
    dt = a[i+1][0]-a[i][0]
    dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
    if dt < dist:
      flag = flag +1
    if dt % 2 != dist % 2:
      flag = flag +1
else:
  dt = a[0]
  dist = abs(a[1])+abs(a[2])
  if dt < dist:
      flag = flag +1
  if dt % 2 != dist % 2:
      flag = flag +1
    
print('Yes' if flag == 0 else 'No')   


Fixed submission:
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != dt % 2:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
flag = 0
 
if N >1: 
  for i in range(N-1):
    dt = a[i+1][0]-a[i][0]
    dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
    if dt < dist:
      flag = flag +1
    if dt % 2 != dist % 2:
      flag = flag +1
else:
  dt = a[0]
  dist = abs(a[1])+abs(a[2])
  if dt < dist:
      flag = flag +1
  if dt % 2 != dist % 2:
      flag = flag +1
    
print('Yes' if flag == 0 else 'No')   

Fixed submission:
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != dt % 2:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
flag = 0

for i in range(N):
  dt = a[i+1][0]-a[i][0]
  dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
  if dt > dist:
    flag = flag +1
  else dt % 2 != dist % 2:
    flag = flag +1

print('Yes' if flag == 0 else 'No')    

Fixed submission:
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != dt % 2:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")
Buggy python submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
print('Left' if A + B > C + D, else 'Balanced' if A + B == C + D else 'Right')

Fixed submission:
A, B, C, D = map(int, input().split())
print('Left' if A + B > C + D else 'Balanced' if A + B == C + D else 'Right')
Buggy python submission (verdict: Time Limit Exceeded):
N,K= map(int, input().split())
A =list(map(int, input().split()))
 
Aset =list(set(A))
B=[0]*len(Aset)
cnt =0
 
for i in range(len(Aset)):
  for j in range(len(A)):
    if Aset[i] == A[j]:
      cnt += 1
  B[i] = cnt
  cnt =0
 
B=sorted(B)[::-1]  
 
ans =0
 
for i in range(K,len(B)):
  ans +=B[i]
  
print(ans) 

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


import collections

c = collections.Counter(a)
c2=sorted(c.values())

sum=0
for i in range(len(c)-K):
        sum+=c2[i]
print(sum)

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

Aset =list(set(A))
B=[0]*len(Aset)
cnt =0

for i in range(len(Aset)):
  for j in range(len(A)):
    if Aset[i] == A[j]:
      cnt += 1
  B[i] = cnt
  cnt =0

B=sorted(B)[::-1]  

ans =0

for i in range(K,len(B)):
  ans +=B[i]
  
print(ans) 

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


import collections

c = collections.Counter(a)
c2=sorted(c.values())

sum=0
for i in range(len(c)-K):
        sum+=c2[i]
print(sum)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
print(min(N*a, B))

Fixed submission:
N, A, B = map(int, input().split())
print(min(N*A, B))
Buggy python submission (verdict: Runtime Error):
N = input()
f = sum(map(int, N))
print("Yes" int(N) % f == 0 else "No")


Fixed submission:
N = input()
f = sum(map(int, N))
print("Yes" if int(N) % f == 0 else "No")
Buggy python submission (verdict: Runtime Error):
A,B,C,D =input().split()

for i in range(2**3):
    op = ['-']*3
    for j in range(3):
        if (i >> j) &1:
            op[3 - 1 - j] ='+'
    if eval(A +op[0] +B+ op[1]+C +op[2] +D) ==7:
        print(A +op[0] +B+ op[1]+C +op[2] +D+'=7')
        break

Fixed submission:
S = input()

for i in range(2**3):
    op = ['-']*3
    for j in range(3):
        if (i >> j) &1:
            op[3 - 1 - j] ='+'
    if eval(S[0] +op[0] +S[1]+ op[1]+S[2] +op[2] +S[3]) ==7:
        print(S[0] +op[0] +S[1]+ op[1]+S[2] +op[2] +S[3]+'=7')
        break
Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())
print((n-1)*(m-1))

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))

Buggy python submission (verdict: Runtime Error):
n = int(input())
m = int(input())
print((n -1 )*(m - 1))

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Runtime Error):
s = input()
print(str(s[0]) + len(s)-2 + str(s[-1]))

Fixed submission:
s = input()
x = len(s)-2
print(s[0] + str(x) + s[-1])
Buggy python submission (verdict: Runtime Error):
N = input()
print(ABC + "N")

Fixed submission:
N = input()
print("ABC" + N)
Buggy python submission (verdict: Runtime Error):
N, K =map(int, input().split())
l = [map(int, input().split())]

l = sorted(l)[::-1]
ans = 0
for i in range(K):
  ans += l[i]

print(ans)

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

l = sorted(l)[::-1]
print(sum(l[0:K]))
Buggy python submission (verdict: Runtime Error):
a, b = map(input().split())
print ("H" if a == "H" and b == "H" else "H" if a == "D" and b == "D" else "D")

Fixed submission:
a, b = input().split()
print ("H" if a == "H" and b == "H" else "H" if a == "D" and b == "D" else "D")
Buggy python submission (verdict: Runtime Error):
W,a,b=map(int,input().split())

if a+W<b:
  print(b-(W+a)):
else:
  print(0)

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

if a+W<b:
  print(b-(W+a))
elif b+W<a:
  print(a-(W+b))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
print((math.factorial(N))/(10^9+7))


Fixed submission:
import math
N = int(input())
print((math.factorial(N))%(10**9+7))