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

Fixed submission:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(300000)

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(X: int):
    if X >= 30:
        ret = YES
    else:
        ret = NO
    print(ret)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

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

Fixed submission:
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(A: int, B: float):
    s = int(B[0]) * 100
    x = int(B[2:])
    #ret = (B * 100 * A) // 100
    ret = ((s + x) * A) // 100
    print(int(ret))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = str(next(tokens))  # type: float
    solve(A, B)

if __name__ == '__main__':
    main()

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

import sys
sys.setrecursionlimit(300000)


def solve(A: int, B: float):
    s = B[0] * 100
    x = int(B[2:])
    #ret = (B * 100 * A) // 100
    ret = ((s + x) * A) // 100
    print(int(ret))
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = str(next(tokens))  # type: float
    solve(A, B)

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

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

def solve(H: int, W: int, A: "List[str]"):
    used = [[False] * W for _ in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, -1, 0, 1]
    s = set()
    for i in range(H):
        for j in range(W):
            if A[i][j] == '#':
                s.add((i, j))
                used[i][j] = True

    ret = 0
    while True:
        nex = set()
        for x, y in s:
            for j in range(4):
                tx = x + dx[j]
                ty = y + dy[j]
                if 0 <= tx < H and 0 <= ty < W and not used[tx][ty]:
                    nex.add((tx, ty))
                    used[tx][ty] = True
        if len(nex) < 1:
            break
        s = nex
        ret += 1

    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [next(tokens) for _ in range(H) ]  # type: "List[str]"
    solve(H, W, A)

if __name__ == '__main__':
    main()

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

INF = float('inf')

def solve(H: int, W: int, A: "List[str]"):
    #corner = [H + W] * 4
    #for i in range(H):
    #    for j in range(W):
    #        if A[i][j] == '#':
    #            corner[0] = min(corner[0], abs(i - 0) + abs(j - 0))
    #            corner[1] = min(corner[1], abs(i - 0) + abs(j - (W - 1)))
    #            corner[2] = min(corner[2], abs(i - (H - 1)) + abs(j - 0))
    #            corner[3] = min(corner[3], abs(i - (H - 1)) + abs(j - (W - 1)))

    count = [[INF] * (W + 2) for _ in range(H + 2)]
    for i in range(H):
        for j in range(W):
            if A[i][j] == '#':
                count[i + 1][j + 1] = 0
            else:
                count[i + 1][j + 1] = min(count[i][j + 1], count[i + 1][j]) + 1

    #pprint(count)
    ret = 0
    for i in range(H, 0, -1):
        for j in range(W, 0, -1):
            count[i][j] = min(count[i][j], min(count[i][j + 1], count[i + 1][j]) + 1)
            ret = max(ret, count[i][j])
    #pprint(count)
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [ next(tokens) for _ in range(W) ]  # type: "List[str]"
    solve(H, W, A)

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

Fixed submission:
s,t = input().split()
ans = [int(i) for i in input().split()]
m = input()
if m == s:
  ans[0] -= 1
elif m == t:
  ans[1] -= 1
print(ans[0],ans[1])

Buggy submission (verdict: Runtime Error):
s,t = input().split()
ans = map(int,input().split())
m = input()
if m == s:
  ans[0] -= 1
elif m == t:
  ans[1] -= 1
print(ans[0],ans[1])
Problem p02933 (python)

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

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

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

change = s[k-1].lower()
print(s[:k-1] + change + s[k:])

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

change = s[k-1].lower()
print(s[:k] + change + s[k+1:])
Problem p03075 (python)

Fixed submission:
data = [int(input()) for i in range(6)]
print('Yay!' if data[-2] - data[0] <= data[-1] else ':(')

Buggy submission (verdict: Runtime Error):
data = [int(input()) for i in range(6)]
print('Yay!' if data[-2] - data[0] =< data[-1] else ':(')

Buggy submission (verdict: Runtime Error):

data = [int(input()) for i in range(6)]
print('Yay!' if data[-2] - data[0] =< data[-1] else ':(')
Problem p03272 (python)

Fixed submission:
n, i = [int(_) for _ in input().split()]
print(n - i + 1)

Buggy submission (verdict: Runtime Error):
    n, i = map(int, input().split())
    print(n - i + 1)
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
len = input()
print(len**3)

