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

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
N = int(input())
a = [[] for i in range(N)]
for i in range(N-1):
  A, B, C = map(int, input().split())
  a[A-1].append([B-1, C])
  a[B-1].append([A-1, C])
dist = [-1]*N
Q, K = map(int, input().split())
dist[K-1] = 0

def dfs(now):
  for i, dis_e in a[now]:
    if dist[i] == -1:
      dist[i] = dist[now] + dis_e
      dfs(i)

def main():
  dfs(K-1)
  ans = []
  for i in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1]+dist[y-1])
  #print(*ans, sep = "\n")

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for i in range(N)]
for i in range(N-1):
  A, B, C = map(int, input().split())
  a[A-1].append([B-1, C])
  a[B-1].append([A-1, C])
dist = [-1]*N
Q, K = map(int, input().split())
dist[K-1] = 0

def  dfs(now):
  for i, dis_e in a[now]:
    if dist[i] == -1:
      dist[i] = dist[now] + dis_e
      dfs(i)

def main():
  dfs(K-1)
  ans = []
  for i in range(Q):
    x, y = map(int, input().split())
    print(dist[x-1]+dist[y-1])
  #print(*ans, sep = "\n")

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for i in range(N)]
edge = {}
for i in range(N-1):
  A, B, C = map(int, input().split())
  a[A-1].append([B-1, C])
  a[B-1].append([A-1, C])
dist = [-1]*N
Q, K = map(int, input().split())
dist[K-1] = 0

def  dfs(now):
  for i, dis_e in a[now]:
    if dist[i] == -1:
      dist[i] = dist[now] + dis_e
      dfs(i)

def main():
  dfs(K-1)
  ans = []
  for i in range(Q):
    x, y = map(int, input().split())
    ans.append(dist[x-1]+dist[y-1])
  print(*ans, sep = "\n")

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [[] for i in range(N)]
edge = {}
for i in range(N-1):
  A, B, C = map(int, input().split())
  a[A-1].append(B-1)
  a[B-1].append(A-1)
  edge[str(A-1)+"and"+str(B-1)] = C
  edge[str(B-1)+"and"+ str(A-1)] = C
dist = [-1]*N
Q, K = map(int, input().split())
dist[K-1] = 0

def  dfs(now):
  for i in a[now]:
    if dist[i] == -1:
      dist[i] = dist[now] + edge[str(now) + "and" +str(i)]
      dfs(i)

def main():
  dfs(K-1)
  ans = []
  for i in range(Q):
    x, y = map(int, input().split())
    ans.append(dist[x-1]+dist[y-1])
  print(*ans, sep = "\n")

if __name__ == "__main__":
  main()
Problem p03013 (python)

Fixed submission:
def Fib(n):
  a, b = 1, 1
  if n == 0:
  	return a
  elif n == 1:
    return b
  else:
    for i in range(n-2):
      a, b = b, a + b
    return b

mod = 1000000007
def mul(a, b):
  return ((a % mod) * (b % mod)) % mod


N, M = map(int, input().split())
if M != 0:
  a = int(input())
  ret = mul(1, Fib(a))
  pre_a = a

for i in range(M-1):
  a = int(input())
  if a - pre_a <= 1:
    ret = 0
    break
  else:
    num_step = a - pre_a - 1
    ret = mul(ret, Fib(num_step))
  pre_a = a
    
if M != 0:
  num_step = N - a
  ret = mul(ret, Fib(num_step))
else:
  ret = mul(1, Fib(N+1))
print(ret)

Buggy submission (verdict: Runtime Error):
def Fib(n):
  a, b = 1, 1
  if n == 0:
  	return a
  elif n == 1:
    return b
  else:
    for i in range(n-2):
      a, b = b, a + b
    return b

mod = 1000000007
def mul(a, b):
  return ((a % mod) * (b % mod)) % mod

def power(x, y):
  if   y == 0     : return 1
  elif y == 1     : return x % mod
  elif y % 2 == 0 : return power(x, y/2)**2 % mod
  else            : return power(x, y/2)**2 * x % mod

def div(a, b):
  return mul(a, power(b, mod-2))
  
