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

from collections import Counter

n=int(input())
S=[]
ans=0
for i in range(n):
    s=input()
    S.append(s)
for i in range(n):
    for j in range(n-i-1):
        if Counter(S[j+i+1]) == Counter(S[i]):
            ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=set()
b=[]
import collections
for i in range(n):
    s=input()
    s=sorted(s)
    a.add("".join(s))
    b.append("".join(s))
ans=0
a=list(a)
c=collections.Counter(b)
for i in range(len(a)):
    ans+=c[a[i]]*(c[a[i]]-1)//2
print(ans)
### BUGGY CODE ###

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

light = [[[0, 0, 0, 0] for _ in range(W)] for _ in range(H)]

for h in range(H):
    for w in range(W):
        if grid[h][w] == '.':
            here = light[h][w]
            if h + 1 < H and grid[h + 1][w] == '.':
                light[h + 1][w][1] = here[1] + 1
            if w + 1 < W and grid[h][w + 1] == '.':
                light[h][w + 1][3] = here[3] + 1

for h in range(H - 1, -1, -1):
    for w in range(W - 1, -1, -1):
        if grid[h][w] == '.':
            here = light[h][w]
            if h - 1 >= 0 and grid[h - 1][w] == '.':
                light[h - 1][w][0] = here[0] + 1
            if w - 1 >= 0 and grid[h][w - 1] == '.':
                light[h][w - 1][2] = here[2] + 1

ans = 0
for h in range(H):
    for w in range(W):
        ans = max(ans, sum(light[h][w]) + 1)

print(ans)


### FIXED CODE ###

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

light = [0] * 4 * (W + 1) * (H + 1)

row = 4 * (W + 1)
col = 4

for h in range(H):
    for w in range(W):
        if grid[h][w] == '.':
            here = row * h + col * w
            light[row * (h + 1) + col * w + 1] = light[here + 1] + 1
            light[row * h + col * (w + 1) + 3] = light[here + 3] + 1

ans = 0
for h in range(H - 1, -1, -1):
    for w in range(W - 1, -1, -1):
        if grid[h][w] == '.':
            here = row * h + col * w
            light[row * (h - 1) + col * w + 0] = light[here + 0] + 1
            light[row * h + col * (w - 1) + 2] = light[here + 2] + 1
            ans = max(ans, sum(light[here: here + 4]) + 1)

print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans=[]

A_dict={}

for n in range(N):
    a = A.pop(0)
    A_dict[a]=n+1
    
for n in range(N):
    ans.append(A_dict[n+1])

print(*ans, sep=' ')

### FIXED CODE ###

from collections import deque

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

ans=[]

A_dict={}

for n in range(N):
    a = A.popleft()
    A_dict[a]=n+1
    
for n in range(N):
    ans.append(A_dict[n+1])

print(*ans, sep=' ')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(4100000)

N, Q = map(int,input().split())
edge = [[] for i in range(N+1)]

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

cnt = [0 for i in range(N+1)]

for i in range(Q):
    p, x = map(int,input().split())
    cnt[p] += x

def dfs(parent,i):
    for k in edge[i]:
        if k != parent:
            cnt[k] += cnt[i]
            dfs(i,k)

dfs(-1,1)

ans = cnt[1:]

print(*ans)

### FIXED CODE ###

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

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(parent,i,add):
    for k in graph[i]:
        if k != parent:
            value[k] += add
            dfs(i,k,value[k])
    

dfs(0,1,value[1])

ans = value[1:]

print(*ans)
### BUGGY CODE ###

N = int(input())

hantei = 0

while N != 0:
    hantei += N % 10
    N = N // 10

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)


### FIXED CODE ###

N = input()

hantei = 0

for i in range(len(N)):
    hantei += int(N[i])

if hantei % 9 == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)
### BUGGY CODE ###

from itertools import permutations
N = int(input())
stuff = list(map(int,input().split()))
junban = list(range(N))
max_happness = 0
for subset in permutations(junban):
    happness = 0
    newjunban = (list(subset))
    for i in range(N):
        happness +=stuff[i]*abs(newjunban[i]-i)
    if happness>max_happness:
        max_happness = happness
