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

Fixed submission:
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]
s.sort()
ss = s[0]
num = 0
ans=0
for i in range(N):
    if ss == s[i]:
        num+=1
    else:
        ans+=num*(num-1)//2
        num=1
        ss=s[i]
ans+=num*(num-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
s = [input() for i in range(N)]
c = []
rem = []
num = 0

for i,si in enumerate(s):
    s.pop(i)
    snum = 0
    for j,sj in enumerate(s):
        if Counter(si) == Counter(sj):
            snum+=1
            rem.append(j)
    rem.reverse()
    if(snum==1):
        num = num + 1
    else:
        num = num + int(snum*(snum+1)/2)

    for r in rem:
        s.pop(r)
    rem.clear()
print(num)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from scipy.special import comb
N = int(input())
s = [input() for i in range(N)]
c = []
rem = []
num = 0
for i,si in enumerate(s):
    s.pop(i)
    snum = 0
    for j,sj in enumerate(s):
        if Counter(si) == Counter(sj):
            snum+=1
            rem.append(j)
    rem.reverse()
    num += comb(snum+1, 2, exact=True)
    for r in rem:
        s.pop(r)
    rem.clear()
print(num)
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*r*r)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
Problem p02971 (python)

Fixed submission:
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
B = sorted(A, reversed = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
Problem p03024 (python)

Fixed submission:
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    priant("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
r = 0
for s in S:
    if s == "x":
        r += 1
if r < 8:
    priant("YES")
else:
    print("NO")
Problem p03067 (python)

Fixed submission:
li = list(map(int, input().split()))
A = li[0]
B = li[1]
C = li[2]
 
if A < C < B or A > C > B:
  print("Yes")
  
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
 
le=N
 
ans = 0
for i in range(le-1):
  if S[i]=="#" and S[i+1]==".":
    ans += 1
    S = S[:i+1] + "#" + S[i+2:]
  
if 2*ans < N:
  print(ans)
 
else:
  print(le-ans)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())
 
ans = ""
for c in S:
    if S[K-1] != c:
        ans += '*'
    else:
        ans += c
 
print(ans)

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

ans = ""
for c in S:
    if S[K] != c:
        ans += '*'
    else:
        ans += c

print(ans)
Problem p03079 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A==B and B==C:
  	print("Yes")
else:
  	print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A==b and B==C:
  	print("Yes")
else:
  	print("No")
Problem p03080 (python)

Fixed submission:
N = int(input())
S = input()

a = 0
for s in S:
  if s=="R":
  	  a += 1
if a > N-a:
	print("Yes")
else:
  	print("No")

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

a = 0
for s in S:
  if s=="B":
  	  a += 1
if a > N-a:
	print("Yes")
else:
  	print("No")
Problem p02898 (python)

Fixed submission:
NK_lis = list(map(int,input().split()))
h_lis = list(map(int,input().split()))
a = 0
for i in range(NK_lis[0]):
    if h_lis[i] >= NK_lis[1]:
        a += 1
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
h = []
a = 0
for i in range(N):
    b = int(input())
    h.append(b)
    if h[i] >= K:
        a += 1
print(a)
Problem p02983 (python)

Fixed submission:
import sys
import itertools

input = sys.stdin.readline

def func(l, r):
    mod_min = float('inf')

    for i in range(l, r):
        for j in range(i+1, r+1):
            mod = (i*j % 2019)

            if mod == 0:
                print(mod)
                exit()     

            elif mod < mod_min:
                mod_min = mod

    print(mod_min)

def main():
    l, r = [int(i) for i in input().split()] 
    func(l, r)
    
# main関数呼び出し
if __name__ == "__main__":
    main()

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

input = sys.stdin.readline

def main():
    l, r = [int(i) for i in input().split()] 

    mod = 0
    mod_min = 2019

    for i, j in itertools.combinations(range(l, r+1), 2):
        mod = (i*j % 2019)
        if mod == 0:
            print(mod)
            exit()
        elif mod < mod_min:
            mod_min = mod
            
    print(mod_min)

# main関数呼び出し
if __name__ == "__main__":
    main()

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

input = sys.stdin.readline

def main():
    l, r = [int(i) for i in input().split()] 

    mod_min = 2019

    for i, j in itertools.combinations(range(l, r+1), 2):
        mod = (i*j % 2019)
        if mod < mod_min:
            mod_min = mod
            
    print(mod_min)

# main関数呼び出し
if __name__ == "__main__":
    main()
Problem p03324 (python)

Fixed submission:
D, N = map(int, raw_input().split())
if N == 100:
 if D == 0:
    print(101)
 elif D == 1:
    print(10100)
 elif D == 2:
    print(1010000)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

Buggy submission (verdict: Runtime Error):
D, N = map(int, raw_input().split())
if N == 100
 if D == 0:
    print(101)
 elif D == 1:
    print(10001)
 elif D == 2:
    print(1000001)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)

