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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w = map(int, readline().split())
a = [input() for i in range(h)]
s = []
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            s.append([i, j])
test = [(0, 1), (0, -1), (1, 0), (-1, 0)]
inf = float('inf')
dist = [[inf] * w for _ in range(h)]
cnt = 0
while s:
    q = [s.pop(0)]
    dist[q[0][0]][q[0][1]] = 0
    q[0] = tuple(q[0])
    cnt = 0
    while q:
        if cnt == (h + w - 2):
            break
        qq = []
        cnt += 1
        for y, x in q:
            for dy, dx in test:
                yy, xx = y + dy, x + dx
                if xx < 0 or yy < 0 or xx > w - 1 or yy > h - 1:
                    continue
                if a[yy][xx] == '#':
                    continue
                if dist[yy][xx] < cnt:
                    continue
                dist[yy][xx] = cnt
                qq.append((yy, xx))
        q = qq
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, dist[i][j])
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w = map(int, readline().split())
a = [input() for i in range(h)]
q = []
dist = [[False] * w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            q.append((i, j))
            dist[i][j] = True
test = [(0, 1), (0, -1), (1, 0), (-1, 0)]
cnt = -1
while q:
    cnt += 1
    qq = []
    for y, x in q:
        for dy, dx in test:
            yy, xx = y + dy, x + dx
            if xx < 0 or yy < 0 or xx > w - 1 or yy > h - 1 or dist[yy][xx]:
                continue
            else:
                dist[yy][xx] = True
                qq.append((yy, xx))
    q = qq
print(cnt)
### BUGGY CODE ###

N = int(input())
 
for n in range(1,N+1):
  ans = 0
  check = False
  for x in range(1,42):
    for y in range(x,64):
      for z in range(y,100):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == n:
          if x == y and y == x and z == x:
            ans += 1
          elif x == y  or z == x or y == z:
            ans += 3
          elif x != y and y != z and z != x:
            ans += 6
  print(ans)

### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(10001)]

for i in range(1,101):
  for j in range(1,101):
    for k in range(1,101):
      v = i*i + j*j + k*k + i*j + j*k + k*i
      if v < 10001:
        ans[v] += 1

for i in range(n):
  print(ans[i+1])
### BUGGY CODE ###

def soin(m):
    pf={}
    for i in range(2,int(m**0.5)+1):
        while m%i==0:
            pf[i]=pf.get(i,0)+1
            m//=i
    if m>1:pf[m]=1
    return pf

n = int(input())
a = list(map(int,input().split()))
p = {}
g = []
mod = 10**9 + 7

for i in range(n):
    g.append(soin(a[i]))
    for k , v in g[i].items():
        if v > p.get(k,0):
            p[k] = v
ans = 0
for i in range(n):
    now = 1
    for k , v in p.items():
        now *= pow(k,p[k]-g[i].get(k,0),mod)
        now %= mod
    ans += now
    ans %= mod
print(ans)

### FIXED CODE ###

import math
n = int(input())
a = list(map(int,input().split()))
g = 1
mod = 10**9 + 7
ans = 0
for i in range(n):
    u = (g*a[i])//math.gcd(g,a[i])
    ans *= u//g
    ans %= mod
    ans += u//a[i]
    ans %= mod
    g = u
print(ans)
### BUGGY CODE ###

A,B,K=map(int,input().split())
while(1):
    if K==0:
        break
    if A>0:
        if A<=K:
            K=K-A
            A=0
    else:
        if B>0 and B<=K:
            K=K-B
            B=0
        elif B>0 and B>=K:
            B=B-K
            K=0
        else:
            pass
print(A,B)

### FIXED CODE ###

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

if A>0:
    if A<=K:
        K=K-A
        A=0
    else:
        A=A-K
        K=0
if A<=0:
    if B>0 and B<=K:
        K=K-B
        B=0
    if B>0 and B>=K:
            B=B-K
            K=0
print(A,B)
### BUGGY CODE ###

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

for a in A:
    for i in range(len(nums)):
        nums[i] += a
        if not nums[i] % M:
            ans += 1
    if not a % M:
        ans += 1
    nums.append(a)

print(ans)

### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    b = 0
    count = {0:1}
    ans = 0
    
    for a in A:
        b = (a+b) % M
        if b in count:
            ans += count[b]
            count[b] += 1
        else:
            count[b] = 1
            
    print(ans)

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

#D
n, k = map(int, input().split())
a = list(map(int, input().split()))
town = 1
for i in range(k):
    town = a[town-1]
print(town)

### FIXED CODE ###

def f(x):
    return int(x)-1
n, k = map(int, input().split())
a = list(map(f, input().split()))
town = 0
i=0
l = [-1] * n
while True:
    if l[town] != -1:
        j = l[town]
        break
    i += 1
    l[town] += i
    town = a[town]
    # print(town,l)
# print(town)
if k >= i:
    k = (k - j) % (i - j) + j
print(l.index(k)+1)
### BUGGY CODE ###

import queue
h, w = map(int, input().split())
s, count, ans = [], 0, float('inf')
for _ in range(h):
    a = input()
    count += a.count('#')
    s.append(list(a))

q = queue.Queue()
q.put((0, 0, 1))
while not q.empty():
    c0, c1, c2 = q.get()
    s[c0][c1] = '#'
    if c0 == h-1 and c1 == w-1:
        ans = min(ans, h*w-count-c2)
        continue
    for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        x, y = c0+i, c1+j
        if 0 <= x < h and 0 <= y < w:
            if s[x][y] == '#':
                continue
            else:
                q.put([x, y, c2+1])
if ans == float('inf'):
    print(-1)
else:
    print(ans)


### FIXED CODE ###

def cal():
    import queue
    h, w = map(int, input().split())
    s = [list(input()) for _ in range(h)]
    cost = [[-1]*w for _ in range(h)]
    INF = float('inf')
    count, ans = 0, INF
    for i in range(h):
        for j in range(w):
            if s[i][j] != '#':
                cost[i][j] = INF
            else:
                count += 1        
    q = queue.Queue()
    q.put((0, 0, 1))
    while not q.empty():
        c0, c1, c2 = q.get()
        s[c0][c1] = '#'
        if c0 == h-1 and c1 == w-1:
            return h*w-count-c2
        for i, j in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            x, y = c0+i, c1+j
            if 0 <= x < h and 0 <= y < w:
                if s[x][y] != '#' and cost[x][y] == INF:
                    cost[x][y] = c2+1
                    q.put((x, y, c2+1))

    return ans

ans = cal()
if ans == float('inf'):
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

import numpy as np

def f(x,a):
  return np.array([ c^x for c in a ],dtype=np.int64).sum()

def g(y,s):
  return np.array([s[m,y[m]] for m in range(M)]).sum()

def bitlength(x):
  i=0
  while x > 0:
    x //= 2
    i += 1
  return i

def bitlengthceil(x):
  l = bitlength(x)
  if x == 2**(l-1):
    return l
  else:
    return (l+1)

def bit2num(y):
  return np.array([ y[m]<<m for m in range(M)]).sum()

(N,K) = map(int,input().split())
A = np.array(list(map(int,input().split())),dtype=np.int64)
M=40

B = np.empty((M,N),dtype=np.int64)
Y = np.empty(M,dtype=np.int64)

for n in range(N):
  for m in range(M):
    B[m,n] = (A[n] >> m) % 2

S = np.empty((M,2),dtype=np.int64)
for m in range(M):
  s = B[m].sum()
  S[m] = [s<<m,(N-s)<<m]
  if 2*s < N:
    Y[m] = 1
  else:
    Y[m] = 0

Kb = np.array([ (K >> i) % 2 for i in range(M)],dtype=np.int64)

ans = S[:,0].sum()
for m in range(M):
  if Kb[m] == 0:
    continue
  else:
    Z = np.concatenate((Y[:m],np.array([0],dtype=np.int64),Kb[m+1:]))
    ans = max(ans,g(Z,S))

print(ans)

### FIXED CODE ###

inpl = lambda: list(map(int,input().split()))
N, K = inpl()
A = inpl()

L = K+1
M = len(bin(L))-2
MM = max(M, len(bin(max(A)))-2)
best = []
ones_num = []
zeros_num = []
for m in range(MM):
    ones = sum([ (A[i]>>m)&1 for i in range(N) ])
    zeros = N - ones
    ones_num.append(ones)
    zeros_num.append(zeros)
    if ones >= zeros:
        best.append(0)
    else:
        best.append(1)
cur = sum([ (N-ones_num[m] if (best[m] and m < M-1) else ones_num[m])<<m for m in range(MM)])
ans = cur
m = M - 1
while m > 0:
    cur += (zeros_num[m]-ones_num[m])<<m
    m -= 1
    while (L >> m)&1 == 0:
        if best[m] == 1:
            cur += (ones_num[m]-zeros_num[m])<<m
        m -= 1
        if m < 0:
            break
    else:
        if best[m] == 1:
            cur += (ones_num[m]-zeros_num[m])<<m
        if cur > ans:
            ans = cur
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
Flag = 1
while Flag:
    flag = 0
    for i in range(N):
        for j in range(i, N):
            if(A[j] < A[j-1]):
                temp = A[j-1]
                A[j-1] = A[j]
                A[j] = temp
                flag = 1 
                count += 1
print(*A)
print(count)
            

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
flag = True
while flag:
    flag = False
    for i in range(N-1, 0, -1):
        if(A[i] < A[i-1]):
            A[i], A[i-1] = A[i-1], A[i]
            flag = True
            count += 1
print(*A)
print(count)
### BUGGY CODE ###

from sys import stdin
from sys import  setrecursionlimit
setrecursionlimit(30000)

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

dp_map = []
for i in range(N+1):
    temp_arr = [-1 for _ in range(H+1)]
    dp_map.append(temp_arr)
#dp_map = [[-1]*(H+1)]*(N+1)
#print(len(dp_map))
#print(len(dp_map[0]))

def DP(i, j):
    if j<=0:
        return 0
    if dp_map[i][j]!=-1:
        return dp_map[i][j]
    
    if i==1:
        dp_map[i][j] = DP(i,j-As[i-1])+Bs[i-1]
        return dp_map[i][j]

    dp_map[i][j] = min(DP(i-1,j),DP(i,j-As[i-1])+Bs[i-1])
    return dp_map[i][j]

print(DP(N,H))

### FIXED CODE ###

from sys import stdin
from sys import  setrecursionlimit
setrecursionlimit(10000)

[H, N] = [int(x) for x in stdin.readline().rstrip().split()]
As = []
Bs=[]
for i in range(N):
    [A, B] = [int(x) for x in stdin.readline().rstrip().split()]
    As.append(A)
    Bs.append(B)

INF = 10**10
dp_map = [[INF]*(H+1) for _ in range(N+1)]

#dp_map[i][j]: i番目の魔法までを使って、最低でもjのダメージを与える時に必要なMP
dp_map[0][0]  = 0
for i in range(N):
    for j in range(H+1):
        if j<As[i]:
            dp_map[i+1][j] = min(dp_map[i+1][0]+Bs[i],dp_map[i][j])
        else:
            dp_map[i+1][j] = min(dp_map[i+1][j-As[i]]+Bs[i] ,dp_map[i][j])

print(dp_map[N][H])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
U = [0]*(10**6+1)
for e in A:
    U[e] += 1
ans = 0
for k in range(1,10**6+1):
    if U[k] == 1:
        ans += 1
    if U[k] > 0:
        for l in range(2*k,max(A)+1,k):
            if U[l] > 0:
                U[l] += 1
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
U = [0]*(10**6+1)
for e in A:
    U[e] += 1
ans = 0
for k in range(1,10**6+1):
    if U[k] == 1:
        ans += 1
    if U[k] > 0:
        for l in range(2*k,10**6+1,k):
            if U[l] > 0:
                U[l] += 1
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
B = {}
C = {}
for a in A:
    c = A.count(a)
    C[a] = c
    B[a] = c * (c - 1) / 2

s = int(sum(B.values()))
for a in A:
    print(int(s - (C[a] * (C[a] - 1) / 2) + ((C[a] - 2) * (C[a] - 1) / 2)))


### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
C = {}
for a in A:
    if a in C:
        C[a] += 1
    else:
        C[a] = 1

s = int(sum(c * (c - 1) / 2 for c in C.values()))
for a in A:
    print(int(s - C[a] + 1))
### BUGGY CODE ###

n = int(input())
L = [[] for _ in range(n+1)]
R = [[] for _ in range(n+1)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    w %= 2
    L[u] += [[u, v, w]]
    R[v] += [[v, u, w]]
P = [[] for _ in range(2*n+2)]
P[1] += (L[1]+R[1])
for i in range(1, 2*n):
    for _, v, w in P[i]:
        P[i+2-w] += (L[v]+R[v])
A = []
for p in P[1::2]: A += p
B = set([u for u, *_ in A])
for i in range(1, n+1): print(1 if i in B else 0)

### FIXED CODE ###

n = int(input())
L = [[] for _ in range(n+1)]
R = [[] for _ in range(n+1)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    w %= 2
    L[u] += [[u, v, w]]
    R[v] += [[v, u, w]]
P = [[] for _ in range(2*n+2)]
P[1] += (L[1]+R[1])
L[1] = R[1] = []
for i in range(1, 2*n):
    for _, v, w in P[i]:
        P[i+2-w] += (L[v]+R[v])
        L[v] = R[v] = []
A = []
for p in P[1::2]: A += p
B = set([u for u, *_ in A])
for i in range(1, n+1): print(1 if i in B else 0)
### BUGGY CODE ###

N = int(input())
Result = []
for i in range(N):
    number = int(input())
    if not number in Result:
        Result.append(number)
    else:
        Result.remove(number)
print(len(Result))

### FIXED CODE ###

N = int(input())
Result = set()
for i in range(N):
    number = int(input())
    if  number in Result:
        Result.remove(number)
    else:
        Result.add(number)
print(len(Result))
### BUGGY CODE ###

import math
from functools import reduce

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

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

answer = 0
N = int(input())
for a in range(1,N+1):
    for b in range(1,N+1):
        for c in range(1,N+1):
            answer += gcd(a,b,c)
            
print(answer)

### FIXED CODE ###

from math import gcd

K = int(input())
ans=0
array = [0] * 201

for X in range(1,K+1):
    for c in range(1,K+1):
        array[X] += gcd(X,c)

for a in range(1,K+1):
    for b in range(1,K+1):
        X = gcd(a,b)
        ans += array[X]

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

n = int(input())

A = [0] * n
for i in range(n):
    A[i] = int(input())

def is_prime(n):
    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, n, 2):
        if n % i == 0:
            return False
    return True

print(len([x for x in A if is_prime(x)]))

### FIXED CODE ###

import math
n = int(input())

A = [0] * n
for i in range(n):
    A[i] = int(input())

# Naive method
def is_prime(n):
    if n < 2:
        return False
    elif n == 2 or n == 3 or n == 5 or n == 7:
        return True
    elif n % 2 == 0:
        return False
    else:
        for i in range(3, int(math.sqrt(n))+1, 2):
            if n % i == 0:
                return False
    return True

print(len([x for x in A if is_prime(x)]))
### BUGGY CODE ###

h,w,d=map(int,input().split())
l=[[] for t in range(h*w)]
for i in range(h):
  ll=list(map(int,input().split()))
  for j in range(w):
    l[ll[j]-1]=[i,j]
q=int(input())
f=lambda x:int(x)-1
for qq in range(q):
  ans=0
  a,b=map(f,input().split())
  for x in range(a,b+1-d,d):
    ans+=abs(l[x+d][0]-l[x][0])+abs(l[x+d][1]-l[x][1])
  print(ans)

### FIXED CODE ###

h,w,d=map(int,input().split())
l=[[] for t in range(h*w)]
for i in range(h):
  ll=list(map(int,input().split()))
  for j in range(w):
    l[ll[j]-1]=[i,j]
    
r=[[0] for dd in range(d)]
for dd in range(d):
  if dd==0:
    k=d
  else:
    k=dd
  while k+d<=h*w:
    r[dd].append(r[dd][-1]+abs(l[k+d-1][0]-l[k-1][0])+abs(l[k+d-1][1]-l[k-1][1]))
    k+=d

    
q=int(input())
for qq in range(q):
  a,b=map(int,input().split())
  if a%d==0:
    p=d
  else:
    p=a%d
  aa=(a-p)//d
  bb=(b-p)//d
  ans=r[a%d][bb]-r[a%d][aa]
  print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
dic = {}
raw = []
dic[1] = []
for i in range(M):
  P, Y = map(int, input().split())
  raw.append([P, Y])
  if not dic.get(P):
    dic[P] = list() 
  dic[P].append(Y)
for i in range(1, N+1):
  try:
    dic[i].sort()
  except:
    continue
for i in range(M):
  P, Y = raw[i]
  ind = dic[P].index(Y)
  P = "{0:06d}".format(P)
  Y = "{0:06d}".format(ind+1)
  print(P+Y)

### FIXED CODE ###

N, M = map(int, input().split())
dic = {}
raw = []
dic[1] = []
for i in range(M):
  P, Y = map(int, input().split())
  raw.append([P, Y, i])
raw.sort()
for i in range(M):
  if i == 0:
    raw[i][1] = 1
    p, y, ind = raw[i]
    continue
  pp, yy, iind = raw[i]
  if pp == p:
    raw[i][1] = y + 1
  else:
    raw[i][1] = 1
  p, y, ind = raw[i]
raw.sort(key = lambda x:x[2])
for r in raw:
    p, y, ind = r
    P = "{0:06d}".format(p)
    Y = "{0:06d}".format(y)
    print(P+Y)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10000)
from collections import deque
N, Q = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N-1)]
PX = [list(map(int, input().split())) for _ in range(Q)]

