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

import numpy as np
h, w, k = map(int, input().split())
s = []
for _ in range(h):
    s.append(list(map(int, list(input()))))
s = np.array(s)

def count(li):
    if np.max(li) > k:
        return -1
    tmp = np.zeros(len(li), dtype=int)
    cnt = 0
    for i in range(w):
        tmp += li[:, i]
        if np.max(tmp) > k:
            cnt += 1
            tmp = li[:, i]
    return cnt

ans = 1000000
for i in range(2**(h-1)):
    r = 0
    l = []
    for j in range(h-1):
        if (i>>j)&1:
            l.append(np.sum(s[r:j+1, :], axis=0))
            r = j+1
    l.append(np.sum(s[r:, :], axis=0))
    cnt = count(np.vstack(l))
    if cnt>=0:
        ans = min(ans, cnt+len(l)-1)
print(ans)


### FIXED CODE ###

import numpy as np
h, w, k = map(int, input().split())
s = []
for _ in range(h):
    s.append(list(map(int, list(input()))))
s = np.array(s)

def count(li):
    if np.max(li) > k:
        return -1
    tmp = np.zeros(len(li), dtype=int)
    cnt = len(li)-1
    for i in range(w):
        tmp += li[:, i]
        if np.max(tmp) > k:
            cnt += 1
            if cnt >= ans:
                return -1
            tmp = li[:, i]
    return cnt

ans = 1000000
for i in range(2**(h-1)):
    r = 0
    l = []
    for j in range(h-1):
        if (i>>j)&1:
            l.append(np.sum(s[r:j+1, :], axis=0))
            r = j+1
    l.append(np.sum(s[r:, :], axis=0))
    if ans <= len(l)-1:
        continue
    cnt = count(np.vstack(l))
    if cnt>=0:
        ans = min(ans, cnt)
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in A:
  cnt = A.count(i)
  if i-1 in A:
    cnt += A.count(i-1)
  if i+1 in A:
    cnt += A.count(i+1)
  ans = max(ans,cnt) 
print(ans)
  

### FIXED CODE ###

n = int(input())
cnt = [0] * 100002
a = list(map(int, input().split()))
for v in a:
    cnt[v] += 1
    cnt[v+1] += 1
    cnt[v+2] += 1
    
print(max(cnt))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N=int(input());AB=[list(map(int,input().split())) for _ in range(1,N)]
nd=[0 for _ in range(N)]
table = [[] for _ in range(N)]
for a,b in AB:
  table[a-1].append(b)
  nd[a-1]+=1
  nd[b-1]+=1

K=max(nd)
co=[0 for _ in range(N)]
for x,li in enumerate(table):
  c=[i for i in range(1,K+1) if i != co[x]]
  for b,y in zip(li,c):
    co[b-1]=y

print(K)
for _,b in AB:
  print(co[b-1])

### FIXED CODE ###

import sys

input = sys.stdin.readline
N=int(input());AB=[tuple(map(int,input().split())) for _ in range(1,N)]

co=[0 for _ in range(N)]
prev=0
color=1
for a,b in sorted(AB):
  if prev!=a:
    color=1
  if co[a-1]==color:
    color+=1
  co[b-1]=color
  prev=a
  color+=1

print(max(co))
for _,b in AB:
  print(co[b-1])
### BUGGY CODE ###

n = int(input())
aa = input()
l = aa.split()
for i in range(0,n):
    l[i] = int(l[i])
dp = []
dp.append("YES")


for i in range(1,n):
    if dp[i-1] == "NO":
        dp.append("NO")
    count = 0
    for j in range(0,i):
        if l[j] == l[i]:
            count = count+1
    if dp[i-1] == "YES" and count == 0:
        dp.append("YES")
    if dp[i-1] == "YES" and count != 0:
        dp.append("NO")
print(dp[n-1])


### FIXED CODE ###

n = int(input())
aa = input()
l = aa.split()
for i in range(0,n):
    l[i] = int(l[i])
l.sort()
count = 0
for i in range(0,n-1):
    if l[i] == l[i+1]:
        count = count+1
if count == 0:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