Buggy submission (verdict: Runtime Error):
D, N = map(int, raw_input().split())
if N == 100
 if D == 0:
    print(101)
  elif D == 1:
    print(10001)
  elif D == 2:
    print(1000001)
elif D == 0:
  print(N)
elif D == 1:
  print(N*100)
elif D == 2:
  print(N*10000)
Problem p03415 (python)

Fixed submission:
a = raw_input()
b = raw_input()
c = raw_input()

A = list(a)
B = list(b)
C = list(c)

print(A[0]+B[1]+C[2])

Buggy submission (verdict: Runtime Error):
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


if int(A) == int(B):
  ans = 1

for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
a = raw_input()
l = a.split()
A = l[0]
B = l[1]
ans = 0


for i in range(int(A),int(B)):
  C = list(str(i))
  if C[0] == C[4] and C[1] == C[3]:
    ans += 1
    
print(ans)
Problem p03547 (python)

Fixed submission:
x, y = map(ord, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')

Buggy submission (verdict: Runtime Error):
x, y = map(int, input(). split())
if x < y:
    print('<')
elif x > y:
    print('>')
else:
    print('=')
Problem p02995 (python)

Fixed submission:
def gcd(A,B):
    if A==B:
        output=A
    n=max(A,B)
    m=min(A,B)
    r=100
    while r>0:
        r=n%m
        n=m
        m=r
    return n

def div(A,B,C):
    n1=A%C
    if n1==0:
        ans1=A//C
    else:
        ans1=A//C+1
    n2=B%C
    if n2==0:
        ans2=B//C
    else:
        ans2=(B-B%C)//C
    d=ans2-ans1+1
    if d>=1:
        ans3=d
    else:
        ans3=0
    return ans3

A,B,C,D=map(int,input().split())
num1=div(A,B,C)
num2=div(A,B,D)
n=gcd(C,D)
lcm=C*D//n
num3=div(A,B,lcm)
lastanswer=(B-A+1)-(num1+num2-num3)
print(lastanswer)

Buggy submission (verdict: Runtime Error):
import math
def div(A,B,C):
    n1=A%C
    if n1==0:
        ans1=A//C
    else:
        ans1=A//C+1
    n2=B%C
    if n2==0:
        ans2=B//C
    else:
        ans2=(B-B%C)//C
    d=ans2-ans1+1
    if d>=1:
        ans3=d
    else:
        ans3=0
    return ans3

A,B,C,D=map(int,input().split())
num1=div(A,B,C)
num2=div(A,B,D)
n=math.gcd(C,D)
lcm=C*D//n
num3=div(A,B,lcm)
lastanswer=(B-A+1)-(num1+num2-num3)
print(lastanswer)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
a=list(input().split())
s=0
i=0
while s<=X:
    i+=1
    if i==N+1:
        break
    s+=int(a[i-1])
print(i)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
a=list(input().split())
s=0
i=0
while s<=X:
    s+=int(a[i])
    i+=1
print(i)
Problem p03024 (python)

Fixed submission:
S=str(input())
N=8-S.count('o')
n=15-len(S)
if n>=N:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S=str(input())
N=S.count('o')
if N>=8:
    pint('Yes')
else:
    print('No')
Problem p03059 (python)

Fixed submission:
A,B,T=map(int,input().split())
num=(T+0.5)//A
print(int(num*B))

Buggy submission (verdict: Runtime Error):
A,B,T=map(int,input(),split())
num=(T+0.5)//A
print(num*B)
Problem p03126 (python)

Fixed submission:
N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
    a[i]=set(a[i])
c=a[0]
for i in range(N):
    c=c&a[i]
print(len(c))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
s=0
a = [list(input().split())for i in range(N)]
for i in range(N):
    del a[i][0]
b=set(a)
print(len(b))
Problem p03284 (python)

Fixed submission:
N,K=map(int,input().split())
if N%K==0:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
if N%k==0:
    print(0)
else:
    print(1)
Problem p03323 (python)

Fixed submission:
A,B=map(int,input().split())
if (A<9) and (B<9):
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if 'A<9) and (B<9):
    print('Yay!')
else:
    print(':)')
Problem p03415 (python)

Fixed submission:
A=input()
B=input()
C=input()
a=A[:1]
b=B[1:2]
c=C[2:3]
print(a+b+c)

Buggy submission (verdict: Runtime Error):
import math
N,M=map(int,input().split())
n=math.fabs(N-2)
m=math.fabs(M-2)
ans=int(n*m)
print(ans)
Problem p03501 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B=mp(int,input().split())
if N*A<=B:
  print(N*A)
else:
  print(B)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
s=N*A
t=B
if s>t:
  print(t)
else:
  prine(s)
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
disA=abs(x-a)
disB=abs(x-b)
if disA>disB:
  print('B')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
disA=abs(x-a)
disB=abs(x-b)
if disA>disB:
  print(B)
else:
  print(A)
Problem p03613 (python)

Fixed submission:
import sys
N = int(sys.stdin.readline())
data = [0] * 100000
for i in map(int,sys.stdin.readline().split()):
	data[i] += 1
print(max(map(sum,zip(data,data[1:],data[2:]))))

Buggy submission (verdict: Runtime Error):
import sys
N = int(sys.stdin.readline())
data = [0] * 10000
for i in map(int,sys.stdin.readline().split()):
	data[i] += 1
print(max(map(sum,zip(data,data[1:],data[2:]))))
Problem p03773 (python)

Fixed submission:
data = list(map(int,input().split(" ")))
x = sum(data)
if x >= 24:
	print(x%24)
else:
    print(x)

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

if V[0] == V[A-1]:
    cnt = sum(nCr(a_num,i) for i in range(A,min(B,a_num))) 
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))

