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

Fixed submission:
n,s=map(int, input().split())
N=[]
for _ in range(n):
    N.append(int(input()))
N=sorted(N)
diff_list=[]
for i in range(s-1,len(N)):
    diff_list.append(N[i]-N[i-s+1])
print(min(diff_list))

Buggy submission (verdict: Runtime Error):
n,s=map(int, input().split())
N=[]
for _ in range(n):
    N.append(int(input()))
N=sorted(N)
for i in range(s-1,len(N)):
    diff_list.append(N[i]-N[i-s+1])
print(min(diff_list))
Problem p03250 (python)

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

A=10*a+b+c
B=a+10*b+c
C=a+b+10*c
print(max(A,B,C))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int, input())

A=10*a+b+c
B=a+10*b+c
print(max(A,B))
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
count=0
z=0
for x in range(k+1):
    for y in range(k+1):
        z=s-x-y
        if(0<=z)&(z<=k):
            count+=1
            
print(count)

Buggy submission (verdict: Runtime Error):
k,s=map(int, input().split())

count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(k+1):
        	if x+y+z=s:
            count+=1
print(count)

Buggy submission (verdict: Runtime Error):
k,s=map(int, input().split())
x+y+z=s
count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(k+1):
        	if x+y+z=s:
            count+=1
print(count)

Buggy submission (verdict: Runtime Error):
k,s=map(int, input().split())
x+y+z=s
count=0
for x in range(k+1):
	for y in range(k+1):
    	for z in range(z+1):
        	if x+y+z=s:
            count+=1
print(count)
Problem p02777 (python)

Fixed submission:
S, T = input().split()
A, B = input().split()
U = input()

print("{} {}".format(int(A) - (1 if S == U else 0), int(B) - (1 if T == U else 0)))

Buggy submission (verdict: Runtime Error):
S, T = input().split()
A, B = input().split()
U = input()

print(f"{int(A) - 1 if S == U else 0} {int(B) - 1 if T == U else 0}")
Problem p02773 (python)

Fixed submission:
N=int(input())
a=[]
b=0
for i in range(N):
	a.append(input())
d={}
sor={}
for i in range(N):
    if a[i] in d.keys():
        d[a[i]]+=1
    else:
        d.setdefault(a[i],1)
        b+=1
sod = sorted(d.keys())
#max=sod["a[0]"]
maxval=0
for i in range(N):
    if maxval<=d[a[i]]:
        maxval=d[a[i]]
