Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

# ABC103D_IslandsWar.py

import operator

"""
区画スケジューリング
まず、(ai, bi) の組を bi について昇順にソートします。ソートした順に、以下を行います。
• 既にその要望を満たしている場合、何もしない。
• まだその要望を満たしていない場合、西から bi − 1 番目の島と bi 番目の島を接続する橋を取り除く。
"""

n, m = map(int, input().split())
ms = [tuple(map(int, input().split())) for i in range(m)]
bridges = set()
ms2 = sorted(ms, key=operator.itemgetter(1))

for i in range(m):
    ms2i = tuple(range(ms2[i][0], ms2[i][1]))
    ms2i2 = [x in bridges for x in ms2i]
    if any(ms2i2):
        pass
    else:
        bridges.add(ms2[i][1]-1)

if __name__ == "__main__":
    print(len(bridges))


### FIXED CODE ###

# ABC103D_IslandsWar.py

import operator

"""
区画スケジューリング
まず、(ai, bi) の組を bi について昇順にソートします。ソートした順に、以下を行う。
• 既にその要望を満たしている場合、何もしない。
• 要望を満たしていない場合、bi − 1 番目の島と bi 番目の島を接続する橋を取り除く。
TLE に注意
"""

n, m = map(int, input().split())
bridges = [0]
ms = sorted((tuple(map(int, input().split())) for i in range(m)), key=operator.itemgetter(1))

for i in range(m):
    if ms[i][0] <= bridges[-1]:
        pass
    else:
        bridges.append(ms[i][1] - 1)

if __name__ == "__main__":
    print(len(bridges)-1)
### BUGGY CODE ###

from collections import deque
def main():
    n = int(input())
    b = list(map(int, input().split()))
    q = deque()
    q.append([b[::], [0]*n, 0])
    ans = None
    while q:
        now, history, depth = q.popleft()
        if len(now) == 0:
            ans = history
            break
        for i, j in enumerate(now):
            if i+1 == j:
                tmp = history[::]
                tmp[depth] = i+1
                q.appendleft([[now[k] for k in range(len(now)) if k != i], tmp, depth+1])
    if ans is None:
        print(-1)
    else:
        for i in ans[::-1]:
            if i == 0:
                break
            print(i)
if __name__ == "__main__":
    main()

### FIXED CODE ###

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

def check(b):
    for i in range(len(b))[::-1]:
        if i+1 == b[i]:
            return i
    return -1

ans = []
for i in range(n):
    ind = check(b)
    if ind >= 0:
        ans.append(ind+1)
        b = b[:ind] + b[ind+1:]
    else:
        print(-1)
        exit()
for i in ans[::-1]:
    print(i)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

A,B,N = map(int, input().split())
z = 0

for x in range(1,N+1):
    ans = (A * x) // B - A * (x // B)
    if ans > z:
        z = ans
print(z)

### FIXED CODE ###

# -*- coding: utf-8 -*-

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

if N >= B:
    x  = B - 1
    z = (A * x) // B - A * (x // B)
else:
    x = N
    z = (A * x) // B - A * (x // B)

print(int(z))
### BUGGY CODE ###

import math
x,y = map(int, input().split())
n = (x+y)/3
r = (2*x-y)/3
mod = 10**9+7

if (x+y)%3!=0:
    print(0)
elif 2*x-y<0:
    print(0)
elif -x+2*y<0:
    print(0)
