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

Fixed submission:
N = int(input())
print(N*N*N)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a and prev != 0:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev == a:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
n = int(import())

print(n*n*n)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
 
print(math.factorial(n) // math.factorial(n - 3))

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

print(math.factorial(n) // math.factorial(n - 3))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev+1 == a and prev != 0:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev = a:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev != 0 or prev != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

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

A.insert(0,0)
B.insert(0,0)
C.insert(0,)
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a]
  if prev != 0 and prev != N:
    manzoku += C[prev]
  prev = a
print(manzoku)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
manzoku = 0
prev = 0
 
for a in A:
  manzoku += B[a-1]
  if prev != 0 and != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)

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

manzoku = 0
prev = 0

for a in A:
  manzoku += B[a-1]
  if prev != 0 && != N:
    manzoku += C[prev-1]
  prev = a
print(manzoku)
Problem p02915 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N = int(raw_input())

C = N*N*N

print(C)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(1):
    a.append(map(int, raw_input().split()))
    b.append(map(int, raw_input().split()))
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
    b.append(map(int, raw_input().split()))
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
N = int(raw_input())
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
for i in range(N):
    b.append(map(int, raw_input().split()))
for i in range(N):
    c.append(map(int, raw_input().split()))
print(a)
print(b)
print(c)
for i in range(N):
	if a[i+1] - a[i] == 1:
  		ans += c[i]
    
ans += sum(b)
 
