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

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

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

n = int(input())
a = np.array(input().split(), dtype=np.int64)
b = np.array(input().split(), dtype=np.int64)
ac = np.bincount(a, minlength=n+2)
ab = np.bincount(b, minlength=n+2)
if np.max(ac+ab) <= n:
    num, count = np.unique(b, return_counts=True)
    ans = []
    for i in range(n):
        if a[i] == num[-1]:
            if len(num) == 1:
              print("No")
              sys.exit()
            ans.append(num[-2])
            if count[-2] == 1:
                num[-2] = num[-1]
                count[-2] = count[-1]
                num = num[:-1]
                count = count[:-1]
            else:
                count[-2] -= 1
        else:
            ans.append(num[-1])
            if count[-1] == 1:
                num = num[:-1]
                count = count[:-1]
            else:
                count[-1] -= 1
    print("Yes")
    print(*ans)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
x = int(input())
if x ==　1:
    ans = 0
else:
    ans = 1
print(ans)
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())
ans = "No" if d > t * s else "Yes"
print(ans)

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

readline = sys.stdin.readline
read = sys.stdin.read
MOD = 10**9 + 7

n = int(input())
a = np.array(readline().split(), dtype=np.uint64)
r = np.cumsum(a[::-1])[::-1]
r &= MOD
x = a[:-1] * r[1:]
x %= MOD
ans = int(np.sum(x) % MOD)
print(ans)
Problem p03774 (python)

Fixed submission:
import numpy as np
from scipy.spatial.distance import minkowski

n, m = map(int, input().split())
a = np.array([list(map(int, input().split())) for i in range(n)])
b = np.array([list(map(int, input().split())) for i in range(m)])

for i in range(n):
    c = np.array([minkowski(a[i], j , 1) for j in b], dtype=np.int64)
    ans = np.argmin(c) + 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.spatial.distance import minkowski

n, m = map(int, input().split())
a = np.array([list(map(int, input().split())) for i in range(n)])
for i in range(m):
    b = np.array(list(map(int,input())))
    c = np.array([minkowski(i, b , 1) for i in a], dtype=np.int64)
    ans = np.argmin(c) + 1
    print(ans)
Problem p02682 (python)

Fixed submission:
#ABC167B
a,b,c,k = map(int,input().split())
print(min(a,k)-max(k-a-b,0))

Buggy submission (verdict: Runtime Error):
#ABC167B
a,b,c,d,k = map(int,input().split())
print(min(a,k)-max(k-a-b,0))
Problem p02723 (python)

Fixed submission:
#ABC160A
s = input()
print("Yes" if s[2]==s[3] and s[4]==s[5] else "No")

Buggy submission (verdict: Runtime Error):
#ABC160A
s = input()
print("Yes" if s[3]==s[4] and s[5]==s[6] else "No")

Buggy submission (verdict: Runtime Error):
#ABC160A
s = input()
print("Yes" if s[3]==s[4] ans s[5]==s[6] else "No")
Problem p02753 (python)

Fixed submission:
#ABC158
s = input()
print("Yes" if len(set(s))==2 else "No")

Buggy submission (verdict: Runtime Error):
#ABC158
s = input()
print("Yes" if len(set(s))== else "No")
Problem p02835 (python)

Fixed submission:
#ABC147
a = list(map(int,input().split()))
print("bust" if sum(a)>=22 else "win")

Buggy submission (verdict: Runtime Error):
#ABC147
a = [map(int,input().split())]
print("bust" if sum(a)>=22 else "win")
Problem p02879 (python)

Fixed submission:
#ABC144A
a,b = map(int,input().split())
print(a*b if 1<=a<=9 and 1<=b<=9 else -1)

Buggy submission (verdict: Runtime Error):
#ABC144A
a,b = map(int,input().split())
print(a*b if 1<=a<=9 ans 1<=b<=9 else -1)
Problem p03631 (python)

Fixed submission:
a = input()
print("Yes" if a[0]==a[2] else "No")

Buggy submission (verdict: Runtime Error):
#ABC070A
n = input().split()
print("Yes" if (a[-1] == a[0]) else "No")
Problem p02629 (python)

Fixed submission:
n = int(input())
lst = list()
 
while True:
  a, b = divmod(n, 26)
  n = a
  lst.append(b)
  if a == 0:
    break
 