else:
    print((math.factorial((x+y)//3)//(math.factorial((2*x-y)//3)*math.factorial((2*y-x)//3)))%mod)


### FIXED CODE ###

# import math
# from operator import mul
# from functools import reduce
x,y = map(int, input().split())
n = (x+y)//3
r = (2*x-y)//3
mod = 10**9+7
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if (x+y)%3!=0:
    print(0)
elif 2*x-y<0:
    print(0)
elif -x+2*y<0:
    print(0)
else:
    # print((math.factorial((x+y)//3)//(math.factorial((2*x-y)//3)*math.factorial((2*y-x)//3)))%mod)
    # print(combinations_count(n,r)%mod)
    print(cmb(n,r,mod))
### BUGGY CODE ###


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def myPow(x,n,m):
  if n == 0:
    return 1
  if n % 2 == 0:
    return myPow(x * x % m, n / 2, m)
  else:
    return x * myPow(x, n - 1, m) % m

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

mod = 10**9+7 #出力の制限
N = n
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n_comb = 2 ** n - 1
n_comb = myPow(2, n, mod) - 1
ans = n_comb - (cmb(n,a, mod) + cmb(n,b,mod))
ans %= mod
print(ans)

### FIXED CODE ###

from functools import reduce 
def solve():
    mod = 10 ** 9 + 7
    n, a, b = map(int, input().split())
    all_comb = pow(2, n, mod) - 1

    X = reduce(lambda x,y:x*y%mod, list(range(n-a+1, n+1))) 
    Y = reduce(lambda x,y:x*y%mod, list(range(1,a+1)))
    Y = pow(Y, mod-2, mod)
    a_comb = X * Y % mod

    X = reduce(lambda x,y:x*y%mod, list(range(n-b+1, n+1))) 
    Y = reduce(lambda x,y:x*y%mod, list(range(1,b+1)))
    Y = pow(Y, mod-2, mod)
    b_comb = X * Y % mod

    ans = all_comb - a_comb
    ans %= mod
    ans -= b_comb
    ans %= mod
    print(ans)

if __name__ == '__main__':
    solve()
### BUGGY CODE ###

s = input()
ans = 0
for i in range(0, len(s)-3):
  for j in range(i+3, len(s)):
    if int(s[i:j+1]) % 2019 == 0:
      ans += 1
print(ans)

### FIXED CODE ###

s = input()
p = 2019
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, p)
  n %= p
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)
### BUGGY CODE ###

def abc153_e():
    H, N = map(int, input().split())
    M = [tuple(map(int, input().split())) for _ in range(N)]

    inf = 10**18
    cost = [inf] * (H+1)
    cost[0] = 0
    for a, b in M:
        for i in range(1, H+1):
            tmp = cost[i-a] + b if i-a > 0 else b
            cost[i] = min(cost[i], tmp)
    print(cost[H])

abc153_e()

### FIXED CODE ###

def abc153_e():
    H, N = map(int, input().split())
    M = [tuple(map(int, input().split())) for _ in range(N)]

    inf = 10**18
    cost = [inf] * (H+1)
    cost[0] = 0
    for a, b in M:
        for i in range(1, H+1):
            tmp = cost[i-a] + b if i-a > 0 else b
            cost[i] = min(cost[i], tmp)
    print(cost[H])

abc153_e()
### BUGGY CODE ###

inf = float("inf")
N, Ma, Mb = map(int, input().split())
ABC = []
for _ in range(N):
    a, b, c = map(int, input().split())
    ABC.append((a, b, c))


def cost(bits):
    sa = sb = sc = 0
    for i, (a, b, c) in enumerate(ABC):
        if not bits & 1 << i:
            continue
        sa += a
        sb += b
        sc += c
    return sc if sa * Mb == sb * Ma else inf


ans = min([cost(bits) for bits in range(1, 1 << N)])
print(ans if ans < inf else -1)


### FIXED CODE ###

inf = float("inf")
N, Ma, Mb = map(int, input().split())
ABC = []
for _ in range(N):
    a, b, c = map(int, input().split())
    ABC.append((a, b, c))
dp = [[inf] * 420 for _ in range(420)]
dp[0][0] = 0
for a, b, c in ABC:
    for i in range(410, -1, -1):
        for j in range(410, -1, -1):
            if dp[i][j] < inf:
                dp[i+a][j+b] = min(dp[i+a][j+b], dp[i][j] + c)
ans = inf
n = 1
while max(Ma * n, Mb * n) < 420:
    ans = min(ans, dp[Ma * n][Mb * n])
    n += 1
print(ans if ans < inf else -1)
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))  # 整数のリスト
    B = [0] * N

    for j in range(K):
        for i in range(N):
            l = max(0, i-A[i])
            r = min(N-1, i+A[i])
            B[l] += 1
            if r+1 < N: B[r+1] -= 1
        for i in range(1,N):
            B[i] += B[i-1]
        A = B
        B = [0] * N

    for i in A:
        print(i, end=" ")

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))  # 整数のリスト
    B = [0] * N

    for j in range(min(K, 41)):
        for i in range(N):
            l = max(0, i-A[i])
            r = min(N-1, i+A[i])
            B[l] += 1
            if r+1 < N: B[r+1] -= 1
        for i in range(1,N):
            B[i] += B[i-1]
        A = B
        B = [0] * N

    for i in A:
        print(i, end=" ")

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import Counter
N = int(input())
S = input()
tmp = Counter(S)
# print(tmp)
r = tmp["R"]
g = tmp["G"]
b = tmp["B"]
ans = 0
# for s in S:
#     if s == "R":
#         r += 1
#     elif s == "G":
#         g += 1
#     else:
#         b += 1

