Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
a=list(map(int,input().split()))
arr=[]

for i in range(m):
    b,c=map(int,input().split())
    arr.append((b,c))

a=sorted(a)
arr=sorted(arr,key=lambda x:-x[1])

flag=0
left=0
for tup in arr:
    for i in range(left,max(left+tup[0],n+1)):
        if tup[1]>a[i]:
            a[i]=tup[1]
        else:
            flag=-1
            break
        if i==n:
            flag=-1
            break
    left+=tup[0]
    if flag==-1:
        break

print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
arr=[]

for i in range(m):
    b,c=map(int,input().split())
    arr.append((b,c))

a=sorted(a)
arr=sorted(arr,key=lambda x:-x[1])

flag=0
left=0
for tup in arr:
    for i in range(left,min(left+tup[0],n)):
        if tup[1]>a[i]:
            a[i]=tup[1]
        else:
            flag=-1
            break
        if i==n-1:
            flag=-1
            break
    left+=tup[0]
    if flag==-1:
        break

print(sum(a))
n = int(input())

edges = [[] for i in range(n)]
distance = [-1 for i in range(n)]

for i in range(n-1):
	f,t,c = map(int,raw_input().split())

	f -= 1
	t -= 1

	edges[f].append([t,c])
	edges[t].append([f,c])

q,k = map(int,raw_input().split())
k -= 1

def dfs(v,c):
	if distance[v] == -1:
		distance[v] = c
		for to,cost in edges[v]:
			dfs(to,c+cost)

dfs(k,0)

for i in range(q):
	x,y = map(int,raw_input().split())
	x -= 1
	y -= 1
	print distance[x] + distance[y]


### FIXED CODE ###

import sys

sys.setrecursionlimit(10**5+100)
n = int(input())

edges = [[] for _ in xrange(n)]
distance = [-1 for _ in xrange(n)]

for _ in xrange(n-1):
	f,t,c = map(int,raw_input().split())

	f -= 1
	t -= 1

	edges[f].append((t,c))
	edges[t].append((f,c))

q,k = map(int,raw_input().split())
k -= 1

def dfs(v,c):
	if distance[v] == -1:
		distance[v] = c
		for to,cost in edges[v]:
			dfs(to,c+cost)

dfs(k,0)

for _ in xrange(q):
	x,y = map(int,raw_input().split())
	x -= 1
	y -= 1
	print distance[x] + distance[y]
cards = []
for suit in ('S','H','C','D'):
    for num in range(1,14):
        cards.append(suit+' '+str(num))

N = raw_input()

while 1;
    suit, number = raw_input().split()
    cards.remove(suit+' '+y)


for card in cards:
    print card

### FIXED CODE ###

cards = []
for suit in ('S','H','C','D'):
    for num in range(1,14):
        cards.append(suit+' '+str(num))

N = int(raw_input())

for n in xrange(N):
    suit, number = raw_input().split()
    cards.remove(suit+' '+number)


for card in cards:
    print card
# -*- coding: utf-8 -*-
# B - バイナリハックイージー

s = input()
listAns = []

set1 = ['0', '1']
set2 = ['B']

listS = list(s)

print(listS)

for i in listS:
    if i in set1:
        listAns.append(i)

    elif i in set2:
        if len(listAns) != 0:
            listAns.pop()

ans = reduce(lambda x, y: x + y, [str(x) for x in listAns])

print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# B - バイナリハックイージー

s = input()
listAns = []

set1 = ['0', '1']
set2 = ['B']

listS = list(s)

# print(listS)

for i in listS:
    if i in set1:
        listAns.append(i)

    elif i in set2:
        if len(listAns) != 0:
            listAns.pop()

ans = "".join(listAns)

print(ans)
n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

from heapq import heappop, heappush
push = lambda x,i: heappush(BB,(-x,i))
BB=[]

for i,b in enumerate(B):
  push(b,i)

