peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
from collections import Counter, defaultdict
n = int(input())
lc = [chr(i) for i in range(97, 97+26)]
ans_dict = Counter(input())

for _ in range(n-1):
    S = input()
    tmp = {k:0 for k in lc}
    for s in S:
        tmp[s] += 1

    for k in tmp.keys():
        try:
            ans_dict[k] = min(ans_dict[k], tmp[k])
        except:
            pass

#%%
ans = ''
for k, v in sorted(ans_dict.items()):
    ans += k * v
print(ans[:n])
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
if (b-a)%2 == 0:
 print(int((b-a)/2))
else:
 print(min(b-1,n-a))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

if x ==0:
    print(sum(a))
    exit()

ans = 0

if a[0]>x:
    ans += a[0]-x
    a[0]=x

for i in range(1,n):
    two = a[i-1]+a[i]
    if two > x:
        tmp = two-x
        ans += tmp
        if tmp > a[i]: a[i]=0
        else: a[i] = a[i]-tmp

print(ans)
# Judge status: Wrong Answer
N = int(input())
s = str (N)
print(s[-1])
if s[-1] == "3":
  print ("bon")
elif s[-1] == "0" or "1" or "6" or "8":
  print ("pon")
else:
  print ("hon")
# Judge status: Wrong Answer
n=input()
change=0
for i in range(1,len(n)+1):
  sn=list(n)
  x=sn[len(sn)-i]
  if int(x)>5:
    change+=(10-int(x))
    n=str(int(n)+(10-int(x))*10**(i-1))
pay=0
snf=list(n)
for j in range(len(snf)):
  pay+=int(snf[j])
print(pay+change)
# Judge status: Accepted
N = input()
li = input()
#print(li)
red = li.count("R")
white = li.count("W")
#print(red,white)


target = li[:red]
ans = red - target.count("R")
print(ans)
# Judge status: Accepted
import math
n,m = [int(x) for x in input().split()]

mod = 10**9 + 7

if n == m:
    ans = (math.factorial(n) * math.factorial(m) * 2) % mod
elif abs(n-m) > 1:
    ans = 0
else:
    ans = (math.factorial(n) * math.factorial(m)) % mod

print(ans)
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))

x_sort = sorted(x)
lenth = len(x)
low = x_sort[int(lenth/2)-1]
high = x_sort[int(lenth/2)]

for y in x:
    if y <= low:
        print(high)
    else:
        print(low)
# Judge status: Accepted
r, g, b = map(int, input().split())
a = r * 100 + g * 10 + b * 1

if a % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
x = int(input())

ans = 0
time = 0

while ans < x:
    time += 1
    ans += time

