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

Fixed submission:
N = int(input())
table = [[0]*10 for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    e1 = int(s[0])
    e2 = int(s[-1])
    table[e1][e2] += 1

res = 0
for i in range(1, 10):
    for j in range(1, 10):
        res += table[i][j]*table[j][i]
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
table = [[0]*10 for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    e1 = int(s[0])
    e2 = int(s[1])
    table[e1][e2] += 1

res = 0
for i in range(1, 10):
    for j in range(1, 10):
        res += table[i][j]*table[j][i]
print(res)
Problem p02831 (python)

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

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

ans = lcm(A, B)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
A, B = input().split()

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

ans = lcm(int(A), int(B))
print(ans)

Buggy submission (verdict: Runtime Error):
#AtCoder
import math
A, B = input().split()

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

print(lcm(int(A), int(B)))
Problem p02859 (python)

Fixed submission:
#AtCoder
r = int(input())
ar = r*r
print(int(ar/1))

Buggy submission (verdict: Runtime Error):
#AtCoder
from math import sqrt
N = int(input())
lst = [list(map(int, input().split())) for _ in range(N)]
res = 0
for i in range(N):
    for j in range(N):
        if i != j:
            res += sqrt((lst[i][0] - lst[j][0])**2 + (lst[i][1] - lst[j][1])**2) 
print(res/N)
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()
m = sum(h)

for i in range(n - k + 1):
    m = min(h[i + k - 1] - h[i], m)
print(m)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = [int(input()) for _ in range(N)]

h.sort()
m = sum(h)

for i in range(n - k):
    m = min(h[i + k] - h[i], m)
print(m)

Buggy submission (verdict: Runtime Error):
#AtCoder

N, K = (int(x) for x in input().split())
S = (int(input()) for _ in range(N))

lst = list(S)

print(max(lst)-min)
Problem p02693 (python)

Fixed submission:
import math
k = int(input())
s, t = [int(i)/k for i in input().split()]

if math.ceil(s) <= math.floor(t):
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
import math
k = input()
s, t = [int(i)/k for i in input().split()]

if math.ceil(s) <= math.floor(t):
  print('OK')
else:
  print('NG')
Problem p02987 (python)

Fixed submission:
s = input()
s = sorted(s)
if s[0] == s[1] and s[2] == s[3] and not (s[1] == s[2]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
t = set(s)
if len(t) != 2:
  print('No')
else:
  for char in t:
    ans = arr([(s.count(char) == 2) for char in t])
  if ans:
    print('Yes')
  else:
    print('No')
Problem p03108 (python)

Fixed submission:
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [-1 for i in range(N)]

def root(x):
    if par[x] < 0:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if size(x) < size(y):
        x, y = y, x
    par[x] += par[y]
    par[y] = x
    
def same(x, y):
    return root(x) == root(y)

def size(x):
    return - par[root(x)]
    
    
inconv = N * (N - 1) // 2
result = [0] * M
for i in range(M - 1, -1, -1):
    A, B = ils[i]
    A -= 1
    B -= 1
    result[i] = inconv
    if not same(A, B):
        inconv -= size(A) * size(B)
        unite(A, B)
    
for i in result:
    print(i)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [i for i in range(0, N + 1)]
size = [1] * (N + 1)

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
      return
    par[x] = y
    size[y] += size[x]
    size[x] = size[y]
    
def same(x, y):
    return root(x) == root(y)
    
    
inconv = N * (N - 1) // 2
inconvs = [inconv]
for A, B in ils[M + 1:0:-1]:
    if not same(A, B):
        inconv -= size[root(A)] * size[root(B)]
        unite(A, B)
    inconvs.insert(0, inconv)
    
for i in inconvs:
    print(i)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [i for i in range(0, N + 1)]
size = [1] * (N + 1)

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
      return
    par[x] = y
    size[y] += size[x]
    size[x] = size[y]
    
    
inconv = N * (N - 1) // 2
inconvs = [inconv]
for A, B in ils[M + 1:0:-1]:
    inconv -= size[root(A)] * size[root(B)]
    inconv = max(0, inconv)
    unite(A, B)
    inconvs.insert(0, inconv)
    
print('\n'.join(map(str, inconvs)))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [i for i in range(N)]
size = [1] * N

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        
def unit(x, y):
    x = root(x)
    y = root(y)
    if x == y:
      return
    par[x] = y
    size[y] += size[x]
    size[x] = size[y]
    
    
inconv = N * (N - 1) // 2
inconvs = [inconv]
for A, B in ils[::-1]
    inconv -= size(root(A)) * size(root(B))
    unite(A, B)
    inconvs.insert(0, inconv)
    
print('\n'.join(inconvs))
Problem p02627 (python)

Fixed submission:
a = input()
 
if a.isupper() == True and a.isalpha() == True:
  print("A")
elif a.islower() == True and a.isalpha() == True:
  print("a")

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

if a.isupper() == True:
  print("A")
elif a.islower() == True:
  print("a")
else:
  return
Problem p02629 (python)

Fixed submission:
import math

t = input()
moji_list = {1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
print_list =[]

def hantei(t):
    global print_list
    try:
        int(t)
    except ValueError:
        return
    else:
        n = int(t)
    
    if 1 <= n and n <= 1000000000000001:
        while(n >= 1):
            s = n % 26
            if s == 0:
                s = 26
            print_list.insert(0, moji_list[s])
            n = math.floor(n / 26)
            if s == 26:
                n -= 1
    else:
        return

hantei(t)
pu = ''.join(print_list)
print(pu)

Buggy submission (verdict: Runtime Error):
import math

t = input()
moji_list = {1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
print_list =[]

def hantei(t):
    global print_list
    try:
        int(t)
    except ValueError:
        return
    else:
        n = int(t)
    
    if 1 <= n and n <= 1000000000000001:
        while(n >= 1):
            s = n % 26
            print_list.insert(0, moji_list[s])
            n = math.floor(n / 26)
    else:
        return

hantei(t)
pu = ''.join(print_list)
print(pu)

Buggy submission (verdict: Runtime Error):
import math

t = input()
n = int(t)
moji_list = {1:"a",2:"b",3:"c",4:"d",5:"e",6:"f",7:"g",8:"h",9:"i",10:"j",11:"k",12:"l",13:"m",14:"n",15:"o",16:"p",17:"q",18:"r",19:"s",20:"t",21:"u",22:"v",23:"w",24:"x",25:"y",26:"z"}
print_list =[]

def hantei(n):
    global print_list

    if 1 <= n and n <= 1000000000000001:
        while(n >= 1):
            s = n % 26
            print_list.insert(0, moji_list[s])
            n = math.floor(n / 26)
    else:
        return

hantei(n)
pu = ''.join(print_list)
print(pu)
Problem p02629 (python)

Fixed submission:
N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
ans=""
while True:
  N-=1
  a=N%26
  N=N//26
  ans=alpha[a]+ans
  
  if N==0:
    break
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
k=26
l=1
while N-k>0:
  N-=k
  k*=26
  l+=1
ans=["a"]*l
N-=1
i=-1
while N>26:
  a=N%26
  N=N//26
  ans[i]=alpha[a]
  i-=1
ans[i]=alpha[N]
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
k=26
l=1
while N-k>0:
  N-=k
  k*=26
  l+=1
ans=["a"]*l
N-=1
i=-1
while N>26:
  a=N%26
  N=N//26
  ans[i]=alpha[a]
  i-=1
ans[i]=alpha[N]
print("".join(ans))

Buggy submission (verdict: Runtime Error):
N=int(input())
alpha=list("abcdefghijklmnopqrstuvwxyz")
k=26
l=1
while N-k>0:
  N-=k
  k*=26
  l+=1
ans=""
N-=1
while N>26:
  a=N%26
  N=N//26
  ans=alpha[a]+ans
ans=alpha[N]+ans
k=len(ans)
for i in range(k,l):
  ans="a"+ans
print(ans)
Problem p02762 (python)

Fixed submission:
N,M,K = map(int,input().split())
ans=[0 for i in range(N)]
  
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
uf = UnionFind(N)
for i in range(M):
  a,b=map(int,input().split())
  uf.union(a-1,b-1)
  ans[a-1]-=1;ans[b-1]-=1
    
for i in range(K):
  c,d=map(int,input().split())
  if uf.same(c-1,d-1):
    ans[c-1]-=1;ans[d-1]-=1
    
for i in range(N):
  ans[i]+=uf.size(i)-1
  print(ans[i],end=" ")

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix
import collections
N,M,K = map(int,input().split())
G = [[0 for i in range(N)] for j in range(N)]
ans=[0 for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  G[a-1][b-1]=1;G[b-1][a-1]=1
  ans[a-1]-=1;ans[b-1]-=1
  
a = np.array(G)
n, labels = connected_components(a)
c = collections.Counter(labels)

for i in range(N):
  ans[i]+=c[labels[i]]-1
  
for i in range(K):
  c,d=map(int,input().split())
  c-=1;d-=1
  if labels[c]==labels[d]:
    ans[c]-=1;ans[d]-=1
for i in range(N):
  print(ans[i],end=" ")
Problem p02793 (python)

Fixed submission:
import  fractions
N = int(input())
A = list(map(int,input().split()))
mod =10**9+7
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
inv_t = [0]+[1]
for i in range(2,10**6+5):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
  
k=1
ans=0
for a in A:
  k=lcm(k,a)
  ans+=inv_t[a]%mod
k%=mod

print(ans*k%mod)

Buggy submission (verdict: Runtime Error):
import  fractions
N = int(input())
A = list(map(int,input().split()))
mod =10**9+7
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
inv_t = [0]+[1]
for i in range(2,10**6):
  inv_t += [inv_t[mod % i] * (mod - int(mod / i)) % mod]
  
k=1
for a in A:
  k=lcm(k,a)
  
ans=0
for a in A:
  ans+=k*inv_t[a]%mod
print(ans)
Problem p03634 (python)

Fixed submission:
import collections
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
Dist=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

que=collections.deque()
que.append(K-1)
Dist[K-1]=0
while len(que):
  u=que.pop()
  for i,j in Branch[u]:
    if Dist[i]==float("Inf"):
      Dist[i]=Dist[u]+j
      que.append(i)

  
for i in range(Q):
  x,y = map(int,input().split())
  print(Dist[x-1]+Dist[y-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
DistK=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

def dfs(s,dist,flag,Branch,DistK):
  DistK[s]=dist
  flag[s]=1
  
  for i in range(len(Branch[s])):
    if flag[Branch[s][i][0]]==0:
      dfs(Branch[s][i][0],dist+Branch[s][i][1],flag,Branch,DistK)
      
  return 1
dfs(K-1,0,flag,Branch,DistK)
for i in range(Q):
  x,y = map(int,input().split())
  print(DistK[x-1]+DistK[y-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
DistK=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

def dfs(s,dist):
  DistK[s]=dist
  flag[s]=1
  
  for i in range(len(Branch[s])):
    if flag[Branch[s][i][0]]==0:
      dfs(Branch[s][i][0],dist+Branch[s][i][1])
dfs(K-1,0)
      
for i in range(Q):
  x,y = map(int,input().split())
  print(DistK[x-1]+DistK[y-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
Branch=[[] for i in range(N)]
for i in range(N-1):
  a,b,c=map(int,input().split())
  Branch[a-1].append([b-1,c])
  Branch[b-1].append([a-1,c])
Q,K=map(int,input().split())
DistK=[float("Inf") for i in range(N)]
flag = [0 for i in range(N)]

def dfs(s,dist):
  DistK[s]=dist
  flag[s]=1
  
  for branch in Branch[s]:
    if flag[branch[0]]==0:
      dfs(branch[0],dist+branch[1])
dfs(K-1,0)
      
for i in range(Q):
  x,y = map(int,input().split())
  print(DistK[x-1]+DistK[y-1])
Problem p03804 (python)

Fixed submission:
N,M = map(int,input().split())
a_g=[];b_g=[]
for i in range(N):
  a_g.append(list(input()))
for i in range(M):
  b_g.append(list(input()))

for i in range(N-M+1):
  for j in range(N-M+1):
    flag=1
    for k in range(M):
      for l in range(M):
        if a_g[k+i][l+j] != b_g[k][l]:
          flag=0
          break
    if flag:
      print("Yes");exit()
print("No")

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
a_g=[];b_g=[]
for i in range(N):
  a_g.append(list(input()))
for i in range(M):
  b_g.append(list(input()))

for i in range(N-M):
  for j in range(N-M):
    flag=1
    for k in range(M):
      for l in range(M):
        if a_g[k+i][l+j] != b_g[k][l]:
          flag=0
          l=M;k=M
    if flag:
      print("Yes");exit()
print("No")
Problem p02682 (python)

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

if k>=a+b+c:
  print(a-c)
elif a+b<=k<=a+b+c:
  print(a-(k-(a+b)))
elif a<=k<=a+b:
  print(a)
elif 0<=k<=a:
  print(k)

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

if k>=a+b+c:
  print(a-c):
elif a+b<=k<=a+b+c:
  print(a-(k-(a+b)))
elif a<=k<=a+b:
  print(a)
elif 0<=k<=a:
  print(k)
Problem p02707 (python)

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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print(k)

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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print k
Problem p02711 (python)

Fixed submission:
n = int(input())
count = 0
tenwari = n%10
baiwari = n%100
ichi = tenwari
jyu = (baiwari-tenwari)//10
hyaku = (n-jyu*10-ichi)//100

if ichi != 7:
  count = count + 1
if jyu != 7:
  count = count + 1
if hyaku != 7:
  count = count + 1
  
if count == 3:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
tenwari = n%10
baiwari = n%100
ichi = tenwari
jyu = (baiwari-tenwari)//10
hyaku = (n-jyu*10-ichi)//100

if ichi != 7:
  count = count + 1
if jyu != 7:
  count = count + 1
if hyaku != 7:
  count = count + 1
  
if count ==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input)
keta = n//10 + 1
count = 0
for i in range(0, keta):
  if n[i] == 7:
    count = count
  else:
    count = count + 1
    
if count == keta:
  print('No')
else:
  print('Yes')
Problem p02712 (python)

Fixed submission:
n = int(input())
count = 0
for i in range(0,n):
  if (i+1)%3==0:
    count = count
  elif (i+1)%5==0:
    count = count
  else:
    count = count + i + 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
for i in range(0,n):
  if (i+1)%3==0:
    count = count
  elif (i+1)%5==0:
    count = count
  else:
    count = count + i + 1

print(count)

Buggy submission (verdict: Runtime Error):
n = int(input)
count = 0
for i in range(0,n):
  if (i+1)//3==0:
    count = count
  elif (i+1)//5==0:
    count = count
  else:
    count = count + i + 1

print(count)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
print(["Yes","No"][input()=="BBB"or"AAA"])
Problem p02759 (python)

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

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
keep=0
aa=["#"]*n
for i in range(m):
  s,c=map(str,input().split())
  s=int(s)
  if n>=2 and s==1 and c=="0":
    keep=1
    print(-1)
    break
  if aa[s-1]=="#":
    aa[s-1]=c
  elif aa[s-1] !=c:
    keep=1
    print(-1)
    break
if keep==0:
  moji=""
  if aa[0]=="#" and n>=2:
    moji+="1"
  elif n==1 and aa[0]=="#":
    moji+="0"
  else:
    moji+=aa[0]
  for i in range(1,n):
    if aa[i]=="#":
      moji+="0"
    else:
      moji+=aa[i]
  print(moji)

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

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for i in range(k):
  try:
    h.pop(-1)
  except IndexError:
    pass
print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  try:
    h.pop(0)
  except IndexError:
    pass
print(sum(h)+t)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h = set(map(int,input().split()))

h = sorted(h)
l = len(h)
for i in range(l-k,l):
  h[i] = 0
  
result = 0  
for j in range(0, l):
  result = result + h[j]
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h = set(map(int,input().split()))

h = sorted(h)
l = len(h)
if k != 0:
  for i in range(l-k,l):
    h[i] = 0
  
result = 0  
for j in range(0, l):
  result = result + h[j]
print(h)
print(result)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h = set(map(int,input().split()))

h = sorted(h)
l = len(h)
for i in range(l-k,l):
  h[i] = 0
  
result = sum(h)
print(result)
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()))

lis=[]
for i in range(0,n-1):
  if a[i]==a[i+1]-1:
    lis.append(a[i])
plus=0
for j in range(0,len(lis)):
  plus+=c[lis[j]-1]
print(sum(b)+plus)

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()))

lis=[]
for i in range(0,n-1):
  if a[i]==a[i+1]-1:
    lis.append(a[i])
plus=0
for j in range(0,len(lis)):
  plus+=c[a[j]-1]
print(sum(b)+plus)
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
b=[]
for i in range(m):
  b.append(input())

res=0
for i in range(0,n-m+1):
  for k in range(0,n-m+1):
    keep=0
    for j in range(i,i+m):    
      if b[j-i] in a[j][k:k+m]:
        keep+=1
      if keep==m:
        print("Yes")
        res=1
        break
  if res==1:
    break
if res==0:
  print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
b=[]
for i in range(m):
  b.append(input())

res=0
for i in range(0,n-m+1):
  keep=0
  for j in range(i,i+m):
    if b[j-i] in a[j]:
      keep+=1
  if keep==m:
    print("Yes")
    res=1
    break
if res=0:
  print("No")
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
 
ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
 
a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])
 
ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
        j -= 1
        ans = max(ans, i + j)
print(ans)

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

a, b = [0], [0]
for i in range(N):
	a.append(a[i] + A[i])
for i in range(M):
	b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
	if a[i] > K:
		break
	while b[j] > K - a[i]:
	j -= 1
	ans = max(ans, i + j)
print(ans)
Problem p02622 (python)

Fixed submission:
s = input()
t = input()
n = len(s)
ans = 0
for i in range(n):
  if s[i] != t[i]:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
n = 0
for i in s:
  for j in t:
    if i != j:
      i = j
      n += 1
return n
Problem p02623 (python)

Fixed submission:
n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=sum(a)
a.append(0)
tb=0
ans=0
j=0
for i in range(n+1):
    ta -= a[n-i]
    if ta>k:
        continue
    while tb + ta<=k:

        if j ==m:
            ans=max(ans,n-i+j)
            break
        ans=max(ans,n-i+j)
        tb += b[j]
        j +=1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=sum(a)
a.append(0)
tb=0
ans=0
j=0
for i in range(n+1):
    ta -= a[n-i]
    if ta>k:
        continue
    while tb + ta<k:

        if j ==n:
            ans=max(ans,n-i+j+1)
            break
        tb += b[j]
        ans=max(ans,n-i+j)
        j +=1

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k =map(int, input().split())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
ta=0
tb=0
ans=0
for i in range(n+1):
    ta += a[i]
    if i=0:
        ta=0
    if ta>k:
        break
    for j in range(m):
        tb=sum(b[:j+1])
        ans=max(ans,i+j)
        if tb + ta >k:
            break
        ans=max(ans,i+j+1)
print(ans)