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

N, M = map(int, input().split())
Ps = []
Ys = []
l = [[] for _ in range(N)]
for _ in range(M):
    P_i, Y_i = map(int, input().split())
    Ps.append(P_i)
    Ys.append(Y_i)
    l[P_i-1].append(Y_i)
for i in range(N):
    l[i].sort()
for i in range(M):
    print("{:012}".format(Ps[i] * 1000000 + l[Ps[i]-1].index(Ys[i]) + 1))

### FIXED CODE ###

N, M = map(int, input().split())
py = []
for _ in range(M):
    py.append(list(map(int, input().split())))
d = {}
now = 0
num = 0
for p, y in sorted(py):
    if now != p:
        now = p
        num = 1
    d[(p, y)] = num
    num += 1
for p, y in py:
    print('{:06d}{:06d}'.format(p, d[(p, y)]))
### BUGGY CODE ###


from collections import defaultdict


N = int(input())
S = input()

X = S[:N]
Y = S[N:]
Y = Y[::-1]

dx = defaultdict(int)
dy = defaultdict(int)

for bit in range(1 << N):
    red = ""
    blue = ""
    for i in range(N):
        if bit & (1 << i):
            red += X[i]
        else:
            blue += X[i]

    dx[(red, blue)] += 1

for bit in range(1 << N):
    red = ""
    blue = ""
    for i in range(N):
        if bit & (1 << i):
            red += Y[i]
        else:
            blue += Y[i]

    dy[(red, blue)] += 1

# 前後が同じになる組がいくつできるか。
ans = 0
for k,v in dx.items():
    ans += dy[k] * v

print(ans)

### FIXED CODE ###


from collections import defaultdict


def main():
        
    N = int(input())
    S = input()

    X = S[:N]
    Y = S[N:]
    Y = Y[::-1]

    dx = defaultdict(int)
    dy = defaultdict(int)

    for bit in range(1 << N):
        red = ""
        blue = ""
        for i in range(N):
            if bit & (1 << i):
                red += X[i]
            else:
                blue += X[i]

        dx[(red, blue)] += 1

    for bit in range(1 << N):
        red = ""
        blue = ""
        for i in range(N):
            if bit & (1 << i):
                red += Y[i]
            else:
                blue += Y[i]

        dy[(red, blue)] += 1

    # 前後が同じになる組がいくつできるか。
    ans = 0
    for k,v in dx.items():
        ans += dy[k] * v

    print(ans)


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

N, M, Q = map(int,input().split())
p=[0,]
q=[0,]
m =  [[0 for y in range(N+1)] for x in range(N+1)]

for i in range(M):
    l, r = map(int,input().split())
    for j in range(0, l+1):
        for k in range(r,N+1):
            m[j][k]+=1

for i in range(Q):
    l, r = map(int,input().split())
    p.append(l)
    q.append(r)

for i in range(1,Q+1):
    print(m[p[i]][q[i]])


### FIXED CODE ###

N, M, Q = map(int,input().split())
m =  [[0 for y in range(N+1)] for x in range(N+1)]
m2 =  [[0 for y in range(N+1)] for x in range(N+1)]
m3 =[[0 for y in range(N+1)] for x in range(N+1)]

for i in range(M):
    l, r = map(int,input().split())
    m[l][r]+=1

for j in range(1, N+1):
    s=0
    for i in range(1, N+1):
        s+=m[i][j]
        m2[i][j]=s

for i in range(1, N+1):
    s=0
    for j in range(i, N+1):
        s+=m2[j][j]-m2[i-1][j]
        m3[i][j]=s

for i in range(1,Q+1):
    l, r = map(int,input().split())
    print(m3[l][r])
### BUGGY CODE ###

from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = readline().strip()
    N = len(S)

    a = [0]
    for i in range(N):
        a.append(int(S[-(i+1):]) % 2019)

    t = Counter(a)

    ans = 0
    for _, v in t.items():
        ans += v * (v-1) // 2
    
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    S = [int(s) for s in list(input().strip())][::-1]
    N,P = len(S), 2019
    
    num = 0
    ans = 0
    
    if P == 2 or P == 5:
    	for i in range(N):
    		if S[i] % P == 0:
    			ans += N-i
    	print(ans)
    	return

    L = [0] * P
    L[0] = 1
    t = 0
    s = 1
	
    for z in S:
    	t = (z * s + t)%P	
    	L[t]+=1
    	s = s * 10 % P
	
    for l in L:
    	ans += l * (l - 1) // 2
    
    print(ans)


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