print(time)
# Judge status: Accepted
S = int(input())
print((S/3)**3)
# Judge status: Wrong Answer
import sys
from itertools import permutations

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    if N >= M // 2: print(N)
    else:
        leftC = M - N * 2
        print(N + leftC // 4)

    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

S = str(input())

if S[0]==S[1]==S[2]:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
a,s,c = input().split()

print('A'+s[0]+'C')
# Judge status: Wrong Answer
N = input()
P = input().split(' ')
count = 0
PM = min(P)
for i, Pi in enumerate(P):
    if i == 0:
        count = count +1
        Pmin = Pi

    elif Pmin>=P[i]:
        count = count +1
        Pmin = Pi

print(count)
# Judge status: Accepted
n = int(input())
s = input()

x, ans = 0, 0
for o in s:
    if o == 'I':
        x += 1 
    else:
        x -= 1
    ans = max(ans, x)

print(ans)
# Judge status: Wrong Answer
ps='aeiuo'
c=input()
for i in range(5):
  if c==ps[i]:
    print('vowel')
else:
  print('consonant')
# Judge status: Accepted
X, A, B = map(int, input().split())
if B-A <= 0:
  print("delicious")
elif X >= B-A:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
A,B,C = map(int, input().split())
K = int(input())

cnt = 0
for i in range(100):
  if A >= B:
    B *= 2
    cnt += 1
    continue
  if B >= C:
    C *= 2
    cnt += 1
    continue

if cnt <= K:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b,c = list(map(int,input().split()))

import math

if math.sqrt(a)+math.sqrt(b) < math.sqrt(c):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
import sys
x = int(input())

mon = 100
ri = 1
year = 0
if x <= mon:
  print(1)
  sys.exit()
while x > mon:
  #print(mon)
  ri = mon*0.01
  mon = math.floor(mon+ri)
  year += 1
  #print(year,mon)

print(year)
# Judge status: Wrong Answer
x, y = map(int, input().split())
a = [4, 6, 9, 11]
b = 0
c = 0
if x == 2 or y == 2:
    print("No")
else:
    if x in a:
        b = 1
    elif y in a:
        c = 1
    if (b + c) % 2 == 0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n,d = map(int,input().split(" "))
d = d*2 + 1
answer = 0
while n >0:
  n-=d
  answer += 1
  
print(answer)
# Judge status: Accepted
A, B, C, D = map(str, input())

for op1 in '+-':
    for op2 in '+-':
        for op3 in '+-':
            if eval(A+op1+B+op2+C+op3+D) == 7:
                print(A+op1+B+op2+C+op3+D+'=7')
                exit()
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
if A == B == C:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
x,y=map(int,input().split())
if x%y==0:
    print(-1)
else:
    print(x*y-x)
# Judge status: Wrong Answer
D = int(input())

if D == 25:
    ans = 'Christmas'
elif D == 24:
    ans = 'Christmas Eve'
elif D == 23:
    ans = 'Christmas Eve Eve'
elif D == 22:
    ans = 'Christmas Eve Eve'
# Judge status: Wrong Answer
def main2():
    N, M, K = map(int, input().split())

    for i in range(1, N + 1):
        for j in range(1, M + 1):
            b = i * (M - j) + j * (N - i)

            if b == K:
                print("Yes")
                exit()

    print("No")

if __name__ == "__main__":
    main2()
# Judge status: Accepted
n,m,X=map(int,input().split())
c=[list(map(int,input().split())) for i in range(n)]
ans=float('inf')
from itertools import combinations as com
for l in range(1,n+1):
    for i in com(list(range(n)),r=l):
        cnt=[0]*m
        p=0
        for j in i:
            p+=c[j][0]
            for x in range(m):
                cnt[x]+=c[j][x+1]
        if min(cnt)>=X:ans=min(ans,p)
print(ans if ans!=float('inf')else -1)
# Judge status: Accepted
from numpy import cumsum
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = cumsum(a)
sb = cumsum(b)
ans = 0
for i in range(n):
    ans = max(ans, sa[i] + sb[n-1] - sb[i] + b[i])

print(ans)
# Judge status: Accepted
# AGC 025 A - Digits Sum
n = int(input())

def DegitSum(x):
    ans = 0
    while x > 0:
        ans += x%10
        x = x // 10
    return ans
    
res = 10**8
for a in range(1, n//2+1):
    b = n - a
    if DegitSum(a) + DegitSum(b) < res:
        res = DegitSum(a) + DegitSum(b)
        
print(res)
# Judge status: Accepted
N,M = map(int,input().split())

if N == 1 and M == 1:
    print(1)
    exit()
elif N == 1:
    print(M-2)
    exit()
elif M == 1:
    print(N-2)
    exit()

print((N-2)*(M-2))
# Judge status: Accepted
h, w = map(int, input().split())
if h == 1 or w == 1:
    print(1)
elif h * w % 2 == 0:
    print(h * w // 2)
else:
    print(h * w // 2 + 1)
# Judge status: Wrong Answer
N,K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
if len(p) >= 3 :
    print(str(p[0] + p[1] + p[2]))
elif len(p) == 2 :
    print(str(p[0]+p[1]))
elif len(p) == 1 :
    print(str(p[0]))
# Judge status: Accepted
x = int(input())

possible = [0] * (x+1) # array of x+1 zeroes
possible[0] = 1

for k in range(x+1):
    for i in range(100, 106):
        if k-i >= 0 and possible[k-i]:
            possible[k] = 1

print(possible[x])
# Judge status: Accepted
N = int(input())
A = tuple(map(int, input().split()))
S = [0]
for a in reversed(A):
    S.append(S[-1] + a)
S.reverse()

lst = [0] * (N + 2)
lst[0] = 1
for i, a in enumerate(A):
    if lst[i] < a:
        print(-1)
        break
    lst[i + 1] = min((lst[i] - a) * 2, S[i + 1])
else:
    print(sum(lst))
# Judge status: Accepted
N = int(input())
vals = list(map(int,input().split()))

vals = sorted(vals)

val = vals[0]
for i in range(1,N):
    val = (val + vals[i]) / 2.0
print(val)
# Judge status: Wrong Answer
import collections
N=int(input())
A=sorted(list(map(int,input().split())))
p=collections.Counter(A)
B=list(set(A))
ans=0
l=len(B)
if l==1:
  ans = p[B[0]]
elif l==2:
  ans = p[B[0]]+p[B[1]]
else:  
  for i in range(l-2):
    sum_a = p[B[i]]+p[B[i+1]]+p[B[i+2]]
    if sum_a > ans:
      ans = sum_a
print(ans)
# Judge status: Accepted
c=input()
en={'a','e','i','o','u'}
print('vowel' if c in en else 'consonant')
# Judge status: Accepted
import collections
import numpy as np
import sys
sys.setrecursionlimit(10000000)
import copy
#N=int(input())
N,K=map(int,input().split())
D=set(input())
while len(set(str(N))&D)>0:
    N+=1
print(N)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
  a.append(a[i] + A[i])
for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
# Judge status: Accepted
a = input()
print('A' if ord(a) <= 90 else 'a')
# Judge status: Accepted
a, b = map(int, input().split())

if a <= 0 and b >= 0:
    print('Zero')
if b < 0:
    if (b - a) % 2 == 0:
        print('Negative')
    else:
        print('Positive')
if a > 0:
    print('Positive')
# Judge status: Accepted
a,v=map(int,input(). split())
b,w = map(int,input(). split())
t=int(input())


if a<=b:

    dist_a = a + t*v

    dist_b = b + t*w

    if dist_a>=dist_b:
        print('YES')
    else:
        print('NO')
else:

    dist_a = a - t*v

    dist_b = b - t*w

    if dist_a<=dist_b:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
N = int(input())
MOD = 1e+9 + 7
shift = 70
a = [int(i) for i in input().split()]

b = [0 for _ in range(shift)]

for i in a:
  for j in range(shift):
    b[j] += (i >> j) & 1

ans = 0
for i, j in enumerate(b):
  ans += ((j * (N - j)) * 2**i) % MOD
  
print(int(ans%MOD))
# Judge status: Wrong Answer
N = int(input())
v = list(map(int, input().split()))
while True:
    if len(v) == 1:
        print(v[0])
        break
    s = sum(v)
    t = (-1, -1, 0)
    for i in range(len(v)):
        for j in range(i, len(v)):
            x = s - v[i]/2 - v[j]/2
            if x > t[2]:
                t = (i, j, x)
    x = v.pop(i)
    y = v.pop(j-1)
    v.append((x+y)/2)
# Judge status: Accepted
import heapq
n,m=map(int, input().split())
lst = []
for i in range(n):
  a,b=map(int, input().split())
  lst.append((-b,a))
lst = sorted(lst, key=lambda x:x[1])

now_idx = 0
queue = []
sum_ = 0
for i in range(1,m+1):
  for j in range(now_idx, n):
    if lst[j][1] <= i:
      heapq.heappush(queue, lst[j])
    else:
      now_idx = j
      break
  else:
    now_idx = n
  if len(queue)>0:
    sum_ -= heapq.heappop(queue)[0]
print(sum_)
# Judge status: Wrong Answer
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(1, k):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
# Judge status: Accepted
a,b,c = map(int,input().split())
print(min(b//a,c))
# Judge status: Accepted
_, K = [int(i) for i in input().split()]
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))
s=set([])
ans=[]
A.sort(reverse=True)
for a in A:
  if a not in s:
    s.add(a)
  else:
    ans.append(a)
    s.discard(a)
  if len(ans)>=2:
    break
if len(ans)<2:
  print(0)
else:
  print(ans[0]*ans[1])
# Judge status: Accepted
a,b=map(int,input().split())
if a-1>=b:
    print(2*a-1)
elif b-1>=a:
    print(2*b-1)
else :
    print(a+b)
# Judge status: Accepted
a,b,c = map(str,input().split())
print(a[0]+b[0]+c[0])
# Judge status: Accepted
A = list(map(int, input().split()))
A.sort()
Ans = 0
temp = (A[2] - A[0])//2
Ans += temp
A[0] += temp*2
temp = (A[2] - A[1])//2
Ans += temp
A[1] += temp*2
if A[0] == A[1] == A[2]:
    print(Ans)
elif A[0] == A[1]:
    print(Ans+1)
else:
    print(Ans+2)
# Judge status: Wrong Answer
import sys
import math
import bisect


def main():
    n = int(input())
    ans = (n//2) / n
    print('%.10f' % ans)



if __name__ == "__main__":
    main()
# Judge status: Accepted
def extract(seq):
    arr = []
    for i in seq:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            arr.append(i)
    return sum(arr)


n = int(input())
print(extract(range(1, n + 1)))
# Judge status: Accepted
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
res=k
ab.sort()
for i in range(n):
  res-=ab[i][1]
  if res<=0:
    print(ab[i][0])
    exit()
# Judge status: Accepted
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from fractions import gcd
def resolve():
    S=input()
    Sd=S[::-1]
    cnt=0
    for i in range(len(S)):
        if S[i]!=Sd[i]:
            cnt+=1
    print(cnt//2) 
#%%submit!
resolve()
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=0
for i in range(n):
    ans+=a[-i]*(-1)**(i+1)
print(ans)
# Judge status: Wrong Answer
import math
x = int(input())
ans = 1
for i in range(2, x):
    p_max = math.floor(math.log(x, i))
    if p_max < 2:
        break
    ans = max(ans, i**p_max)
print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())
cnt = 0
while(1):
    if A%2!=0 or B%2!=0 or C%2!=0:
        break
    A_tmp = A
    B_tmp = B
    C_tmp = C
    A = (B_tmp+C_tmp)/2
    B = (A_tmp+C_tmp)/2
    C = (A_tmp+C_tmp)/2
    cnt += 1
    if A_tmp==A and B_tmp==B and C_tmp==C:
        cnt = -1
        break
print(cnt)
# Judge status: Wrong Answer
X, Y, A, B, C = list(map(int,input().split()))
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
 
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
 
Z = 0
while Z < C:
  if p[X - 1] < r[Z]:
    X -= 1
    Z += 1
  elif q[Y - 1] < r[Z]:
    Y -= 1
    Z += 1

print(sum(p[:X]) + sum(q[:Y]) + sum(r[:Z]))
# Judge status: Wrong Answer
a=int(input())
s=input()
if a>=3200:
    print('s')
else:
    print('red')
# Judge status: Accepted
import sys
def input():return sys.stdin.readline()[:-1]
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
s=input()
print(s[:3])
# Judge status: Wrong Answer
import math

N, M = map(int, input().split())
if abs(N - M) > 2:
    print(0)
    exit()


N = math.factorial(N) % (10 ** 9 + 7)
M = math.factorial(M) % (10 ** 9 + 7)
if N == M:
    print((N * M * 2) % (10 ** 9 + 7))
else:
    print((N * M) % (10 ** 9 + 7))
# Judge status: Wrong Answer
import numpy as np


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
coordinate = np.arange(1, N+1)

limit_count = int(np.log10(N))
for _ in range(limit_count):
    B = np.zeros(N, dtype="int")
    for i in range(N):
        end = np.minimum(coordinate[i]+A[i], N)
        start = np.maximum(coordinate[i]-A[i], 1)

        B[start-1:end] += 1
    A = B

print(" ".join(map(str, A.tolist())))
# Judge status: Accepted
s = input()
n = int(s)

lucas = [2, 1]

x = 0

index = 0

while (index < n):
    x = lucas[index] + lucas[index + 1]
    lucas.append(x)
    index += 1

print(lucas[index])
# Judge status: Accepted
n,m,x,y = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
max_x = max(a)
min_y = min(b)
max_x = max(max_x,x)
min_y = min(min_y,y)

if max_x < min_y:
  print("No War")
else:
  print("War")
# Judge status: Accepted
s = input()

ans = 0
for c in s:
    if c == '1':
        ans += 1

print(ans)
# Judge status: Accepted
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
C = Counter(A)
L = []
for k, v in C.items():
  if v >= 2:
    L.append(k)
  if v >= 4:
    L.append(k)
if len(L) < 2:
  print(0)
else:
  L.sort()
  ans = L[-1] * L[-2]
  print(ans)
# Judge status: Wrong Answer
N, L = map(int, input().split())
strs = sorted([''.join(sorted(list(input()))) for _ in range(N)])
print(''.join(strs))
# Judge status: Accepted
S=input()
List = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i in range (len(List)):
  if List[i] == S:
    print(i+1)
# Judge status: Accepted
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N)]
cd = [list(map(int,input().split())) for _ in range(M)]

for x1,y1 in ab:
    tmp = float('inf')
    ans = None
    for num,xy2 in enumerate(cd):
        x2 = xy2[0]
        y2 = xy2[1]
        dist = abs(x1-x2)+abs(y1-y2)
        if dist < tmp:
            tmp = dist
            ans = num + 1
    print(ans)
# Judge status: Wrong Answer
cnt = 1
mod = 7
k = int(input())

for i in range(k):
  if mod % k == 0:
    break
  cnt += 1
  mod = (mod * 10 * 7) % k

if mod % k == 0:
  print(cnt)
else:
  print(-1)
# Judge status: Accepted
from collections import deque
N, H = map(int, input().split())
a, b = [], []
for _ in range(N):
    a_, b_ = map(int, input().split())
    a.append(a_)
    b.append(b_)
a.sort()
b.sort()
maxa = a[-1]
que = deque(b)
cnt = 0
while H > 0:
    if not que:
        cnt += -(-H//maxa)
        break
    maxb = que.pop()
    if maxb > maxa:
        cnt += 1
        H -= maxb
    else:
        cnt += -(-H//maxa)
        break
print(cnt)
# Judge status: Wrong Answer
x, y, z = map(int,input().split())

result = 0
while y*result + z*result <= x:
  result += 1

print(result)
# Judge status: Accepted
n = int(input())
if n % 2: print(0); exit()
n //= 2
ans = 0

while n >= 5:
    n //= 5
    ans += n
print(ans)
# Judge status: Accepted
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  x = int(input())
  ans = 1
  for i in range(1,x):
    for j in range(2,x):
      if i**j <= x:
        ans = max(ans, i**j)
      else:
        break
  print(ans)
  
if __name__ == '__main__':
  main()
# Judge status: Accepted
X = int(input())
A = range(-400, 400)
for a in A:
    for b in A:
        if X == a ** 5 - b ** 5:
            print(a, b)
            exit()
# Judge status: Accepted
n,x = list(map(int,input().split()))
l = list(map(int,input().split()))
l.insert(0,0)
r = 0
n_l = []
for i in l:
    r += i
    n_l.append(r)

ans = 0
for i in n_l:
    if i <= x:
        ans += 1

print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
s,c=[0]*M,[0]*M
for i in range(M):
    s[i],c[i] = map(int,input().split())
for i in range(10**N):
    if len(str(i)) != N:
        pass
    else:
        num=list(str(i))
        ok = True
        for j in range(M):
            if num[s[j]-1] != str(c[j]):
                ok = False
        if ok:
            print(i)
            exit()
print(-1)
# Judge status: Accepted
n = input()
hon = ["2", "4", "5", "7", "9"]
pon = ["0", "1", "6", "8"]
if n[-1] in hon:
    print("hon")
elif n[-1] in pon:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
N,M = map(int,input().split())
N_List = []
O_List = []

for i in range(M):
    a,b = map(int,input().split())
    if a == 1:
        N_List.append(b)
    if b == 1:
        N_List.append(a)
    if a == N:
        O_List.append(b)
    if b == N:
        O_List.append(a)

print(("IMPOSSIBLE","POSSIBLE")[len(set(N_List) & set(O_List)) > 0])
# Judge status: Accepted
n=int(input())
l=sorted(list(map(int, input().split())))

ans=0
for i in range(len(l)):
    for j in range(i+1, len(l)):
        for k in range(j+1, len(l)):
            if l[i]==l[j] or l[j]==l[k] or l[k]==l[i]:
                continue
            if l[i]+l[j]>l[k]:
                ans+=1
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
s = []
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in range(d):
        s.append(a[j])
s = set(s)
print(n-len(s))
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
ans=0

if A==B and B==C:
  ans=-1
  pass
else:
  while True:
    if A%2!=0 or B%2!=0 or C%2!=0:
      break

    A,B,C=B/2+C/2,A/2+C/2,A/2+B/2
    ans+=1

print(ans)
# Judge status: Wrong Answer
n = int(input())
ng =0
ok=n
while abs(ok-ng)>1:
  mid=(ok+ng)//2
  if mid*(1+mid)//2>=n:
    ok=mid
  else:
    ng = mid
if ok != n:
  ok+=1
print(ok)
# Judge status: Accepted
N, M = map(int, input().split())

image = []
template = []

for _ in range(N):
  image.append([c for c in input()])

for _ in range(M):
  template.append([c for c in input()])
  
# 左上の座標が与えられる  
def is_match(a, b):
  for i in range(M):
    for j in range(M):
      if template[i][j] != image[a + i][b + j]:
        return False
  return True

def solve():
  for i in range(0, N - M + 1):
    for j in range(0, N - M + 1):
      if is_match(i, j):
        return True
  return False

if solve():
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n,m=map(int,input().split())
a=[]
for i in range(1,int(m**.5)+1):
  if m%i==0:
    ans=i
    a.append(i)
  if i==m//n:break
else:
  for i in a:
    if m//i<=m//n:
      ans=m//i
      break
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans1 = max(a)
a.remove(ans1)
val = ans1 / 2
ans2 = int(1e10)
val2 = int(1e10)
# print(val)
for i in range(n-1):
    if abs(a[i] - val) < val2:
        ans2 = a[i]
        val2 = abs(a[i] - val)
        #print(ans2,abs(a[i] - val))
print(ans1, ans2)
# Judge status: Accepted
x, a, b = map(int, input().split())
if a >= b:
  print("delicious")
elif x < b-a:
  print("dangerous")
else:
  print("safe")
# Judge status: Wrong Answer
x,y,z = map(int,input().split())

ans = int(x/(y+z))
if x%(y+z) == 0:
    ans -= 1
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
if a+c == b or b+c == a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())

a = 2
b = 1

for i in range(n):
    if(i == 0):
        preb = b
        b = a + b
        a = preb
    else:
        prea = a
        preb = b
        a = b
        b = prea + b


print(a)
# Judge status: Wrong Answer
from scipy.special import comb

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct

N = int(input())
print(sum([comb(len(factorize(N-C)) + 1, 2, exact=True) for C in range(1, N)]) + 2)
# Judge status: Wrong Answer
O = input()
E = input()
for o,e in zip(O,E):
  print(o,e,end="",sep="")
  if len(O)>len(E):
    print(O[-1],end="")
# Judge status: Wrong Answer
s = list(input())
l = []

for i in range(len(s)):
    if s[i] == "B":
        l.append(i)

for i in l:
    s[i] = ""
    if i-1 >= 0:
        s[i-1] = ""

print("".join(s))
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, _ = rm()
li = np.array([np.array(rl()) for _ in range(n)])
cnt = 0
for i in range(n):
  for j in range(i):
    a = sum((li[i] - li[j]) ** 2)
    if a - a//1 == 0:
      cnt += 1
print(cnt)