Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = list(map(int,input().split()))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    ans = 0
    while len(dic) > K:
        ans += min(dic.values())
        dic.pop(min(dic, key=dic.get))
    print(ans)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    tmp = sorted(dic.values(),reverse=1)
    print(sum(tmp[K:]))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = list(map(int,input().split()))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    ans = 0
    while len(dic) > K:
        ans += min(dic.values())
        dic.pop(min(dic, key=dic.get))
    print(ans)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    tmp = sorted(dic.values(),reverse=1)
    print(sum(tmp[K:]))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
A = sorted(list(map(int,input().split())))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    ans = 0
    while len(dic) > K:
        ans += min(dic.values())
        dic.pop(min(dic, key=dic.get))
    print(ans)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
species = list(set(A))
dic = {}
for i in species:
    dic[i] = 0
for i in A:
    dic[i] += 1
if K >= len(species):
    print(0)
else:
    tmp = sorted(dic.values(),reverse=1)
    print(sum(tmp[K:]))
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
print(min([A*T,B]))

Fixed submission:
N,A,B = map(int,input().split())
print(min([A*N,B]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [2,1]
if N > 3:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])

Fixed submission:
N = int(input())
L = [2,1]
if N > 1:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = str(num)
for j in range(len(tmp)):
    print("".join(tmp[j]))

Fixed submission:
H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
S.insert(0,[0]*W)
S.append([0]*W)
for i in range(len(S)):
    S[i].insert(0,0)
    S[i].append(0)
dx = [1,0,-1,0,1,-1,-1,1]
dy = [0,1,0,-1,1,1,-1,-1]
tmp = [[0] * W for i in range(H)]
for i in range(1,H+1):
    for j in range(1,W+1):
        if S[i][j] == "#":
            tmp[i-1][j-1] = "#"
            continue
        num = 0
        for k in range(len(dx)):
            if S[i+dx[k]][j+dy[k]] == "#":
                num += 1
                tmp[i-1][j-1] = num
for j in range(len(tmp)):
    print(*tmp[j],sep = "")
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
ans = "IMPOSSIBLE"
f = []
s = []
for i in range(M):
    a,b = map(lambda x: int(x)-1, input().split())
    if a == 0:
        f.append(b)
    if b == N-1:
        s.append(a)
if len(f) > len(s):
    for i in range(len(s)):
        if s[i] in f:
            ans = "POSSIBLE"
            break
else:
    for i in range(len(f)):
        if f[i] in s:
            ans = "POSSIBLE"
            break
print(ans)

Fixed submission:
N,M = map(int,input().split())
ans = "IMPOSSIBLE"
f = dict(zip(list(range(N)),[0]*N))
s = dict(zip(list(range(N)),[0]*N))
for i in range(M):
    a,b = map(lambda x: int(x)-1, input().split())
    if a == 0:
        f[b] = 1
    if b == N-1:
        s[a] = 1
if len(f) > len(s):
    for i in range(len(s)):
        if s[i] == 1 and f[i] == 1:
            ans = "POSSIBLE"
            break
else:
    for i in range(len(f)):
        if f[i] == 1 and s[i] == 1:
            ans = "POSSIBLE"
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
col = [0]*8
wild = 0
for i in a:
    if i//400 <= 7:
        col[i//400] = 1
    else:
        wild += 1
minimum = max(1,sum(col))
maximum = min(sum(col)+wild)
print(minimum,maximum)

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
col = [0]*8
wild = 0
for i in a:
    if i//400 <= 7:
        col[i//400] = 1
    else:
        wild += 1
minimum = max(1,sum(col))
maximum = sum(col)+wild
print(minimum,maximum)
Buggy python submission (verdict: Runtime Error):
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)

Fixed submission:
N = int(input())
s = sorted([int(input()) for _ in range(N)])
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)

Buggy python submission (verdict: Runtime Error):
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)

Fixed submission:
N = int(input())
s = sorted([int(input()) for _ in range(N)])
if sum(s)%10 != 0:
    print(sum(s))
