Harryxun/stf_run huggingface dataset:
def woo(x, y):
    for i in range(0,x):
        res[i] = 0
    z = list(map(int, input().split()))
    for i in range(1, x):
        res[i] = min(abs(z[i] - z[j]) + res[j] for j in range(max(0, i - y), i))
    return res

if __name__ == '__main__':
    x, y = map(int, input().split())
    r = woo(x, y)
    f = len(r)-1
    print(r[f])



### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    a = [0] * n
    a[0] = 0
    for i in range(1, n):
        a[i] = min([a[j] + abs(h[i] - h[j]) for j in range(max(0, i - k), i)])
    print(a[-1])
 
if __name__ == '__main__':
    main()
a, b = map(int, input().split())
if a<=9 and b<=:
    print(a*b)
else:
    print("-1")

### FIXED CODE ###

a, b = map(int, input().split())
if a<=9 and b<=9:
    print(a*b)
else:
    print("-1")
from sys import stdin

n=int(input())

for line in stdin:
    x=list(map(int,line.split()))
    x.sort()
    y=map(lambda t:t^2,x)
    if y[0]+y[1]==y[2]: print("YES")
    else: print("NO")

### FIXED CODE ###

import sys

for line in sys.stdin: print(len(str(sum(map(int,line.split())))))
#import numpy as np


def acinput():
    return list(map(int, input().split(" ")))



mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact



H,W,D=acinput()
#Ad={}
Ad=[0]*(H*W+1)
for i in range(H):
    ar=acinput()
    for j,sar in enumerate(ar):
        #Ad[sar]=np.array((i,j))
        Ad[sar] = (i, j)

dp = [[0 for j in range(H*W+1)]for i in range(H*W+1)]

for x in range(1, H*W+1):
    dp[x][x]=0

for x in range(1,H*W+1):
    y=x+D
    while True:
        if y > H*W:
            break
        #print(x,y)
        #tmp = Ad[y]-Ad[y-D]
        #S = np.sum(np.abs(tmp[0])+abs(tmp[1]))
        #tmp = Ad[y]-Ad[y-D]
        S = abs(Ad[y][0]-Ad[y-D][0])+abs(Ad[y][1]-Ad[y-D][1])

        dp[x][y]=dp[x][y-D]+S
        y+=D
        

#print(np.array(dp))

Q=int(input())
for i in range(Q):
    l,r=acinput()
    print(dp[l][r])


#print(Ad)
#print(np.array(dp))



### FIXED CODE ###


#import numpy as np


def acinput():
    return list(map(int, input().split(" ")))


mod = 10**9+7


def factorial(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact


H, W, D = acinput()
# Ad={}
Ad = [0]*(H*W+1)
for i in range(H):
    ar = acinput()
    for j, sar in enumerate(ar):
        # Ad[sar]=np.array((i,j))
        Ad[sar] = (i, j)

#dp = [[0 for j in range(H*W+1)]for i in range(H*W+1)]
d = [0]*(H*W+1)

# for x in range(1, H*W+1):
#    dp[x][x]=0

y = D+1
while True:
        if y > H*W:
            break
        # print(x,y)
        #tmp = Ad[y]-Ad[y-D]
        #S = np.sum(np.abs(tmp[0])+abs(tmp[1]))
        #tmp = Ad[y]-Ad[y-D]
        S = abs(Ad[y][0]-Ad[y-D][0])+abs(Ad[y][1]-Ad[y-D][1])

        # dp[x][y]=dp[x][y-D]+S
        d[y] = d[y-D]+S
        y += 1


# print(np.array(dp))

Q = int(input())
for i in range(Q):
    l, r = acinput()
    print(d[r]-d[l])


# print(Ad)
# print(np.array(dp))
#print(d)
n = [map(int,input().split())]
for i in range(2):
  n.pop(i)
  n.append(n[i])
  
for i in range(3):
  print(n[i],end='')

### FIXED CODE ###

n = list(map(int,input().split()))
m = []
for i in range(2):
    m.append(n[0])
    n.pop(0)
    
n.append(m[0])
n.append(m[1])
  
print(*n)
list=map(int,input().split)
sorted = sort(list)
print(' '.join(map(str, sorted)))


### FIXED CODE ###

InData=input().split()
InDataM = [int(i) for i in InData]
result = sorted(InDataM)
print(' '.join(map(str, result)))
import sys
input = sys.stdin.readline


class unionFind:
    parent = []
    count = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.count = [1 for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            self.count[x] = self.count[self.parent[x]]
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.count[y] += self.count[x]
            self.count[x] = self.count[y]
            return


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

G = unionFind(N)
for a, b in AB:
    G.unite(a, b)

for i in range(N):
    G.root(i)

ans = [G.count[i] - 1 for i in range(N)]

for a, b in AB:
    ans[a-1] -= 1
    ans[b-1] -= 1

for c, d in CD:
    if G.same(c-1, d-1):
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)


### FIXED CODE ###


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)


