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

Fixed submission:
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
N = int(input())
if digitSum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
a= int(input())
if digitSum(a) % 9 == 0:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
a= int(input())
if digitsum(a) % 9 == 0:
    print(Yes)
else:
    print(No)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%9==0:
    print(Yes)
else:
    print(No)
Problem p02547 (python)

Fixed submission:
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if x == y: cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        row = True

if row: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if x == y: cnt += 1
    else:
        cnt += 1
    if cnt == 3:
    row = True

if row: print("Yes")
else: print("No")
Problem p02594 (python)

Fixed submission:
x = int(input())
if x >= 30:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x = input()
if x>= 30:
    print("Yes")
else:
    print("No")
Problem p03834 (python)

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

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

Fixed submission:
t,x=map(float, input().split())
print("{:.4f}".format(t/x))

Buggy submission (verdict: Runtime Error):
t,x=map(float, input().split())
print({0:.4f}.format(t/x))
Problem p03774 (python)

Fixed submission:
n,m=map(int, input().split())
a_list=[]
b_list=[]
for i in range(n):
  a,b=map(int, input().split())
  a_list.append(a)
  b_list.append(b)
c_list=[]
d_list=[]
for i in range(m):
  c,d=map(int, input().split())
  c_list.append(c)
  d_list.append(d)
for i in range(n):
  min=2*(10**8)
  min_number=0
  for j in range(m):
    d=abs(a_list[i]-c_list[j])+abs(b_list[i]-d_list[j])
    if d<min:
      min=d
      min_number=j
  print(min_number+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
a_list=[]
b_list=[]
for i in range(n):
  a,b=map(int, input().split())
  a_list.append(a)
  b_list.append(b)
c_list=[]
d_list=[]
for i in range(m):
  c,d=map(int, input().split())
  c_list.append(c)
  d_list.append(d)
for i in range(n):
  min=0
  min_number=0
  for j in range(m):
    d=abs(a[i]-c[j])+abs(b[i]-d[j])
    if d<min:
      min=d
      min_number=j
  print(min_number)
Problem p03834 (python)

Fixed submission:
s=input()
print(s.replace(",", " "))

Buggy submission (verdict: Runtime Error):
s=input()
print(s.replace(",", " ")

Buggy submission (verdict: Runtime Error):
s=input()
print(s.replace("," " ")
Problem p02629 (python)

Fixed submission:
def colnum_string(n):
    string = ""
    while n > 0:
        n, remainder = divmod(n - 1, 26)
        string = chr(65 + remainder) + string
    return string.lower()
N = int(input())
print(colnum_string(N))

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

table = [0] * 100010


for i in A:
  table[i] += 1

  sum = 0

  for i in A:
    sum += i

    for i in range(q):
      b, c = map(int, input().split())
      cnt = table[b]
      sum += (c - b) * cnt
      table[c] +=  table[b]
      table[b] = 0
      print(sum)
Problem p02546 (python)

Fixed submission:
def createPlural(s):
    if s[-1] == "s":
        return s + "es"
    else:
        return s + "s"

s = input()
s_plural = createPlural(s)
print(s_plural)

Buggy submission (verdict: Runtime Error):
def createPlural(s):
    if s[-1] == "s":
        return s[:-1] + "es"
    else:
        return s + "s"

s = input()
s_plural = cratePlural
print(s_plural)
Problem p02627 (python)

Fixed submission:
a = str(input())
if a.isupper() == True:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a.isupper() = True:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = int(input())
A = int(a. isupper())
if A = "True":
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a == A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P or Q or R or S or T or U or V or W or X or Y or Z:
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a=A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P or Q or R or S or T or U or V or W or X or Y or Z:
  print("A")
else:
  print("a")
Problem p02779 (python)

Fixed submission:
def pairwise_distinct():
    n = int(input())
    k = list(input().split())
    if (len(set(k)) == len(k)):
        return "YES"
    else:
        return "NO"

print(pairwise_distinct())

Buggy submission (verdict: Runtime Error):
def pairwise_distinct():
    n = int(input())
    k = []
    for i in range(0,n):
        k.append(int(input()))
    if (len(set(k)) == len(k)):
        return "YES"
    else:
        return "NO"

    return k
        
        

print(pairwise_distinct())
Problem p02835 (python)

Fixed submission:
a,b,c = map(int, input().split())
d = a + b + c
if d >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = a + b + c
if (d >= 22):
    print('bust')
else:
    print('win')

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

if (d >= 22):
    print('bust')
else:
    print('win')
Problem p02571 (python)

Fixed submission:
S=str(input())
T=str(input())
t=1000
Slen=1000
Tlen=1000
for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break

for i in range(Slen-Tlen+1):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)

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

for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break

for i in range(Slen-Tlen+1):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)

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

for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break
lists=[]
for i in range(Slen-Tlen):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)

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

