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

Fixed submission:

def primesbelow(N):
    # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
    #""" Input N>=6, Returns a list of primes, 2 <= p < N """
    correction = N % 6 > 1
    N = {0:N, 1:N-1, 2:N+4, 3:N+3, 4:N+2, 5:N+1}[N%6]
    sieve = [True] * (N // 3)
    sieve[0] = False
    for i in range(int(N ** .5) // 3 + 1):
        if sieve[i]:
            k = (3 * i + 1) | 1
            sieve[k*k // 3::2*k] = [False] * ((N//6 - (k*k)//6 - 1)//k + 1)
            sieve[(k*k + 4*k - 2*k*(i%2)) // 3::2*k] = [False] * ((N // 6 - (k*k + 4*k - 2*k*(i%2))//6 - 1) // k + 1)
    return [2, 3] + [(3 * i + 1) | 1 for i in range(1, N//3 - correction) if sieve[i]]

n=int(input())
primes=primesbelow(n+10)
factor={}

def val(n,d):
    ans=0
    t=d
    while(t<=n):
        ans+=(n//t)
        t*=d
    return ans
g2=0
g4=0
g24=0
g14=0
g74=0
for i in primes:
    k=val(n,i)
    if k>=4:
        g4+=1
    if k>=2:
        g2+=1
    if k>=24:
        g24+=1
    if k>=14:
        g14+=1
    if k>=74:
        g74+=1

a=(g2-2)*((g4*(g4-1))//2)
b=g24*(g2-1)
c=g14*(g4-1)
d=g74
print(a+b+c+d)

Buggy submission (verdict: Runtime Error):

def primesbelow(N):
    # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188
    #""" Input N>=6, Returns a list of primes, 2 <= p < N """
    correction = N % 6 > 1
    N = {0:N, 1:N-1, 2:N+4, 3:N+3, 4:N+2, 5:N+1}[N%6]
    sieve = [True] * (N // 3)
    sieve[0] = False
    for i in range(int(N ** .5) // 3 + 1):
        if sieve[i]:
            k = (3 * i + 1) | 1
            sieve[k*k // 3::2*k] = [False] * ((N//6 - (k*k)//6 - 1)//k + 1)
            sieve[(k*k + 4*k - 2*k*(i%2)) // 3::2*k] = [False] * ((N // 6 - (k*k + 4*k - 2*k*(i%2))//6 - 1) // k + 1)
    return [2, 3] + [(3 * i + 1) | 1 for i in range(1, N//3 - correction) if sieve[i]]

n=int(input())
primes=primesbelow(n)
factor={}

def val(n,d):
    ans=0
    t=d
    while(t<=n):
        ans+=(n//t)
        t*=d
    return ans
g2=0
g4=0
g24=0
g14=0
g74=0
for i in primes:
    k=val(n,i)
    if k>=4:
        g4+=1
    if k>=2:
        g2+=1
    if k>=24:
        g24+=1
    if k>=14:
        g14+=1
    if k>=74:
        g74+=1

a=(g2-2)*((g4*(g4-1))//2)
b=g24*(g2-1)
c=g14*(g4-1)
d=g74
print(a+b+c+d)
Problem p03239 (python)

Fixed submission:
n,t=map(int,input().strip().split(" "))
c=[]
time=[]
for i in range(n):
    a,b=map(int,input().strip().split(" "))
    if b<=t:
        c.append(a)
if c==[]:
    print("TLE")
else:
    print(min(c))

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().strip().split(" "))
c=[]

for i in range(n):
    a,b=map(int,input().strip().split(" "))
    if b<=t:
        c.append(a)
print(min(c))
Problem p03274 (python)

Fixed submission:
n,K=(int(i) for i in input().strip().split(" "))
x=[int(i) for i in input().strip().split(" ")]


ans = min(b - a + min(abs(a), abs(b)) for a, b in zip(x, x[K-1:]))
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=(int(i) for i in input().strip().split(" "))
ar=[int(i) for i in input().strip().split(" ")]
try:
    ar.remove(0)
    k-=1
except ValueError:
    pass

from bisect import bisect
t=bisect(ar,0)
l=ar[:t]
r=ar[t:]

m=99999999999999
if k:
    if len(r)>=k:
        m=r[k-1]
    if len(l)>=k:
        t1=-l[-k]
        if t1<m:
            m=t1

    for r1 in range(k-len(l),min(k,len(r))):
        l1=k-r1
        t1=2*r[r1-1] - l[-l1]
        t2= -2*l[-l1] + r[r1-1]
        if min(t1,t2)<m:
            m=min(t1,t2)
    print(m)
else:
    print(0)
Problem p03292 (python)

Fixed submission:
ar=[int(i) for i in input().strip().split(" ")]
ar.sort()
s=0
for i in range(1,len(ar)):
    s+=(ar[i]-ar[i-1])
print(s)

Buggy submission (verdict: Runtime Error):
    ar=[int(i) for i in input().strip().split(" ")]
    ar.sort()
    s=0
    for i in range(1,len(ar)):
        s+=(ar[i]-ar[i-1])
    print(s)
Problem p02657 (python)

Fixed submission:
a,b = map(int,input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
print(int(input())*int(input()))
Problem p02706 (python)

Fixed submission:
D, n = map(int,input().split())
l = list(map(int,input().split()))
a = D - sum(l)
if a >-1:
    print(a)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
D, n = map(int,input().split())
l = list(map(int,input().spliy()))
print(D-sum(l))
Problem p02576 (python)

Fixed submission:
n,x,t = map(int,input().split())
i = 0
while x*i<n:
	i +=1
print(i*t)

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

i = 0
while x*i>=n:
	i +=1

println(i*x)
Problem p02641 (python)

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

min = 100

if N !=0:
  Plist = list(map(int,input().split()))
  anslist = [i for i in range(201)]
  anslist.append(-1)
  #anslist.remove(0)
  Plist = sorted(Plist)
  for i in range(N):
    anslist.remove(Plist[i])
    temp =100
  for i in range(len(anslist)):
    if min >abs(anslist[i]-X) :
      min = abs(anslist[i]-X)
      temp = anslist[i]
  print (temp)
else :
  print (X)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
if N!=0:
  plist =list(map(int,input().split()))
  print (plist)
  #maxN = max(plist)
  maxN = 100
  Anslist =[i for i in range(X+1)]
  #print (Anslist)
  for i in range(len(plist)):
    Anslist.remove(plist[i])
  Anslist.remove(0)
  #print(Anslist)

  ans = 0
  min=100
  for i in range(len(Anslist)):
    if min>abs(X-Anslist[i]):
      min = abs(X-Anslist[i])
      ans = Anslist[i]
  print(ans)
else :print(X)

Buggy submission (verdict: Runtime Error):
X,N = map(int,input().split())
maxN = 100
if N!=0:
  plist =list(map(int,input().split()))
  #maxN = max(plist)
  Anslist =[i for i in range(100)]
  #print (Anslist)
  for i in range(len(plist)):
    Anslist.remove(plist[i])
  Anslist.remove(0)
  #print(Anslist)

  ans = 0
  min=100
  for i in range(len(Anslist)):
    if min>abs(X-Anslist[i]):
      min = abs(X-Anslist[i])
      ans = Anslist[i]
  print(ans)
else :print(X)
Problem p02657 (python)

Fixed submission:
a,b = map(int,input().split())
print (a*b)

Buggy submission (verdict: Runtime Error):
num = int(input())
numbers = list(map(int,input().split()))
sum = 1
for i in range(num):
  sum *=numbers[i]
  if (sum>(10**18)):
    sum = -1
    break
if 0 in numbers:
  sum = 0
print (sum)
Problem p02658 (python)

Fixed submission:
num = int(input())
numbers = list(map(int,input().split()))
sum = 1
for i in range(num):
  sum *=numbers[i]
  if (sum>(10**18)):
    sum = -1
    break
if 0 in numbers:
  sum = 0
print (sum)

Buggy submission (verdict: Runtime Error):
num = int(input())
numbers = list(map(int,input().split()))
sum = 1
for i in range(num):
  sum *=numbers[i]
  if (sum>(10**18)):
  	print (-1)
    break
if sum<=(10**18):
  print (sum)
Problem p02657 (python)

Fixed submission:
a, b = map(int, input().split())
print(a*b)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input.split())
print(a*b)
Problem p02675 (python)

Fixed submission:
n = input()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

if int(n[-1]) in hon:
    print('hon')
elif int(n[-1]) in pon:
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
n = input()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

if int(n[-1]) in hon:
    print('hon')
elif int(n[:-1]) in pon:
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
n = input()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

if int(n[:-1]) in hon:
    print('hon')
elif int(n[:-1]) in pon:
    print('pon')
else:
    print('bon')
Problem p02772 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ret = 'APPROVED'
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            ret = 'DENIED'
            break
print(ret)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(int(input().split()))
ret = 'APPROVED'
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            ret = 'DENIED'
            break
print(ret)
Problem p02898 (python)

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))
ret = 0
for i in h:
    if i >= k:
        ret += 1
print(ret)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input())
h = list(map(int, input()))
ret = 0
for i in h:
    if i >= k:
        ret += 1
print(ret)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
ans = 0

for i, j in zip(s, t):
    if i == j:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = 0

for i, j in s, t:
    if i == j:
        ans += 1
print(ans)
Problem p03043 (python)

Fixed submission:
import math

N, K=map(int,input().split())
ansA, ansB = 0, 0
for i in range(N):
    if K/(i+1) <= 1:
        ansA += 1/N
    else:
        x = math.ceil(K/(i+1))
        y = 0.5**math.ceil(math.log2(x))
        ansB += y/N

print(ansA + ansB)

Buggy submission (verdict: Runtime Error):
import math

N, K=map(int,input().split())
ansA, ansB = 0, 0
for i in range(N):
    if K/(i+1) <= 1:
        ansA += 1/N
    else:
        x = math.ceil(K/(i+1))
        y = 0.5**math.ceil(math.log2(x))
        ansB += y/N

print(ansA + ansB)
Problem p03095 (python)

Fixed submission:
N=list(range(int(input())))
S=list(input())
S=sorted(S)
answer=0

prev=S[0]
counts = []
counter=0

for k in S:
    if k==prev:
        counter+=1
    else:
        prev=k
        if counter!=0:
            counts.append(1+counter)
        counter=1
if counter!=0:
    counts.append(1+counter)

def soujou(li):
    atai=1
    for j in li:
        atai=j*atai
    return atai

answer=soujou(counts)-1
print(answer%(7+10**9))

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

N=int(input())
S=list(input())
answer=0
col = collections.Counter(S)
values, counts = zip(*col.most_common())

for i in range(N):
    C=list(itertools.combinations(counts, i+1))
    kumiawase=[np.prod(j) for j in C]
    answer=(answer+sum(kumiawase))%(7+10**9)
print(answer)

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

N=int(input())
S=list(input())
answer=0
col = collections.Counter(S)
values, counts = zip(*col.most_common())

for i in range(N):
    C=list(itertools.combinations(counts, i+1))
    kumiawase=[np.prod(j) for j in C]
    answer+=sum(kumiawase)
print(answer%(7+10**9))

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

N=int(input())
S=list(input())
answer=0
col = collections.Counter(S)
values, counts = zip(*col.most_common())

for i in range(N):
    C=list(itertools.combinations(counts, i+1))
    kumiawase=[np.prod(j) for j in C]
    answer+=sum(kumiawase)
print(answer)
Problem p03106 (python)

Fixed submission:
a, b, k = map(int, input().split())
l = []
for i in range(1, min(a, b)+1):
    if a%i == 0 and b%i == 0:
        l.append(i)
print(l[-k])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = []
for i in range(1, min(a, b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
print(l[-k])

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = []
for i in range(1, max(a, b)):
    if a%i == 0 and b%i == 0:
        l.append(i)
print(l[-k])
Problem p03240 (python)

Fixed submission:
n=int(input())
p=[list(map(int,input().split()))for _ in range(n)] #[ax,ay,ah]をひとつの要素とする二重リスト
ax,ay,ah=list(filter(lambda x:x[2],p))[0] #x[2]がTrue、つまりahが0以外のリストの先頭の要素を取得
for x in range(101):
    for y in range(101):
        H=ah+abs(ax-x)+abs(ay-y) #Hの予測値
        if all([max(H-abs(t[0]-x)-abs(t[1]-y),0)==t[2]for t in p]): #ahのリストを生成し、予測したHから正しいかどうか判定
            print(x,y,H)

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

def solve(li):
    for i in range(101):
        for j in range(101):
            flag=1
            Cx,Cy=i,j
            H_prev=0
            for k in li:
                if k[2]!=0:
                    H_prev=k[2]+abs(k[0]-Cx)+abs(k[1]-Cy)
                    break
            for k in li:
                H=max(k[2]+abs(k[0]-Cx)+abs(k[1]-Cy),0)
                if H_prev != H:
                    flag=0
                    break
                H_prev=H
            if flag==1 and H>=1:
                A=[i,j,H]
                return A
A=solve(li)
print(' '.join(map(str,A)))

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

def solve(li):
    for i in range(101):
        for j in range(101):
            flag=1
            Cx,Cy=i,j
            H_prev=li[0][2]+abs(li[0][0]-Cx)+abs(li[0][1]-Cy)
            for k in li:
                H=k[2]+abs(k[0]-Cx)+abs(k[1]-Cy)
                if H_prev != H:
                    flag=0
                    break
                H_prev=H
            if flag==1 and H>=1:
                A=[i,j,H]
                return A
A=solve(li)
print(' '.join(map(str,A)))
Problem p03244 (python)

Fixed submission:
from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
vo = v[::2]
ve = v[1::2]
co = Counter(vo).most_common()
ce = Counter(ve).most_common()
co.append((-1, 0)) #vが[1,1,1,1]のようなケースへの対応
ce.append((-2, 0)) #頻度の降順に並んでいるのでこの書き方で十分
if co[0][0] != ce[0][0]: #偶奇の最頻の要素が異なる場合
    print(n - co[0][1] - ce[0][1])
else:
    res1 = n - co[0][1] - ce[1][1] #偶数側を書き換える場合
    res2 = n - co[1][1] - ce[0][1] #奇数側を書き換える場合
    print(min(res1, res2))

Buggy submission (verdict: Runtime Error):
from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
vo = v[::2]
ve = v[1::2]
co = Counter(vo).most_common()
ce = Counter(ve).most_common()
co.append((-1, 0)) #vが[1,1,1,1]のようなケースへの対応
ce.append((-2, 0)) #頻度の降順に並んでいるのでこの書き方で十分
if co[0][0] != ce[0][0]: #偶奇の最頻の要素が異なる場合
    print(n - co[0][1] - ce[0][1])
else:
    res1 = n - co[0][1] - ce[1][1] #偶数側を書き換える場合
    res2 = n - co[1][1] - ce[0][1] #奇数側を書き換える場合
print(min(res1, res2))
Problem p03262 (python)

Fixed submission:
N,X=map(int,input().split())
li=list(map(int,input().split()))

def gcd(a,b):
    if b==0:return a
    return gcd(b,a%b)

if X not in li:
    li.append(X)
li=sorted(li)
distance=[]

for i in range(len(li)-1):
    distance.append(li[i+1]-li[i])

answer=1
if N==1:
    answer=distance[0]
else:
    element = gcd(distance[0], distance[1])
    if N==2:answer=element
    else:
        for i in range(2,N):
            element=gcd(element,distance[i])
        answer=element

print(answer)

Buggy submission (verdict: Runtime Error):
import functools
import math

def gcd(values):
    x=functools.reduce(math.gcd, values)
    return x

N,X=map(int,input().split())
li=list(map(int,input().split()))
if X not in li:
    li.append(X)
li=sorted(li)
distance=[]

for i in range(len(li)-1):
    distance.append(li[i+1]-li[i])
answer=gcd(distance)
print(answer)

Buggy submission (verdict: Runtime Error):
import functools
import math

def gcd(values):
    x=functools.reduce(math.gcd, values)
    return x

N,X=map(int,input().split())
li=list(map(int,input().split()))
if X not in li:
    li.append(X)
li=sorted(li)
distance=[]

for i in range(len(li)-1):
    distance.append(li[i+1]-li[i])
answer=gcd(distance)
print(answer)
Problem p03311 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
B=[A[i]-i-1 for i in range(N)]
B=sorted(B)

center=B[N//2] if N%2==1 else round((B[(N-1)//2]+B[(N+1)//2])/2)
ans=0
for i in B:
    ans+=abs(i-center)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=[A[i]-i for i in range(N)]
B=sorted(B)

center=B[N//2] if N%2==0 else round((B[(N-1)//2]+B[(N+1)//2])/2)
ans=0
for i in B:
    ans+=abs(i-center)
print(ans)
Problem p03323 (python)

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

if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

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

if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")
Problem p03360 (python)

Fixed submission:
l = list(map(int, input().split()))
k = int(input())
l = sorted(l, reverse=True)
for i in range(k):
  l[0] = l[0]*2
print(sum(l))

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
k = int(input())
l = sorted(l, reversed=True)
for i in range(k):
  l[0] = l[0]*2
print(sum(l))

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
k = int(input())
l = sorted(l, reversed=True)
for i in range(k):
  l[0] = l[0]*2
print(sum(l))
Problem p03408 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]

ans = 0
for i in S:
    ans = max(ans, S.count(i) - T.count(i))

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(N)]

ans = 0
for i in S:
    ans = max(ans, S.count(i) - T.count(i))

print(ans)
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input())
print((n-1)*(m-1))
Problem p02582 (python)

Fixed submission:
#akash mandal: jalpaiguri government engineering college
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())


def main():
    s=input()
    if(s.count("RRR")>0):
        print(3)
    elif(s.count("RR")>0):
        print(2)
    elif(s.count("R")>0):
        print(1)
    else:
        print(0)
        
        
      
        
    
    
    
            
        
            
    
        
if __name__=="__main__":
    main()

Buggy submission (verdict: Runtime Error):
#akash mandal: jalpaiguri government engineering college
import sys,math

def ii(): return int(input())
def mii(): return map(int,input().split())
def lmii(): return list(mii())

def ask(n):
    print(1,n)
    sys.stdout.flush()
    return ii()
    
def decimalToBinary(n):  
    return bin(n).replace("0b", "")  


def main():
    s=input()
    if(s.count("RRR")>0):
        print(3)
        continue
    if(s.count("RR")>0):
        print(2)
        continue
    if(s.count("R")>0):
        print(1)
        continue
    print(0)
        
        
      
        
    
    
    
            
        
            
    
        
if __name__=="__main__":
    main()
Problem p02705 (python)

Fixed submission:
r=int(input())
print(2*r*3.1415)

Buggy submission (verdict: Runtime Error):
r=int(input)
print(2*r*3.1415)
Problem p02899 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
lst = [0]*len(A)
cnt = 1

for i in A:
  lst[i-1] = str(cnt)
  cnt += 1

print(' '.join(lst))

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

for i in range(1,len(A+1)):
  R += str(A.index(i)+1) + ' '

print(R)
Problem p02900 (python)

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

def make_divisors(n):
	divisors = set()
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.add(i)
			if i != n // i:
				divisors.add(n//i)
	return divisors
	
A = make_divisors(a)
B = make_divisors(b)
S = A & B
#Sから素数だけを抽出してカウント
import math

def is_prime(n):
	if n == 1: return False
	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False
	return True
cnt = 1
for i in S:
	if is_prime(i) == True:
		cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
mport time
import math
a,b = map(int,input().split())
cnt = 0
if a >= b:
  A = int(math.sqrt(b))
else:
  A = int(math.sqrt(a))
pn=[2]

t1 = time.time()
for L in range(3,A):
    chk=True
    for L2 in pn:
        if L%L2 == 0:chk=False
    if chk==True:pn.append(L)
pn.append(1)
t2 = time.time()
for i in pn:
  if a%i ==0 and b%i == 0:
    cnt += 1
t3 = time.time()
print(cnt)
Problem p02947 (python)

Fixed submission:
import collections

n = int(input())
s = [input() for i in range(n)]
s = map(list,s)
lst = []
for i in s:
  i.sort()
  lst.append(''.join(i))
ans = collections.Counter(lst)
ctr = 0
for v in ans.values():
  if v != 1:
    for n in range(1,v):
      ctr+=n
      
print(ctr)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
s = [input() for i in range(n)]
s = map(list,s)
lst = []
for i in s:
  i.sort()
  lst.append(''.join(i))
ans = collections.Counter(lst)
ctr = 0
for v in ans.items():
  if v != 1:
    ctr += v
print(ctr)
Problem p02952 (python)

Fixed submission:
n=int(input())
ct = 0

if n <= 9:
	ct = n
elif n <= 99:
	ct = 9
elif n <= 999:
	ct = n - 90
elif n <= 9999:
	ct = 909
elif n <= 99999:
	ct = n - 9000  - 90
elif n == 100000:
	ct = 90909
	
print(ct)

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

if n < 10:
	print(n)
elif n < 100:
	print(9)
elif n < 1000:
	print(9 + n - 99)
elif n == 1000:
	print(909)
elif n < 10_000:
	print(909)
elif n == 10_000:
	print(910)
elif n < 100_000:
	print(909 + n-9999)
elif n == 100_000:
	print(90909)
else:
	pass

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

if n < 10:
	print(n)
elif n < 100:
	print(9)
elif n < 1000:
	print(9 + n - 99)
elif n == 1000:
	print(909)
elif n < 10_000:
	print(909)
elif n == 10_000:
	print(910)
elif n < 100_000:
	print(909 + n-9999)
elif n == 100_000:
	print(90909)

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

if n < 10:
	print(n)
elif n < 100:
	print(9)
elif n < 1000:
	print(9 + n - 99)
elif n == 1000:
	print(909)
elif n < 10_000:
	print(909)
elif n == 10_000:
	print(910)
elif n < 100_000:
	print(909 + n-9999)
elif n == 100_000:
	print(90909)
Problem p02971 (python)

Fixed submission:
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)

k = [i for i, x in enumerate(a) if x == m]

if len(k)>=2:
	for i in a:
		print(m)
else:
	b = []
	b += a
	mi = b.index(m)
	b.pop(mi) 
	m2 = max(b)
	for i in a:
		if i != m:
			print(m)
		else:
			print(m2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)

k = [i for i, x in enumerate(a) if x == m]

if len(k)>=2:
	for i in range(n):
		print(m)
else:
	b = a
	b.pop(m)
	m2 = max(b)
	for i in range(n):
		if i != m:
			print(m)
		else:
			print(m2)

Buggy submission (verdict: Runtime Error):
import sys
a = list(map(int,sys.stdin.readline().split()))
n = a.pop(0)

for i in range(n):
	b = set(a[:i]+a[i+1:])
	print(max(b))
	del b
Problem p02582 (python)

Fixed submission:
s = input()
print(len(max(s.split("S"))))

Buggy submission (verdict: Runtime Error):
def solve(x):
  if x.count("RRR"):
    return 3
  if x.count("RR"):
    return 2
  if x.count("R"):
    return 1

x = input()
print(int(solve(x)))
Problem p03494 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
count = 0
while all(a % 2 == 0 for a in A):
    A = [a / 2 for a in A]
    count += 1
print(count)

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

cnt = 0
while all(a % 2 == 0 for a in l):
	l = [a / 2 for a in l]
    cnt += 1
print(cnt)

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

cnt = 0
while all(a % 2 == 0 for a in A):
	A = [a / 2 for a in A]
    cnt += 1
print(cnt)

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

cnt = 0
while all(a % 2 == 0 for a in A):
	A = [a / 2 for a in A]
    cnt += 1
print(count)
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)

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

if a[0] == 1:
    print("Hello World")
else:
    print(a[1] + a[2])
Problem p03260 (python)

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

if X % 2 != 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
X = A * B

if X % == 0:
    print("Yes")
else:
    print("No")