chil = [[] for _ in range(N+1)]
count = [0]*(N+1)

for ab in AB:
    chil[ab[0]].append(ab[1])
    chil[ab[1]].append(ab[0])

def cleanse(fromN, toN):
    chil[toN].remove(fromN)
    if len(chil[toN])==0:
        return
    for node in chil[toN]:
        cleanse(toN, node)

def connect(fromN, toN):
    chil[toN].remove(fromN)
    if len(chil[toN])==0:
        return
    for node in chil[toN]:
        cleanse(toN, node)

for node in chil[1]:
    cleanse(1, node)

def addition(fromN, toN):
    count[toN] += count[fromN]
    if len(chil[toN])==0:
        return
    for node in chil[toN]:
        addition(toN, node)
        
for px in PX:
    count[px[0]] += px[1]

for node in chil[1]:
    addition(1, node)

print(*count[1:])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, Q = map(int, input().split())

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

points = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    points[p-1] += x

def dfs(v, par):
    for nv in edges[v]:
        if nv == par:
            continue
        points[nv] += points[v]
        dfs(nv, v)

dfs(0, -1)

print(*points)
### BUGGY CODE ###

import copy
N,K = list(map(int, input().split()))

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

count = [0]
Check = [0] * N
while True:
    countCheck = copy.copy(count)
    count.append(A[count[-1]]-1)
    if(Check[count[-1] == 1]):
        break

    Check[count[-1]] += 1