for i in range(1000):
  try:
    k=S[i]
  except IndexError:
    Slen=i
    break
for j in range(1000):
  try:
    k=T[j]
  except IndexError:
    Tlen=j
    break
lists=[]
for i in range(Slen-Tlen+1):
  s=0
  for j in range(Tlen):
    if S[i+j]==T[j]:
      s+=1
    else:
      continue
  t=min(t,Tlen-s)
print (t)
Problem p02580 (python)

Fixed submission:
H,W,M=map(int,input().split())
R=[list(map(int,input().split())) for i in range(M)]
import sys
listH=[]
for i in range(H):
  listH.append(0)
for i in range(M):
  listH[R[i][0]-1]+=1
maxH=0
listHmax=[]
jH=0
for i in range(H):
  if listH[i]>maxH:
    maxH=listH[i]
    listHmax=[]
    listHmax.append(i)
    jH=1
  elif listH[i]==maxH:
    listHmax.append(i)
    jH+=1

listW=[]
for i in range(W):
  listW.append(0)
for i in range(M):
  listW[R[i][1]-1]+=1
maxW=0
listWmax=[]
jW=0
for i in range(W):
  if listW[i]>maxW:
    maxW=listW[i]
    listWmax=[]
    listWmax.append(i)
    jW=1
  elif listW[i]==maxW:
    listWmax.append(i)
    jW+=1

T=0
for i in range(M):
  if (listH[R[i][0]-1]==maxH and listW[R[i][1]-1]==maxW):
    T+=1
  else:
    continue
if T==jH*jW:
  print (maxH+maxW-1)
else:
  print (maxH+maxW)

Buggy submission (verdict: Runtime Error):
H,W,M=map(int,input().split())
R=[list(map(int,input().split())) for i in range(M)]

listH=[]
for i in range(M):
  listH.append(0)

listW=[]
for i in range(M):
  listW.append(0)
  
for i in range(M):
  listH[R[i-1][0]-1]+=1
maxH=0
listHmax=[]
jH=0
for i in range(M):
  if listH[i]==max(maxH,listH[i]):
    maxH=listH[i]
    listHmax.append(i)
    jH+=1

for i in range(M):
  listW[R[i-1][1]-1]+=1
maxW=0
listWmax=[]
jW=0
for i in range(M):
  if listW[i]==max(maxW,listW[i]):
    maxW=listW[i]
    listWmax.append(i)
    jW+=1
print (maxW+maxH)
Problem p02723 (python)

Fixed submission:
S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print ('Yes')
else:
  print ('No')

Buggy submission (verdict: Runtime Error):
S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print ('Yes')
else:
  print ('No')
Problem p02729 (python)

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

k=(M*(M-1)+N*(N-1))//2
print (k)

Buggy submission (verdict: Runtime Error):
L=int(input())
print (L**3/27)
Problem p02753 (python)

Fixed submission:
s=input()
if s[0]==s[1] and s[0]==s[2]:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s=input()
if s[0]==s[1] and s[0]==s[2]:
  print('No')
else:
  print('Yes')

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

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

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
n=int(n)
a=int(a)
b=int(b)
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
s=input()
if s[0]==s[1] and s[0]==s[2]
  print('Yes')
else
  print('No')
Problem p02754 (python)

Fixed submission:
n,a,b=map(int, input().split())
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
n=int(n)
a=int(a)
b=int(b)
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
n=int(n)
a=int(a)
b=int(b)
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
n=int(n)
a=int(a)
b=int(b)
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)

Buggy submission (verdict: Runtime Error):
n,a,b=input(),input(),input()
k=n//(a+b)*a+min(a,n%(a+b))
  
print(k)
Problem p02759 (python)

