Harryxun/stf_run huggingface dataset:
import sys
 
stdin = sys.stdin

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

check_point = []
inf = 10 ** 18

# AC文字列のAの位置をリストに収めた
for i in range(inf):
  out = S.find('AC')
  if out < 0:
    break
  else:
    S = S[out+2:]
    check_point.extend([(out + len(check_point) * 2)])
  

# 指定した文字列範囲を含む要素数を表示
for i in range(Q):
  start, end  = map(int, stdin.readline().split())
  print(len([i for i in check_point if (start - 1 <= i) and (i + 1 < end)]))


### FIXED CODE ###

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

dct_a_tmp = {}
dct_b = {}
for n in range(N):
  a,b = map(int, input().split())
  dct_a_tmp[n] = a
  dct_b[n] = b

# 安い順にkeyをソート
list_a = sorted(dct_a_tmp.items(), key=lambda x: x[1])


# 安い順に買っていく
'''
1.不足本数を計算
2.不足本数と購入できる本数を比較する
a.全部購入していいようなら通常購入
b.ダメなら、購入していい本数だけ購入
'''
cnt_buied = 0
cost = 0
inf = 10 ** 18


for i in range(inf):
  want_buy = M - cnt_buied 
  
  if dct_b[list_a[i][0]] <= want_buy:
    cost += list_a[i][1] * dct_b[list_a[i][0]]
    cnt_buied += dct_b[list_a[i][0]] 
  else:
    cost += list_a[i][1] * want_buy
    cnt_buied += want_buy
    
  if cnt_buied >= M:
    break

print(cost)
N = int(input())
d = [int(input()) for k in range(N)]
sum = 0
for i in range(N):
    for j in range range(i-1):
        sum = sum + d[i] * d[j]
print(sum)

### FIXED CODE ###

N = int(input())
d = list(map(int,input().split()))
sum = 0
for i in range(N):
    if i > 0:
        for j in range(i):
            sum = sum + d[i] * d[j]
print(sum)
n , a = map(int,input().split())
if n%500 < a:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
a = int(input())

if n%500 <= a:
  print("Yes")
else:
  print("No")
n = int(input())
c0, c1, c2, c3 = 0
for _ in range(n):
    if _ == "AC":
        c0 += 1
    if _ == "WA":
        c1 += 1
    if _ == "TLE":
        c2 += 1
    if _ == "RE":
        c3 += 1
print("AC x", c0)
print("WA x", c1)
print("TLE x", c2)
print("RE x", c3)

### FIXED CODE ###

n = int(input())
count_ac, count_wa, count_tle, count_re = 0, 0, 0, 0
for i in range(n):
    s = input()
    if s == "AC":
        count_ac += 1
    if s == "WA":
        count_wa += 1
    if s == "TLE":
        count_tle += 1
    if s == "RE":
        count_re += 1

print("AC x", count_ac)
print("WA x", count_wa)
print("TLE x", count_tle)
print("RE x", count_re)
k = int(input())

print(int(k-1)/2**2))

### FIXED CODE ###

k = int(input())

if k % 2 == 0:
    print(int((k/2)**2))
else:
    print(int((k-1)/2 * (k+1)/2))
dbg = False

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

if a > b:
    x, y = a, b
else:
    x, y = b, a

for i in range(1, int((y+1)/2)+1):
    if y % i == 0:
        gcd_tmp = int(y / i)
        if dbg: print(gcd_tmp)
        if x % gcd_tmp == 0:
            print(gcd_tmp)
            exit()

print(1)

### FIXED CODE ###

dbg = False

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

if a > b:
    x, y = a, b
else:
    x, y = b, a

divs = [1]
for i in range(1, int((y+1)/2)+1):
    gcd_tmp = int(y / i)
    if dbg: print('%d, %d' % (i, gcd_tmp))
    if i > gcd_tmp:
        break
    if y % i == 0:
        if x % gcd_tmp == 0:
            print(gcd_tmp)
            exit()
        elif x % i == 0:
            divs.append(i)

