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

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

ans = 0
if k > a:
    ans = ans + a
    k = k - a
else:
    ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
    ans = ans - c
else:
    ans = ans - k
print(ans)

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

ans = 0
if k > a:
	ans = ans + a
    k = k - a
else:
	ans = ans + k
    k = 0
if k > b:
    k = k - b
else:
    k = 0
if k > c:
	ans = ans - c
else:
	ans = ans - k
print(ans)

print(ans)
Problem p02699 (python)

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

if n <= m:
  print('unsafe')
else:
  print("safe")

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

if n <= m:
  print('unsafe')
else:
  print("safe")
Problem p02915 (python)

Fixed submission:
print(int(input())**3)

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

s = input()

if len(s) == 2 and s[0] != s[-1]:
    print(0)
    exit()

if s == 'LRL' or s == 'RLR':
    print(0)
    exit()

if s[0] == 'L':
  count = s.count('LR')
else:
  count = s.count('RL')

count = count - m

if s[0] != s[-1]:
  print(n - 2 * max(count, 0) - 1 * (count <= 0))

else:
  if count > 0:
    print(n - 2 * count - 1)
  else:
    print(n - 2 - max(count, -1))
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):
  if i >= 1 and a[i - 1] + 1 == a[i]:
    ans += c[a[i - 1] - 1]
  ans += b[a[i] - 1]

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

a = map(int,input().split())
b = map(int,input().split())
c = map(int,input().split())

ans = 0
for i in range(n):
  if i >= 1 and a[i - 1] + 1 == a[i]:
    ans += c[i - 1]
  ans += b[i]

print(ans)
Problem p02935 (python)

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

b = a[0]
for i in range(n - 1):
  b = (b + a[i + 1]) / 2

print(b)

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

b = a[0]
for i in range(n - 1):
  b = (b + a[i + 1]) / 2

print(b)
Problem p02948 (python)

Fixed submission:
import heapq

n,m = map(int,input().split())

a = [[] for i in range(100000)]
d = []
heapq.heapify(d)

for _ in range(n):
    b,c = map(int,input().split())
    a[b-1].append(-1 * c)

#print(a)

ans = 0
for i in range(m):
    for j in range(len(a[i])):
        heapq.heappush(d,a[i][j])
    if d != []:
        ans -= heapq.heappop(d)

print(ans)

Buggy submission (verdict: Runtime Error):
import heapq

n,m = map(int,input().split())

a = [[] for i in range(m)]
d = []
heapq.heapify(d)

for _ in range(n):
    b,c = map(int,input().split())
    a[b-1].append(-1 * c)

#print(a)

ans = 0
for i in range(m):
    for j in range(len(a[i])):
        heapq.heappush(d,a[i][j])
    ans -= heapq.heappop(d)

print(ans)

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

a = [[] for i in range(m)]

for _ in range(n):
    b,c = map(int,input().split())
    a[b-1].append(c)

#print(a)

ans = 0
for i in range(m):
    if a[m - 1 - i] != []:
        ans += max(a[m - 1 - i])

print(ans)
Problem p02959 (python)

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

ans = 0
for i in range(a):
  ans += min(b[i],c[i])
  c[i] -= min(b[i],c[i])
  ans += min(b[i + 1], c[i])
  b[i + 1] -= min(b[i + 1], c[i])

print(ans)

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

ans = 0
for i in range(a):
  ans += min(b[i],c[i])
  c[i] -= min(b[i],c[i])
  ans += min(b[i + 1], c[i])

print(ans)
Problem p02987 (python)

