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

Fixed submission:
A, B, C = input().split()

a = int(A)
b = int(B)
c = int(C)
if b + c <= a:
  result = 0
else:
  result = b+c-a
 
print(result)

Buggy submission (verdict: Runtime Error):
A, B, C = input().split()
 
if B + C <= A:
  result = 0
else:
  result = B+C-A
 
print(result)

Buggy submission (verdict: Runtime Error):
a = int(input())
        
result =0
for i in range(1,a+1):
  if len(str(i)) % 2 == 1:
      result = result + 1

print(result)

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

if B + C <= A:
  result == 0
else:
  result = B+C-A

print(result)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split())
if b+c<=a:
  ans=0
else:
  ans = (b+c)-a
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n < 10:
  ans = n
elif n < 10**2:
  ans = 9
elif n < 10**3:
  h = n-99
  ans = h+9
elif n < 10**5:
  t_t = n - 9998
  ans = t_t + 909
  
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(max(0,b+c-a)
Problem p02951 (python)

Fixed submission:
a, b,c = map(int, input().split())
d = c-(a-b)
if d<0:
    d = 0
print(d)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
elif N == 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-2):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-2):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-2):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-2):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
        print(range(0))
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
        print(range(0))
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
            
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("Yes")
Problem p02951 (python)

Fixed submission:
def main():
    A, B, C = map(int, input().split())
    output = C - A + B
    if output < 0:
        print(0)
    else:
        print(output)
main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    i = 0
    while N >0:
        n = int(str(N)[-1])
        if n % 2 != 0:
            i+=1
        N -= 1
    print(i)
main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    i = 0
    while N >0:
        n = int(str(N)[-1])
        if n % 2 != 0:
            print("yes")
            i+=1
        N -= 1
    print(i)
main()

Buggy submission (verdict: Runtime Error):
def main():
    A= int(input())
    B= int(input())
    C= int(input())
    output = C - A + B
    if output < 0:
        print(0)
    else:
        print(output)
main()

Buggy submission (verdict: Runtime Error):
A= int(input())
B= int(input())
C= int(input())
output = C - A + B
if output < 0:
    print(0)
else:
    print(output)

Buggy submission (verdict: Runtime Error):
def main():
    output = C - A + B
    if output < 0:
        print(0)
    else:
        print(output)

main()

Buggy submission (verdict: Runtime Error):
def main():
    output = C - A + B
    if output < 0:
        print(0)
    else:
        print(output)
 
main()

Buggy submission (verdict: Runtime Error):
output = C -(A-B)
if output < 0:
    return 0
return output
Problem p02951 (python)

Fixed submission:
A,B,C = input().split()
ans = int(C)-int(A)+int(B)
if(ans>=0):
  print(ans)
else:
  print("0")

Buggy submission (verdict: Runtime Error):
a=$1-$2,ans=$3-a{print ans}
Problem p02990 (python)

Fixed submission:
import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

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

cnt_list = []
for i in range(1,K+1):
    if N-K+1 >= i:
        cnt = int(combi(N-K+1,i)*combi(K-1,i-1))
    else:
        cnt =0
    cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

Buggy submission (verdict: Runtime Error):
import math

def combi(n ,k):
    return math.factorial(n)/(math.factorial(k)*math.factorial(n-k))

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

cnt_list = []
for i in range(1,K+1):
    if N-K+1 >= i:
        cnt = int(combi(N-K+1,i)*combi(K-1,i-1))
    else:
        cnt =0
    cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

Buggy submission (verdict: Runtime Error):
import math

def combi(n ,k):
    return math.factorial(n)/(math.factorial(k)*math.factorial(n-k))

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

cnt_list = []
for i in range(1,K+1):
    if N-K+1 >= i:
        cnt = combi(N-K+1,i)*combi(K-1,i-1)
    else:
        cnt =0
    cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

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

cnt_list = []
for i in range(K):
  C1 = int(math.factorial(N-K+1))/int((math.factorial(i+1)*math.factorial(N-K+1-i-1)))
  C2 = int(math.factorial(K-1))/int((math.factorial(i+1-1)*math.factorial(K-1-i+1-1)))
  cnt = int(C1*C2)
  cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

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

cnt_list = []
for i in range(K):
  C1 = math.factorial(N-K+1)/(math.factorial(i+1)*math.factorial(N-K+1-i-1))
  C2 = math.factorial(K-1)/(math.factorial(i+1-1)*math.factorial(K-1-i))
  cnt = int(C1*C2)
  cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

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

