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

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)
import math
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    N = ii()
    A = lmis()
    l = 1
    for a in A:
        l = lcm(l, a)
    print(sum(l//a for a in A) % N1097)


main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_prime_factors(n):
    import numpy as np
    factors = np.arange(0, n+1, 1, dtype=np.int64)
    for i in range(2, n+1):
        if factors[i] == i:
            np.minimum(factors[i*2::i], i, out=factors[i*2::i])
    return factors

#

def main():
    N=ii()
    A=lmis()
    factors = get_prime_factors(10**6)
    d_lcm = defaultdict(int)
    d = [None] * N
    for i, a in enumerate(A):
        d[i] = dd = defaultdict(int)
        p = a
        while p > 1:
            dd[factors[p]] += 1
            p //= factors[p]
        for key in dd.keys():
            d_lcm[key] = max(d_lcm[key], dd[key])
    ans = 0
    for dd in d:
        tmp = 1
        for p in d_lcm.keys():
            tmp *= p ** (d_lcm[p] - dd[p])
            tmp %= N1097
        ans += tmp
        ans %= N1097
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():

main()

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
ii = lambda: int(input())
lmis = lambda: list(mis())
N1097 = 10**9 + 7

def main():
    ii()
    A = lmis()
    l = 1
    for a in A:
        l = lcm(l, a)
    ans = 0
    for a in A:
        ans += l//a
        ans %= N1097
    print(ans)


main()
Problem p02851 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)
from itertools import count
from collections import defaultdict
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#


def main():
    N, K = mis()
    A = [0] + lmis()
    for i in range(1, len(A)):
        A[i] = ((A[i] - 1) + A[i-1]) % K
    #
    C = defaultdict(int)
    ans = 0
    for i in range(len(A)):
        if i >= K:
            C[A[i-K]] -= 1
        a = A[i]
        ans += C[a]
        C[a] += 1
    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
from itertools import count
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#


def main():
    N, K = mis()
    A = [0] + lmis()
    for i in range(1, len(A)):
        A[i] = ((A[i] - 1) + A[i-1]) % K
    #
    C = [0] * (max(A)+1)
    ans = 0
    for i in range(len(A)):
        if i >= K:
            C[A[i-K]] -= 1
        a = A[i]
        ans += C[a]
        C[a] += 1
    print(ans)

main()
Problem p03723 (python)

Fixed submission:
def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        print(0 if a & 1 else -1)
        return
    count = 0
    while (a | b | c) & 1 == 0:
        a, b, c = (b + c) >> 1, (c + a) >> 1, (a + b) >> 1
        count += 1
    
    print(count)
 
main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c = map(int, input().split())
    count = 0
    while (a | b | c) & 1 == 0:
        if a==b==c:
            print(-1)
            return
        a, b, c = (b + c) >> 1, (c + a) >> 1, (a + b) >> 1
        count += 1
        print(a,b,c)
    
    print(count)

while True:
    main()
Problem p03011 (python)

Fixed submission:
*A,=map(int,input().split());print(sum(A)-max(A))

Buggy submission (verdict: Runtime Error):
*A=map(int,input().split());print(sum(A)-max(A))
Problem p03315 (python)

Fixed submission:
s=input()
print(s.count("+")-s.count("-"))

Buggy submission (verdict: Runtime Error):
n=input()
print("No"if int(n)%sum(int(i)for i in n) else"Yes")
Problem p03345 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
print(a-b if k%2==0 else b-a)

Buggy submission (verdict: Runtime Error):
n=int(input())
r=0
b=0
for i in range(n):
 t=int(input())
 if i==0!=t or b+1<t:print(-1);exit()
 elif b>=t:r+=b
 b=t
print(r+b)
Problem p03346 (python)

Fixed submission:
n=int(input())
p=[int(input())-1for _ in[0]*n]
q=[0]*n
for i in range(n):q[p[i]]=i
r,c=0,1
for i in range(n-1):
    c=c+1if q[i]<q[i+1]else 1
    if r<c:r=c
if r<c:r=c
print(n-r)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input())for _ in[0]*n]
if n%2==0:
    m1=n//2
    m2=m1+1
    m1i=a.index(m1)
    m2i=a.index(m2)
    a1=[a[i] for i in range(m1i) if a[i]<m1]
    a2=[a[i] for i in range(m1i+1,n) if a[i]<m1]
    al=sorted(a2)+a1
    a3=[a[i] for i in range(m2i) if a[i]>m2]
    a4=[a[i] for i in range(m2i+1,n) if a[i]>m2]
    ar=a4+sorted(a3)
    r=len(a2)+len(a3)
    l=al.index(m1-1)
    r+=m1-2-l
    r+=ar.index(m2+1)
