Harryxun/stf_run huggingface dataset:
'''
def weight(n, p, c):
    global count
    global m
    
    if n % c[0] == 0:
        count = min(count, p + n // c[0])
        return count
    elif p + n // c[0] >= count:
        return n
    elif c[0] < n:
        return min(weight(n - c[0], p + 1, c), weight(n, p, c[1:]))
    else:
        return weight(n, p, c[1:])

N, W = map(int, input().split())
lisv = []
lisw = []

for i in range(N):
    v, w = map(int, input().split())
    lisv.append(v)
    lisw.append(w)

for j in range(N):
    pass

count = N
print(weight(N, 0, lisw))

#print(coin(n, 0, mon))
'''
def x(x):
    return(x(x))
print(x('1'))


### FIXED CODE ###

N,W=map(int,input().split())
dp=[[0 for i in range(W+1)]for j in range(N+1)]
goods=[]
for i in range(N):
    v,w=map(int,input().split())
    goods.append([v,w])

    
for i in range(N):
    v=goods[i][0]
    w=goods[i][1]
    for j in range(W+1):
        dp[i+1][j]=max(dp[i][j],dp[i+1][j])
        next_w=j+w
        next_v=dp[i][j]+v
        if(next_w<=W and next_v>dp[i+1][next_w]):
            dp[i+1][next_w]=next_v

ans=0
for i in range(W+1):
    ans=max(ans,dp[N][i])
print(ans)
N = int(input())
a = list(map(int, input().split(' ')))

ans = True
if N % 3 != 0:
    for i in range(N):
        if a[i] != 0:   
            ans = False
else:
    first = a[0]
    i_second = -1
    for i in range(1, N):
        if a[i] != first:
            second = a[i]
            i_second = i
            break
        
    if i_second == -1:
        for i in range(N):
            if a[i] != 0:
                ans = False
    else:
        for i in range(i_second+1, N):
            if (a[i] != first) and (a[i] != second):
                third = a[i]
                break
        if (first ^ second != third) or (second ^ third != first) or (third ^ first != second):
            ans = False
        else:
            cnt_first = 0
            cnt_second = 0
            cnt_third = 0
            for i in range(N):
                if a[i] == first:
                    cnt_first += 1
                elif a[i] == second:
                    cnt_second += 1
                elif a[i] == third:
                    cnt_third += 1
            if (cnt_first != N/3) or (cnt_second != N/3) or (cnt_third != N/3):
                ans = False

if ans is True:
    print('Yes')
else:
    print('No')


### FIXED CODE ###


N = int(input())
a = list(map(int, input().split(' ')))

ans = True
if N % 3 != 0:
    for i in range(N):
        if a[i] != 0:   
            ans = False
else:
    first = a[0]
    i_second = -1
    for i in range(1, N):
        if a[i] != first:
            second = a[i]
            i_second = i
            break
        
    if i_second == -1:
        for i in range(N):
            if a[i] != 0:
                ans = False
    else:
        i_third = -1
        for i in range(i_second+1, N):
            if (a[i] != first) and (a[i] != second):
                third = a[i]
                i_third = i
                break
        if i_third == -1:
            ans = False
            cnt_first = 0
            cnt_second = 0
            for i in range(N):
                if a[i] == first:
                    cnt_first += 1
                elif a[i] == second:
                    cnt_second += 1
            if first ^ second == second:
                if (cnt_first == N/3) and (cnt_second == N*2/3):
                    ans = True
            if first ^ second == first:
                if (cnt_first == N*2/3) and (cnt_second == N/3):
                    ans = True
        else:
            if (first ^ second != third) or (second ^ third != first) or (third ^ first != second):
                ans = False
            else:
                cnt_first = 0
                cnt_second = 0
                cnt_third = 0
                for i in range(N):
                    if a[i] == first:
                        cnt_first += 1
                    elif a[i] == second:
                        cnt_second += 1
                    elif a[i] == third:
                        cnt_third += 1
                if (cnt_first != N/3) or (cnt_second != N/3) or (cnt_third != N/3):
                    ans = False

