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

Fixed submission:
import sys

def resolve():
    N, M = map(int, input().split())
    A = []
    for i in range(N):
        A.append(input())
    B = []
    for i in range(M):
        B.append(input())

    for i in range(N - M + 1):
        for j in range(N - M + 1):
            for k in range(M):
                if B[k] != A[i+k][j:j+M]:
                    break
                if k == M-1:
                    print('Yes')
                    return

    print('No')

if __name__ == "__main__":
    resolve()

Buggy submission (verdict: Runtime Error):
# ABC 054 B

import sys

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

A = [input() for i in range(N)]
B = [input() for i in range(M)]

ret = [[] for i in range(M)]

for i in range(len(B)):
    for j in range(len(A)):
        f = -1
        while True:
            f = A[j].find(B[i], f+1)
            if f == -1:
                break

            ret[i].append((j, f))

flag = False

# ret = [[(1, 1)],
#        [(1, 1), (2, 1)]]

if M == 1 and len(ret[0] > 0):
    print('True')
    sys.exit(0)

for i in range(len(ret[0])):
    start = ret[0][i] # (x, y)

    for j in range(M-1):
        if not (start[0]+1, start[1]) in ret[j+1]:
            break
        if j == M-2:
            print('Yes')
            sys.exit(0)

print('No')
Problem p02897 (python)

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

Buggy submission (verdict: Runtime Error):
a=int(input())
if a%2==0:
  print(0.5)
 else:
  print((a-1)/2/a)
Problem p02682 (python)

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

if a+b >= k:
    print(min(a, k))
else:
    print(a-k+(a+b))

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

ones = [1] * a
zeros = [0] * b
minus_ones = [-1] * c

ans = sorted(ones + zeros + minus_ones)[-k:]
print(sum(ans))
Problem p02897 (python)

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

if n%2 == 0:
    print(1/2)

elif n==1:
    print(1)