for i in range(b):
    if maxval==d[sod[i]]:
        print(sod[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for i in range(N):
	a.append(input())
d={}
sor={}
for i in range(N):
    if a[i] in d.keys():
        d[a[i]]+=1
    else:
        d.setdefault(a[i],1)
sod = sorted(d.keys())
#max=sod["a[0]"]
maxval=0
for i in range(N):
    if maxval<=d[a[i]]:
        maxval=d[a[i]]
for i in range(N):
    if maxval==d[sod[i]]:
        print(sod[i])
Problem p02777 (python)

Fixed submission:
import sys

msg = sys.stdin.readlines()
lines = list()

for item in msg:
    if " " in item:
        s, t = item.split()
        lines.append(s)
        lines.append(t)
    else:
        item = item.replace('\n','')
        lines.append(item)

a = int(lines[2])
b = int(lines[3])

if lines[4] == lines[0]:
    a = a - 1
elif lines[4] == lines[1]:
    b = b - 1

print("{0} {1}".format(a, b))

Buggy submission (verdict: Runtime Error):
inputs = list(map(str,input().split()))

a = int(inputs[2])
b= int(inputs[3])

if inputs[4] == inputs[0]:
  a = a - 1
elif inputs[4] == inputs[1]:
  b = b - 1

print("{0} {1}".format(a, b))
Problem p02970 (python)

Fixed submission:
import math
n, d = map(int, input().split())
print(math.ceil(n/(2*d+1)))

Buggy submission (verdict: Runtime Error):
import math
n, d = map(int, input().split())
print(math.ceil)(n/(2*d+1))
Problem p03013 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

n, m = map(int, input().split(' '))
steps = [int(input()) for _ in range(m)]

def stepcmb(st):
    memo = [0]*(st+1)
    memo[0] = 1
    def _fib(st):
        if st <= 1:
            return 1
        if memo[st] != 0:
            return memo[st]
        memo[st] = _fib(st-1) + _fib(st-2)
        return memo[st]
    return _fib(st)

if m >= 2:
    for i in range(1, m):
        if steps[i] - steps[i-1] == 1:
            print(0)
            exit()

res = 1
nowstep = 0
for i in range(m):
    res *= stepcmb(steps[i]-nowstep-1) % (10**9+7)
    nowstep = steps[i] + 1
res = (res * stepcmb(n-nowstep)) % (10**9+7)

print(res)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
steps = [int(input()) for _ in range(m)]

def stepcmb(st):
    memo = [0]*(st+1)
    memo[0] = 1
    def _fib(st):
        if st <= 1:
            return 1
        if memo[st] != 0:
            return memo[st]
        memo[st] = _fib(st-1) + _fib(st-2)
        return memo[st]
    return _fib(st)

if m >= 2:
    for i in range(1, m):
        if steps[i] - steps[i-1] == 1:
            print(0)
            exit()

res = 1
nowstep = 0
for i in range(m):
    res *= stepcmb(steps[i]-nowstep-1) % (10**9+7)
    nowstep = steps[i] + 1
res = (res * stepcmb(n-nowstep)) % (10**9+7)

print(res)
Problem p03017 (python)

Fixed submission:
import copy
n,a,b,c,d=map(int, input().split())
S='.'+input()
dpa=[0]*(n+1)
dpb=[0]*(n+1)
seta=[c]
setb=[d]
if d<c:
    if S[b-1:d+2].find('...')>=0:
        while seta:
            i = seta.pop()
            if i>0 and S[i-1]=='.' and dpa[i-1]==0:
                dpa[i-1]=1
                seta.append(i-1)
            if i>1 and S[i-2]=='.' and dpa[i-2]==0:
                dpa[i-2]=1
                seta.append(i-2)
        while setb:
            i = setb.pop()
            if i>0 and S[i-1]=='.' and dpb[i-1]==0:
                dpb[i-1]=1
                setb.append(i-1)
            if i>1 and S[i-2]=='.' and dpb[i-2]==0:
                dpb[i-2]=1
                setb.append(i-2)
else:
    while setb:
        i = setb.pop()
        if i>0 and S[i-1]=='.' and dpb[i-1]==0:
            dpb[i-1]=1
            setb.append(i-1)
        if i>1 and S[i-2]=='.' and dpb[i-2]==0:
            dpb[i-2]=1
            setb.append(i-2)
    while seta:
        i = seta.pop()
        if i>0 and S[i-1]=='.' and dpa[i-1]==0:
            dpa[i-1]=1
            seta.append(i-1)
        if i>1 and S[i-2]=='.' and dpa[i-2]==0:
            dpa[i-2]=1
            seta.append(i-2)
if dpa[a]==1 and dpb[b]==1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n,a,b,c,d=map(int, input().split())
S='.'+input()
dpa=[0]*(n+1)
dpb=[0]*(n+1)
seta=[c]
setb=[d]
if d<c:
    if S[b-1:d+2].find('...')>0:
        index = S[b-1:d+2].find('...')
        S[index+1]='#'
        while seta:
            i = seta.pop()
            if i>0 and S[i-1]=='.' and dpa[i-1]==0:
                dpa[i-1]=1
                seta.append(i-1)
            if i>1 and S[i-2]=='.' and dpa[i-2]==0:
                dpa[i-2]=1
                seta.append(i-2)
        S[index+1]='.'
        while setb:
            i = setb.pop()
            if i>0 and S[i-1]=='.' and dpb[i-1]==0:
                dpb[i-1]=1
                setb.append(i-1)
            if i>1 and S[i-2]=='.' and dpb[i-2]==0:
                dpb[i-2]=1
                setb.append(i-2)

else:
    while setb:
        i = setb.pop()
        if i>0 and S[i-1]=='.' and dpb[i-1]==0:
            dpb[i-1]=1
            setb.append(i-1)
        if i>1 and S[i-2]=='.' and dpb[i-2]==0:
            dpb[i-2]=1
            setb.append(i-2)
    while seta:
        i = seta.pop()
        if i>0 and S[i-1]=='.' and dpa[i-1]==0:
            dpa[i-1]=1
            seta.append(i-1)
        if i>1 and S[i-2]=='.' and dpa[i-2]==0:
            dpa[i-2]=1
            seta.append(i-2)
if dpa[a]==1 and dpb[b]==1:
    print('Yes')
else:
    print('No')
Problem p03033 (python)

Fixed submission:
from bisect import bisect_left
N, Q = map(int, input().split())
consts = []
for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t))
consts.sort()
D=[int(input()) for _ in range(Q)]
ans=[-1]*Q
jump=[-1]*Q
for x,s,t in consts:
    left=bisect_left(D,s-x)
    right=bisect_left(D,t-x)
    while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left]
