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

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

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(n//(a+b)+1):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(10**18):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(10**100):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(3):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))
Problem p02970 (python)

Fixed submission:
n, d = map(int, input().split())
if n/(2*d +1) == n//(2*d+1):
  print(n//(2*d+1))
else:
  print(n//(2*d+1)+1)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input().split()
print(-(-n//(2*d+1)))
Problem p02627 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
print(num2alpha(N).lower())
Problem p02897 (python)

Fixed submission:
N = input()

s = int(N)%2

if s == 0:
  print(0.5)
else:
  a = (int(N)+1)/(2*int(N))
  print(a)

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

N = A[0]
K = A[1]

a = N-1
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

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

N = int(A[0])
K = int(A[1])

a = int(N-1)
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)

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

N = int(A[0])
K = int(A[1])

a = int(N-1)
b = 0
d = 0
for i in B:
  c = B[b]
  if K <= c:
    d = d+1
  b = b+1
print(d)
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())
if W>=S:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
S = [input() for i in range(N)]
print(len(collections.Counter(S)))
Problem p02729 (python)

Fixed submission:
import math
def comb(n,r):
    if n<2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

a, b = map(int, input().split())
print(comb(a,2)+comb(b,2))

Buggy submission (verdict: Runtime Error):
sum = int(input())
print((sum/3)*(sum/3)*(sum/3))
Problem p02594 (python)

Fixed submission:
t = int(input())
if (t >= 30):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
int t = 30
if (t >= 30):
  print('Yes')
else:
  print('No')
Problem p02595 (python)

Fixed submission:
import math
n,d  = map(int,input().split())

x =[]
y = []
for i in range(n):
    x1,y1  = map(int,input().split())
    x.append(x1)
    y.append(y1)

n = 0
 
for i ,index in enumerate(x):
  m = math.sqrt(x[i]**2 + y[i]**2)
  if m <= d:
    n += 1
 
print(n)

Buggy submission (verdict: Runtime Error):
import math
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]

n = 0

for i ,index in enumerate(x[0]):
  m = math.sqrt(x[i+1]**2 + y[i+1]**2)
  if (m <= y[0]):
    n += 1

print(n)
Problem p02881 (python)

Fixed submission:
import sys
from io import StringIO
import unittest
import math


def resolve():
    N = int(input())
    A = 1
    B = 1

    center = math.ceil(math.sqrt(N))
    for i in range(1, center + 1)[::-1]:
        if N % i == 0:
            A = i
            B = int(N / i)
            break
        else:
            continue

    result = A - 1 + B - 1
    print(result)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """10"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """50"""
        output = """13"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """10000000019"""
        output = """10000000018"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Buggy submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest
import math


def check(A, F, x, N, K):
    for i in range(N):
        if A[i] * F[i] > x:
            k = math.ceil(A[i] - x / F[i])
            K -= k
    if K < 0:
        return False
    else:
        return True


def resolve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    F = list(map(int, input().split()))
    A.sort(reverse=True)
    F.sort()

    # binary search
    l = 0
    r = max(A) * max(F)
    result = None
    while l <= r:
        # print('l {}, r {}'.format(l, r))
        if l == r:
            result = l
            break
        mid = (l + r) // 2
        if check(A, F, mid, N, K):
            r = mid
        else:
            l = mid + 1

    print(result)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 5
4 2 1
2 3 1"""
        output = """2"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 8
4 2 1
2 3 1"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """11 14
3 1 4 1 5 9 2 6 5 3 5
8 9 7 9 3 2 3 8 4 6 2"""
        output = """12"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()
Problem p03803 (python)

Fixed submission:
A,B = map(int, input().split())
if(A==B):
    print('Draw')
elif A==1:
    print('Alice')
elif B==1:
    print('Bob')
elif A>B:
    print('Alice')
elif B>A:
    print('Bob')

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

ans = 0
for i in range(N-M+1):
    for j in range(N-M+1):
        t = [k[j:j+M] for k in a[i:i+M]]
        if t==b: ans =1

print("Yes" if ans else "No")
Problem p02711 (python)

Fixed submission:
n = list(map(int, input()))
flg = 0
if n[0]==7:
  flg = 1
if n[1]==7:
  flg = 1
if n[2]==7:
  flg = 1

if flg == 1:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
flg = 0
if n[0]==7:
  flg = 1
if n[1]==7:
  flg = 1
if n[2]==7:
  flg = 1

if flg == 1:
  print('Yes')
else:
  print('No')

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

for i in range(1,n)
  if i%15==0:
    print('FizzBuzz')
  elif i%5==0:
    print('Buzz')
  elif i%3==0:
    print('Fizz')
  else:
    print(i)
Problem p02572 (python)

Fixed submission:
def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = array_sum * array_sum 
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    temp=int(array_sum_square - 
            individual_square_sum) 
    temp=temp//2
    return temp%1000000007








n = int(input())
l = list(map(int, input().split()))
print(findProductSum(l,n))

Buggy submission (verdict: Runtime Error):
def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = array_sum * array_sum 
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    temp=int(array_sum_square - 
            individual_square_sum) / 2
    return temp%1000000007








list=list()
n=int(input())
for i in range(n):
	l=int(input())
	list.append(l)
print(findProductSum(list,n))
Problem p02627 (python)

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

Buggy submission (verdict: Runtime Error):
alp = input()
if str.isupper(alp) == True:
  print("A")
else:
  pritn("a")
Problem p02711 (python)

Fixed submission:
number = str(input())
flag = False
for i in range(len(number)):
	if int(number[i])==7:
		flag = True
		break
if(flag):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
number = int(input())
flag = False
for i in range(len(number)):
	if int(number[i])==7:
		flag = True
		break
if(flag):
	print("Yes")
else:
	print("No")
Problem p02779 (python)

Fixed submission:
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

N = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = 0
for i in range(N-1):
	if arr[i]==arr[i+1]:
		ans = 1
		break

if ans:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

N = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = 0
for i in range(N-1):
	if arr[i]==arr[i+1]:
		ans = 1
        break

if ans:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

N = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = 0
for i in range(N-1):
	if arr[i]==arr[i+1]:
		ans = 1
        break

if ans:
	print("NO")
else:
	print("YES")

Buggy submission (verdict: Runtime Error):
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

N = int(input())
arr = list(map(int,input().split()))
arr.sort()
ans = 0
for i in range(N-1):
	if arr[i]==arr[i+1]:
		ans = 1
        break

if ans:
	print("No")
else:
	print("Yes")
Problem p02578 (python)

Fixed submission:
try:
    k = int(input())
    l = list(map(int,input().split(' ')))
    c = 0
    for i in range(len(l)-1):
      x = l[i+1]-l[i]
      if x<0:
        l[i+1]+=abs(x)
        c+=abs(x)
    print(c)
except:
    pass

Buggy submission (verdict: Runtime Error):
    k = input()
    l = list(map(int,input().split(' ')))
    c = 0
    for i in range(len(l)-1):
      x = l[i+1]-lis[i]
      if x<0:
        l[i+1]+=abs(x)
      	c+=abs(x)
    print(c)

Buggy submission (verdict: Runtime Error):
k = input()
l = list(map(int,input()))
c = 0
for i in range(len(l)-1):
  x = l[i+1]-lis[i]
  if x<0:
    l[i+1]+=abs(x)
  	c+=abs(x)
print(c)
Problem p02623 (python)

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

a, b = [0], [0]

# 加算したリスト
for i in range(n):
    a.append(a[i]+A[i])
for i in range(m):
    b.append(b[i]+B[i])
# print(a)
# print(b)

ans, j = 0, m

# 
for i in range(n+1):
    if a[i] > k:
        break

    # bのパイルから何冊読めない？
    while b[j] > k -a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)

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

print(a)
print(b)

read = 0
time_ = 0
ai = 0
bi = 0

max_read = 0

def readbook(time, read, ai, bi, isa):
    
    if isa:
        if ai < n:
            time += a[ai]
        else:
            return
    else:
        if bi < m:
            time += b[bi]
        else:
            return
    if time > k:
        return
    else:
        # readable
        read += 1
        global max_read
        if read > max_read:
            max_read = read

        readbook(time, read, ai + 1, bi, True)
        readbook(time, read, ai, bi + 1, False)


readbook(time_, read, ai, bi, True)
read = 0
time_ = 0
ai = 0
bi = 0
readbook(time_, read, ai, bi, False)

if max_read !=0:
    max_read += 1
print(max_read)
Problem p02629 (python)

Fixed submission:
import sys

alpha = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())

