Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
An = list(map(int,input().split()))
if K==0:
  print(sum(An))
else:
  def f(X, An):
    rtn=0
    for Ai in An:
      rtn += (X^Ai)
    return rtn

  tmp = sum(An)
  for i in range(1,K+1):
    fx = f(i,An)
    if tmp < fx:
      tmp = fx
  print(tmp)
 

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

rtn=0
bit_max = 40
for s in range(bit_max, -1, -1):
  target = 1 << s
  numof_hit = len([1 for a in An if a & target != 0])
  
  if target<=K and numof_hit < N-numof_hit:
    numof_hit = N-numof_hit
    K -= target
  
  rtn += target * numof_hit

print(rtn)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input  = sys.stdin.readline

N,W=map(int,input().split())

def process(N,W):
  box=[0]*(W+1)
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(W,0,-1):
      idx = j-w
      if idx<0:
        break
      else:
        box[j] = max(box[j],box[idx]+v)
  return box[-1]

print(process(N,W))


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

N,W=map(int,input().split())

def process(N,W):
  box=[0]*(W+1)
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(W,0,-1):
      idx = j-w
      if idx<0:
        break
      else:
        box[j] = max(box[j],box[idx]+v)
  return box[-1]

print(process(N,W))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input  = sys.stdin.readline

N,W=map(int,input().split())
box=[0]*(W+1)

for i in range(N):
  w,v=map(int,input().split())
  for j in range(W,0,-1):
    idx = j-w
    if idx<0:
      break
    else:
      box[j] = max(box[j],box[idx]+v)
print(box[-1])


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

N,W=map(int,input().split())

def process(N,W):
  box=[0]*(W+1)
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(W,0,-1):
      idx = j-w
      if idx<0:
        break
      else:
        box[j] = max(box[j],box[idx]+v)
  return box[-1]

print(process(N,W))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input  = sys.stdin.readline

N,W=map(int,input().split())
box=[[0]*(W+1) for i in range(N+1)]

for i in range(N):
  w,v=map(int,input().split())
  for j in range(W+1):
    box[i+1][j]=max(box[i+1][j],box[i][j])
    total = j+w
    if total>W:
      continue
    else:
      box[i+1][total]=max(box[i][total], box[i][j]+v)
print(box[-1][-1])


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

N,W=map(int,input().split())

def process(N,W):
  box=[0]*(W+1)
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(W,0,-1):
      idx = j-w
      if idx<0:
        break
      else:
        box[j] = max(box[j],box[idx]+v)
  return box[-1]

print(process(N,W))
Buggy python submission (verdict: Runtime Error):
N,T = map(int,input().split())
paths = list()
for i in range(N):
  ci,ti = map(int,input().split())
  paths.append((ci,ti))
paths.sort(key=lambda x: x[0])

for path in paths:
  if path[1] <= T:
    print(path[0])
    exit(1)
print('TLE')


Fixed submission:
N,T = map(int,input().split())
paths = list()
for i in range(N):
  ci,ti = map(int,input().split())
  paths.append((ci,ti))
paths.sort(key=lambda x: x[0])

flag=False
for path in paths:
  if path[1] <= T:
    print(path[0])
    flag=True
    break
if not flag:
  print('TLE')
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
n = int(input())
renga_list = list(map(int, input().split()))

tmp_i = 0
i = 1
while(True):
#    print("i="+str(i))
#    renga_list = renga_list[tmp_i:]
#    print("renga_list="+str(renga_list))
    if i in renga_list[tmp_i:]:
        tmp_i = renga_list[tmp_i:].index(i) + tmp_i
        i += 1
    else:
        break

result = n - i + 1
if n == result:
    print(-1)
else:
    print(result)

Fixed submission:
# coding: utf-8
n = int(input())
renga_list = list(map(int, input().split()))


i = 1

for renga in renga_list:
    if i == renga:
        i += 1
        
result = n - i + 1
if n == result:
    print(-1)
else:
    print(result)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
n = int(input())
renga_list = list(map(int, input().split()))

tmp_i = 0
i = 1
while(True):
#    print("i="+str(i))
    renga_list = renga_list[tmp_i:]
#    print("renga_list="+str(renga_list))
    if i in renga_list:
        tmp_i = renga_list.index(i)
        i += 1
    else:
        break

result = n - i + 1
if n == result:
    print(-1)
else:
    print(result)

Fixed submission:
# coding: utf-8
n = int(input())
renga_list = list(map(int, input().split()))


i = 1

for renga in renga_list:
    if i == renga:
        i += 1
        
result = n - i + 1
if n == result:
    print(-1)