import sys
from itertools import accumulate


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        B = [0 for _ in range(N)]
        count = 0
        for i in range(N):
            if A[i] == N:
                count += 1
            l = max(0, i - A[i])
            r = min(N - 1, i + A[i])
            B[l] += 1
            if r + 1 < N:
                B[r + 1] -= 1
        B = list(accumulate(B))
        if count == N:
            break
        else:
            A = B
    print(*B, sep=" ")


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from itertools import accumulate


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    for _ in range(K):
        B = [0 for _ in range(N)]
        count = 0
        for i in range(N):
            if A[i] == N:
                count += 1
            l = max(0, i - A[i])
            r = min(N - 1, i + A[i])
            B[l] += 1
            if r + 1 < N:
                B[r + 1] -= 1
        B = list(accumulate(B))
        if count == N:
            break
        else:
            A = B
    print(*B, sep=" ")


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

from collections import deque

s=deque(list( input() ))
t=deque([]) #

cnt=0
while s!=deque([]):
  x=s.popleft()
  if len(t)>=2 and x=="C":
    if t[-2]=="A" and t[-1]=="B":
      cnt += 1
      t.pop()
      t.pop()
      s.appendleft("A")
      s.appendleft("C")
      s.appendleft("B")
    else:
      t.append(x)
  else:
    t.append(x)
        
#print(t,s)
print(cnt)

### FIXED CODE ###

from collections import deque

s=input()
s=s.replace("BC","D")
N=len(s)

cnt=0
cntA=0
cntD=0

for i in range(N):
  if s[i]=="A":
    cntA += 1
  elif s[i]=="D":
    cnt += cntA
  else:
    cntA=0
    cntD=0
    
print(cnt)
### BUGGY CODE ###

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

n1, n2, n3 = 0, 0, 0
for i in range(N):
    if A[i] == 1:
        n1 += 1
    elif A[i] == 2:
        n2 += 1
    elif A[i] == 3:
        n3 += 1

dp = [[[-1.0 for _ in range(N + 1)] for _ in range(N + 1)] for _ in range(N + 1)]


def solve(n1, n2, n3):

    if dp[n1][n2][n3] >= 0.0:
        return dp[n1][n2][n3]
    if n1 == n2 == n3 == 0:
        return 0.0

    cnt = n1 + n2 + n3
    ret = 0
    if n3 >= 1:
        ret += solve(n1, n2 + 1, n3 - 1) * n3
    if n2 >= 1:
        ret += solve(n1 + 1, n2 - 1, n3) * n2
    if n1 >= 1:
        ret += solve(n1 - 1, n2, n3) * n1

    ret = (ret + N) / cnt
    dp[n1][n2][n3] = ret
    return ret


print(solve(n1, n2, n3))


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
num1,num2,num3=0,0,0
for i in range(n):
    if a[i]==1:
        num1+=1
    elif a[i]==2:
        num2+=1
    else:
        num3+=1
dp=[[[-1.0 for k in range(n+1)] for i in range(n+1)] for j in range(n+1)]
def f(n1,n2,n3):
    if dp[n1][n2][n3]>=0.0:
        return dp[n1][n2][n3]
    if n1==n2==n3==0:
        return 0.0
    ret=n
    if n1>0:
        ret+=f(n1-1,n2,n3)*n1
    if n2>0:
        ret+=f(n1+1,n2-1,n3)*n2
    if n3>0:
        ret+=f(n1,n2+1,n3-1)*n3
    ret*=1.0/(n1+n2+n3)
    dp[n1][n2][n3]=ret
    return dp[n1][n2][n3]
print(f(num1,num2,num3))
### BUGGY CODE ###

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

for i in range(a, b + 1):
    if i < a + k:
        print(i)
    elif i > b - k:
        print(i)

### FIXED CODE ###

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