N, M = map(int, input().split())
a = int(input())
ret = mul(1, Fib(a))
pre_a = a

for i in range(M-1):
  a = int(input())
  if a - pre_a <= 1:
    ret = 0
    break
  else:
    num_step = a - pre_a - 1
    ret = mul(ret, Fib(num_step))
  pre_a = a
    
num_step = N - a
ret = mul(ret, Fib(num_step))
print(ret)
Problem p02580 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np


h, w, m = map(int, input().split())

h_cnt = np.zeros(h, dtype=int)
w_cnt = np.zeros(w, dtype=int)
bom_cord = set()
for i in range(m):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    bom_cord.add((hi, wi))
    h_cnt[hi] += 1
    w_cnt[wi] += 1

w_max = w_cnt.max()

h_argsort = h_cnt.argsort()[::-1]
w_argsort = w_cnt.argsort()[::-1]

bomber = 0
for hi in h_argsort:
    if h_cnt[hi] + w_max <= bomber:
        break
    
    for wi in w_argsort:
        if h_cnt[hi] + w_cnt[wi] <= bomber:
            break

        if (hi, wi) in bom_cord:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi] - 1)
        else:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi])

print(bomber)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np


h, w, m = map(int, input().split())

bom_cord = np.empty((m, 2), dtype=int)
h_cnt = np.zeros(h, dtype=int)
w_cnt = np.zeros(w, dtype=int)
bom_cord = set()
for i in range(m):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    bom_cord.add((hi, wi))
    h_cnt[hi] += 1
    w_cnt[wi] += 1

w_max = w_cnt.max()

h_argsort = h_cnt.argsort()[::-1]
w_argsort = w_cnt.argsort()[::-1]

bomber = 0
for hi in h_argsort:
    if h_cnt[hi] + w_max < bomber:
        break
    
    for wi in w_argsort:
        if h_cnt[hi] + w_cnt[wi] < bomber:
            break

        if (hi, wi) in bom_cord:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi] - 1)
        else:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi])

print(bomber)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np


h, w, m = map(int, input().split())
grid = np.zeros((h, w), dtype=bool)
for _ in range(m):
    hi, wi = map(lambda x: int(x) - 1, input().split())
    grid[hi, wi] = True

h_cnt = np.count_nonzero(grid, axis=1)
w_cnt = np.count_nonzero(grid, axis=0)

w_max = w_cnt.max()

h_argsort = h_cnt.argsort()[::-1]
w_argsort = w_cnt.argsort()[::-1]

bomber = 0
for hi in h_argsort:
    if h_cnt[hi] + w_max < bomber:
        break
    
    for wi in w_argsort:
        if h_cnt[hi] + w_cnt[wi] < bomber:
            break

        if grid[hi, wi]:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi] - 1)
        else:
            bomber = max(bomber, h_cnt[hi] + w_cnt[wi])

print(bomber)
Problem p02984 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

x = [0 for _ in range(n)]
_x = 0
for i, _a in enumerate(a):
    if i % 2 == 0:
        _x += _a
    else:
        _x -= _a

x[0] = _x

for i in range(1, n):
    x[i] = a[i-1] * 2 - x[i-1]

print(" ".join(map(str, x)))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import solve

n = int(input())
a = np.array(list(map(int, input().split())))
a = a*2

x = np.identity(n)
x[::][1:] += x[::][:n-1]
x = x.T
x[n-1][0] += 1

print(" ".join(solve(x, a).astype(np.int64).astype('str')))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from numpy.linalg import solve

n = int(input())
a = list(map(int, input().split()))
a = np.array([_a * 2 for _a in a])

x = np.zeros((n, n))
for i in range(n-1):
    x[i][i] = 1
    x[i][i+1] = 1
x[n-1][n-1] = 1
x[n-1][0] = 1

print(" ".join(solve(x, a).astype('int').astype('str')))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from numpy.linalg import solve

n = int(input())
a = list(map(int, input().split()))
a = [_a * 2 for _a in a]

x = [[0]*n for _ in range(n)]
for i in range(n-1):
    x[i][i] = 1
    x[i][i+1] = 1
x[n-1][n-1] = 1
x[n-1][0] = 1