Buggy submission (verdict: Runtime Error):
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

cnt = 0
if V[0] == V[A-1]:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))
Problem p03086 (python)

Fixed submission:
ACGT = ['A','C','G','T']
s = input() + 'X'
l,count = 0,0
for i in range(len(s)):
	if s[i] in ACGT:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)

Buggy submission (verdict: Runtime Error):
ACGT = ['A','C','G','T']
l,count = 0,0
for i in range(len(s)):
	if ACGT.find(s[i]) >= 0:
		count += 1
	else:
		if l < count:
			l = count
		count = 0
print(l)
Problem p03088 (python)

Fixed submission:
N, MOD = int(input()), 10**9+7
memo = [{} for i in range(N+1)]
# Keyが直前の三文字、Valueが作れる文字列の数
# ↑これを文字列の今の長さごとにメモする
# memo[6]['TTT']には直前の三文字がTTTで、
# 6文字目以降の条件に合う文字列の総数が入ってる


# めも化再帰
def dfs(index,last3):
	if last3 in memo[index]:
		return memo[index][last3]
	if index == N:
		return 1
	c_next = 'AT'
	if last3[1:] != 'AC':
		c_next += 'G'
	if ('AG' in last3) == False:
		if  last3[1:] != 'GA':
			if last3[0]+last3[2] != 'AG':
				c_next += 'C'
	count = 0
	for c in c_next:
		count += dfs(index+1,last3[1:]+c)
		count %= MOD

	memo[index][last3] = count
	return count

print(dfs(0,'TTT'))

Buggy submission (verdict: Runtime Error):
N, MOD = int(input()), 10**9+7
count = 0
def dfs(index,last3):
	if index == N:
		return 1
	c_next = 'AT'
	if 'AC' in last3[1:]:
		c_next + 'G'
	if 'AG' in last3 == False:
		if  last3[1:] != 'GA':
			if last3[0]+last3[2] != 'AG':
				c_next + 'C'

	for c in c_next:
		count += dfs(index+1,last3[1:]+c)

print(dfs(0,'TTT'))
Problem p03101 (python)

Fixed submission:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
print((a[0]-b[0])*(a[1]-b[1]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,inputr().split()))
b = list(map(int,inputr().split()))
print((a[0]-b[0])*(a[1]-b[1]))
Problem p03102 (python)

Fixed submission:
N,M,C = list(map(int,input().split()))
b = list(map(int,input().split()))
count = 0
for i in  range(N):
	a = list(map(int,input().split()))
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,M,C = list(map(int,input().split()))
b = input()
count = 0
for i in  range(N):
	a = input()
	s = 0
	for j in range(M):
		s += a[j]*b[j]
	if s+C>0:
		count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,M,C = list(map(int,input().split()))