print(int(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
 
N = raw_input()
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
for i in range(N):
    b.append(map(int, raw_input().split()))
for i in range(N):
    c.append(map(int, raw_input().split()))
    
for i in range(N-1)
	if a[N] - a[N+1] = 1
  		ans += c[N]
ans += sum(b)
 
print(int(ans))
Problem p03075 (python)

Fixed submission:
A=[]
for i in range(6):
  A.append(int(input()))
X=A[4]-A[0]
if X<=A[5]:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
A=[]
for i in range(6):
  A.append(int(input()))
X=A[4]-A[0]
if X=<A[5]:
  print("Yay!")
else:
  print(":(")
Problem p03775 (python)

Fixed submission:
N = int(input())
min_num = 10**5
for i in range(1, 10**5+1):
    if N % i == 0:
        min_num = min(max(len(str(i)), len(str(N//i))), min_num)
print(min_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
min_num = 10**5
for i in range(1, N+1):
  if N % i == 0:
    min_num = min(max(len(i), len(N//i)), min_num)
print(min_num)
Problem p03835 (python)

Fixed submission:
K, S = [int(x) for x in input().split()]
ans = 0
for x in range(K+1):
    for y in range(K+1):
        a = S-x-y
        if a <= K and a >= 0:
            ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
K, S = [int(x) for x in input().split()]
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if S-x-y =< K:
            ans +=1
print(ans)

Buggy submission (verdict: Runtime Error):
K, S = [str(x) for x in input().split()]
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if S-x-y =< K:
            ans +=1
print(ans)
Problem p02987 (python)

Fixed submission:
if len(set(input())) == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
ss = list(set(s))
if len(ss) == 2:
  if s.count(ss[0]) == 2 and s.count(ss[1]) == 2;
    print('Yes')
  else:
    print('No')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
ss = list(set(s))
if len(ss) == 2:
  if s.count(ss[0]) == 2 and s.count(ss[1]) == 2;
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s = list(input())
ss = list(set(s))
if ss == 2:
  if count(ss[0]) == 2 and count(ss[1]);
    print('Yes')
  else:
    print('No')
else:
  print('Yes')
Problem p02984 (python)

Fixed submission:
import numpy as np
N = int(input())
A = input().split()
A = np.array(A).astype(type(N))
S = np.sum(A)

SS = np.array([A[i] for i in range(1,A.shape[0],2)])

X = np.zeros((N))
X[0] = S -2*sum(SS)
for i in range(0,N-1):
    X[i + 1] = 2*A[i] - X[i]  

for i in X:
    print("{} ".format(int(i)),end="")

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = input().split() 
A = np.array(A).astype(type(N))

T = np.zeros((N,N))
for i in range(N):
    T[i,i%N] = 1
    T[i,(i+1)%N] = 1
    
inv_T = np.linalg.inv(T)
X = np.dot(inv_T , A.T).astype('int32') *2

for i in X:
    print("{} ".format(i) ,end="")
Problem p02951 (python)

Fixed submission:
a,b,c = list(map(int, input().split(" ")))
l = a-b
if l >= c:
    print(0)
else:
    print(c-l)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split(" ")))
a = 'Yes'
m = 0
for i in range(1, len(h)):
    m = max(h[i], m)
    if h[i] < h[i-1] and m - h[i] > 1:
        a = 'No'
        break
print(a)
Problem p03135 (python)

Fixed submission:
T, X = (int(i) for i in input().split())  
print(T / X)

Buggy submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())  
X = [int(i) for i in input().split()] 
lg_bw_x = [] 
s= 0
if N >= M:
    print(0)
else
    X.sort()
    for i in range(M-1):
        lg_bw_x.append(X[i+1] - X[i])
    lg_bw_x.sort()
    for j in range(M-N-1):
        s = s+lg_bw_x[j]
    print(s)
Problem p03137 (python)

Fixed submission:
N, M = (int(i) for i in input().split())  
X = [int(i) for i in input().split()] 
lg_bw_x = [] 
s= 0
if N >= M:
    print(0)
else:
    X.sort()
    for i in range(M-1):
        lg_bw_x.append(X[i+1] - X[i])
    lg_bw_x.sort()
    for j in range(M-N):
        s = s+lg_bw_x[j]
    print(s)

Buggy submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())  
X = [int(i) for i in input().split()] 

s= 0
if N >= M:
    print(0)
else
    X.sort()
    for i in range(M-1):
        lg_bw_x[i] = X[i+1] - X[i]
    for i in range(M-N-1):
        s = s+lg_bw_x[i]
    print(s)

Buggy submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split())  
X = [int(i) for i in input().split()] 
s= 0
if N >= M:
    print(0)
else
    X.sort()
    for i in range(M-N-1):
        s = s+X[i]
    print(s)
Problem p02916 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split(' ')] 
B = [int(i) for i in input().split(' ')]
C = [int(i) for i in input().split(' ')]

s = 0
last = -2
for j in range(N):
    s += B[A[j]-1]
    if A[j] == last+1:
      s += C[last-1]
    last = A[j]
    
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split(' ')] 
B = [int(i) for i in input().split(' ')]
C = [int(i) for i in input().split(' ')]

s = 0
last = -2
for j in range(N):
    s += B[A[j]-1]
    if A[j] == last+1:
      s += C[last-1]
    last = A[j]
    
print(s)a
Problem p03221 (python)

Fixed submission:
N, M = (int(i) for i in input().split(' '))
py=[]
p =[]

# 全都市を配列に代入
for i in range(M):
    p = [i]
    p.extend([int(j) for j in input().split(' ')])
    py.append(p)

# 設立年で一度ソートする
py.sort(key = lambda x: x[2])
pcid = [1] * N # 各県の都市ID

for i in range(M):
    p = py[i][1] # 県ID
    py[i][2] = pcid[p-1]
    pcid[p-1] += 1

py.sort(key=lambda x:x[0])
for t in py:
    print('{0:0>6}{1:0>6}'.format(t[1],t[2]))

Buggy submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split(' '))
py=[]
p =[]

# 全都市を配列に代入
for i in range(M):
    p = [i]
    p.extend([int(j) for j in input().split(' ')])
    py.append(p)

# 設立年で一度ソートする
py.sort(key = lambda x: x[2])
pcid = [1] * M # 各県の都市ID

for i in range(M):
    p = py[i][1] # 県ID
    py[i][2] = pcid[p-1]
    pcid[p-1] += 1

py.sort(key=lambda x:x[0])
for t in py:
    print('{0:0>6}{1:0>6}'.format(t[1],t[2]))

Buggy submission (verdict: Runtime Error):
N, M = (int(i) for i in input().split(' '))
py=[]
p =[]

# 全都市を配列に代入
for i in range(M):
    p = [i]
    p.extend([int(j) for j in input().split(' ')])
    py.append(p)

# 全N個の県について調べる
Npy = []
for i in range(1,N+1):
    # 県i
    pyi = [j for j in py if j[1] == i] # 県iの市リスト
    pyi.sort(key=lambda x: x[2]) # 県iの市を生まれた年でソート
    l = len(pyi)
    cnt = 0
    for k in range(1,l+1):
        pyi[k-1][2] = k
    Npy.extend(pyi)

Npy.sort(key=lambda x: x[0])

for t in Npy:
    print('{0:0>8}{1:0>8'.format(t[1],t[2]))
Problem p03242 (python)

Fixed submission:
n=input()
n = n.replace('1','a')
n = n.replace('9','b')
n = n.replace('a','9')
n = n.replace('b','1')
print(n)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
v=[int(i) for i in input().split(' ')]

v_odd = v[1::2]
v_even = v[0::2]

vo = collections.Counter(v_odd).most_common()
ve = collections.Counter(v_even).most_common()

# 最大の値が同じ場合
if vo[0][0] == ve[0][0]:
    # 奇数のほうが少ない場合
    if vo[0][1] > ve[0][1]:
        result = len(v_odd) - vo[0][1] + len(v_even) - ve[1][1]
    elif vo[0][1] < ve[0][1]:
        result = len(v_odd) - vo[1][1] + len(v_even) - ve[0][1]
    else:
        result = len(v_odd) - vo[0][1] + len(v_even) 
else:
    result = len(v_odd) - vo[0][1] + len(v_even) - ve[0][1]

print(result)
Problem p02915 (python)

Fixed submission:
n=input()
print(n*n*n)

Buggy submission (verdict: Runtime Error):
n=input()
print(n*n*n)

Buggy submission (verdict: Runtime Error):
N = input()
print(N*N*N)
Problem p02933 (python)

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

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

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
a=[]
b=[]
s=[0]


for i in range(0,n-1):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
    s.append(0)
for i in range(0,q):
    P,X=map(int,input().split())
    s[P-1]=s[P-1]+X


for j in range(0,n-1):
    s[b[j]-1]=s[b[j]-1]+s[a[j]-1]

print(' '.join(map(str,s)))
Problem p02935 (python)

Fixed submission:
n=int(input())
d=map(int,input().split())
v=list(d)

v.sort()

s=v[0]
for i in range(1,n):
    s=(s+v[i])/2

print(s)

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

v=v.sort()
s=v[0]
for i in range(1,n):
    s=(s+v[i])/2

print(s)
Problem p02916 (python)

Fixed submission:
n = int(input())

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

before = -100
result = sum(b)

for i in a:
  if(i == before+1):
    result += c[before-1]
  before = i
  
print(result)

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

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

if(len(a) >2):
  result = sum(b) + sum(c) - c[a[-1]-1]
  print(result)
else:
  result = sum(b) + c[0]
  print(result)
Problem p03038 (python)

Fixed submission:
#coding utf-8
N,M=map(int,input().split())
A=list(map(int,input().split())) 
BC=[[int(i) for i in input().split()] for i in range(M)]
A.sort()
BC.sort(key=lambda x:x[1])
BC.reverse()

k=0
t=0
for i in range(M):
  if t==1 or k==N:
    break
  for j in range(BC[i][0]):
    if BC[i][1]>A[k]:
      A[k]=BC[i][1]
      k+=1
      if k==N:
        break
    else:
      t=1
      break
      
      
print(sum(A))

Buggy submission (verdict: Runtime Error):
#coding utf-8
N,M=map(int,input().split())
A=list(map(int,input().split())) 
BC=[[int(i) for i in input().split()] for i in range(M)]
A.sort()
BC.sort(key=lambda x:x[1])
BC.reverse()

k=0
t=0
for i in range(M):
  if t==1 or k==N:
    break
  for j in range(BC[i][0]):
    if BC[i][1]>A[k]:
      A[k]=BC[i][1]
      k+=1
    else:
      t=1
      break
      
      
print(sum(A))

Buggy submission (verdict: Runtime Error):
#coding utf-8
N,M=map(int,input().split())
A=list(map(int,input().split())) 
BC=[[int(i) for i in input().split()] for i in range(M)]
A.sort()
BC.sort(key=lambda x:x[1])
BC.reverse()

k=0
t=0
for i in range(M):
  if t==1:
    break
  for j in range(BC[i][0]):
    if BC[i][1]>A[k]:
      A[k]=BC[i][1]
      k+=1
    else:
      t=1
      break
      
      
print(sum(A))
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = str(input())

s0 = S[:K-1]
smid = S[K-1:K].lower()
s1 = S[K:]

print(s0 + smid + s1)

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

s1 = S[:K-1]
smid = S[K-1:K].lower()
s1 = S[K:]

print(s0 + smid + s1)
Problem p02990 (python)

Fixed submission:
from scipy.misc import comb

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

red_ball_count = N - K

for i in range(1, K + 1):
    if red_ball_count + 1 - i < 0:
        print(0)
    else:
        print(comb(red_ball_count + 1, i, exact=True) * comb(K - 1, i - 1, exact=True) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math

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

ans1 = N - K + 1
ans2 = ans1 * (ans1 - 1)
ans3 = 1

# combination(N,K)を求める
for i in range(K):
    ans3 *= (N - i)

ans3 = int(ans3 / math.factorial(K) - ans1 - ans2 )

print(ans1 % (10**9 + 7))
print(ans2 % (10**9 + 7))
print(ans3 % (10**9 + 7))

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

ans1 = N - K + 1
ans2 = ans1 * (ans1 - 1)
ans3 = 1

# combination(N,K)を求める
for i in range(K):
    ans3 *= (N - i)

ans3 = int(ans3 / 6 - ans1 - ans2 )

print(ans1 % (10**9 + 7))
print(ans2 % (10**9 + 7))
print(ans3 % (10**9 + 7))
Problem p03835 (python)

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

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
cnt=0
for i in range(k):
  for j in range(k):
    for l in range(k):
      if i+j+l=s:
        cnt+=1
print(cnt)
Problem p02959 (python)

Fixed submission:
n = int(input())
A=[]
for x in input().split():
    A.append(int(x))

B=[]
for x in input().split():
    B.append(int(x))

B.append(int(0))    

TOT = sum ( A )

for i in range (n) :
    KILL = min ( A[i], B[i] )
    A [i] = A [i] - KILL
    A [i+1] = A[i+1] - min (A[i+1], B[i] - KILL)
    
print ( TOT - sum ( A ) )

Buggy submission (verdict: Runtime Error):
n = int(input())
A=[]
for x in input().split():
    A.append(int(x))

B=[]
for x in input().split():
    B.append(int(x))

B.append(int(0))    

TOT = sum ( A )

print ( A )

for i in range (n) :
    KILL = min ( A[i], B[i] )
    A [i] = A [i] - KILL
    A [i+1] = A[i+1] - min (A[i+1], B[i] - KILL)
    print ( A )    
    
print ( TOT - sum ( A ) )
Problem p02954 (python)

Fixed submission:
import math
s = [1 if x == "R" else -1 for x in input()]
ans = [0]*len(s)
i = 0
while i < len(s):
    locate = i
    if locate < len(s)-1:
        while s[locate+1] == s[i]:
            locate += 1
            if locate >= len(s)-1:
                break
    count = locate - i + 1
    tmp = math.ceil(count/2)
    if s[i] == 1:
        ans[locate] += tmp
        ans[locate+1] += count - tmp
    else:
        ans[i] += tmp
        ans[i-1] += count - tmp
    i = locate + 1
print(*ans)

Buggy submission (verdict: Runtime Error):
import math
s = [1 if x == "R" else -1 for x in input()]
ans = [0]*len(s)
i = 0
while i < len(s):
    locate = i
    if locate != len(s)-1:
        while s[locate+1] == s[i]:
            locate += 1
            if locate >= len(s):
                break
    count = locate - i + 1
    tmp = math.ceil(count/2)
    if s[i] == 1:
        ans[locate] += tmp
        ans[locate+1] += count - tmp
    else:
        ans[i] += tmp
        ans[i-1] += count - tmp
    i = locate + 1
print(*ans)
Problem p02915 (python)

Fixed submission:
N = int(input())

print(N**3)

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

print(N**3)2

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

print(N^**)
Problem p02987 (python)

Fixed submission:
word = input()

while True:
    if(word[0]==word[1]):
        if((word[2]==word[3])and(word[0]!=word[2])):
            print("Yes")
            break
    if(word[0]==word[2]):
        if(word[1]==word[3])and(word[0]!=word[1]):
            print("Yes")
            break    
    if(word[0]==word[3]):
        if((word[1]==word[2])and(word[0]!=word[1])):
            print("Yes")
            break
    if((word[1]==word[2])and(word[0]==word[1])):
        print("No")
        break
    if((word[1]==word[3])and(word[0]==word[1])):
        print("No")
        break
    if((word[1]==word[3])and(word[2]==word[1])):
        print("No")
        break
    else:      
        print("No")
        break

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

MOD = 10**9 +7

fact = [1]
for i in range(1,N):
    fact.append(fact[-1]*i)


def cmb(n,k):
    return (fact[n]//(fact[k]*fact[n-k]))%MOD

def f(x,y):
    if(x<0):return 0
    if(y<0):return 0
    if(x<y):return 0
    return cmb(x-1,y-1)


for i in range(1,K+1):

    print ((f(K,i))*(f(N-K,i-1)+2*f(N-K,i)+f(N-K,i+1))%MOD)

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

count = 0
for i in range(N-2):
    if((num[i]<num[i+1]<num[i+2])or(num[i]>num[i+1]>num[i+2])):
        count +=1
print(count)
Problem p03013 (python)

Fixed submission:
MOD = 1000000007

N,M = map(int,input().split())
A=[int(input()) for i in range(M)]

T = [-1]*(N+1)

T[0] = 1
T[1] = 1

for i in (A):
    T[i] = 0

    


for i in range(2,N+1):
    if(T[i] == -1):
        T[i] = (T[i-1] + T[i-2])%MOD
        
print(T[N])

Buggy submission (verdict: Runtime Error):
MOD = 1000000007

N,M = map(int,input().split())
A=[int(input()) for i in range(M)]



def binet_mod(n):
    if(n==0):
        return 0
    return((int(1/5**(1/2)*((((1+5**(1/2))/2)**n)-((1-5**(1/2))/2)**n)))%MOD)
    

l = 0
ans = 1

for i in range(M):
    ans = ans * binet_mod(A[i] - l)
    l = A[i] + 1
    

ans = (ans * binet_mod(N-l+1))%MOD
print(ans)
Problem p02987 (python)

Fixed submission:
import collections

inputstr = input()
input = sorted(inputstr)
a = collections.Counter(input)
if len(a) == 2 and a.most_common()[0][1] == 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

n, k = map(int, input().split())

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))

Buggy submission (verdict: Runtime Error):
import sys
import collections

input = sorted(sys.argv[1])
a = collections.Counter(input)
if len(a) == 2 and a.most_common()[0][1] == 2:
    print('Yes')
else:
    print('No')
Problem p02990 (python)

Fixed submission:
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    elif n < r:
        return 0
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

n, k = map(int, input().split())

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))