Buggy submission (verdict: Runtime Error):
len = input()
print(len**3)
Problem p02754 (python)

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

ans = N //(A+B) *A
rem = N % (A+B)
ans += min(rem,A)
print(ans)

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

ans = N //(A+B) *A
rem = N % (A+B)
ans += min(rem,A)
print(ans)
Problem p02773 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
dictionary = {}
for word in S:
    if word in dictionary:
        dictionary[word] += 1
    else:
        dictionary[word] = 1

maximum = max(dictionary.values())
for key, value in sorted(dictionary.items()):
    if value == maximum:
        print(key)

Buggy submission (verdict: Runtime Error):
import  collections 
N = int(input())
list_a = [input() for i in range(N)]
dict_a = collections.Counter(list_a)


list_ans = []

list_ans.append(dict_a.most_common()[0][0])
while True:
    if dict_a.most_common()[0][1] == dict_a.most_common()[i][1]:
        list_ans.append(dict_a.most_common()[i][0])
    else:
            break

list_ans.sort()
for i in range (0,len(list_ans)):
    print(list_ans[i])
Problem p02785 (python)

Fixed submission:
a,b = map(int,input().split())
c = list(map(int,input().split()))
if len(c) <= b:
    b = len(c) 
c.sort(reverse=True)
for i in range(0,b):
    c[i] = 0
print(sum(c))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = list(map(int,input().split()))
c.sort(reverse=True)
for i in range(0,b):
    c[i] = 0
print(sum(c))
Problem p02819 (python)

Fixed submission:
X = int(input())

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_list = primes(100100)

for i in prime_list:
    if X <= i:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
N = int(input())
print(nextprime(N-1))
Problem p02897 (python)

Fixed submission:
number = int(input())

count = 0
for i in range (1,number+1):
    if i % 2 == 1:
        count += 1
answer = count / number
print(answer)

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

count = 0
r = math.gcd(a,b)
for i in range (1,r+1):
    if r % i == 0 :
        count += 1
print(count)
Problem p02594 (python)

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

Buggy submission (verdict: Runtime Error):
M,N = map(int, input().split())
count = 0
for _ in range(M):
    a, b = map(int, input().split())
    X = a*a + b*b
    if X <= N*N:
        count += 1
 
print(count)

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

a=0

for i in range(n):
  x,y=map(int, input().split())
  if x**2 + y**2 <= d**2:
    a+=1
    
print(a)

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

A = 0

for i in range(N):
  X,Y = map(int, input().split())
  
for g in range(N):
  if X**2 + Y**2 <= D**2:
    A += 1
    
print(A)
Problem p02793 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7
def gcd(x,y):
    if x<y:x,y=y,x
    if y==0:return x
    return gcd(y,x%y)
a = 1
for i in range(N):
    a = a*A[i]//gcd(a,A[i])
ans = 0
for i in range(N):
    ans+= a//A[i]
print(ans%mod)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
mod = 10**9+7

def gcd(x,y):
    if x<y:x,y=y,x
    if y==0:return x
    return gcd(y,x%y)
S = [A[1]//gcd(A[0],A[1]),A[0]//gcd(A[0],A[1])]
for i in range(2,N):
    a = A[i-1]*S[i-1]
    b = A[i]*a//gcd(A[i],a)
    c = b//a
    S = list(map(lambda x:x*c,S))
    S.append(b//A[i])
print(sum(S)%mod)
Problem p02925 (python)

Fixed submission:
import time
start = time.time()
N = int(input())
A = [list(map(lambda x:int(x)-1,input().split())) for i in range(N)]
B = [0]*N
S = 0
ans = 0
while True:
    C = [0]*N
    for n in range(N):
        if C[n]==0 and B[n]!=N-1:
            b = A[n][B[n]]
            if C[b]==1: continue
            if A[b][B[b]]==n:
                B[n]+=1
                B[b]+=1
                C[n],C[b]=1,1
    if sum(C)==0:break
    ans +=1
    if time.time()-start>1.7:
        print(N*(N-1)//2)
        exit()
print(ans if sum(B)==N*(N-1) else -1)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]
ans = 0
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
import math
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]
ans = 0
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
D.sort(key=lambda x:abs(x[0])+abs(x[1]))
x,y,k = 0,0,0
for d in D:
    if k<(x+d[0])**2+(y+d[1])**2:
        x+=d[0]
        y+=d[1]
        k = x*x+y*y
ans = max(ans,k)
x,y,k = 0,0,0
for d in D:
    if k<=(x+d[0])**2+(y+d[1])**2:
        x+=d[0]
        y+=d[1]
        k = x*x+y*y
ans = max(ans,k)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]
ans = 0
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
import math
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]
ans = 0
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]>=0 and d[1]<=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
x,y = 0,0
for d in D:
    if d[0]<=0 and d[1]>=0:
        x+=d[0]
        y+=d[1]