else:
    m=n//2+1
    mi=a.index(m)
    a1=[a[i] for i in range(mi) if a[i]<m]
    a2=[a[i] for i in range(mi+1,n) if a[i]<m]
    al=sorted(a2)+a1
    a3=[a[i] for i in range(mi) if a[i]>m]
    a4=[a[i] for i in range(mi+1,n) if a[i]>m]
    ar=a4+sorted(a3)
    r=len(a2)+len(a3)
    l=al.index(m-1)
    r+=m-2-l
    r+=ar.index(m+1)
print(r)
Problem p02659 (python)

Fixed submission:
from math import floor, ceil
import decimal


def main():

    A, B = map(float, input().split())
    B = round(B, 2)
    A = int(A)
    A = decimal.Decimal(str(A))
    B = decimal.Decimal(str(B))
    AB = A*B
    AB = floor(AB)
    print(AB)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools

import math


def main():
    A, B = map(int, input().split())

    print(math.floor(A*B))


if __name__ == '__main__':
    main()
Problem p02546 (python)

Fixed submission:
x=input()
if x[-1]==("s"):
    print(x+"es")
elif x[-1]!=("s"):
    print(x+"s")

Buggy submission (verdict: Runtime Error):
N=int(input())
y=0
for j in range(1,N):
    for k in range(1,N): 
        if (N-k)%j==0:
            y=y+1
print(y)
Problem p02629 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
import string

l = [c for c in string.ascii_lowercase]
def f(N: int):
    N -= 1
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import string

l = [None]+[c for c in string.ascii_lowercase]
def f(N: int):
    N -= 1
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import string

l = [None]+[c for c in string.ascii_lowercase]
def f(N: int):
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import string

l = [None]+[c for c in string.ascii_lowercase]
def f(N: int):
    if N // 26:
        return f(N//26) + l[N%26]
    else:
        return l[N%26]

def solve(N):
    print(f(N))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()
Problem p02835 (python)

Fixed submission:
def main():
    a = list(map(int, input().split()))
    ret = 'bust' if sum(a) >= 22 else 'win'
    print(ret)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b, c = list(map(int, input().split()))
    ret = 'bust' if sum(a,b,c) >= 22 else 'win'
    print(ret)

if __name__ == "__main__":
    main()
Problem p02847 (python)

Fixed submission:
import sys

S = input()

lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

num = lst.index(S)
print(7 - num)

Buggy submission (verdict: Runtime Error):
import sys

lines = sys.stdin.readlines()
S = lines[0]

lst = ['SUN','MON','TUE','WED','THU','FRI','SAT']

num = lst.index(S)
print(7 - num)
Problem p02859 (python)

Fixed submission:
import sys

for line in sys.stdin:
    r = int(line.rstrip())
    print(r*r)

Buggy submission (verdict: Runtime Error):
import sys
from math import factorial
from scipy.misc import comb

def ncr(n, r, p): 
    return comb(n,r,exact=True) % p 

def check(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp

    n = x - y
    x -= 2 * n

    if (x + y) % 3 == 0:
        return True
    else:
        return False
    

# Read
line = sys.stdin.readlines()[0]
X, Y = map(int,line.split(' '))

# if not check(X, Y):
#     print(0)
#     exit(0)

m = int(1/3 * (2*Y - X))
n = int(Y - 2 * m)

if n < 0 or m < 0:
    print(0)
else:
    p = m if m < n else n
    print(ncr(n+m, p))
Problem p03073 (python)

Fixed submission:
S = input()
#複数の定義はまとめられる
cntA, cntB = 0, 0

for i, t in enumerate(S):
    if i%2 == 0:
        if t == '0': #標準入力Sはstr型だから0ではなく'0'のようにする
            cntA += 1
        else:
            cntB += 1
    else:
        if t == '1':
            cntA += 1
        else:
            cntB += 1
print (min(cntA, cntB))

Buggy submission (verdict: Runtime Error):
S = input()
#複数の定義はまとめられる
cntA, cntB = 0, 0

for i, t in enumerate(S):
    if i%2 == 0:
        if t == '0': #標準入力Sはstr型だから0ではなく'0'のようにする
            cntA += 1
        else:
            cntB += 1
    else:
        if t == '1':
            cntA += 1
        else:
            cntB += 1
print (min(ci, c2))
Problem p02948 (python)

Fixed submission:
from heapq import*
N,M,*t=map(int,open(0).read().split())
v=[[]for _ in range(M)]
for i in range(N):
	if t[2*i]<=M:
		v[t[2*i]-1].append(t[2*i+1])
z=0
q=[]
for i in range(M):
	for j in v[i]:
		heappush(q,-j)
	b=0
	if len(q):
		b=heappop(q)
	z-=b
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*9*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*M
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

Buggy submission (verdict: Runtime Error):
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]
v=[[]for _ in q]
z=0
for a,b in t:
	if a<=M:v[a-1]+=[b]
for i in v:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)
Problem p03232 (python)

