Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
def fact(n, k=1):
    if n == 0:
        return 1
    if n <= k:
        return 1
    return n*fact(n-1)%MOD
fact_t = []
for n in range(N):
    fact_t.append(fact(n))
def comb(n, k):
    return (fact_t[n]//(fact_t[n-k]*fact_t[k]))%MOD
s = [1,-1]
for m in range(2):
    for i in range(K-1,N):
        res = (res + s[m]*int((A[i])*comb(i,K-1)))%MOD
    A = sorted(A, reverse=True)
print(res)


### FIXED CODE ###

N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1)
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,N+1):
    fac[i] = fac[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD
def comb(n, k):
    return (fac[n]*((finv[k]*finv[n-k])%MOD))%MOD
s = [1,-1]
for m in range(2):
    for i in range(K-1,N):
        res = (res + s[m]*int((A[i])*comb(i,K-1)))%MOD
    A = sorted(A, reverse=True)
print(res)
while True:
      n, m = map(int, raw_input().split())
      if n == 0 and m == 0:
            break
      p = [ 1 for i in range(n) ]
      pn = n; count = 0; flag = 1
      while flag = 1:
            for i in range(n):
                  if p[i] == 1:
                        count += 1
                        if count == m:
                              p[i] = 0
                              count = 0
                              pn -= 1
                              if pn == 1:
                                    flag = 0
                                    break

      print p.index(1)+1

### FIXED CODE ###

while True:
      n, m = map(int, raw_input().split())
      if n == 0 and m == 0:
            break
      p = [ i+1 for i in range(n) ]
      np = n; a = 0
      while np > 1:
            a = (a+m-1)%len(p)
            p.pop(a)
            np -= 1
      print p[0]
a, b, c = map(int, input().split())
num = c**2+a**2+b**2-2*a*c+2*a*b-2*b*c
if bin(num) <= bin(4*a*b):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])
x, y, z, k = map(int, input().split())

A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))


total = [0]*k
count = 0


def sum_all(a, b, change):
	for i in range(len(change)):
		try:
			total[count] = change[i]
			count += 1
		except IndexError:
			sort_total = sorted(total)
			for i in total:
				print(i)

			quit()

i, j, k = x-1, y-1, z-1
start = 0
while i > 0 or j > 0 or k > 0:
	possible = sorted([A[i], B[j], C[k]])
	now = possible[start]
	
	if A[i] == now:
		sum_all(B[j], C[k], A[:i+1])
	elif B[i] == now:
		sum_all(A[i], C[k], B[:j+1])
	else:
		sum_all(A[i], B[j], C[:k+1])

	start += 1
	if start == 2:
		i -= 1
		j -= 1
		k -= 1




### FIXED CODE ###

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

A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

temp = []
for a in A:
	for b in B:
		temp.append(a+b)

temp = sorted(temp, reverse=True)
temp = temp[:K]

ans = []
for c in C:
	for num in temp:
		ans.append(num+c)

ans = sorted(ans, reverse=True)
for i in range(K):
	print(ans[i])
class Node:
    def __init__(self, val):
        self.num = val
        self.nodes = []
        self.distance = []

def set_color(node, color):
    if color_list[node.num] == None:
        color_list[node.num] = color
        if len(node.nodes) > 0:
            for child, dist in zip(node.nodes, node.distance):
                if child != node:
                    if dist == 0:
                        set_color(child, color)
                    else:
                        set_color(child, not color)

N= int(input())

node_list = [Node(i) for i in range(N)]
color_list = [None for i in range(N)]

for i in range(N-1):
    u, v, w = map(int, input().split())
    x = node_list[u-1]
    y = node_list[v-1]
    w = w % 2
    x.nodes.append(y)
    x.distance.append(w)
    y.nodes.append(x)
    y.distance.append(w)

set_color(node_list[0], True)

for i in color_list:
    if i:
        print(1)
    else:
        print(0)


### FIXED CODE ###

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