cnt_list = []
for i in range(K):
  C1 = math.factorial(N-K+1)/(math.factorial(i+1)*math.factorial(N-K+1-i-1))
  C2 = math.factorial(K-1)/(math.factorial(i+1-1)*math.factorial(K-1-i))
  cnt = int(C1*C2)
  cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])
Problem p03038 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1],reverse=True)
for b,c in bc:
    a.extend([c]*b)
    if len(a)>2*n:
        break
a.sort(reverse=True)
print(sum(a[:n]))

Buggy submission (verdict: Runtime Error):
N, M = [int(item) for item in input().split()]
A = [int(item) for item in input().split()]
A.sort()
for i in range(M):
  B, C = [int(item) for item in input().split()]
  cnt = 0
  while A[cnt] < C and cnt < B:
    A[cnt] = C
    cnt += 1
  A.sort()
print (sum(A))
Problem p03252 (python)

Fixed submission:
import collections
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")
Problem p02989 (python)

Fixed submission:
from heapq import nsmallest

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

m = int(-(n/2))
s = int(n/2)

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)

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

from heapq import nsmallest

m = int(-(a/2))
s = int(a/2)

n = int(a)
p = list(map(int, b.split()))

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)

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

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))

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

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))
Problem p03107 (python)

Fixed submission:
S = str(input())

zero_num = 0
one_num = 0

for i in range(len(S)):
    if S[i] == "0":
        zero_num += 1
    else:
        one_num += 1

print(2*min(zero_num, one_num))

Buggy submission (verdict: Runtime Error):
S = str(input())

zero_num = 0
one_num = 

for i in range(len(S)):
    if S[i] == "0":
        zero_num += 1

print(2*min(zero_num, len(S) - zero_num))
Problem p03038 (python)

Fixed submission:
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split()) )for _ in range(m)]
lst=sorted(l,key=lambda x: x[1],reverse=True)
cur=0
for i in lst:
    tmpb=i[0]
    while (tmpb!=0 and cur<=len(a)-1):
        if a[cur]<i[1]:
            a[cur]=i[1]
            cur+=1
            tmpb-=1
        else:
            break
            
result=0
for i in a:
    result+=i
print(result)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=sorted(list(map(int,input().split())))
l=[list(map(int,input().split()) )for _ in range(m)]
lst=sorted(l,key=lambda x: x[1],reverse=True)
cur=0
for i in lst:
    tmpb=i[0]
    while tmpb:
        if a[cur]<i[1]:
            a[cur]=i[1]
            cur+=1
            tmpb-=1
        else:
            break
            
result=0
for i in a:
    result+=i
print(result)
Problem p02951 (python)

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

print(0 if b+c <= a else c-(a-b))

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

count = 0
for i in range(1, n + 1):
    s = len(str(i))
    if s%2 == 1:
        count += 1

print(count)
Problem p02951 (python)

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

print(max(C-(A-B), 0))

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