class unionFind:
    parent = []
    count = []

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.count = [1 for i in range(N)]

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.count[y] += self.count[x]
            self.count[x] = self.count[y]
            return

    def getCount(self, x):
        self.count[x] = self.count[self.root(x)]
        return(self.count[x])


N, M, K = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]

CD = [tuple(map(int, input().split())) for i in range(K)]

G = unionFind(N)
for a, b in AB:
    G.unite(a, b)

for i in range(N):
    G.root(i)

ans = [G.getCount(i) - 1 for i in range(N)]
# print(ans)
# print(G.count)
for a, b in AB:
    ans[a-1] -= 1
    ans[b-1] -= 1

for c, d in CD:
    if G.same(c, d):
        ans[c-1] -= 1
        ans[d-1] -= 1

print(*ans)
a,b,c=map(int,input().split())
if (a,b)==(0,0):
  print(a,b)
  exit(0)
if(a-k<0):
  print (0,k-(b-a))
else:
        print(a,b)


### FIXED CODE ###

a, b, k = map(int, input().split())
if (a, b) == (0, 0):
    print(0, 0)
    exit(0)
if a - k < 0:
    print(0, max(0, b - (k-a)))
else:
    print(a-k, b)
a,b = int(input())

if a*b %% 2 == 0:
  print("Even")
else:
    print("odd")

### FIXED CODE ###

a,b = map(int, input().split())
 
if a*b % 2 == 0:
	print("Even")
else:
	print("Odd")
n = int(input())
v = list(map(int, input().split))
c = list(map(int, input().split))
d = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))


### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))
def solve(i, j):
    if i = 0:
        return True
    if j < n and A[0] <= i <= sum(A[j:]):
        x = solve(i-A[j], j+1)
        if x:
            return x
        y = solve(i, j+1)
        if y:
            return y
 
n = input()
A = sorted(map(int, raw_input().split()))
p = input()
m = map(int, raw_input().split())
 
for k in m:
    if solve(k, 0):
        print "yes"
    else:
        print "no"

### FIXED CODE ###

n = input()
A = map(int, raw_input().split())
q = input()
M = map(int, raw_input().split())
    
def solve(i, m):
  if m==0:
    return True
  if i>=n or m>sum(A):
    return False
  res=solve(i+1,m) or solve(i+1,m-A[i])
  return res
    
    
for m in M:
  if solve(0,m):
    print"yes"
  else:
    print"no"
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans= []
for i in range(l, r):
    for k in range(l+1, r+1):
        ans.append(i * k % 2019)
print(min(ans))

### FIXED CODE ###

L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans = []
if R - L >= 2019:
    print(0)
else:
    if l >= r:
        print(0)
    else:
        for i in range(l, r):
            for k in range(l+1, r+1):
                ans.append(i * k % 2019)                
    print(min(ans))
a,b,c,d = map(int,input().split())
answer = 0
ac =a*c
ad = a*d
bc = b*C
bd = b*d
answer = max(ac,ad)
answer = max(answer,bc)
answer = max(answer,bd)
print(answer)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
answer = 0
ac =a*c
ad = a*d
bc = b*c
bd = b*d
answer = max(ac,ad)
answer = max(answer,bc)
answer = max(answer,bd)
print(answer)
a = int(input())
b = int(input())

if a * b % 2 == 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

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

if a * b % 2 == 0:
    print('Even')
else:
    print('Odd')
import math
from functools import reduce
n = int(input())
a = list(map(int, input().split()))

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans = 1
for i in range(n):
    b = a[:i] + a[i + 1:]
    ans = max(ans, gcd_list(b))

print(ans)


### FIXED CODE ###

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


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