class Node:
    def __init__(self):
        self.color = 0
        self.check = False
        self.link = []

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

    nodes = [Node() for i in range(N)]
    
    for i in range(N-1):
        u, v, w = map(int, input().split())
        nodes[u-1].link.append((nodes[v-1], w&1))
        nodes[v-1].link.append((nodes[u-1], w&1))
    
    q = deque()
    q.append((nodes[0], 1))
    while len(q) > 0:
        node, color = q.popleft()
        node.color = color
        node.check = True
        for nex, weight in node.link:
            if not nex.check:
                if weight == 0:
                    q.append((nex, color))
                else:
                    q.append((nex, -color))
    
    for i in range(N):
        print((nodes[i].color + 1) // 2)

if __name__ == "__main__":
    main()
a,b,c,d=list(input())
op=lambda i,a:"+" if i&a else "-"
for i in range(8):
  s=a+op(i&1)+e+op(i&2)+c+op(i&4)+d
  if eval(s)==7:print(s+"=7");exit()

### FIXED CODE ###

s=input()
for i in range(2**3):
  b=bin(i)[2:].zfill(3)
  a=s[0]
  for i in range(3):a+=("+"if b[i]=="0"else"-")+s[i+1]
  if eval(a)==7:print(a+"=7");exit()
import math
n = int(input())


for i in the range(n+1):
    ans= math.sqrt(i)
    ans= str(ans)
    if "." not in ans:
        print(ans)
        break


### FIXED CODE ###

n = int(input())
i = 1
while i * i <= n:
    i += 1
print((i - 1) * (i - 1))
for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break

### FIXED CODE ###

n = int(input())
flag = True
ans = 1
now = n
count = 1


for i in range(10000):
    if n > 2**i:
        pass
    elif n == 1:
        print(1)
        break
    elif n == 2**i:
        print(4*(2**(i)//2)-1)
        break
    else:
        print(4*(2**(i-1)//2)-1)
        break
N = int(input().strip())
x = []
y = []
h = []
for i in range(0, N):
    xi, yi, hi= [int(a) for a in input().strip().split()]
    x.append(xi)
    y.append(yi)
    h.append(hi)

def calc_H():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H = -1
            for i in range(0, N):
                if h[i] == 0:
                    continue
                Hi = h[i] + abs(x[i]-Cx) + abs(y[i]-Cy)
                if H == -1:
                    H = Hi
                if H != Hi:
                    break
                if i == N-1:
                    return Cx, Cy, H

print(*calc_H())

### FIXED CODE ###

N = int(input().strip())
xyh = []
for i in range(0, N):
    xi, yi, hi= [int(a) for a in input().strip().split()]
    xyh.append((xi, yi, hi))

xyh.sort(key = lambda t: t[2], reverse = True)

def calc_H():
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            H = -1
            for i in range(0, N):
                Hi = xyh[i][2] + abs(xyh[i][0]-Cx) + abs(xyh[i][1]-Cy)
                if H == -1:
                    H = Hi

                if xyh[i][2] == 0:
                    if H > Hi:
                        break
                elif H != Hi:
                    break

                if i == N-1:
                    return Cx, Cy, H

print(*calc_H())
lis = [int(input()) for i in range 3]
print(int(lis[0]*lis[1]*lis[2]/2))

### FIXED CODE ###

lis = [int(input()) for i in range(3)]
print(int((lis[0]+lis[1])*lis[2]/2))
import numpy as np

A, B, C, D = map(int, input().split())
x, y = zip(*sorted(zip([A, B, C, D], [1, -1, 1, -1])))
print(np.diff(x)[np.cumsum(y)[:-1] == 2][0])

### FIXED CODE ###

import numpy as np

A, B, C, D = map(int, input().split())
x, y = zip(*sorted(zip([A, B, C, D], [1, -1, 1, -1])))
z = np.diff(x)[np.cumsum(y)[:-1] == 2]
print(z[0] if len(z) == 1 else 0)
S = input()
print(700 + 100 * S.count(o))

### FIXED CODE ###

S = input()
print(700 + 100 * S.count("o"))
n=int(input())
h=list(map(int,input().split()))
ans=0
kari=0
inde=0
while 1:
    suuzi=h[inde]
    if h[inde+1]<=suuzi:
        kari+=1
    elif ans<kari:
        ans=kari
        kari=0
    inde+=1
    if inde==n-1:
        if ans<kari:
          ans=kari

        break
print(ans)

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
ans=0
kari=0
for i in range(n-1):
        if h[i+1]<=h[i]:
            kari+=1
        else:
            if ans<kari:
                ans=kari
            kari=0
        
       
print(max(ans,kari))
# sys.stdin.readline()
import sys
input = sys.stdin.readline

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

#output
import fractions, functools
import numpy as np

mod = 10**9 + 7

def lcm_base(x, y):
    return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)

#lcm = A[0]
#for i in range(1, N):
#    lcm = lcm * A[i]//fractions.gcd(lcm, A[i])

answer = 0
for i in range(N):
    answer += lcm//A[i] % mod

print(answer % mod)

### FIXED CODE ###

import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
#output
import fractions, functools
 
def lcm_base(x, y):
    return (x*y) // fractions.gcd(x, y)
def lcm_list(numbers):
    return functools.reduce(lcm_base, numbers, 1)
 
lcm = lcm_list(A)
 
answer = 0
for i in range(N):
    answer += lcm//A[i]
 
print(answer % (10**9 + 7))
#import math
#from functools import reduce
#from fractions import gcd
#from functools import lru_cache
import numpy as np

#def lcm_base(x, y):
#    return (x * y) // gcd(x, y)

#def lcm(numbers):
#    return reduce(lcm_base, numbers, 1)

#@lru_cache(maxsize=1000)
def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // np.gcd(x, a[i])
    return x


n = int(input())
A = [int(x) for x in input().split()]

t_lcm = lcm(A)
count = 0
for i in A:
    count += t_lcm//i
    
print(count%(10**9+7))


### FIXED CODE ###

#import math
#from functools import reduce
from fractions import gcd
#from functools import lru_cache


#def lcm_base(x, y):
#    return (x * y) // gcd(x, y)

#def lcm(numbers):
#    return reduce(lcm_base, numbers, 1)


def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x


n = int(input())
A = [int(x) for x in input().split()]

t_lcm = lcm(A)
count = 0
for i in A:
    count += t_lcm//i
    
print(count%(10**9+7))
a, b, c = map(int, input().split())
if a+b+c = 19:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())
if a+b+c == 17:
    print("YES")
else:
    print("NO")
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.atan((v/a*a)/a))
else:
	print(math.atan((x/a*a)/a))


### FIXED CODE ###

import math
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.degrees(math.atan2((2*(b-(x/(a*a)))), a)))
elif x == v:
	print(0)
else:
	print(90 - math.degrees(math.atan2(((2*x)/(a*b)), b)))
# -*- coding: utf-8 -*-
from collections import defaultdict

n = int(input())
pairs = list()
patterns = defaultdict(int)

for _ in range(n):
    pairs.append(tuple((map(int, input().split()))))

for i in range(n):
    for j in range(n):
        if i != j:
            patterns[(pairs[i][0] - pairs[j][0], pairs[i][1] - pairs[j][1])] += 1

print(n - max(patterns.values()))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import defaultdict

n = int(input())
pairs = list()
patterns = defaultdict(int)

for _ in range(n):
    pairs.append(tuple((map(int, input().split()))))

for i in range(n):
    for j in range(n):
        if i != j:
            patterns[(pairs[i][0] - pairs[j][0], pairs[i][1] - pairs[j][1])] += 1

ans = 1
if n > 1:
    ans = n - max(patterns.values())

print(ans)
x,y = map(int,input().split())
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)