print(max(divs))
k, x = [int(i) for i in input().split()]
minimum = 1_000_000 - k + 1 if x + k - 1 > 1_000_000 else max(x - k + 1, -1_000_000)
maximum = -1_000_000 + k - 1 if x - k - 1 < -1_000_000 else min(x + k - 1, 1_000_000)
print(*range(minimum, maximum + 1))

### FIXED CODE ###

k, x = [int(i) for i in input().split()]
minimum = 1000000 - k + 1 if x + k - 1 > 1000000 else max(x - k + 1, -1000000)
maximum = -1000000 + k - 1 if x - k - 1 < -1000000 else min(x + k - 1, 1000000)
print(*range(minimum, maximum + 1))
c=input()
if c in"aiueo"
  print("vowel")
else:
  print("consonant")

### FIXED CODE ###

c=input()
if "a" in c or "i" in c or "u" in c or "e" in c or "o" in c:
  print("vowel")
else:
  print("consonant")
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
mm = a.pop()
ind = bisect.bisect_left(a,mm/2)
print(mm,a[ind])

### FIXED CODE ###

from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
ma = a.pop()
mi = -1
dif = mod
for i in range(n-1):
    if abs(ma/2-a[i]) < dif:
        mi = i
        dif = abs(ma/2-a[i])
print(ma,a[mi])
import sys
# Python < 3.5
# from math import gcd
# Python >= 3.5
from fractions import gcd

def gcdall(*args):
  if len(args) == 1:
    return args[0]
  return gcdall(gcd(args[0], args[1]), *args[2:])

N, X = map(int, input().split())
d = [abs(int(s) - X) for s in input().split()]

print(gcdall(*d))


### FIXED CODE ###

from functools import reduce
# Python < 3.5
# from math import gcd
# Python >= 3.5
from fractions import gcd

N, X = map(int, input().split())
d = [abs(int(s) - X) for s in input().split()]

print(reduce(gcd, d, 0))
n = int(input())
if n < 3:
  print(0)
  exit()
l = map(int,input().split())
l.sort()
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i] + l[j] > l[k] and l[i] != l[j] and l[j] != l[k]:
        c += 1
print(c)

### FIXED CODE ###

n = int(input())
if n < 3:
  print(0)
  exit()
l = map(int,input().split())
l = sorted(l)
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i] + l[j] > l[k] and l[i] != l[j] and l[j] != l[k]:
        c += 1
print(c)
def main():
  n, m = input_list()
  if n >= m:
    print(0)
    exit(0)
  x = input_list()
  sx = list(sorted(x))
  diffs = []
  for i, xv in enumerate(range(m-1)):
    diff = abs(sx[i+1]-sx[i])
    diffs.append((i, diff))
  sd = list(sorted(diffs, key=lambda x: x[1], reverse=True))
  
  points = []
  for i in range(n-1):
    points.append(sd[i][0])
  
  r = chunk_list(points, sx)
  ans = 0
  for v in r:
    ans += max(v) - min(v)
  print(ans)
    

def chunk_list(index_list, data):
  result = []
  start = 0
  for i in index_list:
    result.append(data[start:i+1])
    start = i+1
  result.append(data[start:len(data)])
  return result
  
def count_section_by_zero(data):
  count = 0
  flg = False
  start = 0
  for i, d in enumerate(data):
    if flg is False and d != 0:
      count += 1
      flg = True
      
    if d == 0:
      flg = False
  return count
  
def input_list():
  return list(map(int, input().split()))

def input_list_str():
  return map(str, input().split())

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

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

# 2で割り切れる回数
def divide_two(arg):
  c = 0
  while True:
    if c >= 2:
      break
    if arg % 2 != 0:
      break
    arg //= 2
    c += 1
  return c

# 素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

import math
import fractions
import collections
from functools import reduce
main()

### FIXED CODE ###

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

if M <= N:
  print(0)
  exit(0)
  
X.sort()
intervals = []
for i in range(M-1):
  intervals.append(X[i+1] - X[i])
  
intervals.sort()
R = max(X) - min(X)
for _ in range(N-1):
  R -= intervals.pop()
  
print(R)
def main():
    N = int(input())
    A = int(input())
    B = int(input())
    counter = 0

    for n in range(1, N+1):
        sum = int(n / 10) + n % 10
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, A, B = map(int, input().split())
    counter = 0

    for n in range(1, N+1):
        sum = 0
        for digit in str(n):
            sum += int(digit)
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()
n = int(input())
a = list(map(int,input().split()))