ans = 1
if n == 2:
    print(max(a))
else:
    l = [0] * (n + 1)
    r = [0] * (n + 1)
    for i in range(1, n):
        l[i] = gcd(l[i - 1], a[i - 1])
        r[n - i] = gcd(r[n - i + 1], a[-i])
    for i in range(n):
        m = gcd(l[i], r[i + 1])
        ans = max(ans, m)
    print(ans)
x,y = map(int,input().split())
a = 4 * x - y
b = y - 2*x
if a/2 == a//2 and a >= 0 and b/2 == b//2 and b >= 0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

x = input()
a,b,c,d,e = map(int,x.split())
print(15 - a-b-c-d-e)
def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    else if a < b:
        print "a < b"
    else :
        print "a == b"

aizu001 ()

### FIXED CODE ###

def aizu001 ():
    xs = map(int,raw_input().split())
    a = xs[0]
    b = xs[1]
    if a > b:
        print "a > b"
    elif a < b:
        print "a < b"
    else :
        print "a == b"

aizu001()
S = int(input())
h = S//3600
m = (S//60)-60*(S//3600)
s = S//60
a = str(h)
b = str(m)
c = str(s)
print("a":"b":"c")



### FIXED CODE ###

S = int(input())
h = S//3600
m = (S//60)-60*(S//3600)
s = S%60
print('{}:{}:{}'.format(h,m,s))
waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
waitTime = sorted(waitTime, reverse= True)
_time += (len(waitTime) - 1) * 10
_time += min(waitTime)
print(_time)


### FIXED CODE ###

waitTime = []
_time = 0
for i in range(0,5):
    t, mod = divmod(int(input()), 10)
    _time += (t * 10)
    if mod != 0:
        waitTime.append(mod)
if len(waitTime) > 0:
    waitTime = sorted(waitTime, reverse= True)
    _time += (len(waitTime) - 1) * 10
    _time += min(waitTime)
print(_time)
n = int(input())
i_s = input()
out = ''
for s in i_s:
       s = ord(s)
       s = s + n
       if s >= 91 :
            s=s%26 + 25
       s = chr(s)
       out += s

print(out)

### FIXED CODE ###

n = input()
if n == 'SUN':
  print('7')
elif n == 'MON':
  print('6')
elif n == 'TUE':
  print('5')
elif n == 'WED':
  print('4')
elif n == 'THU':
  print('3')
elif n == 'FRI':
  print('2')
elif n == 'SAT':
  print('1')
def solve(string):
    nl = map(int, string.split())
    l = sorted(list(nl)[1:])
    return "Yes" if sum(l[:-1]) > l[-1] else "No"


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

def solve(string):
    l = map(int, string.split())
    l= sorted(l)
    return "Yes" if sum(l[:len(l)-1]) > l[-1] else "No"


if __name__ == '__main__':
    input()
    print(solve(input()))
import networkx as nx

N, M = map(int,input().split())
G = nx.Graph()

for _ in range(M):
    G.add_edge(map(int,input().split()))

print_str = 'Yes\n'
for i in range(2, N + 1):
    ans = nx.shortest_path(G, source = i, target = 1)
    print_str += (str(ans[1]) + '\n')
        
print(print_str[:-1])

### FIXED CODE ###

from collections import deque
N, M = map(int,input().split())
graph = [[] for i in range(N + 1)]
for _ in range(M):
    A, B = map(int,input().split())
    graph[A].append(B)
    graph[B].append(A)

queue = deque([1]) 
flag = [-1] * (N + 1)

while queue: 
    node = queue.popleft()
    children = graph[node] 
    for child in children:
        if flag[child] == -1:
            flag[child] = node
            queue.append(child)

if -1 in flag[2:]:
    print('No')
else:
    print('Yes')
    print(*flag[2:], sep='\n')
N,K = map(int, input().split())
A =[0]
B=list(map(int, input().split()))
for m in range(N):
    A.append(B[m])
place=set([])
p=[]
i=1
count=0
while i not in place:
    place.add(i)
    p.append(i)
    i=A[i]
    count+=1
if count>=K:
    print(p[K])
else:
    loop=[i]
    start=i
    j=A[i]
    count+=1
    while j!=start:
        loop.append(j)
        j=A[j]
        count+=1
    if count>=K:
        print(loop[K-len(p)])
    num=(K-count)%len(loop)
    print(loop[num])

### FIXED CODE ###

N,K = map(int, input().split())
A =[0]
B=list(map(int, input().split()))
for m in range(N):
    A.append(B[m])
place=set([])
p=[]
i=1
count=0
while i not in place:
    place.add(i)
    p.append(i)
    i=A[i]
    count+=1
if count>K:
    print(p[K])
else:
    loop=[i]
    start=i
    j=A[i]
    count+=1
    while j!=start:
        loop.append(j)
        j=A[j]
        count+=1
    if count>K:
        print(loop[K-len(p)])
    else:
        num=(K-count)%len(loop)
        print(loop[num])
X = int(input())
'''
numの順番によっては買うことが出来ない金額が発生するためNG
num = [105, 104, 103, 102, 101, 100]

f = 0
for i in range(2**6):
    XX = X
    for j in range(6):
        if (i>>j)&1:
            XX %= num[j]
            if XX == 0:
                f = 1
print(f)
'''

num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X)]
dp[0] = 1
f = 1