for i in range(len(lst) - 1):
  if lst[i] <= 0:
    lst[i] += 26
    lst[i + 1] -= 1
 
if lst[-1] == 0:
  lst.pop()
 
for i in range(len(lst)):
  lst[i] = chr(lst[i] + 96)
 
print("".join(lst[::-1]))

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

while True:
  a, b = divmod(n, 26)
  n = a
  lst.append(b)
  if a == 0:
    break

for i in range(len(lst)):
  if lst[i] <= 0:
    lst[i] += 26
    lst[i + 1] -= 1

if lst[-1] == 0:
  lst.pop()

for i in range(len(lst)):
  lst[i] = chr(lst[i] + 96)

print("".join(lst[::-1]))
Problem p02570 (python)

Fixed submission:
num = list(map(lambda x: int(x), input().split()))

if num[0]/num[2]<=num[1]: print('Yes')
else: print('No')

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

if num[0]/num[2]<=num[1]: print('Yes')
else: print('No')
Problem p02916 (python)

Fixed submission:
num = int(input())
order = input().split()
order = [int(i) for i in order]
manzoku = input().split()
additional = input().split()

prev = -1
ans = 0
for i in order:
  ans += int(manzoku[i-1])
  if i == prev+1:
    ans += int(additional[i-2])
  prev = i
  
print(ans)

Buggy submission (verdict: Runtime Error):
num = int(input())
order = input().split()
manzoku = input().split()
additional = input().split()

prev = 0
ans = 0
for i in range(num):
  ans += manzoku[i]
  if i = prev+1:
    ans += additional[i]
  prev += 1
  
print(ans)
Problem p02933 (python)

Fixed submission:
num = int(input())
col = input()

if num >= 3200:
  print(col)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
num = input().split()

if int(num[0]) >= 3200:
  print(num[1])
else:
  print("red")

Buggy submission (verdict: Runtime Error):
num = input().split()

print(num[1]) if int(num[0]) >= 3200 else print("red")
Problem p03042 (python)

Fixed submission:
order = input()
forw = int(order[:2])
back = int(order[2:])
flg_f = 0
flg_b = 0
 
if forw<=12 and forw != 0:
  flg_f = 1
if back<=12 and back != 0:
  flg_b = 1

if flg_f + flg_b == 2:
  print('AMBIGUOUS')
elif flg_f == 1:
  print('MMYY')
elif flg_b == 1:
  print('YYMM')
else:
  print('NA')

Buggy submission (verdict: Runtime Error):
order = input()
forw = int(order[:2])
back = int(order[2:])
flg_f = 0
flg_b = 0

if forw<=12 and forw != 0:
  flg_m = 1
if back<=12 and back != 0:
  flg_b = 1

if flg_m + flg_b == 2:
  print('AMBIGUOUS')
elif flg_m == 1:
  print('MMYY')
elif flg_b == 1:
  print('YYMM')
else:
  print('NA')
Problem p02912 (python)

Fixed submission:
import bisect
 
N,M = map(int,input().split())
Price_List = list(map(int,input().split()))
Price_List.sort()
for i in range(M):
    New_Price = Price_List.pop(-1)//2
    Price_List.insert(bisect.bisect(Price_List,New_Price),New_Price)
print(sum(Price_List))

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

N,M = map(int,input().split())
Price_List = list(map(lambda x:x*(-1),map(int,input().split())))
heapq.heapify(Price_List)
for i in range(M):
    heapq.heapify(Price_List)
    val = heapq.heappop(Price_List)* -1 // 2 * -1
    heapq.heappush(Price_List,val)
    print(Price_List)
print(-sum(Price_List))
Problem p03073 (python)

Fixed submission:
from collections import Counter
moji = str(input())
guall = len(moji)//2
kiall = guall + len(moji) % 2
gucount=dict(Counter(moji[1::2]))
kicount=dict(Counter(moji[0::2]))
if len(moji) == 1:
    ans = 0
elif max(gucount, key=gucount.get) != max(kicount, key=kicount.get):
    ans = guall - max(gucount.values()) + kiall - max(kicount.values())
else:
    if kiall - max(kicount.values()) > guall - max(gucount.values()):
        ans = max(kicount.values()) + guall - max(gucount.values())
    else:
        ans = max(gucount.values()) + kiall - max(kicount.values())
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
moji = str(input())
guall = len(moji)//2
kiall = guall + len(moji) % 2
gucount=dict(Counter(moji[1::2]))
kicount=dict(Counter(moji[0::2]))
if max(gucount, key=gucount.get) != max(kicount, key=kicount.get):
    ans = guall - max(gucount.values()) + kiall - max(kicount.values())