print (max_happness)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ABI = sorted(((a, i) for i, a in enumerate(A, 1)), reverse=True)
prev = [0]
for k, (a, i) in enumerate(ABI):
    curr = [0]*(k+2)
    for l in range(k+1):
        curr[l] = max(curr[l], prev[l] + a*abs(N-i-(k-l)))
        curr[l+1] = prev[l]+a*abs(i-l-1)
    prev = curr
print (max(prev))
### BUGGY CODE ###

n = int(input())
ans = 1
for i in range(1,n+1):
    ans *= i
print(ans % (10**9 + 7))


### FIXED CODE ###

n = int(input())
import math
print(math.factorial(n) %(10**9 + 7))
### BUGGY CODE ###

def factoring(n):
    if n == 1:
        return dict()
    p = 2
    tmp = int(n**0.5)
    ret = {}
    while n != 1:
        if n % p == 0:
            n //= p
            ret[p] = ret.get(p, 0) + 1
        elif p > tmp:
            p = n
        else:
            p += 1
    return ret
            

def func(ans, b):
    B = factoring(b)
    # print(ans, B)
    return {i:max(ans.get(i, 0), B.get(i, 0)) for i in set(ans) | set(B)}

N = int(input())
A = [int(input()) for _ in range(N)]
ans = {}
for a in A:
    ans = func(ans, a)

ret = 1
for k, v in ans.items():
    ret *= k**v
print(ret)

### FIXED CODE ###

def gcd(a, b):
    sm = min(a, b)
    la = max(a, b)
    if la % sm == 0:
        return sm
    else:
        return gcd(sm, la % sm)


N = int(input())
A = [int(input()) for _ in range(N)]

ans = 1
for a in A:
    ans = a * ans // gcd(a, ans)
print(ans)
### BUGGY CODE ###