Buggy submission (verdict: Runtime Error):
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    else:
        a = factorial(n) // factorial(r) // factorial(n - r)
    return int(a)

n, k = map(int, input().split())

for i in range(k):
    pick_count = i + 1

    blue_pattern =  count_pattern(k - 1, pick_count - 1)
    red_pattern = count_pattern(n - k + 1 , pick_count)
    total_pattern = blue_pattern * red_pattern
    print (int(total_pattern % (10 ** 9 + 7)))

Buggy submission (verdict: Runtime Error):
from math import factorial

def count_pattern(n, r):
    if r == 0:
        return 1
    else:
        a = factorial(k) / factorial(r) / factorial(n - r)

n, k = map(int, input().split())

for i in range(k):
    blue_pattern =  count_pattern(n, i - 1)
    red_pattern = count_pattern(k, i)
    total_pattern = blue_pattern * red_pattern
    print (total_pattern % (10 ** 9 + 7))
Problem p02935 (python)

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

n_list.sort()

new_list = []
ctr = 0

while len(n_list) > 1:
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
  n_list.pop(ctr + 1)
  n_list.sort
  
print(n_list[0])

Buggy submission (verdict: Runtime Error):
ソースコード
[0]
1
N = int(input())
2
n_list = list(map(int,input().split()))
3
​
4
n_list.sort()
5
​
6
new_list = []
7
ctr = 0
8
​
9
while len(n_list) > 1:
10
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
11
  n_list.pop(ctr + 1)
12
  n_list.sort
13
  
14
print(n_list[0
Problem p02951 (python)

Fixed submission:
A, B, C = map(int,input().split())
print(C - min(A-B,C))

Buggy submission (verdict: Runtime Error):
A, B, C = input().split()
 
answer = (B + C) % A
 
print(answer)

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

answer = (b + c) % a

print(answer)