i = 0
idx = n
if n > 26:
    while n > 0:
        idx = n
        i += 1
        n = n - 26**i
        # print(i, n)

else:
    print(alpha[n-1])
    sys.exit()

# letter len : i, idx 

def getstr(i, idx):

    if i == 0:
        return ""
    elif i == 1:
        return alpha[idx-1]
    else:
        # number in the range
        t = 26**i

        # number  of bin
        b = int(26 * idx / t)

        bb = 0
        tmp = idx
        while tmp > 0:
            tmp -= int(t/26)
            bb += 1

        b = bb - 1
        idx -= b * int(t/26) 
        i -= 1
        
        return alpha[b] + getstr(i, idx)

print(getstr(i,idx))

Buggy submission (verdict: Runtime Error):
import sys

alpha = 'abcdefghijklmnopqrstuvwxyz'

n = int(input())

i = 0
idx = n
if n > 26:
    while n > 0:
        idx = n
        i += 1
        n = n - 26**i
        # print(i, n)

else:
    print(alpha[n-1])
    sys.exit()

# letter len : i, idx 

def getstr(i, idx):

    if i == 0:
        return ""
    elif i == 1:
        return alpha[idx-1]
    else:
        # number in the range
        t = 26**i

        # number  of bin
        b = int(26 * idx / t)
        idx -= b * int(t/26) 
        i -= 1

        return alpha[b] + getstr(i, idx)