Fixed submission:
s = list(input())
s.sort()
if s[0] == s[1] and s[2] == s[3] and s[0] != s[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s.sorted()
if s.count(s[0]) == s.count(s[-1]):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s.sort()
if s.count(s[0]) == s.count(s[-1]):
  print('Yes')
else:
  print('No')
Problem p03135 (python)

Fixed submission:
l = list(map(float,input().split()))
m =l[0]/l[1]
print(m)

Buggy submission (verdict: Runtime Error):
l = list(map(float,input.split()))
m =l［0］/l［1］
print(m)
Problem p03137 (python)

Fixed submission:
# coding: utf-8
# Your code here!
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(0)
  
    
else:  
  c.sort()
  for j in range(min(a[0] - 1,a[1])):
    c[len(c)- 1 - j] = 0
  print(sum(c))

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

c = list(map(int,input().split()))
c.sort()

d = []
for i in range(b-1):
    d.append(c[i+1] - c[i])

d.sort()

#print(c,d)

for k in range(a - 1):
    d.pop()

print(sum(d))

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

c = []
if len(b) != 1:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 1:
  print(1)
  
    
else:  
  for j in range(min(a[0] - 1,a[1]):
    for k in range(len(c)):
      if c[k] == max(c):
        c[k] = 0

  print(sum(c))

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

c = []
if len(b) != 0:
  for i in range(len(b) - 1):
    c.append(b[i+1] - b[i])

if len(b) == 0:
  print(1)
  
    
else:  
  for j in range(min(a[0] - 1,a[1]):
    for k in range(len(c)):
      if c[k] == max(c):
        c[k] = 0

  print(sum(c))
Problem p02577 (python)

Fixed submission:
n = list(input())

ans = 0
for i in n:
    ans += int(i)
    ans = ans%9

print('Yes' if ans == 0 else 'No')

Buggy submission (verdict: Runtime Error):
def decisum(n):
    if n == 0:
        return 0
    else:
        return n%10 + decisum(n//10)

n = int(input()) 

ans = not (decisum(n)%9)

if ans:
    print('Yes')
else:
    print('No')
Problem p03013 (python)

Fixed submission:
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 1

[n,m] = inpl()
fibsec = [0]*(n+2)
fibsec[0] = 1
fibsec[1] = 1
fibsec[-1] = 0
for i in range(2,n+1):
    fibsec[i] = fibsec[i-1]+fibsec[i-2]

firsta = -1
for k in range(m):
    seconda = inp()
    ans = ans*(fibsec[seconda-firsta -2 ])%mod
    firsta = seconda

ans = ans*(fibsec[n-firsta-1])%mod
    

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict,deque, Counter
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
ans = 1

[n,m] = inpl()
fibsec = [0]*n
fibsec[0] = 1
fibsec[1] = 1
fibsec[-1] = 0
for i in range(2,n-1):
    fibsec[i] = fibsec[i-1]+fibsec[i-2]

firsta = -1
for k in range(m):
    seconda = inp()
    ans = ans*(fibsec[seconda-firsta -2 ])%mod
    firsta = seconda

ans = ans*(fibsec[n-firsta-1])%mod
    
print(ans)
Problem p02570 (python)

Fixed submission:
D, T, S = list(map(int, input().split()))

if D <= S * T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D, T, S = list(map(input().split()))

if D <= S * T:
    print("Yes")
else:
    print("No")
Problem p02987 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
if s[0] == s[1] == s[2] == s[3]:
  print('No')
else:
  if s[0] == s[1]:
      if s[2] == s[3]:
        print('Yes')
      else:
        print('No')
    elif s[0] == s[2]:
      if s[1] == s[3]:
        print('Yes')
      else:
        print('No')
    elif s[0] == s[3]:
      if s[1] == s[2]:
        print('Yes')
      else:
        print('No')
Problem p03803 (python)

Fixed submission:
a, b = list(map(int, input().split()))
if a == 1:
  a = 14
else:
  a = a
if b == 1:
  b = 14
else:
  b = b
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split()))
if a == 1:
  a = 14
else:
  break
if b == 1:
  b = 14
else:
  break
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')
Problem p02598 (python)

Fixed submission:
from bisect import *
from heapq import *
import math
mod = 10**9+7
N, K = map(int, input().split())
A = list(map(int, input().split()))
l = 0
r = 10**9+1
while l+1 < r:
    x = (l+r)//2
    k = 0
    for a in A:
        k += math.ceil(a/x)-1
        if k > K:
            break
    if K < k:
        l = x
    else:
        r = x
print(r)

Buggy submission (verdict: Runtime Error):
from bisect import *
from heapq import *
import math
mod = 10**9+7
N, K = map(int, input().split())
A = list(map(lambda x: (-int(x), int(x), 1), input().split()))
heapify(A)
k = 0
while K > 0:
    x, _x, c1 = A[0]
    heappop(A)
    y, _y, c2 = A[0]
    c3 = math.ceil(_x/(-y))
    print(c3)
    if c3-c1 > K:
        c3 = c1+K
        K = 0
    else:
        K -= c3-c1
    heappush(A, (-(_x/c3), _x, c3))
print(math.ceil(-A[0][0]))
print(A)
Problem p02763 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
INF = float("inf")

# Binary Indexed Tree
class BIT:
    def __init__(self, N):
        self.N = N
        self.bit = [0] * (N+1)
    def add(self, x, a):
        while x <= self.N:
            self.bit[x] += a
            x += x & -x
    def sum(self, x):
        ret = 0
        while x != 0:
            ret += self.bit[x]
            x -= x & -x
        return ret

N = int(input())
S = list(input())
Q = int(input())
bit = [BIT(N+1) for i in range(26)]
for i in range(N):
    bit[ord(S[i])-97].add(i+1, 1)
for i in range(Q):
    q, x, y = input().split()
    q = int(q)
    if q == 1:
        i = int(x)-1
        bit[ord(S[i])-97].add(i+1, -1)
        S[i] = y
        bit[ord(y)-97].add(i+1, 1)
    else:
        l, r, ans = int(x), int(y), 0
        for i in range(26):
            ans += (bit[i].sum(r)-bit[i].sum(l-1))> 0
        print(ans)

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
INF = float("inf")

# Binary Indexed Tree
class BIT:
    def __init__(self, N):
        self.N = N
        self.bit = [0] * (N+1)
    def add(self, x, a):
        while x <= self.N:
            self.bit[x] += a
            x += x & -x
    def sum(self, x):
        ret = 0
        while x != 0:
            ret += self.bit[x]
            x -= x & -x
        return ret

N = int(input())
S = list(input())
Q = int(input())
bit = [BIT(N) for i in range(26)]
for i in range(N):s
    bit[ord(S[i])-97].add(i+1, 1)
for i in range(Q):
    q, x, y = input().split()
    q = int(q)
    if q == 1:
        i = int(x)-1
        bit[ord(S[i])-97].add(i+1, -1)
        S[i] = y
        bit[ord(y)-97].add(i+1, 1)
    else:
        l, r, ans = int(x), int(y), 0
        for i in range(26):
            ans += (bit[i].sum(r)-bit[i].sum(l-1))> 0
        print(ans)
Problem p02769 (python)

Fixed submission:
N=2*10**5+1
mod=10**9+7
f=[None]*N
fi=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(N):
  fi[i]=pow(f[i],mod-2,mod)
def com(n,k):
  return f[n]*fi[n-k]%mod*fi[k]%mod
def hcom(n,k):
  return com(n+k-1,n-1)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k+1,n)):
  ans=(ans+com(n,i)*hcom(n-i,i)%mod)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