from fractions import gcd
from functools import reduce

CONST = 10 ** 9 + 7

def lcm(list_):
    return reduce(lambda x, y: x * y // gcd(x, y), list_)

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

l = lcm(a)
total = 0

for a_ in a:
    total += l // a_
    if total >= CONST:
        total %= CONST

print(total)


### FIXED CODE ###

from fractions import gcd
from functools import reduce

MOD = 10 ** 9 + 7

def lcm(list_):
    return reduce(lambda x, y: x // gcd(x, y) * y,
                  list_)

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

l = lcm(a)
total = 0

for a_ in a:
    total += l // a_

print(total % MOD)
### BUGGY CODE ###

n=int(input())
c = list(map(int, input().rstrip().split()))
a=0
b=10**9+7
for i in range(len(c)):
    for j in range(i+1,n):
        
        a=(a+(c[i]*c[j])%b)%b
        
print(a)

### FIXED CODE ###

n=int(input())
c = list(map(int, input().rstrip().split()))
ans=0
b=10**9+7
sum1=0
for i in range(n):
    ans=(ans+c[i]*sum1)%b
    sum1=(sum1+c[i])%b

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

import math
n, k = map(int,input().split())
g={}
for i in range(n):
    g[i]=[]
for i in range(k):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
ans = [-1] * n
queue = [0]
visited = [False] * n
 

while queue:
    x = queue.pop(0)
    for n in g[x]:
        if visited[n] == False: 
            queue.append(n)
            if ans[n] == -1: 
                ans[n] = x
                visited[n] = True
 
if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for a in ans[1:]:
        print(a+1)

### FIXED CODE ###

import math
n, k = map(int,input().split())
g={}
for i in range(n):
    g[i]=[]
for i in range(k):
    a,b= map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
ans = [-1] * n
queue = [0]
visited = [False] * n
 

while queue:
    x = queue.pop(0)
    for n in g[x]:
        if visited[n] == False: 
            queue.append(n)
            if ans[n] == -1: 
                ans[n] = x
                visited[n] = True
 
if -1 in ans[1:]:
    print('No')
else:
    print('Yes')
    for a in ans[1:]:
        print(a+1)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline

    from fractions import gcd

    def lcd(x, y):
        g = gcd(x, y)
        return x * y // g

    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7

    l = 1
    for e in a:
        l = lcd(l, e)

    ans = 0
    for e in a:
        ans += (l // e) % mod
        ans %= mod

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

l = 1
for e in a:
    l = lcm(l, e)

l %= mod

ans = 0
for e in a:
    ans += l * pow(e, mod - 2, mod)
    ans %= mod

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

import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n,m,p=MI()
	G=[[] for _ in range(n+1)]
	
	for _ in range(m):
		a,b,c=MI()
		G[a].append([b,c-p])
	#print(G)
	
	coin=[-10**18]*(n+1)
	coin[1]=0
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				coin[b]=max(coin[b],coin[i]+c)
	#print(coin)
	ans=coin[-1]
	
	check=[False]*(n+1)
	for i in range(1,n+1):
		for b,c in G[i]:
			if coin[b]<coin[i]+c and coin[b]>-10**10:
				check[b]=True
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				check[b]=check[i] or check[b]
	#print(check)
	
	if check[n]==True:
		ans=-1
	else:
		ans=max(ans,0)
	
	print(ans)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

if __name__=="__main__":
	main()


### FIXED CODE ###

import sys

input=sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()


def II(): return int(input())


def MI(): return map(int,input().split())


def MF(): return map(float,input().split())


def LI(): return list(map(int,input().split()))


def LF(): return list(map(float,input().split()))


def TI(): return tuple(map(int,input().split()))


# rstrip().decode('utf-8')


def main():
	n,m,p=MI()
	G=[[] for _ in range(n+1)]
	
	for _ in range(m):
		a,b,c=MI()
		G[a].append([b,c-p])
	#print(G)
	
	coin=[-10**18]*(n+1)
	coin[1]=0
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				coin[b]=max(coin[b],coin[i]+c)
	#print(coin)
	ans=coin[-1]
	
	check=[False]*(n+1)
	for i in range(1,n+1):
		for b,c in G[i]:
			if coin[b]<coin[i]+c and coin[b]>-10**10:
				check[b]=True
	
	for _ in range(n):
		for i in range(1,n+1):
			for b,c in G[i]:
				check[b]=check[i] or check[b]
	#print(check)
	
	if check[n]==True:
		ans=-1
	else:
		ans=max(ans,0)
	
	print(ans)
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

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

M = (int)(1e9 + 7)
m, n = map(int, input().split())
ans = 1;

for i in range(n):
    ans *= m
    ans %= M

print(ans)

### FIXED CODE ###

mod = 1000000007
m, n = map(int, input().split())
print(pow(m,n,mod))
### BUGGY CODE ###

n,k = [int(i) for i in input().split()]
s = [int(i) for i in input()]

num = [0]
which = s[0]
sign = [which]
for i in s:
  if i != which:
    which = 1-which
    num.append(0)
    sign.append(which)
  num[-1] += 1

if k >= len(sign) - sum(sign):
  print(sum([abs(i) for i in num]))
  exit()

#print(num)
#print(sign)

if sign[0] == 0:
  num = [0] + num

if sign[-1] == 0:
  num.append(0)

#print(num)

ans = 0
for i in range(0,len(num),2):
  ans_tmp = sum(num[i:i+2*k+1])
  #print(i,i+2*k,ans_tmp)
  if ans_tmp > ans:
    ans = ans_tmp
    
print(ans)



### FIXED CODE ###

n,k = [int(i) for i in input().split()]
s = [int(i) for i in input()]

num = [0]
which = s[0]
sign = [which]
for i in s:
  if i != which:
    which = 1-which
    num.append(0)
    sign.append(which)
  num[-1] += 1

num_0 = len(sign) - sum(sign)

if k >= num_0:
  print(sum(num))
  exit()

if sign[0] == 0:
  num = [0] + num

if sign[-1] == 0:
  num.append(0)

sum_now = sum(num[0:2*k+1])
ans = sum_now

for i in range(0,len(num),2):
  if i == 0:
    continue
  if i+2*k >= len(num):
    break
  
  plus = num[i+2*k-1]+num[i+2*k]
  minus = num[i-2] + num[i-1]
  diff = plus - minus
  sum_now += diff
  if sum_now > ans:
    ans = sum_now

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


from collections import defaultdict
def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    
    res = defaultdict(int)

    for s in S:
        res[s] += 1

    max_k_list = [kv[0] for kv in res.items() if kv[1] == max(res.values())]

    max_k_list.sort()
    for k in max_k_list:
        print(k)


if __name__ == "__main__":
    resolve()

### FIXED CODE ###


from collections import defaultdict
def resolve():
    N = int(input())
    S = [input() for _ in range(N)]
    
    res = defaultdict(int)

    for s in S:
        res[s] += 1

    max_v = max(res.values())
    max_k_list = [kv[0] for kv in res.items() if kv[1] == max_v]

    max_k_list.sort()
    for k in max_k_list:
        print(k)


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

import math

n, k = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

def search(x, k, A, F):
    for a, f in zip(A, F):
        time = a * f
        if time <= x:
            continue
        else:
            dif = time - x
            training = int(math.ceil(dif/f))
            k -= training

        if k < 0:
            return False
    return True


A.sort()
F.sort(reverse=True)
r= max([a*f for a, f in zip(A, F)])
l = 0
while l < r:
    candidate = (r+l)//2
    if search(candidate, k, A, F):
        r = candidate
    else:
        l = candidate + 1

print(r)

### FIXED CODE ###

import math

n, k = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))