print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
#ref : https://atcoder.jp/contests/abc128/submissions/5694292
#工事を座標順に処理，工事にぶつかる人をにぶたん
#すでに更新済みだったら更新しない．-> jumpで管理
from bisect import bisect_left
N, Q = map(int, input().split())
consts = []
for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t))
const.sort()
D=[int(input()) for _ in range(Q)]
ans=[-1]*Q
jump=[-1]*Q
for x,s,t in consts:
    left=bisect_left(D,s-x)
    right=bisect_left(D,t-x)
    while left<right:
        if jump[left]==-1:
            ans[left]=x
            jump[left]=right
            left += 1
        else:
            left=jump[left]
print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
N, Q = map(int, input().split())
consts = []
for _ in range(N):
    s,t,x = map(int, input().split())
    consts.append((x,s,t))
const.sort()
D=[int(input()) for _ in range(Q)]
ans=[-1]*Q
jump=[-1]*Q
for x,s,t in consts:
     left=bisect_left(D,s-x)
     right=bisect_left(D,t-x)
     while left<right:
         if jump[left]==-1:
             ans[left]=x
             jump[left]=right
             left += 1
         else:
             left=jump[left]
print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
import bisect
import copy
N, Q = map(int, input().split())
events = []
for i in range(N):
    s,t,x = map(int, input().split())
    events.append([s-x, 1, x])
    events.append([t-x, -1, x])
events.sort()
events=np.array(events)
sets = set()
prev = 0
for _ in range(Q):
    d = int(input())
    index = bisect.bisect_right(events[:,0], d)
    for i in range(prev, index):
        t, pm, x = events[i]
        if pm == 1:
            sets.add(x)
        if pm == -1:
            sets.remove(x)
    prev=copy.copy(index)
    if len(sets)==0:
        print(-1)
    else:
        print(min(sets))
Problem p03077 (python)