### FIXED CODE ###

x,y = map(int,input().split())
ans = 0
if abs(y) > abs(x):
  if x < 0:ans += 1
  if y < 0:ans += 1
  ans += (abs(y)-abs(x))
else:
  if x > 0:ans += 1
  if y > 0:ans += 1
  ans += (abs(x)-abs(y))
print(ans)
N, M = map(int, input().split())

A = [list(map(int, input())) for _ in range(N)]
B = [list(map(int, input())) for _ in range(M)]

def func():
  for i in range(N-M):
    for j in range(N-M):
      if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):
        return True
  return False

print("Yes" if func() else "No")

    


### FIXED CODE ###

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

f = lambda x: 1 if x == "#" else 0
A = [list(map(f, input())) for _ in range(N)]
B = [list(map(f, input())) for _ in range(M)]

def func():
  for i in range(N-M+1):
    for j in range(N-M+1):
      if all(A[i+k][j+l] == B[k][l] for k in range(M) for l in range(M)):
        return True
  return False

print("Yes" if func() else "No")
import math 
A,B,X = map(int,input().split())

t = 0
if (A**2)*B/X >= 2:
    t = float((A*(B**2))/(2*X))
else:
    t = float((A**3)/(2*(A**2)*B-2*X))

print(math.atan(t)*180/math.pi)

