Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []
for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break
for i in range(Q):
    l, r = (int(i) for i in input().split())
    result = [i for i in onon if i >= l and i <= (r - 1)]
    left = bisect.bisect_left(onon,l)
    right = bisect.bisect_left(onon,r)
    print(right - left)

Fixed submission:
import bisect
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []
for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break
for i in range(Q):
    l, r = (int(i) for i in input().split())
    left = bisect.bisect_left(onon,l)
    right = bisect.bisect_left(onon,r)
    print(right - left)

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []

for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break

for i in range(Q):
    l, r = (int(i) for i in input().split())
    result = [i for i in onon if i >= l and i <= (r - 1)]
    print(len(result))

Fixed submission:
import bisect
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []
for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break
for i in range(Q):
    l, r = (int(i) for i in input().split())
    left = bisect.bisect_left(onon,l)
    right = bisect.bisect_left(onon,r)
    print(right - left)

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = (int(i) for i in input().split())
char = input()

for i in range(Q):
    l, r = (int(i) for i in input().split())
    charlist = char[(l - 1) : r]
    result = charlist.count("AC")
    print(result)

Fixed submission:
import bisect
N, Q = (int(i) for i in input().split())
char = input()
charlist = list(char)
hoge = 0
onon = []
for i in charlist:
    if char[hoge:(hoge + 2)] == "AC":
        onon.append(hoge + 1)
    hoge += 1
    if (hoge - 1) >= int(N):
        break
for i in range(Q):
    l, r = (int(i) for i in input().split())
    left = bisect.bisect_left(onon,l)
    right = bisect.bisect_left(onon,r)
    print(right - left)
Buggy python submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())
hoge = {i for i + 1 in range(M)}
for i in range(N):
    likes[i] = set()
    likes[i] = {i for i in input().split()}
    hoge &= likes[i]

c = len(hoge)

print(hoge)

Fixed submission:
N, M = (int(i) for i in input().split())
hoge = {i + 1 for i  in range(M)}

for i in range(N):
    likes = set()
    on = input().split()
    on.pop(0)
    likes = {int(j) for j in on}
    hoge &= likes


c = len(hoge)

print(c)

Buggy python submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())
hoge = set((int(i) for i + 1 in range(M)))
for i in range(N):
    likes[i] = set()
    likes[i].add((int(i) for i in input().split()))
    hoge &= likes[i]

c = len(hoge)

print(hoge)

Fixed submission:
N, M = (int(i) for i in input().split())
hoge = {i + 1 for i  in range(M)}

for i in range(N):
    likes = set()
    on = input().split()
    on.pop(0)
    likes = {int(j) for j in on}
    hoge &= likes


c = len(hoge)

print(c)
Buggy python submission (verdict: Runtime Error):
import math
S = int(input())

hoge = math.sqrt(S)
hoge = math.ceil(hoge)
onon = hoge ** 2 - S
for i in range(2, 10*9):
    if onon % i == 0:
        hogehoge = onon // i
        hogehoge2 = i
        break

print("0 0 " + str(i) + " " + str(hoge) + " " + str(hoge) + " " + str(hogehoge2))

Fixed submission:
import math
S = int(input())

hoge = math.sqrt(S)
hoge = math.ceil(hoge)
onon = hoge ** 2 - S
hogehoge = onon
hogehoge2 = 1
for i in range(2, 10*9):
    if onon % i == 0:
        hogehoge = onon // i
        hogehoge2 = i
        break

print("0 0 " + str(hogehoge) + " " + str(hoge) + " " + str(hoge) + " " + str(hogehoge2))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect_left(result,S[i])
    if hoge == 0:
        result = [S[i]] + result
    else:
        result[hoge - 1] = S[i]
print(len(result))

Fixed submission:
import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect(result,S[i])
    if hoge == len(result):
        result.append(S[i])
    else:
        result[hoge] = S[i]
print(len(result))

Buggy python submission (verdict: Runtime Error):
import bisect

N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect_left(result,S[i])
    if hoge == 0:
        result = S[i] + result
    else:
        result[hoge - 1] = hoge
print(len(result))