else:
    print(result)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
i = input()
print(i * i)

Fixed submission:
# coding: utf-8
i = int(input())
print(i * i)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
n = int(input())
s = input()
if n % 2:
	print('No')
else:
	if s[0:(n/2)] == s[(n/2):n]:
		print('Yes')
	else:
		print('No')

Fixed submission:
# coding: utf-8
n = int(input())
s = input()
if n % 2:
	print('No')
else:
	if s[0:int(n/2)] == s[int(n/2):n]:
		print('Yes')
	else:
		print('No')
Buggy python submission (verdict: Runtime Error):
import math
inp = input().split()
A = int(inp[0])
B = int(inp[1])

print(int(A*B/math.gcd(A, B)))

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

inp = input().split()
A = int(inp[0])
B = int(inp[1])

print(int(A*B/gcd(A, B)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
alist = list(map(int, input().split()))
blist = [a for a in alist]
alen = len(alist)

n = 0
i = 1
i2 = 0
all = 0

while all < N:
    if alist[i2] != i:
        n += 1
        alist.pop(i2)
    else:
        i += 1
        i2 += 1
    all += 1

if len(alist) == 0:
    print(-1)
else:
    print(n)

Fixed submission:
N = int(input())
alist = list(map(int, input().split()))
blist = []
alen = len(alist)

n = 0
i = 1

for a in alist:
    if a == i:
        i += 1
    else:
        blist.append(a)
        n += 1

if len(blist) == len(alist):
    print(-1)
else:
    print(n)

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

n = 0
i = 1
i2 = 0
all = 0
while True:
    if alist[i2] != i:
        n += 1
        alist.pop(i2)
    else:
        i += 1
        i2 += 1
    all += 1
    if all >= alen: break

if len(alist) == 0:
    print(-1)
else:
    print(n)

Fixed submission:
N = int(input())
alist = list(map(int, input().split()))
blist = []
alen = len(alist)

n = 0
i = 1

for a in alist:
    if a == i:
        i += 1
    else:
        blist.append(a)
        n += 1

if len(blist) == len(alist):
    print(-1)
else:
    print(n)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
hstr = input().split()
h = [int(n) for n in hstr]

dp = [math.inf for i in range(N)]

dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    dif1 = abs(h[i] - h[i-1])
    dif2 = abs(h[i] - h[i-2])
    dp[i] = min(dp[i-1] + dif1, dp[i-2] + dif2)

print(dp[N-1])



Fixed submission:
N = int(input())
hstr = input().split()
h = [int(n) for n in hstr]

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

dp[0] = 0
dp[1] = abs(h[0] - h[1])

for i in range(2, N):
    dif1 = abs(h[i] - h[i-1])
    dif2 = abs(h[i] - h[i-2])
    dp[i] = min(dp[i-1] + dif1, dp[i-2] + dif2)

print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

words = b.split('\n')
print(words)
def main():
    ed = []
    for i in range(int(a)-2):
        w1 = words[i]
        ed.append(w1)
        w2 = words[i+1]
        print(ed)
        if w1[-1] != w2[0] or w1 in ed:
            return 'No'
    return 'Yes'

if __name__ == '__main__':
    main()



Fixed submission:
a = input()

def main():
    ed = []
    for i in range(int(a)):
        neww = input()
        if i != 0:
            if ed[i-1][-1] != neww[0] or neww in ed:
                return 'No'
        ed.append(neww)

    return 'Yes'
                

if __name__ == '__main__':
    print(main())

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

words = b.split()

for i in range(len(words)-1):
    w1 = words[i]
    w2 = words[i+1]

    if w1[-1] != w2[0]:
        return 'No'

return 'Yes'



Fixed submission:
a = input()

def main():
    ed = []
    for i in range(int(a)):
        neww = input()
        if i != 0:
            if ed[i-1][-1] != neww[0] or neww in ed:
                return 'No'
        ed.append(neww)

    return 'Yes'
                

if __name__ == '__main__':
    print(main())
Buggy python submission (verdict: Time Limit Exceeded):
a,b = [int(i) for i in input().split()]

c = 0
if a < b:
  c = a
else:
  c = b

d = []
for i in range(1, c+1):
  if a % i == 0 and b % i == 0:
    d.append(i)

#print(d)
ans = [1]
if len(d) != 1:
  ans.append(d[1])
for i in d[1:]:
  for j in ans[1:]:
    if i % j == 0:
      break
  else:
    ans.append(i)

print(len(ans))

Fixed submission:
a, b = [int(i) for i in input().split()]

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

  
import math

def is_prime(n):
    if n == 1: return True

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
ad = make_divisors(a)
bd = make_divisors(b)
ans = 0
for i in ad:
  if i in bd:
    if is_prime(i):
      ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
Ds=list(map(int,input().split()))

if min(Ds)!=0 or Ds.count(0)!=1:
    print(0)
else:
    Ans=[0]*(max(Ds)+1)
    Ans[0]=1
    for i in range(1, max(Ds)+1):
        Ans[i]=(Ans[i-1]*(Ds.count(i-1)**Ds.count(i)))

    print(Ans[max(Ds)])%998244353

Fixed submission:
n=int(input())
if n%2==0:
    Ans=n//2-1
else:
    Ans=n//2
print(Ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
H=list(map(int,input().split()))

for i in range(N-1):
        if max(H[:i+1])-H[i+1]>=2:
                print('No')
                exit()
print('Yes')

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

now=H[0]
for i in H:
        if i>now:
                now=i
        elif now>i+1:
                print('No')
                exit()

print('Yes')

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

for i in range(N-1):
        for j in range(i,N):
                if H[i]-H[j]>=2:
                        print('No')
                        exit()
print('Yes')

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

now=H[0]
for i in H:
        if i>now:
                now=i
        elif now>i+1:
                print('No')
                exit()

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

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D=map(int, input().split())
LCM=lcm(C,D)
Ac=(A-1)//C
div_C=B//C-Ac
Ad=(A-1)//D
div_D=B//D-Ad
Alcm=(A-1)//LCM
div_CD=B//LCM-Alcm
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)
#A未満でCで割れる個数
Ac=(A-1)//C
#範囲内でCで割れる個数
div_C=B//C-Ac
#A未満でDで割れる個数
Ad=(A-1)//D
#範囲内でDで割れる個数
div_D=B//D-Ad
#A未満でLCMで割れる個数
Alcm=(A-1)//LCM
#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm
#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)

#A未満でCで割れる個数
Ac=(A-1)//C

#範囲内でCで割れる個数
div_C=B//C-Ac

#A未満でDで割れる個数
Ad=(A-1)//D

#範囲内でDで割れる個数
div_D=B//D-Ad

#A未満でLCMで割れる個数
Alcm=(A-1)//LCM

#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm

#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)
#A未満でCで割れる個数
Ac=(A-1)//C
#範囲内でCで割れる個数
div_C=B//C-Ac
#A未満でDで割れる個数
Ad=(A-1)//D
#範囲内でDで割れる個数
div_D=B//D-Ad
#A未満でLCMで割れる個数
Alcm=(A-1)//LCM
#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm
#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)

#A未満でCで割れる個数
Ac=(A-1)//C

#範囲内でCで割れる個数
div_C=B//C-Ac

#A未満でDで割れる個数
Ad=(A-1)//D

#範囲内でDで割れる個数
div_D=B//D-Ad

#A未満でLCMで割れる個数
Alcm=(A-1)//LCM

#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm

#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)
#A未満でCで割れる個数
Ac=(A-1)//C
#範囲内でCで割れる個数
div_C=B//C-Ac
#A未満でDで割れる個数
Ad=(A-1)//D
#範囲内でDで割れる個数
div_D=B//D-Ad
#A未満でLCMで割れる個数
Alcm=(A-1)//LCM
#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm
#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d=map(int, input().split())
div_c=[]
div_d=[]
div_cd=[]
for i in range(a,b+1):
    if i%c==0 and i%d==0:
        div_cd.append(i)
    if i%c==0:
        div_c.append(i)
    if i%d==0:
        div_d.append(i)
print(b-a+1-len(div_c)-len(div_d)+len(div_cd))

Fixed submission:
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)
#A未満でCで割れる個数
Ac=(A-1)//C
#範囲内でCで割れる個数
div_C=B//C-Ac
#A未満でDで割れる個数
Ad=(A-1)//D
#範囲内でDで割れる個数
div_D=B//D-Ad
#A未満でLCMで割れる個数
Alcm=(A-1)//LCM
#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm
#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
Key=[0]*(N+1)
for i in range(M):
    L,R = map(int,input().split())
    Key[L-1] += 1
    Key[R] -= 1
for i in range(N):
    Key[i+1] += Key[i] # 累積和
print(Key)
print(Key.count(m))


Fixed submission:
N,M=map(int,input().split())
Key=[0]*(N+1)
for i in range(M):
    L,R = map(int,input().split())
    Key[L-1] += 1
    Key[R] -= 1
for i in range(N):
    Key[i+1] += Key[i] # 累積和
print(Key.count(M))
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*N
for i in range(1,N):
    dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-K),i))