ans = []
for i in range(a, min(b, a + k)):
    if i in ans:
        continue
    else:
        ans.append(i)
for i in range(max(a, b - k + 1), b + 1):
    if i in ans:
        continue
    else:
        ans.append(i)

for i in range(len(ans)):
    print(ans[i])
### BUGGY CODE ###

from math import factorial

N, M = map(int, input().split())
search_starts = [0]
search_ends = []
for _ in range(M):
    a_i = int(input())
    search_ends.append(a_i-1)
    search_starts.append(a_i+1)
search_ends.append(N)

all_patterns = 1
for start, end in zip(search_starts, search_ends):
    passdiff = end - start
    num_2 = passdiff // 2
    residue = passdiff % 2

    tmp_patterns_for_range = 0
    for num2to1 in range(num_2+1):
        add_n_1 = num2to1 * 2
        tmp_num2 = num_2 - num2to1
        tmp_n_pattern = \
            factorial(tmp_num2 + add_n_1 + residue) // factorial(tmp_num2) // factorial(add_n_1 + residue)
        tmp_patterns_for_range += tmp_n_pattern
    all_patterns *= tmp_patterns_for_range

print(all_patterns%1000000007)

### FIXED CODE ###

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

if M == 0:
    alist = set()
else:
    alist = set(int(input()) for _ in range(M))

dp = [0] * (N + 1)
dp[0] = 1
dp[1] = 1 if 1 not in alist else 0

MOD = 10**9 + 7
for i in range(2, N + 1):
    if i in alist:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

print(dp[N])
### BUGGY CODE ###

N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

for _ in range(M):
    b,c = [int(x) for x in input().split()]
    for i in range(b):
        A.append(c)

A.sort(reverse=True)

ans = sum(A[:N])
print(ans)

### FIXED CODE ###

# N = int(input())
# A = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]

N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort(reverse=True)

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


L = []
for cb in CB:
    if len(L) >= N:
        break
    L.extend([cb[0]] * cb[1])

newA = A + L
newA.sort(reverse=True)

newA = newA[0:N]
ans = sum(newA)

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

import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from bisect import bisect_left, bisect_right
def resolve():
    n, m = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(n)]
    AB.sort()
    AB.append([INF, 0])
    for i in range(n, 0, -1):
        AB[i][1] ^= AB[i - 1][1]

    E = [[] for _ in range(n + 1)]
    for i in range(m):
        u, v = map(int, input().split())
        l = bisect_left(AB, [u, 0])
        r = bisect_right(AB, [v, 1])
        E[l].append((r, i + 1))
        E[r].append((l, i + 1))

    ans = []
    used = [False] * (n + 1)
    def dfs(v):
        used[v] = True
        res = AB[v][1]
        for nv, i in E[v]:
            if used[nv]:
                continue
            if dfs(nv):
                ans.append(i)
                res ^= 1
        return res

    for v in range(n + 1):
        if used[v]:
            continue
        if dfs(v):
            print(-1)
            return

    print(len(ans))
    if ans:
        print(*sorted(ans))
resolve()

### FIXED CODE ###

import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from bisect import bisect_left, bisect_right
def resolve():
    n, m = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(n)]
    AB.sort()
    X = [0] * (n + 1)
    X[0] = AB[0][1]
    for i in range(n - 1):
        X[i + 1] = AB[i][1] ^ AB[i + 1][1]
    X[n] = AB[n - 1][1]

    E = [[] for _ in range(n + 1)]
    for i in range(m):
        u, v = map(int, input().split())
        l = bisect_left(AB, [u, 0])
        r = bisect_right(AB, [v, 1])
        E[l].append((r, i + 1))
        E[r].append((l, i + 1))

    ans = []
    used = [False] * (n + 1)
    def dfs(v):
        used[v] = True
        res = X[v]
        for nv, i in E[v]:
            if used[nv]:
                continue
            r = dfs(nv)
            if r:
                ans.append(i)
            res ^= r
        return res

    for v in range(n + 1):
        if used[v]:
            continue
        if dfs(v):
            print(-1)
            return

    print(len(ans))
    if ans:
        print(*sorted(ans))