print(" ".join(map(str, map(int, list(solve(x, a))))))
Problem p02990 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r < 0: return 0
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


n, k = map(int, input().split())
red_n = n - k + 1

const = 1000000007

for i in range(1, k+1, 1):
    cnt = cmb(red_n, i) * cmb(k-1, i-1)
    print(cnt % const)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
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, k = map(int, input().split())
red_n = n - k + 1

const = 1000000007

for i in range(1, k+1, 1):
    cnt = cmb(red_n, i) * cmb(k-1, i-1)
    print(cnt % const)
Problem p02546 (python)

Fixed submission:
s=str(input())
t=len(s)
if s[t-1]=='s':
  print(s+'es')
else:
  print(s+'s')

Buggy submission (verdict: Runtime Error):
s=str(input())
t=len(s)
if s[t]=='s':
  print(s+'es')
else:
  print(s+'s')
Problem p02547 (python)

Fixed submission:
n=int(input())
l=[]
j=0
for i in range(n):
  a=list(map(int,input().split()))
  l.append(a)
for k in range(n-2):
  if l[k][0]==l[k][1] and l[k+1][0]==l[k+1][1] and l[k+2][0]==l[k+2][1]:
    j+=1
    break
if j==1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[]
j=0
for i in range(n):
  a=list(map(int,input().split()))
  l.append(a)
for k in range(n-2):
  if l[k+2][0]==l[k+2][1] and l[k+3][0]==l[k+1][1] and l[k+4][0]==l[k+4][1]:
    j+=1
    break
if j==1:
  print('Yes')
else:
  print('No')
Problem p02550 (python)

Fixed submission:
n,x,m=map(int,input().split())
order=[-1 for i in range(m)] #-1のところにはまだ対応する余りがない、余りは高々m通り
index=0 #何番目に出た余りなのかを示す
a=[] #数列
while order[x]==-1: #ループが完成するまでは
  order[x]=index #xはindex番目の余り
  a.append(x)
  x=(x**2)%m
  index+=1
tmp=sum(a[order[x]:index]) #1ループの和、xがループの始点の余り
t=index-order[x] #1ループの長さ
if n-1<order[x]: #ループが完成しない場合
  print(sum(a[:n]))
else:
  sum1=sum(a[:order[x]]) #ループの前の和
  x1=n-order[x] #ループ部分の長さ
  n1=x1//t #ループの回数
  n2=x1%t
  print(sum1+n1*tmp+sum(a[order[x]:order[x]+n2]))

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
ans=0
p=0
l=[x]
o=0
if x%m==0:
  print(x)
else:
  for i in range(1,n):
    s=(l[i-1]**2)%m
    if s==0:
      break
    if s in l:
      p=1
      o=list.index(s)
      break
    else:
      l.append(s)
  if p==1:
    
    t=sum(l[o:])
    k=(n-o)//(len(l)-1) #ループ何回回るか
    j=(n-o)%(len(l)-1)
    ans=x+t*k+sum(l[1:j+1])
    print(ans)
  else:
    print(sum(l))

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
ans=0
p=0
l=[x]
if x%m==0:
  print(x)
else:
  for i in range(1,n):
    s=(l[i-1]**2)%m
    if s==0:
      p=1
      break
    if s in l:
      p=2
      break
    else:
      l.append(s)
  if p==2:
    t=sum(l[1:])
    k=(n-1)//(len(l)-1) #ループ何回回るか
    j=(n-1)%(len(l)-1)
    ans=x+t*k+sum(l[1:j+1])
    print(ans)
  elif p==1:
    print(sum(l))
  else:
    print(sum(l))

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
ans=0
p=0
l=[x]
if x%m==0:
  print(x)
else:
  for i in range(1,n):
    s=(l[i-1]**2)%m
    if s==0:
      p=1
      break
    if s in l:
      break
    else:
      l.append(s)
  if p==0:
    t=sum(l[1:])
    k=(n-1)//(len(l)-1) #ループ何回回るか
    j=(n-1)%(len(l)-1)
    ans=x+t*k+sum(l[1:j+1])
    print(ans)
  else:
    print(sum(l))