### FIXED CODE ###

import math 
A,B,X = map(int,input().split())

t = 0
if (A**2)*B/X >= 2:
    t = float((A*(B**2))/(2*X))
else:
    t = float((2*(A**2)*B-2*X)/(A**3))

print(math.atan(t)*180/math.pi)
a = map(int,input().split())

print('possible' if (a+b)% ==0 else 'impossible')

### FIXED CODE ###

a,b = map(int,input().split())
if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
N, W = 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] * (W + 1) for _ in range(N + 1)]

for i in range(N):
    for j in range(W+1):
        if j-w[i]>=0:
            dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i])
        dp[i+1][j]=max(dp[i+1][j],dp[i][j])
print(dp[N][W])

### FIXED CODE ###

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

V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]

dp[0][0] = 0
for i in range(N):
	for j in range(V + 1):
		# i+1番目を選ぶ場合
		if j - v[i] >= 0:
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])
		# i+1番目を選ばない場合
		dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるようなjの最大値が答えになる
ans = 0
for j in range(V + 1):
	if dp[N][j] <= W:
		ans = j

print(ans)
import heapq
# dijkstra
# edges = |V|のリスト
# 頂点iから頂点jにコストwで移動可能な場合：edges[i] = [(j, w)]

def dijkstra(n, edges, start):
    INF = float('inf')
    vertices = [INF] * n # 初期化
    vertices[start] = 0 # スタートの距離はゼロ
    hq = [(0, start)]
    heapq.heapify(hq)

    while q:
        cost, v = heapq.heappop(hq)
        
        for to, w in edges[v]:
            if cost + w >= vertices[to]:
                continue
            vertices[to] = cost + w
            heapq.heappush(hq, (vertices[to], to))
    
    return vertices

# input
n, m, s, t = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(m)]

G_yen = [[] for _ in range(n)]
G_snu = [[] for _ in range(n)]

s, t = s - 1, t - 1

for u, v, a, b in G:
    G_yen[u - 1].append((v - 1, a))
    G_yen[v - 1].append((u - 1, a))
    G_snu[u - 1].append((v - 1, b))
    G_snu[v - 1].append((u - 1, b))

yen = dijkstra(n, G_yen, s)
snu = dijkstra(n, G_snu, t)

ans = [INF]

for i in reversed(range(n)):
    tmp = snu[i] + yen[i]
    ans.append(min(ans[-1], tmp))

for i in reversed(ans[1:]):
    print(10 ** 15 - a)

### FIXED CODE ###

import heapq
# dijkstra
# edges = |V|のリスト
# 頂点iから頂点jにコストwで移動可能な場合：edges[i] = [(j, w)]

def dijkstra(n, edges, start):
    INF = float('inf')
    vertices = [INF] * n # 初期化
    vertices[start] = 0 # スタートの距離はゼロ
    hq = [(0, start)]
    heapq.heapify(hq)

    while hq:
        cost, v = heapq.heappop(hq)
        
        for to, w in edges[v]:
            if cost + w >= vertices[to]:
                continue
            vertices[to] = cost + w
            heapq.heappush(hq, (vertices[to], to))
    
    return vertices

# input
n, m, s, t = map(int, input().split())
G = [list(map(int, input().split())) for _ in range(m)]
INF = float('inf')


G_yen = [[] for _ in range(n)]
G_snu = [[] for _ in range(n)]

s, t = s - 1, t - 1

for u, v, a, b in G:
    G_yen[u - 1].append((v - 1, a))
    G_yen[v - 1].append((u - 1, a))
    G_snu[u - 1].append((v - 1, b))
    G_snu[v - 1].append((u - 1, b))

yen = dijkstra(n, G_yen, s)
snu = dijkstra(n, G_snu, t)