ans=0
while BB:
  b,ind=heappop(BB)
  b,ai=-b,A[ind]
  if b<ai:
    ans=-1
    break
  if ind==0:
    d=B[1]+B[-1]
  elif ind==n-1:
    d=B[-2]+B[0]
  else:
    d=B[ind-1]+B[ind+1)]
  dd=(b-ai)//d
  if dd==0:
    if b==ai:
      continue
    ans=-1
    break
  ans+=dd
  B[ind]-=d*dd
  push(B[ind],ind)
  
print(ans)


### FIXED CODE ###

n=int(input())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]

from heapq import heappop, heappush
push = lambda x,i: heappush(BB,(-x,i))
BB=[]

for i,b in enumerate(B):
  push(b,i)

ans=0
while BB:
  b,ind=heappop(BB)
  b,ai=-b,A[ind]
  if b<ai:
    ans=-1
    break
  d=B[(ind-1)%n]+B[(ind+1)%n]
  dd=(b-ai)//d
  if dd==0:
    if b==ai:
      continue
    ans=-1
    break
  ans+=dd
  B[ind]-=d*dd
  push(b-d*dd,ind)
  
print(ans)
def main()
	a = int(input())
  	if a%2 == 1:
      print((a+1)/2)
    else:
      print(a/2)
main()

### FIXED CODE ###

def main():
    N = int(input())
    if N%2 == 1:
      print(int((N+1)/2))
    else:
      print(int(N/2))
main()
def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]

N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

flag = False
for i in range(M-1):
  if (A[i]+1 == A[i+1]):
    flag = True

if flag:
  print(0)
else:
  parts = []  
  for i in range(M):
    if i == 0:
      a_list = [x for x in range(0, A[i])]
      parts.append(a_list)
    else:
      a_list = [x for x in range(A[i-1]+1, A[i])]
      parts.append(a_list)
  a_list = [x for x in range(A[M-1]+1, N+1)]
  parts.append(a_list)
  ans = 1
  for part in parts:
    part_ans = fib(len(part))
    ans *= part_ans
  print(ans % 1000000007)

    

### FIXED CODE ###

def fib(n):
    if n <= 1:
        return n
    result = [1, 0, 0, 1]
    matrix = [1, 1, 1, 0]
    while n > 0:
        if n % 2:
            result = mul(matrix, result)
        matrix = mul(matrix, matrix)
        n //= 2
    return result[2]

def mul(a, b):
    return [a[0]*b[0] + a[1]*b[2],
            a[0]*b[1] + a[1]*b[3],
            a[2]*b[0] + a[3]*b[2],
            a[2]*b[1] + a[3]*b[3]]

N, M = map(int, input().split())
A = []
for i in range(M):
  A.append(int(input()))

flag = False
for i in range(M-1):
  if (A[i]+1 == A[i+1]):
    flag = True

if flag:
  print(0)
elif M != 0:
  parts = []  
  for i in range(M):
    if i == 0:
      a_list = [x for x in range(0, A[i])]
      parts.append(a_list)
    else:
      a_list = [x for x in range(A[i-1]+1, A[i])]
      parts.append(a_list)
  a_list = [x for x in range(A[M-1]+1, N+1)]
  parts.append(a_list)
  ans = 1
  for part in parts:
    part_ans = fib(len(part))
    ans *= part_ans
  print(ans % 1000000007)
else:
  ans = fib(N+1)
  print(ans % 1000000007)
import numpy as np
n=int(input())
a=list(map(int, input().split()))

N=max(a)+1
A=list(range(2,N))
p=list()
c=[0]*max(a)

while A[0]**2<=N:
	tmp=A[0]
	p.append(tmp)
	A=[e for e in A if e%tmp!=0]
l=p+A

for i in range(len(a)):
    for j in range(len(l)):
        if a[i]%l[j]==0:
            c[l[j]-1]+=1

#print(c)
maxcount=max(c)
if np.gcd.reduce(a) != 1:
    print('not coprime')
elif maxcount <= 1:
    print('pairwise coprime')
else:
    print('setwise coprime')

### FIXED CODE ###

