Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# D - Binomial Coefficients

import sys
readline = sys.stdin.readline

n = int(readline())
A = list(int(a) for a in readline().split())
A.sort(reverse=True)

def comb(n, r):
    num = 1
    den = 1
    r = min(r, n-r)
    for i in range(r):
        num = (num * (n-i))
        den = (den * (i+1))
    return num // den

tmp = 0
ans = (0, 0)
for i in range(1, n):
    c = comb(A[0], A[i])
    if tmp < c:
        tmp = c
        ans = (A[0], A[i])

print(' '.join(map(str, ans)))    

Fixed submission:
# D - Binomial Coefficients

import sys
readline = sys.stdin.readline

n = int(readline())
A = list(int(a) for a in readline().split())
A.sort(reverse=True)

N = A[0]
R = 0
tmpR = 0
for i in range(1, n):
    tmp = min(A[i], N-A[i])
    if tmpR < tmp:
        tmpR = tmp
        R = A[i]       

print(N, R)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N, A = map(int,input().split())
X = [int(x) for x in input().split()]
 
dp = np.zeros((N+1,sum(X)+1),dtype=np.int64)
dp[0,0] = 1
 
for x in X:
    dp[1:,x:] += dp[:-1,:-x].copy()
  
ans = 0
for n in range(1,N+1):
    ans += dp[n,n*A]

print(ans)

Fixed submission:
import numpy as np

N, A = map(int,input().split())
X = [int(x) for x in input().split()]
 
dp = np.zeros((N+1,N*A+1),dtype=np.int64)
dp[0,0] = 1
 
for x in X:
    dp[1:,x:] += dp[:-1,:-x].copy()
  
ans = 0
for n in range(1,N+1):
    ans += dp[n,n*A]

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

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n < s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))):
            if func((n-s)/p+1, n) == s:
                ans = int((n-s)/p+1)
print(ans)

Fixed submission:
import math

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n < s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))+1):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))+1):
            b = int((n-s)/p+1)
            if b >= 2 and func(b, n) == s:
                ans = b
print(ans)

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

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n > s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))):
            if func((n-s)/p+1, n) == s:
                ans = int((n-s)/p+1)
print(ans)

Fixed submission:
import math

n = int(input())
s = int(input())
ans = -1

def func(b, n):
    if n < b:
        return n
    else:
        return func(b, n//b) + n%b

if n < s:
    ans = -1
elif n == s:
    ans = n+1
else:
    for b in range(2,int(math.sqrt(n))+1):
      if func(b, n) == s:
          ans = b
          break

    if ans == -1:
        for p in range(1,int(math.sqrt(n))+1):
            b = int((n-s)/p+1)
            if b >= 2 and func(b, n) == s:
                ans = b
print(ans)
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = list()

for _ in range(n):
  s.append(input())

print(''.join(s.sort()))


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

for _ in range(n):
  s.append(input())
  
s.sort()
print(''.join(s))

Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = list()
for _ in range(n):
  s.append(input())
  s.sort()
print('{}{}{}'.format(s[0],s[1],s[2]))


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

for _ in range(n):
  s.append(input())
  
s.sort()
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W-B):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod)

    print(ans%mod)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod)

    print(ans%mod)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W-B):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += (comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod))%mod

    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    H, W, A, B = map(int, input().split())
    mod = 10**9 + 7
    ans = 0

    # 予め階乗を計算しておく
    f = [1]
    for i in range(H+W):
        f.append(f[i]*(i+1)%mod)

    # 組み合わせ関数
    def comb_mod(n, r, p):
        return f[n] * pow(f[r], p-2, p) * pow(f[n-r], p-2, p)

    for i in range(H-A):
        ans += comb_mod(i+B-1,B-1,mod) * comb_mod(H-1-i+W-B-1,W-B-1,mod)

    print(ans%mod)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
	b = X - a
    if 2 * a + 4 * b == Y:
		ans = 'Yes'