minus = []
plus = []

for i in a:
    elif i < 0:
        minus.append(i)
    else:
        plus.append(i)
plus.sort()
minus.sort(reverse=True)

if len(plus)*len(minus) == 0:
    plus[133],minus[133]
    print(sum(plus)-sum(minus))
    exit()

if len(minus) % 2==0:
    print(sum(plus) - sum(minus))
    exit()

if - minus[0] < plus[0]:
    print(sum(plus) - sum(minus) +2*minus[0])
else:
    print(sum(plus) - sum(minus) -2*plus[0])

### FIXED CODE ###

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

minus = []
plus = []

for i in a:
    if i < 0:
        minus.append(i)
    else:
        plus.append(i)
plus.sort()
minus.sort(reverse=True)

if len(plus)==0:
    if len(minus)%2==0:
        print(-sum(minus))
    else:
        print(-sum(minus)+2*minus[0])
    exit()

if len(minus)==0:
    print(sum(a))
    exit()

if len(minus) % 2==0:
    print(sum(plus) - sum(minus))
    exit()

if - minus[0] < plus[0]:
    print(sum(plus) - sum(minus) +2*minus[0])
else:
    print(sum(plus) - sum(minus) -2*plus[0])
W, H, x, y, r = map(int, raw_input().split))

if 0 <= x-r and x+r <= W and 0 <= y-r and y+r <= H:
 print 'Yes'
else:
 print 'No'

### FIXED CODE ###

W, H, x, y, r = map(int, raw_input().split())
 
if r <= x and x + r <= W and r <= y and y + r <= H:
 print 'Yes'
else:
 print 'No'
num = int(input())
x = input().split()
count = 0
TF = True
while TF: 
    count += 1
    for i in range(0,num):
        number = int(x[i])
        if(number%2==0):
            number = number/2
            x[i] =  number
            TF = True
        else:
            TF =False
print(count)

### FIXED CODE ###



str = input()
print(str.count("1") )
import sys
input = sys.stdin.readline
 
N,K = map(int,input().split())
H = [int(x) for x in input().split()]
 
def main(N,K,H):
    dp = [0]*N
    for i in range(1,N):
        L = [dp[j]+abs(H[i]-H[j]) for j in range(max(0,i-K),i)]
        dp[i] = min(L)
    print(dp[-1])
main(N,K,H)

### FIXED CODE ###

#1:初期化
N = int(input())
h = list(map(int, input().split()))
inf = float("inf")
dp = [inf]*(N)

#2:初期値
dp[0] = 0