Fixed submission:
m=10**9+7
input()
i=s=r=0
f=1
a=input().split()
for _ in a:
 s+=pow(i+1,m-2,m);r+=int(a[i])*~-s+int(a[~i])*s;i+=1;f=f*i%m
print(r*f%m)

Buggy submission (verdict: Runtime Error):
m=10**9+7
input()
i=s=r=0
f=1
a=map(int,input().split())
for _ in a:
 s+=pow(i+1,m-2,m)
 r+=a[i]*~-s+a[~i]*s
 i+=1
 f=f*i%m
print(r*f%m)
Problem p03426 (python)

Fixed submission:
line = input().split(" ")
a = list(map(int, line))
data = [0] * 90001
ans = 0
for i in range(0, a[0]):
    line = input().split(" ")
    temp = list(map(int, line))
    for j in range(0, a[1]):
        data[temp[j]] = [i, j]

memo = [0] * 90001

for i in range(1, a[0] * a[1]+1):
    if i < a[2]+1:
        memo[i] = 0
    else:
        memo[i] = memo[i - a[2]] + abs(data[i][0] - data[i - a[2]][0]) + abs(data[i][1] - data[i - a[2]][1])
times = int(input())
for i in range(0, times):
    line = list(map(int, input().split(" ")))
    print(memo[line[1]] - memo[line[0]])

Buggy submission (verdict: Runtime Error):
line = input().split(" ")
a = list(map(int, line))
data = [0] * 90001
ans = 0
for i in range(0, a[0]):
    line = input().split(" ")
    temp = list(map(int, line))
    for j in range(0, a[1]):
        data[temp[j]] = [i, j]

memo = [0] * 90001

for i in range(0, a[0] * a[1]):
    if i < a[2]:
        memo[i] = 0
    else:
        memo[i] = memo[i - a[2]] + abs(data[i][0] - data[i - a[2]][0]) + abs(data[i][1] - data[i - a[2]][1])
times = int(input())
for i in range(0, times):
    line = list(map(int, input().split(" ")))
    print(memo[line[1]-1] - memo[line[0]-1])

Buggy submission (verdict: Runtime Error):
line = input().split(" ")
a = list(map(int, line))
data = [0] * 90001
ans = 0
for i in range(0, a[0]):
    line = input().split(" ")
    temp = list(map(int, line))
    for j in range(0, a[1]):
        data[temp[j]] = [i, j]

memo = [0] * 90001

for i in range(0, a[0] * a[1]):
    if i < a[2]:
        memo[i] = 0
    else:
        memo[i] = memo[i - a[2]] + abs(data[i][0] - data[i - a[2]][0]) + abs(data[i][1] - data[i - a[2]][1])
times = int(input())
for i in range(0, times):
    line = list(map(int, input().split(" ")))
    print(memo[line[1]] - memo[line[0]])

Buggy submission (verdict: Runtime Error):
line = input().split(" ")
a = list(map(int, line))
data = [0]*90000
ans=0
for i in range(0, a[0]):
    line = input().split(" ")
    temp = list(map(int, line))
    for j in range(0, a[1]):
        data[temp[j]] = [i,j]
times=int(input())
for i in range(0,times):
    line = input().split(" ")
    temp = list(map(int, line))
    nowloc=temp[0]
    ans=0
    while nowloc!=temp[1]:
        ans+=abs(data[nowloc][0]-data[nowloc+a[2]][0])+abs(data[nowloc][1]-data[nowloc+a[2]][1])
        nowloc+=a[2]
    print(ans)
Problem p02547 (python)

Fixed submission:
n = int(input())
d = [list(map(int,input().split())) for i in range(n)]
count = 0

# [[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6]]

for i in d:
  if i[0] == i[1]:
    count += 1
  else:
    count = 0
  if count == 3:
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
dD = [map(int, input().split()) for _ in range(5)]
d,D = [list(i) for i in zip(*dD)]
count = 0

for i in range(n-1):
  if d[i] == D[i]:
    count += 1
  else:
    count *= 0

if count >= 3:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
D1D2 = [map(int, input().split()) for _ in range(5)]
D1,D2 = [list(i) for i in zip(*D1D2)]
count = 0

for i in range(n-1):
  if D1[i] == D2[i]:
    count += 1
  else:
    count *= 0

if count >= 3:
  print('Yes')
else:
  print('No')
Problem p02693 (python)

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

if a <= b//k*k:
  print('OK')
else:
  print('NG')

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

if A//K < B//K or K==1:
  print('OK')
else:
  print('NG')
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
S = [input() for i in range(N)]

ans = collections.Counter(S)
print(len(ans))
Problem p02711 (python)

Fixed submission:
N = str(input())

