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

Fixed submission:
import collections

n=int(input())


X=list(map(int,input().split()))
odd=[]
even=[]
for i in range(int(n/2)):
    odd.append(X[2*i+1])
    even.append(X[2*i])

odd_counter=collections.Counter(odd) #登場回数とその値の辞書型
even_counter=collections.Counter(even)

odd_count=sorted(odd_counter.values(),reverse=True) #登場回数の多い順に並べた配列
even_count=sorted(even_counter.values(),reverse=True)

max_odd_value=max(odd_counter,key=odd_counter.get) #登場回数が最大の値
max_even_value=max(even_counter,key=even_counter.get)

if max_odd_value!=max_even_value:
    print(n-odd_count[0]-even_count[0])
elif len(set(odd))!=1 and len(set(even))!=1:
    print(min(n-odd_count[0]-even_count[1],n-odd_count[1]-even_count[0]))
elif len(set(odd))==1 and len(set(even))==1:
    print(int(n/2))
elif len(set(odd))==1:
    print(int(n/2)-even_count[1])
elif len(set(even))==1:
    print(int(n/2)-odd_count[1])

Buggy submission (verdict: Runtime Error):
import collections

n=int(input())


X=list(map(int,input().split()))
odd=[]
even=[]
for i in range(int(n/2)):
    odd.append(X[2*i+1])
    even.append(X[2*i])

odd_counter=collections.Counter(odd) #登場回数とその値の辞書型
even_counter=collections.Counter(even)

odd_count=sorted(odd_counter.values(),reverse=True) #登場回数の多い順に並べた配列
even_count=sorted(even_counter.values(),reverse=True)

max_odd_value=max(odd_counter,key=odd_counter.get) #登場回数が最大の値
max_even_value=max(even_counter,key=even_counter.get)

if max_odd_value!=max_even_value:
    print(n-odd_count[0]-even_count[0])

else:
    print(min(n-odd_count[0]-even_count[1],n-odd_count[1]-even_count[0]))
Problem p03274 (python)

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

X=list(map(int,input().split()))
V=[]
for i in range(n-k+1):
    Y=X[i+k-1]-X[i]   
    V.append(Y+min(abs(X[i]),abs(X[i+k-1])))

print(min(V))

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

X=list(map(int,input().split()))
V=[]
for i in range(n-k):
    Y=X[i+k-1]-X[i]   
    if X[i+k-1]<0:
        V.append(Y-X[i+k-1])
    elif X[i+k-1]>=0 and X[i]<0:
        V.append(Y+min(abs(X[i]),abs(X[i+k-1])))
    else:
        V.append(Y+X[i])
if X==[0]:
    print(0)
else:
    print(min(V))

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

X=list(map(int,input().split()))
V=[]
for i in range(n-k):
    Y=X[i+k-1]-X[i]   
    if X[i+k-1]<0:
        V.append(Y-X[i+k-1])
    elif X[i+k-1]>=0 and X[i]<0:
        V.append(Y+min(abs(X[i]),abs(X[i+k-1])))
    else:
        V.append(Y+X[i])
print(min(V))
Problem p03294 (python)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))

print(sum(X)-n)

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

X=list(map(int,input()))

print(sum(X)-n)
Problem p03308 (python)

Fixed submission:
n=int(input())

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



print(max(A)-min(A))

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

A=list(map(int,input()))



print(max(A)-min(A))
Problem p03309 (python)

Fixed submission:
n=int(input())

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0

if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=(Y[int(n/2)-1]+Y[int(n/2)])//2
    for j in range(n):
        res_1+=abs(Y[j]-m)
        

        
print(res_1)

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

X=list(map(int,input().split()))
Y=[]
for i in range(n):
    Y.append(X[i]-(i+1))