def search(x, k, A, F):
    for a, f in zip(A, F):
        time = a * f
        if time <= x:
            continue
        else:
            dif = time - x
            training = int(math.ceil(dif/f))
            k -= training

        if k < 0:
            return False
    return True


A.sort()
F.sort(reverse=True)
r= max([a*f for a, f in zip(A, F)])
l = 0
while l < r:
    candidate = (r+l)//2
    if search(candidate, k, A, F):
        r = candidate
    else:
        l = candidate + 1

print(r)
### BUGGY CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 998244353
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

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

fact = [1]
for i in range(1, N+10):
    fact.append(fact[-1] * i % MOD)
def rev(x):
    return pow(x, MOD-2, MOD)
def cmb(i, k):
    if(i < k): return 0
    return fact[i] * rev(fact[k]) * rev(fact[i-k]) % MOD

def count(m, k):
    combo = cmb(N-1, k)
    col = m * pow(m-1, N-k-1, MOD)
    val = (combo*col)%MOD
    return val

cnt = 0
for k in range(0, K+1):
    addval = count(M, k)
    cnt += addval
    cnt %= MOD

print(cnt)


### FIXED CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 998244353
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

def main():
    N, M, K = map(int, input().split())

    fact = [1]
    for i in range(1, N+3):
        fact.append(fact[-1] * i % MOD)
    def rev(x):
        return pow(x, MOD-2, MOD)
    def cmb(i, k):
        if(i < k): return 0
        return fact[i] * rev(fact[k]) * rev(fact[i-k]) % MOD

    def count(m, k):
        combo = cmb(N-1, k)
        col = m * pow(m-1, N-k-1, MOD)
        val = (combo*col)%MOD
        return val

    cnt = 0
    for k in range(0, K+1):
        addval = count(M, k)
        cnt += addval
        cnt %= MOD

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