Fixed submission:
N=int(input())
print(N//2+N%2)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
b=[list(map(int,input().split())) for i in range(M)]
lists=[0,0,0]
import sys
for i1 in range(0,M):
  for i2 in range(i1,M):
    if b[i1][0]==b[i2][0] and b[i1][1]!=b[i2][1]:
      print (-1)
      sys.exit()
    else:
      lists[b[i1][0]-1]=b[i1][1]
for i3 in range(M):
  if b[i3][0]==4-N and b[i3][1]==0:
    print (-1)
    sys.exit()
s=0
for i in range(3):
  s=s+lists[i]*10**(2-i)
if s>=10**N:
  print (-1)
elif s<10**(N-1):
  s=s+10**(N-1)
  print (s)
else:
  print (s)
Problem p02759 (python)

Fixed submission:
N = int(input())
p = int(N / 2)

if N % 2 == 1:
    p = p + 1

print(p)

Buggy submission (verdict: Runtime Error):
bingo = [list(map(int, input().split(" "))) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]

#list = [[0] * 3] * 3
list = [ [0]*3 for x in range( 0, 3 ) ]
flag = 0

# print(list)

for i in range(0, 3):
    for j in range(0, 3):
        for k in range(0, N):
            if bingo[i][j] == b[k]:
                list[i][j] = 1
                #print(list)
                #print(b[k])
# print(list)
# list = [[1,0,0], [1, 1, 0], [0,0,1]]

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[i][j]
    if hantei == 3:
        flag = 1
        break

for i in range(0, 3):
    hantei = 0
    for j in range(0, 3):
        hantei = hantei + list[j][i]
    if hantei == 3:
        flag = 1
        break

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][i]
if hantei == 3:
    flag = 1

hantei = 0
for i in range(0, 3):
    hantei = hantei + list[i][2 - i]
if hantei == 3:
    flag = 1

if flag == 1:
    print('Yes')
elif flag == 0:
    print('No')
Problem p02693 (python)

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

for i in range(A, B + 1):
    if i % K == 0:
        ans = "OK"
        break
else:
    ans = "NG"
print(ans)

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


N = int(input())
a = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(N - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    to[u].append(v)
    to[v].append(u)
del u, v

ans = [-1] * N


def dfs(v, dp):
    # dp は参照渡し
    if len(dp) == 0 or a[v] > dp[-1]:
        dp.append(a[v])
        back = -1
    else:
        pos = bisect.bisect_left(dp, a[v])
        back = dp[pos]
        dp[pos] = a[v]
    ans[v] = len(dp)

    for u in to[v]:
        if ans[u] == -1:
            dfs(u, dp)
    if back == -1:
        dp.pop()
    else:
        dp[pos] = back


sys.setrecursionlimit(10 ** 6)
dfs(0, [])


for an in ans:
    print(an)
Problem p02851 (python)

Fixed submission:
from collections import Counter

N, K = map(int, input().split())
A = list(map(lambda s: int(s) % K, input().split()))

cumAm1 = [1] + A
for i in range(1, N + 1):
    cumAm1[i] = (-1 + cumAm1[i - 1] + cumAm1[i]) % K

counts = Counter()
ans = 0
for i in range(N + 1):

    if i >= K:
        counts[cumAm1[i - K]] -= 1

    cur = cumAm1[i]
    ans += counts[cur]

    counts[cur] += 1

print(ans)

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

counts = [0] * K
counts2 = [0] * K

cumAm1 = [1] 
for i, Ai in enumerate(A):
    cumAm1.append((-1 + cumAm1[-1] + Ai) % K)

for i in range(N + 1):
    if i >= K:
        counts[cumAm1[i - K]] -= 1

    cur = cumAm1[i]
    counts2[cur] += counts[cur]

    counts[cur] += 1

print(sum(counts2))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(lambda s: int(s) % K, input().split()))

cumAm1 = [1] + A
for i in range(1, N + 1):
    cumAm1[i] = (-1 + cumAm1[i - 1] + cumAm1[i]) % K

counts = [0] * K
counts2 = [0] * K
for i in range(N + 1):

    if i >= K:
        counts[cumAm1[i - K]] -= 1

    cur = cumAm1[i]
    counts2[cur] += counts[cur]

    counts[cur] += 1

print(sum(counts2))

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

cumAm1 = [1] + A
for i in range(1, N + 1):
    cumAm1[i] = (-1 + cumAm1[i - 1] + cumAm1[i]) % K

counts = [0] * K
counts2 = [0] * K
for i in range(N + 1):

    if i >= K:
        counts[cumAm1[i - K]] -= 1

    cur = cumAm1[i]
    counts2[cur] += counts[cur]

    counts[cur] += 1