b = input()
count = 0
for i in  range(N):
	a = input()
	s = 0
	for j in range(M)
		s += a[j]*b[j]
	if s>C:
		count+=1
print(count)
Problem p03103 (python)

Fixed submission:
N,m = list(map(int,input().split()))
data = [[0,0] for i in range(N)]
for i in range(N):
	data[i] = list(map(int,input().split()))
data.sort()
cost = 0
for i in range(N):
	prices,nums = data[i]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Buggy submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	prices = sortedData[i][0]
	nums = sortedData[i][1]
	if m > nums:
		cost += prices * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Buggy submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	prices = sortedData[i][0]
	nums = sortedData[i][1]
	if m > nums:
		cost += price * nums
		m -= nums
	else:
		cost += prices * m
		print(cost)
		break

Buggy submission (verdict: Runtime Error):
N,m = list(map(int,input().split()))
data = {}
for i in range(N):
	a,b = list(map(int,input().split()))
	data[a] = b
sortedData = sorted(data.items())
cost = 0
for i in range(N):
	v = sortedData[i][1]
	if m > v:
		cost += sortedData[i][0] * v
		m -= v
	else:
		cost += sortedData[i][0] * m
		print(cost)
		break
Problem p03547 (python)

Fixed submission:
a = list(map(str,input().split()))
dic = {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,"A":10,"B":11,"C":12,"D":14,"E":15,"F":16}
if dic[a[0]]==dic[a[1]]:
  print("=")
elif dic[a[0]]>dic[a[1]]:
  print(">")
else:
  print("<")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
dic = {0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,"A":10,"B":11,"C":12,"D":14,"E":15,"F":16}
if dic[a[0]]==dic[a[1]]:
  print("=")
elif dic[a[0]]>dic[a[1]]:
  print(">")
else:
  print("<")
Problem p03658 (python)

Fixed submission:
n, k = map(int, input().split())
l = list(map(int, input().split()))
len = 0
l.sort()
l.reverse()

for i in range(k):
  len += l[i]

print(len)

Buggy submission (verdict: Runtime Error):
#1行目を読み取る
line1 = input()
#スペースで区切る
splitLine1 = line1.split()

#それぞれをintに変換してn, kに代入する
#n, k = map(int, splitLine1)を分解
n = int(splitLine1[0])
k = int(splitLine1[1])

#2行目を読み取る
line2 = input()
#スペースで区切る
splitLine2 = line2.split()

#それぞれをintに変換してリストとして持つ
lengthList = []
for i in range(n):
  eachLengthNum = int(splitLine2[i])
  lengthList.append(eachLengthNum)

#lengthListを数字の小さい順にソートする
lengthList.sort()
#順番に取り出すために、大きい順に並べ替える
#reverseを使うと、listの順番をひっくり返す
lengthList.reverse()

#頭からkまでの数字を合計していく
resultLengthSum = 0
for i in range(k):
  resultLengthSum += l[i]

#答えを出力
print(resultLengthSum)
Problem p03672 (python)

Fixed submission:
S = input().strip()
while len(S) > 0:
  S = S[:-1]
  mid = len(S)//2
  if S[:mid] == S[mid:]:
    print(len(S))
    break

Buggy submission (verdict: Runtime Error):
S = input().strip()
while len(S) > 0:
  S = S[:-1]
  mid = len(S)//2
  if S[:mid] == S[mid:]:
    print(len(S))
  	break
Problem p03674 (python)

Fixed submission:
import itertools

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

MOD = 10**9 + 7
MAX_NUM = 10**5 + 10

def inv_mod(n):
  return pow(n, MOD-2, MOD)

FACTS = [1 for _ in range(MAX_NUM+1)]
for n in range(1, MAX_NUM+1):
  FACTS[n] = (n*FACTS[n-1]) % MOD

INV_FACTS = [1 for _ in range(MAX_NUM+1)]
INV_FACTS[MAX_NUM] = inv_mod(FACTS[MAX_NUM])
for n in range(MAX_NUM-1, -1, -1):
  INV_FACTS[n] = (INV_FACTS[n+1]*(n+1)) % MOD
  
for i in range(MAX_NUM+1):
  assert (FACTS[i]*INV_FACTS[i])%MOD == 1