K, S = map(int, input().split())

kotae = 0
for i in range(K + 1):
    for j in range(K + 1):
        for k in range(K + 1):
            if i + j + k == S:
                kotae += 1

print(kotae)

### FIXED CODE ###

K, S = map(int, input().split())

kotae = 0
for Z in range(K + 1):
    X_plus_Y = S - Z
    for Y in range(K + 1):
        X = X_plus_Y - Y
        if 0 <= X <= K:
            kotae += 1

print(kotae)
### BUGGY CODE ###

N = int(input())

A = [''] * N
for i in range(N):
  A[i] = str(input())
  
B = list(set(A))
B.sort()

C = [0] * len(B)

for i in range(len(B)):
  C[i] = A.count(B[i])
  
m = max(C)
ans = [n for n, v in enumerate(C) if v == m]

for i in ans:
  print(B[i])

### FIXED CODE ###

N = int(input())
A = {}
for i in range(N):
  s = str(input())
  if s in A:
    A[s] += 1
  else:
    A[s] = 1

max_val = max(A.values())
keys = [key for key in A if A[key] == max_val]
keys.sort()
for s in keys:
  print(s)
### BUGGY CODE ###

N = int(input())
tmp = []
for _ in range(N):
    tmp.append(input())
tmp.sort()
# print(tmp)

n = []
for t in tmp:
    n.append(tmp.count(t))

# print(n)
m = max(n)
b = ""
for i in n:
    # print(i)
    if i == m:
        if b != tmp[n.index(i)]:
            print(tmp[n.index(i)])
            b = tmp[n.index(i)]
        n[n.index(i)] = -1

### FIXED CODE ###

N = int(input())

ans = {}
m = 1
for _ in range(N):
    w = input()
    c = ans.get(w)
    # print(c)
    # print(type(c))
    if c == None:
        ans[w] = 1
    else:
        ans[w] = c + 1
        if c + 1 > m:
            m = c + 1
# print(ans)

tmp = []
for a in ans:
    if ans[a] == m:
        tmp.append(a)

tmp.sort()
for t in tmp:
    print(t)
### BUGGY CODE ###

S = input()
K = int(input())
target = []
def func(split_range):
    for i in range(0,len(S)-split_range+1):
        #print(S[0:0])
        #print(S[0:1])
        #print(S[i:i+split_range])
        #print(S[i:i+split_range])
        target.append(S[i:i+split_range])

for i in range(1,len(S)+1):
    #print(i)
    func(i)
#print(target)
print(sorted(set(target))[K-1])

### FIXED CODE ###