N=2*10**5+1
mod=10**9+7
f=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(1,N):
  fi[i]=pow(f[i],mod-2,mod)
def com(n,k):
  return f[n]*fi[n-k]%mod*fi[k]%mod
def hcom(n,k):
  return com(n+k-1,n-1)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k,n)):
  ans=(ans+com(n,i)*hcom(n-i,i)%mod)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
N=2*10**5+2
mod=10**9+7
f=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(1,N):
  fi[i]=pow(f[i],mod-2,mod)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k,n)):
  ans+=f[n]*fi[k]%mod*fi[k]%mod*f[n+1]*%mod*fi[i-1]%mod
  ans%=mod
print(ans)

Buggy submission (verdict: Runtime Error):
N=2*10**5+1
mod=10**9+7
f=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(1,N):
  fi[i]=pow(f[i],mod-2,mod)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k,n)):
  ans+=f[n]*fi[k]%mod*fi[k]%mod*f[n+1]*%mod*fi[i-1]%mod
  ans%=mod
print(ans)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy submission (verdict: Runtime Error):
s,t=input().split
a,b=map(int,input().split())
u=input()
if s==u:
  print(b)
else:
  print(a)
Problem p02781 (python)

Fixed submission:
N = [int(x) for x in input()]
K = int(input())
dp = [[[0]*2 for j in range(K+1)] for i in range(len(N)+1)]
dp[0][0][1] = 1
for i in range(len(N)):
    dp[i+1][0][0] = 1
    if N[i] == 0:
        for k in range(1, K+1):
            dp[i+1][k][0] = dp[i][k][0]+dp[i][k-1][0]*9
            dp[i+1][k][1] = dp[i][k][1]
    else:
        for k in range(1, K+1):
            dp[i+1][k][0] = dp[i][k][0]+dp[i][k-1][0]*9+dp[i][k-1][1]*(N[i]-1)+dp[i][k][1]
        for k in range(K-1, -1, -1):
            if dp[i][k][1]:
                dp[i+1][k+1][1] = dp[i][k][1]
                break
print(dp[len(N)][K][0]+dp[len(N)][K][1])

Buggy submission (verdict: Runtime Error):
import sys
# sys.setrecursionlimit(1000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
mod = 998244353