if ans is True:
    print('Yes')
else:
    print('No')
a, b = input().split()
x = (a + b) / 2
if x > 0:
	return x + 1
else:
	return x

### FIXED CODE ###

# -*- coding: utf-8 -*-
import math

a, b = map(int, input().split())
x = (a + b) / 2
print(math.ceil(x))
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

counter = 0
for i in range(int(len(S_list)/2)):
  #print(S_list[i],S_list[i+int(len(S_list)/2)+1])
  if(S_list[i]==S_list[i+int(len(S_list)/2)+1]):
    counter = counter + 1
  else:
    counter = counter
    
#print(counter,int(len(S_list)/2))
if(counter < int(len(S_list)/2)):
    print("NO")
    
for i in range(int(len(S_list)/4)):
  if(S_list[i]==S_list[i+int(len(S_list)/4)+1]):
    #print(S_list[i],S_list[i+int(len(S_list)/4)+1])
    #print((S_list[i+int(len(S_list)/2)+1],S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]))
    if(S_list[i+int(len(S_list)/2)+1]==S_list[i+int(len(S_list)/2)+int(len(S_list)/2)]):
      print("YES")

### FIXED CODE ###

#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

S_list_reverse = list(reversed(S_list))


#print(S_list_reverse)
#print(S_list)

if(S_list != S_list_reverse):
  print("No")
else:
  S_list_new = S_list
  del S_list_new[int(len(S_list)/2):]
  S_list_new_reverse =  list(reversed(S_list_new))
  if(S_list_new != S_list_new_reverse):
    print("No")
  else:
    print("Yes")
n=input()
k=int(input())
l=len(n)
dp=[[[0 for _ in range(2)] for _ in range(5)] for _ in range(l+1)]
dp[0][1][1]=int(n[0])-1
dp[0][1][0]=1
for i in range(1,L):
  for j in range(4):
    b=i-1
    now=int(n[i])
    if now=0:
      dp[i][j][0]+=dp[b][j][0]
    else:
      dp[i][j][1]+=dp[b][j][0]
      dp[i][j+1][1]+=dp[b][j][0]*(now-1)
      dp[i][j+1][0]+=dp[b][j][0]
    dp[i][j][1]+=dp[b][j][1]
    dp[i][j+1][1]+=dp[b][j][1]*9
  dp[i][1][1]+=9
print(dp[l-1][k][0]+dp[l-1][k][1])
           

### FIXED CODE ###

n=input()
k=int(input())
l=len(n)
dp=[[[0 for _ in range(2)] for _ in range(5)] for _ in range(l+1)]
dp[0][1][1]=int(n[0])-1
dp[0][1][0]=1
for i in range(1,l):
  for j in range(4):
    b=i-1
    now=int(n[i])
    if now==0:
      dp[i][j][0]+=dp[b][j][0]
    else:
      dp[i][j][1]+=dp[b][j][0]
      dp[i][j+1][1]+=dp[b][j][0]*(now-1)
      dp[i][j+1][0]+=dp[b][j][0]
    dp[i][j][1]+=dp[b][j][1]
    dp[i][j+1][1]+=dp[b][j][1]*9
  dp[i][1][1]+=9
print(dp[l-1][k][0]+dp[l-1][k][1])
import numpy as np
import itertools

def main():
    N, M=map(int, input().split())
    a =[]
    c = []
    for i in range(2*M):
      if i%2 == 0:
        temp,_=map(int, input().split()) 
        a.append(temp)
      else:
        temp=list(map(int, input().split()))
        c.append(temp)
    a = np.array(a) 

    row = 2**M 
    boo = np.array([[int(j[i]) for i in range(M)] for j in  [bin(i)[2:].zfill(M) for i in range(row)]])
    table = np.zeros((row,N), dtype = 'int8')

    for i in range(row):
        ind_temp = np.array(list(set(itertools.chain.from_iterable(c*boo[i]))),dtype = int) -1
        table[i][ind_temp] = 1

    ind = np.where(np.all(table, axis=1))
    price = np.array([np.sum(a*boo[ind], axis = 1)])

    if price:
        print(np.min(price))
    else:
        print(-1)