#    print(countCheck, count)

#print(count)


saisyo = count.index(count[-1]) + 1

loop_kazu = len(count) - saisyo

#print(loop_kazu)
K_loop = K - saisyo

ans_index = K_loop % loop_kazu
#print(ans_index)

ans = count[saisyo + ans_index] + 1

print(ans)

#hoge = count[loop:loop_kaisuu]
#ans = hoge[(K - loop) % loop_kaisuu]

#ans = count[K % loop] + 1

#print(ans)

### FIXED CODE ###

import copy
N,K = list(map(int, input().split()))
 
A = list(map(int, input().split()))
 
count = [0]
Check = [0] * N
for i in range(K):
    count.append(A[count[-1]]-1)
#    print(count)
    if(Check[count[-1]-1] == 1):
        break
 
    Check[count[-1]-1] = 1
    i += 1
 
saisyo = count.index(count[-1]) + 1
#print(count,saisyo)
 
if(saisyo == len(count)):
    saisyo = 0
 
loop_kazu = len(count) - saisyo
 
if(K > loop_kazu):
    K_loop = K - saisyo
 
    ans_index = K_loop % loop_kazu
    ans = count[saisyo + ans_index] + 1
 
    print(ans)
 
else:
    print(count[K]+1)
### BUGGY CODE ###