S = input()
K = int(input())
S_len = len(S)
ans = set()
for i in range(0, K+1):
    for j in range(0, S_len):
        if j + i <= S_len:
            t = S[j:j + i]
            if t != '':
                ans.add(t)
ans = list(ans)
ans.sort()
print(ans[K-1])
### BUGGY CODE ###

#D
n,k=map(int,input().split())
mod=10**9+7
def comb(x,y):
    if y==0 or y==x:
        return 1
    else:
        a=x-y+1
        for j in range(2,y+1):
            a=a*(x-y+j)//(j)
        return a
for i in range(1,k+1):
    print(comb(k-1,i-1)*comb(n-k+1,i)%mod)

### FIXED CODE ###

#D
from scipy.misc import comb
n,k=map(int,input().split())
mod=10**9+7
for i in range(1,k+1):
    print(int(comb(k-1,i-1,exact=True)*comb(n-k+1,i,exact=True))%mod)
### BUGGY CODE ###

import numpy as np
N, K, Q = map(int, input().split())
score = np.array([K]*N)

for _ in range(Q):
    n = int(input())
    score[n-1] = score[n-1] + 1
    score=score-1

for i in score:
    print("Yes" if i>0 else "No")

### FIXED CODE ###

import numpy as np
N, K, Q = map(int, input().split())
score = np.array([K]*N)

for _ in range(Q):
    n = int(input())
    score[n-1] = score[n-1] + 1

score=score-Q

for i in score:
    print("Yes" if i>0 else "No")
### BUGGY CODE ###

import re
if __name__ =="__main__":
    string = input()
    pattern=["A","G","C","T"]
    point = 0
    max_len = 0
    while(True):
        stack_max = 0
        if max_len>(len(string)-point):
            break
        for x in range(point,len(string)):
            if string[x] in pattern:
                stack_max += 1
            else:
                point = x+1
                max_len = max(max_len,stack_max)
                break
        if point == len(string):
            break
        
    print(max_len)

### FIXED CODE ###

if __name__ =="__main__":
    S = input()
    N = len(S)
    ans=0

    for i in range(N):
        for j in range(i,N):
            if all('ACGT'.count(c)==1 for c in S[i:j+1]):
                ans = max(ans,j-i+1)
    print(ans)
### BUGGY CODE ###

n = int(input())
print(sum([i for i in range(n)]))

### FIXED CODE ###

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

import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint


INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

N, M = [int(x) for x in input().split()]
AB = []
for _ in range(N):
    A, B = [int(x) for x in input().split()]
    AB.append((A, B))

AB = sorted(AB, key=lambda x: (-x[1], -x[0]))

ans = 0
used = set()
for m in range(M, -1, -1):
    for i in range(N):
        a, b = AB[i]
        if a + m <= M and i not in used:
            ans += b
            used.add(i)
            # print("m:{}, a:{},b{}".format(m, a, b))
            break

print(ans)


### FIXED CODE ###

import sys, math, itertools, bisect, copy, re
from collections import Counter, deque, defaultdict

from itertools import accumulate, permutations, combinations, takewhile, compress, cycle

# from functools import reduce
# from math import ceil, floor, log10, log2, factorial
# from pprint import pprint
import heapq

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

# N = int(input())
# N,M = [int(x) for x in input().split()]
# V = [[0] * 100 for _ in range(100)]
# A = [int(input()) for _ in range(N)]
# DP = [[0] * 100 for _ in range(100)]
# DP = defaultdict(lambda: float('inf'))

N, M = [int(x) for x in input().split()]
AB = []
for _ in range(N):
    A, B = [int(x) for x in input().split()]
    AB.append((A, B))

AB = sorted(AB, key=lambda x: x[0])