print(max(C-(A-B), 0)
Problem p03307 (python)

Fixed submission:
n = int(input())

if n % 2 == 0:
    print(n)
else:
    print(n*2)

Buggy submission (verdict: Runtime Error):
 = int(input())
  2 
  3 if n % 2 == 0:
  4     print(n)
  5 else:
  6     print(n*2)
Problem p03127 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

def gcd_list(numbers):
    return reduce(gcd, numbers)

N = int(input())
A = list(map(int,input().split()))
answer = gcd_list(A)
print(answer)

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

def gcd(numbers):
    return reduce(math.gcd, numbers)

N = int(input())
A = list(map(int,input().split()))
answer = gcd(A)
print(answer)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd(numbers):
    return reduce(math.gcd, numbers)

N = int(input())
A = list(map(int,input().split()))
answer = gcd(A)
print(answer)

Buggy submission (verdict: Runtime Error):

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

A.sort()
check = []
while True:
    min_num = A[0]
    for i in A:
        # 余りのリスト
        if
        check.append(i%A[0])
    check[0] = min_num
    if A[1] - A[0]>0:
        A[1] = A[1] - A[0]
    else:
        break
    A = check
    A.sort()

print(A[0])
Problem p03745 (python)

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

flg_inc = False
flg_dec = False

count = 1
for i in range(1, len(a)):
    if a[i] < a[i - 1]:
        flg_dec = True
        if flg_inc:
            count += 1
            flg_inc = False
            flg_dec = False
    elif a[i] > a[i - 1]:
        flg_inc = True
        if flg_dec:
            count += 1
            flg_inc = False
            flg_dec = False

print(count)

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


if a[1] > a[0]:
    inc = True
else:
    inc = False
count = 1
for i in range(2, len(a)):
    if a[i] > a[i - 1]:
        if inc:
            pass
        else:
            count += 1
            inc = False
    elif a[i] < a[i - 1]:
        if inc:
            count += 1
            inc = True
        else:
            pass

print(count)

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

diff_list = [a[i] - a[i - 1]  for i in range(1, len(a))]
print(diff_list)

diff = a[1] - a[0]
count = 1
for i in range(2, len(a)):
    if a[i] - a[i - 1] != 1:
        count += 1
    elif a[i] - a[i - 1] == 1:
        if diff != 1:
            count += 1
        diff = 1
    elif a[i] - a[i - 1] == -1:
        if diff != -1:
            count += 1
        diff = -1

print(count)
Problem p03250 (python)

Fixed submission:
import itertools

n = list(map(str, raw_input().split()))
n.append('+')
nc = list(itertools.permutations(n))
ncc = []
vn = []
for _ in nc:
    if _[0] != '+' and _[3] != '+':
        ncc.append(_)
for __ in ncc:
    v = eval(('').join(__))
    vn.append(v)
print(max(vn))

Buggy submission (verdict: Runtime Error):
n = list(map(str, raw_input().split()))
n.append('+')
nc = list(itertools.permutations(n))
ncc = []
vn = []
for _ in nc:
    if _[0] != '+' and _[3] != '+':
        ncc.append(_)
for __ in ncc:
    v = eval(('').join(__))
    vn.append(v)
print(max(vn))
Problem p02987 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[1] ==p[2] ==p[3]:
    print("No") 
elif p[0] ==p[3] and p[1] == p[2]:
    print("Yes")
elif p[0] == p[1] and p[2] == p[3]:
    print("Yes")
elif p[0] ==p[2] and p[1] == p[3]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[1] ==p[2] ==p[3]:
    print("No") 
elif p[0] ==p[3] and p[1] == p[2]:
    print("Yes")
elif p[0] == p[1] and p[2] == p[3]:
    print("Yes")
elif p[0] ==p[2] and p[1] == p[3]:
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
p=str(input())
if p[0] ==p[1] ==p[2] ==p[3]:
    print("No") 
elif p[0] ==p[3] and p[1] == p[2]:
    print("Yes")
elif p[0] == p[1] and p[2] == p[3]:
    print("Yes")
elif p[0] ==p[2] and p[1] == p[3]
else:
    print("No")
Problem p03075 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#a,b,c,d,e,k = 2,4,7,8,15,1
#box = [a,b,c,d,e]
import itertools
box = []
for i in range(0,5):
    box.append(int(input()))
k = int(input())
c = 0
for two in list(itertools.combinations(box,2)):
    if (two[1]- two[0] > k):
        c +=1
    else:
        pass
if c == 0:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#a,b,c,d,e,k = 2,4,7,8,15,1
#box = [a,b,c,d,e]
box = []
for i in range(0,5):
    box.append(int(input())
k = int(input())
c = 0
for i in range(0,4):
    if box[i+1] - box[i] > k :
        c +=1
    else:
        pass
if c == 0:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#a,b,c,d,e,k = 2,4,7,8,15,1
#box = [a,b,c,d,e]
box = []
for i in range(0,5):
    box.append(int(input())
c = 0
for i in range(0,4):
    if box[i+1] - box[i] > k :
        c +=1
    else:
        pass
if c == 0:
    print("Yay!")
else:
    print(":(")
Problem p02970 (python)

Fixed submission:
N, D = tuple([int(i) for i in input().split(" ")])

if (N%(2*D+1)==0):
  print(N//(2*D+1))
else:
  print(N//(2*D+1) + 1)

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

if (N%(2*D-1)==0):
  print(N//(2*D-1))
else:
  print(N//(2*D-1) + 1)

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

if (N%(2*D-1)==0):
  print(N//(2*D-1))
else:
  print(N//(2*D-1) + 1)
Problem p02951 (python)

Fixed submission:
a, b, c = [int(i) for i in input().split()]
if c-(a-b)<0:
    print(0)
else:
    print(c-(a-b))

Buggy submission (verdict: Runtime Error):
a, b, c = [int(i) for i in input().split()]

print(c-(a-b))a
Problem p02987 (python)

Fixed submission:
s = input()

s1 = s[0]
if s.count(s1) == 2:
    s = s.replace(s1, "")
    s2 = s[0]
    if s.count(s2) == 2:
        print('Yes')
    else:
        print('No')

else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = (input()

s1 = s[0]
if s.count(s1) == 2:
    s = s.replace(s1, "")
    s2 = s[0]
    if s.count(s2) == 2:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s = str(input())

if str.count(s[0]) == str.count(s[1]) == str.count(s[2]) == str.count(s[3]) == 2:
    print('Yes')
else:
    print('No')
Problem p02989 (python)

Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
lis2 = sorted(lis)
m1 = lis2[n//2-1]
m2 = lis2[n//2]

c = 0
for i in range((m1+1), (m2+1)):
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
lis = list(map(int, input().split()))
lis2 = sorted(lis)
m1 = lis2[n/2-1]
m2 = lis2[n/2]

c = 0
for i in range((m1+1), (m2+1)):
    c += 1
print(c)
Problem p03036 (python)

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

for i in range(10):
    x = (r * x) - d
    print(x)

Buggy submission (verdict: Runtime Error):
r, d, x = map(int, input().split())

for i in range(10):
    x = (r * x) - D
    print(x)
Problem p03041 (python)

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

print(s[:b-1] + s[b-1].lower() + s[b:])

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

print(s[:k-1] + s[k-1].lower() + s[k:])

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

print(s[0:k-1] + s[k-1].lower() + s[k:a])

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

print(s[0:k-1] + s[k-1].lower() + s[k, a])
Problem p03775 (python)

Fixed submission:
n = int(input())
pf={}
for i in range(1,int(n**0.5) + 1):
    if n % i == 0:
      pf[i] = pf.get(i,0) + 1
a = max(pf)
b = int(n/a)
ans = max(len(str(a)), len(str(b)))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
pf={}
for i in range(2,int(n**0.5) + 1):
    if n % i == 0:
      pf[i] = pf.get(i,0) + 1
a = max(pf)
b = int(n/a)
ans = max(len(str(a)), len(str(b)))
print(ans)
Problem p03805 (python)

Fixed submission:
N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

def dfs(v, used):
    if not False in used:
        return 1
    
    ans = 0
    for i in range(N):
        if not adj_matrix[v][i]:
            continue
        if used[i]:
            continue
        
        used[i] = True
        ans += dfs(i, used)
        used[i] = False
    
    return ans

used = [False] * N
used[0] = True

print(dfs(0, used))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
adj_matrix = [[0] * n for _ in range(N)]

for i in range(m):
  a, b = map(int, input().split())
  adj_matrix[a-1][b-1] = 1
  adj_matrix[b-1][a-1] = 1
  
def dfs(v, used):
  if not False in used:
    return 1
  
  ans = 0
  for i in range(n):
    if not adj_matrix[v][i]:
      continue
    if used[i]:
      continue
    
    used[i] = True
    ans += dfs(i, used)
    used[i] = False
    
  return ans

used = [False] * n
used[0] = True

print(dfs(0, used))
Problem p03307 (python)

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

n = int(input())

# for i in range(1, 10**9):
#     if i % 2 == 0 and i % n == 0:
#         print(i)
#         break

if n % 2 == 0:
    print(n) 
else:
    print(2*n)

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

n = int(input())

# for i in range(1, 10**9):
#     if i % 2 == 0 and i % n == 0:
#         print(i)
#         break

if n % 2 == 0:
    print(n) 
else:
    print(2n)
Problem p03834 (python)

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

s = input()

print(s.replace(',', ' '))

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

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

ans = 0

for i in range(k+1):
    for j in range(k+1):
        k2 = s - j - i
        if 0 <= k2 <=k:
            ans += 1

        # あれTLEだ
        # if k2 > k or k2 < 0:
        #     continue
        # if s == i + j + k2:
        #     ans += 1

print(ans)
Problem p02990 (python)

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 
N = 10**4
g1 = [1, 1]
g2 = [1, 1] 
inverse = [0, 1] 

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


N_with_K = list(map(int, input().split()))
N = N_with_K[0]
K = N_with_K[1]


for i in range(K+1):
  if i == 0:
    pass
  else:
    post_pattern = cmb(N-K+1, i, mod)
    num_pattern =  cmb(K-1, i-1, mod)
    all_pattern = post_pattern * num_pattern
    print(all_pattern % mod)

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

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

N_with_K = list(map(int, input().split()))
N = N_with_K[0]
K = N_with_K[1]

for_mod = 10**9 + 7
for i in range(K+1):
  if i == 0:
    pass
  else:
    post_pattern = cmb(N-K+1, i)
    num_pattern =  cmb(K-1, i-1)
    all_pattern = post_pattern * num_pattern
    print(all_pattern % for_mod)

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

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

N_with_K = list(map(int, input().split()))
N = N_with_K[0]
K = N_with_K[1]

for_mod = 10**9 + 7
for i in range(K+1):
  if i == 0:
    pass
  else:
    post_pattern = cmb(N-K+1, i)
    num_pattern =  cmb(K-1, i-1)
    all_pattern = post_pattern * num_pattern
    print(all_pattern % for_mod)