Problem:


Score : 100 points

Problem Statement

Serval is fighting with a monster.

The health of the monster is H.

In one attack, Serval can decrease the monster's health by A.
There is no other way to decrease the monster's health.

Serval wins when the monster's health becomes 0 or below.

Find the number of attacks Serval needs to make before winning.

Constraints

1 \leq H \leq 10^4

1 \leq A \leq 10^4

All values in input are integers.

Input

Input is given from Standard Input in the following format:

H A

Output

Print the number of attacks Serval needs to make before winning.

Sample Input 1

10 4

Sample Output 1

3

After one attack, the monster's health will be 6.

After two attacks, the monster's health will be 2.

After three attacks, the monster's health will be -2.

Thus, Serval needs to make three attacks to win.

Sample Input 2

1 10000

Sample Output 2

1

Sample Input 3

10000 1

Sample Output 3

10000



Sample input:
10 4


Sample output:
3

Submission status: Runtime Error

Solution code:
def main():  
  import sys
  input = sys.stdin.readline
  n, d, a = [int(i) for i in input().split()]
  chk = []
  for i in range(n):
    x, h = [int(i) for i in input().split()]
    chk.append((x, 0, h))

  from heapq import heapify, heappop, heappush
  heapify(chk)
  atk_cnt = 0; ans = 0
  while chk:
    x, t, h = heappop(chk)
    if t == 0:
      if atk_cnt * a >= h:
          continue
      remain = h - atk_cnt * a
      new_atk = (remain - 1) // a + 1
      heappush(chk, (x + 2 * d, 1, new_atk))
      ans += new_atk
      atk_cnt += new_atk
    else:
      atk_cnt -= h
  print(ans)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
h, a = input().split;
h = int(h);
a = int(a);

if h % a == 0:
  ans = int(h // a);
else:
  ans = int(h // a + 1);
  
print(ans);

Submission status: Runtime Error

Solution code:
import math
a,b=map(int,input().split())
print(mayh.ceil(a/b))

Submission status: Runtime Error

Solution code:
# ceil関数(2引数)
def ceilT(a,b): #ceil(a/b)
    return (a+b-1)//b
H,A=map(int,input().split())
print(ceil(H,A))

Submission status: Runtime Error

Solution code:

import math
H = int(input())


def iterated_power(z: int, n: int, mod=None) -> int:
    beta = bin(n)[2:]

    Z, q, t = z, 0, len(beta)
    while beta[t - q - 1] == '0':
        Z = Z * Z
        if mod is not None:
            Z = Z % mod
        q += 1
    result = Z

    for k in range(q + 1, t):
        Z = Z * Z
        if mod is not None:
            Z = Z % mod
        if beta[t - k - 1] == '1':
            result = result * Z
            if mod is not None:
                result = result % mod

    if mod is not None:
        result = result % mod

    return result

cnt = 0
while True:
    H = math.floor(H/2)
    cnt += 1
    if H ==1:
        break
cnt += 1

ans = iterated_power(2, cnt) - 1

print(ans)

Submission status: Runtime Error

Solution code:
a,b=input()
c = a % b
a /= b
if c != 0:
    print (a+1)
else:
    print (a)

Submission status: Runtime Error

Solution code:
h,a = map(int,input().split())

ans=h//a
if(h%a!=0):
    ans++
print(ans)

Submission status: Runtime Error

Solution code:
h, n = map(int, input().split())
l = list(map(int, input().split()))
if h > sum(l):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
 
int main() {
  int H, A;
  cin >> H >> A;
  cout << (H + A -1) / A << endl;
}

Submission status: Runtime Error

Solution code:
H, N = input().split()
H = int(H)
#print(H)
#H, N = input().split()
lis = list(map(int,input().split()))
A =sum(lis)
if H > A:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())
ans = H // A + (H % A)/(H % A) * 1
print(round(ans))

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())

ans = H // A + (H % A)/(H % A) * 1

print(ans)

Submission status: Runtime Error

Solution code:
H, A=map(int, input().split())

if A>=H:
	print(1)