Fixed submission:
import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect(result,S[i])
    if hoge == len(result):
        result.append(S[i])
    else:
        result[hoge] = S[i]
print(len(result))

Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = 0

while onon < N:
    result += 1
    hoge = S.pop(0)
    onon = 0
    for j in range(len(S)):
        if S[onon] > hoge:
            S.pop(onon)
        else:
            onon + 1
print(result)

Fixed submission:
import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect(result,S[i])
    if hoge == len(result):
        result.append(S[i])
    else:
        result[hoge] = S[i]
print(len(result))

Buggy python submission (verdict: Time Limit Exceeded):
N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = 0

for i in range(N):
    if S[i] >= 0:
        result += 1
        hoge = S[i]
        for j in range(i+1,N):
            if S[j] > hoge and hoge != -1:
                hoge = S[j]
                S[j] = -1 
print(result)

Fixed submission:
import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect(result,S[i])
    if hoge == len(result):
        result.append(S[i])
    else:
        result[hoge] = S[i]
print(len(result))
Buggy python submission (verdict: Runtime Error):
S = input()
S = list(S)
S.append("a")
hoge = "Good"
for i in range(4):
    if hoge[i] == hoge[i + 1]:
        hoge = "Bad"

print(hoge)

Fixed submission:
S = input()
S = list(S)
S.append("a")
hoge = "Good"
for i in range(4):
    if S[i] == S[i + 1]:
        hoge = "Bad"

print(hoge)
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = "True"
s = sorted(s, key=lambda s:s[1])
for i in s:
    time += s[0]
    if time > s[1]:
        hoge = "No" 
        break

print(hoge)

Fixed submission:
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
time = 0
hoge = "Yes"
s = sorted(s, key=lambda s:s[1])
for i in s:
    time += i[0]
    if time > i[1]:
        hoge = "No" 
        break

print(hoge)
Buggy python submission (verdict: Runtime Error):
N,x = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    if i != N:
        D += L[i]
print(result)

Fixed submission:
N,X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    if i != N:
        D += L[i]
print(result)

Buggy python submission (verdict: Runtime Error):
N,x = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    D += L[i]
print(result)

Fixed submission:
N,X = (int(i) for i in input().split())
L = [int(i) for i in input().split()] 
result = 0
D = 0
for i in range(N + 1):
    if D <= X:
        result += 1
    if i != N:
        D += L[i]
print(result)
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
W = [int(i) for i in input().split()] 


W,H,x,y = (int(i) for i in input().split())
hoge = 0
if W//2 == x and H // 2 == y:
    hoge = 1