Buggy submission (verdict: Runtime Error):
n,x,m=map(int,input().split())
ans=0
p=0
l=[x]
if x%m==0:
  print(x)
else:
  for i in range(1,n):
    s=(l[i-1]**2)%m
    if s==0:
      p=1
      break
    if s in l:
      break
    else:
      l.append(s)
  if p==0:
    t=sum(l[1:])
    k=n//(len(l)-1)
    j=n%(len(1)-1)
    ans=x+t*k+sum(l[1:j+1])
    print(ans)
  else:
    print(sum(l))
Problem p02571 (python)

Fixed submission:
s=str(input())
t=str(input())
n=len(t)
m=len(s)
a=[]
if t in s:
  print(0)
else:
  for i in range(m-n+1): #ずらす文字数
    ans=0
    for j in range(n):
      if s[i+j]!=t[j]:
        ans+=1
    a.append(ans)
  print(min(a))

Buggy submission (verdict: Runtime Error):
s=str(input())
t=str(input())
n=len(t)
m=len(s)
ans=0
a=[]
if t in s:
  print(0)
else:
  for i in range(m-n-1):
    for j in range(n):
      if s[i+j]==t[j]:
        ans+=1
    a.append(ans)
  print(n-max(a))
Problem p02577 (python)

Fixed submission:
n=int(input())
k=str(n)
s=len(k)
ans=0
for i in range(1,s+1):
  ans=(ans+int(k[-i]))%9
if ans==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=len(n)
ans=0
for i in range(1,s+1):
  ans=(ans+a[-i])%9
if ans==0:
  print('Yes')
else:
  print('No')
Problem p02596 (python)

Fixed submission:
k=int(input())
m=0
for i in range(k):
  m=(m*10+7)%k
  if m==0:
    break
  elif i==k-1:
    print(-1)
    exit()
print(i + 1)

Buggy submission (verdict: Runtime Error):

k=int(input())
ans=2
s_1=7%k
s_2=10%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
elif k%7==0:
  l=9*k/7
  s=10%l
  while j==0:
    m=(m+s_1*(s-1))%l
    if m==0:
      j==1
    else:
      ans+=1
      s=(s*10)%l
  print(ans)
else:
  l=9*k
  i=0
  while j==0:
    m=(m+s_1*(s-1))%l
    if m==0:
      j==1
    else:
      ans+=1
      s=(s*10)%l
  print(ans)

Buggy submission (verdict: Runtime Error):
k=int(input())
ans=2
s_1=7%k
m=0
j=0
if k%2==0 or k%5==0:
  print(-1)
elif k==1 or k==7:
  print(1)
elif k%7==0:
  l=9*k/7
  i=0
  while j==0:
    m=(m+s_1*(((s_2**i)%l-1)%l))%l
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
  print(ans)
else:
  l=9*k
  s=10%k
  while j==0:
    m=(m+s_1*s)
    if m==0:
      j==1
    else:
      i+=1
      ans+=1
      s=(10*s)%k
  print(ans)
Problem p02598 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
l,r=0,max(a)
def test(x):
  num=0
  for i in a:
    num+=i//x
    if i%x==0:
      num-=1
  if num<=k:
    return num
while r-l>1:
  mid=(l+r)//2
  if test(mid):
    r=mid
  else:
    l=mid
print(r)

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort(revese=True)
for i in range(k):
  t=max(a)
  a.insert(0,t/2)
  a.remove(t)
print(math.ceil(max(a)))
Problem p02627 (python)

Fixed submission:
f=str(input())
if f.islower() == True:
  print('a')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
f=str(input())
if f.islower == True:
  print(a)
else:
  print(A)
Problem p02707 (python)