import numpy as np
n=int(input())
a=list(map(int, input().split()))

if np.gcd.reduce(a) != 1:
    print('not coprime')
    exit()

m=max(a)
cnt=[0]*(m+1)

for i in range(len(a)):
    cnt[a[i]]+=1
#print(cnt)
for i in range(2, m + 1):
    #print(cnt[i::i])
    if sum(cnt[i::i]) > 1:
        print('setwise coprime')
        exit()

print('pairwise coprime')
#c
a, b = map(int ,input().split())
import math
print(a*b//math.gcd(a, b))

### FIXED CODE ###

#c
a, b = map(int ,input().split())
from fractions import gcd
print(a*b//gcd(a, b))
n = int(input())
V = [int(v) for v in input().split()]

V1 = [V[n] for n in range(0, n, 2)] #v1, v3, v5, ...
V2 = [V[n] for n in range(1, n, 2)] #v2, v4, v6, ...

V1_set = list(set(V1))
V1_cnt = []
for i in V1_set:
  i_cnt = V1.count(i)
  V1_cnt += [i, i_cnt]
V1_cnt += [0, 0] #V1に一種類しか数字が存在しなかったときのために
V1_cnt.sort(key=lambda x: x[1], reverse=True)
  
V2_set = list(set(V2))
V2_cnt = []
for i in V2_set:
  i_cnt = V2.count(i)
  V2_cnt += [i, i_cnt]
V2_cnt += [0, 0] #V2に一種類しか数字が存在しなかったときのために
V2_cnt.sort(key=lambda x: x[1], reverse=True)

mxnum_V1_cnt = V1_cnt[0][0] #V1の中で一番出現回数多い数字
mxnum_V2_cnt = V2_cnt[0][0] #V2の中で一番出現回数多い数字
if mxnum_V1_cnt != mxnum_V2_cnt:
  ans = n - (V1_cnt[0][1] + V2_cnt[0][1])
else:
  ans = n - max(V1_cnt[0][1] + V2_cnt[1][1], V1_cnt[1][1] + V2_cnt[0][1])

print(ans)

### FIXED CODE ###

n = int(input())
V = [int(v) for v in input().split()]

V1 = [V[n] for n in range(0, n, 2)] #v1, v3, v5, ...
V2 = [V[n] for n in range(1, n, 2)] #v2, v4, v6, ...

mx_V1 = max(V1)
V1_cnt = [[0, 0]] # V1に一種類しか数字が存在しなかったときのために
for i in range(1, mx_V1+1):
  V1_cnt.append([i, 0])
for v in V1:
  V1_cnt[v][1] += 1  
V1_cnt.sort(key=lambda x: x[1], reverse=True)

mx_V2 = max(V2)
V2_cnt = [[0, 0]] # V2に一種類しか数字が存在しなかったときのために
for j in range(1, mx_V2+1):
  V2_cnt.append([j, 0])
for v in V2:
  V2_cnt[v][1] += 1  
V2_cnt.sort(key=lambda x: x[1], reverse=True)

mxnum_V1_cnt = V1_cnt[0][0] #V1の中で一番出現回数多い数字
mxnum_V2_cnt = V2_cnt[0][0] #V2の中で一番出現回数多い数字
if mxnum_V1_cnt != mxnum_V2_cnt:
  ans = n - (V1_cnt[0][1] + V2_cnt[0][1])
else:
  ans = n - max(V1_cnt[0][1] + V2_cnt[1][1], V1_cnt[1][1] + V2_cnt[0][1])

print(ans)
N = int(input())
p = [int(x) for x in input.split()]

count = 0
p_sorted = sorted(p)
for i in range(N):
    if p_sorted[i] != p[i]:
        count += 1
if count > 2:
    print("NO")
else:
    print("YES")
        

### FIXED CODE ###

N = int(input())
p = [int(x) for x in input().split()]

count = 0
p_sorted = sorted(p)
for i in range(N):
    if p_sorted[i] != p[i]:
        count += 1
if count > 2:
    print("NO")
else:
    print("YES")
import math

n = int(input())
X = [list(map(int,input().split())) for i in range(n)]

X2 = []
for i in range(n):
    if X[i] != [0, 0]:
        X2.append(X[i][:])

X = X2[:]

n = len(X)

for i in range(n):
    X[i].append(math.atan2(X[i][1], X[i][0]))

X.sort(key=lambda x:x[2])

X += X[:]
#print(X)
ans = 0

X_sum = [[X[0][0], X[0][1]]]
for i in range(1, 2*n):
    #print(i)
    X_sum.append([X_sum[i-1][0] + X[i][0], X_sum[i-1][1] + X[i][1]])

#print(len(X_sum))

for st in range(0, n):
    for en in range(st+1, st+n+1):
        dis = [0, 0]
        for i in range(st, en):
            #print(i)
            dis[0] = X_sum[en][0] - X_sum[st][0]
            dis[1] = X_sum[en][1] - X_sum[st][1]
        #print(st,en,(dis[0]**2 + dis[1]**2)**0.5)
        ans = max(ans, (dis[0]**2 + dis[1]**2))


print(ans ** 0.5)

### FIXED CODE ###

import math

n = int(input())
X = [list(map(int,input().split())) for i in range(n)]

X2 = []
for i in range(n):
    if X[i] != [0, 0]:
        X2.append(X[i][:])

X = X2[:]

n = len(X)

if n == 0:
    print(0)
else:

    for i in range(n):
        X[i].append(math.atan2(X[i][1], X[i][0]))

    X.sort(key=lambda x:x[2])

    X += X[:]
    #print(X)
    ans = 0

    X_sum = [[X[0][0], X[0][1]]]
    for i in range(1, 2*n):
        #print(i)
        X_sum.append([X_sum[i-1][0] + X[i][0], X_sum[i-1][1] + X[i][1]])

    #print(len(X_sum))

    for st in range(0, n):
        for en in range(st+1, st+n+1):
            dis = [0, 0]
            for i in range(st, en):
                #print(i)
                dis[0] = X_sum[en][0] - X_sum[st][0]
                dis[1] = X_sum[en][1] - X_sum[st][1]
            #print(st,en,(dis[0]**2 + dis[1]**2)**0.5)
            ans = max(ans, (dis[0]**2 + dis[1]**2))


    print(ans ** 0.5)
N,u,v = map(int,input().split())
u -= 1
v -= 1
E = [set() for _ in range(N)]
for _ in range(N-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  E[a].add(b)
  E[b].add(a)

DU = [-1 for _ in range(N)]  
DV = [-1 for _ in range(N)]
def dfs(p,c,D):
  D[p] = c
  for q in E[p]:
    if D[q] == -1:
      dfs(q,c+1,D)
dfs(u,0,DU)
dfs(v,0,DV)
#print(DU)
#print(DV)
mx = 0
for du,dv in zip(DU,DV):
  if du < dv:
    mx = max(dv,mx)
print(mx-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

N,u,v = map(int,input().split())
u -= 1
v -= 1
E = [set() for _ in range(N)]
for _ in range(N-1):
  a,b = map(int,input().split())
  a -= 1
  b -= 1
  E[a].add(b)
  E[b].add(a)

DU = [-1 for _ in range(N)]  
DV = [-1 for _ in range(N)]
def dfs(p,c,D):
  D[p] = c
  for q in E[p]:
    if D[q] == -1:
      dfs(q,c+1,D)
dfs(u,0,DU)
dfs(v,0,DV)
#print(DU)
#print(DV)
mx = 0
for du,dv in zip(DU,DV):
  if du < dv:
    mx = max(dv,mx)
print(mx-1)
H,W=map(int, input().split())
A=[input() for _ in range(H)]

from collections import deque

q=deque([])
B=[[None]*H for _ in range (W)]
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            q.append((i,j))
            B[i][j]=0
dx=[-1,1,0,0]
dy=[0,0,-1,1]
while len(q)>0:
  XY=[]
  while len(q)>0:
     XY.append(q.popleft())
  for xy in XY:
    for i in range(4):
      if 0<=(xy[0]+dx[i])<=H-1 and 0<=(xy[1]+dy[i])<=W-1:
        if B[xy[0]+dx[i]][xy[1]+dy[i]]==None:
          B[xy[0]+dx[i]][xy[1]+dy[i]]=B[xy[0]][xy[1]]+1
          q.append((xy[0]+dx[i],xy[1]+dy[i]))
print(max([max(B[i]) for i in range(H)]))

### FIXED CODE ###

H,W=map(int, input().split())
A=[input() for i in range(H)]

from collections import deque

q=deque([])
B=[[None]*W for _ in range (H)]
for i in range(H):
    for j in range(W):
        if A[i][j]=="#":
            q.append((i,j))
            B[i][j]=0
dx=[-1,1,0,0]
dy=[0,0,-1,1]
while len(q)>0:
  XY=[]
  while len(q)>0:
     XY.append(q.popleft())
  for xy in XY:
    for i in range(4):
      if 0<=(xy[0]+dx[i])<=H-1 and 0<=(xy[1]+dy[i])<=W-1:
        if B[xy[0]+dx[i]][xy[1]+dy[i]]==None:
          B[xy[0]+dx[i]][xy[1]+dy[i]]=B[xy[0]][xy[1]]+1
          q.append((xy[0]+dx[i],xy[1]+dy[i]))
        else: pass
      else: pass
print(max([max(B[i]) for i in range(H)]))
a,b,c,d,e,k= map(int, input().split())

A-B = b-a
A-C = c-a
A-D = d-a
A-E = e-a
B-C = c-b
B-D = d-b
B-E = e-b
C-D = d-c
C-E = e-c
D-E = e-d

if A-B > k or A-C > k or A-D > k or A-E > k or B-C > k or B-E > k or C-D > k or C-E > k or D-E > k:
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())



if e-a > k:
    print(":(")
else:
    print("Yay!")
n,m,k=map(int,input().split())
data2=list(map(int,input().split()))
data3=list(map(int,input().split()))

data2cnt=0
data3cnt=0
total=0
count=0
maxint=n+m

for i in range(maxint):
  if len(data2)>=data2cnt+1 and int(data2[data2cnt]) < int(data3[data3cnt]):
      if k>=total+data2[data2cnt]:
        total=total+int(data2[data2cnt])
        data2cnt=data2cnt+1
  elif len(data3)>=data3cnt+1:
      if k>=total+data3[data3cnt]:
        total=total+int(data3[data3cnt])
        data3cnt=data3cnt+1
  else:
    break

print(str(data2cnt+data3cnt))

### FIXED CODE ###

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(len(A)):
    a.append(a[i]+A[i])
for i in range(len(B)):
    b.append(b[i]+B[i])
#すべてJの場合から減らしていく
ans,j=0,M
for i in range(N+1):
    if a[i] > K:
        break
    #すべてBの総和がK-a[i]より小さくなるjを測定
    while b[j] > K - a[i]:
        j -= 1
    #i+jとansのうち大きい方を答えにする。
    ans= max(ans,i+j)

print(ans)
# encoding:utf-8
import copy
import numpy as np
import random
import pandas as pd
import torch

a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        cds.append(i)

cds.reverse()
print(cds[k-1])


### FIXED CODE ###

# encoding:utf-8
import copy
import numpy as np
import random


a,b,k = map(int,input().split())

cds = []
for i in range(1,min(a,b)+1):
    if ((a%i==0) and (b%i==0)):
        cds.append(i)

cds.reverse()
print(cds[k-1])
def maxf(n):
    a = list(map(int, list(n)))
    for i, item in enumerate(a):
        if i == 0 and item != 9:
            a[i] -=1
            a[i+1:] = [9]*(len(a)-1)
            break
        elif item != 9:
            a[i-1] -= 1
            a[i:] = [9]*(len(a)-i)
            break
    return sum(a)

print(maxf(input())


### FIXED CODE ###

def maxf(n):
    a = list(map(int, list(n)))
    for i, item in enumerate(a):
        if i == 0 and item != 9:
            if a[i+1:] == [9]*(len(a)-1):break
            a[i] -=1
            a[i+1:] = [9]*(len(a)-1)
            break
        elif item != 9:
            a[i-1] -= 1
            a[i:] = [9]*(len(a)-i)
            break
    return sum(a)

print(maxf(input()))
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
c = [input().split() for l in range(H)]
b=[]
d=[]
for m in range(len(c)):
  for item in c[m]:
    item_mod = item.replace("."  , "0")
    item_mod = item_mod.replace("#" , "1")
    b.append(item_mod)
  d.append(b)
  b=[]

C_arr = np.array(d)

In = np.array(list(itertools.product([0,1] , repeat=H)))
Out = np.array(list(itertools.product([0,1] , repeat=W)))
 
ans = 0
for i in range(len(In)):
  for j in range(len(Out)):
    In_matrix = np.diag(In[i])
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == K:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
cards = []
for suit in ('S','H','C','D'):
    for num in range(1,14):
        cards.append(suit+' '+str(num))

N = raw_input()

for n in xrange(N):
    suit, number = raw_input().split()
    cards.remove(suit+' '+number)


for card in cards:
    print card

### FIXED CODE ###

cards = []
for suit in ('S','H','C','D'):
    for num in range(1,14):
        cards.append(suit+' '+str(num))

N = int(raw_input())

for n in xrange(N):
    suit, number = raw_input().split()
    cards.remove(suit+' '+number)


for card in cards:
    print card
x = raw_input()
a = int(x[0:1])
b = int(x[2:3])
aa = a*2 + b*2
bb = a*b
print str(bb) + " " + str(aa)

### FIXED CODE ###

x = map(int,raw_input().split())
aa = x[0] * x[1]
bb = x[0]*2 + x[1]*2
print aa,bb
A, B, C, D = map(int, input().split())
import math
def lcm(x, y):
    return (x*y)//math.gcd(x,y)
ret = 0
ret += B//C - (A-1)//C
ret += B//D - (A-1)//D
L = lcm(C, D)
ret -= B//L - (A-1)//L
print(B-A+1-ret)

### FIXED CODE ###

A, B, C, D = map(int, input().split())
import fractions
def lcm(x, y):
    return (x*y)//fractions.gcd(x,y)
ret = 0
ret += B//C - (A-1)//C
ret += B//D - (A-1)//D
L = lcm(C, D)
ret -= B//L - (A-1)//L
print(B-A+1-ret)
def s(a):
	for i in a:
		if i > b:
			b = i
		elif i > c:
			c = i
		else:
			return False
	return True
	
for n in range(int(raw_input())):
	print "YES" if s(map(int,raw_input().split())) else "NO"

### FIXED CODE ###

def d(x):
    b, c = 0, 0
    for a in x:
        if b < a:
             b = a
        elif c < a:
             c = a
        else:
             return False
    return True
 
n = int(raw_input())
for i in range(n):
    all = map(int, raw_input().split())
    print "YES" if d(all) else "NO"
from itertools import product, combinations_with_replacement
N=int(input())
s="abcdefghij"

def get_gen(a, N):
  for c in s[:s.index(max(a))+2]:
    t = a+c
    if len(t) == N:
      print(t)
    else:
      get_gen(t,N)
get_gen("a", N)

### FIXED CODE ###

from itertools import product, combinations_with_replacement
N=int(input())
s="abcdefghij"
 
def get_gen(a, N):
  for c in s[:s.index(max(a))+2 if a else 1]:
    t = a+c
    if len(t) == N:
      print(t)
    else:
      get_gen(t,N)

get_gen("", N)
a, b, x = map(int,input().split())

if a+b > b:
  print("YES")
else;
  print("NO")


### FIXED CODE ###

a, b, x = map(int,input().split())

if a+b >= x:
  if a > x:
    print("NO")
  else:
    print("YES")
else:
  print("NO")
q=int(input())
import math
import numpy as np
def is_prime(n):
    if n==1:return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
def is_is_prime(n):
    an=0
    if is_prime((n+1)//2)==True:
        if is_prime(n)==True:
            an=1
    return an
ko=[]
print(is_is_prime(3))
for i in range(1,10**2,2):
    ko.append(is_is_prime(i))

koko=np.cumsum(ko)

for i in range(q):
    l,r=map(int,input().split()) 
    print(koko[r]-koko[l])
    

### FIXED CODE ###

q=int(input())
import math
import numpy as np
def is_prime(n):
    if n==1:return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
def is_is_prime(n):
    an=0
    if is_prime((n+1)//2)==True:
        if is_prime(n)==True:
            an=1
    return an
ko=[]
for i in range(1,10**5,2):
    ko.append(is_is_prime(i))

koko=np.cumsum(ko)

for i in range(q):
    l,r=map(int,input().split()) 
    if l==1:
        ans=koko[(r-1)//2]-koko[(l-1)//2]
    else:
        ans=koko[((r-1)//2)]-koko[((l-1)//2)-1]
    print(ans)
return "ABC" if int(input()) < 1000 else "ABD"

### FIXED CODE ###

print('ABC') if int(input()) < 1000 else print('ABD')
N=int(input())
H=[int(s) for s in input().split()]

count_max=0
count=0
for i in range(N-1):
    if H[i]-H[i+1] >= 0:
        count+=1
    else:
        count=0
    if count > count_max:
        count_max=count
        X=j

print(count_max)

### FIXED CODE ###

N=int(input())
H=[int(s) for s in input().split()]

count_max=0
count=0
for i in range(N-1):
    if H[i]-H[i+1] >= 0:
        count+=1
        if count > count_max:
            count_max=count
    else:
        count=0

print(count_max)
rainy_days = input('3日間で連続した雨の日は？:')
if rainy_days = RRR:
    print(3)
elif rainy_days == RRS or SRR:
    print(2)
elif rainy_days == RSR or RSS or SSR or SRS:
    print(1)
elif rainy_days == SSS:
    print(0)

### FIXED CODE ###

r = input()
if r == 'RRR':
    print(3)
elif r == 'RRS' or r == 'SRR':
    print(2)
elif r == 'RSR' or r == 'RSS' or r =='SSR' or r =='SRS':
    print(1)
elif r == 'SSS':
    print(0)
a,b=map(input().split())
print(a*b)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
from sys import stdin
N,K = [int(x) for x in stdin.readline().rstrip().split()]
H = [int(x) for x in stdin.readline().rstrip().split()]
INF = float(inf)
dp = [INF]*N
dp[0] = 0
dp[1] = abs(H[0]-H[1])
for i in range(2,N):
    for j in range(1,min(i+1,K+1)):
        dp[i] = min(dp[i],dp[i-j]+abs(H[i]-H[i-j]))
print(dp[-1])

### FIXED CODE ###

from sys import stdin
N,K = [int(x) for x in stdin.readline().rstrip().split()]
H = [int(x) for x in stdin.readline().rstrip().split()]
INF = float("inf")
dp = [INF]*N
dp[0] = 0
dp[1] = abs(H[0]-H[1])
for i in range(2,N):
    for j in range(1,min(i+1,K+1)):
        dp[i] = min(dp[i],dp[i-j]+abs(H[i]-H[i-j]))
print(dp[-1])
a, b, c, k = map(int, input().split())
print(min(a, k, a-(k-a-b))

### FIXED CODE ###

a, b, c, k = map(int, input().split())
print(min(a, k, a*2+b-k))
z,y,x=map(int,input())
z-=x
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)

### FIXED CODE ###

z,y,x=map(int,input().split())
z-=x*2+y
count=1
while(1):
  z-=y+x
  if z<0:
    break
  count+=1
print(count)