ans = max(ans,x*x+y*y)
D.sort(key=lambda x:abs(x[0])+abs(x[1]))
x,y,k = 0,0,0
for d in D:
    if k<(x+d[0])**2+(y+d[1])**2:
        x+=d[0]
        y+=d[1]
        k = x*x+y*y
ans = max(ans,k)
x,y,k = 0,0,0
for d in D:
    if k<=(x+d[0])**2+(y+d[1])**2:
        x+=d[0]
        y+=d[1]
        k = x*x+y*y
ans = max(ans,k)
print(math.sqrt(ans))
Problem p03011 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
print(sum(a[:2]))

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
x = 0
y = 1
for i in range(N):
  if i+1 in a:
    z = 0
  else:
    z = x + y
  x,y = y,z  
print(z%MOD)
Problem p03013 (python)

Fixed submission:
import bisect
def f(x,a):
  global M
  b = bisect.bisect_left(a,x)
  if x==a[min(b,M)]:
    return True
  else:
    return False
MOD = 10**9+7
N,M = map(int,input().split())
a = [-1]+[int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  global N,M
  if M==0:
    return False
  b = bisect.bisect_left(a,x)
  return True if x==a[min(b,N)] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  global N,M
  if M==0:
    return False
  b = bisect.bisect_left(a,x)
  return True if x==a[mi  n(b,N)] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  global N,M
  if M==0:
    return False
  b = bisect.bisect_left(a,x)
  return True if x==a[mi
  n(b,N)] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  global N
  b = bisect.bisect_left(a,x)
  return True if x==a[min(b,N)] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  b = bisect.bisect_right(a,x)
  return True if x==a[max(0,b-1)] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)

Buggy submission (verdict: Runtime Error):
import bisect
def f(x,a):
  b = bisect.bisect_left(a,x)
  return True if x==a[b] else False
MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)
Problem p03045 (python)

Fixed submission:
N,M = map(int,input().split())
p = [i for i in range(N)]#parent
g = [[i] for i in range(N)]#group
for _ in range(M):
  x,y,z = map(int,input().split())
  x,y = p[x-1],p[y-1]
  if x==y:
    continue
  if len(g[x])<len(g[y]):
    x,y = y,x
  g[x] += g[y]
  for z in g[y]:
    p[z] = x
  g[y] = []
print(len(set(p)))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
#count chain node
cou_cha = [1 for i in range(N)]
cha_node = [[i]for i in range(N)]
for _ in range(M):
  x,y,z = map(int,input().split())
  cou_cha[x-1]+=1
  cou_cha[y-1]+=1
  cha_node[x-1].append(y-1)
  cha_node[y-1].append(x-1)
ans = cou_cha.count(1)
def f(x):
  global cou_cha,cha_node
  if cou_cha[x]==1:
    return
  cou_cha[x]=1
  for chi in cha_node[x]:
    f(chi)
while cou_cha.count(1)!=N:
  ans+=1
  f(cou_cha.index(max(cou_cha)))

print(ans)
Problem p03053 (python)

Fixed submission:
H,W = map(int,input().split())
A = [list(input()) for i in range(H)]
S = [[0]*W for i in range(H)]
for h in range(H):
    for w in range(W):
        if A[h][w]=="#":
            S[h][w] = H*W
for h in range(H):
    a = 0
    for w in range(W):
        S[h][w] = max(a,S[h][w])
        a = max(a,S[h][w])-1
    for w in range(W)[::-1]:
        S[h][w] = max(a,S[h][w])
        a = max(a,S[h][w])-1