def factorization(n):
    if n==1:
        return 1
    else:
        arr = []
        temp = n
        for i in range(2, int(-(-n**0.5//1))+1):
            if temp%i==0:
                cnt=0
                while temp%i==0:
                    cnt+=1
                    temp //= i
                arr.append([i, cnt])

        if temp!=1:
            arr.append([temp, 1])

        if arr==[]:
            arr.append([n, 1])
        ans=1
        for j in arr:
            ans*=j[1]+1
        return ans

ans=0
n=int(input())
for i in range(1,n+1):
    ans+=i*factorization(i)
print(ans)

### FIXED CODE ###

n=int(input())

def number_of_divisor(n):
    ans=[0]*(n+1)
    for i in range(1,n+1):
        for j in range(i,n+1,i):
            ans[j]+=1
    return ans

divisor=number_of_divisor(n)
ans=0
for i in range(1,n+1):
    ans+=i*divisor[i]

print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def main():
    n = int(input())
    s = int(input(), 2)
    ans = []
    for i in range(n):
        k = 1 << (n - 1 - i)
        x = k ^ s
        cnt = 0
        while x > 0:
            pc = bin(x).count("1")
            x %= pc
            cnt += 1
        ans.append(cnt)
    print("\n".join(str(y) for y in ans))
if __name__ == '__main__':
    main()

### FIXED CODE ###

n = int(input())
s = input()
x = int(s, 2)
pcx = s.count("1")
pc1 = x % (pcx - 1) if pcx > 1 else 0
pc2 = x % (pcx + 1)

def f(j):
    cnt = 0
    while j:
        j %= bin(j).count("1")
        cnt += 1
    return cnt

for i, y in enumerate(s):
    k = n - 1 - i
    if y == "0":
        print(f((pc2 + pow(2, k, pcx + 1)) % (pcx + 1)) + 1)
    elif pcx > 1:
        print(f((pc1 - pow(2, k, pcx - 1)) % (pcx - 1)) + 1)
    else:
        print(0)
### BUGGY CODE ###

import bisect

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

alist = sorted(list(map(int, input().split())))

for _ in range(m):
  b, c = map(int, input().split())
  idx = bisect.bisect_right(alist,c)
  if idx-1 <= b:
    alist = [c for _ in range(idx)] + alist[idx:]
  else:
    new_alist = alist[b:]
    idx2 = idx-b
    alist = new_alist[:idx2] + [c for _ in range(b)] + new_alist[idx2:]
  
print(sum(alist))

### FIXED CODE ###

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

CB = []
for _ in range(M):
  b,c = map(int,input().split())
  CB.append([c,b])
CB.sort(reverse=True)

num = 0
ans = 0 
for c,b in CB:
  for bi in range(b):
    if num >= N: break
    if num > N or c<=A[num]:
      break
    else:
      num += 1
      ans += c
print(ans+sum(A[num:]) if num != N else ans)
### BUGGY CODE ###

import numpy as np


N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
d = np.zeros((N, N))

for i in range(N-1):
    for j in range(i+1, N):
        d[i, j] = min(j-i, abs(X-i)+1+abs(Y-j))

for k in range(1, N):
    print(np.sum(d==k))

### FIXED CODE ###

N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = {i:0 for i in range(1, N)}

for i in range(N-1):
    for j in range(i+1, N):
        d = min(j-i, abs(X-i)+1+abs(Y-j))
        ans[d] += 1
        
for _, v in ans.items():
    print(v)
### BUGGY CODE ###

a=int(input())
b=0
for i in range(a):
    b+=i

print(b)

### FIXED CODE ###

a=int(input())
b=int(a*(a-1)//2)
print(b)
### BUGGY CODE ###

s = input()
q = int(input())

for _ in range(q):
    t = [x for x in input().split()]
    if t[0] == "1":
        s = s[::-1]
    else:
        if t[1] == "1":
            s = "".join([t[2],s])
        else:
            s = "".join([s,t[2]])

print(s)


### FIXED CODE ###

from collections import deque
s = deque(input())
q = int(input())

rev = False

for _ in range(q):
    t = [x for x in input().split()]
    if t[0] == "1":
        rev = not rev
    else:
        if t[1] == "1":
            s.append(t[2]) if rev else s.appendleft(t[2])
        else:
            s.appendleft(t[2]) if rev else s.append(t[2])

if rev:
    s.reverse()
print("".join(s))
### BUGGY CODE ###

import math
from functools import reduce
from collections import defaultdict


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_max = max(A)

    is_pairwise_coprime = True

    D = [-1] * (A_max + 1)
    for i in range(2, A_max + 1):
        if D[i] == -1:
            D[i] = i
            p = 2
            while i * p <= A_max:
                D[i * p] = i
                p += 1

    def factorization(n):
        assert 0 < n <= A_max
        primes_ = defaultdict(int)
        temp = n
        while temp > 1:
            primes_[D[temp]] += 1
            temp = temp // D[temp]

        return primes_

    primes = set({})
    for i in range(N):
        for p in factorization(A[i]).keys():
            if p in primes:
                is_pairwise_coprime = False
                break
            else:
                primes.add(p)

    gcd_ = reduce(math.gcd, A)

    if is_pairwise_coprime:
        print('pairwise coprime')
    elif gcd_ == 1:
        print('setwise coprime')
    else:
        print('not coprime')


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
from functools import reduce
from collections import defaultdict


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A_max = max(A)

    is_pairwise_coprime = True

    D = [-1] * (A_max + 1)
    for i in range(2, A_max + 1):
        if D[i] == -1:
            D[i] = i
            for j in range(i*i, A_max+1, i):
                D[j] = i

    def factorization(n):
        # assert 0 < n <= A_max
        primes_ = defaultdict(int)
        temp = n
        while temp > 1:
            primes_[D[temp]] += 1
            temp = temp // D[temp]

        return primes_

    P = [False]*(A_max+1)

    # primes = set({})
    for i in range(N):
        for p in factorization(A[i]).keys():
            # if p in primes:
            if P[p]:
                is_pairwise_coprime = False
                break
            else:
                # primes.add(p)
                P[p] = True

    gcd_ = reduce(math.gcd, A)

    if is_pairwise_coprime:
        print('pairwise coprime')
    elif gcd_ == 1:
        print('setwise coprime')
    else:
        print('not coprime')


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

from collections import defaultdict
n=int(input())
dic=defaultdict(int)
for _ in range(n):
	s=list(input())
	s.sort()
	s=''.join(s)
	if s not in dic.keys():
		dic[s]=1
	else:
		dic[s]+=1
	ans=0
	for (k,v) in dic.items():
		ans += v*(v-1)//2
print(ans)

### FIXED CODE ###

from collections import defaultdict
n=int(input())
dic=defaultdict(int)
for _ in range(n):
	s=list(input())
	s.sort()
	s=''.join(s)
	dic[s]+=1
ans=0
for (k,v) in dic.items():
	ans += v*(v-1)//2
print(ans)
### BUGGY CODE ###

K=int(input())
n=0
c=0
while 1:
  n+=1
  j=True
  n_str=str(n)
  for i in range(len(n_str)-1):
    if abs(int(n_str[i]) - int(n_str[i+1])) > 1:
      j=False
  if j:
    c+=1
  if c==K:
    print(n)
    break

### FIXED CODE ###

from collections import deque
K=int(input())
Q=deque(list(range(1,10)))
for _ in range(K):
  x=Q.popleft()
  if x%10 != 0:
    Q.append(10*x+x%10-1)
  Q.append(10*x+x%10)
  if x%10 != 9:
    Q.append(10*x+x%10+1)
print(x)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
q = int(input())

replace = []
for _ in range(q):
  m, n = [int(i) for i in input().split()]
  replace.append((m,n))

l = len(a)
res = sum(a)
for r in replace:
  for i in range(l): 
    if a[i] == r[0]:
      res += r[1] - r[0]
      a[i] = r[1]
  print(res)

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a_dict = {}
for i in a:
  if i not in a_dict:
    a_dict[i] = 1
  else:
    a_dict[i] += 1

q = int(input())

replace = []
for _ in range(q):
  m, n = [int(i) for i in input().split()]
  replace.append((m,n))

res = sum([m*n for m,n in a_dict.items()])

for r in replace:
  if r[0] in a_dict:
    res += (r[1] - r[0])*a_dict[r[0]]
    
    if r[1] in a_dict:
      a_dict[r[1]] += a_dict[r[0]]
    else:
      a_dict[r[1]] = a_dict[r[0]]
    a_dict[r[0]] = 0

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

s = input()
q = int(input())

count = 0
for i in range(q):
  query = list(input().split())
  
  if query[0] == "1":
    count = (count + 1) % 2
    
  if query[0] == "2":
    
    if query[1] == "1":
      
      if count == 0:
        
        s = query[2] + s
        
      else:
        s = s + query[2]
    if query[1] == "2":
      
      if count == 0:
        
        s = s + query[2]
        
      else:
        
        s = query[2] + s

if count == 1:
  
  s = s[::-1]
  
print(s)

### FIXED CODE ###

s = input()
q = int(input())

count = 0
top = []
bottom = []

for i in range(q):
  query = list(input().split())
  if query[0] == "1":
    count = (count + 1) % 2  
  if query[0] == "2":    
    if query[1] == "1":      
      if count == 0:        
        top.append(query[2])    
      else:
        bottom.append(query[2])
    if query[1] == "2":      
      if count == 0:        
        bottom.append(query[2])        
      else:       
        top.append(query[2])
  
t = "".join(top)
b = "".join(bottom)

lst = [t[::-1], s, b]
ans = "".join(lst)

if count == 1:
  ans = ans[::-1]
  
print(ans)
### BUGGY CODE ###

import sys
def solve(n,m,a):
    bb = {i+1:[] for i in range(n)}
    for [s1,s2] in a:
        bb[s1].append(s2)
    b = [i for i in bb.values()]
    for i in range(len(b)):
        b[i].sort()
    c = {s2:s1 for [s1,s2] in a}
    d = [s2 for [s1,s2] in a]
    #print(" a=",a,"\n","b=",b,"\n","c=",c,"\n","d=",d)
    ans = ""
    for i in range(m):
        ken = str(c[d[i]])
        ban = str(b[c[d[i]]-1].index(d[i])+1)

        zero = ""
        for i in range(6-len(ken)):
            zero += "0"
        ans += zero
        ans += ken
        zero = ""
        for i in range(6-len(ban)):
            zero += "0"
        ans += zero
        ans += ban
        ans += "\n"
    
    return ans 
def readQuestion():
    ws = sys.stdin.readline().strip().split()
    N = int(ws[0])
    M = int(ws[1])
    ls_PY = [list(map(int, sys.stdin.readline().strip().split())) for j in range(M)]
    return (N, M, ls_PY)

def main():
    N, M, ls_PY = readQuestion()
    answer = solve(N, M, ls_PY)
    print(answer)

if __name__ == '__main__':
    main()

### FIXED CODE ###

N,M=map(int,input().split())
PY=[list(map(int,input().split()))+[i] for i in range(M)] #定義終了
 
PY.sort(key= lambda x:x[1])
num=[0]*N
w=[""]*M
 
for p,y,i in PY:
	num[p-1]+=1
	w[i]=str(p).zfill(6)+str(num[p-1]).zfill(6)

for i in range(M):
  	print(w[i])
### BUGGY CODE ###

#!/usr/bin/env python3
import io
import os


def main():
    n, m = map(int, input().split())

    w, v = [0] * n, [0] * n
    for i in range(n):
        w[i], v[i] = map(int, input().split())

    dp = [0] * (m + 1)
    for j in range(w[0], m + 1):
        dp[j] = v[0]

    for i in range(n - 1):
        next_dp = [0] * (m + 1)
        for j in range(m + 1):
            if j < w[i + 1]:
                next_dp[j] = dp[j]
            else:
                next_dp[j] = max(v[i + 1] + dp[j - w[i + 1]], dp[j])
        dp = next_dp

    print(dp[-1])


input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
main()


### FIXED CODE ###

#!/usr/bin/env python3
import os
import sys
from atexit import register
from io import StringIO

sys.stdin = StringIO(os.read(0, os.fstat(0).st_size).decode())
sys.stdout = StringIO()
register(lambda: os.write(1, sys.stdout.getvalue().encode()))

input = lambda: sys.stdin.readline().rstrip('\r\n')

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

w, v = [0] * n, [0] * n
for i in range(n):
    w[i], v[i] = map(int, input().split())

dp = [[0] * (m + 1) for _ in range(n)]
for j in range(w[0], m + 1):
    dp[0][j] = v[0]

for i in range(1, n):
    for j in range(m + 1):
        if j < w[i]:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = max(v[i] + dp[i - 1][j - w[i]], dp[i - 1][j])

print(dp[-1][-1])
### BUGGY CODE ###

M=10**9+7
n,*a=map(int,open(0).read().split())
b=[0]*61
for c in a:
  for i in range(61):b[i]+=2**i&c>0
print(sum(pow(2,i,M)*c*(n-c)for i,c in enumerate(b))%M)

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
b=[0]*61
for c in a:
  for i in range(61):b[i]+=2**i&c>0
print(sum(2**i*c*(n-c)for i,c in enumerate(b))%(10**9+7))
### BUGGY CODE ###

from itertools import combinations
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

maxv = 0
for i in range(1, N+1):
    for t in list(combinations(list(range(N)), i)):
        X = sum(V[k] for k in t)
        Y = sum(C[k] for k in t)
        maxv = max(maxv, X-Y)
print(maxv)


### FIXED CODE ###

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

maxv = 0
for v, c in zip(V, C):
    if v > c:
        maxv += (v-c)
print(maxv)
### BUGGY CODE ###

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

N, K, L = map(int, input().split())

# Group1
G1 = [[] for i in range(N)]
for i in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    G1[p].append(q)
    G1[q].append(p)
gids = [0]*N
done = [False]*N
def dfs1(i, gid):
    gids[i] = gid
    done[i] = True
    for nex in G1[i]:
        if done[nex]: continue
        dfs1(nex, gid)
gid = 0
for i in range(N):
    if not done[i]:
        dfs1(i, gid)
        gid += 1

# Group2
G = [[] for i in range(N)]
for i in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    G[r].append(s)
    G[s].append(r)
done = [False]*N
D = []
gids2 = [0]*N
def dfs(i, gid):
    D[gid][gids[i]] += 1
    done[i] = True
    gids2[i] = gid
    for nex in G[i]:
        if done[nex]: continue
        dfs(nex, gid)
gid = 0
for i in range(N):
    if not done[i]:
        D.append([0]*N)
        dfs(i, gid)
        gid += 1

# answer
ans = [0]*N
for i in range(N):
    ans[i] = D[gids2[i]][gids[i]]
print(*ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict

# UnionFind
class UnionFind:
    def __init__(self, n):
        self.parent = [i 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 unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            self.parent[x] = y

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

N, K, L = map(int, input().split())
un = UnionFind(N)
for i in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    un.unite(p, q)
G = [[] for i in range(N)]
for i in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    G[r].append(s)
    G[s].append(r)
done = [False]*N
D = []
gid = 0
def dfs(i, gid):
    D[gid][un.root(i)] += 1
    done[i] = True
    for nex in G[i]:
        if done[nex]: continue
        dfs(nex, gid)
for i in range(N):
    if not done[i]:
        D.append(defaultdict(int))
        dfs(i, gid)
        gid += 1
ans = [0]*N
done = [False]*N
gid = 0
def dfs2(i, gid):
    done[i] = True
    ans[i] = D[gid][un.root(i)]
    for nex in G[i]:
        if done[nex]: continue
        dfs2(nex, gid)
for i in range(N):
    if not done[i]:
        dfs2(i, gid)
        gid += 1
print(*ans)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
arr=list(map(int,input().split()))
prev=1
for i in range(k):
    prev*=arr[i]
ans=[]
for i in range(k,n):
    if(prev<prev*arr[i]/arr[i-k]):
        print('Yes')
    else:
        print('No')
    prev=prev*arr[i]/arr[i-k]
           
        

    

### FIXED CODE ###

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
arr=list(map(int,input().split()))

for i in range(k,n):
    if(arr[i-k]<arr[i]):
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
cnt=1
for i in range(N):
    cnt*=A[i]
print(-1 if cnt>10**18 else cnt)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
cnt=1
for i in range(N):
    cnt*=A[i]
    if cnt>10**18:
        cnt=-1
        break
print(cnt)
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

n=int(input())
s=input()
d=set([])
t=[]
for i in range(n-2):
    for j in range(i+1,n-1):
        if i in t: break
        for k in range(j+1,n):
            d.add(s[i]+s[j]+s[k])
    t.append(i)
print(len(d))

### FIXED CODE ###

n=int(input())
s=input()
d=[set([]) for i in range(10)]
for i in range(n):
    x=int(s[i])
    d[x].add(i)
ans=0
#print(d)
#exit()
for i in range(1000):
    a=b=c=-1
    x=i//100
    y=(i%100)//10
    z=i%10
    if len(d[x])>0:
        a=min(d[x])
    if len(d[z])>0:
        c=max(d[z])
    if a!=-1 and c!=-1:
        for j in range(a+1,c):
            #print(a,c)
            if j in d[y]:
                ans+=1
                break
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int, input().split()))
cnt = 0
ans = 0

for i in range(N - 1):

    if ans > N - i:
        break

    else:
        for j in range(i, N - 1):

            if H[j] >= H[j + 1]:
                cnt += 1
            else:
                break

    # print(i, cnt)
    ans = max(ans, cnt)
    cnt = 0

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0

ans.append(cnt)
print(max(ans))