H,W = map(int,input().split(' '))
bk = []
for i in range(H):
	t = input()
	bk.extend([(i,x) for x in range(W) if t[x] == '#'])

ans = -1

for y in range(H):
	for x in range(W):
		t = min([abs(x-x2)+abs(y-y2) for y2,x2 in bk])
		ans = max(t,ans)

print(ans)



### FIXED CODE ###

H,W = map(int,input().split(' '))
bk = []
for i in range(H):
	t = input()
	bk.extend([(x,i) for x in range(W) if t[x] == '#'])

mat = [[True]*H for i in [0]*W]
for x,y in bk:
	mat[x][y] = False

cnt = 0
al = len(bk)
while(True):
	if al == H*W:
		break
	new = []
	for x,y in bk:
		if x > 0 and mat[x-1][y]:
			mat[x-1][y] = False
			new.append((x-1,y))
		if x < W-1 and mat[x+1][y]:
			new.append((x+1,y))
			mat[x+1][y] = False
		if y > 0 and mat[x][y-1]:
			new.append((x,y-1))
			mat[x][y-1] = False
		if y < H-1 and mat[x][y+1]:
			new.append((x,y+1))
			mat[x][y+1] = False
	al += len(new)
	bk = new
	cnt += 1
print(cnt)
### BUGGY CODE ###

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