N = [int(x) for x in input()]
K = int(input())
dp = [[[0]*2 for j in range(K+1)] for i in range(len(N)+1)]
dp[0][0][1] = 1
for i in range(len(N)):
    dp[i+1][0][0] = 1
    if N[i] == 0:
        for k in range(1, K+1):
            dp[i+1][k][0] = dp[i][k][0]+dp[i][k-1][0]*9
            dp[i+1][k][1] = dp[i][k][1]
    else:
        for k in range(1, K+1):
            dp[i+1][k][0] = dp[i][k][0]+dp[i][k-1][0]*9+dp[i][k-1][1]*(N[i]-1)+dp[i][k][1]
        for k in range(K-1, -1, -1):
            if dp[i][k][1]:
                print(i, k, N[i])
                dp[i+1][k+1][1] = dp[i][k][1]
                break
print(dp)
print(dp[len(N)][K][0]+dp[len(N)][K][1])
Problem p03015 (python)

Fixed submission:
import sys
def input():
    return sys.stdin.readline()[:-1]
from collections import *
from math import atan2, pi
from bisect import *
mod = 10**9+7

L = input()
N = len(L)
dp = [0] * N
dp[0] = 1
T = 2
for i in range(1, N):
    if L[i] == '1':
        dp[i] = (dp[i-1] * 3 + T) % mod
        T = T * 2 % mod
    else:
        dp[i] = dp[i-1] * 3 % mod
print((dp[-1] + T) % mod)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
MOD = 10**9 + 7
exist = [1 for _ in range(N+2)]
for _ in range(M):
    exist[int(input())] = 0
dp = [0 for _ in range(N+2)]
dp[0] = 1
for i in range(N):
    dp[i+1] = (dp[i+1] + dp[i] * exist[i+1]) % MOD
    dp[i+2] = (dp[i+2] + dp[i] * exist[i+2]) % MOD
print(dp[N])
Problem p03137 (python)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
if N >= M:
    print(0)
else:
    X = sorted(X)
    L = []
    for i in range(0, M-1):
        L.append(X[i+1] - X[i])
    L = sorted(L, reverse = True)
    S = 0
    for i in range(N-1):
        S += L[i]
    res = X[M-1] - X[0] - S
    print(res)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
if N >= M:
  	print(0)
else:
	X = list(map(int, input().split()))
	X = sorted(X)
	L = []
	for i in range(0, M-1):
    	L.append(X[i+1] - X[i])
	L = sorted(L, reverse = True)
	S = 0
	for i in range(N-1):
    	S += L[i]
	res = X[M-1] - X[0] - S
	print(res)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
X = sorted(X)
L = []
for i in range(0, M-1):
    L.append(X[i+1] - X[i])
L = sorted(L, reverse = True)
S = 0
for i in range(N-1):
    S += L[i]
res = X[M-1] - X[0] - S
print(res)
Problem p03250 (python)

Fixed submission:
lst = list(map(int, input().split()))
print(max(lst)*10+sum(lst)-max(lst))

Buggy submission (verdict: Runtime Error):
in = list(map(int, input().split()))
print(max(in)*10+sum(in)-max(in))
Problem p03252 (python)

Fixed submission:
from collections import defaultdict
s = input()
t = input()
dic = defaultdict(lambda : None)
revdic = defaultdict(lambda : None)
for x, y in zip(s, t):
    if dic[x] == None and revdic[y] == None:
        dic[x] = y
        revdic[y] = x
    elif dic[x] != y or revdic[y] != x:
        print('No')
        quit()
print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
dic = defaultdict(set)
for x, y in zip(s, t):
  if x != y:
    dic[x].add(y)
    dic[y].add(x)
f = True
for key in dic:
  if len(dic[key]) > 1:
    print("No")
  	f = False
if f:
  print("Yes")
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100001)
def input():
    return sys.stdin.readline()[:-1]
from heapq import *

INF = 10 ** 20
def dijkstra(s, edges):
    dist = [INF for _ in range(len(edges))]
    dist[s], h = 0, []
    heappush(h, (0, s))
    while (len(h)):
        dv, v = heappop(h)
        if dv > dist[v]:
            continue
        for u, cost in edges[v]:
            if dv + cost < dist[u]:
                dist[u] = dv + cost
                heappush(h, (dist[u], u))
    return dist

N = int(input())
es = [[] for i in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    es[a].append((b, c))
    es[b].append((a, c))
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(Q)]
dist = dijkstra(K, es)
for i in range(Q):
    print(dist[xy[i][0]] + dist[xy[i][1]])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100001)
def input():
    return sys.stdin.readline()[:-1]
from heapq import *

def dfs(s, es):
    dist = [None] * len(es)
    dist[s] = 0
    def ret(v, d):
        for u, c in es[v]:
            if dist[u] == None:
                dist[u] = dist[v] + c
                ret(u, dist[u])
    ret(s, 0)
    return dist