print(sum(counts2))

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

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

# N = 2 * 10 ** 5
# A = [10 ** 9 for i in range(N)]


cumAm1 = np.cumsum(np.array([1] + A) % K - 1) % K

counts = [0] * K
counts2 = [0] * K
for i in range(N + 1):

    if i >= K:
        counts[cumAm1[i - K]] -= 1

    cur = cumAm1[i]
    counts2[cur] += counts[cur]

    counts[cur] += 1

print(sum(counts2))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
A = list(map(int, input().split()))
import numpy as np

cumAm1 = np.cumsum(np.array([1] + A) - 1)
cumAm1 %= K

counts = np.zeros(K, dtype=int)
counts2 = np.zeros(K, dtype=int)
for i in range(N + 1):

    if i >= K:
        counts[cumAm1[i - K]] -= 1

    counts2[cumAm1[i]] += counts[cumAm1[i]]

    counts[cumAm1[i]] += 1

print(counts2.sum())
Problem p02948 (python)

Fixed submission:
from heapq import heappush, heappop

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


jobs = [[] for _ in range(m)]
for a, b in ab:
    if a <= m:
        jobs[a - 1].append(-b)

ans = 0
available = []
for job in jobs:
    for jo in job:
        heappush(available, jo)

    if available:
        ans -= heappop(available)

print(ans)

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

jobs = [(a, -b) for a, b in ab]
jobs.sort()

ans = 0
job_index = 0
for i in range(m):
    while job_index < len(jobs):
        if jobs[job_index] + i < m:
            ans -= jobs[job_index][1]
        else:
            job_index += 1
print(ans)
Problem p03291 (python)

Fixed submission:
p = [1, 0, 0, 0]
m = 1e9 + 7
def mod(x):
    return int(x % m)

for s in input():
    if s == 'A' :
        p[1] = mod(p[0] + p[1])
    if s == 'B' :
        p[2] = mod(p[1] + p[2])
    if s == 'C' :
        p[3] = mod(p[2] + p[3])
    if s == '?':
        p[3] = mod(p[2] + p[3] * 3)
        p[2] = mod(p[1] + p[2] * 3)
        p[1] = mod(p[0] + p[1] * 3)
        p[0] = mod(p[0] * 3)
        
print(int(p[3] % m))

Buggy submission (verdict: Runtime Error):
p = [1, 0, 0, 0]

for s in input():
    if s == 'A' :
        p[1] += p[0]
    if s == 'B' :
        p[2] += p[1]
    if s == 'C' :
        p[3] += p[2]
    if s == '?':
        p[3] += p[2] + p[3] * 2
        p[2] += p[1] + p[2] * 2
        p[1] += p[0] + p[1] * 2
        p[0] += p[0] * 2
        
print(int(p[3] % (1e9 + 7)))
Problem p02598 (python)

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

right=10**9
left=0

while right-left>1 :
    mid=(left+right)//2
    count=0
    for a in A :
        count+=a//mid
        if a%mid==0 :
            count-=1
    if count<=k :
        right=mid
    else :
        left=mid

print(right)

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

right=10**9
left=1

while right-left>1 :
    mid=(left+right)//2
    count=0
    for a in A :
        count+=a//mid
        if a%mid==0 :
            count-=1
    if count<=k :
        right=mid
    else :
        left=mid

print(right)
Problem p03053 (python)

Fixed submission:
from collections import deque
import sys
input=sys.stdin.readline


#-------------------------------------------------------------------------
#白から黒に変えていく

def search() :
    H,W=map(int,input().split())
    pos=deque([])

    D= [[True]*(W+2)]                                  #True True True True
    D+=[[True]+[False]*W+[True] for i in range(H)]     #True FalseFalseTrue
    D.append([True]*(W+2))                             #True True True True

    for i in range(H) :
        maze=input()
        for j in range(W) :
            if maze[j]=="#" :
                pos.append([i+1,j+1,0])
                D[i+1][j+1]=True
 
    while len(pos)>0 :
        h,w,depth=pos.popleft()
        if not D[h+1][w] :
            pos.append([h+1,w,depth+1])
            D[h+1][w]=True

        if not D[h-1][w] :
            pos.append([h-1,w,depth+1])
            D[h-1][w]=True

        if not D[h][w+1] :
            pos.append([h,w+1,depth+1])
            D[h][w+1]=True

        if not D[h][w-1] :
            pos.append([h,w-1,depth+1])
            D[h][w-1]=True

    return depth            