ans_list = []
ans_cnt = 0
for i in range(N):
    if A[i] in ans_list:
        ans_list.remove(A[i])
        ans_cnt -= 1
    else:
        ans_list.append(A[i])
        ans_cnt += 1
        
print(ans_cnt)

### FIXED CODE ###

N = int(input())

kami = set([])
for i in range(N):
    A = int(input())
    if A not in kami:
        kami.add(A)
    else:
        kami.remove(A)

print(len(kami))
### BUGGY CODE ###

S = input()

# stored = set({})
prev = ''

ans = 0
while len(S) > 0:
    j = 1
    while S[:j] == prev:
        j += 1

    if S[:j] == S[j:]:
        j += 1

    prev = S[:j]
    ans += 1
    # stored.add(S[:j])
    # print(j, S[:j], S[j:])
    S = S[j:]

# print(len(stored))
print(ans)

### FIXED CODE ###

S = input()

i = 1
buf = S[0]
ans = 1

while i <= len(S) - 1:
    if buf == S[i]:
        # 2文字ずらすと，何をとってもOK (Siは2文字，Si+1は1文字なので)
        i = i + 2
        if i <= len(S): # ズラした分，末尾じゃなければ+1
            ans += 1
        buf = ""
    else:
        # 違う文字ならそのまま入れ替えればOK
        ans += 1
        buf = S[i]
        i = i + 1

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