print(dp[N-1])

Fixed submission:
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*N
for i in range(1,N):
    dp[i]=min(dp[j]+abs(h[i]-h[j]) for j in range(max(0,i-K),i))
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
V=list(map(int, input().split()))

Vo=V[::2]
Ve=V[1::2]

oddmost = collections.Counter(Vo).most_common()[0][1]
oddsec = collections.Counter(Vo).most_common()[1][1]
evenmost = collections.Counter(Ve).most_common()[0][1]
evensec = collections.Counter(Ve).most_common()[1][1]

if oddmost!=evenmost:
    print(len(V)-oddmost-evenmost)
else:
    print(min(len(V)-oddmost-evensec, len(V)-evenmost-oddsec))

Fixed submission:
import collections

n=int(input())
vs=list(map(int,input().split()))

vs_odd=vs[::2]
c_odd=collections.Counter(vs_odd) 
C1=c_odd.most_common()
C1.append((0,0))
common1=C1[0][1] #最頻値の個数
common1sec=C1[1][1] #第2頻値

vs_even=vs[1::2]
c_even=collections.Counter(vs_even) 
C2=c_even.most_common()
C2.append((0,0))
common2=C2[0][1] #最頻値の個数
common2sec=C2[1][1] #第2頻値

Ans1=len(vs_odd)-common1
Ans2=len(vs_even)-common2
Ans3=len(vs_odd)-common1sec
Ans4=len(vs_even)-common2sec