print(ans)

Fixed submission:
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
    b = X - a
    if 2 * a + 4 * b == Y:
        ans = 'Yes'
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
        l_diff.append(diff)
    ans = min(ans, diff)
    
print(ans)

Fixed submission:
S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
    ans = min(ans, diff)
    
print(ans)

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

ans = len(T)

for i in range(len(S) - len(T)):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
print(min(ans, diff))

Fixed submission:
S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
    ans = min(ans, diff)
    
print(ans)

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

S = input()
T = input()

start = time.time()

ans_list = []

a = '.'*len(T)

for i in range(len(T)):
    if i == 0:
        b = T[i] + a[i+1:]
    elif i == len(T)-1:
        b = a[:i] + T[i]
    else:
        b = a[:i] + T[i] + a[i+1:]
    s = re.findall(b, S)
    
    if len(s) >= 1:
        for j in range(len(s)):
            c = list(s[j])
            d = list(T)
            ans = 0
            for k in range(len(c)):
                if c[k] == d[k]:
                    ans += 1
            ans_list.append(ans)
    else:
        pass

print(len(T) - max(ans_list))

Fixed submission:
S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
    ans = min(ans, diff)
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        ans += ((A[i]% (10**9 + 7))*(A[j]% (10**9 + 7))) % (10**9 + 7)
        
print(ans % (10**9 + 7))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
S = []
e = 0
for i in A:
    e += i
    S.append(e)
    
ans = 0
for i in range(N-1):
    ans += A[i]%(10**9+7)*((S[N-1] - S[i])%(10**9+7))
    
print(ans%(10**9+7))

Buggy python submission (verdict: Runtime Error):
ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        print(i, j)
        ans += ((A[i]% (10**9 + 7))*(A[j]% (10**9 + 7))) % (10**9 + 7)
        
print(ans % (10**9 + 7))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
S = []
e = 0
for i in A:
    e += i
    S.append(e)
    
ans = 0
for i in range(N-1):
    ans += A[i]%(10**9+7)*((S[N-1] - S[i])%(10**9+7))
    
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        ans += (A[i]*A[j]) % (10**9 + 7)
        
print(ans % (10**9 + 7))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
S = []
e = 0
for i in A:
    e += i
    S.append(e)
    
ans = 0
for i in range(N-1):
    ans += A[i]%(10**9+7)*((S[N-1] - S[i])%(10**9+7))
    