resolve()
### BUGGY CODE ###

class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

mod = 998244353

N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
xy.sort(key=lambda x:x[1])
for i in range(N):
    xy[i][1] = i+1
xy.sort()
for i in range(N):
    xy[i][0] = i

# x<xi,y<yi
l1 = [0]*N
# x<xi,y>yi
l2 = [0]*N
# x>xi,y<yi
r1 = [0]*N
# x>xi,y>yi
r2 = [0]*N

bitl = BIT(N)
for i in range(N):
    l1[i] = bitl.sum(xy[i][1])
    l2[i] = i-l1[i]
    bitl.add(xy[i][1],1)

bitr = BIT(N)
for i in range(N):
    r1[N-i-1] = bitr.sum(xy[N-i-1][1])
    r2[N-i-1] = i-r1[N-i-1]
    bitr.add(xy[N-i-1][1],1)

pow2 = [1]*(N+1)
for i in range(N):
    pow2[i+1] = 2*pow2[i]%mod

ans = pow(2,N-1,mod)*N%mod
for i in range(N):
    ans += pow2[l1[i]+l2[i]+r1[i]+r2[i]]
    ans -= pow2[l1[i]+r1[i]]
    ans -= pow2[l2[i]+r2[i]]
    ans -= pow2[l1[i]+l2[i]]
    ans -= pow2[r1[i]+r2[i]]
    ans += pow2[l1[i]]
    ans += pow2[l2[i]]
    ans += pow2[r1[i]]
    ans += pow2[r2[i]]
    ans -= 1
    ans %= mod

print(ans)


### FIXED CODE ###

from operator import itemgetter

class BIT:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

mod = 998244353

N = int(input())
xy = [list(map(int,input().split())) for _ in range(N)]
xy.sort(key=itemgetter(1))
for i in range(N):
    xy[i][1] = i+1
xy.sort(key=itemgetter(0))

pow2 = [1]*(N+1)
for i in range(N):
    pow2[i+1] = 2*pow2[i]%mod

ans = pow2[N-1]*N%mod

bit = BIT(N)
for i in range(N):
    l1 = bit.sum(xy[i][1])
    l2 = i-l1
    r1 = xy[i][1]-l1-1
    r2 = N-xy[i][1]-l2
    bit.add(xy[i][1],1)
    ans += (pow2[l2]-1)*(pow2[r1]-1)*pow2[r2]*pow2[l1]
    ans += (pow2[r2]-1)*(pow2[l1]-1)*(pow2[l2]+pow2[r1]-1)
    ans %= mod

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

from itertools import combinations

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

comb = list(combinations(l, 3))

ans = 0
for i in range(len(comb)):
    a = comb[i][0]
    b = comb[i][1]
    c = comb[i][2]
    if (a < b + c) and (b < c + a) and (c < a + b):
        ans += 1
print(ans)


### FIXED CODE ###

from bisect import bisect_left

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

ans = 0
l.sort()

for i in range(n):
    for j in range(i + 1, n):
        a = l[i]
        b = l[j]
        idx = bisect_left(l, a + b)
        # print(a, b, idx)

        ans += idx - (j + 1)


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

H,W=map(int,input().split())
A=[[True]*(W+2)]+\
  [[True] + [i=="#" for i in input()] + [True] for _ in range(H)] + \
  [[True]*(W+2)]
 
cnt=0
q,r=[],[]
for i in range(1,H+1):
    for j in range(1,W+1):
        if A[i][j]==True:
            q.append((i,j))
if len(q)==H*W:
    import sys
    print(0)
    sys.exit()
while(q):
    for i,j in q:
        if A[i-1][j]==False:
            A[i-1][j]=True
            r.append((i-1,j))
        if A[i+1][j]==False:
            A[i+1][j]=True
            r.append((i+1,j))
        if A[i][j-1]==False:
            A[i][j-1]=True
            r.append((i,j-1))
        if A[i][j+1]==False:
            A[i][j+1]=True
            r.append((i,j+1))
    q=[i for i in r]
    r=[]
    cnt+=1
print(cnt-1)

### FIXED CODE ###

H,W = list(map(int,input().split()))
A = [list(str(input())) for i in range(H)]
 