ans = [INF]

for i in reversed(range(n)):
    tmp = snu[i] + yen[i]
    ans.append(min(ans[-1], tmp))

for i in reversed(ans[1:]):
    print(10 ** 15 - i)
s = str(input())
num = len(s)
dp = [[0,0] for i in range(n+1)]
for i in range(n):
  for j in [1,2]:
    for k in [1,2]:
      if i + k <= n:
        a = s[i-j:i]
        b = s[i:i+k]
        if a != b:
          dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)
print(max(dp[n]))

### FIXED CODE ###

s = str(input())
n = len(s)
dp = [[0,0] for i in range(n+1)]
for i in range(n):
  for j in [1,2]:
    for k in [1,2]:
      if i + k <= n:
        a = s[i-j:i]
        b = s[i:i+k]
        if a != b:
          dp[i+k][k-1] = max(dp[i+k][k-1],dp[i][j-1]+1)
print(max(dp[n]))
#input
S = input()

#output
N = len(S)
k = N//2
l = (N-3)//4
m = (3*N-1)//4
if N == 3:
    if S[0] == S[3]:
        print("Yes")
    else:
        print("No")
elif N > 3:
    if (S[0:k] == S[-1:k:-1] )and (S[0:l] == S[(N-3)//2:l:-1]) and (S[(N+1)//2:m] == S[N-1:m:-1]):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

#input
S = input()

#output
N = len(S)

if (S == S[::-1]) and (S[:(N-1)//2] == S[:(N-1)//2][::-1]) and (S[(N+3)//2-1:] == S[(N+3)//2-1:][::-1]):
    print("Yes")
else:
    print("No")
N, M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
  max_item = A.index(max(A))
  A[max_item] //= 2
print(sum(A))

### FIXED CODE ###

S = input()
weather = ['Sunny', 'Cloudy','Rainy']
if S == weather[0]:
  print(weather[1])
elif S == weather[1]:
  print(weather[2])
else:
  print(weather[0])
a, b = int(input()).split()
seki = a * b
sekito = seki % 2
if sekito == 1:
  response = 'Odd'
else :
  response = 'Even'
print(response)

### FIXED CODE ###

a, b = map(int, input().split())
seki = a * b
sekito = seki % 2
if sekito == 1:
  response = 'Odd'
else :
  response = 'Even'
print(response)
from __future__ import division, print_function
from sys import stdin, maxint
 
 
def main():
    n = int(stdin.readline())
 
    M = []
    for _ in xrange(n):
        M.append([int(s) for s in stdin.readline().split()])
 
    g = set(xrange(1, num+1))
    index = g.pop()
    h = {index}
    weight = 0
 
    while g:
        minimum = maxint
        for j in h:
            mj = M[j-1]
            for i in g:
                if 0 <= mj[i-1] < minimum:
                    index = i
                    minimum = mj[i-1]
        h.add(index)
        g.remove(index)
        weight += minimum
 
  
 
 
main()

### FIXED CODE ###

from __future__ import division, print_function
from sys import stdin, maxint
 
 
def main():
    num = int(stdin.readline())
 
    M = []
    for _ in xrange(num):
        M.append([int(s) for s in stdin.readline().split()])
 
    g = set(xrange(1, num+1))
    index = g.pop()
    h = {index}
    weight = 0
 
    while g:
        minimum = maxint
        for j in h:
            mj = M[j-1]
            for i in g:
                if 0 <= mj[i-1] < minimum:
                    index = i
                    minimum = mj[i-1]
        h.add(index)
        g.remove(index)
        weight += minimum
 
    print(weight)
 
 
main()
a8, a10 = input().split(' ')
a8 = int(a8)
a10 = int(a10)
 
value1 = int(a8 / 0.08)
value2 = int(a10 / 0.1)

if int(value1 * 0.1) == a10:
  if value1 > value2:
    print(value1)
  else:
    print(value2)
elif int(value2 * 0.08 == a8):
  if value1 > value2:
    print(value1)
  else:
    print(value2)
else:
  print(-1)

### FIXED CODE ###

s = input()
n, a, b = s.split(' ')
n = int(n)
a = int(a)
b = int(b)

na = n // (a+b) * a
if n % (a+b) >= a:
  na += a
else:
  na += (n % (a + b))
  
print(na)
n=int(input())
a,b,c=input(),input(),input()
ct=0
for i in range(n):
  if a[i]==b[i]==c[i]:ct+=0
  elif a[i]==b[i] or b[i]==c[i] or c[i]==a[i]:ct+=1
  else:ct+=2
print(ct)​

### FIXED CODE ###

n=int(input())
a=input()
b=input()
c=input()
ct=0
for i in range(n):
  if a[i]==b[i] and b[i]==c[i]:ct+=0
  elif a[i]==b[i] or b[i]==c[i] or c[i]==a[i]:ct+=1
  else:ct+=2
print(ct)
N = list(map(int, input().split()))
d = {}

pos=[]
for x in range(N[0]):
    a = list(map(int, input().split()))
    for y in pos:
        key = (a[0]-y[0])*(10**11)+(a[1]-y[1])
        if key<0:
            key=-key
        if key not in d:
            d[key] = 0
        d[key] += 1
    pos.append(a)
    
print(N[0]-max(d.values()))

### FIXED CODE ###

N = list(map(int, input().split()))
d = {0:0}

pos=[]
for x in range(N[0]):
    a = list(map(int, input().split()))
    for y in pos:
        key = (a[0]-y[0])*(10**11)+(a[1]-y[1])
        if key<0:
            key=-key
        if key not in d.keys():
            d[key] = 0
        d[key] += 1
    pos.append(a)
    
print(N[0]-max(d.values()))
S=input()
s=set(S)
if ("N" in s and "S" not in s) or
	("S" in s and "N" not in s) or
	("E" in s and "W" not in s) or
    ("W" in s and "E" not in s):
      print("No")
else:
  print("Yes")

### FIXED CODE ###

S = input()
s = set(S)
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" not in s) \
 or ("W" in s and "E" not in s) \
 or ("E" in s and "W" not in s):
    print("No")
else:
    print("Yes")
print(input.swapcase())

### FIXED CODE ###

print(input().swapcase())
l = int(input())

for p in range(19, 0, -1):
    if 2**p < l:
        n = p+1
        break

p = n-1
m = 2*p
ans = []
for i in range(1, n):
    ans.append([i, i+1, 0])
    ans.append([i, i+1, 2**(i-1)])
    
while l > 2**p:
    for i in range(n-1, 0, -1):
        if l-2**(i-1) >= 2**p:
            ans.append([i, n, l-2**(i-1)])
            l = l-2**(i-1)
            m += 1
            break

print(n, m)
for a in ans:
    print(' '.join(list(map(str, a))))


### FIXED CODE ###

l = int(input())

p = 0
while True:
    if 2**p > l:
        p -= 1
        break
    else:
        p += 1
        
n = p+1
m = 2*p
ans = []
for i in range(1, n):
    ans.append([i, i+1, 0])
    ans.append([i, i+1, 2**(i-1)])
    
while l > 2**p:
    for i in range(n-1, 0, -1):
        if l-2**(i-1) >= 2**p:
            ans.append([i, n, l-2**(i-1)])
            l = l-2**(i-1)
            m += 1
            break

print(n, m)
for a in ans:
    print(' '.join(list(map(str, a))))
import sys

def keta(x):
    return len(str(x))

while True:
    t=input()
    if t=="":
        sys.exit()
    a,b=[int(i) for i in t.split(" ")]
    print(keta(a+b))

### FIXED CODE ###

while True:
    try:
        a,b=[int(i) for i in input().split(" ")]
        print(len(str(a+b)))
    except EOFError:
        break
from operator import itemgetter
import  numpy as np
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
in_num = [0] * n

p = np.zeros((n,m))

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1,i]= b
    in_num[a-1]+=1

p_sort=np.sort(p,axis=1)
in_num = np.array(in_num)
in_num = m - in_num
for i in range(m):
    year=str(in_p[i]).zfill(6)
    a =  np.where(p_sort == in_y[i])
    b = int(a[1] - in_num[int(a[0])]+1 )
    print("{0}{1}".format(year,str(b).zfill(6)))






### FIXED CODE ###

import copy

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

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))