print(ans%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

ans = 0

for i in range(N-1):
    for j in range(i+1, N):
        ans += A[i]*A[j]
        
print(ans % (10**9 + 7))

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
S = []
e = 0
for i in A:
    e += i
    S.append(e)
    
ans = 0
for i in range(N-1):
    ans += A[i]%(10**9+7)*((S[N-1] - S[i])%(10**9+7))
    
print(ans%(10**9+7))
Buggy python submission (verdict: Runtime Error):
N = list(input())

if len(N) < 2:
    if int(N) == 9:
        print('Yes')
    else:
        print('No')
elif len(N) >= 2:
    l = [int(n) for n in N]
    a = sum(l)
    if a % 9 == 0:
        print('Yes')
    else:
        print('No')

Fixed submission:
N = input()

if int(N) < 10:
    if int(N) == 9:
        print('Yes')
    elif int(N) == 0:
        print('Yes')
    else:
        print('No')
elif int(N) >= 10:
    l = [int(n) for n in list(N)]
    a = sum(l)
    if a % 9 == 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
ans = 0

for i in range(N - 1):
    if As[i] >As[i+1]:
        diff = As[i] - As[i+1]
        As[i +1] = As[i]
        ans += diff
    else:
        pass
    
print(ans)

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

ans = 0

for i in range(N - 1):
    if As[i] >As[i+1]:
        diff = As[i] - As[i+1]
        As[i +1] = As[i]
        ans += diff
    else:
        pass
    
print(ans)
Buggy python submission (verdict: Runtime Error):
x = input()

def converter(x):
    if x <= 26:
        y = chr(x + 96)
    elif x % 26 == 0:
        y = converter(x // 26) + converter(26)
    else:
        y = converter(x // 26) + converter(x % 26)
    return y

name = converter(x)

print(name)

Fixed submission:
x = int(input())

def converter(x):
    if x <= 26:
        y = chr(x + 96)
    elif x % 26 == 0:
        y = converter(x // 26 - 1) + chr(122)
    else:
        y = converter(x // 26) + chr(x % 26 + 96)
    return y

name = converter(x)

print(name)
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())

if a.isdigit()==True and b.isdigit()==True and c.isdigit()==True and k.isdigit()==True:
    a = int(a)
    b = int(b)
    c = int(c)
    k = int(k)
    if k>=1 and k<=(a+b+c) and (a+b+c)<=2*(10**9):
        if k <= a:
            print(k)
        elif k > a and k <= (a+b):
            print(a)
        else:
            print(a - (k - b - a))

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

result = 0
t = min(a, k)
result += t
k -= t
t = min(b, k)
k -= t
t = min(c, k)
result -= t
print(result)

Buggy python submission (verdict: Runtime Error):
if a.isdigit()==True and b.isdigit()==True and c.isdigit()==True and k.isdigit()==True:
    a = int(a)
    b = int(b)
    c = int(c)
    k = int(k)
    if a>=0 and b>=0 and c>=0:
        if k>=1 and k<=(a+b+c) and (a+b+c)<=2*(10**9):
            if k < a:
                print(k)
            elif k >= a and k <= (a+b):
                print(a)
            else:
                print(a - (k - b - a))

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

result = 0
t = min(a, k)
result += t
k -= t
t = min(b, k)
k -= t
t = min(c, k)
result -= t
print(result)

Buggy python submission (verdict: Runtime Error):
if a.isdigit()==True and b.isdigit()==True and c.isdigit()==True and k.isdigit()==True:
    a = int(a)
    b = int(b)
    c = int(c)
    k = int(k)
    if a>=0 and b>=0 and c>=0 and k>=1 and k<=(a+b+c) and (a+b+c)<=2*(10**9):
        if k < a:
            print(k)
        elif k >= a and k <= (a+b):
            print(a)
        else:
            print(a - (k - b - a))

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

result = 0
t = min(a, k)
result += t
k -= t
t = min(b, k)
k -= t
t = min(c, k)
result -= t
print(result)

Buggy python submission (verdict: Runtime Error):
if a.isdigit()==True and b.isdigit()==True and c.isdigit()==True and k.isdigit()==True:
    a = int(a)
    b = int(b)
    c = int(c)
    k = int(k)
    if a>=0 and b>=0 and c>=0 and k>=1 and k<=(a+b+c) and (a+b+c)<=2*(10**9):
        if k < a:
            print(k)
        elif k >= a and k <= (a+b):
            print(a)
        else:
            print(a - (k - b - a))

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

result = 0
t = min(a, k)
result += t
k -= t
t = min(b, k)
k -= t
t = min(c, k)
result -= t
print(result)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
match=0
for i in range(len(S)-len(T)):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)

Fixed submission:
D,T,S = input().split()
if int(D)/int(S) > int(T):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
i=0
j=0
match = 0
for i in Range(len(S)-len(T)):
  count = 0
  for j in Range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)
      

Fixed submission:
D,T,S = input().split()
if int(D)/int(S) > int(T):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
D,T,S = input().split(' ')
if D/S>T:
  print('No')
else
  print('Yes')

Fixed submission:
D,T,S = input().split()
if int(D)/int(S) > int(T):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
i=0
j=0
match = 0
for i in range(Len(S)-Len(T)):
  count = 0
  for j in range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)
      

Fixed submission:
S=input()
T=input()
match=0
for i in range(len(S)-len(T)+1):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()
i=0
j=0
match = 0
for i in Range(Len(S)-Len(T)):
  count = 0
  for j in Range(Len(T)):
    if S[i+j]==T[j]:
      count=count+1
  
  if match<count:
    match=count

print(Len(T)-match)
      
    

Fixed submission:
S=input()
T=input()
match=0
for i in range(len(S)-len(T)+1):
    count=0
    for j in range(len(T)):
        if S[i+j]==T[j]:
            count=count+1
    if match<count:
        match=count
print(len(T)-match)
Buggy python submission (verdict: Runtime Error):
in1 = input().split(' ')
N=int(in1[0])
M=int(in1[1])
K=int(in1[2])

inA = input().split(' ')
inB = input().split(' ')

T = 0
Ac=0
Bc=0

while T < K:
  
  if Ac>=N and Bc>=M:
    break
  elif Ac>=N:
    Bn=int(inB[Bc])
    T+=Bn
    Bc+=1
  elif Bc>=M:
    An=int(inA[Ac])
    T+=An
    Ac+=1
  else:
    An=int(inA[Ac])
    Bn=int(inB[Bc])
    if An>Bn:
      T+=An
      Ac+=1
    else:
      T+=Bn
      Bc+=1
  
  

print(Ac+Bc)

Fixed submission:
a=int(input())

print(a+a*a+a*a*a)
Buggy python submission (verdict: Runtime Error):

S=input()
T=input()
check=[]
for i,ss in enumerate(S[:-len(T)]):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
print(len(T)-max(check))

Fixed submission:

S=input()
T=input()
check=[]
for i in range(len(S)-len(T)+1):
    check.append(0)
    for j,tt in enumerate(T):
        if tt==S[i+j]:
            check[i]+=1
# print(check)
check.append(0)
# print(check)
print(len(T)-max(check))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=al[i]*sum(al[i+1:N])
print(sss%1000000007)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=(sum(al[0:i])%1000000007)*al[i]
print(sss%1000000007)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=sum(al[0:i])%1000000007*al[i]
print(sss%1000000007)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=al[i]*sum(al[0:i])
    sss%=1000000007
print(sss)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
al = list(map(int,input().split()))
sss=0
for i in range(N):
    sss+=al[i]*sum(al[0:i])
print(sss%1000000007)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)