else:
    if kiall - max(kicount.values()) > guall - max(gucount.values()):
        ans = max(kicount.values()) + guall - max(gucount.values())
    else:
        ans = max(gucount.values()) + kiall - max(kicount.values())
print(ans)
Problem p03208 (python)

Fixed submission:
#AtCorder Begginer Contest 161 Christmas Eve
import numpy as np
N,K= map(int, input().split())
Tree_List= [int(input()) for i in range(N)]
Tree_List=np.array(sorted(Tree_List))
Answer=min(Tree_List[K-1:]-Tree_List[:-(K-1)])
print(Answer)

Buggy submission (verdict: Runtime Error):
#AtCorder Begginer Contest 161 Christmas Eve
N,K= map(int, input().split())
Tree_List= [int(input()) for i in range(N)]
Tree_List=np.array(sorted(Tree_List))
Answer=min(Tree_List[K-1:]-Tree_List[:-(K-1)])
print(Answer)

Buggy submission (verdict: Runtime Error):
#AtCorder Begginer Contest 161 Christmas Eve
N,K= map(int, input().split())
Tree_List= [int(input()) for i in range(N)]
Tree_List=np.array(sorted(Tree_List))
min(Tree_List[K-1:]-Tree_List[:-(K-1)])
Problem p03327 (python)

Fixed submission:
moji = int(input())
print(("ABC","ABD")[moji >=1000])

Buggy submission (verdict: Runtime Error):
moji = map(int,input().split())
print(("ABC","ABD")[moji >=1000])

Buggy submission (verdict: Runtime Error):
A,B = map(str,input().split())
print(B+A)
Problem p02712 (python)

Fixed submission:
n = int(input())

ans = 0

for i in range(1,n+1):
    if (i % 3 != 0) and (i % 5 != 0):
        ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(n):
    if i % 3 != 0 and i % 5 != 0:
        ans += i
print(ans)
Problem p02897 (python)

Fixed submission:

N = int(input())

if N%2 ==0:
    ans=0.5
else :
    ans=(N//2 + 1)/N
    
print(ans)

Buggy submission (verdict: Runtime Error):

A,B =[int(x) for x in input().split()]

def bunkai(n):
    sosu= {1}
    tmp = n
    stop_flag = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.add(2)
    
    for i in range(3,n+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)
            stop_flag = tmp 
            
        if i > stop_flag:
            break
#        else:
#            stop_flag = int(stop_flag/i) 
            
    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[1]:
        sosu.add(n)
    
    return sosu

def check_sosu(n,x):
    ans=0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)
Problem p03332 (python)

Fixed submission:
# https://beta.atcoder.jp/contests/agc025/tasks/agc025_b
from functools import reduce
import operator as op

MOD = 998244353
mod_inv = [0, 1]


