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

Fixed submission:
import math
from queue import PriorityQueue
from sys import stdin,stdout
from collections import defaultdict

def solve():
    n=int(input())
    ans=[0 for _ in range(200050)]
    for i in range(1,101):
        for j in range(1,101):
            for k in range(1,101):
                v=i*i+j*j+k*k+i*j+k*j+k*i
                ans[v]+=1
    for i in range(n):
        print(ans[i+1])
    

    
    
    
def main():
    solve()
main()

Buggy submission (verdict: Runtime Error):
import math
from queue import PriorityQueue
from sys import stdin,stdout
from collections import defaultdict

def solve():
	n=int(input())
	ans=[0 for _ in range(20005)]
	for i in range(1,101):
		for j in range(1,101):
			for k in range(1,101):
				v=i*i+j*j+k*k+i*j+k*j+k*i
				ans[v]+=1
	for i in range(n):
		print(ans[i+1])
    

    
    
    
def main():
	solve()
main()

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=[0 for _ in range(10050)]
for i in range(105):
  for j in range(1,105):
    v=i*i+j*j+k*k+i*j+j*k+k*i;
    if(v<10050):
      ans[v]+=1
for i in range(n):
  print(ans[i+1])
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
try:
  p = list(map(int, input().split()))
except EOFError:
  print(100)
  exit()
old_diff = 10000
for i in range(-110, 110):
  if i in p:
    continue
  else:
    diff = abs(x-i)
    if diff < old_diff:
      ans = i
      old_diff = abs(x-i)

try:
  print(ans)
except:
  print()

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
try:
  p = list(map(int, input().split()))
except EOFError:
  print(100)
  exit()
old_diff = 100
for i in range(1, 101):
  if i in p:
    continue
  else:
    diff = abs(x-i)
    if diff < old_diff:
      ans = i
      old_diff = abs(x-i)
print(ans)
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

R = [False]*(N+1)
D = []
p = 1
while True:
    if R[p]:
        break
    D.append(p)
    R[p] = True
    p = A[p-1]
m = D.index(p)
c = len(D)-m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
e = [False] * (N+1)
idx = 1
move = []
while True:
  if e[idx]:
    break
  move.append(idx)
  e[idx] = True
  idx = A[idx-1]
m = move.index(idx)
c = len(move) - m

if K <= m:
    print(D[K])
else:
    print(D[m+(K-m) % c])
Problem p02696 (python)

Fixed submission:
a, b, n = map(int, input().split())
n = min(n, b-1)
 
print(int((a * n) / b) - a * int(n / b))

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(B, N+1):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(N+1, B):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
A, B, N = map(int, input().split())
ans = []
for x in range(1, N//(10**6)+1 ):
    cal = math.floor((A*x)/B) - (int(A) * math.floor(x/B))
    ans.append(cal)
print(max(ans))
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()
ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N):
    for j in range(i + 1, N):
        k = j - i + j
        if k < N:
            if {S[i], S[j], S[k]} == {"R", "G", "B"}:
                ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
import numpy as np
ans = 0
for i in range(0, N):
    for j in range(i, N):
        if i ==j or S[i] == S[j]:
            continue
        s = ['R', 'G', 'B']
        s.remove(S[i])
        s.remove(S[j])
        k_s = np.where(np.array(list(S[j:])) == s[0])[0] + j
        for k in k_s:
            if j == k or S[j] == S[k]:
                continue
            elif j-i != k-j and S[i] != S[k]:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
S = input()
ans = 0
for i in range(0, N):
    for j in range(i, N):
        if i ==j or S[i] == S[j]:
            continue
        s = ['R', 'G', 'B']
        s.remove(S[i])
        s.remove(S[j])
        k_s = np.where(np.array(list(S[j:])) == s[0])[0] + j
        for k in k_s:
            if j == k or S[j] == S[k]:
                continue
            elif j-i != k-j and S[i] != S[k]:
                ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
ans = 0
for i in range(0, N):
    for j in range(i, N):
        if i ==j or S[i] == S[j]:
            continue
        s = ['R', 'G', 'B']
        s.remove(S[i])
        s.remove(S[j])
        k_s = np.where(np.array(list(S[j:])) == s[0])[0] + j
        for k in k_s:
            if j == k or S[j] == S[k]:
                continue
            elif j-i != k-j and S[i] != S[k]:
                ans += 1
print(ans)
Problem p02720 (python)