print(search())

Buggy submission (verdict: Runtime Error):
input=sys.stdin.readline
H,W=map(int,input().split())


#-------------------------------------------------------------------------
#白から黒に変えていく

def search() :
    pos=deque([])


    D= [[True]*(W+2)]                                   #True True True True
    D+=[[True]+[False]*W+[True] for i in range(H)]      #True FalseFalseTrue
    D.append([True]*(W+2))                              #True True True True

    for i in range(H) :
        maze=input()
        for j in range(W) :
            if maze[j]=="#" :
                pos.append([i+1,j+1,0])
                D[i+1][j+1]=True
 
    while len(pos)>0 :
        h,w,depth=pos.popleft()
        for p,q in [[-1,0],[1,0],[0,-1],[0,1]] :
            if not D[h+p][w+q] :
                pos.append([h+p,w+q,depth+1])
                D[h+p][w+q]=True

    return depth            

#-------------------------------------------------------------------------
#動作
print(search())
Problem p02572 (python)

Fixed submission:
N = int(input())
Al = input().split()
A = list( map((lambda x: int(x)), Al))
num = 0
ma = 10**9 + 7
li = 0

for i in range(N-1, 0, -1):
  li += A[i]
  num += A[i-1] * li

num = num % ma
print(num)

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

A = range(N)
for i in range(Al):
  A[i] = int(i)

num = 0

for i in range(N):
  for j in range(i+1, N):
    num += A[i]*A[j]

num = num % (10**9 + 7)
print(num)
Problem p02546 (python)

Fixed submission:
word = input()
if word[-1] == "s":
  print(word + "es")
else:
  print(word + "s")

Buggy submission (verdict: Runtime Error):
word = input()
if word[-1] == "s":
  print(word + "es)
else:
  print(word)
Problem p02729 (python)

Fixed submission:
import math

def comb(n, r):
    try: 
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

raw = input()
n, m = [int(i) for i in raw.split(" ")]
 
print(comb(n, 2) + comb(m, 2))

Buggy submission (verdict: Runtime Error):
L = int(input())
print(L/3 * L/3 * L/3)

Buggy submission (verdict: Runtime Error):
import scipy.optimize

L = int(input())

func = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))

res = scipy.optimize.minimize(func, (0.1 ,0.2), bounds = ((0, None), (0, None)), tol=1e-6)

print(-1 * res.fun)

Buggy submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
 
n, m = input().split(" ")
 
print(comb(n, 2) + comb(m, 2))

Buggy submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, m = input().split(" ")

return comb(n, 2) + comb(m, 2)
Problem p02546 (python)

Fixed submission:
# import inflect
s = input()

# p = inflect.engine()
# print(p.plural(s))


if s[-1:] == "s":
    print(s+"es")
else:
    print(s+"s")

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

p = inflect.engine()
print(p.plural(s))
Problem p02729 (python)

Fixed submission:
from itertools import combinations

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

a = list(combinations(range(N), 2))
b = list(combinations(range(M), 2))
print(len(a)+len(b))

Buggy submission (verdict: Runtime Error):
#include<stdio.h>

long int multiplyNumbers(int n) {
    if (n>=1)
        return n*multiplyNumbers(n-1);
    else
        return 1;
}

int main(){
	long int N, M;
	scanf("%ld %ld", &N, &M);
	long int c1 = multiplyNumbers(N)/((multiplyNumbers(N-2))*multiplyNumbers(2));
	long int c2 = multiplyNumbers(M)/((multiplyNumbers(M-2))*multiplyNumbers(2));
	printf("%d", c1+c2);
	return 0;
}
Problem p02835 (python)

Fixed submission:
a = input().split(" ")

a = [int(x) for x in a]

if sum(a) >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
a = int(input().split(" "))

if sum(a) >= 22:
    print("win")
else:
    print("bust")
Problem p02552 (python)

Fixed submission:
n=int(input())
print(int(not(n)))

Buggy submission (verdict: Runtime Error):
n=int(input())
print(!n)
Problem p02546 (python)

Fixed submission:
st = input()
if st[-1]=="s":
  name = st+"es"
else:
  name = st+"s"
print(name)

Buggy submission (verdict: Runtime Error):
st = input()
if st[-1]=="s":
  st.append("es")
else:
  st.append("s")