if c_odd.most_common()[0][0] == c_even.most_common()[0][0]:
    #最頻値が同じ場合
    print(min(Ans1+Ans4, Ans2+Ans3))
else:
    print(Ans1+Ans2)
Buggy python submission (verdict: Runtime Error):
N,K=map(int, input().split())
Candles=list(map(int, input().split()))

Distance=[]
for i in range(N-K):
        Distance.append(abs(Candles[i]-Candles[i+K-1])+min(abs(Candles[i]),abs(Candles[i+K-1])))
print(min(Distance))

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

Distance=[]
for i in range(N-K+1):
        Distance.append(abs(Candles[i]-Candles[i+K-1])+min(abs(Candles[i]),abs(Candles[i+K-1])))
print(min(Distance))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
people=list(input())
List=[]

for i in range(N):
    #向きを変える人数
    List.append(people[:i].count('W')+people[i:].count('E'))

print(min(List))

Fixed submission:
N=int(input())
people=list(input())

Wlist=[0]*(N+1)
Elist=[0]*(N+1)
for i in range(N):
    Wlist[i+1]=Wlist[i]
    if people[i]=='W':
        Wlist[i+1]+=1
    Elist[i+1]=Elist[i]
    if people[i]=='E':
        Elist[i+1]+=1

#print(Wlist)
#print(Elist)

List=[]
for i in range(N):
    List.append(Wlist[i]+(Elist[N]-Elist[i+1]))

print(min(List))
Buggy python submission (verdict: Time Limit Exceeded):
import statistics

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

for i in range(len(Xs)):
    Xs_i=Xs[:i]+Xs[i+1:]
    med=statistics.median(Xs_i)
    print(med)

Fixed submission:
N=int(input())
Xs=list(map(int, input().split()))
nXs=sorted(Xs)

medL=nXs[len(nXs)//2-1]
medR=nXs[len(nXs)//2]

if medL == medR:
    for i in range(N):
        print(medL)
else:
    for i in Xs:
        if i<=medL:
            print(medR)
        else:
            print(medL)
Buggy python submission (verdict: Runtime Error):
S = [input() for _ in range(int(input()))]
T = [input() for _ in range(int(input()))]
ans = 0
for s in set(S):
    score = S.count(s) - T.count(s)
    if score > ans:
        ans = score
print(ans)

Fixed submission:
a,b,c=map(int,input().split())
print('Yes' if a+b>=c else 'No')
Buggy python submission (verdict: Runtime Error):
a, b, c, x =[int(input()) for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Fixed submission:
a, b, c, x =[int(input()) for i in range(4)]
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,Y=map(int,input().split())

res10000=-1
res5000=-1
res1000=-1

for a in range(0,N+1):
    for b in range(0,N-a+1):
        total=a*10000+b*5000+(N-a-b)*1000
        if total == Y:
            res10000=a
            res5000=b
            res1000=N-a-b
            
print(res10000,res5000,res1000))

Fixed submission:
n,y=map(int, input().split())
for p in range(n+1):
    for q in range(n-p+1):
        if 10000*p+5000*q+1000*(n-p-q)==y:
                print(p,q,n-p-q)
                exit()
print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
some=[]
for i in range(1,n+1):
    if a<=sum(map(int, list(str(i))))<=b:
        some.append(i)
print(sum(some))

Fixed submission:
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d else 'Left' if a+b>c+d else 'Right')

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d 'Left' if a+b>c+d else 'Right')