def kou(a,b):
    while (a != 0):
        if a < b:
            k = a
            a = b
            b = k
        a = a % b
    return(b)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    while len(x) > 1:
#        print(x[0],x[1])
        y = kou(x[0],x[1])
        x.pop(0)
        x.pop(0)
        x.insert(0,y)
#        print(x)
    print(x[0])

if __name__ == "__main__":
    main()

### FIXED CODE ###

def gcd(a,b):
    while b != 0:
        a, b = b, a%b
    return(a)

def main():    
    N,X = map(int,input().split())
    x = list(map(int,input().split()))
    for i in range(N):
        x[i] = abs(x[i]-X)
    y = x[0]
    for i in range(N):
        if x[i]%y == 0:
            continue
        y = gcd(y,x[i])
    print(y)

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

n,k = map(int,input().split())
a = list(map(int,input().split()))
ans1,ans2=0,0
i = 0
while i < n-1:
    j = i+1
    while j < n:
        if a[i]>a[j]:
            ans1+=1
        j+=1
    i+=1
i = 0
while i < 2*n-1:
    j = i+1
    while j < 2*n:
        if a[i%n]>a[j%n]:
            ans2+=1
        j+=1
    i+=1
print((ans1*((1+k)*k)//2+(ans2-3*ans1)*((1+(k-1))*(k-1))//2)%(10**9+7))

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans3 = 0
for i in range(n-1):
    for j in range(i+1,n):
        if a[i]>a[j]:
            ans1+=1
        elif a[i]==a[j]:
            ans3+=1
ans2 = (n*(n-1))//2 - ans1 - ans3
print((ans1*((1+k)*k)//2+ans2*(k*(k-1))//2)%(10**9+7))
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
num=[0]*n
for i in range(n-1):
    if s[i+1]=="C" and s[i]=="A":
        num[i]+=1
for i in range(q):
    l,r=map(int,input().split())
    print(sum(num[l-1:r-1]))


### FIXED CODE ###

n,q=map(int,input().split())
s=input()
num=[0]
for i in range(n-1):
    if s[i+1]=="C" and s[i]=="A":
        num.append(num[-1]+1)
    else:
        num.append(num[-1])
for i in range(q):
    l,r=map(int,input().split())
    print(num[r-1]-num[l-1])
### BUGGY CODE ###

N = int(input())

nums = []
for n in range(1,N+1):
    nums.append(int(N/n))

sum = 0
ro = 1
for num in nums:
    s = int(((1+num)*num)/2)
    sum += ro*s
    ro += 1

print(sum)

### FIXED CODE ###

N = int(input())
 
sum = 0
ro = 1
for n in range(1,N+1):
    num = int(N/n)
    if num == 1:
        record = n
        break
    s = int(((1+num)*num)/2)
    sum += ro*s
    ro += 1


sum += int(((record+N)*(N-record+1))/2)
print(sum)
### BUGGY CODE ###

n,k,q=map(int,input().split())
lst=[k]*n
for i in range(q):
  person=int(input())
  lst=list(map(lambda x: x-1, lst))
  lst[person-1]+=1
for p in range(n):
  if lst[p]<=0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

n,k,q=map(int,input().split())
lst=[0]*n
for i in range(q):
  person=int(input())
  lst[person-1]+=1
for p in range(n):
  temp=k-q+lst[p]
  if temp<=0:
    print("No")
  else:
    print("Yes")