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

Fixed submission:
def gcd(x,y):
    while y != 0:
        x,y = y, x%y
    return x

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

def div_num(a,x,y):
    return a//x + a//y - a//lcm(x,y)

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

ans = (b-a+1) - ( div_num(b,c,d) - div_num((a-1),c,d) )

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def div_num(a,x,y):
    return (a//x + a//y - a//lcm(x,y))

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

ans = (b-a+1) - ( div_num(b,c,d) - div_num((a-1),c,d) )

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def div_num(a,x,y):
    return a//x + a//y - a//lcm(x,y)

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

ans = (b-a+1) - ( div_num(b,c,d) - div_num((a-1),c,d) )

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def div_num(a,x,y):
    return a//x + a//y - a//lcm(x,y)

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

ans = (b-a+1) - ( div_num(b,c,d) - div_num(a-1,c,d) )

print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

def div_num(a,x,y):
    return a//x + a//y - a//lcm(x,y)

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

ans = (b-a+1) - ( div_num(b,c,d) - div_num(a-1,c,d) )

print(ans)
Problem p03061 (python)

Fixed submission:
def GCD(x, y): 
    while(y): 
       x, y = y, x % y 
    return x

n = int( input() )
a = list( map( int, input().split() ) )
left = [0]*n
right = [0]*n

left[0] = a[0]
for i in range(1,n):
    left[i] = GCD(left[i-1], a[i])

right[-1] = a[-1]
for i in range(2,n+1):
    right[-i] = GCD(right[-i+1], a[-i])

max_gcd = 0
for i in range(n):
    if i == 0 and max_gcd < right[1]:
        max_gcd = right[1]
    elif i == n-1 and max_gcd < left[n-2]:
        max_gcd = left[n-2]
    if i >= 1 and i <= n-2 and max_gcd < GCD( left[i-1], right[i+1]):
        max_gcd = GCD( left[i-1], right[i+1])

print(max_gcd)

Buggy submission (verdict: Runtime Error):
from math import gcd

n = int( input() )
a = list( map( int, input().split() ) )
left = [0]*n
right = [0]*n

left[0] = a[0]
for i in range(1,n):
    left[i] = gcd(left[i-1], a[i])

right[-1] = a[-1]
for i in range(2,n+1):
    right[-i] = gcd(right[-i+1], a[-i])

max_gcd = 0
for i in range(n):
    if i == 0 and max_gcd < right[1]:
        max_gcd = right[1]
    elif i == n-1 and max_gcd < left[n-2]:
        max_gcd = left[n-2]
    if i >= 1 and i <= n-2 and max_gcd < gcd( left[i-1], right[i+1]):
        max_gcd = gcd( left[i-1], right[i+1])

print(max_gcd)
Problem p03087 (python)

Fixed submission:
n,q = map( int, input().split() )
s = input()
lr = []
for i in range(q):
    lr.append(list( map( int, input().split() ) ) )

exist = [0]*n
for i in range(1,n):
    if s[i-1:i+1] == 'AC':
        exist[i] = exist[i-1]+1
    else:
        exist[i] = exist[i-1]

for i in range(q):
    print(exist[lr[i][1]-1]-exist[lr[i][0]-1])

Buggy submission (verdict: Runtime Error):
n,q = map( int, input().split() )
s = input()
lr = []
for i in range(q):
    lr.append(list( map( int, input().split() ) ) )

exist = [0]*n
for i in range(1,n):
    if s[i-1:i+1] == 'AC':
        exist[i+1] = 1

for i in range(q):
    if lr[i][1] - lr[i][0] < 2:
        print(0)
    else:
        print(sum(exist[lr[i][0]-1:lr[i][1]]))
Problem p03488 (python)

Fixed submission:
def isReach( goal, move, is_x):
    msum = sum(move)
    m = len(move)

    if msum < abs(goal):
        return False

    dp = [[False for _ in range(msum*2+1)] for _ in range(m+1)]
    dp[0][0] = True
    
    for i in range(m):
        for j in range(-msum,msum+1):
            if i == 0 and dp[i][j] and is_x:
                dp[i+1][j+move[i]] = True
            elif dp[i][j]:
                dp[i+1][j-move[i]] = True
                dp[i+1][j+move[i]] = True
    
    return dp[m][goal]


s = list( input().split('T') )
x,y = map( int, input().split() )

move_dist = [len(move) for move in s]
x_move = move_dist[0::2]
y_move = move_dist[1::2]

if isReach(x,x_move,True) and isReach(y,y_move,False):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def isReach( goal, move ):
    msum = sum(move)
    m = len(move)
    dp = [[False]*(msum*2+2) for i in range(m+1)]
    dp[0][0] = True

    for i in range(m):
        for j in range(-msum,msum+1):
            if dp[i][j]:
                dp[i+1][j-move[i]] = True
                dp[i+1][j+move[i]] = True
    
    return dp[m][goal]

s = list( input().split('T') )
x,y = map( int, input().split() )

move_dist = [len(move) for move in s]
x_move = move_dist[0::2]
y_move = move_dist[1::2]

if isReach(x,x_move) and isReach(y,y_move):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def isReach( goal, move ):
    msum = sum(move)
    m = len(move)
    dp = [[False]*(msum*2+2) for i in range(m+1)]
    dp[0][0] = True

    for i in range(m):
        for j in range(-msum-1,msum+1):
            if dp[i][j]:
                dp[i+1][j-move[i]] = True
                dp[i+1][j+move[i]] = True
    
    return dp[m][goal]

s = list( input().split('T') )
x,y = map( int, input().split() )

move_dist = [len(move) for move in s]
x_move = move_dist[0::2]
y_move = move_dist[1::2]

if isReach(x,x_move) and isReach(y,y_move):
    print('Yes')
else:
    print('No')
Problem p02576 (python)

Fixed submission:
N, X, T = map(int, input().split())
 
print(T * ((N+(X-1))//X))

Buggy submission (verdict: Runtime Error):
N, X, T = map(int, input().split())
 
print(T * ((N//X + 1))
Problem p03160 (python)

Fixed submission:
n=int(input())
arr=[int(i) for i in input().split()]
dp=[0]*(n)
dp[0]=0
dp[1]=abs(arr[1]-arr[0])

for i in range(2,n):
    dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1],abs(arr[i]-arr[i-2])+dp[i-2])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,w=[int(i) for i in input().split()]
wi=[]
val=[]
for i in range(n):
    k=[int(i) for i in input().split()]
    wi.append(k[0])
    val.append(k[1])
dp=[[-1]*10**9]*105
def solve(pos,we):
    if we>w:
        return float("-inf")
    if pos>=n:
        return 0
    if dp[pos][we]!=-1:
        return dp[pos][we]
    ans=max(solve(pos+1,we+wi[pos])+val[pos],solve(pos+1,we))
    dp[pos][we]=ans
    return ans
print(solve(0,0))
Problem p02582 (python)

Fixed submission:
S = input()
if S=="SSS":
    print(0)
elif S =="SSR"or S == "SRS" or S == "RSS" or S == "RSR":
    print(1)
elif S =="RRS" or S == "SRR":
    print(2)
else:
    print(3)

Buggy submission (verdict: Runtime Error):
x,k,d=map(int,input().split())
p=k*d-x
q=p//(2*d)
r=p/(2*d)
if r<=0:
  print(-p)
elif 0<r<k:
  s=min(p-2*d*q,-p+2*d*(q+1))
  print(s)
Problem p02584 (python)

Fixed submission:
x,k,d=map(int,input().split())
p=k*d-x
q=p//(2*d)
r=p/(2*d)
if r<=0:
  print(-p)
elif 0<r<k:
  s=min(p-2*d*q,-p+2*d*(q+1))
  print(s)
else:
  print(-x-k*d)

Buggy submission (verdict: Runtime Error):
X = input()
K = input()
D = input()
x = int(X)
k = int(K)
d = int(D)
p = k*d-x
q = p//(2*d)
r = p/(2*d)
if r <= 0:
    print(-p)
elif 0 < r < k:
    s = min(p-2*d*q,-p+2*d*(q+1))
    print(s)
else:
    print(x+k*d)

Buggy submission (verdict: Runtime Error):
X = input("X:")
K = input("K:")
D = input("D:")
x = int(X)
k = int(K)
d = int(D)
p = k*d-x
q = p//(2*d)
r = p/(2*d)
if r <= 0:
    print(-p)
elif 0 < r < k:
    s = min(p-2*d*q,-p+2*d*(q+1))
    print(s)
else:
    print(x+k*d)

Buggy submission (verdict: Runtime Error):
X = input("X:")
K = input("K:")
D = input("D:")
x = int(X)
k = int(K)
d = int(D)
p = k*d-x
q = p//(2*d)
r = p/(2*d)
if r <= 0:
    print(-p)
elif 0 < r < k:
    s = min(p-2*d*q,-p+2*d*(q+1))
    print(s)
else:
    print(x+k*d)
Problem p02644 (python)

Fixed submission:
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from collections import deque
INF = float('inf')
 
 
def main():
    H, W, K = map(int, readline().split())
    x1, y1, x2, y2 = map(int, readline().split())
    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1
    C = read().split()
 
    dist = [[INF] * W for i in range(H)]
    dist[x1][y1] = 0
    d = deque([[x1, y1]])
    dxy = [[1, 0], [0, 1], [-1, 0], [0, -1]]
    while d:
        x, y = d.popleft()
        if (x, y) == (x2, y2):
            print(dist[x][y])
            quit()
        for dx, dy in dxy:
            xx = x
            yy = y
            for i in range(K):
                xx += dx;
                yy += dy
                if 0 <= xx < H and 0 <= yy < W and C[xx][yy] != '@':
                    if dist[xx][yy] <= dist[x][y]:
                        break
                    if dist[xx][yy] == INF:
                        d.append([xx, yy])
                    dist[xx][yy] = dist[x][y] + 1
                else:
                    break
 
    print(-1)
 
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    h, w, k = map(int, input().split())
    x1, y1, x2, y2 = map(int, input().split())
 
    # surround the square with '@'
    c = [['@'] * (w+2)]
    for _ in range(h):
        i = input()
        l = ['@']
        for j in i:
            l.append(j)
        l.append('@')
        c.append(l)
    c.append(['@'] * (w+2))
 
    # Dijkstra
    # seen[x][y] = the minimum cost of (x, y)
    # if seen[x][y] == -1, (x, y) is unresearched
    seen = [[-1] * (w+2) for _ in range(h+2)]
 
    # todo[i] == (cost, x, y, direction)
    todo = [(0, x1, y1, 0)]
    heapq.heapify(todo)
 
    # direction
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
 
    while len(todo) > 0:
        cost, xi, yi, direction = heapq.heappop(todo)
 
        # only straight
        if seen[xi][yi] != -1:
            if (seen[xi][yi]+k-1)//k * k > cost:
                xj, yj = xi + dx[direction], yi + dy[direction]
                if c[xj][yj] == '.':
                    heapq.heappush(todo, (cost+1, xj, yj, direction))
            continue
        seen[xi][yi] = cost
 
        # goal
        if xi == x2 and yi == y2:
            print((cost+k-1)//k)
            exit()
        
        # 4 directions
        for j in range(4):
            xj, yj = xi + dx[j], yi + dy[j]
            if c[xj][yj] == '.':
                if j == direction:
                    if seen[xj][yj] == -1 or (seen[xj][yj]+k-1)//k * k > cost:
                        heapq.heappush(todo, (cost+1, xj, yj, j))
                elif seen[xj][yj] == -1:
                    heapq.heappush(todo, ((cost+k-1)//k * k + 1, xj, yj, j))
 
    print(-1)
 
main()
Problem p02717 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(c,a,b)v
Problem p02741 (python)

Fixed submission:
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
x=int(input())
print(arr[x-1])

Buggy submission (verdict: Runtime Error):
arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
x=input()
print(arr[x-1])
Problem p02910 (python)

Fixed submission:
s = input()
ans = "Yes"
for i in range(len(s)):
  if ((i+1)%2==1 and s[i]=="L") or ((i+1)%2==0 and s[i]=="R"):
    ans = "No"
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = "Yes"
for i in len(s):
  if ((i+1)%2==1 and s[i]=="L") or ((i+1)%2==0 and s[i]=="R"):
    ans = "No"
    break
print(ans)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(a+b, a-b, a*b))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(a+b, a-b, a*b)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(a+b, a-b, a*b)
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
print(3*int(input)**2)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
b = a[:]
b.sort()

if b[n-1] == b[n-2]:
    for _ in range(n): 
        print(b[n-1])
else:
    for j in a:
        if j >= b[n-1]:
            print(b[n-2])
        else:
            print(b[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(N)]

for j in a:
    if j >= max(a):
        print(sorted(a)[-2])
    else:
        print(max(a))
Problem p02983 (python)

Fixed submission:
l,r=map(int,input().split())
ans = []

for n in range(l,r+1):
    for m in range(n+1,r+1):
        tmp = n*m%2019
        if tmp == 0:
            print(0)
            exit()
        ans.append(tmp)
print(min(ans))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
ans = []

l = l%2019
r = r%2019

for n in range(l,r+1):
    for m in range(n+1,r+1):
        tmp = n*m%2019
        if tmp == 0:
            print(0)
            exit()
        ans.append(tmp)
print(min(ans))
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
ans,d=1,0

for i in l:
  d+=i
  if d<=x:
    ans+=1
  else:
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
l=list(map(int,input().split()))
ans,d=0,0

while d<=x:
  ans+=1
  d+=l[ans-1]
print(ans)
Problem p03061 (python)

Fixed submission:
import fractions

n = int(input())
a = list(map(int,input().split()))
b = a[:]

for i in range(1,n):
    a[i] = fractions.gcd(a[i],a[i-1])
    b[n-i-1] = fractions.gcd(b[n-i-1],b[n-i])
a = [0]+a #左に0を追加
b = b+[0] #右に0を追加
print(max(fractions.gcd(a[i],b[i+1]) for i in range(n)))

Buggy submission (verdict: Runtime Error):
import fractions

N = int(input())
A = list(map(int,input().split()))
ans = 0
A = list(set(A))

for j in range(len(A)):
    B = A[:]
    B.pop(j)
    tmp = max(B)
    for i in B:
        tmp = fractions.gcd(tmp, i)
    if tmp > ans:
        ans = tmp
print(ans)
Problem p03087 (python)

Fixed submission:
n, q = map(int,input().split())
s = list(input())
t = [0]*(n)
j = 0
for j in range(n-1):
    if s[j]=="A" and s[j+1]=="C":
        t[j+1]=t[j]+1
    else:
        t[j+1]=t[j]
i = 0
for i in range(q):
    a,b = map(int,input().split())
    print((t[b-1])-(t[a-1]))

Buggy submission (verdict: Runtime Error):
n, q = map(int,input().split())
s = list(input())
t = [0]*(n+1)
j = 0
for j in range(n):
    if s[j]=="A" and s[j+1]=="C":
        t[j+1]=t[j]+1
    else:
        t[j+1]=t[j]
i = 0
for i in range(q):
    a,b = map(int,input().split())
    print((t[b-1])-(t[a-1]))
Problem p03101 (python)

Fixed submission:
H, W = map(int,input().split())
h, w = map(int,input().split())
print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
H, W = map(int(input().split()))
h, w = map(int(input().split()))
print((H-h)*(W-w))
Problem p03243 (python)

Fixed submission:
n = int(input())
print(n) if n%111 == 0 else print((n//111+1)*111)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n%111 = 0:
  print(n)
else:
  print((n//111+1)*111)
Problem p03288 (python)

Fixed submission:
a = int(input())
if a < 1200:
  print("ABC")
elif a < 2800:
  print("ARC")
else:
  print("AGC")

Buggy submission (verdict: Runtime Error):
r = int(input())
if a < 1200:
  print("ABC")
elif a < 2800:
  print("ARC")
else:
  print("AGC")
Problem p03416 (python)

Fixed submission:
a,b = map(int,input().split())
ans = 0
for i in range(a,b+1):
  j = str(i)[::-1]
  if i == int(j):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int(input().split()))
ans = 0
for i in range(a,b+1):
  j = str(i)[::-1]
  if i == int(j):
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
ans = 0
for i in range(a,b+1):
  j = str(i)[::-1]
  if i == int(j):
    ans += 1
print(ans)
Problem p03456 (python)

Fixed submission:
a,b = input().split()
n = int(a+b)

print("Yes") if (n**0.5).is_integer() else print("No")

Buggy submission (verdict: Runtime Error):
a,b = input()
n = int(a+b)

print("Yes") if (n**0.5).is_integer() else print("No")
Problem p03470 (python)

Fixed submission:
n = int(input())
d = [int(input()) for _ in range(n)]
print(len(list(set(d))))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for _ in range(n)]
print(count(list(set(d))))
Problem p03502 (python)

Fixed submission:
n = input()
m = [int(c) for c in n]
print("No") if int(n)%sum(m) else print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
m = [int(c) for c in n]
print("No") if n%sum(m) else print("Yes")
Problem p03624 (python)

Fixed submission:
s = list(set(list(input())))
a = list("abcdefghijklmnopqrstuvwxyz")
for c in s:
  a.remove(c)
print(a[0]) if len(a)>0 else print("None")

Buggy submission (verdict: Runtime Error):
s = list(set(list(input())))
a = list("abcdefghijklmnopqrstuvwxyz")
for c in s:
  a.remove(c)
print(a[0])

Buggy submission (verdict: Runtime Error):
s = list(input()).set
a = "abcdefghijklmnopqrstuvwxyz"
for c in s:
  a.remove(c)
print(a[0])
Problem p03773 (python)

Fixed submission:
a,b = map(int,input().split())
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
print((a+b)%24)
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()
x=before=0

for i in s:
  if i == "I":
    x += 1
    if before < x:
      before = x
  else:
    x -= 1
print(before)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
x=before=0

for i in s:
  if i == "I":
    x += 1
    if before < x:
      before = x
  else:
    x -= 1
print(berofe)
Problem p03845 (python)

Fixed submission:
n = input()
t = list(map(int,input().split()))
m = int(input())
s = sum(t)

for i in range(m):
  p,x = map(int,input().split())
  print(s-t[p-1]+x)

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

for i in range(m):
  p,x = map(int,input().split())
  print(s-t[p+1]+x)
Problem p02576 (python)

Fixed submission:
def multiplier(N,maxx,time):
  if N%maxx==0 :
    return N//maxx
  else :
    return N//maxx+1
  
def main():
	N,maxx,time = map(int, input().split())
	if N!=0 :
		ans = time * multiplier(N,maxx,time)
	else:
		ans=0  
	print(ans)
    
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
N,maxx,time = map(int, input.split())
if (N!= 0):
	ans = time*(N //maxx + 1)
else :
	ans=0  
print(ans)

Buggy submission (verdict: Runtime Error):
N, maxx, time = map(int, input.split())
ans = time * (N //maxx + 1)
if(N != 0): 
  	print(ans)
else 
	print("0")
Problem p03071 (python)

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

for i in range(2):
    if A > B:
        sum = A + sum
        A = A - 1
    else:
        sum = B + sum
        B = B -1 

print(sum)

Buggy submission (verdict: Runtime Error):
A = input()
A = int(A)
B = input()
B = int(B)
sum = 0

for i in range(2):
    if A > B:
        sum = A + sum
        A = A - 1
    else:
        sum = B + sum
        B = B -1 

print(sum)

Buggy submission (verdict: Runtime Error):
A = input('A = ')
A = int(A)
B = input('B = ')
B = int(B)
sum = 0

for i in range(2):
    if A > B:
        sum = A + sum
        A = A - 1
    else:
        sum = B + sum
        B = B -1 

print(sum)
Problem p03136 (python)

Fixed submission:
N=int(input())
a=input().split()
for i in range(N):
  a[i]=int(a[i])
a.sort()
sum=0
m=len(a)-1
for i in range(m):
  sum+=a[i]
  
if sum>a[len(a)-1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=input()
a=sort(list(map(int, input().split())))
sum=0
for i in range(len(a)-1):
  sum+=a[i]
  
if sum>a(len(a)-1):
  Yes
else:
  No
Problem p02765 (python)

Fixed submission:
x, y = map(int, input().split())
if x >= 10:
    print(y)
else:
    print(y+100*(10-x))

Buggy submission (verdict: Runtime Error):
x, y = gets.split(" ").map(&:to_i)
def rating_try(x, y)
  if x < 10
     y+(100*(10-x))
  else
     y
  end
end
puts rating_try(x, y)

Buggy submission (verdict: Runtime Error):
x, y = gets.split.map(&:to_i)
def rating_try(x, y)
  if x < 10
     y+(100*(10-x))
  else
     y
  end
end
puts rating_try(x, y)
Problem p02817 (python)

Fixed submission:
x, y = input().split()
print(y+x)

Buggy submission (verdict: Runtime Error):
A - Strings
Problem p03323 (python)

Fixed submission:
x, y = map(int, input().split())
if x <= 8 and y <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
A - Happy Birthday!
Problem p03399 (python)

Fixed submission:
x = [int(input()) for i in range(4)]
print(min(x[0], x[1])+min(x[2], x[3]))

Buggy submission (verdict: Runtime Error):
a, s, d, f = map(int, input().split())
print(min(a, s)+min(d, f))
Problem p03737 (python)

Fixed submission:
x, y, z = input().split()
print(x[0].upper()+y[0].upper()+z[0].upper())

Buggy submission (verdict: Runtime Error):
atcoder beginner contest
Problem p02788 (python)

Fixed submission:
N,D,A=[int(x) for x in input().split()]
xh = [[int(x) for x in input().split()] for _ in range(N)]
xh = sorted(xh)
r=0
l=0
ans = 0
mi = 10**9
d = [0]*(N+1)
for l in range(N):
  if d[l]<xh[l][1]:
    la = (xh[l][1]-d[l]+A-1)//A
    for _ in range(N):
      if l<N and r<N and 2*D>=xh[r][0]-xh[l][0]:
        r+=1
      else:
        break
    ans += la
    d[l]+=la*A
    d[r]-=la*A
  d[l+1]+=d[l]
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
H,N = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]
dp = [[10**18]*(10**4+1) for _ in range(N+1)]
for i in range(N+1):
  dp[i][0]=0
mi=10**9
for i in range(N):
  for w in range(10**4+1):
    dp[i+1][w]=min(dp[i+1][w],dp[i][w])
    if w-AB[i][0]>=0:
      dp[i+1][w]=min(dp[i+1][w],dp[i + 1][w - AB[i][0]] + AB[i][1])
for i in range(H,10**4+1):
  mi = min(mi,dp[N][i])
print(mi)
Problem p02803 (python)

Fixed submission:
import itertools
H,W= [int(x) for x in input().split()]
meiro=[list(input())for _ in range(H)]
#print(meiro)
ans=0
dx = [1,0,-1,0]
dy=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    result=[[0]*W for _ in range(H)]
    cnt=0
    #print(i,j)
    if meiro[i][j]=="#":
      continue
    elif meiro[i][j]==".":
      stk =[[i,j]]
      result[i][j]=1
      while stk:
        x,y = stk.pop(0)
        
        for r in range(4):
          xx,yy=x+dx[r],y+dy[r]
          if yy<0 or xx<0 or W<=yy or H<=xx or meiro[xx][yy]=="#" or result[xx][yy]!=0:
            continue
          result[xx][yy]=result[x][y]+1
          stk.append([xx,yy])
      for l in range(H):
        for t in range(W):
          ans = max(ans,result[l][t])
print(ans-1)

Buggy submission (verdict: Runtime Error):
import itertools
H,W= [int(x) for x in input().split()]
meiro=[list(input())for _ in range(H)]
#print(meiro)
ans=0
dx = [1,0,-1,0]
dy=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    result=[[0]*W for _ in range(H)]
    cnt=0
    #print(i,j)
    if meiro[i][j]=="#":
      continue
    elif meiro[i][j]==".":
      stk =[[i,j]]
      result[i][j]=1
      while stk:
        x,y = stk.pop(0)
        
        for r in range(4):
          xx,yy=x+dx[r],y+dy[r]
          if yy<0 or xx<0 or W<=yy or H<=xx or meiro[xx][yy]=="#" or result[xx][yy]!=0:
            continue
          result[xx][yy]=result[x][y]+1
          stk.append([xx,yy])
      for l in range(H):
        for t in range(W):
          ans = max(ans,result[l][t])
print(ans-1)import itertools
H,W= [int(x) for x in input().split()]
meiro=[list(input())for _ in range(H)]
#print(meiro)
ans=0
dx = [1,0,-1,0]
dy=[0,1,0,-1]
for i in range(H):
  for j in range(W):
    result=[[0]*W for _ in range(H)]
    cnt=0
    #print(i,j)
    if meiro[i][j]=="#":
      continue
    elif meiro[i][j]==".":
      stk =[[i,j]]
      result[i][j]=1
      while stk:
        x,y = stk.pop(0)
        
        for r in range(4):
          xx,yy=x+dx[r],y+dy[r]
          if yy<0 or xx<0 or W<=yy or H<=xx or meiro[xx][yy]=="#" or result[xx][yy]!=0:
            continue
          result[xx][yy]=result[x][y]+1
          stk.append([xx,yy])
      for l in range(H):
        for t in range(W):
          ans = max(ans,result[l][t])
print(ans-1)