def ncr(n, r):
  if r > n:
    return 0
  if r < 0:
    return 0
  # C(n, r) = n!/(n-r)!r!
  ans = FACTS[n]*INV_FACTS[n-r]*INV_FACTS[r]
  return ans % MOD

from collections import defaultdict
v2i = defaultdict(list)
for i, v in enumerate(A):
  v2i[v].append(i)

fst, snd = -1, -1
for v in v2i:
  if len(v2i[v]) == 2:
    fst, snd = v2i[v]

K = snd - fst - 1
for ell in range(1, N+2):
  ans = ncr(N+1, ell) - ncr(N-1-K, ell-1)
  print(ans%MOD)

Buggy submission (verdict: Runtime Error):
import itertools

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

MOD = 10**9 + 7
MAX_NUM = 10**5

def inv_mod(n):
  return pow(n, MOD-2, MOD)

FACTS = [1 for _ in range(MAX_NUM+1)]
for n in range(1, MAX_NUM+1):
  FACTS[n] = (n*FACTS[n-1]) % MOD

INV_FACTS = [1 for _ in range(MAX_NUM+1)]
INV_FACTS[MAX_NUM] = inv_mod(FACTS[MAX_NUM])
for n in range(MAX_NUM-1, -1, -1):
  INV_FACTS[n] = (INV_FACTS[n+1]*(n+1)) % MOD
  
for i in range(MAX_NUM+1):
  assert (FACTS[i]*INV_FACTS[i])%MOD == 1

def ncr(n, r):
  if r > n:
    return 0
  if r < 0:
    return 0
  # C(n, r) = n!/(n-r)!r!
  ans = FACTS[n]*INV_FACTS[n-r]*INV_FACTS[r]
  return ans % MOD

from collections import defaultdict
v2i = defaultdict(list)
for i, v in enumerate(A):
  v2i[v].append(i)

fst, snd = -1, -1
for v in v2i:
  if len(v2i[v]) == 2:
    fst, snd = v2i[v]

K = snd - fst - 1
for ell in range(1, N+2):
  ans = ncr(N+1, ell) - ncr(N-1-K, ell-1)
  print(ans%MOD)

Buggy submission (verdict: Runtime Error):
import iterools

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

for i in range(n+1):
  if i == len(n):
    print(1)
  else:
    combos = list(itertools.combinations(a, i))
    print(len(set(combos)))

Buggy submission (verdict: Runtime Error):
import iterools

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

for i in range(n):
  if i == len(n)-1:
    print(1)
  else:
    combos = itertools.combinations(a, i)
    print(len(set(combos)))
Problem p03280 (python)

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

ans = (a - 1) * (b - 1)
print(ans)

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

ans = (a - 1) * (b - 1)
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

print((A - 1) * (B - 1))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
print((A - 1) * (B - 1))
Problem p03289 (python)

Fixed submission:
import re

S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')

Buggy submission (verdict: Runtime Error):
S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')
Problem p03370 (python)

Fixed submission:
N, X = [int(i) for i in input().split()]
m = [0 for i in range(N)]

for i in range(N):
  m[i] = int(input())

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)

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

for i in range(N):
  m(i) = int(input())

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)

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

for i in range(N):
  m(i) = int(m(i))

X = X - sum(m)
num = X // min(m)
num = num + N

print(num)
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = [int(i) for i in input().split()]

cost1 = X * A + Y * B

c = X * 2
a = 0
b = max([0, Y - c / 2])
cost2 = a * A + b * B + c * C

c = Y * 2
a = max([0, X - c / 2])
b = 0
cost3 = a * A + b * B + c * C

print(int(min([cost1, cost2, cost3])))

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

mincost = 10000000000

for a in range(X + 1):
    for b in range(Y + 1):
        c = max[(X - a) * 2, (Y - b) * 2]
        cost = a * A + b * B + c * C
        if (cost < mincost):
            mincost = cost

print(mincost)
Problem p02917 (python)

Fixed submission:
N = int(input())
Bs = list(map(int, input().split()))
 
As = [ None for _ in range(N) ]

As[0] = Bs[0]
for i in range(1, N-1):  
  As[i] = min(Bs[i-1], Bs[i])

As[-1] = Bs[-1]

print(sum(As))

Buggy submission (verdict: Runtime Error):
N = int(input())
Bs = list(map(int, input().split()))
 
As = [ None for _ in range(N) ]

As[0] = Bs[0]
for i in range(1, N):  
  As[i] = min(Bs[i-1], Bs[i])

print(sum(As))