for i in range(len(S) - 2):
    j = 1
    if S[i] == "R":
        ans += g * b
        r -= 1
    elif S[i] == "G":
        ans += r * b
        g -= 1
    else:
        ans += r * g
        b -= 1
    
    while not (i + j + j >= len(S)):
        if S[i] == "R":
            if S[i + j] == "R":
                j += 1
                continue
            if S[i + j] == "G" and S[i + j + j] == "B" or S[i + j] == "B" and S[i + j + j] == "G":
                ans -= 1
        if S[i] == "G":
            if S[i + j] == "G":
                j += 1
                continue
            if S[i + j] == "R" and S[i + j + j] == "B" or S[i + j] == "B" and S[i + j + j] == "R":
                ans -= 1
        if S[i] == "B":
            if S[i + j] == "B":
                j += 1
                continue
            if S[i + j] == "G" and S[i + j + j] == "R" or S[i + j] == "R" and S[i + j + j] == "G":
                ans -= 1
        j += 1
print(ans)


### FIXED CODE ###

from collections import Counter
N = int(input())
S = input()
tmp = Counter(S)
# print(tmp)
r = tmp["R"]
g = tmp["G"]
b = tmp["B"]
ans = 0
# for s in S:
#     if s == "R":
#         r += 1
#     elif s == "G":
#         g += 1
#     else:
#         b += 1

for i in range(len(S) - 2):
    j = 1
    if S[i] == "R":
        ans += g * b
        r -= 1
    elif S[i] == "G":
        ans += r * b
        g -= 1
    else:
        ans += r * g
        b -= 1
    
    while not (i + j + j >= len(S)):
        if S[i] == "R":
            if S[i + j] == "R":
                j += 1
                continue
            if S[i + j] == "G" and S[i + j + j] == "B" or S[i + j] == "B" and S[i + j + j] == "G":
                ans -= 1
        if S[i] == "G":
            if S[i + j] == "G":
                j += 1
                continue
            if S[i + j] == "R" and S[i + j + j] == "B" or S[i + j] == "B" and S[i + j + j] == "R":
                ans -= 1
        if S[i] == "B":
            if S[i + j] == "B":
                j += 1
                continue
            if S[i + j] == "G" and S[i + j + j] == "R" or S[i + j] == "R" and S[i + j + j] == "G":
                ans -= 1
        j += 1
print(ans)
### BUGGY CODE ###

from collections import deque
import sys
input=sys.stdin.readline


def solve():
    H, W = map(int, input().split())
    m = [[-1]*W for _ in range(H)]
    candidate = [(i, j, 0) for i in range(H) for j, s in enumerate(input()) if s=="#"]
    q = deque(candidate)

    while q:
        y, x, cost = q.popleft()
        m[y][x] = cost

        for y1, x1 in [(y-1, x), (y+1, x), (y, x-1), (y, x+1)]:
            if not (0<=x1<W and 0<=y1<H):
                continue
            if m[y1][x1] == -1:
                q.append((y1, x1, cost+1))

    print(max(map(max, m)))