Fixed submission:
K = int(input())
table = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in table:
  if len(table) > K:
    break
  x = i % 10
  for j in range(max(0, x - 1), min(x + 2, 10)):
    table.append(i * 10 + j)
print(table[K-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
K = int(input())
table = ['1', '2', '3', '4', '5', '6', '7', '8', '9']
c = 9
result = []
for i in table:
  runrun = i
  if runrun[-1] == '0':
    table.extend([runrun + str(int(runrun[-1])), 
                   runrun + str(int(runrun[-1])+1)])
    c += 2
  elif runrun[-1] == '9':
    table.extend([runrun + str(int(runrun[-1])-1), 
                   runrun + str(int(runrun[-1]))])
    c += 2
  else:
    table.extend([runrun + str(int(runrun[-1])-1), 
                   runrun + str(int(runrun[-1])), 
                   runrun + str(int(runrun[-1])+1)])
    c += 3
  if c>=K:
    print(table[K-1])
    exit()
Problem p02780 (python)

Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
s = [0] * 1000000
for i in range(N):
    s[i+1] = s[i] + A[i]

max_s = 0
for i in range(N):
    if max_s < s[i+K] - s[i]:
        max_s = s[i+K] - s[i]


print((max_s+K) / 2)

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

window = sum(A[0:K])
max_s = 0
for i in range(N - K):
    window -= A[i]
    window += A[i + K]
    sum_w = sum(window)
    if sum_w > max_s:
        max_s = sum_w
print((max_s+K) / 2)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
s = [0] * 200000
for i in range(N):
    s[i+1] = s[i] + A[i]

max_s = 0
for i in range(N):
    if max_s < s[i+K] - s[i]:
        max_s = s[i+K] - s[i]


print((max_s+K) / 2)

Buggy submission (verdict: Runtime Error):
s = [0] * 200000
for i in range(N):
    s[i+1] = s[i] + A[i]

max_s = 0
for i in range(N):
    if max_s < s[i+K] - s[i]:
        max_s = s[i+K] - s[i]


print((max_s+K) / 2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
s = [0] * 200000
for i in range(N):
    s[i+1] = s[i] +A[i]

max_s = 0
for i in range(K):
    if max_s < s[i+K] - s[i]:
        max_s = s[i+K] - s[i]


print((max_s+K) / 2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = []
s = [0] * 200000
for i in range(K):
  a_k = int(input())
  s[i+1] = s[i] + a_k

max_s = 0
for i in range(K)
  if max_s < s[i+K] - s[i]:
    max_s = s[i+K] - s[i]
print(max_s)
Problem p02787 (python)

Fixed submission:
import numpy as np
H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
  ai, bi = map(int, input().split())
  A.append(ai)
  B.append(bi)

A = np.array(A)
B = np.array(B)
# process
dp = np.zeros(H+1, dtype=np.int64)
dp[0] = 0

for i in range(1, H + 1):
    dp[i] = np.amin(dp[np.maximum(i - A, 0)] + B)

# output
print(dp[H])

Buggy submission (verdict: Runtime Error):
import numpy as np
H, N = map(int, input().split())
A = []
B = []
for _ in range(N):
  ai, bi = map(int, input().split())
  A.append(ai)
  B.append(bi)

# process
dp = np.zeros(H+1, dtype=np.int64)
dp[0] = 0

for i in range(1, H + 1):
    dp[i] = np.amin(dp[np.maximum(i - A, 0)] + B)

# output
print(dp[H])
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())
a = 0
b = 0
sp = dict()
for _ in range(M):
    s, p = input().split()
    if int(s) not in sp.keys():
        sp[int(s)] = [p]
    else:
        sp[int(s)].append(p)
        
a = 0
b = 0
for i, result in sp.items():
    if "AC" in result:
        a += 1
        b += result.index("AC")
    else:
        continue
print(a, b)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = 0
b = 0
sp = dict()
correct = []
wrong = dict()
for _ in range(M):
    s, p = input().split()
    if not s in sp.keys():
        if p == "AC":
            a +=1
            correct.append(s)
        else:
            wrong[s] = 1
        sp[s] = p
    else:
        if sp[s] == "AC":
            continue
        else:
            if p == "AC":
                a += 1
                correct.append(s)
            else:
                wrong[s] = 1
            sp[s] = p
for c in set(correct):
    b += wrong[c]
print(a, b)
Problem p02848 (python)

Fixed submission:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
l = [] 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        w = a[b]
    else:
        w = a[b-26]
    l.append(w)
print("".join(l))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
a = []
s_list = list(s)
for i in range(len(s)):
    if i + 1 < len(s) - n: 
        w = s_list[i + n]
    else:
        w = s_list[i + n - len(s)]
    a.append(w)
print("".join(a))
Problem p03085 (python)

Fixed submission:
char = input()
if char == "A":
    char2 = "T"
elif char == "T":
    char2 = "A"
elif char == "G":
    char2 = "C"
elif char == "C":
    char2 = "G"
print(char2)

Buggy submission (verdict: Runtime Error):
N, Q= input().split(" ")
S = input()
index_list_all = []
for i in range(int(Q)):
    lQ, rQ = input().split(" ")
    index_list_all.append([int(lQ), int(rQ)])

for index_list in index_list_all:
    print(len(S[index_list[0] - 1: index_list[1]].split("AC")) - 1)

Buggy submission (verdict: Runtime Error):
seq = input()
seq_list = []
for char in seq :
    if char == "A":
        char2 = "T"
    elif char == "T":
        char2 = "A"
    elif char == "G":
        char2 = "C"
    elif char == "C":
        char2 = "G"
    seq_list.append(char2)
return("".join(seq_list))

Buggy submission (verdict: Runtime Error):
seq = input()
seq_list = []
for char in seq :
    if char == "A":
        char2 = "T"
    elif char == "T":
        char2 = "A"
    elif char == "G":
        char2 = "C"
    elif char == "C":
        char2 = "G"
    seq_list.append(char2)
return("".join(seq_list))
Problem p03455 (python)

Fixed submission:
input_value = input()
a, b = input_value.split()
if int(a) * int(b) % 2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
input_value = Input()
a, b = input_value.split()
if a * b // 2:
  print("Even")
else:
  print("Odd")
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
done = False
for i in range(N+1):
  a = i
  for j in range(N+1-a):
    b = j
    c = N -i -j
    sum = 10000*a + 5000 * b + 1000 *c
    if sum == Y:
      done = True
      print(a, b, c)
  if done:
    break
        
if not done:
  print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
done = False
for i in range(N+1):
  a = i
  for j in (N+1-a):
    b = j
    c = N -i -j
    sum = 10000*a + 5000 * b + 1000 *c
    if sum == Y:
      done = True
      print(a, b, c)
if not done:
  print(-1, -1, -1)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A, B =map(int,input())
print(A*B)
Problem p02658 (python)

Fixed submission:
N =int(input())
A_n =list(map(int,input().split()))
ans =1
i = 0

while ans <= 10**18 and i < N:
  ans *= A_n[i]
  i +=1
if ans > 10**18:
  if 0 in A_n:
    print(0)
  else:
    print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N =int(input())
A_n =list(map(int,input().split()))
ans =1
i = 0

while ans <= 10**18 and i < N:
  ans *= A_n[i]
  i +=1
if ans > 10**18:
  elif 0 in A_n is False:
    print(-1)
  else:
    print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N =int(input())
A_n =list(map(int,input().split()))
ans =1
i = 0

while ans <= 10**18 and i < N:
  ans *= A_n[i]
  i +=1
if ans > 10**18:
  elif "0" in A_n is False:
    print(-1)
  else:
    print(0)
else:
  print(ans)
Problem p02718 (python)

Fixed submission:
N , M =map(int,input().split())
A_n =list(map(int,input().split()))

B_n=sorted(A_n,reverse=True)

if B_n[M-1] >= sum(B_n)/(4*M) :
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n,reverse=True)
i =0
count = M
while B_n[i] >= sum(B_n)/(4*M) and count>0:
    i +=1
    count -=1
if count == 0:
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n)
i =0
count =N
while B_n[i] < sum(B_n)/(4*M) and i<=N-1:
    i +=1
    count -=1
if count >= M:
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n)
i =0
count =len(B_n)
while B_n[i] < sum(B_n)/(4*M) and i-1<=len(B_n):
    i +=1
    count -=1