else:
    print((math.ceil(n//2)+1)/n)

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

if n%2 == 0:
    print(1/2)

elif n==1:
    print(1)

else:
    print((math.ceil(n//2)+1)/n)
Problem p03017 (python)

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

temp=str(input())
maxim=max(a,b)
minim=min(a,b)
if temp[maxim:d+2].count("...")!=0 or temp[maxim+1]==temp[maxim+2]=="." or temp[maxim+1]==temp[maxim-1]==".":
    flag=1
else:
    flag=0
    
s=list(temp)
s[a]="A"
s[b]="B"
s[c]="C"
s[d]="D"

mac=max(c,d)
ans=1

for i in range(minim,mac):
    if s[i]==s[i+1]=="#":
        ans=0

if c<d and ans==1:
    ans=1
elif c>d and ans==1:
    if flag==1:
        ans=1
    elif s[d-1]=="#" or s[d+1]=="#":
        ans=0
    else:
        ans=1
                
if ans==1:
    print("Yes")
else:
    print("No")

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

temp=str(input())
maxim=max(a,b)
minim=min(a,b)
if temp[maxim:].count("...")!=0 or temp[maxim+1]==temp[maxim+2]=="." or temp[maxim+1]==temp[maxim-1]==".":
    flag=1
else:
    flag=0
    
s=list(temp)
s[a]="A"
s[b]="B"
s[c]="C"
s[d]="D"

mac=max(c,d)
ans=1

for i in range(minim,mac):
    if s[i]==s[i+1]=="#":
        ans=0


elif c<d and ans==1:
    ans=1
elif c>d and ans==1:
    if flag==1:
        ans=1
    elif d<=len(s)-1:
        ans=1
    elif s[d-1]=="#" or s[d+1]=="#":
        ans=0
    else:
        ans=1
                
if ans==1:
    print("Yes")
else:
    print("No")

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

temp=str(input())
maxim=max(a,b)
minim=min(a,b)
if temp[maxim:].count("...")!=0 or temp[maxim+1]==temp[maxim+2]=="." or temp[maxim+1]==temp[maxim-1]==".":
    flag=1
else:
    flag=0
    
s=list(temp)
s[a]="A"
s[b]="B"
s[c]="C"
s[d]="D"

mac=max(c,d)
ans=1

for i in range(minim,mac):
    if s[i]==s[i+1]=="#":
        ans=0


elif c<d and ans==1:
    ans=1
elif c>d and ans==1:
    if flag==1:
        ans=1
    elif d==len(s)-1:
        ans=1
    elif s[d-1]=="#" or s[d+1]=="#":
        ans=0
    else:
        ans=1
                
if ans==1:
    print("Yes")
else:
    print("No")

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

temp=str(input())
maxim=max(a,b)
if temp[maxim:].count("...")!=0 or temp[maxim+1]==temp[maxim+2]=="." or temp[maxim+1]==temp[maxim-1]==".":
    flag=1
else:
    flag=0
    
s=list(temp)
s[a]="A"
s[b]="B"
s[c]="C"
s[d]="D"

ans=1

for i in range(n-1):
    if s[i]==s[i+1]=="#":
        ans=0
        

if c<d and ans=1:
    ans=1
elif c>d and ans=1:
    if flag==1:
        ans=1
    elif s[d-1]=="#" or s[d+1]=="#":
        ans=0
    else:
        ans=1
                
if ans==1:
    print("Yes")
else:
    print("No")
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
    print(b)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
kyori=[]
if n>=m:
    print(0)
    
else:
    for i in range(m-1):
        kyori.append(a[i+1]-a[i])
    b=0
    kyori.sort()
    for i in range(m-n):
        b+=kyori[i]
    
print(b)

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

a.sort()
start1=a[0]
start2=a[m-1]

a.pop(0)
a.pop(m-2)

centre=(start1+start2)/2
a.append(centre)
a.sort()
c=a.index(centre)
cent_left=a[c-1]
cent_right=a[c+1]

print(abs(cent_left-start1) + abs(start2-cent_right))
Problem p02629 (python)

Fixed submission:

N = int(input())

ans = ""
while N > 0:
    N-=1                        #-1 means "a"
    ans += chr(ord('a') + N%26) #chr: Unicode to character, ord:character to Unicode
    N//=26                      #next power of 26

print(ans[::-1])                #sort reverse

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


lista=[chr(i) for i in range(97, 97+26)]
alphlist=[1]
anslist=[]
for i in range(1,12):
    if i==1:
        a=alphlist[i-1]+26**i-1
    else:
        a=alphlist[i-1]+26**i
    alphlist.append(a)

for i in range(12):
    if N<=alphlist[i]:
        keta=i
        break
a=keta
Ni=N
for i in range(a):
    Ni=Ni-sum(alphlist[0:a-i-1])+1
    at=Ni//alphlist[a-i-1]-2
    Ni=Ni-(at+1)*alphlist[a-i-1]
    print(Ni,at)
    anslist.append(lista[at])
print(''.join(anslist))
Problem p02659 (python)

Fixed submission:

A,B=map(float,input().split())

A=int(A)
B=int(B*1000)

ans=A*B//1000

print(ans)

Buggy submission (verdict: Runtime Error):

import math
from fractions import Fraction
                                                                                                           

A,B=map(float,input().split())

A=Fraction(A,15)
B=Fraction(B,15)

ans=A*B

print(math.floor(ans))
Problem p02689 (python)

Fixed submission:


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

ans_list=[1]*N

for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]<H[b-1]:
        ans_list[a-1]=0
    if H[a-1]>H[b-1]:
        ans_list[b-1]=0
    if H[a-1]==H[b-1]:
        ans_list[a-1]=0
        ans_list[b-1]=0
print(sum(ans_list))

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

ans_list=[1]*N

for i in range(M):
    a,b=map(int,input().split())
    if H[a-1]<H[b-1]:
        ans_list[a]=0
    if H[a-1]>H[b-1]:
        ans_list[b]=0
    if H[a-1]==H[b-1]:
        ans_list[a]=0
        ans_list[b]=0
print(sum(ans_list))
Problem p02707 (python)

Fixed submission:

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

A.sort()
if A[0]==0:
    A.remove(0)

l=len(A)
k=0

ans=1

m=max(A)

for i in range(l-1):
    if A[i+1]>A[i]:
        k=A[i]
        print(ans)
        while A[i+1]!=k+1:
            k=k+1
            print(0)
        ans=1
    else:
        ans=ans+1
if A[l-1]==A[l-2]:
    print(ans)
else:
    print(ans)
    
   
for j in range(m+1,N+1):
    print(0)

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

Num=[0]*(N+1)

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

for i in range(1,N+1):
    print(Num[i])
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[5]==S[6]:
    print("Yes")
else:
    print("No")
Problem p02773 (python)

Fixed submission:

from collections import Counter


N = int(input())
S = []
for i in range(N):
    S.append(input())

C=Counter(S).most_common()
L=len(C)

D=[]

D.append(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        D.append(C[i][0])
D.sort()
M=len(D)

for i in range(M):
    print(D[i])

Buggy submission (verdict: Runtime Error):

from collections import Counter


N = int(input())
S = []
for i in range(N):
    S.append(input())

C=Counter(S).most_common()
L=len(C)

D=[]

D.append(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        D.append(C[i][0])
D.sort()

for i in range(L):
    print(D[i])
Problem p02831 (python)

Fixed submission:
def gcd(x,y):
    while y!=0:
        x,y=y,x%y
    return x

def lcm(x,y):
    return x*y/gcd(x,y)

A,B=map(int,input().split())
print(int(lcm(A,B)))

Buggy submission (verdict: Runtime Error):
import math

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

A,B=map(int,input().split())
print(int(lcm(A,B)))

Buggy submission (verdict: Runtime Error):
import math

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

A,B=map(int,input().split())
print(int(lcm(A,B)))

Buggy submission (verdict: Runtime Error):
import math

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

A,B=map(int,input().split())
print(int(lcm(A,B)))

Buggy submission (verdict: Runtime Error):
import math

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

A,B=map(int,input().split())
print(lcm(A,B))
Problem p02833 (python)

Fixed submission:
import sys

N=int(input())

if N%2!=0:
    print(0)
    sys.exit()

ans1=0
ans2=0
a=2
b=5

while N//a!=0:
    ans1=ans1+N//a
    a=a*2
while N//b!=0:
    ans2=ans2+N//b//2
    b=b*5

print(min(ans1,ans2))

Buggy submission (verdict: Runtime Error):
def f(n):
    if n<2:
        return(1)
    else:
        return(n*f(n-2))

N=int(input())

F=f(N)
ans=0

while F%10==0:
    ans+=1
    F=F/10

print(ans)
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:
        print("OK")
        exit()
print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int, input().split())
if i%k == 0:
    print("OK")
    exit()
print("NG")

Buggy submission (verdict: Runtime Error):
k = int(input())
a,b = map(int, input().split())
    if i%k == 0:
        print("OK")
        exit()
print("NG")
Problem p02831 (python)

Fixed submission:
import math
def gcd(m, n):
    x = max(m,n)
    y = min(m,n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
def lcm(m, n):
    return int(m*n/gcd(m,n))
a, b = map(int, input().split())
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(math.floor(a*b/math.gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(math.floor(a*b/math.gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return math.floor(x * y/math.gcd(x, y))
a, b = map(int, input().split())
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return int((x * y)/math.gcd(x, y))
a, b = map(int, input().split())
print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a, b = map(int, input().split())
print(lcm(a,b))
Problem p03242 (python)

Fixed submission:
a = input()
l = list(a)
for i in range(len(a)):
    if l[i] == "9":
        l[i] = "1"
    elif l[i] == "1":
        l[i] = "9"
print("".join(l))

Buggy submission (verdict: Runtime Error):
a = input()
for i in range(len(a)):
    if a[i] == "1":
        a[i] = "9"
    elif a[i] == "9":
        a[i] = "1"
print(a)
Problem p02577 (python)

Fixed submission:
n=input()
s=sum(int(c) for c in n)
if s%9==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=input()
s=sum(int(c) for c in n)
if n%9==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n=int()
s=sum(int(c) for c in n)
if n%9==0:
  print('Yes')
else:
  print('No')
Problem p02781 (python)

Fixed submission:
def comb(n,k):
  if k==0:
    return 1
  if k==1:
    return n
  if k==2:
    return n*(n-1)//2
  if k==3:
    return n*(n-1)*(n-2)//6
  return None
def cnt(n,k):
  if k==0:
    return 1
  if k>len(n):
    return 0
  return (comb(len(n)-1,k)*9**k
          +(int(n[0])-1)*comb(len(n)-1,k-1)*9**(k-1)
          +cnt(n[1:].lstrip('0'),k-1))
def main():
  n=input()
  k=int(input())
  print(cnt(n,k))
main()

Buggy submission (verdict: Runtime Error):
def comb(n,k):
  if k==0:
    return 1
  if k==1:
    return n
  if k==2:
    return n*(n-1)//2
  if k==3:
    return n*(n-1)*(n-2)//6
  return None
def cnt(n,k):
  if k==0:
    return 1
  return (comb(len(n)-1,k)*9**k
          +(int(n[0])-1)*comb(len(n)-1,k-1)*9**(k-1)
          +cnt(n[1:],k-1))
def main():
  n=input()
  k=int(input())
  print(cnt(n,k))
main()
Problem p02792 (python)

Fixed submission:
from itertools import product
from functools import reduce
import operator
def prod(iterable):
    return reduce(operator.mul, iterable, 1)
def cnt_samelen(b,e,n_str):
  n0=int(n_str[0])
  if b>n0 or len(n_str)==1:
    return 0
  if b<n0:
    return b*int(10**(len(n_str)-2))
  
  return (int(n_str[1:-1])+1 if len(n_str)>2 else 1)-(1 if e>int(n_str[-1]) else 0)
def cnt(b,e,n_str):
  res=0
  l=len(n_str)
  if b==e and int(n_str)>=b:
    res+=1
  for i in range(l-2):
    res+=10**(i)
  res+=cnt_samelen(b,e,n_str)
  return res
def sol():
  n_str=input()
  return sum(cnt(b,e,n_str)*cnt(e,b,n_str) 
             for b,e in product(range(1,10),repeat=2))

print(sol())

Buggy submission (verdict: Runtime Error):
from itertools import product
def cnt(b,e,n_str):
  res=0
  for i in range(int(n_str)+1):
    if int(str(i)[0])==b and i%10==e:
      res+=1
  return res
def sol():
  n_str=input()
  c={i:{j:cnt(b,e,n_str) for j in range(1,10)} for i in range(1,10)}
  return sum(c[b][e]*c[e][b] 
             for b,e in product(range(1,10),repeat=2))

print(sol())

Buggy submission (verdict: Runtime Error):

def cnt(b,e,n_str):
  res=0
  for i in range(int(n_str)+1):
    if int(str(i)[0])==b and i%10==e:
      res+=1
  return res
def sol():
  n_str=input()
  return sum(cnt(b,e,n_str)*cnt(e,b,n_str) 
             for b,e in product(range(1,10),repeat=2))

print(sol())
Problem p03222 (python)

Fixed submission:
h,w,k=map(int,input().split())
def amida_h1_total(w):
    if w<0:
        return 0
    if w==0:
        return 1
    return amida_h1_total(w-1)+amida_h1_total(w-2)
def amida(h,w,k):
    memo=[[-1 for _ in range(w)] for _ in range(h)]
    memo[0][0]=amida_h1_total(w-1)
    if w>1:
        memo[0][1]=amida_h1_total(w-2)
    for i in range(2,w):
        memo[0][i]=0
    def _amida(h,k):
        if k<=0 or k>w:
            return 0
        if memo[h-1][k-1]>=0:
            return memo[h-1][k-1]
        memo[h-1][k-1]=sum((_amida(h-1,k-1)*amida_h1_total(k-2)*amida_h1_total(w-k),
                            _amida(h-1,k)  *amida_h1_total(k-1)*amida_h1_total(w-k),
                            _amida(h-1,k+1)*amida_h1_total(k-1)*amida_h1_total(w-k-1)))%1000000007
        return memo[h-1][k-1]
    return _amida(h,k)
print(amida(h,w,k))

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

def amida(h,w,k):
    memo=[[-1 for _ in range(w)] for _ in range(h)]
    memo[0][0]=amida_h1_total(w-1)
    if w>1:
        memo[0][1]=amida_h1_total(w-2)
    for i in range(2,w):
        memo[0][i]=0
    def _amida(h,k):
        if k<=0 or k>w:
            return 0
        if memo[h-1][k-1]>=0:
            return memo[h-1][k-1]
        memo[h-1][k-1]=sum((_amida(h-1,k-1)*amida_h1_total(k-2)*amida_h1_total(w-k),
                            _amida(h-1,k)  *amida_h1_total(k-1)*amida_h1_total(w-k),
                            _amida(h-1,k+1)*amida_h1_total(k-1)*amida_h1_total(w-k-1)))%1000000007
        return memo[h-1][k-1]
    return _amida(h,k)
print(amida(h,w,k))
Problem p02595 (python)

Fixed submission:
import math
n,d=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)]
c=0
for i in range(n):
    x=l[i][0]
    y=l[i][1]
    k=math.sqrt(x**2+y**2)
    if k<=d:c+=1
print(c)

Buggy submission (verdict: Runtime Error):
import math
n,d=map(int,input().split())
l==[list(map(int,input().split())) for _ in range(n)]
c=0
for i in range(n):
    x=l[i][0]
    y=l[i][1]
    k=math.sqrt(x**2+y**2)
    if k<=d:c+=1
print(c)
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if k<=a:
    print(k)
elif k<=a+b:
    print(a)
else:
    print(a-(k-a-b))

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input())
if k<=a:
    print(k)
elif k<=a+b:
    print(a)
else:
    print(a-(k-a-b))
Problem p02725 (python)

Fixed submission:
import numpy as np
k,n=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a)
if max(abs(a[1:]-a[:-1])) < k-abs(a[0]-a[-1]):b=k-abs(a[0]-a[-1])
else:b= max(abs(a[1:]-a[:-1]))
print(k-b)

Buggy submission (verdict: Runtime Error):
import numpy as np
k,n=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a)
a1=abs(a[1:]-a[:-1])
a1.append(abs(a[0]-a[-1]))
print(k-max(a1))

Buggy submission (verdict: Runtime Error):
import numpy as np
k,n=map(int,input().split())
a=list(int,input().split())
a=np.array(a)
if max(abs(a[1:]-a[:-1])) < k-abs(a[0]-a[-1]):b=k-abs(a[0]-a[-1])
else:b= max(abs(a[1:]-a[:-1]))
print(k-b)
Problem p02773 (python)

Fixed submission:
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
l=c.most_common()
k=l[0][1]
l1=[]
for i in range(len(l)):
    if l[i][1]==k:l1.append(l[i][0])
    else:break
l1.sort()
for i in range(len(l1)):
    print(l1[i])

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
l=c.most_common()
k=l[0][1]
for i in range(n):
    if l[i][1]==k:print(l[i][0])
    else:exit()
Problem p02819 (python)

Fixed submission:
x=int(input())
A=10**6
pn=[2]
for L in range(3, A, 2):
    if x==2:
        print(2)
        exit()
    if all(L % L2 != 0 for L2 in pn):
        pn.append(L)
        if L>=x:
            k=L
            break
print(k)

Buggy submission (verdict: Runtime Error):
x=int(input())
A=10**5
pn=[2]
for L in range(3, A, 2):
    if x==2:
        print(2)
        exit()
    if all(L % L2 != 0 for L2 in pn):
        pn.append(L)
        if L>=x:
            k=L
            break
print(k)
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
l=[1,2,3]
l.remove(a)
l.remove(b)
print(l[0])

Buggy submission (verdict: Runtime Error):
a=int(input()
b=int(input()
l=[1,2,3]
l.remove(a)
l.remove(b)
print(l[0])

Buggy submission (verdict: Runtime Error):
l=[1,2,3]
l.remove(int(input())
l.remove(int(input())
print(l[0])
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a,b=map(int,input().split())
def lcm(a,b):
    return a*b // gcd(a,b)
print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
ab=list(map(int,input().split()))
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(ab[0], ab[1]))

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a, b))
Problem p02897 (python)

Fixed submission:
n= int(input())
if n%2==0:print(0.5)
elif n==1:print(1.0)
else:print((n//2 +1)/n)

Buggy submission (verdict: Runtime Error):
n= int(input())
if n%2==0:print(n/2)
elif n=1:print(1)
else:print((n//2 +1)/n)
Problem p02912 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for i in range(m):
  min = heapq.heappop(a)
  heapq.heappush(a, (-min//2)*(-1))
print(-sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
sa=sum(a)//n
c=0
if n==1:
    print(a[0]//(2**m))
    exit()
else:
    while True:
        a.sort()
        a1=a[:n//2]
        a2=a[n//2:]
        print(a1,a2)
        while True:
            if c==m:
                print(sum(a1)+sum(a2))
                exit()
            if len(a2)==0:
                a=a1
                break
            k=a2.pop(-1)
            while True:
                k=k//2
                c+=1
                if k<=sa:
                    a1.append(k)
                    print(a1,a2)
                    break

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
sa=sum(a)//n
c=0
if n==1:
    print(a[0]//(2**m))
    exit()
else:
    while True:
    a.sort()
    a1=a[:n//2]
    a2=a[n//2:]
    print(a1,a2)
    while True:
        if c==m:
            print(sum(a1)+sum(a2))
            exit()
        if len(a2)==0:
            a=a1
            break
        k=a2.pop(-1)
        while True:
            k=k//2
            c+=1
            if k<=sa:
                a1.append(k)
                print(a1,a2)
                break

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
c=0
while True:
    a.sort()
    a1=a[:n//2]
    a2=a[n//2:]
    while True:
        if c==m:
            print(sum(a1)+sum(a2))
            exit()
        if len(a2)==0:
            a=a1
            break
        k=a2.pop(-1)
        while True:
            k=k//2
            c+=1
            if k<=a1[-1]:
                a1.append(k)
                break
Problem p02987 (python)

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

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

Fixed submission:
k=list(map(int,input().split()))
k.sort()
print(int(k[0])+int(k[1]))

Buggy submission (verdict: Runtime Error):
p,q,r=map(int,input().split())
print(min(p,q,r)+min(p,q,r)[1])