print(getstr(i,idx))
Problem p02578 (python)

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = []
for b in an:
  if b != "" and b != " ":
    ani.append(int(b))
if len(ani) == 1:
  print("0")
else:
  print(f(0,0,ani,0))

Buggy submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(f(0,0,ani,0))

Buggy submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
print(f(0,0,ani,0))

Buggy submission (verdict: Runtime Error):
def f(i,ans,l):
  if (i+1) == (len(l)-1):
    return max(ans,l[i+1]-l[i])
  else:
    return f(i+1,max(ans,l[i+1]-l[i]),l)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
print(str(f(0,0,ani)))
Problem p02659 (python)

Fixed submission:
A, B = input().split()
A = int(A)
B = int(B.replace('.',''))

print(A*B // 100)

Buggy submission (verdict: Runtime Error):
A, B = map(float, input().split())
ans = A * B
print(int(ans)
Problem p02676 (python)

Fixed submission:
from sys import stdin

K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[:K],'...',sep='')

Buggy submission (verdict: Runtime Error):
from sys import stdin

K = int(inpu())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[:K],'...',sep='')
Problem p02688 (python)

Fixed submission:
from sys import stdin
import re
import bisect
import numpy as np

N, K = map(int, stdin.readline().rstrip().split())
frag = np.zeros((K,N), dtype=bool)
for i in range(K):
    _ = stdin.readline()
    line = map(int, stdin.readline().rstrip().split())
    for j in line:
        j -= 1
        frag[i][j] = True
        
count = int(0)
frag = frag.T
for i in range(N):
    if np.count_nonzero(frag[i] == 1) == 0:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
from sys import stdin
import re
import bisect
import numpy as np

n, k = map(int(), stdin.readline().rstrip().split())
data = np.zeros((n,k),dtype=bool)
for i in range(k):
    _ = stdin.readline()
    line = map(int(), stdin.readline().rstrip().split())
    for j in line:
        data[i][j] = True

count = int(0)
for i in range(n):
    if (data.T[n]).all() == True:
        count += 1
print(count)
Problem p02723 (python)

Fixed submission:
S = input()

if S[2] == S[3]:
  if S[4] == S[5]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()