print(str(W*H//2) +" " + str(hoge))

Fixed submission:
W,H,x,y = (int(i) for i in input().split())
hoge = 0
if W / 2 == x and H / 2 == y and H > 0 and W > 0:
    hoge = 1

print(str(W*H/2) +" " + str(hoge))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
if N >= 2:
    print(N - K)
elif:
    print(0)

Fixed submission:
N, K = map(int, input().split())
if K >= 2:
    print(N - K)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = []
import collections

for i in s:
    for k in s:
        if k != i:
            hoge1 = (i[0] - k[0],i[1] - k[1])
            if hoge1[0] < 0:
                hoge1 = (k[0] - i[0],k[1] - i[1])
            hoge.append(hoge1)

c = collections.Counter(hoge)

print(N - c.most_common()[0][1] // 2)

Fixed submission:
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = []
import collections

for i in s:
    for k in s:
        if k != i:
            hoge1 = (i[0] - k[0],i[1] - k[1])
            if hoge1[0] <= 0:
                hoge1 = (k[0] - i[0],k[1] - i[1])
            if hoge1[0] == 0 and hoge1[1] <= 0:
                hoge1 = (k[0] - i[0],i[1] - k[1])
            hoge.append(hoge1)
if len(hoge) >= 1:
	c = collections.Counter(hoge)
	print(N - c.most_common()[0][1] // 2)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = []
import collections

for i in s:
    for k in s:
        if k != i:
            hoge1 = (i[0] - k[0],i[1] - k[1])
            if hoge1[0] < 0:
                hoge1 = hoge1 * -1
            hoge.append(hoge1)

c = collections.Counter(hoge)
print(N - c.most_common()[0][1] // 2)

Fixed submission:
N = input()
N = int(N)
s = [[ int(i) for i in input().split()] for i in range(N)]
hoge = []
import collections

for i in s:
    for k in s:
        if k != i:
            hoge1 = (i[0] - k[0],i[1] - k[1])
            if hoge1[0] <= 0:
                hoge1 = (k[0] - i[0],k[1] - i[1])
            if hoge1[0] == 0 and hoge1[1] <= 0:
                hoge1 = (k[0] - i[0],i[1] - k[1])
            hoge.append(hoge1)
if len(hoge) >= 1:
	c = collections.Counter(hoge)
	print(N - c.most_common()[0][1] // 2)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = [int(i) for i in input().split()] 
onon = 0
hoge = sum(W)
for i in range(N):
    onon += W[0]:
    hoge -= W[0]:
    result = abs(onon - hoge)
    if result <= nowresult:
        nowresult = result
print(nowresult)


Fixed submission:
N = int(input())
W = [int(i) for i in input().split()] 
onon = 0
hoge = sum(W)
nowresult = sum(W)
for i in range(N):
    onon += W[i]
    hoge -= W[i]
    result = abs(onon - hoge)
    if result <= nowresult:
        nowresult = result
print(nowresult)
Buggy python submission (verdict: Runtime Error):
N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D:
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
    

Fixed submission:
N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)

Buggy python submission (verdict: Runtime Error):
N = input()
N = int(N)
N,K = (int(i) for i in input().split())
s = [[ i for i in input().split()] for i in range(N)]


N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(len(S)-1):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(len(S)-1):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B,D-2):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
    

Fixed submission:
N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = (int(i) for i in input().split())
e = [[int(i) for i in input().split()] for i in range(M)]
hoge = set()

zenbu = {int(i + 1) for i in range(N)}

for i in e:
    konkaino = {int(i) for i in range(i[0],i[1] + 1)}
    zenbu = zenbu & konkaino


print(len(zenbu))

Fixed submission:
N,M = (int(i) for i in input().split())
e = [[int(i) for i in input().split()] for i in range(M)]

right = N
left = 0

for i in e:
    if left < i[0]:
        left = i[0]
    if right > i[1]:
        right = i[1]
if right >= left:
    print(right - left + 1)
else:
    print("0")

Buggy python submission (verdict: Runtime Error):
N,M = (int(i) for i in input().split())
e = [[int(i) for i in input().split()] for i in range(M)]
hoge = set()

zenbu = {int(i + 1) for i in range(N)}

for i in e:
    konkaino = {int(i) for i in range(e[0],e[1] + 1)}
    zenbu = zenbu & konkaino


print(len(zenbu))

Fixed submission:
N,M = (int(i) for i in input().split())
e = [[int(i) for i in input().split()] for i in range(M)]

right = N
left = 0

for i in e:
    if left < i[0]:
        left = i[0]
    if right > i[1]:
        right = i[1]
if right >= left:
    print(right - left + 1)
else:
    print("0")
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    elif S[-1] == "A":
        A += 1




if ABAB >= 1:
    onon = onon + ABAB - 1

if A >= 1:
    onon += 1
if B >= 1:
    onon += 1



print(result + onon)


Fixed submission:
N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0
onon = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    elif S[-1] == "A":
        A += 1

if ABAB >= 1:
    onon = onon + ABAB - 1

if A >= 1 and ABAB >= 1 :
    onon += 1
    A -= 1
if B >= 1 and ABAB >= 1 :
    onon += 1
    B -= 1

if A >= 1 and B >= 1:
    if A >= B:
        onon += B
    else:
        onon += A


print(result + onon)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    else S[-1] == "A":
        A += 1


if A >= B:
    onon = B
    amari = A - B
else:
    onon = A
    amari = B - A

if ABAB >= 1:
    onon = onon + ABAB - 1

if amari >= 1:
    onon = onon + 1

print(result + onon)

Fixed submission:
N = int(input())
s = []

result = 0
ABAB = 0
A = 0
B = 0
onon = 0

amari = 0
for i in range(N):
    s.append(input())

for S in s:
    AB = S.count("AB")
    result += AB
    if S[0] == "B" and S[-1] == "A":
        ABAB += 1
    elif S[0] == "B":
        B += 1
    elif S[-1] == "A":
        A += 1

if ABAB >= 1:
    onon = onon + ABAB - 1

if A >= 1 and ABAB >= 1 :
    onon += 1
    A -= 1
if B >= 1 and ABAB >= 1 :
    onon += 1
    B -= 1

if A >= 1 and B >= 1:
    if A >= B:
        onon += B
    else:
        onon += A


print(result + onon)
Buggy python submission (verdict: Runtime Error):
N = input()
s = input()
hoge = []
charlist = list(s)
result = 1
Alist = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"]
for i in Alist:
    hoge.append(charlist.count(i))
for j in hoge:
    result = result * (j + 1)
print((result -1) ¥ (10 ** 9 + 7))


Fixed submission:
N = input()
s = input()
hoge = []
charlist = list(s)
result = 1
Alist = ["q","w","e","r","t","y","u","i","o","p","a","s","d","f","g","h","j","k","l","z","x","c","v","b","n","m"]
for i in Alist:
    hoge.append(charlist.count(i))
for j in hoge:
    result = result * (j + 1)
print((result -1) % (10 ** 9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
import copy
import numpy as np

N = int(input())
A = []
B = []

for _ in range(N):
    putin = int(input())
    A.append(putin)
    B.append(putin)

for i in range(N):
    A = copy.deepcopy(B)
    del A[i]
    print(np.max(A))

Fixed submission:

import numpy as np

N = int(input())
A = []
B = []

for _ in range(N):
    putin = int(input())
    A.append(putin)
    B.append(putin)

MAX = int(np.max(A))
A.remove(MAX)
MAX2 = int(np.max(A))

for i in range(N):
    if B[i] == MAX:
        print(MAX2)
    
    else:
        print(MAX)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())
A = []
B = []

for _ in range(N):
    putin = int(input())
    A.append(putin)
    B.append(putin)

for i in range(N):
    A = copy.deepcopy(B)
    del A[i]
    print(max(A))

Fixed submission:

import numpy as np

N = int(input())
A = []
B = []

for _ in range(N):
    putin = int(input())
    A.append(putin)
    B.append(putin)

MAX = int(np.max(A))
A.remove(MAX)
MAX2 = int(np.max(A))

for i in range(N):
    if B[i] == MAX:
        print(MAX2)
    
    else:
        print(MAX)
Buggy python submission (verdict: Runtime Error):
n=int(input()).split(" ")
A=n[0]
B=n[1]
T=n[2]

bis=int((T+0.5)/A)*B

Fixed submission:
n=input().split(" ")
A=int(n[0])
B=int(n[1])
T=int(n[2])
 
bis=int((T+0.5)/A)*B
print(bis)
Buggy python submission (verdict: Runtime Error):
from sys import exit, setrecursionlimit, stdin, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import *
from heapq import *
import operator
import math
from fractions import gcd
from random import randint

setrecursionlimit(10**8)

def input():
  return stdin.readline().strip()

def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

N, K = reads()
A = reads()

skip = [-1] * N
first_occ = {}
for i in range(N-1, -1, -1):
  a = A[i]
  if a in first_occ:
    if first_occ[a] < N-1:
      skip[i] = skip[first_occ[a] + 1]
    else:
      skip[i] = first_occ[a] + 1
  else:
    skip[i] = i
  first_occ[a] = i

back = [first_occ[A[i]] + 1 for i in range(N)] + [0]
next_state = [skip[back[q]] for q in range(N+1)]


q = skip[0]

rev = {}
memo = {}
i = 0
while True:
  if q in rev:
    j = rev[q]
    break
  rev[q] = i
  memo[i] = q
  q = next_state[q]
  i += 1

m = i - j
q = memo[j + (K - 1 - j) % m]

s = []
while q < N:
  if skip[q] == q:
    s.append(A[q])
    q += 1
  else:
    q = skip[q]

print(*s)

Fixed submission:
from sys import exit, setrecursionlimit, stdin, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import *
from heapq import *
import operator
import math
from fractions import gcd
from random import randint

setrecursionlimit(10**8)

def input():
  return stdin.readline().strip()

def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]

N, K = reads()
A = reads()

skip = [-1] * (N + 1)
first_occ = {}
for i in range(N-1, -1, -1):
  a = A[i]
  if a in first_occ:
    if first_occ[a] < N-1:
      skip[i] = skip[first_occ[a] + 1]
    else:
      skip[i] = first_occ[a] + 1
  else:
    skip[i] = i
  first_occ[a] = i
skip[N] = N

back = [first_occ[A[i]] + 1 for i in range(N)] + [0]
next_state = [skip[back[q]] for q in range(N+1)]


q = skip[0]

rev = {}
memo = {}
i = 0
while True:
  if q in rev:
    j = rev[q]
    break
  rev[q] = i
  memo[i] = q
  q = next_state[q]
  i += 1

m = i - j
q = memo[j + (K - 1 - j) % m]

s = []
while q < N:
  if skip[q] == q:
    s.append(A[q])
    q += 1
  else:
    q = skip[q]

print(*s)
Buggy python submission (verdict: Runtime Error):
x, y = list(map(input().split(), int))
print(x + y//2)

Fixed submission:
x, y = list(map(int, input().split()))
print(x+y//2)
Buggy python submission (verdict: Runtime Error):
ソースコード
N=int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
temp = [abs(1000*T - 6*x - 1000*A) for x in H]
m = min(temp)
i = temp.index(m)
print(i+1)

Fixed submission:
N=int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
temp = [abs(1000*T - 6*x - 1000*A) for x in H]
m = min(temp)
i = temp.index(m)
print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

K, N = reads()
MOD = 998244353

MAXN = 5000

fact = [1] * MAXN
for i in range(1, MAXN): fact[i] = (fact[i-1] * i) % MOD
invfact = [0] * MAXN; invfact[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(MAXN-2, -1, -1): invfact[i] = invfact[i+1] * (i+1) % MOD
def comb(n, k):
  return fact[n] * invfact[n-k] * invfact[k] % MOD if 0 <= k <= n else 0
def h(n, k):
  return comb(n+k-1, n) if k >= 1 else 0

def solve(n, k, u):
  ans = 0
  for q in range(u+1):
    s = 2**(u-q) * h(n-u+q, k-q-u)
    # print(n, k, u, q, s)
    ans = (ans + comb(u, q) * pow(2, u-q, MOD) % MOD * h(n-u+q, k-q-u)) % MOD
  return ans

for i in range(2, 2*K+1):
  u = sum(j < i-j <= K for j in range(1, K+1))
  if i % 2 == 1:
    ans = solve(N, K, u)
  else:
    ans = (solve(N, K-1, u) + solve(N-1, K-1, u)) % MOD
  print(ans)

Fixed submission:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

K, N = reads()
MOD = 998244353

MAXN = 4020

fact = [1] * MAXN
for i in range(1, MAXN): fact[i] = (fact[i-1] * i) % MOD
invfact = [0] * MAXN; invfact[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(MAXN-2, -1, -1): invfact[i] = invfact[i+1] * (i+1) % MOD
def comb(n, k):
  return fact[n] * invfact[n-k] * invfact[k] % MOD if 0 <= k <= n else 0
def h(n, k):
  return comb(n+k-1, n)

def solve(n, k, u):
  ans = 0
  for q in range(u+1):
    ans = (ans + comb(u, q) * pow(2, u-q, MOD) % MOD * h(n-u+q, k-q-u)) % MOD
  return ans

anss = [0] * (2*K+1)
for i in range(2, K+2):
  u = sum(j < i-j <= K for j in range(1, K+1))
  if i % 2 == 1:
    ans = solve(N, K, u)
  else:
    ans = (solve(N, K-1, u) + solve(N-1, K-1, u)) % MOD
  anss[i] = ans
  print(ans)

for j in range(K+2, 2*K+1):
  print(anss[2*K - j + 2])