else:
    for i in range(N):
        if s[i]%10 != 0:
            print(sum(s)-s[i])
            break
        if i == N-1:
            print(0)
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
ls = []
len = 0
for i in range(N):
    a,b = map(int,input().split())
    ls.append(str(a)*b)
    len += b
    if len >= K:
        break
ls = "".join(ls)
print(ls[K-1])

Fixed submission:
from operator import itemgetter
N,K = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(N)]
ls = sorted(ls,key=itemgetter(0))
len = 0
ans = 0
i = 0
while True:
    if len >= K:
        break
    ans = ls[i][0]
    len += ls[i][1]
    i += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")

Fixed submission:
A,B,C = map(str,input().split())
if A[-1] == B[0] and B[-1] == C[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
start = time.time()
A,B,C = map(int,input().split())
flag = 0
if A == 1:
    flag = 1
else:    
    while flag == 0:
        if A%B == C:
            flag = 1
            break
        else:
            A += A
        now = time.time() - start
        if now > 1.9:
            break
if flag == 0:
    print("NO")
else:
    print("YES")

Fixed submission:
A,B,C = map(int,input().split())
tmpA = A
tmp = []
while A%B != C and A%B not in tmp:
    tmp.append(A%B)
    A += tmpA
if A%B == C:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
X = int(input())
len = 0
flag = False
for i in range(1,X+1):
    if flag:
        break
    for j in range(i):
        len += 1
        if len >= X:
            flag = True
            ans = i
            break
print(ans)

Fixed submission:
import math
X = int(input())
print(math.ceil((-1+(8*X+1)**(1/2))/2))
Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator
N = int(input())
prod = functools.partial(functools.reduce,operator.mul)
print(prod(list(range(1,N+1)))%(10**9+7))

Fixed submission:
from math import factorial
N = int(input())
print(factorial(N)%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
for i in range(1,N):
    N = N*i
print(N%(10**9+7))

Fixed submission:
from math import factorial
N = int(input())
print(factorial(N)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
tmp = list(A,B)
ans = ["Alice","Bob"]
if tmp[0] == tmp[1]:
    print("Draw")
elif tmp[0] == 1:
    print(ans[0])
elif tmp[1] == 1:
    print(ans[1])
elif tmp[0] > tmp[1]:
    print(ans[0])
else:
    print(ans[1])

Fixed submission:
A,B = map(int,input().split())
tmp = [A,B]
ans = ["Alice","Bob"]
if tmp[0] == tmp[1]:
    print("Draw")
elif tmp[0] == 1:
    print(ans[0])
elif tmp[1] == 1:
    print(ans[1])
elif tmp[0] > tmp[1]:
    print(ans[0])
else:
    print(ans[1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

def main():
    N = int(input())
    A = np.array([None]*N)
    B = np.array([None]*N)
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    ans = 0
    for i in range(N-1,-1,-1):
        if A[i]%B[i] == 0:
            continue
        ans += (B[i] - A[i]%B[i])
        A += (B[i] - A[i]%B[i])
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    A = [None]*N
    B = [None]*N
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    tmp = 0
    ans = 0
    for i in range(N-1,-1,-1):
        if (A[i]+tmp)%B[i] == 0:
            continue
        ans += (B[i] - (A[i]+tmp)%B[i])
        tmp += (B[i] - (A[i]+tmp)%B[i])
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
    N = int(input())
    A = np.array([None]*N)
    B = np.array([None]*N)
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    ans = 0
    for i in range(N-1,-1,-1):
        if A[i]%B[i] == 0:
            continue
        ans += (B[i] - A[i]%B[i])
        A += (B[i] - A[i]%B[i])
    print(ans)


if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N = int(input())
    A = [None]*N
    B = [None]*N
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    tmp = 0
    ans = 0
    for i in range(N-1,-1,-1):
        if (A[i]+tmp)%B[i] == 0:
            continue
        ans += (B[i] - (A[i]+tmp)%B[i])
        tmp += (B[i] - (A[i]+tmp)%B[i])
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
H,W = map(int,input().split())
c = [input() for i in range(W)]
for j in range(W):
    print(c[j])
    print(c[j])

Fixed submission:
H,W = map(int,input().split())
c = [input() for i in range(H)]
for j in range(H):
    print(c[j])
    print(c[j])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X = input()
    count = 0
    for i in range(10**3):
        count += X.count("ST")
        X = X.replace("ST","")
    print(len(X))


if __name__ == '__main__':
    main()

Fixed submission:
from collections import deque
def main():
    X = input()
    stack = deque([])
    for i in range(len(X)):
        if X[i] == "S":
            stack.append(X[i])
        else:
            if len(stack) != 0:
                tmp = stack.pop()
                if tmp == "T":
                    stack.append(tmp)
                    stack.append(X[i])
            else:
                stack.append(X[i])
    print(len(stack))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X = input()
    count = 0
    for i in range(10**4):
        count += X.count("ST")
        X = X.replace("ST","")
    print(len(X))


if __name__ == '__main__':
    main()

Fixed submission:
from collections import deque
def main():
    X = input()
    stack = deque([])
    for i in range(len(X)):
        if X[i] == "S":
            stack.append(X[i])
        else:
            if len(stack) != 0:
                tmp = stack.pop()
                if tmp == "T":
                    stack.append(tmp)
                    stack.append(X[i])
            else:
                stack.append(X[i])
    print(len(stack))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X = input()
    count = 0
    for i in range(10**4):
        count += X.count("ST")
        X = X.replace("ST","")
    print(len(X))


if __name__ == '__main__':
    main()

Fixed submission:
from collections import deque
def main():
    X = input()
    stack = deque([])
    for i in range(len(X)):
        if X[i] == "S":
            stack.append(X[i])
        else:
            if len(stack) != 0:
                tmp = stack.pop()
                if tmp == "T":
                    stack.append(tmp)
                    stack.append(X[i])
            else:
                stack.append(X[i])
    print(len(stack))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X = input()
    count = 0
    for i in range(10**6):
        count += X.count("ST")
        X = X.replace("ST","")
    print(len(X))


if __name__ == '__main__':
    main()

Fixed submission:
from collections import deque
def main():
    X = input()
    stack = deque([])
    for i in range(len(X)):
        if X[i] == "S":
            stack.append(X[i])
        else:
            if len(stack) != 0:
                tmp = stack.pop()
                if tmp == "T":
                    stack.append(tmp)
                    stack.append(X[i])
            else:
                stack.append(X[i])
    print(len(stack))
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import time
import collections
import scipy.misc

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   

N, M = map(int, input().split())
t_strt = time.time() 

factors = collections.Counter(prime_decomposition(M))
t_elps = time.time()
#print(f"{t_elps - t_strt} [sec]")
num_pattern = 1;

for exponent in factors.values():
    tmp_num_pattern = scipy.misc.comb(exponent + N -1, N-1, exact = True) 
    num_pattern = num_pattern * int(tmp_num_pattern)
    
#print(num_pattern%(10**9+7))

t_elps = time.time()
print(f"{t_elps - t_strt} [sec]")

Fixed submission:
# 整数の入力
A, B, C = map(int, input().split())

tmp_max = 10*A + B + C 

if tmp_max < 10*B + C +A:
    tmp_max = 10*B + C +A

if tmp_max < 10*C + A +B:
    tmp_max = 10*C + A +B

# 出力
print("{}".format(tmp_max))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 20:12:17 2019

@author: Owner
"""

import numpy as np
from operator import itemgetter
import bisect

N, M = map(int, input().split())


ab = [(0, 0)]*M
c = np.zeros(N)
for m in range(M):
    ab[m] = tuple(map(int, input().split()))

ab = tuple(sorted(ab, key = itemgetter(0)))

a = [0]*M
b = [0]*M
for m in range(M):
    a[m], b[m] = ab[m]
b.sort()
res = 0
n = -1
while True:
    tmp = bisect.bisect_left(a, n)
    
    n = b[bisect.bisect_right(b, a[tmp])]
    res+=1
    if n > a[m]:
        break
    
    
        

print(res)



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun May 19 20:12:17 2019

@author: Owner
"""

from operator import itemgetter
import bisect

N, M = map(int, input().split())


ab = [(0, 0)]*M
for m in range(M):
    ab[m] = tuple(map(int, input().split()))

ab = tuple(sorted(ab, key = itemgetter(1)))

#print(ab)
x_rm = -1
res = 0
for m in range(M):
    if ab[m][0] < x_rm:
        continue
    else:
        x_rm = ab[m][1]
        res += 1
    
    
        

print(res)
Buggy python submission (verdict: Runtime Error):
X, Y = list(map(int, input()))

print(Y//X)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 24 21:42:42 2019

@author: Owner
"""


X, Y = list(map(int, input().split()))
cnt = 0
for n in range(Y):
    if X*2**n ==Y:
        cnt = n +1
        break
    elif X*2**n >Y:
        cnt = n
        break
    else:
        pass

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Thu Sep  5 14:58:17 2019

@author: Owner
"""

K, S = map(int, input().split())

cnt = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                cnt+=1
print(cnt)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Thu Sep  5 14:58:17 2019

@author: Owner
"""

K, S = map(int, input().split())

cnt = 0

for x in range(K+1):
    for y in range(K+1):
        if 0 <= S-(x+y) and S-(x+y)<=K :
            cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

ans = 0

for i in range(n-1):
	if s[i]!=s[i+1]:
    	ans = ans + 1

print(ans+1)

    

Fixed submission:
n = int(input())
s = input()

ans = 0

for i in range(n-1):
	if s[i]!=s[i+1]:
		ans = ans + 1

print(ans+1)
Buggy python submission (verdict: Runtime Error):
n = input()

if n == 'A':
  print('T')
  
elif n == 'T'
  print('A')
  
elif n == 'C'
  print('G')
  
elif n == 'G'
  print('C')

else:
  pass


Fixed submission:
n = input()

if n == 'A':
  print('T')
  
elif n == 'T':
  print('A')
  
elif n == 'C':
  print('G')
  
elif n == 'G':
  print('C')

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

if n == 'A':
  print('T')
  
elif n == 'T'
  print('A')
  
elif n == 'C'
  print('G')
  
elif n == 'G'
  print('C')



Fixed submission:
n = input()

if n == 'A':
  print('T')
  
elif n == 'T':
  print('A')
  
elif n == 'C':
  print('G')
  
elif n == 'G':
  print('C')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.platform == 'ios':
	sys.stdin = open('input.txt')

input = sys.stdin.readline


n,q = map(int,input().split())
s = input()
l = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
	print(s[l[i][0]-1:l[i][1]].count('AC'))

Fixed submission:
import sys
if sys.platform =='ios':
	sys.stdin=open('input.txt')

n,q=map(int,input().split())
s=input()
lr=[list(map(int,input().split())) for _ in range(q)]

AC=[]
for i in range(n-1):
    if s[i]=="A":
        if s[i+1]=="C":
            AC.append(i)
#print(AC)

from bisect import bisect_right as br
from bisect import bisect_left as bl
for i in range(q):
    a=bl(AC,lr[i][0]-1)
    #print(i,AC,lr[i][0],a)
    b=br(AC,lr[i][1]-2)
    #print(a,b)
    print(b-a)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
if sys.platform == 'ios':
	sys.stdin = open('input.txt')


n,q = map(int,input().split())
s = input()
l = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
	print(s[l[i][0]-1:l[i][1]].count('AC'))

Fixed submission:
import sys
if sys.platform =='ios':
	sys.stdin=open('input.txt')

n,q=map(int,input().split())
s=input()
lr=[list(map(int,input().split())) for _ in range(q)]

AC=[]
for i in range(n-1):
    if s[i]=="A":
        if s[i+1]=="C":
            AC.append(i)
#print(AC)

from bisect import bisect_right as br
from bisect import bisect_left as bl
for i in range(q):
    a=bl(AC,lr[i][0]-1)
    #print(i,AC,lr[i][0],a)
    b=br(AC,lr[i][1]-2)
    #print(a,b)
    print(b-a)
Buggy python submission (verdict: Runtime Error):
n,h,w = map(int,input().split())

print((n-h+1)*(n-w+1))


Fixed submission:
n = int(input())
h = int(input())
w = int(input())

print((n-h+1)*(n-w+1))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

input = sys.stdin.readline

n,k = map(int,input().split())
l = [int(input()) for _ in range(n)]

#print(l)

l = sorted(l)

#print(l)

ansmin = float("inf")
for i in range(n-k+1):
	if ansmin > max(l[i:i+k])-min(l[i:i+k]):
		ansmin = max(l[i:i+k])-min(l[i:i+k])

print(ansmin)





Fixed submission:
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	#print(name)
	sys.stdin = open(name)

input = sys.stdin.readline

n,k = map(int,input().split())
l = [int(input()) for _ in range(n)]

#print(l)

l = sorted(l)

#print(l)

ansmin = float("inf")
for i in range(n-k+1):
	if ansmin > l[i+k-1]-l[i]:
		ansmin = l[i+k-1]-l[i]

print(ansmin)
Buggy python submission (verdict: Time Limit Exceeded):
x,y = map(int,input().split())

if x == y:
	print('-1')
	exit()

i =2

while x*i % y == 0:
	i = i + 1	

print(x*i)



Fixed submission:
x,y = map(int,input().split())

if x == y:
	print(-1)
	exit()

i =2

if x < y :
	while x*i % y == 0:
		i = i + 1	
	print(x*i)
	
else:
	if x%y==0:
		print(-1)
	else:
		while x*i % y == 0:
			i = i + 1	
		print(x*i)
Buggy python submission (verdict: Runtime Error):

# スペース区切りの整数の入力
n, y = map(int, input().split())

i = 0
j = 0
k = 0

l = [-1,-1,-1]
#print(l)

for i in reversed(range(0,n+1)):
    #print('i= %d' % i)
    if  y >= i*10000:
        for j in reversed(range(0,n-i+1)):
            #print('j= %d' % j)
            k = n - i - j
            #print('k= %d' % k)
            if  y == i*10000 + j*5000 + k*1000:
                l = [i, j, k]

#----ここは一つ見つかったら抜けるための命令
#                break
#        else:
#            continue
#        break
#------------------------------------

                #print(l)

print(l[0], l[1], l[2])


Fixed submission:

s = input()

#print(s)

#文字を置き換える
print(s.replace('2017', '2018'))

Buggy python submission (verdict: Runtime Error):

# スペース区切りの整数の入力
n, y = map(int, input().split())

i = 0
j = 0
k = 0

l = [-1,-1,-1]
#print(l)

for i in reversed(range(0,n+1)):
    #print('i= %d' % i)
    if  y >= i*10000:
        for j in reversed(range(0,n-i+1)):
            #print('j= %d' % j)
            k = n - i - j
            #print('k= %d' % k)
            if  y == i*10000 + j*5000 + k*1000:
                l = [i, j, k]

#----ここは一つ見つかったら抜けるための命令
                break
        else:
            continue
        break
#------------------------------------

                #print(l)

print(l[0], l[1], l[2])


Fixed submission:

s = input()

#print(s)

#文字を置き換える
print(s.replace('2017', '2018'))

Buggy python submission (verdict: Runtime Error):

# スペース区切りの整数の入力
n, y = map(int, input().split())

i = 0
j = 0
k = 0

l = [-1,-1,-1]
#print(l)

for i in reversed(range(0,n+1)):
    #print('i= %d' % i)
    if  y >= i*10000:
        for j in reversed(range(0,n-i+1)):
            #print('j= %d' % j)
            k = n - i - j
            #print('k= %d' % k)
            if  y == i*10000 + j*5000 + k*1000:
                l = [i, j, k]

#----ここは一つ見つかったら抜けるための命令
                break
        else:
            continue
        break
#------------------------------------

                #print(l)

print(l[0], l[1], l[2])


Fixed submission:

s = input()

#print(s)

#文字を置き換える
print(s.replace('2017', '2018'))