Y.sort()
res_1=0
res_2=0
if n%2==1:
    m=Y[int((n-1)/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
else:
    m=Y[int(n/2)-1]
    n=Y[int(n/2)]
    for j in range(n):
        res_1+=abs(Y[j]-m)
        res_2+=abs(Y[j]-n)
    res_1=min(res_1,res_2)
        
    

print(res_1)

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

X=[a,b,c]
X.sort()
x=X[2]
y=X[1]
z=X[0]


sabun1=x-y
sabun2=x-z

if sabun1%2==0 and sabun2%2==0:
    res=(sabun1+sabun2)/2
elif sabun1%2==1 and sabun2%2==1:
    res=(sabun1//2+sabun2//2)+1
elif sabun1%2==0 and sabun2%2==1:
    res=(sabun1/2)+(sabun2//2)+2
else:
    res=(sabun1//2)+(sabun2/2)+2

print(int(res))
Problem p03353 (python)

Fixed submission:
s=input()
k=int(input())
X=[]
for i in range(len(s)):
    for j in range(k):
        X.append(s[i:i+j+1])
X=list(set(X))

X.sort()

print(X[k-1])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
X=[]
for i in range(len(s)-4):
    X.append(s[i:i+5])
X.append(s[len(s)-4:len(s)])
X.append(s[len(s)-3:len(s)])
X.append(s[len(s)-2:len(s)])
X.append(s[len(s)-1:len(s)])
    
X.sort()
C=[]
for x in X[:k]:
    for j in range(len(x)):
        C.append(x[:j+1])
        
C=list(set(C))

C.sort()

print(C[k-1])
Problem p03611 (python)

Fixed submission:
import collections
n=int(input())

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

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])

if len(X)>=3:
    for j in range(1,len(X)-1):
        res=V[j]
        if K[j]-1==K[j-1]:
            res+=V[j-1]
        if K[j]+1==K[j+1]:
            res+=V[j+1]
        RES.append(res)
elif len(X)==2:
    if K[0]+1==K[1]:
        RES.append(V[0]+V[1])
    else:
        RES.append(max(V))
else:
    RES.append(V[0])        

print(max(RES))

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

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

a=collections.Counter(A)

X=sorted(a.items(), key=lambda x:x[0])

K=[]
V=[]

RES=[]
for i in range(len(X)):
    K.append(X[i][0])
    V.append(X[i][1])
    
for j in range(1,len(X)-1):
    res=V[j]
    if K[j]-1==K[j-1]:
        res+=V[j-1]
    if K[j]+1==K[j+1]:
        res+=V[j+1]
    RES.append(res)

print(max(RES))
Problem p03625 (python)

Fixed submission:
import collections

n=int(input())

A=list(map(int,input().split()))
        
X=collections.Counter(A)

ans=1
cnt_1=0
cnt_2=0

for k,v in sorted(X.items(),key=lambda x:x[0],reverse=True):
    if v>=2:
        cnt_1+=1
        ans*=k
        if cnt_1==2:
            break
        if v>=4:
            ans*=k
            break
    else:
        cnt_2+=1
        if cnt_2==n or cnt_2==n-2 or cnt_2==n-3:
            ans=0
            break
print(ans)

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

A=list(map(int,input().split()))
        
A.sort(reverse=True)

X=[]

t=None

for i in A:
    if t==i:
        t=None
        X.append(t)
        if len(X)>1:
            break
    else:
        t=i
        
if len(X)>1:
    print(X[0]*X[1])
else:
    print(0)

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

A=list(map(int,input().split()))
        
A.sort(reverse=True)


X=[]

t=None

for i in A:
    if i==t:
        t=None
        X.append(t)
        if len(X)==2:
            break
    else:
        t=i
        
if len(X)>1:
    print(X[0]*X[1])
else:
    print(0)

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

A=list(map(int,input().split()))
        
A.sort(reverse=True)

X=[]

t=None

for i in A:
    if i==t:
        t=None
        X.append(t)
        if len(X)==2:
            break
    else:
        t=i
        
print(X[0]*X[1] if len(X)>1 else 0)
Problem p03651 (python)

Fixed submission:
from fractions import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[-1]:
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1:
        print('POSSIBLE')
    else:
        if k%a==0:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
from math import gcd
n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
if k>A[-1]:
    print('IMPOSSIBLE')
else:
    a=A[0]
    for i in range(n):
        a=gcd(a,A[i])
    if a==1:
        print('POSSIBLE')
    else:
        if k%a==0:
            print('POSSIBLE')
        else:
            print('IMPOSSIBLE')
Problem p03681 (python)

Fixed submission:
import math

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

if n==m+1 or n==m-1:
    print((math.factorial(m)*math.factorial(n))%(10**9+7))
elif n==m:
    print((2*(math.factorial(m)**2))%(10**9+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import math

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

if n==m-1 or n==m+1:
  print((math.factorial(m)*math.factorail(n))%(1e9+7))
elif n==m:
  print((2*(math.factorial(m)**2))%(1e9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math

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

if n==m-1 or n==m+1:
  print((math.factorial(m)*math.factorail(n))%(1e9+7))
elif n==m:
  print((2*(math.factorail(m)**2))%(1e9+7))
else:
  print(0)
Problem p03696 (python)

Fixed submission:
n=int(input())
s=input()
z=s
while '()' in s:
    s=s.replace('()','')
print('('*s.count(')')+z+')'*s.count('('))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
if s[0]==')':
    cnt=1
else:
    cnt=0
for i in range(1,n):
    if s[i]==')' and s[i-1]!='(':
        cnt+=1
    if s[i]==')':
        x=i
print('('*cnt+s+')'*(n-x-1))
Problem p03828 (python)

Fixed submission:
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x//i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x/i
        cnt+=1
    res*=cnt
    
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input())
x=1
for i in range(1,n+1):
    x*=i

res=1

for i in range(2,n+1):
    cnt=1
    while x%i==0:
        x=x/i
        cnt+=1
    res*=cnt
    
print(res)
Problem p03845 (python)

Fixed submission:
n=int(input())
T=list(map(int,input().split()))
m=int(input())
for i in range(m):
    p,k=map(int,input().split())
    tmp=T[p-1]
    T[p-1]=k
    print(sum(T))
    T[p-1]=tmp

Buggy submission (verdict: Runtime Error):
n=int(input())
T=list(map(int,input()))
m=int(input())
for i in range(m):
    p,k=map(int,input().split())
    T[p-1]=k
    print(sum(T))
Problem p03994 (python)

Fixed submission:
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k%26]

print(ans)

Buggy submission (verdict: Runtime Error):
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[-1])+k]

print(ans)

Buggy submission (verdict: Runtime Error):
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=[]
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
ans=''
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
        ans+='a'
    else:
        ans+=S[i]
ans=ans[:-1]+X[X.index(ans[i])+k]

print(ans)

Buggy submission (verdict: Runtime Error):
from _collections import deque
X='abcdefghijklmnopqrstuvwxyz'*2
S=input()
k=int(input())
N=deque([])
for s in S:
    if s=='a':
        N.append(0)
    else:
        N.append(26-X.index(s))
important=0
for i in range(len(S)):
    if N[i]<=k :
        k-=N[i]
    else:
        important=i
        break
ans2=''
for i in range(important,len(S)-1):
    if N[i]<=k:
        ans2+='a'
        k-=N[i]
    else:
        ans2+=X[X.index(S[i])]

print('a'*important+ans2+X[X.index(S[-1])+k])
Problem p02727 (python)

Fixed submission:
x,y,a,b,c=map(int,input().split())
p,q,r=[list(reversed(sorted(list(map(int,input().split()))))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p,q,r=[reversed(sorted(list(map(int,input().split())))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p,q,r=[reversed(sorted(list(map(int,input())))) for i in range(3)]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)

Buggy submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())
p,q,r=[reversed(sorted(list(map(int,input()))) for i in range(3))]
p=p[0:x]
q=q[0:y]
p.append(0)
q.append(0)
r.append(0)

s=0
i,j,k=0,0,0

for _ in range(x+y):
  if p[i]>=q[j] and p[i]>=r[k]:
    s+=p[i]
    i+=1
  elif q[j]>=r[k]:
    s+=q[j]
    j+=1
  else:
    s+=r[k]
    k+=1
    
print(s)
Problem p02765 (python)

Fixed submission:
n,r = map(int,input().split())
 
if n < 10:
  print(r+(100*(10-n)))
else:
  print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = int(input())
 
if r < 10:
  print(n-(100*(10-r)))
else:
  print(n)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = int(input())
 
if n < 10:
  print(n-(100*(10-r)))
else:
  print(n)

Buggy submission (verdict: Runtime Error):
n = int(input())
r = int(input())
 
if n < 10:
  print(n-(100*(10-k)))
else:
  print(n)

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

if n < 10:
  print(n-(100*(10-n)))
else:
  print(n)
Problem p02811 (python)

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

if k * 500 >= x:
    print("Yes")
else:
    print("No")

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

if 500 * k > x :
    print("Yes")
else :
    print("No")
Problem p02818 (python)

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

A -= K
if(A < 0):
    B -= abs(A)
    A = 0
    if(B < 0):
        B = 0

print(str(A) + " " + str(B))

Buggy submission (verdict: Runtime Error):
a,b,k = input().split()

for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 1

print(a + " " + b)
Problem p02947 (python)

Fixed submission:
from math import factorial
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 = int(input())
D = {}
L = [[]for _ in range(N)]
count = 0
for i in range(N):
    L[i] = list(input())
    L[i].sort()
    L[i] = tuple(L[i])
    if L[i] in D:
        D[L[i]] = D[L[i]] + 1
        if D[L[i]] == 2:
            D[L[i]] = D[L[i]] + 1
    else:
        D[L[i]] = 0
for key in D:
    if D[key] > 2:
        count += cmb(D[key],2)
    else:
        count += D[key]

print(count)

Buggy submission (verdict: Runtime Error):

from math import factorial

N = int(input())
D = {}
L = [[]for _ in range(N)]
count = 0
for i in range(N):
    L[i] = list(input())
    L[i].sort()
    L[i] = tuple(L[i])
    if L[i] in D:
        D[L[i]] = D[L[i]] + 1
        if D[L[i]] == 2:
            D[L[i]] = D[L[i]] + 1
    else:
        D[L[i]] = 0
for key in D:
    if D[key] > 2:
        #count += factorial(D[key]) / factorial(2) / factorial(D[key]-2)
    else:
        count += D[key]

print(int(count))

Buggy submission (verdict: Runtime Error):

from math import factorial

N = int(input())
D = {}
L = [[]for _ in range(N)]
count = 0
for i in range(N):
    L[i] = list(input())
    L[i].sort()
    L[i] = tuple(L[i])
    if L[i] in D:
        D[L[i]] = D[L[i]] + 1
        if D[L[i]] == 2:
            D[L[i]] = D[L[i]] + 1
    else:
        D[L[i]] = 0
for key in D:
    if D[key] > 2:
        count += factorial(D[key]) / factorial(2) / factorial(D[key]-2)
    else:
        count += D[key]

print(int(count))
Problem p02784 (python)

Fixed submission:
a = input().split()
h, n = int(a[0]), int(a[1])
nums = input().split()
nums = list(map(int, nums))
x = h - sum(nums)
if x <= 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = input().split()
h, n = int(a[0]), int(a[1])
nums = input().split()
nums = list(map(int, nums))
x = max(nums)
xx = nums.index(x)
del nums[xx]
y = max(nums)
z = x + y

if z >= h:
  print("yes")
else:
  print("no")

Buggy submission (verdict: Runtime Error):
a = input().split()
h, n = int(a[0]), int(a[1])
nums = input().split()
nums = list(map(int, nums))
nums = sorted(nums, reverse=True)
x = nums[0] + nums[1]
if x >= h:
  print("yes")
else:
  print("no")
Problem p02686 (python)

Fixed submission:
def count(i, s):
    left = right = 0
    for e in s:
        if e == "(":
            left += 1
        else:
            if left == 0:
                right += 1
            else:
                left -= 1

    return left-right, left, right, i


n = int(input())
S = [input() for i in range(n)]
s1 = []
s2 = []
for i, e in enumerate(S):
    c = count(i, e)
    # print(i, c)
    if c[0] >= 0:
        s1.append((c[2], c[3]))
    else:
        s2.append((-c[1], c[3]))

s1.sort()
s2.sort()
# print(s1, s2)
s = []
for e in s1:
    s.append(S[e[1]])
for e in s2:
    s.append(S[e[1]])
# print(s)

_, left, right, _ = count(0, "".join(s))
if left == right == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math
# MOD = 10**9+7
# MOD = 998244353


def count(idx, s):
    left = right = 0
    for i in range(len(s)):
        if s[i] == "(":
            left += 1
        else:
            if left > 0:
                left -= 1
            else:
                right += 1

    return left, right, idx


n = int(input())
S = [input() for i in range(n)]
A = [count(i, s) for i, s in enumerate(S)]
A.sort(key=lambda x: (x[1], x[1]-x[0]))

left_rem = 0
for left, right in A:
    left_rem -= right
    if left_rem < 0:
        print("No")
        exit()
    left_rem += left

if left_rem == 0:
    print("Yes")
else:
    print("No")
Problem p02696 (python)

Fixed submission:
import math

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

if n < b:
    print(math.floor(a*n/b) - a*math.floor(n/b))
else:
    print(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b))

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

if n < b:
    print(math.floor(a*n/b) - a*math.floor(n/b))
else:
    print(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b))
Problem p02721 (python)

Fixed submission:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)

n, k, c = map(int, input().split())
s = input()
left = [-1]*k
right = [-1]*k

d = w = 0
while w < k:
    if s[d] == "o":
        left[w] = d
        w += 1
        d += c+1
    else:
        d += 1

d, w = n-1, k-1
while w >= 0:
    if s[d] == "o":
        right[w] = d
        w -= 1
        d -= c+1
    else:
        d -= 1

# print(left, right)
for i in range(k):
    if left[i] == right[i]:
        print(left[i]+1)

Buggy submission (verdict: Runtime Error):
n, k, c = map(int, input().split())
S = input()
pre = [0]*n
pre[0] = 1 if S[0] == "o" else 0
for i in range(1, n):
    if S[i] == "o" and i-c-1 >= 0:
        pre[i] = max(pre[i-1], pre[i-c-1]+1)
    else:
        pre[i] = pre[i-1]

suf = [0]*n
suf[-1] = 1 if S[-1] == "o" else 0
for i in range(n-2, -1, -1):
    if S[i] == "o" and i+c+1 < n:
        suf[i] = max(suf[i+1], suf[i+c+1]+1)
    else:
        suf[i] = suf[i+1]

# print(pre)
# print(suf)

if S[0] == "o" and suf[1] < k:
    print(1)

for i in range(1, n-1):
    if S[i] == "o" and pre[i-1]+suf[i+1] < k:
        print(i+1)

if S[-1] == "o" and pre[-2] < k:
    print(n)
Problem p02743 (python)

Fixed submission:
a, b, c = map(int, input().split())
if c-a-b < 0:
    print("No")
elif 4*a*b < (c-a-b)**2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a+b+2*math.sqrt(a)*math.sqrt(b) < c:
    print("Yes")
else:
    print("No")
Problem p02814 (python)

Fixed submission:
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
# import math
from fractions import gcd

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


n, m = map(int, input().split())
A = list(map(int, input().split()))


def lcm_base(x, y):
    # return (x * y) // math.gcd(x, y)
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    x = 1
    for i in range(n):
        x = lcm_base(x, numbers[i])
        if x > 2*m:
            print(0)
            exit()

    return x


def count_two(x):
    count = 0
    while x%2 == 0:
        count += 1
        x //= 2
    return count


two_count = count_two(A[0])
for a in A[1:]:
    if two_count != count_two(a):
        print(0)
        exit()

LCM = lcm_list(A)
# print(LCM)
print((m - LCM//2)//LCM + 1)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


n, m = map(int, input().split())
A = list(map(int, input().split()))


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm_list(numbers):
    x = 1
    for i in range(n):
        x = lcm_base(x, numbers[i])
        if x > 2*m:
            print(0)
            exit()

    return x


def count_two(x):
    count = 0
    while x%2 == 0:
        count += 1
        x //= 2
    return count


two_count = count_two(A[0])
for a in A[1:]:
    if two_count != count_two(a):
        print(0)
        exit()

LCM = lcm_list(A)
# print(LCM)
print((m - LCM//2)//LCM + 1)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict, Counter, namedtuple, deque
import itertools
import functools
import bisect
import heapq
import math

MOD = 10 ** 9 + 7
# MOD = 998244353
# sys.setrecursionlimit(10**8)


n, m = map(int, input().split())
A = list(map(int, input().split()))


def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)


def lcm(*numbers):
    return functools.reduce(lcm_base, numbers, 1)


def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)


def count_two(x):
    count = 0
    while x%2 == 0:
        count += 1
        x //= 2
    return count


two_count = count_two(A[0])
for a in A[1:]:
    if two_count != count_two(a):
        print(0)
        exit()

LCM = lcm(*A)
# print(LCM)
print((m - LCM//2)//LCM + 1)
Problem p03006 (python)

Fixed submission:
from collections import Counter
n = int(input())
coor = []
for i in range(n):
  x,y = map(int, input().split())
  coor.append([x,y])
  
if n == 1:
  print(1)
  exit()

dif = []
for i in range(n):
  for j in range(n):
    if i != j:
      dif.append((coor[i][0] - coor[j][0], coor[i][1] - coor[j][1]))
      
S = Counter(dif)
way = max(S.values())
print(n-way)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
coor = []
for i in range(n):
  x,y = map(int, input().split())
  coor.append([x,y])

dif = []
for i in range(n):
  for j in range(n):
    if i != j:
      dif.append((coor[i][0] - coor[j][0], coor[i][1] - coor[j][1]))
      
S = Counter(dif)
way = max(S.values())
print(n-way)