if S[3] == S[4]:
  if S[5] == S[6]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
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):
	target = heapq.heappop(a)
	heapq.heappush(a, (-1)*(-target//2))
	
print(-sum(a))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import collections

N, M = map(int,input().split())
A = list(map(int,input().split()))
sort_A = sorted(A, reverse=True)
L = []
for i in range(N):
  L.append(len(bin(sort_A[i])))

count_discount = [0]*M
for i in range(M):
  index = L.index(max(L))
  L[index] = L[index] -1
  count_discount[index] += 1

sum = 0
for i in range(N):
  if count_discount[i] >= 1:
    q, mod = divmod(sort_A[i], (2*count_discount[i]))
    sum += q
  else:
    sum += sort_A[i]
print(sum)
Problem p02726 (python)

Fixed submission:
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
#print(N)
dlist = [0]*N
for k in range(1, N):
    for i in range(N-k):
        j = i + k
        usek = abs(X -i)+1+abs(j-Y)
        curk = min(k, usek)
        dlist[curk] += 1

for i in dlist[1:]:
    print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
N, X, Y = map(int, input().split())
G = np.zeros((N, N))
for i in range(N-1):
    G[i,i+1] = 1
    G[i+1,i] = 1
G[X-1, Y-1] = 1
G[Y-1, X-1] = 1
#print(G)
spG = shortest_path(csr_matrix(G))
for i in range(1,N):
    print(int(np.count_nonzero(spG==i)/2))
Problem p02781 (python)

Fixed submission:
from collections import defaultdict

N = input().strip()
K = int(input().strip())
lenN = len(N)

memo = defaultdict(lambda :defaultdict(lambda :defaultdict(int)))
def f(keta, flag, k):
    if keta == lenN-1:
        if k == K:
            return 1
        else:
            return 0
    if keta in memo and flag in memo[keta] and k in memo[keta][flag]:
        return memo[keta][flag][k]
    nketa = keta + 1
    maxi = int(N[nketa]) if flag else 9
    res = 0
    for i in range(maxi+1):
        nflag = flag and (int(N[nketa]) == i)
        nk = k if i == 0 else k + 1
        if nk > K:
            continue
        res += f(nketa, nflag, nk)
    memo[keta][flag][k] = res
    return res

print(f(-1, True, 0))

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

N = input().strip()
K = int(input().strip())
lenN = len(N)

dp = np.zeros((lenN+1, 2, 4))
dp[0][1][0] = 1
for keta in range(lenN):
    for flag in range(2):
        for k in range(K+1):
            for i in range(10):
                nk = k
                nflag = flag
                if flag:
                    if i > int(N[keta]):
                        continue
                    if i < int(N[keta]):
                        nflag = 0
                if i != 0:
                    nk = k + 1
                if nk > K:
                    continue
                dp[keta+1][nflag][nk]+=dp[keta][flag][k]

print(int(dp[lenN][0][K] + dp[lenN][1][K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)
Problem p02577 (python)

Fixed submission:
nstr=input()
keta=len(nstr)
wa=0
for i in range(keta):
    wa+=int(nstr[i])

ans="No"
if wa%9==0:
    ans="Yes"

print(ans)

Buggy submission (verdict: Runtime Error):
nstr=input()
keta=len(nstr)
wa=0
for i in range(keta):
    wa+=nstr[i]

ans="No"
if wa%9==0:
    ans="Yes"

print(ans)
Problem p02659 (python)

Fixed submission:
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)

Buggy submission (verdict: Runtime Error):
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
import decimal
[a,b]=list(input().split())
a10=decimal.Decimal(a)
b10=decimal.Decimal(b)
ans=int(a10*b10)
print(ans)


"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)

Buggy submission (verdict: Runtime Error):
"""
[a,b]=list(map(float,input().split()))
import math
a=int(a)
b=int(b*100)
ans=a*b
ans=ans/100
ans=math.floor(ans)
print(ans)
"""
import decimal
[a,b]=list(input().split()
a10=decimal.Decimal(a)
b10=decimal.Decimal(b)
ans=int(a10*b10)
print(ans)


"""
[a,b]=list(input().split())
a=int(a)
b12=list(b.split('.'))
bkai=int(int(b12[0])*100+int(b12[1]))
ans=a*bkai
ans=ans//100
print(ans)