Buggy python submission (verdict: Time Limit Exceeded):
N= int(input())
al=list(map(int,input().split()))
sss=0
for i in range(N):
    for j in range(i):
        sss+=al[j]*al[i]

print(sss%1000000007)

Fixed submission:
N = int(input())
al = list(map(int,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(sss%1000000007)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
sum = 0
ans = 0
# for i in range(n):
#     a[i] = a[i] % (10**9 +7)
#
# s = 0

for i in range(n):
    sum += a[i]

for i in range(n-1):
    sum -= a[i]
    ans += a[i] * sum

print(ans % (10**9 + 7))


Fixed submission:
d,t,s = map(int,input().split())
if d/s <= t:
    print("Yes")

else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    a[i] = a[i] % (10**9 +7)

s = 0

for i in range(n-1):
    for j in range(i+1,n):
        s += a[i]*a[j]

print(s % (10**9 + 7))


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

for i in range(n):
    sum += a[i]

for i in range(n-1):
    sum -= a[i]
    ans += a[i] * sum

print(ans % (10**9 + 7))

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

s = 0

for i in range(n-1):
    for j in range(i+1,n):
        s += a[i]*a[j]

print(s % (10**9 + 7))


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

for i in range(n):
    sum += a[i]

for i in range(n-1):
    sum -= a[i]
    ans += a[i] * sum

print(ans % (10**9 + 7))
Buggy python submission (verdict: Runtime Error):
S = list(input())
T = list(input())

i = 0
ans =[]

while i + len(T) < len(S):
    n = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s != t:
            n += 1
    ans.append(n)
    i += 1

print(min(ans))

Fixed submission:
S = list(input())
T = list(input())

i = 0
ans =[]

while i + len(T) <= len(S):
    n = 0
    for s, t in zip(S[i:i+len(T)], T):
        if s != t:
            n += 1
    ans.append(n)
    i += 1

print(min(ans))
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())
goal = []
times = 0
pos = [0]
movement = []

while times < K:
    for i in pos:
        plus = i + 1
        minus = i - 1
        movement.append(plus)
        movement.append(minus)
    times += 1
    pos.clear()
    for j in movement:
        pos.append(j)
    movement.clear()

for i in pos:
    goal.append(i * D + X)

print(abs(min(goal, key=abs)))


Fixed submission:
import math
X, K, D = map(int, input().split())
ans = 0
if K * D < abs(X):
    ans = abs(X) - K * D
elif (K - math.floor(abs(X) / D)) % 2 == 0:
    ans = abs(X) - (math.floor(abs(X) / D)) * D
else:
    ans = abs(X) - (math.floor(abs(X) / D)) * D - D

print(abs(int(ans)))
Buggy python submission (verdict: Runtime Error):
t = int(input())
wlist = [0]*4
for i in range(t):
    w = input()
    if w == "AC":
        wlist[0] += 1
    elif w == "WA":
   	    wlist[1] += 1
    elif w == "TEL":
        wlist[2] += 1
    else:
        wlist[3] += 1
print("AC x " + wlist[0])
print("WA x " + wlist[1])
print("TEL x " + wlist[2])
print("RE x " + wlist[3])

Fixed submission:
t = int(input())
wlist = [0]*4
for i in range(t):
    w = input()
    if w == "AC":
        wlist[0] += 1
    elif w == "WA":
        wlist[1] += 1
    elif w == "TLE":
        wlist[2] += 1
    else:
        wlist[3] += 1
print("AC x " + str(wlist[0]))
print("WA x " + str(wlist[1]))
print("TLE x " + str(wlist[2]))
print("RE x " + str(wlist[3]))

Buggy python submission (verdict: Runtime Error):
t = int(input())
wlist = [0]*4
for i in range(t):
  w = input()
  if w == "AC":
    wlist[0] += 1
  elif w = "WA":
   	wlist[1] += 1
  elif w = "TEL":
    wlist[2] += 1
  else:
    wlist[3] += 1
print("AC x " + wlist[0])
print("WA x " + wlist[1])
print("TEL x " + wlist[2])
print("RE x " + wlist[3])  

Fixed submission:
t = int(input())
wlist = [0]*4
for i in range(t):
    w = input()
    if w == "AC":
        wlist[0] += 1
    elif w == "WA":
        wlist[1] += 1
    elif w == "TLE":
        wlist[2] += 1
    else:
        wlist[3] += 1
print("AC x " + str(wlist[0]))
print("WA x " + str(wlist[1]))
print("TLE x " + str(wlist[2]))
print("RE x " + str(wlist[3]))
Buggy python submission (verdict: Runtime Error):
data = list(map(int, input().split()))
p = data.find(0)
print(p+1)

Fixed submission:
data = list(map(int, input().split()))
p = data.index(0)
print(p+1)
Buggy python submission (verdict: Runtime Error):
guh, gum, gbh, bgm, st = map(int, input().split())
if bgm < gum:
  gbh -= 1
  bgm += 60
tmp = (gbh-guh)*60+(gbm-gum)
ans = tmp-st
print(ans)

Fixed submission:
guh, gum, gbh, gbm, st = map(int, input().split())
if gbm < gum:
  gbh -= 1
  gbm += 60
tmp = (gbh-guh)*60+(gbm-gum)
ans = tmp-st
print(ans)
Buggy python submission (verdict: Runtime Error):
x = input()

if x >= 30:
    print("Yes")
else:
    print("No")

Fixed submission:
x = input()

if int(x) >= 30:
    print("Yes")
else:
    print("No")