if '7' in N:
  print('Yes')
else:
  print('No')

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

if N in 7:
  print('Yes')
else:
  print('No')

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

if N in 7:
  print('Yes')
else:
  print('No')
Problem p02725 (python)

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

A.append(A[0]+K)
L = []

for i in range(N):
  a = A[i+1]-A[i]
  L.append(a)
ans = K-max(L)

print(ans)

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

A.append(A[0]+K)

print(A)

for i in range(K):
  L = A[i+1]-A[i]
ans = K-max(L)

print(ans)

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

A.append(A[0]+K)

for i in K:
  L = A[i+1]-A[i]
ans = K-max(L)

print(ans)
Problem p02729 (python)

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

even = N*(N-1)/2
odd = M*(M-1)/2

print(int(even + odd))

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

x = (N-1)/2
y = (N+3)/2

a = S[:x]
b = S[y:N]

if a == reversed(a) and b == reversed(b):
  print('Yes')
else:
  print('No')

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

even = N*(N-1)/2
odd = M*(M-1)/2

ans = even + add

print(ans)
Problem p02753 (python)

Fixed submission:
S = input()
if S == "AAA" or S == "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = int(input())
if S == "AAA" or "BBB":
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = int(input())
if S == AAA or BBB:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = int(input())
if S = AAA or BBB:
  print("No")
else:
  print("Yes")
Problem p02754 (python)

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

count = N//(A+B)
amari = N%(A+B)

if amari < A:
  c = amari
else:
  c = A
  
ans = A * count + c
print(ans)

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

count = N//(A+B)
amari = N%(A+B)

if amari < A:
  c = amari
else:
  c = A
  
ans = A * x + c
print(ans)

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

line = 'b'*A + 'r'*B

for i in 10**100:
  line += line
  if len(line) >= N:
    break
   
ans = line.count('b')
print(ans)
Problem p02759 (python)

Fixed submission:
N = int(input())
if N%2 == 0:
  ans = int(N/2)
else:
  ans = int(N/2)+1
  
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
if N%2 == 0:
  ans = N/2
else:
  ans = N/2+1
  
print(ans)
Problem p02571 (python)

Fixed submission:
s = list(input())
t = list(input())

r = len(s) - len(t)
l = []
if r != 0:
    for start in range(r):
        count = 0
        for i in range(len(t)):
            if t[i] == s[start+i]:
                count +=1
        l.append(count)
    ans = len(t)- max(l)
else:
    count = 0
    for i in range(len(t)):
        if t[i] == s[i]:
            count +=1
    ans = len(t)- count   

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())

r = len(s) - len(t)
l = []
for start in range(r):
    count = 0
    for i in range(len(t)):
        if t[i] == s[start+i]:
            count +=1
    l.append(count)
ans = len(t)- max(l)
print(ans)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

i_l, j_l = [0], [0]

best0 = M
ans = 0

for i in range(N):
    i_l.append(i_l[i] + a_l[i])

for i in range(M):
    j_l.append(j_l[i] + b_l[i])

# for j in range(M):
#     total += b_l[j]
#     if total > K:
#         best0 = j-1
#         break
#     elif total == K:
#         best0 = j
#     else:
#         continue

for k in range(N+1):
    if i_l[k] > K:
        break
    while i_l[k] + j_l[best0] > K:
        best0 -= 1
    ans = max(ans, k+best0)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))

i_l, j_l = [0], [0]

best0 = M
ans = 0

for i in range(N):
    i_l.append(i_l[i] + a_l[i])

for i in range(M):
    j_l.append(j_l[i] + b_l[i])

# for j in range(M):
#     total += b_l[j]
#     if total > K:
#         best0 = j-1
#         break
#     elif total == K:
#         best0 = j
#     else:
#         continue

for k in range(N+1):
    if i_l[i] > K:
        break
    while i_l[k] + j_l[best0] > K:
        best0 -= 1
    ans = max(ans, k+best0)
print(ans)
Problem p02693 (python)

Fixed submission:
n=int(input())
a,b=map(int,input().split())
flag=0
for i in range(a,b+1):
    if i%n==0:
        flag=1
if flag==1:
    print("OK")
else:
    print("NG")

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

for i in range(a,b+1):
    if i%n==0:
        flag=1
if flag==1:
    print("OK")
else:
    print("NG")
Problem p02916 (python)

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-1):
    if a[i]+1==a[i+1]:
        ans+=c[a[i]-1]
print(sum(b)+ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n-1):
    if a[i]+1==a[i+1]:
        ans+=c[a[i]-1]
print(sum(b)+ans)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=str(input())
if a>=3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
a=input()
s=input()
if a>=3200:
    print(s)
else:
    print("red")
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
a=s[k-1].lower
print(s[:k-1]+a+s[k:])