if count >= M:
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n)
i =0
count =len(B_n)
while B_n[i] < sum(B_n)/(4*M) and i<=len(B_n):
    i +=1
    count -=1
if count >= M:
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n)
i =0
count =len(B_n)
while B_n[i] < sum(B_n)/(4*M):
    i +=1
    count -=1
if count >= M:
    print('Yes')
else:
    print('No')

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

B_n=sorted(A_n,reverse =True)
i =0
count =0
while B_n[i] >= sum(B_n)/(4*M):
    i +=1
    count +=1
if count >= M:
    print('Yes')
else:
    print('No')
Problem p02732 (python)

Fixed submission:
N = int(input())
A_n = list(map(int,input().split()))

count =[0 for i in range(N)]
for i in range(N):
    count[A_n[i]-1] +=1
ans =[count[i]*(count[i]-1)//2 for i in range(N)]
a1=sum(ans)
for i in range(N):
    print(a1-count[A_n[i]-1]+1)

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

count =[0 for i in range(N)]
for i in range(N):
    count[A_n[i]] +=1
ans =[count[i]*(count[i]-1)//2 for i in range(N)]

for i in range(N):
    count[A_n[i]] -= 1
    ans =[count[i]*(count[i]-1)//2 for i in range(N)]
    print(sum(ans))
    count[A_n[i]] += 1
Problem p03478 (python)

Fixed submission:
lis=list(map(int,input().split()))
N ,A, B= lis[0],lis[1],lis[2]

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/1000
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
list =[int(input()) for i in range(3)]
N ,A, B= list[0],list[1],list[2]

ans = 0
for i in range(1,N+1):
    i1 =  i%10
    i10 = (i%100 -i1)/10
    i100 = (i%1000 -i1 - 10*i10)/100
    i1000 = (i%10000 -i1 - 10*i10-100*i100)/100
    i10000 = (i -i1 -10*i10 -100*i100 - 1000*i1000)/10000
    if A<=i1+i10+i100+i1000+i10000<=B:
        ans +=1
print(ans)
Problem p02630 (python)

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

num_A = [0 for i in range(10**5+1)]
first = 0

for a in A:
    num_A[a] += 1
    first += a

for i in range(Q):
    b, c = map(int, input().split())
    first += c*num_A[b]
    first -= b*num_A[b]
    num_A[c] += num_A[b]
    num_A[b] = 0
    print(first)

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

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

num_A = [A.count(i) for i in range(10**5)]

for i in range(Q):
    b, c = map(int, input().split())
    num_A[c] += num_A[b]
    num_A[b] = 0
    print(sum(np.array(num_A)*np.array([j for j in range(10**5)])))

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

N = int(input())
A = list(map(int, input().split()))
Q = int(input())

num_A = [A.count(i) for i in range(10)]

for i in range(Q):
    b, c = map(int, input().split())
    num_A[c] += num_A[b]
    num_A[b] = 0
    print(sum(np.array(num_A)*np.array([j for j in range(10)])))
Problem p02639 (python)

Fixed submission:
X = list(map(int, input().split()))
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

#K = int(input())
#S = input()

##一次元配列の初期化
#a=[0]*5
#[i for i in range(100) if i%2==1] #奇数のみ
##二次元配列の初期化
#[[float("inf") for i in range(N)] for i in range(N)]

for i in range(len(X)):
    if X[i] == 0:
        break
    

print(i+1)

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

N = int(input())
A = list(map(int, input().split()))
A.sort()#わるほう

kouho = sorted([x for x in set(A) if A.count(x) == 1])
#maxA = 10**5

#target = kouho[:]
maxA = A[-1]
work=[0]*(A[-1]+1)

for i in range(len(A)):
    maxN = int(maxA/A[i])
    for n in range(1,maxN+1):
        buf = A[i]*n
        #remove_list.append(buf)
        work[buf]+=1
            #print(A[i]*n)
#target = kouho[:]
#kouho = list(set(kouho) - set(remove_list))

sm=0
for s in A:
    if work[s]==1: sm+=1
print(sm)

#print(len(kouho))

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

N = int(input())
A = list(map(int, input().split()))
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

#K = int(input())
#S = input()

##一次元配列の初期化
#a=[0]*5
#[i for i in range(100) if i%2==1] #奇数のみ
##二次元配列の初期化
#mod = np.array([[-1 for i in range(N)] for i in range(N)])
#A = list(set(A))
A = sorted(A)#わるほう

kouho = [x for x in set(A) if A.count(x) == 1]
target = list(kouho.copy())
            
for i in range(len(A)):
    if target == []:
        break
    maxN = int(max(target)/A[i])
    for n in range(2,maxN+1):
        if A[i]*n in kouho:
            kouho.remove(A[i]*n)
            #print(A[i]*n)
target = list(kouho.copy())
        
print(len(target))

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

N = int(input())
A = list(map(int, input().split()))
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

#K = int(input())
#S = input()

##一次元配列の初期化
#a=[0]*5
#[i for i in range(100) if i%2==1] #奇数のみ
##二次元配列の初期化
#mod = np.array([[-1 for i in range(N)] for i in range(N)])
#A = list(set(A))
A = sorted(A)#わるほう

kouho = list(A.copy())#わられるほう
target = sorted(list(set(A)))

kouho = [x for x in set(A) if A.count(x) == 1]
target = [x for x in set(A) if A.count(x) == 1]
            
for i in range(len(A)):
    if target == []:
        break
    maxN = int(max(target)/A[i])
    for n in range(2,maxN+1):
        if A[i]*n in kouho:
            kouho.remove(A[i]*n)
            #print(A[i]*n)
    target = list(kouho.copy())
        
print(len(target))
Problem p02641 (python)

Fixed submission:
#import numpy as np
#import math

X, N = map(int, input().split())
if N != 0:
    P = list(map(int, input().split()))
    # a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
    # c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
    # s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
    
    #K = int(input())
    #S = input()
    
    ##一次元配列の初期化
    #a=[0]*5
    #[i for i in range(100) if i%2==1] #奇数のみ
    ##二次元配列の初期化
    #[[float("inf") for i in range(N)] for i in range(N)]
    
    for diff in range(0,102):
        if X-diff not in P:
            print(X-diff)
            break
        elif X+diff not in P:
            print(X+diff)
            break
else:
    print(X)

Buggy submission (verdict: Runtime Error):

X, N = map(int, input().split())
if N != 0:
    P = list(map(int, input().split()))
    # a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
    # c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
    # s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
    
    #K = int(input())
    #S = input()
    
    ##一次元配列の初期化
    #a=[0]*5
    #[i for i in range(100) if i%2==1] #奇数のみ
    ##二次元配列の初期化
    #[[float("inf") for i in range(N)] for i in range(N)]
    
    for diff in range(0,102):
        if X-diff not in P:
            print(X-diff)
            break
        elif X+diff not in P:
            print(X+diff)
            break
else:
    print(N)
#import numpy as np
#import math

X, N = map(int, input().split())
if N != 0:
    P = list(map(int, input().split()))
    # a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
    # c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
    # s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき
    
    #K = int(input())
    #S = input()
    
    ##一次元配列の初期化
    #a=[0]*5
    #[i for i in range(100) if i%2==1] #奇数のみ
    ##二次元配列の初期化
    #[[float("inf") for i in range(N)] for i in range(N)]
    
    for diff in range(0,102):
        if X-diff not in P:
            print(X-diff)
            break
        elif X+diff not in P:
            print(X+diff)
            break
else:
    print(X)
Problem p02675 (python)

Fixed submission:
N = int(input())
 
ichinokurai = N%10
 
if ichinokurai in [2,4,5,7,9]:
    print('hon')
elif ichinokurai in [0,1,6,8]:
    print('pon')
elif ichinokurai in [3]:
    print('bon')

Buggy submission (verdict: Runtime Error):
import numpy as np
#, K = map(int, input().split())
#S = input()
N = int(input())

ichinokurai = N%10

if ichinokurai in [2,4,5,7,9]:
    print('hon')
elif ichinokurai in [0,1,6,8]:
    print('pon')
elif ichinokurai in [3]:
    print('bon')
Problem p02708 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import numpy as np
#import math
import itertools


#N= int(input())
N, K = map(int, input().split())
l = [i for i in range(N+1)]

count = 0
if K == N+1:
    max_sum = np.sum(l[1:])
elif K == 1:
    max_sum = 0
else:
    max_sum = np.sum(l[-K+1:])

if K == 1:
    min_sum = 0
else:
    min_sum = np.sum(l[:K-1])

#print(max_sum)
#print(min_sum)
#print(l)

for k in range(K,N+2):
    max_sum += l[-k]
    min_sum += l[k-1]
    #print(max_sum, min_sum)
    count += (max_sum-min_sum+1)%((10**9)+7)
    
print(count%((10**9)+7))
#count = 0
#for k in range(K, N+1):
#    count += 
#141421 35623

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import numpy as np
#import math
import itertools


#N= int(input())
N, K = map(int, input().split())
l = [i for i in range(N+1)]

count = 0
for k in range(K,N+2):
    max_sum = sum(l[-k:])
    min_sum = sum(l[:k])
    #print(max_sum-min_sum+1)
    count += max_sum-min_sum+1
    
print(count)
#count = 0
#for k in range(K, N+1):
#    count +=