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

Fixed submission:
N , Z , W = map(int , input().split())

a = list(map(int , input().split()))

print(max(abs(a[N - 2] - a[N - 1]), abs(a[N - 1] - W)))

Buggy submission (verdict: Runtime Error):
from pprint import pprint
'''
## O(1)のパターン
N , Z , W = map(int , input().split())

a = list(map(int , input().split()))

print(max(abs(a[N - 2] - a[N - 1]), abs(a[N - 1] - W)))
'''
## DPを使って解くとき
N , Z , W = map(int , input().split())
a = list(map(int , input().split()))
a.reverse()
a += [W]
#print(a)
memo = [[-1]* (N + 1) , [-1] * (N + 1)]
def DP(n , turn):

    if n == 1:
        #print(memo[turn][n])
        return abs(a[0] - W)
    if memo[turn][n] != -1:
        return memo[turn][n]
    if turn == 1:
        #print("turn : 1")
        tmp_max = 0
        for i in range(1 , n + 1):
            if i == n:
                tmp_max = max(tmp_max , abs(a[0]-W))
            else:
                tmp_max = max(tmp_max , DP(n - 1,1 - turn))
        #print("tmp_max : ",tmp_max)
        memo[turn][n] = tmp_max
        return tmp_max
    if turn == 0:
        tmp_min = 10 ** 9
        #print("turn : 0")
        for i in range(1 , n + 1):
            if i == n:
                tmp_min = min(tmp_min , abs(a[0]-W))
            else:
                tmp_min = min(tmp_min , DP(n - 1,1 - turn))
        #print("tmp_min : ",tmp_min)
        memo[turn][n] = tmp_min
        return tmp_min



print(DP(N , 1))
#print(memo)
Problem p03624 (python)

Fixed submission:
from collections import Counter
S = list(input())
S = Counter(S)
S = list(S.keys())
S.sort()
for i in range(26):
    alph = chr(ord("a") + i)
    #print(alph)
    if i == len(S):
        print(chr(ord("a") + i))
        exit()
    elif S[i] != chr(ord("a") + i):
        print(alph)
        exit()

print("None")

Buggy submission (verdict: Runtime Error):
from collections import Counter
S = list(input())
S = Counter(S)
S = list(S.keys())
S.sort()
for i in range(26):
    alph = chr(ord("a") + i)
    #print(alph)
    if S[i] != chr(ord("a") + i):
        print(alph)
        exit()
print("None")
Problem p03633 (python)

Fixed submission:
import math


def lcm(a, b):
    return a * b // math.gcd(a, b)


N = int(input())
ans = int(input())
for _ in range(N - 1):
    ans = lcm(ans, int(input()))
print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(x, y):
    return (x * y) // gcd(x, y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T)

ans = lcm(T[0] , T[1])
for i in range(2 , N):
    ans = lcm(T[i] , ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T)

ans = lcm(T[0] , T[1])
for i in range(2 , N):
    ans = lcm(T[i] , ans)
print(ans)
Problem p03645 (python)