Fixed submission:
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d else 'Left' if a+b>c+d else 'Right')

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d 'Left' a+b>c+d else 'Right')

Fixed submission:
a,b,c,d=map(int, input().split())
print('Balanced' if  a+b==c+d else 'Left' if a+b>c+d else 'Right')
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
n,a,b=map(int, input().split())
some=[]
for i in range(1,n+1):
    if a<=sum(map(int, list(str(i))))<=b:
        some.append(i)
print(sum(some))


Fixed submission:
n,a,b=map(int, input().split())
some=[]
for i in range(1,n+1):
    if a<=sum(map(int, list(str(i))))<=b:
        some.append(i)
print(sum(some))
Buggy python submission (verdict: Time Limit Exceeded):
n=input()
Numbers = list(map(int,input().split()))
ans=0
while all([x%2==0 for x in Numbers]):
    ans+=1
    [t/2 for t in Numbers]
print(ans)

Fixed submission:

n=input()
Numbers = list(map(int,input().split()))
ans=0
while all(x%2==0 for x in Numbers):
    ans+=1
    Numbers=[t/2 for t in Numbers]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
Numbers = list(map(int,input().split()))
ans=0
while True:
    if all([x%2==0 for x in Numbers]):
        ans+=1
        [t/2 for t in Numbers]
print(ans)

Fixed submission:

n=input()
Numbers = list(map(int,input().split()))
ans=0
while all(x%2==0 for x in Numbers):
    ans+=1
    Numbers=[t/2 for t in Numbers]
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k,x,y=[int(input()) for i in range(4)]
print(k*x+y*(n-k))

Fixed submission:
s=str(input())
n=str(len(s)-2)
print(s[0]+str(n)+s[-1])

Buggy python submission (verdict: Runtime Error):
a,b,c=input(); print(a+str(len(b))+c)

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

Fixed submission:
a,b,h=[int(input()) for i in range(3)];print((a+b)*h//2)

Buggy python submission (verdict: Runtime Error):
a,b,h=map(int, input().split());print((a+b)*h//2)

Fixed submission:
a,b,h=[int(input()) for i in range(3)];print((a+b)*h//2)

Buggy python submission (verdict: Runtime Error):
a,b,h=map(int, input().split());print((a+b)*h/2)

Fixed submission:
a,b,h=[int(input()) for i in range(3)];print((a+b)*h//2)
Buggy python submission (verdict: Runtime Error):
import math

A, B = [int(n) for n in input().split()]

print(int((A * B) / math.gcd(A, B)))


Fixed submission:
import fractions

A, B = [int(n) for n in input().split()]

print(A * B // fractions.gcd(A, B))

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

A, B = [int(n) for n in input().split()]

print((A * B) // math.gcd(A, B))


Fixed submission:
import fractions

A, B = [int(n) for n in input().split()]

print(A * B // fractions.gcd(A, B))
Buggy python submission (verdict: Runtime Error):
i = input()

l = i.split()

if sum(l) >= 22:
    print('bust')
else:
    print('win')


Fixed submission:
i = input()

l = i.split()
l = [int(e) for e in l]

if sum(l) >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(num) for num in input().split()]

count = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):

            if x + y + z == S:
                count += 1

print(count)


Fixed submission:
K, S = [int(num) for num in input().split()]

count = 0

for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if 0 <= z <= K:
            count += 1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = [int(num) for num in input().split()]

count = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):

            if x + y + z == S:
                count += 1

print(count)


Fixed submission:
K, S = [int(num) for num in input().split()]

count = 0

for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if 0 <= z <= K:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = list(input())
s[b] = s[b].lower()
s = str(s)
print('{}'.format(s))

Fixed submission:
a, b = map(int, input().split())
c = input()
c = list(c)
if (c[b-1] == 'A'):
    c[b-1] = 'a'
if (c[b-1] == 'B'):
    c[b-1] = 'b'
if (c[b-1] == 'C'):
    c[b-1] = 'c'
c = ''.join(c)
print('{}'.format(c))
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int,input().split())

ans = (A * B) // math.gcd(A, B)
print(ans)

Fixed submission:
A, B = map(int,input().split())
 
n = max(A,B)
m= min(A,B)
count = 1
while True:
    if (n*count)%m == 0:
        print(n*count)
        break
    else:
        count += 1