if __name__ == "__main__":
    solve()


### FIXED CODE ###

from collections import deque


def solve():
    H, W = map(int, input().split())
    m = [[-1]*W for _ in range(H)]
    l = [list(input()) for _ in range(H)]
    dx = [-1, 1, 0, 0]
    dy = [0, 0, -1, 1]
    q = deque([])

    for i in range(H):
        for j in range(W):
            if l[i][j]=="#":
                q.append((i, j))
                m[i][j] = 0
    
    while q:
        y, x = q.popleft()

        for px, py in zip(dx, dy):
            x1, y1 = x + px, y + py
            if not (0<=x1<W and 0<=y1<H):
                continue
            if m[y1][x1] == -1:
                q.append((y1, x1))
                m[y1][x1] = m[y][x] + 1

    print(max(map(max, m)))


if __name__ == "__main__":
    solve()
### BUGGY CODE ###

S = input()
T = input()

dp = [[0] * (len(T)+1) for _ in range(len(S)+1)]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i] == T[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

res = ""
i = len(S)
j = len(T)

while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        res = S[i-1] + res
        i -= 1
        j -= 1

print(res)
            

### FIXED CODE ###

S = input()
T = input()

dp = [[0] * (len(T)+1) for _ in range(len(S)+1)]
for i in range(len(S)):
    for j in range(len(T)):
        if S[i] == T[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

res = ""
i = len(S)
j = len(T)

while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        res = S[i-1] + res
        i -= 1
        j -= 1

print(res)
### BUGGY CODE ###

n, m, = map(int, input().split())
h = list(map(int, input().split()))
p = []
for i in range(m):
    a, b, = map(int, input().split())
    p.append([a-1, b-1])

#print("p = {}".format(p))

ret = 0
for i in range(n):
    # 自分の高さは？
    max_height = h[i]
    # 今のところ自分が高い
    flag = True

    for j in p:
        if j[0] == i:
            if max_height <= h[j[1]]:
                flag = False
                break
        elif j[1] == i:
            if max_height <= h[j[0]]:
                flag = False
                break
    if flag == True:
        ret += 1

print("{}".format(ret))

### FIXED CODE ###

import copy

n, m, = map(int, input().split())
h = list(map(int, input().split()))
p = []
for i in range(m):
    a, b, = map(int, input().split())
    p.append([a-1, b-1])

#print("p = {}".format(p))

height = copy.copy(h)
for i in p:
    index0 = i[0]
    index1 = i[1]
    if h[index0] < h[index1]:
        height[index0] = -1
    elif h[index0] > h[index1]:
        height[index1] = -1
    elif h[index0] == h[index1]:
        height[index0] = -1
        height[index1] = -1

#print("height = {}".format(height))

ret = 0
for i in range(n):
    if height[i] == h[i]:
        ret += 1

print("{}".format(ret))
### BUGGY CODE ###

import collections
n = int(input())
a = list(map(int, input().split()))
for k in range(n):
    a_2 = a[:k] + a[k + 1:]
    coun = collections.Counter(a_2)
    num = list(coun.values())
    num_2 = map(lambda x: (x - 1) * (2 + (x - 2)) / 2, num)
    print(int(sum(num_2)))


### FIXED CODE ###

from collections import Counter

n = int(input())
a = list(map(int, input().split()))
dif = [0] * (n + 1)
sum_c = 0
c = Counter(a)
for i, v in c.items():
    if v < 2:
        continue
    val = v * (v - 1) / 2
    dif[i] = v - 1
    sum_c += val
print('\n'.join([str(int(sum_c - dif[i])) for i in a]))
### BUGGY CODE ###

# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import numpy as np
l ={}
N,K = map(int,input().split())
#P = list(map(int,input().split()))
P = np.asarray(list(map(int,input().split())))
#print(P)
P_ = []
#print(P_)

def kitai(num):
    x = 0
    for j in range(num):
        x += num-j
    return x/num
for i in P:
    P_ = np.append(P_,kitai(i))
#print(type(P_))


#print(P)
for i in range(0,N-K+1):
    #print(P[i:i+K])
    l[sum(P_[i:i+K])]=i
#print(l)
max = max(l.keys())
print(max)
import sys
def input():
    return sys.stdin.readline()[:-1]







### FIXED CODE ###

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

N,K = map(int,input().split())
def kitai(num):
    return (1+int(num))/2
P = list(map(kitai,input().split()))	  

S = [0]*(N+1)
ans = 0
for i in range(N):
    S[i+1]=S[i]+P[i]
for i in range(N-K+1):
    ans = max(ans,S[i+K]-S[i])
print(ans)
### BUGGY CODE ###

import math

def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
 
x, y = map(int, input().split())

if (x + y) % 3 != 0:
    ans = 0
else:

    b = (2*y - x) / 3 
    a = b + x -y

    

    ans = comb(a+b, b, 1000000007)

    # answer = (a+b)! / a!b! mod 10^9+7

    
print(ans)

# 999999 999999


### FIXED CODE ###

from math import factorial
import sys

x, y = map(int, input().split())

maxim = 10**6+10
mod = 10**9 + 7

fac = [None] * maxim
finv = [None] * maxim
inv = [None] * maxim

def cominit():
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1

    for i in range(2, maxim):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod

def com(n, k):
    if (n < k):
        return 0
    if (n < 0 or k < 0):
        return 0
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod


def main():
    if (x + y) % 3 != 0:
        return 0
    else:

        b = (2*y - x) // 3 
        a = b + x -y
        if a < 0 or b < 0:
            print(0)
            sys.exit()
        
        cominit()
        ans = com(a+b, b)
        return ans 
    # answer = (a+b)! / a!b! mod 10^9+7


    
print(main())

# 999999 999999
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list()
for i in range(1,N+1):
    B.append(A.index(i)+1)
print(' '.join(map(str,B)))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0] * N
for i in range(N):
    B[A[i]-1] = i+1
print(' '.join(map(str,B)))
### BUGGY CODE ###

N = int(input())
T = [ [] for _ in range(N) ]
ans = []
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
    ans.append([a-1,b-1])

color = [ [0]*N for _ in range(N)]
total = 0
for i in range(N):
    for j in T[i]:
        if color[j][i] == 0:
            k = []
            c = 0
            for s in T[i]:
                k.append(color[i][s])
            while(True):
                if c not in k:
                    break
                c += 1
            color[i][j] = c
            color[j][i] = c
            total = max(total,c)
print(total)
for pair in ans:
    print(color[pair[0]][pair[1]])

### FIXED CODE ###

from collections import deque

N = int(input())
T = [ [] for _ in range(N) ]
ans = []
for i in range(N-1):
    a,b = map(int,input().split())
    T[a-1].append(b-1)
    T[b-1].append(a-1)
    ans.append((a-1,b-1))


used = [0]*N
used[0] = 1
a = dict()
parent = [0]*N
total = 0
q = deque()
q.append(0)

while(len(q) > 0):
    c = 1
    r = q.popleft()
    for j in T[r]:
        if used[j] == 0:
            used[j] = 1
            if c == parent[r]:
                c += 1
            a[(r,j)] = c
            parent[j] = c
            c += 1
            q.append(j)
    total = max(total,c-1)


print(total)
for pair in ans:
    print(a[pair])
### BUGGY CODE ###

import itertools
n,p = [int(x) for x in input().split()]
s = input()
if p!=2 and p!=5:
  r = []
  a = int(s)
  r.append(a%p)
  for i in range(n):
    a = a-int(s[i])*pow(10,(n-1-i))
    r.append(a%p)
  #print(r)
  r.sort()
  ans = 0
  cnt=1
  for i in range(len(r)-1):
    if r[i]==r[i+1]:
      cnt+=1
    else:
      ans +=cnt*(cnt-1)//2
      cnt=1
  print(ans+cnt*(cnt-1)//2)
elif p==2:
  ans = 0
  for i in range(n):
    if int(s[i])%2==0:
      ans +=i+1
  print(ans)
elif p==5:
  ans = 0
  for i in range(n):
    if int(s[i])%5==0:
      ans +=i+1
  print(ans)

### FIXED CODE ###

from collections import defaultdict,deque
import itertools
n,p = [int(x) for x in input().split()]
s = list(input())
if p!=2 and p!=5:
  r = defaultdict(int)
  a =[]
  s1 = s[::-1]
  for i in range(n):
    a.append((int(s1[i])%p*pow(10,i,p))%p)
  a = [0]+a[::-1]
  b = list(itertools.accumulate(a))
  for i in b:
    r[i%p]+=1
  ans = 0
  for i in r.values():
    ans+=(i*(i-1))//2
  print(ans)
elif p==2:
  ans = 0
  for i in range(n):
    if int(s[i])%2==0:
      ans +=i+1
  print(ans)
elif p==5:
  ans = 0
  for i in range(n):
    if int(s[i])%5==0:
      ans +=i+1
  print(ans)
### BUGGY CODE ###

import sys
import math
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))
is_even = lambda x: True if x%2==0 else False

