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

Fixed submission:
n = int(input())
s = input().split()

for si in s:
  if si == "Y":
    print("Four")
    break
else:
  print("Three")

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

for si in s:
  if si == "Y":
    print("Four")
    break
else:
  print("Three")
Problem p03433 (python)

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

if n % 500 <= a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
b = int(N / A)
c = N - 500 * b
if c > A:
    print("No")
else:
    print("Yes")
Problem p03434 (python)

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

ans = 0
for i in range(len(a)):
  if i % 2 == 0:
    ans += a[i]
  else:
    ans -= a[i]

print(ans)

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

ans = 0
for i in range(len(a)):
  if i % 2 == 0:
    ans += a[i]
  else:
    ans -= a[i]

print(ans)
Problem p03477 (python)

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

if a + b > c + d:
	print("Left")
elif a + b == c + d:
	print("Balanced")
else:
	print("Right")

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

if a + b > c + d:
	print("Left")
elif a + b == c + d:
	print("Balanced")
else:
	print("Right")
Problem p03547 (python)

Fixed submission:
x, y = input().split()

if x > y:
	print(">")
elif x == y:
	print("=")
else:
	print("<")

Buggy submission (verdict: Runtime Error):
x, y = input().split()

if x > y:
	print(">")
elsif x == y:
	print("=")
else:
	print("<")
Problem p03555 (python)