idx = 0
available = []
ans = 0
for d in range(1, M + 1):
    while idx < N and AB[idx][0] <= d:
        heapq.heappush(available, -AB[idx][1])
        idx += 1

    if len(available) != 0:
        ans += (-heapq.heappop(available))

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

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque()
d.append((Ch, Cw))
ans = 0
s = set() # いったところ
a = [(1,0),(-1,0),(0,1),(0,-1),(0,0)]
b = [-2,-1,0,1,2]
while True:
  flag = True
  # 行けるところすべて追加
  while flag:
    flag = False
    for _ in range(len(d)):
      Th, Tw = d.popleft()
      for i,j in a:
        _h = Th + i
        _w = Tw + j
        _p = (_h, _w)
        if (not (_p) in d) and _h >= 0 and _h < h and _w >= 0 and _w < w and t[_h][_w] == '.':
          d.append(_p)
          if not(i == 0 and j == 0):
            flag = True
  # クリアしてるか確認
  temps = set(d)
  if (Dh,Dw) in temps:
    print(ans)
    exit()
  else:
    s |= temps
    d = deque()
    for Th,Tw in temps:
      for i in b:
        for j in b:
          _h = Th + i
          _w = Tw + j
          _p = (_h, _w)
          if (not (_p) in s) and (not (_p) in d) and _h >= 0 and _h < h and _w >= 0 and _w < w and t[_h][_w] == '.':
            d.append(_p)
    if len(d) == 0:
      print('-1')
      exit()
    ans += 1


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
Ch -= 1
Cw -= 1
Dh -= 1
Dw -= 1
t = [[i for i in range(w)] for j in range(h)]
visited = [[0 for i in range(w)] for j in range(h)] # いったところ
ans = 0
for i in range(h):
  temp = input()
  for j in range(w):
    t[i][j] = temp[j]

d = deque([(Ch, Cw)])
ans = 0
a = [(1,0),(-1,0),(0,1),(0,-1)]

while True:
  # 移動A
  stemp = set()
  while len(d) != 0:
    Th, Tw = d.popleft()
    # s.add((Th, Tw))
    visited[Th][Tw] = 1
    stemp.add((Th, Tw))
    if (Th,Tw) == (Dh, Dw):
      print(ans)
      exit()
    for i, j in a:
      _h,_w = Th + i, Tw + j
      _p = (_h, _w)
      if 0 <= _h < h and 0 <= _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
        d.append(_p)
        visited[_h][_w] = 1
  # 移動B
  ans += 1
  for Th,Tw in stemp:
    for i in range(-2, 3) :
      for j in range(-2, 3) :
        _h,_w = Th + i, Tw + j
        _p = (_h, _w)
        if 0 <= _h < h and 0 <=  _w < w and t[_h][_w] == '.' and visited[_h][_w] == 0:
          d.append(_p)
  if len(d) == 0:
    print('-1')
    exit()
### BUGGY CODE ###

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

for i in range(N):
  B = A.copy()
  del B[i]
  print(max(B))
    

### FIXED CODE ###

import sys
input = sys.stdin.readline

import numpy as np

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

from_left = np.maximum.accumulate(A)
from_right = np.maximum.accumulate(A[::-1])[::-1]

from_left, from_right

from_left = [0] + from_left.tolist()[:-1]
from_right = from_right[1:].tolist() + [0]

for x,y in zip(from_left, from_right):
    print(x if x > y else y)
### BUGGY CODE ###

n=int(input())
s=[input() for i in range(n)]
dic={}
for word in s:
    if word in dic:
        dic[word]+=1
    else:
        dic[word]=1
maximum=max(dic.values())
for key,value in sorted(dic.items()):
    if value==max(dic.values()):
        print(key)

### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]
dictionary={}
for word in S:
    if word in dictionary:
        dictionary[word]+=1
    else:
        dictionary[word]=1
maximum=max(dictionary.values())
for key,value in sorted(dictionary.items()):
    if value==maximum:
        print(key)
### BUGGY CODE ###

n=int(input())
ans=[]
for i in range(n):
  a=input()
  if a in ans:
    ans.remove(a)
  else:
    ans.append(a)
print(len(ans))

### FIXED CODE ###

n=int(input())
a=[0 for _ in range(n)]
for i in range(n):
  a[i]=int(input())
a.sort()
ans,cnt=0,0
p=-1
for x in a:
  if p==x:
    cnt+=1
  else:
    p=x
    if cnt%2==1:
      ans+=1
    cnt=1
if cnt%2==1:
  ans+=1
print(ans)