for i in range(X):
    for j in num:
        if i-j >= 0 and dp[i-j]:
            dp[i] = 1

for i in num:
    if not dp[X-i]:
        f = 0

print(f)

### FIXED CODE ###

X = int(input())
num = [105, 104, 103, 102, 101, 100]

dp = [0 for _ in range(X+1)]
dp[0] = 1
f = 1

for i in range(X+1):
    for j in num:
        if i-j >= 0:
            if dp[i-j]:
                dp[i] = 1

print(dp[X])
n,k = map(int,input().split())
lst = []
for _ in range(k):
  d = int(input())
  lstx = [int(input()) for _ in range(d)]
  lst += lstx
setans = set(lst)
print(n - len(setans))

### FIXED CODE ###

n,k = map(int,input().split())
lst = []
for _ in range(k):
  d = int(input())
  lstx = list(map(int,input().split()))
  lst += lstx
setans = set(lst)
print(n - len(setans))
N , M =map(int,input().split())
A_n =list(map(int,input().split()))

B_n=sorted(A_n,reverse=True)
i =0
count = M
while B_n[i] >= sum(B_n)/(4*M) and count>0:
    i +=1
    count -=1
if count == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N , M =map(int,input().split())
A_n =list(map(int,input().split()))

B_n=sorted(A_n,reverse=True)

if B_n[M-1] >= sum(B_n)/(4*M) :
    print('Yes')
else:
    print('No')
s = input()

print(s[0] +　str(len(s)-2) + s[-1])


### FIXED CODE ###

s = input()

print(s[0]+str(len(s)-2)+s[-1])
a = input()
if a == 'Sunny':
  print('Cloudy')
elif a == 'Cloudy':
  print('Rainy')
else
  print('Sunny')

### FIXED CODE ###

a = input()
if a == 'Sunny':
  print('Cloudy')
elif a == 'Cloudy':
  print('Rainy')
elif a == 'Rainy':
  print('Sunny')
S = list(input())
K = int(input())

pre = S[0]
flg = 0
cnt = 0
cnt_list =[]

for i in range(1, len(S)):
    cnt += 1
    if flg == 1:
        flg = 0
        pre = S[i]
        continue
    if S[i] == pre:
        cnt_list.append(cnt)
        flg = 1
    pre = S[i]

if S[0] == S[-1] and (S[-1] == S[-2] or S[0] == S[1]):
    print(len(cnt_list)*K)
elif S[0] == S[-1]:
    print(len(cnt_list)*K+K)
else :
    print(len(cnt_list)*K)

### FIXED CODE ###

S = input()
K = int(input())
 
if len(S) == 1:
    print(K // 2)
    exit()

chkd, flg = 0, 1
cnt = 0
cnt_list =[]
 
for i in range(1, len(S)):
    cnt += 1
    if S[i] != S[i-1]:
        flg = 0
    if chkd == 1:
        chkd = 0
        continue
    if S[i] == S[i-1]:
        cnt_list.append(cnt)
        chkd = 1
 
# 2個連続の場合
S2 = S*2
chkd = 0
cnt = 0
cnt_list2 =[]
 
for i in range(1, len(S2)):
    cnt += 1
    if chkd == 1:
        chkd = 0
        continue
    if S2[i] == S2[i-1]:
        cnt_list2.append(cnt)
        chkd = 1

if flg: # 全部同じ場合
    print(len(S)*K // 2)
elif S[0] == S[-1]:
    print(len(cnt_list) + (len(cnt_list2)-len(cnt_list)) * (K - 1))
else :
    print(len(cnt_list)*K)
from collections import deque
import math
mod = 10**9+7
N,K = map(int,input().split())

def Perm(n,r):#aPb
    return math.factorial(n) // math.factorial(n - r)

K_2perm =[1,K-2]
pres = K-2
#K_2perm[i] = K-2Pi
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)
child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]
    child[a].append(b)
    child[b].append(a)
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True