#3:dp実行部
for i in range(1,N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if(i>1): #2つ目の足場には二個前の足場がないので．
        dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

#4:出力
print(dp[N-1])
import sys
import math
import collections

readline = sys.stdin.readline

def myindex(t, x, default=-1):
    if x in t:
        return t.index(x)
    else:
        return default


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    lenB = len(B)
    log2lenB = int(math.log2(lenB))

    A.sort()
    C.sort()

    countAlist = list(zip(*list(collections.Counter(A).items())))
    countClist = list(zip(*list(collections.Counter(C).items())))

    #print(countClist)

    sumAlist = [0] * (max(A)+1)
    sumClist = [0] * (max(C)+1)

    for i in range(max(A)+1):
        index = myindex(countAlist[0], i)
        sumAlist[i] = sumAlist[i-1] + (index >= 0) * countAlist[1][index]

    for i in range(max(C)+1):
        j = max(C) - i + 1
        index = myindex(countClist[0], j)
        sumClist[i] = sumClist[i-1] + (index >= 0) * countClist[1][index]

    ans = 0

    for i in range(lenB):
        target = B[i]
        upper = lenB - 1
        lower = 0
        middle = (upper + lower) // 2

        for _ in range(log2lenB+1):
            if target > max(A):
                lower = len(A) - 1
                break
            if target == A[middle]:
                lower = middle - 1
                break
            elif target < A[middle]:
                upper = middle
            else:
                lower = middle
            middle = (upper + lower) // 2 + 1
        
        ansA = sumAlist[A[lower]]
        #print('A:{} B:{} C:{}'.format(A, B, C))
        #print('A:{} B:{}, ansA:{}'.format(A[lower], target, ansA))

        upper = lenB - 1
        lower = 0
        middle = (upper + lower) // 2

        for _ in range(log2lenB+1):
            if target == C[middle]:
                upper = middle + 1
                break
            elif target < C[middle]:
                upper = middle
            else:
                lower = middle
            middle = (upper + lower) // 2

        ansC = sumClist[-C[upper]]
        #print('B:{} C:{}, ansC:{}'.format(target, C[upper], ansC))
        ans += ansA * ansC


    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import bisect

readline = sys.stdin.readline

def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    A.sort()
    C.sort()

    ans = 0
    for b in B:
        ansA = bisect.bisect_left(A, b)
        ansC = N - bisect.bisect_right(C, b)
        ans += ansA * ansC

    print(ans)


if __name__ == "__main__":
    main()
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
  t, x, y = map(int, input().split())
  td = t - tp
  xd = x - xp
  yd = y - yp
  if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
    print('No')
    break
    tp = t
    xp = x
    yp = y
    else:
      print('Yes')

### FIXED CODE ###

n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    td = t - tp
    xd = x - xp
    yd = y - yp
    if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
        print('No')
        break
    tp = t
    xp = x
    yp = y
else:
    print('Yes')
a=input()-input();print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')

### FIXED CODE ###

a=(int)(input())-(int)(input());print(a>0 and'GREATER'or a<0 and'LESS'or'EQUAL')
N = int(input())
A = [0]*N
for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N+1):
    print(A[j])

### FIXED CODE ###

N = int(input())
A = [0]*N

for i in [int(s) for s in input().split()]:
    A[i-1] +=1

for j in range(N):
    print(A[j])