Fixed submission:
from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
for i in range(n):
  print(c[i + 1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=sorted(b)
for i in range(1,n+1):
  print(b.count(i))
  b=b[b.count(i):]
Problem p02712 (python)

Fixed submission:
n=int(input())
a=0
for i in range(1,n+1):
  if i%3!=0 and i%5!=0:
    a=a+i
print(a)

Buggy submission (verdict: Runtime Error):
import copy
n=int(input())
a=[]
b=[]
c=[]
d=[]
for i in range(n):
  a.append(i+1)
for i in range(n):
  if 3*i+2>n:
    break
  else:
    b.append(a[3*i+2])
for i in range(n):
  if 5*i+4>n:
    break
  else:
    c.append(a[5*i+4])
for i in range(n):
  if 15*i+14>n:
    break
  else:
    d.append(a[15*i+14])
print(sum(a)-sum(b)-sum(c)+sum(d))
Problem p02725 (python)

Fixed submission:
k,n=map(int,input().split())
a=list(map(int,input().split()))
t=0
for i in range(1,n):
  t=max(t,a[i]-a[i-1])
s=max(t,k-a[n-1]+a[0])
print(k-s)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
t=0
for i in range(1,n):
  t=max(t,a[i]-a[i-1])
s=max(t,k-a[n])
print(k-s)

Buggy submission (verdict: Runtime Error):
k,n=map(int,input().split())
a=list(map(int,input().split()))
ans=10**9
for i in range(n):
  s=a[i]
  t=0
  for j in range(1,n):
    m=min(abs(s-a[i-j]),abs(s+20-a[i-j]),abs(s-a[i+j]),abs(20-s+a[i+j]))
    t=t+m
    s=a[i-j]
  ans=min(ans,t)
print(ans)
Problem p02754 (python)

Fixed submission:
N,A,B=map(int,input().split())
a=N//(A+B)*A
c=N%(A+B)
b=min(A,c)
print(a+b)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb2=ballb*A
ballr.append('r')
ballr2=ballr*B
ball=(ballb2+ballr2)*(10**100)
count=0
for i in range(N):
    if ball[i]=='b':
        count += 1
    else:
        count=count
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=int(input())
B=int(input())
ballb=[]
ballr=[]
ballb.append('b')
ballb2=ballb*A
ballr.append('r')
ballr2=ballr*B
ball=(ballb2+ballr2)*N
count=0
for i in range(N):
    if ball[i]=='b':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb2=ballb*A
ballr.append('r')
ballr2=ballr*B
ball=(ballb2+ballr2)*(10**100)
count=0
for i in range(N):
    if ball[i]=='b':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb2=ballb*A
ballr.append('r')
ballr2=ballr*B
ball=(ballb2+ballr2)*N
count=0
for i in range(N):
    if ball[i]=='b':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb=ballb*A
ballr.append('r')
ballr=ballr*B
ball=(ballb+ballr)*N
count=0
for i in range(N):
    if ball[i]=='b':
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb=ballb*A
ballr.append('r')
ballr=ballr*B
ball=(ballb+ballr)*N
count=0
for i in range(0,N):
    if ball[i]=='b':
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
def bc(N,A,B):
    ballb=[]
    ballr=[]
    ballb.append('b')
    ballb=ballb*A
    ballr.append('r')
    ballr=ballr*B
    ball=(ballb+ballr)*N
    count=0
    for i in range(N):
        if ball[i]=='b':
            count+=1
    print(count)
bc(N,A,B)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb=ballb*A
ballr.append('r')
ballr=ballr*B
ball=(ballb+ballr)*N
count=0
for i in range(N):
    if ball[i]=='b':
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb=ballb*A
ballr.append('r')
ballr=ballr*B
ball=(ballb+ballr)*(10**18)
count=0
for i in range(N):
    if ball[i]=='b':
        count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
ballb=[]
ballr=[]
ballb.append('b')
ballb=ballb*A
ballr.append('r')
ballr=ballr*B
ball=(ballb+ballr)*(10**18)
count=0
for i in range(N):
    if ball[i]=='b':
        count+=1
print(count)
Problem p02771 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a==b==c or (a!=b and a!=c and b!=c):
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a=b=c or (a!=b and a!=c and b!=c):
  print('No')
else:
  print('Yes')
Problem p02779 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
b=sorted(a)
for i in range(n-1):
  if b[i]==b[i+1]:
    ans=1
    break
if ans==1:
  print('NO')
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
b=sorted(a)
for i in range(n):
  if b[i]==b[i+1]:
    ans=1
    break
if ans==1:
  print('NO')
else:
  print('YES')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=0
a=sorted(a)
for i in range(n):
  if a[i]==a[i+1]:
    ans=1
    break
if ans==1:
  print('NO')
else:
  print('YES')
Problem p02695 (python)

Fixed submission:
import itertools
n,m,q=list(map(int,input().split()))
q_l=[list(map(int,input().split())) for _ in range(q)]
#bar_l = [(i,j,k) for i in range(0,m+1) for j in range(i,m+1) for k in range(j,m+1)]
bar_m = [i for i in range(m)]
bar_l = list(itertools.combinations_with_replacement(bar_m,n))
score = 0
for bar in bar_l:
    score_tmp=0
    for queue in q_l:
        if bar[queue[1]-1]-bar[queue[0]-1]==queue[2]:
            score_tmp+=queue[3]
    #print(score_tmp)
    if score<=score_tmp:
        score=score_tmp
        #print(bar)
print(score)

Buggy submission (verdict: Runtime Error):
import itertools
n,m,q=list(map(int,input().split()))
q_l=[list(map(int,input().split())) for _ in range(q)]
#print(q_l)
#bar_l = [(i,j,k) for i in range(0,m+1) for j in range(i,m+1) for k in range(j,m+1)]
bar_m = [i for i in range(m)]
#print(bar_m)
bar_l = list(itertools.combinations_with_replacement(bar_m,m))
#print(bar_l)
score = 0
for bar in bar_l:
    score_tmp=0
    for queue in q_l:
        if bar[queue[1]-1]-bar[queue[0]-1]==queue[2]:
            score_tmp+=queue[3]
    #print(score_tmp)
    if score<score_tmp:
        score=score_tmp
print(score)
Problem p02753 (python)

Fixed submission:
S = list(input())
if S[0]==S[1] and S[1]==S[2]:
    print("No")
else:print("Yes")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#define INF 1050000000
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    string s, flag="No";
    cin >> s;
    rep(i, ARRAY_LENGTH(s)-1){
        if (s[i]!=s[i+1]) flag = "Yes";
    }
    cout <<flag<< endl;
    return 0;
}
Problem p02552 (python)

Fixed submission:
x=int(input())
if x ==1:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
za=abs(a)
zb=abs(b)
zc=abs(c)
zd=abs(d)
if b>=0 and d>=0 :
  if a>0 or c>0:
    print(b*d)
  else:
    ans=max(a*c,b*d)
    print(ans)
elif b<0 and d<0 :
  x=max(za,zb)
  y=max(zc,zd)
  print(x*y)
else:
  if b>=0 and d<0 :
  	x=max(za,zb)
  	y=max(zc,zd)
  	print(x*y)
  else:
  	x=max(za,zb)
  	y=max(zc,zd)
  	print(x*y)
Problem p02570 (python)

Fixed submission:
d, t, s = list(map(int, input().split(" ")))

min = d / s

if min <= t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d, t, s = list(map(int, input()))

min = d / s

if min <= t:
  print("Yes")
else:
  print("No")
Problem p02572 (python)

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

mod = 10**9 + 7

sum_a = sum(a)%mod
ans = 0
for i in range(n-1):
    sum_a -= a[i]
    ans += (a[i]*sum_a)%mod

print(ans%mod)

Buggy submission (verdict: Runtime Error):
import collections

n,m = map(int,input().split())
friend = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    if a not in friend[b]:
        friend[a].append(b)
        friend[b].append(a)

q = collections.deque()
visited = [0 for i in range(n)]

ans = 0
for i in range(n):
    if visited[i] == 0:
        visited[i] = 1
        tmp = 1
        for j in friend[i]:
            if visited[j] == 0:
                visited[j] = 1
                tmp += 1
                q.append(j)
        while q:
            s = q.pop()
            for k in friend[s]:
                if visited[k] == 0:
                    visited[k] = 1
                    tmp += 1
                    q.append(k)
    ans = max(ans,tmp)

print(ans)
Problem p02773 (python)

Fixed submission:
n = int(input())
d = dict()

for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

M = max(d.values())

ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)

ans_list.sort()
for i in ans_list:
    print(i)

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

for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

M = max(d.values())

ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)

ans_list.sort()
for i in ans_list:
    print(i