x = len(child[0]) + 1
ans = (K_2perm[x] *(K-1)*K//(K-1-x)//(K-x) )%mod
while queue:
    cur = queue.pop()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)



### FIXED CODE ###

from collections import deque
import math
import sys
mod = 10**9+7
N,K = map(int,input().split())

#k
Kperm =[1,K]
pre = K
for i in range(2,K+1):
    pre = (pre*(K+1-i))%mod
    Kperm.append(pre)


#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)

if len(child[0])>=K:
    print(0);sys.exit()
ans = Kperm[len(child[0])+1]
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0 and len(child[cur])>=K:
        print(0)
        sys.exit()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)
A,B,C,K = map(int,input().split())
if K<=A:
    print(K)
elif A<K and K<=A+B:
    print(A)
else:
    print(A-(K-A-B))

### FIXED CODE ###

S = input()
T = input()
if len(T)==1:
    print("No")
elif S==T[0:-1]:
    print("Yes")
else:
    print("No")
s = input()
slen = len(s)

kotae = 0
for i in range(2**(slen-1)):
    for j in range(slen-1):
        if i & 1<<j:
            si = si[:slen-j]+"+"+si[slen-j:]
        else:
            pass
    kotae += eval(si)

print(kotae)

### FIXED CODE ###

s = input()
slen = len(s)

def keisan(s):
    smod = s
    wa = 0
    while smod.count("+") != 0:
        wa += int(smod[:smod.index("+")])
        smod = smod[smod.index("+")+1:]
    wa += int(smod)
    return wa

kotae = 0
for i in range(2**(slen-1)):
    ibin = bin(i)[2:]
    si = s
    for j in range(1, len(ibin)+1):
        if ibin[-j] == "1":
            si = si[:slen-j]+"+"+si[slen-j:]
        else:
            pass
    kotae += keisan(si)

print(kotae)
import math
N = int(input())
K = list(map(int,input().split()))
hashmap = {}
for k in K:
  if k not in hashmap:
    hashmap[k] = 0
  hashmap[k]+=1
total = 0
for v in hashmap.values():
  total+=math.factorial(v) // (math.factorial(v - 2) * 2)

for k in K:
  print(total-(hashmap[k]-1))

### FIXED CODE ###

import math
N = int(input())
K = list(map(int,input().split()))
hashmap = {}
for k in K:
  if k not in hashmap:
    hashmap[k] = 0
  hashmap[k]+=1
total = 0
for v in hashmap.values():
  if v>=2:
  	total+=math.factorial(v) // (math.factorial(v - 2) * 2)

for k in K:
  print(total-(hashmap[k]-1))
import sys
import bisect
import math
input = sys.stdin.readline

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

mc = max(l)[1]
mc_sqrt = math.sqrt(mc)

prime = [i for i in range(2, mc + 1)]
c = 0
while True:
    if c >= len(prime):
        break
    t = prime[c]
    prime = [v for v in prime if v == t or v % t != 0]
    c = c + 1
    if c >= mc_sqrt:
        break
        
cum = [0 for i in range(mc + 1)]
for i in range(len(cum)):
    prime_index = bisect.bisect_left(prime, i)
    
    n2 = (i + 1) / 2
    prime_index2 = bisect.bisect_left(prime, n2)
    if len(prime) > prime_index and len(prime) > prime_index2 and prime[prime_index] == i and prime[prime_index2] == n2:
        cum[i] = cum[i - 1] + 1
    else:
        if i - 1 < 0:
            cum[i] = 0
        else:
            cum[i] = cum[i - 1]
        