n = aint()
get = [[],[],[],[],[],[],[],[],[],[]]
for i in range(n):
    s = input()
    if s not in get[len(s)-1]:
        get[len(s)-1].append(s)

ss = 0
for cont in get:
    ss += len(cont)
print(ss)

### FIXED CODE ###

import sys
import math
from collections import deque
input = lambda: sys.stdin.readline().rstrip()
Yes = lambda boolean: print('Yes') if boolean else print('No')
YES = lambda boolean: print('YES') if boolean else print('NO')
aint = lambda: int(input())
ints = lambda: list(map(int, input().split()))
is_even = lambda x: True if x%2==0 else False

n = aint()
get = []
for i in range(n):
    s = input()
    get.append(s)
ss = set(get)
print(len(ss))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import numpy as np

def main():
    n = int(input())
    h = np.array(input().split(), dtype='int')

    ans = 0

    for i in range(n - 1):
        times_move = 0
        for j in range(n - i - 1):
            if h[i + j] >= h[i + j + 1]:
                times_move += 1
            else:
                break
        if times_move > ans:
            ans = times_move
        if n - i - 1 <= ans:
            break

    print(ans)


main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np

def main():
    n = int(input())
    h = np.array(input().split(), dtype='int')

    ans = 0
    i = 0

    while i < n:
        times_move = 0
        for j in range(n - i - 1):
            if h[i + j] < h[i + j + 1]:
                break
            else:
                times_move += 1
        if times_move > ans:
            ans = times_move
        if n - i - 1 <= ans:
            break
        i += times_move + 1

    print(ans)


main()
### BUGGY CODE ###

N = int(input())
a = list(map(int, input().split()))
answer = [0] * N
for i in range(N):
    tmp = a[:i] + a[i+1:]
    ans = tmp[0]
    for j in range(1, len(tmp)):
        ans = ans ^ tmp[j]
    answer[i] = ans
    
print(' '.join(map(str, answer)))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
all_xor = a[0]
for j in range(1, len(a)):
    all_xor = all_xor ^ a[j]
answer = [0] * N
for i in range(N):
    answer[i] = all_xor ^ a[i]
    
print(' '.join(map(str, answer)))
### BUGGY CODE ###

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

for _ in range(M):
    A.sort(reverse=True)
    A[0] //= 2

print(sum(A))

### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = list(-int(i) for i in input().split())

heapq.heapify(A)
 
for _ in range(M):
    temp = -heapq.heappop(A) // 2
    heapq.heappush(A, -temp)
 
print(-sum(A))