def init_mod_inv(n):
    for i in range(2, n + 1):
        ans = MOD - (MOD // i) * mod_inv[MOD % i] % MOD
        mod_inv.append(ans)


def main():
    n, a, b, k = map(int, input().split())

    init_mod_inv(n)
    nCr = [0] * (n + 1)
    nCr[0] = 1
    for i in range(1, n+1):
        nCr[i] = (nCr[i - 1] * (n - i + 1) * mod_inv[i]) % MOD

    ways = 0
    for x in range(0, n + 1):
        yb = k - a * x
        if yb >= 0 and yb % b == 0 and yb // b <= n:
            ways += nCr[x] * nCr[yb // b]
            ways %= MOD
    print(ways)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# https://beta.atcoder.jp/contests/agc025/tasks/agc025_b
from functools import reduce
import operator as op

MOD = 998244353
mod_inv = [0, 1]


def init_mod_inv(n):
    for i in range(2, n + 1):
        ans = MOD - (MOD // i) * mod_inv[MOD % i] % MOD
        mod_inv.append(ans)
    return ans


def main():
    n, a, b, k = map(int, input().split())

    init_mod_inv(n)
    nCr = [0] * (n + 1)
    nCr[0] = 1
    for i in range(1, n):
        nCr[i] = nCr[i - 1] * (n - i + 1) * mod_inv[i] % MOD

    ways = 0
    for x in range(0, n + 1):
        yb = k - a * x
        if yb >= 0 and yb % b == 0 and yb // b <= n:
            ways += nCr[x] * nCr[yb // b]
            ways %= MOD
    print(ways)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# https://beta.atcoder.jp/contests/agc025/tasks/agc025_b
from functools import reduce
import operator as op

MOD = 998244353
mod_inv = [0, 1]


def init_mod_inv(n):
    for i in range(2,n+1):
        ans = MOD - (MOD // i) * mod_inv[MOD % i] % MOD
        mod_inv.append(ans)
    return ans


def nCr(n, r):
    r = min(r, n - r)
    ans = 1
    for i in range(n, n - r, -1):
        ans = (ans * i) % MOD
    for i in range(1, r + 1):
        ans = (mod_inv[i] * ans) % MOD
    return ans

def main():
    n, a, b, k = map(int, input().split())

    ways = 0
    init_mod_inv(n)
    for x in range(0, n + 1):
        yb = k - a*x
        if yb >= 0 and yb % b == 0 and yb//b<=n:
            ways += nCr(n, x)*nCr(n, yb//b)
            ways %= MOD
    print(ways)

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

Fixed submission:
n=int(input())
s=[input() for i in range(n)]
s.sort()
b=list(set(s))
b.sort()
a=s[0]
m=[0]
for i in range(n):
  if s[i]!=a:
    m.append(i)
    a=s[i]
m.append(n)
o=[]
for i in range(len(m)-1):
  o.append(m[i+1]-m[i])
num=max(o)
for i in range(len(o)):
  if o[i]==num:
    print(b[i])

Buggy submission (verdict: Runtime Error):
from statistics import mode

N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
print(mode(S))
Problem p02860 (python)

Fixed submission:
n=int(input())
s=input()
if n%2==1:
  print("No")
else:
  for i in range(n//2):
    if s[i]!=s[i+(n//2)]:
      print("No")
      break
  else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
if N%2==1:
  print("No")
else:
  flag=0
  for i in range(len(S)):
    if S[i]!=S[i+(len(S)/2)]:
      flag=1
      break
  if flag==0:
    print("Yes")
  else::
    print("No")
Problem p02951 (python)

Fixed submission:
A,B,C=map(int,input().split())
if B+C>A:
	print(B+C-A)
else:
	print("0")

Buggy submission (verdict: Runtime Error):
N=int(input())
if 1<=N and N<10:
	print(N)
elif 10<=N and N<100:
	print("9")
elif 100<=N and N<1000:
	print(9+N-99)
elif 1000<=N and N<10000:
	print("909")
elif 10000<=N and N<100000:
	print(909+N-999)
else:
	print("90909")
Problem p03345 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
if abs(a-b)>10**18:
    print("unfair")
else:
    if k%2==0:
        print(a-b)
    else:
        print(b-a)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
if abs(a-b)>10**18:
  print("unfair)
else:
  if k%2==0:
    print(a-b)
  else:
    print(b-a)
Problem p02793 (python)

Fixed submission:
def gcd(a,b):
    while b:a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

N = int(input())
A = tuple(map(int,input().split(" ")))
ans = 0
mod = 10**9+7
l = 1
for i in range(N):
    l = lcm(l,A[i])
l %= mod

for i in A:
    ans += l*pow(i,mod-2,mod)
    ans %= mod

print(ans)

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while b:a,b=a,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)

N = int(input())
A = tuple(map(int,input().split(" ")))
ans = 0
mod = 10**9+7
l = 1
for i in range(N):
    l = lcm(l,A[i])
l %= mod

for i in A:
    ans += l//A[i]
    ans %= mod

print(ans)
Problem p02831 (python)

Fixed submission:
#LCMを求めれば良い
a, b = map(int, input().split())
s, t = max(a, b), min(a, b)
c = s%t
while (c != 0):
    s = t
    t = c
    c = s%t

ans = a * b//t
print(ans)

Buggy submission (verdict: Runtime Error):
#LCMを求めれば良い
a, b = map(int, input().split())

import math

c = math.gcd(a, b)
ans = a * b//c
print(ans)
Problem p02879 (python)

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

if (a >= 10) or (b >= 10):
  print(-1)
else:
  print(a*b)

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

if x > a*a*b/2:
    theta = math.atan(2*(a*a*b-x)/a/a/a)
else:
    theta = math.atan(a*a*b/2/x)

print(math.degrees(theta))
Problem p03253 (python)

Fixed submission:
mod = 10**9+7
def prime(n,p):
    iteral = 0
    while n%p == 0:
        n //= p
        iteral += 1
    return iteral,n
def modpow(a,n):#二乗
    if n==0:
        return 1
    elif n==1:
        return a%mod
    elif n%2==0:
        return (modpow(a,n/2)**2)%mod
    else:
        return (a*modpow(a,n-1))%mod
def modfact(l,r):#階乗
    fact=1
    for i in range(l-r+1):
        fact=fact*(r+i)%mod
    return fact
def comb(n,x):#組み合わせ
    S=modfact(n,n-x+1)
    fact=modfact(x,1)
    T=modpow(fact,mod-2)
    return S*T%mod
def main():
    N,M = map(int,input().split())
    b = {}
    for i in range(2,int(M**0.5)+10):
        if M%i==0:
            num,M = prime(M,i)
            b[i] = num
    if M > 1:
        b[M] = 1
    ans = 1
    for num in b:
        ans *= comb(b[num]+N-1,b[num])
        ans %= mod
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
mod = 10**9+7
def sieve(N):#エラトステネスの篩
    prime = [0]*(N+1)
    isprime = [True]*(N+1)
    isprime[0]=isprime[1] = False
    num = 0
    for p in range(2,N+1):
        if isprime[p]:
            prime[num] = p
            num += 1
            for j in range(2*p,N+1,p):
                isprime[j] = False
    prime.sort()
    prime.reverse()
    for k in range(N-1):
        if prime[k+1] == 0:
            end = k
            break
    return prime[:end+1]

def comb(n,k):
    n1, k = n+1, min(k, n-k)
    numer = denom = 1
    for i in range(1,k+1):
        numer = numer*(n1-i)
        denom = denom*i
    return numer//denom

def solve():
    N,M = map(int,input().split())
    if M == 1:
        print(1)
    prime = sieve(M)
    prime.sort()
    b = {}
    for i in prime:
        if M%i == 0:
            cnt = 0
            while M%i == 0:
                cnt += 1
                M //= i
            b[i] = cnt
    ans = 1
    for num in b:
        ans *= comb(b[num]+N-1,b[num])
        ans %= mod
    print(ans)

if __name__=="__main__":
    solve()
Problem p02793 (python)

Fixed submission:
import fractions

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

def main():
    N = int(input())
    A = list(map(int, input().split()))
    prev_lc = 1
    ans = 0
    for i in A:
        lc = lcm(prev_lc, i)
        ans = ans * (lc // prev_lc) + lc // i
        prev_lc = lc
    print(ans % 1000000007)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007

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

N = int(input())
A = [int(x) for x in input().split()]
lc = 1
for i in A:
    lc = lcm(lc, i)
ans = 0
for i in A:
    ans = (ans + lc // i) % MOD
print(ans)
Problem p03137 (python)

Fixed submission:
import sys
import numpy as np

N, M = map( int, input().split() )
X_list = np.array( sorted( list( map( int, input().split() ) ) ) )

diff=np.diff(X_list, n=1)

if N>=M:
	print(0)
	sys.exit()

sorted_diff=np.sort(diff)

cnt=np.sum(sorted_diff[:M-N])

print(cnt)

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

N, M = map( int, input().split() )
X_list = np.array( sorted( list( map( int, input().split() ) ) ) )

diff=np.diff(X_list, n=1)

if N>=M:
	print(0)
	sys.exit()

for i in range(N-1):
	tmp_max=np.amax(diff)
	diff=diff[~(diff==tmp_max)]

cnt=np.sum(diff)

print(cnt)
Problem p02623 (python)

Fixed submission:
N,M,K = map(int,input().split())
A = [0]*N
B = [0]*M
A = list(map(int,input().split()))
B = list(map(int,input().split()))

b = []
b.append(0)
tmp = 0
for i in range(M):
    b.append(tmp+B[i])
    tmp = tmp+B[i]# M冊全部呼んだとする
a = [0]
for i in range(N):
    a.append(a[i]+A[i])
#print(b)
ans,j = 0,M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j] > K - a[i]:#Kを超えてたらこの冊数読むの諦める
        j -= 1
    ans = max(ans,i+j)#最大冊数を更新していく

print(ans)

Buggy submission (verdict: Runtime Error):
import copy
N,M,K = map(int,input().split())
A = [0]*N
B = [0]*M
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = 0
b = 0

tmp = 0
ans = 0
# for i in range(200000):
#     if A[a] < B[b]:
#         if tmp <= K:
#             tmp += A[a]
#             ans += 1
#             a += 1
#     elif A[a] > B[b]:
#         if tmp <= K:
#             tmp += B[b]
#             ans += 1
#             b += 1
#     if a > len(A)-1 or b > len(B)-1:
#         break
fa = False
fb = False

while len(A) > 0 or len(B) > 0:
    AA = copy.copy(A)
    BB = copy.copy(B)
    if len(AA) != 0:
        a = AA.pop(0)
        fa = True
    if len(BB) != 0:
        b = BB.pop(0)
        fb = True
    if fa and fb:
        if a<=b:
            tmp += a
            ans += 1
            A = AA
        else:
            tmp += b
            ans += 1
            B = BB
    else:
        if fa:
            tmp += a
            ans += 1
            A = AA
        if fb:
            tmp += b
            ans += 1
            B = BB

    if tmp > K:
        break
    fa = False
    fb = False
    
    print(tmp,A,B)
    
if len(A)==0 and len(B)==0:
    print(ans)
else:
    print(ans-1)
Problem p02659 (python)

Fixed submission:
s = input().split()

A = int(s[0])
B = int(s[1].replace(".", ""))
m = A*B

if m>=100:
  result = int(str(m)[:-2])
else:
  result = 0
  
print(result)

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

A = int(s[0])
B = float(s[1])

seisu = math.floor(B)
daiiti = math.floor(B*10)/10 - seisu
daini = B - seisu - daiiti

big = A*seisu
small = A*(int(daiiti*10))
if small >= 10:
  small = int(str(small)[:-1])
else:
  small = 0
too_small = A*(int(daini*100))
if too_small >= 100:
  too_small = int(str(small)[:-2])
else:
  too_small = 0

print(big+small+too_small)

Buggy submission (verdict: Runtime Error):
import math

s = input().split()

A = int(s[0])
B = int(float(s[1])*100)

result = A*B
result = int(str(result)[:-2])
print(result)
Problem p02549 (python)

Fixed submission:
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit,i8


@njit(i8(i8,i8,i8,i8[:,:],i8[:],i8,i8))
def give_dp(N,K,mod,LR,dp,l,r):
    for i in range(N):
        if i > 0:
            dp[i] += dp[i-1]
            dp[i] %= mod
        for k in range(K):
            l = LR[k][0]
            r = LR[k][1]
            if i + l < N:
                dp[i+l] += dp[i]
                dp[i+1] %= mod
            if i + r < N:
                dp[i+r+1] -= dp[i]
                dp[i+1] %= mod
    return dp[-1]


def main():
    N,K = map(int,input().split())
    LR = [list(map(int,input().split())) for i in range(K)]
    LR = np.array(LR)

    mod = 998244353

    dp = [0 for i in range(N)]
    dp[0] = 1
    dp[1] = -1
    dp = np.array(dp)

    res = give_dp(N,K,mod,LR,dp,0,0)
    res %= mod

    print(res)



main()

Buggy submission (verdict: Runtime Error):
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
# from numba import njit,i8


# @njit(i8(i8,i8,i8,i8[:,:],i8[:],i8,i8))
def give_dp(N,K,mod,LR,dp,l,r):
    for i in range(N):
        if i > 0:
            dp[i] += dp[i-1]
            dp[i] %= mod
        for k in range(K):
            l = LR[k][0]
            r = LR[k][1]
            if i + l < N:
                dp[i+l] += dp[i]
                dp[i+1] %= mod
            if i + r < N:
                dp[i+r+1] -= dp[i]
                dp[i+1] %= mod
    return dp[-1]


def main():
    N,K = map(int,input().split())
    LR = [list(map(int,input().split())) for i in range(K)]
    # LR = np.array(LR)

    mod = 998244353

    dp = [0 for i in range(N)]
    dp[0] = 1
    dp[1] = -1
    # dp = np.array(dp)

    res = give_dp(N,K,mod,LR,dp,0,0)
    res %= mod

    print(res)



main()