for t in l:
    x, y = t[0], t[1]
    p = 0
    if 0 <= x - 1:
        p = cum[x] - cum[x - 1]
    if x != y:
        p += cum[y] - cum[x]
    print(p)


### FIXED CODE ###

import sys
import bisect
import math
input = sys.stdin.readline

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

mc = 0
for v in l:
    mc = max(mc, v[1])
mc_sqrt = math.sqrt(mc)

prime = [i for i in range(2, mc + 1)]
c = 0
while True:
    if c >= len(prime):
        break
    t = prime[c]
    prime = [v for v in prime if v == t or v % t != 0]
    c = c + 1
    if c >= mc_sqrt:
        break
        
cum = [0 for i in range(mc + 1)]
for i in range(len(cum)):
    prime_index = bisect.bisect_left(prime, i)
    
    n2 = (i + 1) / 2
    prime_index2 = bisect.bisect_left(prime, n2)
    if len(prime) > prime_index and len(prime) > prime_index2 and prime[prime_index] == i and prime[prime_index2] == n2:
        cum[i] = cum[i - 1] + 1
    else:
        if i - 1 < 0:
            cum[i] = 0
        else:
            cum[i] = cum[i - 1]

for t in l:
    x, y = t[0], t[1]
    p = 0
    if 0 <= x - 1:
        p = cum[x] - cum[x - 1]
    if x != y:
        p += cum[y] - cum[x]
    print(p)
a=list(map(int,input().split))
a=sorted(a)
d=str(a[2])+str(a[1])
print(int(d)+a[0])

### FIXED CODE ###

a=list(map(int,input().split()))
a=sorted(a)
d=str(a[2])+str(a[1])
print(int(d)+a[0])
[a,b]=map(int,input(),split())
print(a*b,a*2+b*2)

### FIXED CODE ###

[a,b] = map(int,input().split())
print(a*b,(a+b)*2)
n = int(input())
keys = list(map(int, input().split()))
#n=5
#heap_keys = [7,8,1,2,3]
heap = []
for i,x in enumerate(heap_keys):
    node = i+1
    key = x
    parent_key = heap_keys[int(node/2)-1] if i > 0 else None
    left_key = heap_keys[2*node-1] if 2*node-1 <len(heap_keys) else None
    right_key = heap_keys[2*node] if 2*node <len(heap_keys) else None
    heap.append({"node":node, "key":x, "parent_key":parent_key, "left_key":left_key, "right_key":right_key})

for h in heap:
    out_str = "node %s: key = %s, " % (h["node"],h["key"])
    if h["parent_key"]:out_str += "parent key = %s, " % h["parent_key"]
    if h["left_key"]:out_str += "left key = %s, " % h["left_key"]
    if h["right_key"]:out_str += "right key = %s, " % h["right_key"]
    print(out_str)

### FIXED CODE ###

n = int(input())
heap_keys = list(map(int, input().split()))
heap = []
for i,x in enumerate(heap_keys):
    node = i+1
    key = x
    parent_key = heap_keys[int(node/2)-1] if i > 0 else None
    left_key = heap_keys[2*node-1] if 2*node-1 <len(heap_keys) else None
    right_key = heap_keys[2*node] if 2*node <len(heap_keys) else None
    heap.append({"node":node, "key":x, "parent_key":parent_key, "left_key":left_key, "right_key":right_key})

for h in heap:
    out_str = "node %s: key = %s, " % (h["node"],h["key"])
    if h["parent_key"]:out_str += "parent key = %s, " % h["parent_key"]
    if h["left_key"]:out_str += "left key = %s, " % h["left_key"]
    if h["right_key"]:out_str += "right key = %s, " % h["right_key"]
    print(out_str)
x,y=input().split()
x=int(x)
y=int(y)
a=[input() for i in range(x)]
c=""
for i in range(y+2):
  c=c+"#"
print(c)
for i in range(y-1):
  print("#"+a[i]+"#")
print(c)


### FIXED CODE ###

x,y=input().split()
x=int(x)
y=int(y)
a=[input() for i in range(x)]
c=""
for i in range(y+2):
  c=c+"#"
print(c)
for i in range(x):
  print("#"+a[i]+"#")
print(c)
a = int(input())
s = input()

if a < 3200:
  print('red')
 else:
  print(s)

### FIXED CODE ###

a = int(input())
s = input()
 
if a < 3200:
  print('red')
else:
  print(s)