Fixed submission:
n = int(input())
clist = [int(input()) for _ in range(5)]
cmin = min(clist)
if cmin == 1:
  print(5 + n//cmin - 1)
else:
  print(5 + n//cmin)

Buggy submission (verdict: Runtime Error):
n = int(input())
clist = [int(input()) for _ in range(5)]
cmin = min(clist)
if cmin = 1:
  print(5 + n//cmin + 1)
else:
  print(5 + n//cmin)
Problem p03785 (python)

Fixed submission:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0
while len(T) > 0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        if T[0] > limit:
            break
        del T[0]
        counter += 1
    answer += 1
print(answer)

Buggy submission (verdict: Runtime Error):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0
while len(T) >　0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        if T[0] > limit:
            break
        del T[0]
        counter += 1
    answer += 1
print(answer)
Problem p03835 (python)

Fixed submission:
K, S = map(int, input().split())
answer = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y <= K:
            answer += 1
print(answer)

Buggy submission (verdict: Runtime Error):
K,S = map(int,input().split())
print(sum(range(S+1))
Problem p02777 (python)

Fixed submission:
s, t = input().split(" ")
a, b = (int(x) for x in input().split(" "))
u = input()
 
if s==u:
  print(a-1, b)
else:
  print(a, b-1)

Buggy submission (verdict: Runtime Error):
s, t = input().split(" ")
a, b = (int(x) for x in input().split(" "))
u = input()
 
if s==u:
  print(s-1,t)
else:
  print(s,t-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
a = int(input())
b = int(input())
u = input()

if s==u:
  print(s-1,t)
else:
  print(s,t-1)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
a = int(input())
b = int(input())
u = input()

if u==s:
  print(s-1, t)
else:
  print(s, t-1)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000000)
N = int(raw_input())
dict = {}
for i in range(1,N+1):
    dict[i]={}
for i in range(1,N):
    a = map(int,raw_input().split())
    dict[a[0]].update({a[1]:a[2]})
    dict[a[1]].update({a[0]:a[2]})
leng = {}
q,K = map(int,raw_input().split())
def rec(bef,now):
    leng[now]=leng[bef]+dict[bef][now]
    for i in dict[now]:
        if i in leng:
            continue
        rec(now,i)
leng[K] = 0
for j in dict[K]:
    rec(K,j)
for i in range(0,q):
    a,b = map(int, raw_input().split())
    print leng[a]+leng[b]

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
N = int(raw_input())
dict = {}
for i in range(1,N+1):
    dict[i]={}
for i in range(1,N):
    a = map(int,raw_input().split())
    dict[a[0]].update({a[1]:a[2]})
    dict[a[1]].update({a[0]:a[2]})
leng = {}
q,K = map(int,raw_input().split())
def rec(bef,now):
    leng[now]=leng[bef]+dict[bef][now]
    for i in dict[now]:
        if i in leng:
            continue
        rec(now,i)
leng[K] = 0
for j in dict[K]:
    rec(K,j)
for i in range(0,q):
    a,b = map(int, raw_input().split())
    print leng[a]+leng[b]

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)
N = int(raw_input())
dict = {}
for i in range(1,N+1):
    dict[i]={}
for i in range(1,N):
    a = map(int,raw_input().split())
    dict[a[0]].update({a[1]:a[2]})
    dict[a[1]].update({a[0]:a[2]})
leng = {}
q,K = map(int,raw_input().split())
def rec(bef,now):
    leng[now]=leng[bef]+dict[bef][now]
    for i in dict[now]:
        if i in leng:
            continue
        rec(now,i)
leng[K] = 0
for j in dict[K]:
    rec(K,j)
for i in range(0,q):
    a,b = map(int, raw_input().split())
    print leng[a]+leng[b]
Problem p02777 (python)

Fixed submission:
s,t=map(str,input().split())
a,b=map(int,input().split())
u=str(input())
if s==u:
    a=a-1
if t==u:
    b=b-1
print(a,b)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
l=list(map(int,input().split()))
a=[]
for i in range(N-K+1):
    b=sum(l[i:i+K])+K
    a.append(b)
    b=0
print(max(a)/2)
Problem p02897 (python)

Fixed submission:
# coding: UTF-8
N = int(input())
ans = -(-N // 2) / N
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
N = int(input())
ans = N / (N // 2)
print(ans)
Problem p02831 (python)

Fixed submission:
import fractions

A, B = [int(i) for i in input().split()]

print(int(A*B/fractions.gcd(A, B)))

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

A, B = [int(i) for i in input().split()]

print(np.lcm(A, B))

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

A, B = [int(i) for i in input().split()]

print(np.lcm(A, B))
Problem p02881 (python)

Fixed submission:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import math
F = sys.stdin
N = int(F.readline())
sqN = int(math.sqrt(N))
ans = 0

for i in range(1, sqN+1):
    if N % i == 0:
        A = int(i - 1)
        B = int((N / i) - 1)
        if ans == 0 or A + B < ans:
            ans = A + B

print(ans)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import math
F = sys.stdin
a, b, x = F.readline().rstrip().split()
a = int(a)
b = int(b)
x = int(x)
h = x / (a**2)
h2 = x/a
y = a * b / 2


if h2 <= y:
    c = 2*h2/b
    ans = math.degrees(math.atan(c/b))
    print(90 - ans)

if h2 > y:
    c = (2*h2/a) - b
    ans = math.degrees(math.atan(a/(b-c)))
    print(90 - ans)
Problem p03041 (python)

Fixed submission:
read = input
n, k = map(int, read().split())
s = read()
k -= 1
s= s[:k] + str.lower(s[k]) + s[k+1:]
print(s)

Buggy submission (verdict: Runtime Error):
n, k = map(int, read().split())
s = read()
k -= 1
s= s[:k] + str.lower(s[k]) + s[k+1:]
print(s)
Problem p02771 (python)

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

if a == b:
  if a == c:
    print("No")
  else:
    print("Yes")
else:
  if a == c:
    print("Yes")
  else:
    if b == c:
      print("Yes")
    else:
      print("No")

Buggy submission (verdict: Runtime Error):
a, b, c =list(map(int, input().split()))

if a = b:
  if a = c:
    print("No")
  else:
    print("Yes")
else:
  if a = c:
    print("Yes")
  else:
    print("No")
Problem p02777 (python)

Fixed submission:
str1, str2 = input().split()
cnt1, cnt2 = list(map(int, input().split()))
tar = input()

if tar == str1:
  cnt1 -= 1
else:
  cnt2 -= 1

print(str(cnt1) + " " + str(cnt2))

Buggy submission (verdict: Runtime Error):
str1, str2 = input().split()
cnt1, cnt2 = list(map(int, input().split()))
tar = input()

if tar == str1:
  cnt1 -= 1
else
  cnt2 -= 1

print(str(cnt1) + " " + str(cnt2))
Problem p02933 (python)

Fixed submission:
#coding:utf-8

a = int(input())
s = str(input())

if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
# coding:utf-8

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

ind = n.index(min(n))
POT = n.pop(ind)

for i in range(0, len(n)):
    ind = n.index(min(n))
    POT = (POT + n.pop(ind)) / 2

print(POT)
Problem p02792 (python)

Fixed submission:
n=int(input())

m=[[0 for i in range(10)] for j in range(10)]

for i in range(n+1):
    s=int(str(i)[0])
    e=int(str(i)[-1])

    m[s][e]+=1

ans=0

for i in range(10):
    for j in range(10):
        ans+=m[i][j]*m[j][i]

print(ans-1)

Buggy submission (verdict: Runtime Error):
mod=10**9+7

n=int(input())

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

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

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

lcma=1

for i in range(n):
    lcma=lcm(lcma,a[i])

ans=0

for i in range(n):
    ans=(ans+lcma//a[i])

print(ans%mod)
Problem p02859 (python)

Fixed submission:
r=int(input())

print(r**2)

Buggy submission (verdict: Runtime Error):
import sys
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

if a<0 or b<0:
  print(0)
  sys.exit()
  
f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y and (-x+2*y)%3==0 and (2*x-y)%3==0:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)
Problem p02862 (python)

Fixed submission:
import sys
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

if a<0 or b<0:
  print(0)
  sys.exit()
  
f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

f=[1]
for i in range(1,a+b+100):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

f=[1]
for i in range(1,a+b+1):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
mod=10**9+7
x,y=map(int,input().split())

a=(-x+2*y)//3
b=(2*x-y)//3

f=[1]
for i in range(1,a+b):
    f.append(f[-1]*i%mod)

if a+2*b==x and 2*a+b==y:
    print(f[a+b]*pow(f[a]*f[b],mod-2,mod)%mod)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys

mod=10**9+7
x,y=map(int,input().split())

if (-X + 2*Y) % 3 or (2*X - Y) % 3 or (-X + 2*Y) < 0 or (2*X - Y) < 0:
    print(0)
    sys.exit()

a=(-x+2*y)//3
b=(2*x-y)//3

n=a+b

p1=1
p2=1
p3=1

for i in range(n):
    p1=p1*(i+1)%mod

for i in range(max(a,b)):
    p2=p2*(i+1)%mod

    if i==b-1:
        p3=p2

if a+2*b==x and 2*a+b==y:
    print(p1*pow(p2,mod-2,mod)*pow(p3,mod-2,mod)%mod)
else:
    print(0)
Problem p02984 (python)

Fixed submission:
N=int(input())

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

B=[sum(A)]

for i in range(1,N,2):
    B[0]-=2*A[i]

for i in range(N-1):
    B.append(2*A[i]-B[i])

print(' '.join(map(str,B)))

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

N=int(input())

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

A=np.array(A)

B=np.identity(N)

for i in range(N-1):
    B[i][i+1]=1
B[N-1][0]=1

B_inv=np.linalg.inv(B)

A=A.reshape((1,N))
X=2*np.dot(B_inv,A.transpose())

X=list(map(int,X))

print(' '.join(map(str,X)))
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce

from operator import mul
from functools import reduce

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

mod=10**9+7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under%mod

for i in range(K):
    if i<N-K+1:
        print((cmb(N-K+1,i+1)*cmb(K-1,i))%mod)
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

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

mod=10**9+7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under%mod

for i in range(K):
    print((cmb(N-K+1,i+1)*cmb(K-1,i))%mod)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

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

mod=10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = (cmb(n-1,r) + cmb(n-1,r-1))%mod
    return nCr[(n,r)]

for i in range(K):
    print((cmb(N-K+1,i+1)*cmb(K-1,i))%mod)
Problem p03077 (python)

Fixed submission:
import math
 
N=int(input())
 
m=0
 
for i in range(5):
    a=math.ceil(N/int(input()))
    if m<a:
      m=a
 
print(m+4)

Buggy submission (verdict: Runtime Error):
import math

N=int(input())

m=0

for i in range(5):
    if m<math.ceil(N/int(input())):
      m=math.ceil(N/int(input()))

print(m+4)
Problem p03767 (python)

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

a = sorted(a, reverse=True)
m = 0

for i in range(1, 2 * n, 2):
    m += a[i]

print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())

a = reversed(sorted(a))
m = 0

for i in range(n, 2 * n):
    m += a[i]

print(m)
Problem p02773 (python)

Fixed submission:
N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

dicts = sorted(dicts.items(), key=lambda x:x[1], reverse=True)
max_list = []

buf = dicts[0][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in sorted(max_list):
    print(k)

Buggy submission (verdict: Runtime Error):
N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

dicts = sorted(dicts.items(), key=lambda x:x[1])
max_list = []

buf = dicts[1][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in max_list:
    print(k)

Buggy submission (verdict: Runtime Error):
N = int(input())

dicts = {}

for _ in range(N):
    S = input()
    if S in dicts:
        dicts[S] += 1
    else:
        dicts[S] = 1

max_list = [kv[0] for kv in d.items() if kv[1] == max(dicts.values())]

print(sorted(max_list))