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

Fixed submission:
n = int(input())
monster = list(map(int,input().split()))
brave = list(map(int,input().split()))
ans = 0
for i in range(n):
  kill = min(monster[i],brave[i])
  ans += kill
  brave[i] -= kill
  kill = min(monster[i+1],brave[i])
  ans += kill
  monster[i+1] -= kill
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
monster = list(map(int,input().split()))
brave = list(map(int,input().split()))
ans = 0
for i in range(n):
  if i == 0:
    kill = min(monster[0],brave[0])
    ans += kill 
    brave -= kill
  else:
    kill = min(monster[i],brave[i])
    ans += kill
    brave[i] -= kill
    kill = min(monster[i+1],brave[i])
    ans += kill
    monster -= kill
print(ans)
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int,input().split()))
mid = N//2
d.sort()
if (d[mid]==d[mid-1]):
  print(0)
else:
  ans = d[mid]-d[mid-1]
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = list(map(int,input().split()))
mid = N/2
if (d[mid]==d[mid-1]):
  print(0)
else:
  ans = d[mid]-d[mid-1]
  print(ans)
Problem p03041 (python)

Fixed submission:
n,k = map(int,input().split())
s = str(input())
ans = ""
for i in range(n):
  if(i==k-1):
    if(s[i]=="A"):
      ans+="a"
    elif(s[i]=="B"):
      ans+="b"
    else:
      ans+="c"
  else:
    ans+=s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k= map(int,input().split())
s = str(input())
if(s[k-1]=="A"):
  s[k-1]="a"
elif(s[k-1]=="B"):
  s[k-1]="b"
else:
  s[k-1]="c"
print(s)
Problem p03072 (python)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
count = 1
for i in range(1,N):
  judge = 0
  for j in range(i):
    if(H[j]>H[i]):
      judge = judge +1
      break
  if(judge==0):
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
count = 1
for i in range(1,N):
  judge = 0
  for j in range(i):
    if(H[j]>H[I]):
      judge = judge +1
      break
  if(judge==0):
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
M = max(H)
count=1
i = 1
while True:
  if(H[i]==M):
    break
  else:
    judge=0
    for j in range(i):
      if(H[j]>H[i]):
        judge = judge + 1
      else:
        None
    if(judge==0):
      count += 1
  i += 1
print(count)
Problem p03075 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
A =[a,b,c,d,e]
A.sort(reverse=True)
K = []
for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    K.append(A[i]-A[j])
Max = 0
for n in range(len(K)):
  Max = max(Max,K[n])
if (Max <= k):
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=map(int, input().split())
A =[a,b,c,d,e]
A.sort(reverse=True)
K = []
for i in range(len(A)-1):
  for j in range(i+1,len(A)):
    K.append(A[i]-A[j])
Max = 0
for n in range(len(K)):
  Max = max(Max,K[n])
if (Max <= k):
  print("Yay!")
else:
  print(":(")