black = []
 
cnt = 0
 
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            black.append([i,j])
 
length = len(black)
            
while (length < H*W):
    gray = []
    for l in black:
        if l[1] != 0:
            c1 = (l[0],l[1]-1)
            if A[c1[0]][c1[1]] == ".":
                gray.append(c1)
                A[c1[0]][c1[1]] = "#"
        if l[1] != W-1:
            c2 = (l[0],l[1]+1)
            if  A[c2[0]][c2[1]] == ".":
                gray.append(c2)
                A[c2[0]][c2[1]] = "#"
        if l[0] != 0:
            c3 = (l[0]-1,l[1])
            if  A[c3[0]][c3[1]] == ".":
                gray.append(c3)
                A[c3[0]][c3[1]] = "#"
        if l[0] != H-1:
            c4 = (l[0]+1,l[1])
            if  A[c4[0]][c4[1]] == ".":
                gray.append(c4)
                A[c4[0]][c4[1]] = "#"
    
    gray = list(set(gray))
    black = [l for l in gray]
    
    cnt += 1
    length += len(black)
    
print(cnt)
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = [int(x) for x in input().split()]
C = Counter(A)
ans = {}

cal = {}
for a, b in C.items():
    cal[a] = b*(b-1)//2
for i in C.keys():
    ans[i] = sum(cal.values()) - (C[i] - 1)
for a in A:
    print(ans[a])

### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(x) for x in input().split()]
C = Counter(A)
ans = {}
cal = sum([b*(b-1)//2 for b in C.values()])
for a, b in C.items():
    ans[a] = cal - (b-1)
for a in A:
    print(ans[a])
### BUGGY CODE ###

h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))
lr = [[0] * w for i in range(h)]
#print(lr)
for i in range(h):
    cnt = 0
    lis = []
    for j in range(w):

        if s[i][j] == '#':
            lis.append(cnt)
            cnt = 0
        elif j == w-1:
            if s[i][j] == '.':
                cnt += 1
            lis.append(cnt)
        else:
            cnt += 1
    p = 0
    #print(lis)
    for j in range(w):
        if s[i][j] == '.':
            #print(p)
            #print(lr)
            lr[i][j] = lis[p]
        else:
            p += 1
#print(lr)

ud = [[0] * w for i in range(h)]
#print(ud)
for j in range(w):
    cnt = 0
    lis = []
    for i in range(h):
        #print(s[i][j])
        if s[i][j] == '#':
            lis.append(cnt)
            cnt = 0
        elif i == h-1:
            if s[i][j] == '.':
                cnt += 1
            lis.append(cnt)
        else:
            cnt += 1
    p = 0
    #print(lis)
    for i in range(h):
        #print(p,i,j,)
        #print(lis[p])
        #print(ud[j][i])
        if s[i][j] == '.':
            #print(p)
            #print(lr)
            ud[i][j] = lis[p]
        else:
            p += 1
        #print(p)
#print(ud)
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, lr[i][j] + ud[i][j] - 1)
print(ans)


### FIXED CODE ###

h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))
lr = [[0] * w for i in range(h)]
#print(lr)
for i in range(h):
    cnt = 0
    lis = []
    for j in range(w):

        if s[i][j] == '#':
            lis.append(cnt)
            cnt = 0
        elif j == w-1:
            if s[i][j] == '.':
                cnt += 1
            lis.append(cnt)
        else:
            cnt += 1
    p = 0
    #print(lis)
    for j in range(w):
        if s[i][j] == '.':
            #print(p)
            #print(lr)
            lr[i][j] = lis[p]
        else:
            p += 1
#print(lr)

ud = [[0] * w for i in range(h)]
#print(ud)
for j in range(w):
    cnt = 0
    lis = []
    for i in range(h):
        #print(s[i][j])
        if s[i][j] == '#':
            lis.append(cnt)
            cnt = 0
        elif i == h-1:
            if s[i][j] == '.':
                cnt += 1
            lis.append(cnt)
        else:
            cnt += 1
    p = 0
    #print(lis)
    for i in range(h):
        #print(p,i,j,)
        #print(lis[p])
        #print(ud[j][i])
        if s[i][j] == '.':
            #print(p)
            #print(lr)
            ud[i][j] = lis[p]
        else:
            p += 1
        #print(p)