a = list(map(input().split())
cnt = 0

while all(i%2==0 for i in a):
         a = [i/2 for i in a]
         cnt += 1
         print(cnt)

### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
N=int(input())

A=list(map(int,input().split()))
#B=[]
#C=[]
D=[0]*1500000
E=[0]*1500000

ans=0

for i in range(N):
  #B.append(A[i]+i+1)
  #C.append(-A[i]+i+1)
  D[A[i]+i+1]+=1
  E[-A[i]+i+1]+=1

for i in range(len(D)):
  #ans+=C.count(i)
  ans+=D[i]*E[i]

print(ans)

### FIXED CODE ###

N=int(input())
 
A=list(map(int,input().split()))
#B=[]
#C=[]
D=[0]*1000000
E=[0]*1000000
 
ans=0
 
for i in range(N):
  if A[i]<500000:
  #B.append(A[i]+i+1)
  #C.append(-A[i]+i+1)
  #if -A[i]+i>=0:
  	D[A[i]+i]+=1
  	E[-A[i]+i]+=1
   #print(E[-A[i]+i],-A[i]+i)

for i in range(1000000):
  #ans+=C.count(i)
  ans+=D[i]*E[i]
 
print(ans)
def a(s,i):
    if i = l-1:
        if eval(s)==7:
            print(s+"=7")
            exit()
        return
    a(s+"+"+N[i],i+1)
    a(s+"-"+N[i],i+1)

N = input()
l = len(N)

a(N[0],0)

### FIXED CODE ###

def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

s=input()
dfs(0,s[0],int(s[0]))
X, N = map(int,input().split(' '))
if N == 0:
    print(X)
    exit()

p = input().split(' ')
p =[int(i) for i in p]
if X not in p:
    print(X)
    exit()

num_list = [int(i-99) for i in range(200)]
[num_list.remove(p[i]) for i in range(N)]
tmp = [0] * int(len(num_list))


for i in range(len(num_list)):
    tmp[i] = max(num_list[i], X) - min(num_list[i], X)

ans = [i for i,x in enumerate(tmp) if x == min(tmp)]
# print(num_list)
# print(tmp)
# print(ans)
if len(ans) == 2:
    print(min(num_list[ans[0]],num_list[ans[1]]))
else:
    print(num_list[ans])


### FIXED CODE ###

X, N = map(int,input().split(' '))
if N == 0:
    print(X)
    exit()

p = input().split(' ')
p =[int(i) for i in p]
if X not in p:
    print(X)
    exit()

num_list = [int(i) for i in range(102)]
[num_list.remove(p[i]) for i in range(N)]
tmp = [0] * int(len(num_list))


for i in range(len(num_list)):
    tmp[i] = abs(num_list[i] - X)

ans = tmp.index(min(tmp))

print(num_list[ans])
import sys
import numpy as np

# N 時計の数
n = int(input())

# Ti 各時計が1周する秒数
t = []
for i in range(n):
    t.append(int(input()))
    
# 最大公約数を求める
def gcb(a, b):
    if b == 0:
        return a
    return gcb(b, a % b)

def lcm(a, b):
    g = gcb(a, b)
    return a / g * b

ans = 1

for num in t:
    ans = lcm(ans, num)

print(int(ans))


### FIXED CODE ###

import sys
import numpy as np

# N 時計の数
n = int(input())

# Ti 各時計が1周する秒数
t = []
for i in range(n):
    t.append(int(input()))
    
# 最大公約数を求める
def gcb(a, b):
    if b == 0:
        return a
    return int(gcb(b, a % b))

def lcm(a, b):
    g = gcb(a, b)
    return a * b // g

if (n == 1):
    print(t[0])
else:
    ans = 1
    for num in t:
        ans = lcm(ans, num)
    print(int(ans))
N = int(input())
W = map(int,input().split())
L = []
for i in range(1,N):
  L.append(abs(sum(N[:i])-sum(N[i:])))
print(min(L))

### FIXED CODE ###

N = int(input())
W = list(map(int,input().split()))
L = []
for i in range(1,N):
  L.append(abs(sum(W[:i])-sum(W[i:])))
print(min(L))
S = input()
if S[:2]=="hi" and S[2] != "i":
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
print("Yes" if S.count("hi")*2==len(S) else "No")
a=int(input())
b=sum([10**i*9 for i in range(0, len(str(a))-1) if not i%2])
if len(str(a))%2:
    print(b+int(str(a)[1:])+1)
else:
    print(b)

### FIXED CODE ###

n = int(input())
 
if n <10:
    count = n
elif n <100:
    count = 9
elif n <1000:
    count = n-90
elif n < 10000:
    count = 909
elif n < 100000:
    count = n-9090
else:
    count = 90909
 
print(count)
a, b, c = map(int, input().split())

d = a // b
if a % d != 0:
    d += 1

print(d * c)

### FIXED CODE ###

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

d = a // b
if a % b != 0:
    d += 1

print(d * c)
h,w=map(int,input())
for i in range(h):
  s=list(input().split())
  for j in range(w):
    if s[j]=='snuke':
      print(chr(97+j)+str(i+1))


### FIXED CODE ###

h,w=map(int,input().split())
for i in range(h):
  s=list(input().split())
  for j in range(w):
    if s[j]=='snuke':
      print(chr(65+j)+str(i+1))
k = int(input())
a, b=map(int,input().split())

fly=0
l=[]
while fly<b:
    fly += k
    l.append(fly)

if l[-1]>=a and l[-1]<=b:
    print('OK')
elif l[-2]>=a and l[-2]<=b:
    print('OK')
else:
    print('NG')

### FIXED CODE ###

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

fly=0
l=[]
while fly<b:
    fly += k
    l.append(fly)
    
if len(l)==1:
    if k>=a and k<=b:
        print('OK')
    else:
        print('NG')
else:
    if l[-1]>=a and l[-1]<=b:
        print('OK')
    elif l[-2]>=a and l[-2]<=b:
        print('OK')
    else:
        print('NG')
from numpy import *
n,m = map(int, input().split())

s = [[int(j) for j in input().split()][1:] for i in range(m)]
p = [int(i) for i in input().split()]

ans = 0

for i in range(2**n):
    b = array([(i >> j)&1 for j in range(n)])
    if [sum(b[array(k) - 1] % 2 for k in s)] == p:
        ans += 1
print(ans)

### FIXED CODE ###

from numpy import *
n,m = map(int, input().split())

s = [[int(j) for j in input().split()][1:] for i in range(m)]
p = [int(i) for i in input().split()]

ans = 0

for i in range(2**n):
    b = array([(i>>j)&1 for j in range(n)])
    if [sum(b[array(k)-1]) % 2 for k in s] == p:
        ans += 1
print(ans)
S = input()
T = input()

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    for j in range(len(T)):
        if(T[j] != S[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)

### FIXED CODE ###

S = input()
T = input()

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    tmp = 0
    for j in range(len(T)):
        if(T[j] != U[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)
n=int(input())
s=input()
dp=[[[False for k in range(1000)] for j in range(4)] for i in range(n+1)]

dp[0][0][0]=True

for i in range(n):
    for j in range(4):
        for k in range(1000):
            if dp[i][j][k]==False:continue
            print(i,j,k)
            dp[i+1][j][k]=True
            print(i+1,j,k,i,j,k)
            if j<=2:
                dp[i+1][j+1][k*10+int(s[i])]=True
                print(i+1,j+1,k*10+int(s[i]),i,j,k)
cnt=0
for i in range(1000):
    if dp[n][3][i]==True:cnt+=1
print(cnt)

### FIXED CODE ###

m,d=map(int,input().split(" "))
mm,dd=map(int,input().split(" "))
if m==mm:print(0)
else:print(1)
d=int(input())
if d=25:
  print("Christmas")
elif d=24:
  print("Christmas Eve")
elif d=23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

### FIXED CODE ###

d=int(input())
if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(min(N - M + 2, N)):
	for j in range(min(N - M + 2, N)):
		# print("i=", i, "j=", j)
		if A[i][j: j + M] == B[0]:
			for k in range(1, M):
				tmp = True
				if A[i + k][j: j + M] == B[k]:
					pass
				else:
					tmp = False
					break
			if tmp:
				print("Yes")
				exit()
print("No")


### FIXED CODE ###

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(min(N - M + 2, N)):
	for j in range(min(N - M + 2, N)):
		# print("i=", i, "j=", j)
		if A[i][j: j + M] == B[0]:
			tmp = True
			for k in range(1, M):
				if A[i + k][j: j + M] == B[k]:
					pass
				else:
					tmp = False
					break
			if tmp:
				print("Yes")
				exit()
print("No")
n = input()
x = 800*n
y = 200*(n//15)
print(x*y)

### FIXED CODE ###

n = int(input())
x = 800*n
y = 200*(n//15)
print(x-y)
S, T = input().split()
if S in T:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

S = input()
T = input()
if T[:-1] == S:
    print("Yes")
else:
    print("No")
import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
for _ in range(N):
    A, B = map(int, input().split())

hq = []
ans = 0

for i in range(1, M + 1):
    while j < N and A[j] <= i:
        heapq.heappush(hq, -B[j])
        j += 1
    if len(hq):
        ans -= heapq.heappop(hq)

print(ans)


### FIXED CODE ###

import heapq
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
X = sorted([list(map(int, input().split())) for _ in range(N)], key = lambda x: x[0])

hq = []
ans, j = 0, 0

for i in range(1, M + 1):
    while (j < N) and (X[j][0] <= i):
        heapq.heappush(hq, -X[j][1])
        j += 1
    if len(hq):
        ans -= heapq.heappop(hq)

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

c=collections.Counter(a)
num_kind=len(set(a)) #種類の数
diff = num_kind-k #変更すべき数
values, counts = zip(*c.most_common()[::-1]) #少ない順
print(sum(counts[:diff]))

### FIXED CODE ###

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

c=collections.Counter(a)
num_kind=len(set(a)) #種類の数
diff = num_kind-k #変更すべき数
values, counts = zip(*c.most_common()[::-1]) #少ない順
print(sum(counts[:diff]))
while True:
    a = raw_input.split(" ")
    a.sort()
    s = "%d %d" % (a[0],a[1])
    if s == "0 0":
        break
    print s

### FIXED CODE ###

while True:
    a = map(int,raw_input().split(" "))
    a.sort()
    s = "%d %d" % (a[0], a[1])
    if s == "0 0":
        break
    print s