Fixed submission:
c = []
for i in range(2):
	c.append(input())

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
c = []
for i in range(2):
	c.append(list(map(int, input().split())))

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
c = []
for i in range(2):
	c.append(list(map(int, input().split()))

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
c = [[list(map(int, input().split()))] for _ in range(2)]

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
c = [list(map(int, input().split())) for _ in range(2)]

if c[0][0] == c[1][2] and c[0][1] == c[1][1] and c[0][2] == c[1][0]:
	print("Yes")
else:
	print("No")
Problem p03605 (python)

Fixed submission:
n = input()

if "9" in n:
  print("Yes")
else:
  print("No")

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

if "9" in n:
  print("Yes")
else:
  print("No")
Problem p03648 (python)

Fixed submission:
K = int(input())
N = 50
a = [0] * 50

if K <= 50:
    for i in range(K):
        a[i] = 50
else:
    m = (K - 1) // 50
    base = 100 + m
    r = K % 50
    big = base - r
    small = big - 50 - r

    for i in range(r):
        a[i] = big
    for i in range(r, N, 1):
        a[i] = small

print(N)
print(" ".join(map(str, a)))

Buggy submission (verdict: Runtime Error):
N = 50
big = 10 ** 16

K = int(input())

if K <= 50 * 50:
    a = [49] * 50
    a[0] += K * 50
else:
    a = [0] * 50
    index = 0 
    for i in range(K // big):
        a[i] = big
    a[i] = K % big
print(N)
print(" ".join(map(str, a)))
Problem p03682 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n = int(input())
x = []
y = []
for i in range(n):
    s = list(map(int, input().split()))
    x.append([s[0], i])
    y.append([s[1], i])

x.sort()
y.sort()

xdiff = []
ydiff = []
for i in range(1, n):
    xdiff.append([x[i][0] - x[i - 1][0], x[i - 1][1], x[i][1]])
    ydiff.append([y[i][0] - y[i - 1][0], y[i - 1][1], y[i][1]])

xdiff.sort()
ydiff.sort()

parent = [-1] * n

def getParent(index):
    if parent[index] == -1:
        return index
    else:
        parent[index] = getParent(parent[index])
        return parent[index]

count = 0
ans = 0
xIndex = 0
yIndex = 0
while count != n - 1:
    if xIndex != n - 1:
        xTemp = xdiff[xIndex]
    if yIndex != n - 1:
        yTemp = ydiff[yIndex]

    if yIndex == n - 1 or (xIndex != n - 1 and xTemp[0] < yTemp[0]):
        xIndex += 1
        temp = xTemp
    else:
        yIndex += 1
        temp = yTemp

    parent1 = getParent(temp[1])
    parent2 = getParent(temp[2])
    if parent1 == parent2:
        continue
    else:
        count += 1
        ans += temp[0]
        parent[parent1] = parent2

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = []
y = []
for i in range(n):
    s = list(map(int, input().split()))
    x.append([s[0], i])
    y.append([s[1], i])

x.sort()
y.sort()

xdiff = []
ydiff = []
for i in range(1, n):
    xdiff.append([x[i][0] - x[i - 1][0], x[i - 1][1], x[i][1]])
    ydiff.append([y[i][0] - y[i - 1][0], y[i - 1][1], y[i][1]])

xdiff.sort()
ydiff.sort()

parent = [-1] * n

def getParent(index):
    if parent[index] == -1:
        return index
    else:
        return getParent(parent[index])

count = 0
ans = 0
xIndex = 0
yIndex = 0
while count != n - 1:
    if xIndex != n - 1:
        xTemp = xdiff[xIndex]
    if yIndex != n - 1:
        yTemp = ydiff[yIndex]

    if yIndex == n - 1 or (xIndex != n - 1 and xTemp[0] < yTemp[0]):
        xIndex += 1
        temp = xTemp
    else:
        yIndex += 1
        temp = yTemp

    parent1 = getParent(temp[1])
    parent2 = getParent(temp[2])
    if parent1 == parent2:
        continue
    else:
        count += 1
        ans += temp[0]
        parent[temp[1]] = temp[2]

print(ans)
Problem p03730 (python)

Fixed submission:
import fractions

A, B, C = map(int, input().split())
ab = fractions.gcd(A, B)
temp = fractions.gcd(A, ab)
if C % temp == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import fractions

A, B, C = map(int, input().split())
ab = fractions.gcd(A, B)
if C % temp == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import fractions

A, B, C = map(int, input().split())
ab = math.gcd(A, B)
temp = fractions.gcd(A, ab)
if C % temp == 0:
    print("YES")
else:
    print("NO")
Problem p03455 (python)

Fixed submission:
a,b = [int(x) for x in input().split(' ')]
if a * b % 2 == 0:
	print('Even')
else:
	print('Odd')

Buggy submission (verdict: Runtime Error):
a,b = [x for x in input().split(' ')]
if a * b % 2 == 0:
	print('Even')
else:
	print('Odd')
Problem p03701 (python)

Fixed submission:
n = int(input())
sum = 0
sub = 101
for i in range(n):
    store = int(input())
    sum += store
    if store % 10 != 0 and store < sub:
        sub = store
if sum % 10 != 0:
    print(sum)
else:
    if sub == 101:
        print(0)
    else:
        print(sum - sub)

Buggy submission (verdict: Runtime Error):
import math as mt
store = []
def binarysearch(min, max):
    mid = int((max + min)/2)
    if (min == max):
        return mid
    elif count(mid) > mid:
        return binarysearch(mid+1, max)
    else:
        return binarysearch(min, mid)

def count(x):
    store = [mt.ceil((n - x*b)/a) for n in hp]
    store = [x for x in store if x > 0]
    return sum(store)

st = 0
min = 10 ** 18
max = 0
n, a, b = [int(x) for x in input().split(' ')]
hp = []
for i in range(n):
    st = int(input())
    if st < min:
        min = st
    if st > max:
        max = st
    hp.append(st)
min, max = mt.ceil(min/a), mt.ceil(max/b)
a = a - b
print(binarysearch(min,max))
Problem p02621 (python)

Fixed submission:
a=input()
a=int(a)
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
a=int(input()) print(a+a*a+a**3)

Buggy submission (verdict: Runtime Error):
a=input()
print(a+a*a+a*a*a)
Problem p02639 (python)

Fixed submission:
A=list(map(int,input().split()))
for i in range(len(A)):
  if A[i]==0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
def main1():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    ans=[1]*len(A)
    for i in  range(len(A)-1):
        if ans[i]==0:
            continue
        for j in range(i+1,len(A)):
            if A[j]%A[i]==0:
                ans[j]=0
    an=0
    for i in range(len(A)-1):
        if A[i]!=A[i+1]:
            an+=ans[i]
    an+=ans[-1]
    print(an)
main1()
Problem p02642 (python)

Fixed submission:
def main1():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    ans=[0]*(10**6+1)
    if N ==1 :
        print(1)
        return 
    for i in  range(len(A)):
        ans[A[i]]+=1
        if ans[A[i]]==1:
            for j in range(A[i]*2,10**6+1,A[i]):
                ans[j]=2
    print(ans.count(1))
main1()

Buggy submission (verdict: Runtime Error):
def main1():
    N=int(input())
    A=list(map(int,input().split()))
    A.sort()
    ans=[0]*(10**6)
    for i in  range(len(A)-1):
        if ans[A[i]]>=2:
            continue
        if A[i]!=A[i+1]:
            ans[i]+=1
        for j in range(A[i]*2,10**6,A[i]):
                ans[j]=2
    print(ans.count(1))
main1()

Buggy submission (verdict: Runtime Error):
def main1():
    N=int(input())
    A=map(int,input().split())
    A.sort()
    ans=[0]*(10**6)
    for i in  range(len(A)-1):
        if ans[i]>=2:
            continue
        if A[i]!=A[i+1]:
            ans[i]+=1
        for j in range(A[i]*2,10**6,A[i]):
                ans[j]=2
    print(ans.count(1))
main1()
Problem p02660 (python)

Fixed submission:
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def main():
    N=int(input())
    ans=0
    if N==1:
        print(ans)
        return 
    t=prime_decomposition(N)
    if len(t)==1:
        print(1)
        return 
    dic={}
    for a in t:
        if not a in dic.keys():
            dic[a]=1
            continue
        else:
            dic[a]+=1
    ans=0
    for i in dic.keys():
        num=dic[i]
        tmp=1
        c=1
        while True:
            if num >=c:
                num-=c
                c+=1
                ans+=1
            else:
                break
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
import sympy
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def main():
    N=int(input())
    ans=0
    if N==1:
        print(ans)
        return 
    t=prime_decomposition(N)
    if len(t)==1:
        print(1)
        return 
    dic={}
    for a in t:
        if not a in dic.keys():
            dic[a]=1
            continue
        else:
            dic[a]+=1
    ans=0
    for i in dic.keys():
        num=dic[i]
        tmp=1
        c=1
        while True:
            if num >=c:
                num-=c
                c+=1
                ans+=1
            else:
                break
    print(ans)



        


main()
Problem p02778 (python)

Fixed submission:
S=input()
ans=""
for i in range(len(S)):
  ans+="x"
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
for i in range(len(S)):
  S[i]="x"
print(S)
Problem p02787 (python)

Fixed submission:
INF=10**10
def main():
  H,N=map(int,input().split())
  AB=[]
  for i in range(N):
    AB.append(list(map(int,input().split())))
  dp=[INF]*(H+1)
  dp[0]=0
  for a,b in AB:
    for k in range(H+1):
      tmp=k-a
      if tmp<0:
        tmp=0
      need_magic=dp[tmp]+b
      if need_magic<dp[k]:
        dp[k]=need_magic
  print(dp[H])
main()

Buggy submission (verdict: Runtime Error):
INF=10**10
def main():
  H,N=map(int,input().split())
  AB=[]
  for i in range(N):
    AB.append(list(map(int,input().split())))
  dp=[INF]*(H+1)
  dp[0]=0
  for a,b in AB:
    for k in range(H+1):
      tmp=k-a
      if tmp<0:
        tmp=0
      need_magic=dp[tmp]+b
      if need_magic<dp[k]:
        dp[k]=need_magic
  print(dp[H+1])
main()
Problem p02812 (python)

Fixed submission:
N=int(input())
S=input()
count=0
for i in range(len(S)-2):
  if S[i]=="A":
    if S[i+1]=="B" and S[i+2]=="C":
      count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
count=0
for i in range(len(S)):
  if S[i]=="A":
    if S[i+1]=="B" and S[i+2]=="C":
      count+=1
print(count)
Problem p02838 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
import numpy as np
a=np.array(a)
mod = 10**9+7
md = len(bin(max(a)))
ans = 0
for d in range(md):
    cnt1 = np.count_nonzero((a>>d)&1)# a内の全ての要素の d bit目の1の個数を数える
    ans += cnt1 * (n-cnt1) * (1<<d)          # 求めるべきは (0の個数)*(1の個数)をd bit目にそのまま収めたものを足し合わせたもの (?)
    ans %= mod                               # mod 取っておく
    
print(ans%mod)

Buggy submission (verdict: Runtime Error):
imoprt numpy as np 
n = int(input())
A = list(map(int,input().split()))
a=np.array(A)
mod = 10**9+7
md = len(bin(max(a)))
ans = 0
for d in range(md):
    cnt1 =np.count_nonzero(a)        
    ans += cnt1 * (n-cnt1) * (1<<d)         
    ans %= mod                              
    
print(ans%mod)
Problem p02865 (python)

Fixed submission:
N=int(input())
if N%2==0:
  print(N//2-1)
else:
  print(N//2)

Buggy submission (verdict: Runtime Error):
def main():
  N=int(input())
  A=list(map(int,input().split()))
  B=list(map(int,input().split()))
  tmp={}
  for i in range(N):
    if not B[i] in tmp.keys():
      tmp[B[i]]=[]
    tmp[B[i]].append(A[i])
  A.sort()
  B.sort()
  for i in range(N):
    if A[i]>B[i]:
      print("No")
      return 0
  for i in range(N):
    if A[i] in tmp[B[i]]:
      print("Yes")
      return 0
    if i!=N-1:
      if B[i] >= A[i+1]:
        print("Yes")
        return 0
  print("No")
      
main()
Problem p02909 (python)

Fixed submission:
S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
S=input()
if S=='Sunny':
  print('Cloudy')
elif S='Cloudy':
  print('Rainy')
else:
  print('Sunny')
Problem p02917 (python)

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
sum=B[0]
for i in range(len(B)-1):
  sum+=min(B[i],B[i+1])
sum+=B[-1]
print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
B=map(int,input().split())
sum=B[0]
for i in range(len(B)-1):
  sum+=min(B[i],B[i+1])
sum+=B[-1]
print(sum)
Problem p02928 (python)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0:
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  K=K//2
  ans=(tmp*K)%Mod
else:
  tmp=(ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  ans=(tmp*K)//2%Mod
else:
  tmp=(2*ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)
Problem p02988 (python)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
cnt =0
for i in range(1,n-1):
    if p[i-1]<=p[i]<=p[i+1] or p[i+1]<=p[i]<=p[i-1]:
        cnt +=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=input()
if n>20 or n<2:
  print(0)
else:
  S=list(input().split())
  count=0
  for i in range(1,len(S)-1):
      if (S[i-1]<S[i] and S[i+1]>S[i]):
          count+=1
          break
      if(S[i-1]>S[i] and S[i+1]<S[i]):
          count+=1
  print(count)

Buggy submission (verdict: Runtime Error):
ソースコード 拡げる

Copy
Copy
n=input()
S=list(input().split())
count=0
for i in range(1,len(S)-1):
    if (S[i-1]<S[i] and S[i+1]>S[i]) or (S[i-1]>S[i] and S[i+1]<S[i]):
        count+=1
print(count)
Problem p02995 (python)

Fixed submission:
def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(int,input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    mod=C*D//gcd(C,D)
    if A%mod!=0:
        CD_min=A-A%mod+mod
    else:
        CD_min=A
    CD_max=B-B%mod
    C_sum=(C_max-C_min)//C
    D_sum=(D_max-D_min)//D
    CD_sum=(CD_max-CD_min)//mod
    sum= B-A+1-int(C_sum+D_sum-CD_sum+1)
    return sum
print(int(main()))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/gcd(C,D))!=0:
        CD_min=A-A%(C*D/gcd(C,D))+(C*D/gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/gcd(C,D))+1
    sum= B-A+1-int(C_sum+D_sum-CD_sum)
    return sum
print(main())

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b

def main():
    A,B,C,D=map(input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/gcd(C,D))!=0:
        CD_min=A-A%(C*D/gcd(C,D))+(C*D/gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/gcd(C,D))+1
    sum= B-A+1-int(C_sum+D_sum-CD_sum)
    return sum
 
print(main())

Buggy submission (verdict: Runtime Error):
def main():
    A,B,C,D=input().split()
    A=int(A)
    B=int(B)
    C=int(C)
    D=int(D)
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/gcd(C,D))!=0:
        CD_min=A-A%(C*D/gcd(C,D))+(C*D/gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/gcd(C,D))+1
    sum= B-A+1-int(C_sum+D_sum-CD_sum)
    return sum

print(main())

Buggy submission (verdict: Runtime Error):
import math
def main():
    A,B,C,D=input().split()
    A=int(A)
    B=int(B)
    C=int(C)
    D=int(D)
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/math.gcd(C,D))!=0:
        CD_min=A-A%(C*D/math.gcd(C,D))+(C*D/math.gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/math.gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/math.gcd(C,D))+1
    sum= B-A+1-(C_sum+D_sum-CD_sum)
    return sum

sum=main()
print(sum)
Problem p03039 (python)

Fixed submission:
N,M,K=map(int,input().split())
MOD=10**9+7

# 組合せの総数
def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])
            result%=MOD

    return result



ans_x=0
ans_y=0

for i in range(1,N):
  ans_x+=i*(N-i)
  ans_x%=MOD
for i in range(1,M):
  ans_y+=i*(M-i)
  ans_y%=MOD
ans_x*=((M**2))
ans_y*=((N**2))
ans=comb(N*M-2,K-2)
ans*=(ans_x+ans_y)
ans%=MOD
print(int(ans))

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
MOD=10**9+7
def comb(n, k):
    m = 1
    if n < 2 * k:
        k = n - k
    for i in range(1, k + 1):
        m = m * (n - i + 1) / i    
    return m
for i in range(1,N):
  ans_x+=(i*(N-i))
for i in range(1,M):
  ans_y+=(i*(M-i))
ans_x*=M**2
ans_y*=X**2
print(conb(NM-2,K-2)*(ans_x+ans_y)%MOD)
Problem p03068 (python)

Fixed submission:
N=int(input())
S=list(input())
K=int(input())
word=S[K-1]
for i in range(len(S)):
    if S[i]!=word:
        S[i]='*'
print(''.join(S))

Buggy submission (verdict: Runtime Error):
N=int(input())
S=list(input())
K=int(input())
word=S[K]
for i in range(len(S)):
    if S[i]!=word:
        S[i]='*'
print(''.join(S))
Problem p03076 (python)

Fixed submission:
b=10
sum=0
for _ in range(5):
  a=int(input())
  if a%10 !=0:
      sum += (a+10-a%10)
      if b>(a%10):
          b=a%10
  else:
      sum += a
print(sum-10+b)

Buggy submission (verdict: Runtime Error):
b=10
sum=0
for _ in range(5):
	a=int(input())
    sum+=a-a%10
  	if b>a:
      b=a
sum+=40+b
print(sum)
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):
N,Q=map(int, input().split())
s=list(input())
box=[1]*(N+2)
for _ in range(Q):
    k=1
    t,d=map(str, input().split())
    for j in s:
        if t == j:
            if box[k] > 0:
                if d =='L':
                    box[k-1]+=box[k]
                    box[k]=0
                else:
                    box[k+1]+=box[k]
                    box[k]=0
        k+=1
print(sum(box[1:N+1]))
Problem p03085 (python)

Fixed submission:
word=input()
if word == 'A':
  print('T')
elif word == 'T':
  print('A')
elif word == 'G':
  print('C')
else:
  print('G')

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
word_list=list(S)
for i in range(Q):
  count=0
  flag =0
  l,r=map(int,input().split())
  box=word_list[l-1:r]
  for i in box:
    if i == 'A':
      flag =1
    elif i!= 'C':
      flag=0
    if flag == 0 and i=='C':
      flag = 0
    if flag == 1 and i =='C':
      count += 1
      flag = 0
  print(count)
Problem p03095 (python)

Fixed submission:
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S))
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=list(input())
answer=counter(S)
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return (reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7)
  
N=input()
S=list(input())
answer=counter(S)
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

N=input()
S=list(input())
answer=counter(S)
print(answer)

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

N=input()
S=list(input())
answer=counter(s)
print(answer)

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

def counter(list_1):
	return reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))

if __name__ == '__main__':
  N=input()
  S=list(input())
  answer=counter(s)
  print(answer)