N = int(input())
es = [[] for i in range(N+1)]
for i in range(N-1):
    a, b, c = map(int, input().split())
    es[a].append((b, c))
    es[b].append((a, c))
Q, K = map(int, input().split())
xy = [list(map(int, input().split())) for i in range(Q)]
dist = dfs(K, es)
for i in range(Q):
    print(dist[xy[i][0]] + dist[xy[i][1]])
Problem p03774 (python)

Fixed submission:
n,m=map(int,input().split())
a_b=[list(map(int,input().split())) for _ in range(n)]
c_d=[list(map(int,input().split())) for _ in range(m)]
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(1,m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      res=j+1
  print(res)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a_b=[list(map(int,input().split()) for _ in range(n)]
c_d=sorted([list(map(int,input().split()) for _ in range(m)])
for i in range(n):
  res=1
  d=abs(a_b[i][0]-c_d[0][0])+abs(a_b[i][1]-c_d[0][1])
  for j in range(m):
    t=abs(a_b[i][0]-c_d[j][0])+abs(a_b[i][1]-c_d[j][1])
    if t<d:
      d=t
      res=j+1
  print(res)
Problem p03804 (python)

Fixed submission:
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
flag = False
for i in range(0, N - M + 1):
  for j in range(0, N - M + 1):
    if B == [x[j:j+M] for x in A[i:i+M]]:
      flag = True
    if flag:
      break
  if flag:
    break
if flag:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
for i in range(0, M - N):
  for j in range(0, M - N):
    if A == B[i:i+N+1][j:j+N+1]:
      flag = True
    if flag:
      break
  if flag:
    break
if flag:
  print("Yes")
else:
  print("No")
Problem p02570 (python)

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

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

ans=[]
ans.append(len(b))
for i in range(len(a)-len(b)+1):
    dif=0
    k=a.find(b[i])
    for j in range(len(b)):
        if a[i+j]!=b[j]:
            dif+=1
            ans.append(dif)
print(min(ans))
Problem p02577 (python)

Fixed submission:
n=int(input())
s=str(n)
array = list(map(int,s))
if sum(array)%9==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=str(n)
array = list(map(int,s))
if array%9==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
str(n)
array = list(map(int,s))
if array%9==0:
    print("Yes")
else:
    print("No")
Problem p02570 (python)

Fixed submission:
nums=input().split()
t=int(nums[0])/int(nums[2])
if t<=int(nums[1]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
nums=input().split()
t=int(nums[1])/int(nums[3])
if t<=int(nums[2]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
nums=input().split()
t=int(nums[1])/int(nums[3])
if t<int(nums[2]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
nums=input().split()
t=int(nums[1])/int(nums[2])
if t<int(nums[3]):
  print("Yes")
else:
  print("No")
Problem p02688 (python)

Fixed submission:
init=input().split()
num=int(init[0])
snacks=int(init[1])
check=[]
 
for i in range(snacks):
  sNum=int(input())
  if sNum>1:
    whos=input().split()
    for j in range(sNum):
      check.append(whos[j])
  else:
    who=input()
    check.append(who)
   
count=0
for i in range(1,num+1):
  if str(i) not in check:
    count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
init=input().split()
num=init[0]
snacks=init[1]
ceck=[]
for i in range(snacks):
  sNum=input()
  if sNum>1:
    whos=input().split()
    for j in range(sNum):
      check.append()=whos[j]
  else:
    who=input()
    check.append()=who

for i in range(num):
  if not str(num[i]) in check:
    print(num)
Problem p02659 (python)

Fixed submission:
from fractions import Fraction
a, b = input().split()
A = int(a)
B = Fraction(b)
ans = A*B
ans = ans // 1
print(int(ans))

Buggy submission (verdict: Runtime Error):
from fractions import Fraction
a, b = input().split()
b = Fraction(b)
ans = Fraction(a*b)
ans = ans // 1
print(int(ans))
Problem p02689 (python)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
x=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  x[a].append(h[b-1])
  x[b].append(h[a-1])
count=0
for j in range(1,n+1):
  if x[j]==[]:
    count+=1
  else:
    if h[j-1]>max(x[j]):
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
h=list(map(int,input().split()))
x=[[] for _ in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  x[a].append(h[b-1])
  x[b].append(h[a-1])
count=0
for j in range(1,n+1):
  if x[j]==[]:
    count+=1
  else:
    if h[j-1]>max(x[j]):
      count+=1
print(count)