if __name__ == "__main__":
    main()



### FIXED CODE ###

N, M = map(int, input().split())
Inf = 10**8
Dp = [Inf]*(2**N)
Dp[0] = 0

for i in range(M): #カギiで
    a,_=map(int, input().split())
    c = list(map(int, input().split()))
    d = sum((1<<p-1) for p in c) #iで開けられる宝箱の2bit表記
    for j in range(2**N):
        ope = j|d
        Dp[ope] = min(Dp[ope], Dp[j] + a)

if Dp[-1] == Inf:
    print(-1)
else:
    print(Dp[-1])
s = [int(i) for i in input().split()]
print(''.swapcase(1200))

### FIXED CODE ###

s = input()
print(s.swapcase())
N,K=map(int,input().split())
H=list(map(int,input().split()))

import numpy as np
dp = np.ones(N+1,dtype=float)*float('inf')
dp[0]=0
dp[1]=0
    

for i in range(N):
    if i!=0:
        for k in range(K):
            if i-k>=1:
                dp[i+1] = min ( dp[i+1] ,dp[i-k] + abs(H[i]-H[i-(k+1)]) )
print(int(dp[N]))
# print(dp)

### FIXED CODE ###

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

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

for i in range(N):
    if i!=0:
        for k in range(K):
            if i-k>=1:
                dp[i+1] = min ( dp[i+1] ,dp[i-k] + abs(H[i]-H[i-(k+1)]) )
print(int(dp[N]))
# print(dp)
import itertools
import numpy as np

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

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,M))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())


### FIXED CODE ###

import itertools
import numpy as np

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

a = range(1,M+1)
arr = np.asarray(list(itertools.combinations_with_replacement(a,N))) #重複組み合わせ
#print(arr)

sc = np.zeros(arr.shape[0],dtype=int)
#print(sc)

for i in range(Q):
  abcd = list(map(int, input().split()))
  f = (arr[:,abcd[1]-1]-arr[:,abcd[0]-1])==abcd[2]
  sc += abcd[3]*f 
#
print(sc.max())
a,b,c=input().split()
a=int(a)
c=int(c)
if b="+":
  print(a+c)
else:
  print(a-c)

### FIXED CODE ###

a,b,c=input().split()
a=int(a)
c=int(c)
if b=="+":
  print(a+c)
else:
  print(a-c)
k = int(input())
s = input()
n = len(s)

if s <= k :
print(s)

else :
print(s[:k] + '...')

### FIXED CODE ###

k = int(input())
s = input()
n = len(s)
     
if n <= k:
	print(s)
else:
	print(s[:k] + '...')
num = int(input())
res = num**3

print("{1}".format(res))


### FIXED CODE ###

num = int(input())

print("{0}".format(num**3))
class Stack:
    MAX = 100

    def __init__(self):
        self.S = [None] * self.__class__.MAX
        self.top = 0

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.__class__.MAX - 1

    def push(self, x):
        self.top += 1
        self.S[self.top] = x

    def pop(self):
        self.top -= 1
        return self.S[self.top + 1]


arr = [str(s) for s in input().split()]
stack = Stack()
for s in arr:
    if s in ["+", "-", "*"]:
        stack.push(
            eval("".join(map(str, [stack.pop(), s, stack.pop()][::-1]))))
    else:
        stack.push(int(s))

print(stack.pop())



### FIXED CODE ###

class Stack:
    MAX = 101

    def __init__(self):
        self.S = [None] * self.__class__.MAX
        self.top = 0

    def is_empty(self):
        return self.top == 0

    def is_full(self):
        return self.top >= self.__class__.MAX - 1

    def push(self, x):
        self.top += 1
        self.S[self.top] = x
        return x

    def pop(self):
        self.top -= 1
        return self.S[self.top + 1]