#print(ud)
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, lr[i][j] + ud[i][j] - 1)
print(ans)
### BUGGY CODE ###

import itertools

N, K = list(map(int, input().split()))
p_n = list(map(int, input().split()))
ans = 10 ** 10

for p in itertools.permutations(p_n, K):
    s = sum(p)
    if ans > s:
        ans = s

print(ans)

### FIXED CODE ###

N, K = list(map(int, input().split()))
p_n = list(map(int, input().split()))
ans  = 0
p_n.sort()

for i in range(K):
    ans += p_n[i]

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

N=int(input())
a=list(map(int, input().split()))
b=0
for i in range(N):
  if a[i] in a[i+1:]:
    print("NO")
    b=1
    break
  else:
    pass
if b==0:
  print("YES")

### FIXED CODE ###

import numpy as np
N=int(input())
a=list(map(int, input().split()))
A=np.array(a)
def has_duplicates(seq):
    return len(seq) != len(set(seq))

s=has_duplicates(A)
if s==False:
  print("YES")
elif s==True:
  print("NO")
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    SP = [tuple(input().split()) for i in range(M)]
    wa_num = 0
    wa_num_temp = {}
    ac_num = 0
    ansed = []
    for sp in SP:
        if sp[0] in ansed:
            continue
        if sp[0] not in wa_num_temp:
            wa_num_temp[sp[0]] = 0
        if sp[1] == "WA" and sp[0] not in ansed:
            wa_num_temp[sp[0]] += 1
        elif sp[1] == "AC" and sp[0] not in ansed:
            ac_num += 1
            wa_num += wa_num_temp[sp[0]]
            ansed.append(sp[0])

    print(ac_num, wa_num)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    from sys import stdin
    input = stdin.readline
    N, M = map(int, input().split())
    SP = [list(input().split()) for i in range(M)]
    was = [0] * N
    acs = [0] * N
    penaltyCount = 0
    for sp in SP:
        if acs[int(sp[0])-1] == 1:
            continue
        if acs[int(sp[0])-1] == 0 and sp[1] == "WA":
            was[int(sp[0])-1] += 1
        elif acs[int(sp[0])-1] == 0 and sp[1] == "AC":
            acs[int(sp[0])-1] = 1
            penaltyCount += was[int(sp[0])-1]

    print(sum(acs), penaltyCount)


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

N = int(input())
D = [int(i) for i in input().split()]
D.sort()
M = int(input())
T = [int(i) for i in input().split()]
T.sort()
cnt = [0]*M
s = 0
for n in range(N):
    d = D[n]
    for m in range(s,M):
        if T[m] == d:
            T[m] = 0
            s = m
            cnt[m] += 1
            break

if sum(cnt) == M:
    print('YES')
else:
    print('NO')



### FIXED CODE ###

from collections import Counter
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

cD = Counter(D)

for t in T:
    if cD.get(t,0) == 0:
        print('NO')
        exit()
    else:
        cD[t] -= 1

print("YES")
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
if N % 2 == 1 and (A.count(0) != 1 or not all(A.count(i*2+2)==2 for i in range(N//2))):
    print(0)
elif N % 2 == 0 and not all(A.count(i*2+1)==2 for i in range(N//2)):
    print(0)
else:
    print(2**(N//2) % (10**9 + 7))

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
M = N//2
c = Counter(A)
if N % 2 == 1 and A.count(0) == 1 and all(c[i*2+2] == 2 for i in range(M)):
    print((2 ** M) % (10**9+7))
elif N % 2 == 0 and all(c[i*2+1]==2 for i in range(M)):
    print((2 ** M) % (10**9+7))
else:
    print(0)
### BUGGY CODE ###

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

count = 1
for i in range(1, n):
  if min(p_list[:i+1]) == p_list[i] :
    count += 1
      
print(count)

### FIXED CODE ###

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

count = 1
min = min(p_list[:1]) 
for i in range(1, n):
  if min > p_list[i] :
    count += 1
    min = p_list[i] 

print(count)