for w in range(W):
    a = 0
    for h in range(H):
        S[h][w] = max(a,S[h][w])
        a = max(a,S[h][w])-1
    for h in range(H)[::-1]:
        S[h][w] = max(a,S[h][w])
        a = max(a,S[h][w])-1
ans = H*W
for h in range(H):
    for w in range(W):
        ans = min(ans,S[h][w])
print(H*W-ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
A = []
for i in range(H):
  a = list(input())
  A.append(a)
def f(h,w):
  global H,W,A
  res = 0
  for i in range(H*W):
    for x in range(-i,i+1):
      for y in range(-i,i+1):
        if abs(x)+abs(y)>i:
          continue
        hx,wx = h+x,w+y
        if hx<0 or H<=hx or wx<0 or W<=wx:
          continue
        if A[hx][wx]=='#':
          res = i
          break
      if res>0:
        break
    if res>0:
      break
  return res
ans = []
for h in range(H):
  for w in range(W):
    if A[h][w]=='.':
      ans.append(f(h,w))
print(max(ans))

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
A = []
B_place = []
for i in range(H):
  a = list(input())
  for w in range(W):
    if a[w]=="#":
      B_place.append([i,w])
  A.append(a)

all_map = [[10**10 for i in range(W)] for i in range(H)]
def f(h,w,cou):
  global H,W,all_map
  if h<0 or H<=h or w<0 or W<=w:
    return
  if cou>=all_map[h][w]:
    return
  else:
    all_map[h][w]=cou
  f(h-1,w,cou+1)
  f(h+1,w,cou+1)
  f(h,w-1,cou+1)
  f(h,w+1,cou+1)

for B in B_place:
  f(B[0],B[1],0)

ans = 0
for i in range(H):
  ans = max(ans,max(all_map[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())
A = []
for i in range(H):
  a = list(input())
  A.append(a)

ans = 0
def f(h,w,count):
  global H,W,cou,B
  if h<0 or H<=h or w<0 or W<=w:
    return
  if A[h][w]=="#":
    cou = min(cou,count)
    k = 1
    return
  if B[h][w]>count:
    B[h][w]=count
  else:
    return
  f(h-1,w,count+1)
  f(h+1,w,count+1)
  f(h,w-1,count+1)
  f(h,w+1,count+1)
def return_map():
  B = [[10**10 for i in range(W)] for i in range(H)]
  return B
for x in range(H):
  for y in range(W):
    B = return_map()
    cou = 10**10
    f(x,y,0)
    ans = max(ans,cou)
print(ans)
Problem p03127 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
a.sort()
for i in range(n-1):
    mina = min(mina,gcd(a[i],a[i+1]))
print(mina)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
a.sort()
for i in range(n-1):
    mina = min(mina,math.gcd(a[i],a[i+1]))
print(mina)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
a.sort()
for i in range(n-1):
    mina = min(mina,math.gcd(a[i],a[i+1]))
print(mina)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
for i in range(n-1):
    mina = min(mina,math.gcd(a[i],a[i+1]))
print(mina)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))
mina = max(a)
for i in range(n-1):
    mina = min(mina,math.gcd(a[i],a[i+1]))
print(mina)
Problem p03221 (python)

Fixed submission:
N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5+1)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
for i in range(N+1):
  arr[i].sort()
for i in range(M):
  #二部探索
  left = 0
  right = len(arr[P[i]])-1
  while left <= right:
    mid = (left+right)//2
    if arr[P[i]][mid] == Y[i]:
      k = mid
      break
    elif arr[P[i]][mid] > Y[i]:
      right = mid-1
    else:
      left = mid+1
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
  arr[listA[0]].sort()
for i in range(M):
  num = Y[i]
  for k in range(M):
    if arr[P[i]][k] == Y[i]:
      break
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
P = []
Y = []
arr = [[]for j in range(10**5)]
for i in range(M):
  listA = list(map(int,input().split()))
  P.append(listA[0])
  Y.append(listA[1])
  arr[listA[0]].append(listA[1])
  arr[listA[0]].sort()
for i in range(M):
  num = Y[i]
  for k in range(M):
    if arr[P[i]][k] == Y[i]:
      break
  print(str(P[i]).rjust(6,'0')+str(k+1).rjust(6,'0'))
print(arr)