Fixed submission:
N , M = map(int,input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a , b = map(int,input().split())
    graph[a - 1].append(b - 1)
    graph[b - 1].append(a - 1)

for node0 in graph[0]:
    for node1 in graph[node0]:
        if node1 == N - 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import bisect
N, M = map(int, input().split())
start_to_middle = []
middle_to_end = []
for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        start_to_middle.append(b)
    elif b == N:
        middle_to_end.append(a)
if not len(start_to_middle) or not len(middle_to_end):
    print('IMPOSSIBLE')
    exit()
middle_to_end.sort()
for middle in start_to_middle:
    idx = bisect.bisect_left(middle_to_end, middle)
    if middle_to_end[idx] == middle:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
Problem p03651 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
if max(A) < K or N == 1:
    print("IMPOSSIBLE")
    exit()

A.sort()
for i in range(1, N):
    tmp = abs(A[i - 1] - A[i])
    if not tmp == 0 and K % tmp == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
    print("POSSIBLE")
    exit()
if max(A) < K or N == 1:
    print("IMPOSSIBLE")
    exit()

A.sort()
for i in range(1, N):
    tmp = abs(A[i - 1] - A[i])
    if K % tmp == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
if max(A) < K:
    print("IMPOSSIBLE")
    exit()
if K in A:
    print("POSSIBLE")
    exit()

A.sort()
for i in range(1, N):
    tmp = abs(A[i - 1] - A[i])
    if K % tmp == 0:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
Problem p03673 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A_oddList = A[::2]
A_evenList = A[1::2]
A_oddList = A_oddList[::-1]
A_evenList = A_evenList[::-1]

if N % 2 == 1:
    A_evenList = A_evenList[::-1]
    print(*A_oddList , end = " ")
    print(*A_evenList)
else:
    A_oddList = A_oddList[::-1]
    print(*A_evenList , end = " ")
    print(*A_oddList)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A_oddList = A[::2]
A_evenList = A[1::2]
A_oddList = A_oddList[::-1]
A_evenList = A_evenList[::-1]

if N % 2 == 1:
    print(*A_oddList ,*A_evenList)
else:
    A_oddList = A_oddList[::-1]
    print(*A_evenList , *A_oddList)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
A_oddList = A[::2]
A_evenList = A[1::2]
A_oddList = A_oddList[::-1]
A_evenList = A_evenList[::-1]

if N % 2 == 1:
    print(*A_oddList ,*A_evenList)
else:
    A_oddList = A_oddList[::-1]
    print(*A_evenList , *A_oddList)
Problem p03711 (python)

Fixed submission:
sequence = ((1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2, ))

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')

Buggy submission (verdict: Runtime Error):
sequence = ((1, 3, 5, 7, 8, 10, 12), (4, 6, 9, 11), (2))

x , y = map(int, input().split())
for s in sequence:
    if x in s and y in s:
        print('Yes')
        exit()
print('No')
Problem p03761 (python)

Fixed submission:
from collections import Counter
N = int(input())
S = []
for _ in range(N):
    s = list(input())
    s.sort()
    S.append(s)

work = S[0]
for i in range(1 , N):
    work_lst = []
    while len(work) != 0 and len(S[i]) != 0:
        if work[0] == S[i][0]:
            c = S[i].pop(0)
            c = work.pop(0)
            work_lst.append(c)
        elif work[0] > S[i][0]:
            S[i].pop(0)
        elif work[0] < S[i][0]:
            work.pop(0)
    work = work_lst
if N == 1:
    print("".join(s))
else:
    print("".join(work_lst))

Buggy submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = []
for _ in range(N):
    s = list(input())
    s.sort()
    S.append(s)

work = S[0]
for i in range(1 , N):
    work_lst = []
    for j in range(max(len(S[i]) , len(work))):
        if len(work) == 0 or len(S[i]) == 0:
            break
        if work[0] == S[i][0]:
            c = S[i].pop(0)
            c = work.pop(0)
            work_lst.append(c)
        elif work[0] > S[i][0]:
            S[i].pop(0)
        elif work[0] < S[i][0]:
            work.pop(0)
    work = work_lst
print("".join(work_lst))
Problem p03814 (python)

Fixed submission:
s = input()
for i in range(len(s)):
    if s[i] == 'A':
        A_idx = i
        break
for i in range(len(s)):
    if s[i] == 'Z':
        Z_idx = i
print(Z_idx - A_idx + 1)

Buggy submission (verdict: Runtime Error):
ZABCZ
Problem p03846 (python)

Fixed submission:
from collections import Counter
import math
N = int(input())
A = list(map(int,input().split()))
A_count = Counter(A)
count_item = list(A_count.items())
count_item.sort()
start = 1 - (N % 2)
for i in range(math.ceil(N / 2)):
    if i == 0 and N % 2 == 1:
        if count_item[i][0] == 0 and count_item[i][1] != 1:
            print("0")
            exit()
    else:
        if count_item[i][0] != i * 2 + (1 - (N % 2)) or count_item[i][1] != 2:
            print("0")
            exit()
print(2 ** (N // 2) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
from collections import Counter
import math
N = int(input())
A = list(map(int,input().split()))
A_count = Counter(A)
count_item = list(A_count.items())
count_item.sort()
start = 1 - (N % 2)
for i in range(math.ceil(N / 2)):
    if i == 0 and N % 2 == 1:
        if count_item[i][0] == 0 and count_item[i][1] != 1:
            print("0")
            exit()
    else:
        if count_item[i][0] != i * 2 + (1 - (N % 2)) or count_item[i][1] != 2:
            print("0")
            exit()
print(2 ** (N // 2) % (10 ** 9 + 7)
Problem p03852 (python)

Fixed submission:
c = input()
l = ['a','e','i','o','u']
print('vowel' if c in l else 'consonant')

Buggy submission (verdict: Runtime Error):
c = input()
l = ['a'、'e'、'i'、'o'、'u']
print('vowwl' if c in l else 'consonant')
Problem p02818 (python)

Fixed submission:
str = input().split()
a = int(str[0])
b = int(str[1])
k = int(str[2])

x = max(0,a-k)
y = b;
if x == 0:
    y = max(0, b + a - k)

print(x,y)

Buggy submission (verdict: Runtime Error):
str = input().split()
a = int(str[0])
b = int(str[1])
k = int(str[2])

x = max(0,a-k)
if x == 0:
    y = b + a - k

print(x,y)
Problem p02584 (python)

Fixed submission:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

X,K,D = LI()
X = abs(X)
sho = X // D
amari = X % D

if (sho>=K):
    saigo = X - (K*D)
    print(abs(saigo))
else:
    nokori = K - abs(sho)
    if nokori % 2 == 0:
        print(abs(amari))
    else:
        ans = min(amari+D,amari-D)
        print(abs(ans))

Buggy submission (verdict: Runtime Error):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

X,K,D = LI()

sho = X // D
amari = X % D

if (sho>=K):
    saigo = X - (K*D)
    print(abs(saigo))
else:
    nokori = K - ans(sho)
    if nokori % 2 == 0:
        print(abs(amari))
    else:
        ans = min(amari+D,amari-D)
        print(abs(ans))
Problem p02612 (python)

Fixed submission:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

ans = N // 1000
ans2 = N - (ans*1000)

if ans2 == 0:
    print(0)
else:
    print(1000-ans2)

Buggy submission (verdict: Runtime Error):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

n %= 1000
if n==0:
    print(0)
else:
    print(1000-n)

Buggy submission (verdict: Runtime Error):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()

n %= 1000
if n==0:
    print(0)
else:
    print(1000-n)
Problem p02614 (python)

Fixed submission:
import sys
import numpy as np
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

h,w,k = LI()
cnt = 0
c = [0]*h
for i in range(h):
    c[i] = input()

for rows in range(1 << h):
    for cols in range(1 << w):
        black = 0
        for i in range(h):
            if (rows >> i) % 2 == 1:
                continue
            for j in range(w):
                if (cols >> j) % 2 == 1:
                    continue
                black += c[i][j] == '#'
        if black == k:
            cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

h,w,k = LI()
cnt = 0
c = [0]*h
for i in range(h):
    c[i] = input()

for rows in range(1 << h):
    for cols in range(1 << w):
        black = 0
        for i in range(h):
            if (rows >> i) % 2 == 1:
                continue
            for j in range(w):
                if (cols >> j) % 2 == 1:
                    continue
                black += c[i][j] == '#'
        if black == k:
            cnt += 1
print(cnt)
Problem p02743 (python)

Fixed submission:
import sys
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
a,b,c = LI()



if c-a-b > 0 and (4*a*b) < ((c-a-b)**2) :
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys
import math
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
a,b,c = LI()



if c-a-b > and (4*a*b) < ((c-a-b)**2) :
    print('Yes')
else:
    print('No')
Problem p03371 (python)

Fixed submission:
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

only = A*X+B*Y
only_mix = C*max(X,Y)*2
comp = 0
if X > Y:
    comp = C*Y*2+A*(X-Y)
elif X < Y:
    comp = C*X*2+B*(Y-X)
else:
    comp = C*Y*2

print(min(only,only_mix,comp))

Buggy submission (verdict: Runtime Error):
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

# only = A*X+B*Y
# only_mix = C*max(X,Y)*2
# comp = 0
# if X > Y:
#     comp = C*Y*2+A*(X-Y)
# elif X < Y:
#     comp = C*X*2+B*(Y-X)
# else:
#     comp = C*Y*2

# print(min(only,only_mix,comp))

ans = float('INF')
for i in range(max(X,Y)+1):
    price = A+max(X-i,0)+B*max(Y-i,0)+C*2*i
    ans = min(ans,price)

price(ans)

Buggy submission (verdict: Runtime Error):
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

A,B,C,X,Y = LI()

# only = A*X+B*Y
# only_mix = C*max(X,Y)*2
# comp = 0
# if X > Y:
#     comp = C*Y*2+A*(X-Y)
# elif X < Y:
#     comp = C*X*2+B*(Y-X)
# else:
#     comp = C*Y*2

# print(min(only,only_mix,comp))

ans = float('INF')
for i in range(max(X,Y)+1):
    price = A+max(X-i,0)+B*max(Y-i,0)+C*2*ians 
    ans = min(ans,price)

price(ans)
Problem p03448 (python)

Fixed submission:
A, B, C, X = [int(input()) for i in range(4)]
count = 0
for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            if 500*a+100*b+50*c == X:
                count += 1

print(count)

Buggy submission (verdict: Runtime Error):
A, B, C, X = [int(input()) for i in range(4)]
count = 0
for a in A:
    for b in B:
        for c in C:
            if 500*a+100*b+50*c == X:
                count += 1

print(count)
Problem p03457 (python)

Fixed submission:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t, x, y = LI()
    if abs(prev_x-x) + abs(prev_y-y) > (t - prev_t) or (abs(prev_x-x) + abs(prev_y-y) + (t - prev_t)) % 2:
        print('No')
        exit()
    prev_t = t
    prev_x = x
    prev_y = y
print('Yes')

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t, x, y = LI()
    if (x+y) > (t - prev_t) or (abs(prev_x-x) + abs(prev_y-y) + (t - prev_t)) % 2:
        print('No')
        exac()
    prev_t = t
    prev_x = x
    prev_y = y
print('Yes')
Problem p03471 (python)

Fixed submission:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N, Y = LI()
y = 1000 * N
for i in range(N+1):
    for j in range(N-i+1):
        if i * 10000 + 5000 * j + 1000 * (N-i-j) == Y:
            print(i, j, N-i-j)
            exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N, Y = LI()
y = 1000 * N
for i in range(N+1):
    for j in range(n-i+1):
        if i * 10000 + 5000 * j + 1000 * (N-i-j) == Y:
            print(i, j, N-i-j)
            exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N, Y = LI()
y = 1000 * N
for i in range(N+1):
    for j in range(n-i+1):
        if i * 10000 + 5000 * j + 1000 * (N-i-j) == y:
            print(i, j, N-i-j)
            exit()
print("-1 -1 -1")
Problem p03478 (python)

Fixed submission:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N, A, B = LI()
ans = 0
for i in range(1, int(N)+1):
    si = str(i)
    sum = 0
    for sii in si:
        sum += int(sii)
    if A <= sum <= B:
        ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
count = 0
for i in range(1, N+1):
    if a <= sum(map(int, str(i))) <= b:
        count += 1
print(count)
Problem p03160 (python)

Fixed submission:
n=int(input())
l=input().split()
li=[int(i) for i in l]
dp=[0 for i in range(n)]
dp[0]=0
for i in range(1,n):
	if(i==1):
		dp[i]=dp[i-1]+abs(li[i]-li[i-1])
	else:
		dp[i]=min(dp[i-1]+abs(li[i]-li[i-1]),dp[i-2]+abs(li[i]-li[i-2]))
print(dp[-1])

Buggy submission (verdict: Runtime Error):
def f(i,li,dp,visited):
    if(visited[i]==1):
        return dp[i]
    if(i>=len(li)):
        return 0
    if(i==len(li)-1):
        return 0
    if(i==len(li)-2):
        visited[i]=1
        dp[i]=abs(li[i]-li[i+1])
        return dp[i]
    else:
        dp[i]=min(f(i+1,li,dp,visited)+abs(li[i+1]-li[i]),f(i+2,li,dp,visited)+abs(li[i+2]-li[i]))
        visited[i]=1
        return dp[i]

n=int(input())
l=input().split()
li=[int(i) for i in l]
dp=[0 for i in range(n)]
visited=list(dp)
print(f(0,li,dp,visited))
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
def f(x):
	global hashi
	if(x in hashi):
		return hashi[x]
	if(adj[x]==[]):
		return 0
	mino=0
	for i in adj[x]:
		mino=max(mino,f(i))
	hashi[x]=mino+1
	return mino+1
l=input().split()
n=int(l[0])
m=int(l[1])
adj=[[] for i in range(n+1)]
for i in range(m):
	l=input().split()
	u=int(l[0])
	v=int(l[1])
	adj[u].append(v)
maxa=0
hashi=dict()
for i in range(1,n+1):
	maxa=max(maxa,f(i))
print(maxa)

Buggy submission (verdict: Runtime Error):
def f(x):
	global hashi
	if(x in hashi):
		return hashi[x]
	if(adj[x]==[]):
		return 0
	mino=0
	for i in adj[x]:
		mino=max(mino,f(i))
	hashi[x]=mino+1
	return mino+1
l=input().split()
n=int(l[0])
m=int(l[1])
adj=[[] for i in range(n+1)]
for i in range(m):
	l=input().split()
	u=int(l[0])
	v=int(l[1])
	adj[u].append(v)
maxa=0
hashi=dict()
for i in range(1,n+1):
	maxa=max(maxa,f(i))
print(maxa)
Problem p02606 (python)

Fixed submission:
l,r,n = map(int, input().split())
L = l//n if l%n!=0 else (l//n)-1
R = r//n
print(R-L)

Buggy submission (verdict: Runtime Error):
n = int(input())
cnt = [0]*(n+1)

for i in range(1,int(n**0.5)+1):
  for j in range(1,int(n**0.5)+1):
    for k in range(1,int(n**0.5)+1):
      v = (i**2)+(j**2)+(k**2)+i*j+j*k+k*i
      if v<=n:
        cnt[v] += 1
for i in range(1,n+1):
  print(cnt[i])
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a+(a**2)+(a**3))

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
A = [int(p) for p in input().split()]
B = [int(p) for p in input().split()]
a,b = [0],[0]

a_apnd = a.append
b_apnd = b.append
for i in range(n):
  a_apnd(a[i]+A[i])
for i in range(m):
  b_apnd(b[i]+B[i])

count = 0
t = m
for i in range(n+1):
  if k<a[i]:
    break
  while b[t] > k-a[i]:
    t -= 1
  count = max(count,i+t)

print(count)

Buggy submission (verdict: Runtime Error):
a = input()
print(a+(a**2)+(a**3))
Problem p02630 (python)

Fixed submission:
# 整数の入力
N = int(input())
A = [int(a) for a in input().split()]
Q = int(input())
process = []
proc_append = process.append
hash = [0]*100001
for i in range(Q):
    proc_append(tuple(input().split()))
    process[i] = tuple(map(int,process[i]))

goukei = sum(A)

for i in A:
	hash[i] += 1

for b,c in process:
	if hash[b] != 0:
		goukei += (c-b)*hash[b]
		hash[c] += hash[b]
		hash[b] = 0
	print(goukei)

Buggy submission (verdict: Runtime Error):
# 整数の入力
N = int(input())
A = [int(a) for a in input().split()]
Q = int(input())
process = []
proc_append = process.append
hash = [0]*100000
for i in range(Q):
    proc_append(tuple(input().split()))
    process[i] = tuple(map(int,process[i]))

goukei = sum(A)

for i in A:
	hash[i] += 1

for b,c in process:
	if hash[b] != 0:
		goukei += (c-b)*hash[b]
		hash[c] += hash[b]
		hash[b] = 0
	print(goukei)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())
A = [int(a) for a in input().split()]
Q = int(input())
process = []
proc_append = process.append
for i in range(Q):
	proc_append(tuple(input().split()))
	process[i] = tuple(map(int,process[i]))

for b,c in process:
	A.sort()
	if b not in set(A):
		print('not in')
		continue
	for i in range(N):
		if b==A[i]:
			begin = i
			break
	for i in range(begin,N):
		if b!=A[i]:
			end = i-1
			break
	for i in range(begin,end+1):
		A[i] = c
	print(sum(A))
Problem p02640 (python)

Fixed submission:
X,Y = map(int,input().split())
v = Y-(2*X)
if v<0 or v%2==1:
  print('No')
elif 4*X < Y:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
X,Y = input().split()
v = Y-(2*X)
if v<0 or v%2==1:
  print('No')
else:
  print('Yes')