stack = Stack()
print([stack.push(eval("".join(map(str,[stack.pop(),s,stack.pop()][::-1]))))
       if s in["+","-","*"]else stack.push(int(s))for s in input().split()][-1])
import sys
n, m, k = map(int, input().split())
mod = 998244353

# 隣り合ったブロックを異なる色で塗ると何通りあるか
# 隣り合ったブロック通しで同じ色にする場所をn-1箇所から選ぶ(combination)

# combinationを計算する
def combination(n, r, p):
    if r < 0 or r > n:
        return 0
    r = min(r, n-r)
    return (f[n]*f_inverse[r]*f_inverse[n-r])%p

f = [1, 1] # n!を計算する
f_inverse = [1, 1]# n!の逆元を計算する
n_inverse = [0, 1] # nの逆元
for i in range(2, n+1):
    f.append((f[i-1]*i)%mod)
    n_inverse.append( (-1*(mod//i)*n_inverse[mod%i])%mod )
    f_inverse.append((f_inverse[i-1]*n_inverse[i])%mod)

c = m * ((m-1)**(n-1))
count = 0
for i in range(k+1):
    # print(count, c, combination(n-1, i, mod))
    count += combination(n-1, i, mod) * c
    c =  c // (m-1) 
    count %= mod
    
print(count)

# for i in range(1, k):
#     count += t * s
#     t = t//(m-1)
#     s = ((s * (n-1-i))// (i+1))%998244353
#     print(count, t, s)

### FIXED CODE ###

import sys
n, m, k = map(int, input().split())
mod = 998244353

# 隣り合ったブロックを異なる色で塗ると何通りあるか
# 隣り合ったブロック通しで同じ色にする場所をn-1箇所から選ぶ(combination)

# combinationを計算する
def combination(n, r, p):
    if r < 0 or r > n:
        return 0
    r = min(r, n-r)
    return (f[n]*f_inverse[r]*f_inverse[n-r])%p

f = [1, 1] # n!を計算する
f_inverse = [1, 1]# n!の逆元を計算する
n_inverse = [0, 1] # nの逆元
for i in range(2, n+1):
    f.append((f[i-1]*i)%mod)
    n_inverse.append( (-1*(mod//i)*n_inverse[mod%i])%mod )
    f_inverse.append((f_inverse[i-1]*n_inverse[i])%mod)

# c = m * ((m-1)**(n-1))
# L = []
# for i in range(k+1):
#     L.append(c)
#     c=c//(m-1)

def pow_m(k):
    if k == 0:
        return 1
    elif k%2==0:
        return (pow_m(k//2)**2)%mod
    else:
        return (m-1)*(pow_m(k//2)**2)%mod

count = 0
for i in range(k+1):
    # print(count, c, combination(n-1, i, mod))
    count += combination(n-1, i, mod) * m * pow_m(n-1-i)#L[i]
    count %= mod
    
print(count)
n,m = (int(x) for x in input().split())
friendlist = [0]*n
classes = 1
for i in range(m):
    a,b = (int(x)-1 for x in input().split())
    if friendlist[a]!=0 and friendlist[b]!=0:
        continue
    elif friendlist[a]!=0:
        friendlist[b] = friendlist[a]
    elif friendlist[b]!=0:
        friendlist[a] = friendlist[b]
    else:
        friendlist[a] = classes
        friendlist[b] = classes
        classes += 1

count = [0]*classes
maxa = 0
for i in range(n):
    count[friendlist[i]] += 1
    maxa = max([count[friendlist[i]],maxa])

print(maxa)

### FIXED CODE ###

n = int(input())

An = [int(i) for i in input().split()]
S = sum(An)
Sn = S**2
Sn2 = 0
for a in An:
    Sn2 += a**2

ans = ((Sn - Sn2)//2)%(10**9+7)
print(ans)
n = int(input())
S = list(input().split())
T = list(input().split())

ans=""

for i in range(n)
	ans+=S[i]+T[i]

print(ans)


### FIXED CODE ###

a = int(input())
b = int(input())

print(6-(a+b))
from collections import deque
N, M = map(int, input().split())
graph = [] 
for i in range(N + M - 1):
    a, b = map(int, input().split())
    graph += [[a,b]]

path = [[] for i in range(N)]  
parent = [[] for i in range(N)]
ans = [-1 for i in range(N)]
for p in graph:
    parent[p[1]-1] += [p[0]-1]
    path[p[0]-1] += [p[1]-1]

root = -1
for i in range(N):
    if parent[i] == []:
        root = i
        parent[i] = [-1]
visited = [0 for i in range(N)]
visited[root] = 1

que = deque()
for v in path[root]:
    ans[v] = root
    que.append([root, v])
    if len(parent[v]) > 1:
        parent[v].remove(root) 
while que:
    u, V = que.popleft()
    for v in path[V]:
        if visited[v] == 0:
            if len(parent[v]) > 1:
                parent[v].remove(V)
            else:
                visited[v] = 1
                que.append([V, v])
for i in range(N):
    print(parent[i][0]+1)

### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
graph = [] 
for i in range(N + M - 1):
    a, b = map(int, input().split())
    graph += [[a,b]]

path = [[] for i in range(N)]  
parent = [[] for i in range(N)]
ans = [-1 for i in range(N)]
for p in graph:
    parent[p[1]-1] += [p[0]-1]
    path[p[0]-1] += [p[1]-1]

root = -1
for i in range(N):
    if parent[i] == []:
        root = i
        parent[i] = [-1]
visited = [0 for i in range(N)]
visited[root] = 1

que = deque()
for v in path[root]:
    ans[v] = root
    if len(parent[v]) > 1:
        parent[v].remove(root) 
    else: que.append([root, v])
while que:
    u, V = que.popleft()
    for v in path[V]:
        if len(parent[v]) > 1:
            parent[v].remove(V)
        else:
            que.append([V, v])
for i in range(N):
    print(parent[i][0]+1)
1inport sys
for i in sys.stdin.readlines():
        a,b = i.strip().split()
        if a == "0" and b == "0":
                break;

        if int(a) < int(b):
                print("{0} {1}".format(a,b))
        else:
                print("{1} {0}".format(a,b))
        

### FIXED CODE ###

import sys
for i in sys.stdin.readlines():
        a,b = i.strip().split()
        if a == "0" and b == "0":
                break

        if int(a) < int(b):
                print("{0} {1}".format(a,b))
        else:
                print("{1} {0}".format(a,b))
import sys
s = input()
t = input()

check = [False]*30
for c in s:
    i = ord(c) - ord("a")
    check[i] = True

for c in t:
    i = ord(c) - ord("a")
    if not check[i]:
        print(-1)
        sys.exit()

dp = [[0 for i in range(26)] for j in range(len(s))]

s = s + s

#
def ser(string :str,target :str,s :int):
    for i in range(s,len(string)):
        if string[i] == target:
            return i % (len(string)//2),i-1

# 指定した範囲に数字を埋める
def dig(ls,c,v,s,t):
    for i in range(s,t+1):
        ls[i][c] = v

for c in range(len(dp[0])):
    i = 0
    while i < len(dp):
        start = i
        print(i)
        v,i = ser(s,chr(c+ord("a")),i+1)
        dig(dp,c,v,start,min(i,len(dp)-1))
        i += 1

print(dp)

### FIXED CODE ###

import sys
s = input()
t = input()

check = [False]*30
for c in s:
    i = ord(c) - ord("a")
    check[i] = True

for c in t:
    i = ord(c) - ord("a")
    if not check[i]:
        print(-1)
        sys.exit()

dp = [[-1 for i in range(26)] for j in range(len(s))]

s = s + s

#
def ser(string :str,target :str,s :int):
    for i in range(s,len(string)):
        if string[i] == target:
            return i % (len(string)//2),i-1

# 指定した範囲に数字を埋める
def dig(ls,c,v,s,t):
    for i in range(s,t+1):
        ls[i][c] = v

for c in range(len(dp[0])):
    if not check[c]:continue
    i = 0
    while i < len(dp):
        start = i
        v,i = ser(s,chr(c+ord("a")),i+1)
        dig(dp,c,v,start,min(i,len(dp)-1))
        i += 1

# 最初にうまいことやるために
import copy
ls = [0 if s[0] == chr(i + ord("a")) else dp[0][i] for i in range(len(dp[0]))]
dp.append(ls)

ans = 0
i = -1
for char in t:
    ikari = dp[i][ord(char) - ord("a")]
    if i >= ikari:
        ans += 1
    i = ikari
print(ans * (len(dp)-1) + 1 + i)
N, M, X=map(int, input().split())
list=[0]*(N+1)
m=list[int() for i in input().split()]
for i in m:
  list[i]=1

### FIXED CODE ###

N, M, X=map(int, input().split())
sum=sum(int(i)<X for i in input().split())
print(min(sum, M-sum))
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
max = l[N-1]
tp = N
for i in range(N-2):
    if l[i]+l[i+1] > max:
        k = N-i-1
        ans += ((k-1)*k*(k+1))//6
        break
    for j in range(i+1,N-1):
        if j == tc:
            ans += tp
            break
        s = l[i]+l[j]
        if s <= l[j+1]:
            continue
        if s > max:
            tc = j 
            tp = (N-j-1) * (N-j) //2 #これをiの中でできないか
            ans += tp
            break
        start = j+1
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        ans += end-j-1
print(ans)

### FIXED CODE ###

N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
max = l[N-1]
tc = N
st = [j+1 for j in range(N-1)]
for i in range(N-2):
    if l[i]+l[i+1] > max:
        k = N-i-1
        ans += ((k-1)*k*(k+1))//6
        break
    for j in range(i+1,N-1):
        if j == tc:
            ans += tp
            break
        s = l[i]+l[j]
        if s <= l[j+1]:
            continue
        if s > max:
            tc = j 
            tp = (N-j-1) * (N-j) //2 #これをiの中でできないか
            ans += tp
            break
        start = st[j]
        if s <= l[start]:
            ans += start-j-1
            continue
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        st[j] = end
        ans += end-j-1
print(ans)
n,m = list(map(int,input().split()));
a = list(map(int,input().split()));

a.sort(reverse = True);

i = 0;
while a[i] >= sum(a)/(4*m) :
    i += 1;

if i >= m :
    print('Yes');
else :
    print('No');

### FIXED CODE ###

n,m = list(map(int,input().split()));
a = list(map(int,input().split()));

ans = 0;
for i in range(n) :
    if a[i] >= sum(a)/(4*m):
        ans += 1;

if ans >= m :
    print('Yes');
else :
    print('No');
N=int(input())
List=list(map(int,input().split()))
D=List.sort()
m=D[N&2]-D[N%2-1]-1
if m=-1:
  print(0)
else:
  print(m)

### FIXED CODE ###

N=int(input())
List=list(map(int,input().split()))
List.sort()
l=int(N/2)
k=int(N/2-1)
m=List[l]-List[k]
print(m)
n = int(input())
A = map(int, input().split())
rate = [0] * 9
for a in A:
    rate[a // 400] += 1
color_min = 8 - rate[:-1].count(0)
color_max = color_min + (min(rate[-1], rate[:-1].count(0)) if rate[-1] > 0 else 0)
print(color_min, color_max)

### FIXED CODE ###

n = int(input())
A = map(int, input().split())

rate = set()
free = 0
for a in A:
    if a < 3200:
        rate.add(a // 400)
    else:
        free += 1

if len(rate) == 0:
    color_min, color_max = 1, n
else:
    color_min, color_max = len(rate), len(rate) + free

print(color_min, color_max)
, b, c, d = map(int, input().split())
print('Yes' if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c) <= d else 'No')

### FIXED CODE ###

a, b, c, d = map(int, input().split())
print('Yes' if (abs(a-b) <= d and abs(b-c) <= d) or abs(a-c) <= d else 'No')
N,M,X=list(map(int,input().split()))
lines = []

for i in range(N):
	lines.append(list(map(int,input().split())))
pricemin = 1000000
for i in range(2**N):
	price = 0
	count = 0
	A = [0]*M
	for j in range(N):
		if ((i >> j) & 1):
			for k in range(M):
				A[k] += lines[j][k+1]
			price += lines[j][0]
	for j in range(M):
		if A[j] >= X:
			count += 1
	if count == M and pricemin > price:
		pricemin = price
if pricemin == 1000000:
	print('-1')
else:
	print(pricemin)
			
	



### FIXED CODE ###

S = input()
T = input()
N = len(T)
T2 = T[0:N-1]
if S == T2:
	print('Yes')
else:
	print('No')
n=int(input())
kei=0
for i in range(n):
    l,r=map(int,input().split())
    kei += sum(r)-sum(l)
kei += n
print(kei)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(N):
	l,r=map(int,input().split())
	ans+=r-l+1
print(ans)
def main():
    while 1:
        a,b=(int(x) for x in input().split())
        a1=a
        b1=b
        while b!=0:
            c=a%b
            a=b
            b=c
        print(a, a1*b1//a)

main()


### FIXED CODE ###

def main():
    while True:
        try:
            a,b=(int(x) for x in input().split())
        except:
            break
        a1=a
        b1=b
        while b!=0:
            c=a%b
            a=b
            b=c
        print(a, a1*b1//a)

main()
while True:
  a, op, b = input(), raw_input(), input()
  if op == "+":
    print a+b
  elif op == "-":
    print a-b
  elif op == "*":
    print a*b
  elif op == "/":
    print a/b
  else:
    break

### FIXED CODE ###

while True:
  s = raw_input().split()
  a = int(s[0])
  op = s[1]
  b = int(s[2])
  if op == '?':
    break
  elif op == '+':
    print (a+b)
  elif op == '-':
    print (a-b)
  elif op == '*':
    print (a*b)
  elif op == '/':
    print (a/b)
a=float(input())
b=float(input())
c=a*b
d=(a+b)*2
print(c,d)


### FIXED CODE ###

a,b=map(int,input().split())
c=a*b
d=(a+b)*2
print(c,d)
a=int(input())
b=int(input())
if a<=2b:
  print(0)
else:
  print(a-2b)

### FIXED CODE ###

a,b=map(int,input().split())
print(0 if a<=(2*b) else a-(2*b))
N = int(input())
A = {(i+1):int(j) for i, j in enumerate(input().split())}
A_sorted = sum(map(list, sorted(A.items(), key=lambda x:x[1])), [])
t = A_sorted[0::2]
print(*t, sep=' ')

### FIXED CODE ###

n = int(input())
print(((n+1)//2)/n)
n, k = map(int, input().split())
h =  list(map(int, input().split()))

s = sum(h)
m = 0
for _ in range(k):
    a = 0
    m = 0
    index = 0
    for i, j in enumerate(h):
        if j > m:
            m = j
            index = i
    a += m
    del h[i]
print(s - m)

### FIXED CODE ###

n, k = map(int, input().split())
h =  list(map(int, input().split()))

def solve():
    global n, k, h
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        s -= h[i]
    return s

print(solve())
K=input()
A=input()
B=input()

for i in range(A,B):
  if (i %= K) ==0:
    print("OK")


### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())

yn=0
for i in range(A,B+1,1):
    if (i % K) == 0:
        print("OK")
        yn=1
        break
if yn==0:
    print("NG")