Problem p03077 (python)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
L = [A,B,C,D,E]
L.sort()
M = 0
H = N % L[0]
if(H == 0):
  print(N//L[0]+4)
else:
  print(N//L[0]+5)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
L = [A,B,C,D,E]
L.sort()
if L[0] =>N:
  M = 1
else:
  K = N // L[0]
  M = K + 1
print(M + 4)
Problem p03127 (python)

Fixed submission:
import math
N = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,N):
  ans = math.gcd(ans,a[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,N):
  ans = gcd(ans,a[i])
print(ans)
Problem p03186 (python)

Fixed submission:
A,B,C=map(int,input().split())
if(A+B>=C-1):
  print(B+C)
else:
  print(B+A+B+1)

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input())
if(A+B>=C+1):
  print(B+C)
else:
  print(B+A+B+1)

Buggy submission (verdict: Runtime Error):
A.B.C=map(int,input())
if(A+B>=C+1):
  print(B+C)
else:
  print(B+A+B+1)
Problem p03705 (python)

Fixed submission:
n,a,b = map(int,input().split())
if(a>b):
  print(0)
else:
  if(n == 1):
    if(a!=b):
      print(0)
    else:
      print(1)
  else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
if(a>b):
  print(0)
else:
  if(n = 1):
    if(a!=b):
      print(0)
    else:
      print(1)
  else:
    print(b*(n-1)+a-(a*(n-1)+b)+1)
Problem p02546 (python)

Fixed submission:
S=input()
if (S[-1:]=="s"):
  print(S+"es")
else:
  print(S+"s")

Buggy submission (verdict: Runtime Error):
S=input()
if (S[-1:]==s):
  print(S+"es")
else:
  print(S+"s")
Problem p02594 (python)

Fixed submission:
T=int(input())
if (T>=30):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x=int(input())
if (x>=30):
  print(‘Yes’)
else:
  print(‘No’)
Problem p02754 (python)

Fixed submission:
N,A,B=input().split()
ANS=int(N)//(int(A)+int(B))
ANS=ANS*int(A)
if(int(N)%(int(A)+int(B))<=int(A)):
   ANS=ANS+(int(N)%(int(A)+int(B)))
else:
   ANS=ANS+int(A)
print(ANS)

Buggy submission (verdict: Runtime Error):
N,A,B=input().split()
ANS=int(N)//(int(A)+int(B))
ANS=ANS*int(A)
if((int(N)%(int(A)+int(B))<=int(A)):
   ANS=ANS+(int(N)%(int(A)+int(B)))
else:
   ANS=ANS+int(A)
print(ANS)
Problem p02777 (python)

Fixed submission:
S,T=input().split()
A,B=input().split()
U=input()
if(str(S)==str(U)):
  A=int(A)-1
if(str(T)==str(U)):
  B=int(B)-1
print(str(A)+' '+str(B))

Buggy submission (verdict: Runtime Error):
N=input()
A=input().split()
if(A in N):
  print("YES")
else:
  print("NO")
Problem p02712 (python)

Fixed submission:
def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if (i%3==0) and (i%5==0):
            continue
        if (i%3==0):
            continue
        if (i%5==0):
            continue
        ans += i
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ans = 0
    for i in range(n):
        if (i%3==0) and (i%5==0):
            continue
        if (i%3==0):
            continue
        if (i%5==0):
            continue
        ans += i
    print(ans)
main(
Problem p02829 (python)

Fixed submission:
#usr/bin/python3
a = input()
b = input()
print(6-int(a)-int(b))

Buggy submission (verdict: Runtime Error):
#usr/bin/python3
a, b = input().split()
print(6-int(a)-int(b))
Problem p02831 (python)

Fixed submission:
#python3
a, b = map(int, input().split())
def gcd(x, y):
  if x%y == 0:
    return y
  else :
    return gcd(y, x%y) 

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

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
#python3
import math
a,b=map(int, input().split())
print(a*b//(math.gcd(a,b)))

Buggy submission (verdict: Runtime Error):
#python3
import math
a,b=map(int, input().split())
print(a*b//math.gcd(a,b))
Problem p02832 (python)

Fixed submission:
#python3
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    k = 1
    for i in range(n):
        if a[i] == k:
            k += 1
    k -= 1
    print(n - k) if k else print(-1)  

main()

Buggy submission (verdict: Runtime Error):
#python3
cnt = 0
s = 1
def main():
    n = int(input())
    a = [int(i) for i in input().split()]

    def solve(ar):
        global cnt
        global s
        idx = 0
        f = False
        for i in range(len(ar)):
            if s == ar[i]:
                idx = i
                cnt += 1
                f = True
                break
        if (not f) or (idx>n):
            return 
        s += 1
        solve(ar[idx+1:])
        return cnt

    p = solve(a)
    print(n-p) if p else print(-1)
main()

Buggy submission (verdict: Runtime Error):
#python3
cnt = 0
s = 1
def main():
    n = int(input())
    a = [int(i) for i in input().split()]

    def solve(ar):
        global cnt
        global s
        idx = 0
        f = False
        for i in range(len(ar)):
            if s == ar[i]:
                idx = i
                cnt += 1
                f = True
                break
        if (not f) or (idx>n):
            return 
        s += 1
        solve(ar[idx+1:])
        return cnt

    p = solve(a)
    print(n-p) if p else print(-1)
main()
Problem p02862 (python)

Fixed submission:
#python3
from math import factorial
from math import floor
MOD = int(1e9+7)

def comb(n, m, mod):
    comb_a = 1
    for i in range(m): 
        comb_a *= (n-i)
        comb_a %= mod
    comb_tmp = factorial(m) 
    comb_b = pow(comb_tmp, mod-2, mod)
    return (comb_a * comb_b)%mod
def main():
    x, y = map(int, input().split())
    k = (2*x-y)/3
    l = (2*y-x)/3

    if floor(k) - k != 0:
        print(0)
        return
    if floor(l) - l != 0:
        print(0)
        return 
    if k<0:
        print(0)
        return
    if l<0:
        print(0)
        return
    k = int(k)
    l = int(l)
    print(comb(k+l, k, MOD)%MOD) 

main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from math import factorial 
def main():
    x, y = map(int, readline().split())
    if ((2*y-x)%3) or ((2*x-y)%3):
        print(0)
        return
    a = (2*y-x)//3
    b = (2*x-y)//3
    P = int(1e9)+7
    def c(n, m):
        ch = 1
        for i in range(m):
            ch *= (n-i)
            ch %= P
        b = factorial(m) 
        b = pow(b, P-2, P)
        return ch*b%P
    print(c(a+b, a)) 
if __name__ == '__main__':
    main()
Problem p02984 (python)

Fixed submission:
#python3

def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    c = 0
    for i in range(n):
        if i%2 == 0:
            c += a[i]
        else:
            c -= a[i]
    x = c//2
    xs = []
    xs.append(x)
    for i in range(2, n+1):
        z = a[i-2] - xs[i-2]
        xs.append(z)
    for i in range(n):
        xs[i] = 2*xs[i]
    for i in range(n):
        if i == n-1:
            print(xs[i])
        else:
            print(xs[i], end=' ')
main()

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from itertools import accumulate
def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    Ae = A[1::2]
    Ao = A[::2]
    x1 = (sum(Ao)-sum(Ae))//2
    table = [0]*(N+1)
    table[0] = x1
    def rec(i):
        if i == N:
            return
        table[i+1] = A[i] - table[i]
        rec(i+1)
    rec(0)
    for i in table[:N]:
        print(i*2, end=' ')
if __name__ == '__main__':
    main()
Problem p02624 (python)

Fixed submission:
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ans = 0
    for x in range(1, N + 1):
        n = N // x  # Nのうちにxがいくつ含まれるか（等差数列の項数）
        ans += (n * (2 * x + (n - 1) * x)) // 2  # 初項と公差がxでn項の等差数列の和
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, K = il()
    A = il()
    SA = [0] * (N + 1)
    for n in range(N):
        SA[n + 1] = A[n] + SA[n]
    B = il()
    SB = [0] * (M + 1)
    for m in range(M):
        SB[m + 1] = B[m] + SB[m]
        
    ret = 0
    for n in range(N+1):
        for m in range(M+1):
            if SA[n] + SB[m] <= K:
                ret = max(ret, n + m)
    print(ret)


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

Fixed submission:
import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = list(map(int, sys.stdin.buffer.readline().split()))
    even = (N * (N - 1)) // 2
    odd = 0 if M == 1 else (M * (M - 1)) // 2
    print(even + odd)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os
import math


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    A = list(map(int, sys.stdin.buffer.readline().split()))
    P = set(A)

    for n in range(N):
        ary = A[n + 1:] + A[:-len(A) + n]
        tmp = 0
        for p in P:
            t = ary.count(p)
            tmp += (t * (t - 1)) // 2

        print(tmp)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L = int(sys.stdin.buffer.readline().rstrip())
    print(L ** 3 / 27)


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

Fixed submission:
a = input()
n, mod = divmod(int(a), 2)
print(n if mod == 0 else n + 1)

Buggy submission (verdict: Runtime Error):
import sys
import os
import math
import string
import collections

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def f(N):
    return sum(map(int, str(N)))


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    SC = [il() for _ in range(M)]
    ret = [0] * N
    for s, c in SC:
        if ret[s - 1] == 0 or ret[s - 1] == c:
            ret[s - 1] = c
        else:
            print(-1)
            exit()
    else:
        q = ''.join(map(str, ret))
        print(q if q[0] != str(0) and len(q) == N else -1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

        a = int(sys.stdin.readline().rstrip())

    print(int(a // 2 if a % 2 == 0 else a // 2 + 1))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
a = input()
n, mod = divmod(a, 2)
print(n if mod == 0 else n + 1)

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

        a = int(sys.stdin.readline().strip())
        n, mod = divmod(a, 2)
    print(n if mod == 0 else n + 1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

        a = int(sys.stdin.readline().rstrip())
        n, mod = divmod(a, 2)
    print(n if mod == 0 else n + 1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

        a = int(sys.stdin.readline().rstrip())

    print(a // 2 if a % 2 == 0 else a // 2 + 1)


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

Fixed submission:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    a, b = list(map(int, sys.stdin.readline().split()))
    if a < 10 and b < 10:
        print(a*b)
    else:
        print(-1)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())

    ret = float('inf')
    for i in range(1, 10000000):
        q, mod = divmod(N, i)
        if mod == 0:
            j = N // i
            ret = min(ret, ((j-1)+(i-1)))

    print(ret)


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

Fixed submission:
import sys
import os
import math
import bisect
import collections
import itertools
from fractions import gcd

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    sm = sum(A)
    print(min([gcd(sm, a) for a in A]))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
import os
import math
import bisect
import collections
import itertools

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    sm = sum(A)
    print(min([math.gcd(sm, a) for a in A]))


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

Fixed submission:
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = [iss() for _ in range(N)]
    B = [iss() for _ in range(M)]

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            t = i
            for b in B:
                # if t > M: break
                # if j + M > N: break
                if A[t][j:j+M] == b:
                    t += 1
                else:
                    break
            else:
                print('Yes')
                exit()
    else:
        print('No')


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = il()
    A = [iss() for _ in range(N)]
    B = [iss() for _ in range(M)]

    for i in range(N):
        for j in range(N):
            for b in B:
                if A[i][j:] == b: i += 1
                else:break
            else:
                print('Yes')
                exit()
    else:
        print('No')




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

Fixed submission:
string = input()
 
if string[-1] != 's':
  new_string = string[0:] + 's'
if string[-1] == 's':
  new_string = string[0:] +'es'
 
print(new_string)

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

if string[-1] != 's':
  new_string = string[0:-1] + 's'
if string[-1] = 's':
  new_string = string[0:-1] +'es'
 
print(new_string)
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 0:
  x = 1
else:
  x = 0
print(x)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
x = []
y = []
distance = []
 
for i in range(n):
  x1, y1 = input().split()
  x1 = int(x1)
  y1 = int(y1)
  x.append(x1)
  y.append(y1)
 
for i in range(len(x)):
  for j in range(i+1,len(x)):
    temp = abs(x[i] - x[j]) + abs(y[i] - y[j])
    distance.append(temp)

 
for i in range(len(distance)-1):
  if distance[i] >= distance[i+1]:
    a = distance[i]
 
print(a)
Problem p02571 (python)

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

res = 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 += 1
  res = max(res,count)

print(len(t)- res)

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

for i in range(len(s) - len(t) + 1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      count += 1
      if count != 0:
      	temp = count
    else:
      count = 0
if temp == len(t):
  temp = 0
print(temp)