else:
  print((N//M)+1)

Submission status: Runtime Error

Solution code:
H,A = map(int, input().split())
print(math.ceil(H/A))

Submission status: Runtime Error

Solution code:
h,a = map(int,input().split())
for n in range(0,):
  if h - a*n <= 0
  exit()
print(n)

Submission status: Runtime Error

Solution code:
def main():
    hp, num = map(int, input().split())
    a = list(map(int, input().split()))
    attack = sum(a)

    if hp > attack:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
H,A = map(int,input().split())
answer = H // A
if answer == 0
	answer += 1
print(answer)

Submission status: Runtime Error

Solution code:
H, N = map(int, input().split())
magic = list()
for _ in range(N):
    magic.append(list(map(int, input().split())))
 
magic_min = [0 for _ in range(H+1)]
for i in range(H+1):
    if i != 0 and magic_min[i] == 0:
        continue
    for A, B in magic:
        Index = i + A
        value = magic_min[i] + B
        try:
            if magic_min[Index] == 0:
                magic_min[Index] = value
            elif value < magic_min[Index]:
                magic_min[Index] = value
        
        except:
            if magic_min[-1] == 0:
                magic_min[-1] = value
            elif value < magic_min[-1]:
                magic_min[-1] = value
                
print(magic_min[-1])

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
// #include <bits/stdc++.h> all

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){

  int h,a; cin >> h >> a;
  cout << (h + a - 1)/a << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
H,A=map(int,input().split())
count=1
if H%N==0:
  for i in range(H):
    if 0<H:
      H-A
      count+=1
      H-=A
  print(count)
else:
  for i in range(H):
    if 0<H:
      H-A
      count+=1
      H-=A
  print(count+1)

Submission status: Runtime Error

Solution code:
x = [int(x) for x in input().split()]

import math

print(math.ceil(x[0]/x[1])

Submission status: Runtime Error

Solution code:
import math
import time

t = time.time()
def iip():
    return [int(i) for i in input().split()]

H, N = iip()
mp_for_damage = [10**9 for i in range(H+1)]
mp_for_damage[0] = 0

for i in range(N):
    a, b = iip()
    for j in range(H+1):
        for k in range(1, a):
            if k > H:
                break
            mp_for_damage[k] = min(mp_for_damage[k], b)

        if j + a > H:
            break
        mp_for_damage[j+a] = min(mp_for_damage[j+a], mp_for_damage[j] + b)

#print(mp_for_damage)
print(mp_for_damage[H])

#print(time.time() - t)

Submission status: Runtime Error

Solution code:
H,A=map(int,input().split())
if H%A==0:
    print(H//A)
else:
    print((H/A,0)+1)

Submission status: Runtime Error

Solution code:
h,a=map(int,input().split())
print(h//a if h%a+==0 else (h//a)+1)

Submission status: Runtime Error

Solution code:
import math

h, n = map(int,input().split())
a = list(map(int,input().split()))
sum = 0
for i in range(n):
    sum += a[i]

if sum >= h:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
h, n = map(int,input().split())
a = list(map(int,input().split()))
sum = 0
for i in range(n):
    sum += a[i]

if sum >= h:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
# 1-index
from sys import stdin
H, N = [int(x) for x in stdin.readline().rstrip().split()]

data = [0]*N

for i in range(N):
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    data[i] = (A, B)
dp = [10**9]*(H+1)
dp[0] = 0

for h in range(0,H+1):
    for a,b in data:
        if h+a >= H:
            dp[H] = min(dp[h]+b,dp[H])
        else:
            dp[h+a] = min(dp[h]+b,dp[h+a])
print(dp[H])

Submission status: Runtime Error

Solution code:
h,a = map(int,input().split())
print(h\\a)

Submission status: Runtime Error

Solution code:
h,n=map(int,input().split())
INF=10**12
a=[]
b=[]
for i in range(n):
    A,B=map(int,input().split())
    a.append(A)
    b.append(B)
dp=[INF]*20010
dp[0]=0
for i in range(20010):
    for j in range(n):
        if i>=a[j]:
            dp[i]=min(dp[i],dp[i-a[j]]+b[j])
ans=min(dp[h:])
print(ans)

Submission status: Runtime Error

Solution code:
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

# n = int(input())
h, n = map(int, input().split())
# a = list(map(int, input().split()))
a, b = [0] * n, [0] * n

for i in range(n):
    a[i], b[i] = map(int,input().split())

dp = [float('inf')] * (h+1)
dp[0] = 0

for i in range(n):

    for j in range(h):

        dp[min(j+a[i], h)] = min(dp[min(j+a[i],h)], dp[j]+b[i])


print(dp[h])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# RemainingBalls
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    print(a-1, b)
elif t == u:
    print(a, b-1)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
arr=list(map(int,input().split()))
total=0
if k>=n:
  print(0)
else:
  for i in range(n-k):
    total+=(min(arr))
  print(total)

Submission status: Runtime Error

Solution code:
h,n=map(int,input().split())
arr=list(map(int,input().split()))
if h<=sum(arr):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
h, n = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a)
if h <= s:
	print('YES')
else:
	print('NO')

Submission status: Runtime Error

Solution code:
h,a = map(int,input().split())
if h%a == 0:
    print(h//a)
else:
print((h//a)+1)

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())

x = 0
while True:
H = H - A
  if H < 0:
    break
  else:
    x += 1
print(x)

Submission status: Runtime Error

Solution code:
H, A = int(input().split())

x = 1
while True:
  if 0 =< H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Submission status: Runtime Error

Solution code:
H, A = int(input().split())

x = 1
while True:
  if 0 <= H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Submission status: Runtime Error

Solution code:
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

x = 1
while True:
  if 0 <= H/(A*x):
    H -= A
    a += 1
  else:
    break
print(x)

Submission status: Runtime Error

Solution code:
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

a = 0
while True:
  if x <= H/A:
    H - A
    a += 1
  else:
    break
print(a)

Submission status: Runtime Error

Solution code:
from sys import stdin
H, A = map(int,stdin.readline().rstrip().split)

a = 0
while True
  if x <= H/A:
    H - A
    a += 1
  else:
    break
print(a)

Submission status: Runtime Error

Solution code:
h,n = map(int,input().split())
list1 = list(map(int,input().split()))

if h-sum(list1)<=0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:

def main():
    
    h,a = map(int, input().split())

    if h%a== 0:
        print(h//a)
    else:
        prinbt(h%a+1)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
h, a = map(int, input().split())
  print((h+a-1)//a)

Submission status: Runtime Error

Solution code:
h, a = map(int, input().split())
  print(h//a + h%a != 0)

Submission status: Runtime Error

Solution code:
while True:
    h,a = map(int, input().split())
    x = h // a
    y = h / a
    if x == y:
        print(x)
    else:
        print(x + 1)

Submission status: Runtime Error

Solution code:
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp,reverse=True)

if K < N:
    for i in range(K):
        list_hp.pop(0)
    print(sum(list_hp))
    
else:
    print(0)

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())

H = [int(x) for x in list(input().split())]

H.sort()

sum = 0

for i in range(N-K):
    sum = sum+int(H[i])
    
print(sum)

Submission status: Runtime Error

Solution code:
H,A=int(input().split())
count=0

while H>=0:
  H-=A
  count+=1

print(A)

Submission status: Runtime Error

Solution code:
import math
H, A map(int, input().split())

print(math.ceil(H / A))

Submission status: Runtime Error

Solution code:
h, a = map(int, input().split())

if h%a == 0:
  input(h/a)
else:
  input(h/a+1)

Submission status: Runtime Error

Solution code:
h,a=map(int,inout().split())
print((h-1)//a+1)

Submission status: Runtime Error

Solution code:
h, a = map(int, input().split())
print(h // a + boll(h % a))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

A = list(map(int, input().split()))
#print(h)

A.sort(reverse=True)
#print(hs)

print(sum(A[k:]))

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())
if N % A == 0:
    print(H // A)
else:
    print(H // A + 1)

Submission status: Runtime Error

Solution code:
import sys

def dp_all(dp):
  length = len(dp)
  for i in range(length):
    print(dp[i])

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

a = []
b = []

for i in range(N):
  a_dash,b_dash = map(int,input().split())
  a.append(a_dash)
  b.append(b_dash)

#dp[i+1][j] = i番目までの魔法で体力jのモンスターに
#勝つことができる、魔力の最小値
INF = 10**9
dp = [[INF for _ in range(H+1)] for _ in range(N+1)]

for i in range(N+1):
  dp[i][0] = 0

for i in range(N):
  for j in range(H+1):
    if a[i] > j:
      dp[i+1][j] = min(dp[i][j],b[i])
    else:
      dp[i+1][j] = min(dp[i][j],dp[i+1][j-a[i]]+ b[i])

print(dp[N][H])

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

h = input().split()
#print(h)

hs = sorted(h)
#print(hs)

#必殺技によって倒したあとのモンスターの数
if n >= k: 
  num_mon = n - k 
else:
  num_mon = 0
#print(num_mon)

#攻撃するモンスターの体力のリスト
mon_att = hs[0:num_mon]
#print(mon_att)

#攻撃する回数の最小値
min_att = sum(map(int, mon_att))
print(min_att)

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
C=list(input().split())
count= 0
for i in range (B):
	count=count+int(C[i])
if count>=A:
	print("Yes")
else: print("No")

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
C=list(input())
count= 0
for i in range (B):
	count=count+int(C[i])
if count>=A:
	print("Yes")
else: print("No")

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
C=list(input())
count= 0
for i in range (B):
	count=count+int(C[i])
if count<=A:
	print("Yes")
else: print("No")

Submission status: Runtime Error

Solution code:
import math
n, m = int(input().split())
print(math.ceil(n/m))

Submission status: Runtime Error

Solution code:
import math
n, m = input().split()
print(math.ceil(n/m))

Submission status: Runtime Error

Solution code:
#E re
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
DP = [0] * H

for i in range(H):
    minM = float('inf')
    for j in range(N):
        if i+1 - A[j] >= 0:
            M = DP[i-A[j]] + B[j]
        else:
            M = B[j]
        if minM > M:
            minM = M
    DP[i] = minM

print(int(DP[H-1]))

Submission status: Runtime Error

Solution code:
hp, n = map(int, input().split())
#print("{} {}".format(hp, n))

a = list(map(int, input().split()))
#print(a)

print("yes") if sum(a) >= hp else print("no")

Submission status: Runtime Error

Solution code:
a,b=map(int,input(),split())
print(-(-a/b))

Submission status: Runtime Error

Solution code:
h,a = map(int, input().split)
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)

Submission status: Runtime Error

Solution code:
h,a = int(input())
ans = 0
if h % a == 0:
  ans = h // a
else:
  ans = h // a + 1
print(ans)

Submission status: Runtime Error

Solution code:
if H / A > 0:
  print(int(H / A) + 1)
else:
  print(int(H / A))

Submission status: Runtime Error

Solution code:
if H % A > 0:
  print(int(H / A + 1))
else:
  print(int(H / A))

Submission status: Runtime Error

Solution code:
if H / A > 0:
  print(int(H / A + 1))
else:
  print(int(H / A))

Submission status: Runtime Error

Solution code:
H,A=map(int,input().spkit())
if H%A==0:
    print(H//A)
else:
    print((H//A)+1)

Submission status: Runtime Error

Solution code:
h,a = map(int,input().cplit())
print(h//a+1)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main() 
{
    int h, a;
    cin >> h >> a;
    if (h%a!=0)
        h = h + (a-h%a);
    cout << h/a;
    return 0;
}

Submission status: Runtime Error

Solution code:
h, n = map(int, input().split())
a = map(int, input().split())
ans = "Yes" if sum(a) >= h else "No" 
print(ans)

Submission status: Runtime Error

Solution code:
H,A=,map(int,input().split())
 
n=(H//A)+1

if H%A==0:
  n=H//A
else:
  n=(H//A)+1
print(n)

Submission status: Runtime Error

Solution code:
H,A=,map(int,input().split())

n=(H//A)+1
print(n)

Submission status: Runtime Error

Solution code:
a,b =map(int,input().split())
if a%B==0:
  print(a/b)
else:
  print(1+(a//b))

Submission status: Runtime Error

Solution code:
a,b =map(int,input().split())
if a%B==0:
  print(a/b)
else:
  print(1+a//b)

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())
H, A = int(H. A)
def a(H,A):
  if H/B <= 0:
    print(H//A+1)
  else:
    print(H/A)
    return

a(H,B)

Submission status: Runtime Error

Solution code:
from math import ceil
a,b = map(int,input().split())

print(ceil(a,b))

Submission status: Runtime Error

Solution code:
struct Pair {
  Pair(int _a, int _b, long _f) : a(_a), b(_b), f(_f) {}
  long f;
  int a, b;
};

int main() {
  int n, m, q;
  cin >> n >> m >> q;

  vector<Pair> pairs;
  pairs.reserve(m);
  for (int i = 0; i < m; i++) {
    int a, b;
    long f;
    cin >> a >> b >> f;
    int a1 = a > b ? b : a;
    int b1 = a > b ? a : b;
    pairs.push_back(Pair(a1, b1, f));
  }
  sort(pairs.begin(), pairs.end(), [](const Pair &a, const Pair &b) -> bool { return a.f > b.f; });

  bool in_grp[n];
  for (int i = 0; i < n; i++) { in_grp[i] = false; }

  for (int p = 0; p < q; p++) {
    char op;
    int id;
    cin >> op >> id;
    id--;

    if (op == '+') {
      in_grp[id] = true;
      for (int i = 0; i < m; i++) { cout << "  " << pairs[i].f << endl; }
    } else {
      in_grp[id] = false;
    }
  }

  return 0;
}

Submission status: Runtime Error

Solution code:
A,B map(int,input().split())
print(int(A/B))

Submission status: Runtime Error

Solution code:
h,a = map(int,input().split())
b = h/a
if b%1 = 0:
    print(b)
elif b%1 < 0:
    print(1)
else:
    print(b//1)

Submission status: Runtime Error

Solution code:
h = int(input())
a = int(input())
ans = 0
ans = h // a
ans += 1
print(ans)

Submission status: Runtime Error

Solution code:
h,a=map(int,input().split(" "))

if h%a==0:
  print(h/a)
else:
  primt((h//a)+1)

Submission status: Runtime Error

Solution code:
h,a=map(int,input().split(" "))

if h%a==0:
  print(h/a)
else:
  primt(h//a+1)

Submission status: Runtime Error

Solution code:
H, N= map(int,input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
ma = max(A)
dp = [float("inf")] * (H + ma)
dp[0] = 0
for i in range(N):
    a = A[i]
    b = B[i]
    for j in range(1, H + ma):
        dp[j] = min(dp[j - a] + b, dp[j])
print(min(dp[H:]))

Submission status: Runtime Error

Solution code:
hp = int(input())
attack = int(input())

print(-(-(hp) //attack))

Submission status: Runtime Error

Solution code:
#L, R = map(int,input().split())
H,N = map(int,input().split())
A = list(map(int,input().split()))
 
a = 0
for i in A:
  a += i
  
if a>=H:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
#include <iostream>
using namespace std;

int main() {
    int H, A;
    cin >> H >> A;
    cout << (!(H%A) ? (H/A) : (H/A+1)) << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
object Main extends App {
    val num = readLine
    val h = num.split(" ")(0).toInt
    val a = num.split(" ")(1).toInt

    val result = if (h%a==0) (h/a) else ((h/a)+1)
    println(result);      
}

Submission status: Runtime Error

Solution code:
print(a)

Submission status: Runtime Error

Solution code:
x=input().split()
h=int(x[0])
n=int(x[1])
import numpy as np
a=np.full(n,0,int)
b=np.full(n,0,int)
for k in range(n):
  x=input().split()
  a[k]=int(x[0])
  b[k]=int(x[1])
m=max(a)  
inf=10**8
dp=np.full(h+m+1,inf,int)
dp[0]=0
for k in range(1,h+m):
  dp[k]=(dp[np.max(k-a,-1)]+b).min()
print(dp[h:h+m].min())

Submission status: Runtime Error

Solution code:
H, n = map(int, input().split())
List = [[0 for i in range(4)] for j in range(n)]
for i in range(n):
    a, b = map(int, input().split())
    List[i][0] = b / a
    List[i][1] = b / H
    List[i][2] = a
    List[i][3] = b

def recal():
    for i in range(n):
        b = List[i][3]
        List[i][1] = b / H

sList = sorted(List)
MP = 0
k = 0
while H > 0:
    if sList[k][2] <= H:
        H -= sList[k][2]
        MP += sList[k][3]
        recal()
    else:
        if sList[k + 1][2] <= H:
            if sList[k][1] <= sList[k + 1][0]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
        else:
            if sList[k][1] <= sList[k + 1][1]:
                H -= sList[k][2]
                MP += sList[k][3]
                recal()
                break
            else:
                H -= sList[k + 1][2]
                MP += sList[k + 1][3]
                recal()
                k += 1
print(MP)

Submission status: Runtime Error

Solution code:
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))  
m=max(a)  
dp=[10**8]*(h+m)
dp[0]=0
for k in range(h+m):
  for i in range(n):
    if k-a[i]<0:
      continue
    new=dp[k-a[i]]+b[i]
    if new < dp[k]:
      dp[k]=new
print(min(dp[h:h+m]))

Submission status: Runtime Error

Solution code:
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))  
m=max(a)  
dp=[10**9]*(h+m)
dp[0]=0
for k in range(h+m):
  for i in range(n):
    if k-a[i]<0:
      continue
    new=dp[k-a[i]]+b[i]
    if new < dp[k]:
      dp[k]=new
print(min(dp[h:h+m]))

Submission status: Runtime Error

Solution code:
import math


def get_inputs():
    inputs = input().split(" ")
    monsters_num, diff, attack = int(inputs[0]), int(inputs[1]), int(inputs[2])
    monsters = []
    for monster in range(monsters_num):
        inputs = input().split(" ")
        coordinate, health = int(inputs[0]), int(inputs[1])
        monsters.append({"coordinate": coordinate, "health": health})
    return monsters, diff, attack, monsters_num


def between_coordinates(monster, coordinate, diff):
    if (coordinate - diff <= monster["coordinate"] <= coordinate) or (
            coordinate <= monster["coordinate"] <= coordinate + diff):
        return True
    return False


def sort_monsters_coordinates(monsters):
    return sorted(monsters, key=lambda k: k['coordinate'])


def get_alive_monsters(monsters):
    return [monster for monster in monsters if monster["health"] > 0]


def attack_leftmost_monster(coordinate, monsters, attack, diff):
    bombs_num = 0
    if len(monsters) == 0:
        return 0
    leftmost_monster = monsters.pop(0)
    needed_attacks = math.ceil(leftmost_monster["health"] / attack)
    bombs_num += needed_attacks
    for monster in monsters:
        if between_coordinates(monster, coordinate, diff):
            monster["health"] -= (needed_attacks * attack)
    monsters = get_alive_monsters(monsters)
    return monsters, bombs_num


def get_max_health(monsters):
    if len(monsters) == 0:
        return 0

    max_health = - math.inf
    for monster in monsters:
        if monster["health"] >= max_health:
            max_health = monster["health"]
    return max_health


monsters, diff, attack, monsters_num = get_inputs()
if len(monsters) > 0:
    monsters = sort_monsters_coordinates(monsters)
else:
    print(0)

coordinate = monsters[0]["coordinate"] + diff
total_bombs_num = 0

while len(monsters) > 0 and coordinate <= monsters[-1]["coordinate"] - diff:
    monsters, bombs_num = attack_leftmost_monster(coordinate, monsters, attack, diff)
    total_bombs_num += bombs_num
    if len(monsters) > 0:
        coordinate = monsters[0]["coordinate"] + diff
        
print(total_bombs_num + math.ceil(get_max_health(monsters) / attack))

Submission status: Runtime Error

Solution code:
H = int(input())
K = int(input())
cnt=0
while(H>0):
  H=H-K
  cnt=cnt+1

print(cnt)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
print(sum(sorted(list(map(int, input().split())))[:0 if n<=k else n-k]))

Submission status: Runtime Error

Solution code:
N, K= map(int, input().split())
Nli = [int(x) for x in input().split()]
Nli.sort()
if N > K:print(sum(Nli[0:N-K]))
else: print(0)

Submission status: Runtime Error

Solution code:
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
c=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))
  c.append(int(x[0])/int(x[1]))
s=0  
while H>0:
  maxim=0
  for k in range(n):
    m=H//a[k]
    d=a[k]*(H//a[k]+1)
    if (d+1)*b[k]>maxim:
      maxim=(d+1)*b[k]
  s+=maxim
print(s)

Submission status: Runtime Error

Solution code:
H = int(input())

def func(h):
    if h == 1:
        return 1
    else:
        return func(h // 2) * 2 + 1

r = func(H)
print(r)

Submission status: Runtime Error

Solution code:
H,N=map(int,input().split())
A=map(int,input().split())
if sum(A)>=H:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
H,N=map(int,input().split())
A=[int(x) for x in input().split()]
if sum(A)>=H:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
h = int(input())
count = 0
def dfs(h):
    global count
    count += 1
    if h == 1:
        quit()
    else:
            dfs(h//2)
            dfs(h//2)

dfs(h)
print(count)

Submission status: Runtime Error

Solution code:
a,b=map(int, input().split()) 
if A % b !=0:
    print(a//b+1)
else:
    print(a//b)

Submission status: Runtime Error

Solution code:
h,n = map(int,input().split())
a = sum(map(int,input().split()))
print(["Yes","No"][h>a])

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
H = map(int, input().split())

H = sorted(H, reverse=True)
HAS = sum(H)
HHA = sum(H[:K])

print(HAS-HHA)

Submission status: Runtime Error

Solution code:
H,N=map(int,input().split())
A=list(map(int,input().split()))
Max_A=0
for i in range(len(A)):
  Max_A=Max_A+A[i]
if Max_A>=H:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:

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

AB = [list(map(int, input().split())) for _ in range(N)]

dp = [math.inf] *(H+1)
dp[H] = 0
for a,b in AB:
    for i in range(H,-1,-1):
        if i <= H - a:
            dp[i] = min(dp[i], dp[i+a] + b)
        dp[0] = min(dp[0], min(dp[:a+1]) + b) # if hp is not just 0

print(dp[0])

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ans=int
ans=n/m
print(int(ans)+1)

Submission status: Runtime Error

Solution code:
H,N=map(int,input().split())
print('NYoe s'[H<=sum(list(map(int,input().split())))::2])

Submission status: Runtime Error

Solution code:
h,a = map(int, input().split())

print(math.ceil(h/a))

Submission status: Runtime Error

Solution code:
h,n = map(int,input().split())
i = list(map(int,input().split()))
ans = 0
for j in range(n):
    ans+=i[j]
    if ans >= h:
        print("Yes")
        exit()
print("No")

Submission status: Runtime Error

Solution code:
H, A = map(int, input().split())
 
if A > H:
  print(1)
  
else:
  if H % A = 0:
    answer = H // A
  else:
    answer = H // A + 1
  
  print(answer)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
s=list(map(int,input().split()))
if a<=sum(s):
    print ("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
s=list(map(int,input().split()))
count=0
for i in range(b):
        for j in range(i,b):
            if a<s[i]+s[j] and count==0:
                print("yes")
                count+=1
if count==0:
    print("no")

Submission status: Runtime Error

Solution code:
H,A = (int(x) for x input().split())

if not H <= 10^4 && H >= 1:
  return False
if not A <= 10^4 && H >= 1:
  return False

int count = 0
while H >= 0:
  count=+
  H = H - A

print(count)

Submission status: Runtime Error

Solution code:
health = int(input())
decrease = int(input())
attack = 0
while health > 0:
    health = health - decrease
    attack += 1
print(attack)

Submission status: Runtime Error

Solution code:
mylist = list(map(int, myinput.split(" ")))
H = mylist[0]
A = mylist[1]
x = 0
while H >0:
  H -= A
  x += 1
print(x)

Submission status: Runtime Error

Solution code:
mylist = list(map(int, myinput.split(" ")))
H = mylist[0]
A = mylist[1]
H // A = C
print(C)

Submission status: Runtime Error

Solution code:
N,M = (int(x) for x in input().split())

K = N/M
if N < M:
  print(1)
else if N > M && N%M == 0:
  print(K)
else:
  print(K+1)

Submission status: Runtime Error

Solution code:
h, a = map(int, input())
print(-(-h // a))