peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
    else:
        ans = "No"
print(ans)
# Judge status: Accepted
import math

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

#  にぶたん！ 半開区間二分探索は正義

def calc(x):
    count = 0
    for a in A:
        count += (a - 1) // x

    return count <= K

A.sort(reverse=True)

r = 10 ** 9
l = 0

while abs(r - l) > 1:
    mid = (r + l) // 2
    
    if calc(mid):
        r = mid
    else:
        l = mid

print(r)
# Judge status: Accepted
#!/usr/bin/env python3
n, m, *x = map(int, open(0).read().split())
x.sort()
print(sum(sorted(j - i for i, j in zip(x, x[1:]))[-n::-1]))
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
for _ in range(n):
    k,*s=input().split()
    l+=s
se=set(l)
a=0
for i in se:
    c=l.count(i)
    if c==n:
        a+=1
print(a)
# Judge status: Accepted
N=input()
if (N[0]==N[1] and N[1]==N[2]) or (N[1]==N[2] and N[2]==N[3]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N =int(input())
X = [list(map(int, input().split())) for _ in range(N)]
A = [0]*N
B = [0]*N
C = [0]*N
A[0]=X[0][0]
B[0]=X[0][1]
C[0]=X[0][2]
for i in range(1, N):
  A[i]=max(B[i-1], C[i-1])+X[i][0]
  B[i]=max(A[i-1], C[i-1])+X[i][1]
  C[i]=max(B[i-1], A[i-1])+X[i][2]
print(max(A[N-1], max(B[N-1], C[N-1])))
# Judge status: Wrong Answer
n,m = list(map(int, input().split()))
mod = 10**9+7

def factorial(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
        val %= mod
    return val

if abs(n-m)>1:
    print(0)
elif abs(n-m)==1:
    num = factorial(max(m,n))
    print(num**2//max(m,n)%mod)
else:
    num = factorial(m)
    print(num**2*2%mod)
# Judge status: Accepted
d, n = map(int,input().split())
if n== 100:
  n+=1
print(n*(100**d))
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())


def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        yield -1
        return

    while all(x%2 == 0 for x in (a, b, c)):
        a_ = a//2
        b_ = b//2
        c_ = c//2
        a, b, c = b_+c_, a_+c_, a_+b_
        yield 1


print(sum(main()))
# Judge status: Accepted
n = str(input())
for i in range(10):
    f = str(i)*3
    if f in n:
        print('Yes')
        quit()
print('No')
# Judge status: Accepted
d={'':0}
for i in range(int(input())):
    s=input()
    if s in d:
        d[s]+=1
    else:
        d[s]=1
for i in range(int(input())):
    t=input()
    if t in d:
        d[t]-=1
print(max(d.values()))
# Judge status: Wrong Answer
O = input()
I = input()

for o, i in zip(O, I): print(o+i, end="")
# Judge status: Accepted
n = int(input())

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

M = 0
m = n
count = 0

for i in range(n):
    if p[i] > M:
        M = p[i]
    else:
        pass
    if p[i] < m:
        m = p[i]
    else:
        pass
    
    if p[i] <= m:
        count += 1
    else:
        pass

print(count)
# Judge status: Accepted
a, b = map(int, input().split())
print(a + (b//2))
# Judge status: Accepted
S=input()
K=int(input())
lenS=len(S)
for i in range(lenS-1):
    ordS_i=ord(S[i])
    if (ord("a")-ordS_i)%26<=K:
        K-=(ord("a")-ordS_i)%26
        S=S[:i]+"a"+S[i+1:]
ordS_i=ord(S[lenS-1])
moda=(ordS_i-ord("a")+K)%26
S=S[:lenS-1]+chr(ord("a")+moda)
print(S)
# Judge status: Accepted
animals_num, legs_num = map(int, input().split())

answer = "No"

for i in range(animals_num + 1):
  j = animals_num - i
  if j * 4 + i * 2 == legs_num:
    answer = "Yes"
print(answer)
# Judge status: Accepted

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

if l.count(5)==2 and l.count(7)==1:
    print('YES')

else:
    print('NO')
# Judge status: Accepted
N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"
top = 0
for i in range(len(H)):
    if (H[i] < top-1 ):
        result = "No"
        break
    top = max(top, H[i])

print(result)
# Judge status: Wrong Answer
S = list(input())
T = list(input())

ans = ""
flag = False
for i, s in enumerate(S):
  count = 0
  for t in T:
    if i + count < len(S):
      if S[i+count] == "?" or s == t:
        count += 1
      else:
        break

      if count == len(T):
        ans = S[:i] + T + S[i+count:]
        flag = True


an = ""
for x in ans:
  if x == "?":
    an += "a"
  else:
    an += x

if flag:
  print(an)
else:
  print("UNRESTORABLE")
# Judge status: Accepted
def count(x,y):
	c = 0
	for i in range(len(x)):
		c += (x[i]!=y[i])
	return c
s = input()
t = input()
mx = len(s)
for i in range(0, len(s) - len(t) + 1):
	c = count(s[i:i+len(t)], t)
	mx = min(mx,c)
print(mx)
# Judge status: Wrong Answer
N = int(input())
ans = 10**12
for i in range(1,10**6):
  if N % i == 0 and (N//i + i -2) < ans:
    ans = (N//i + i -2)
print(ans)
# Judge status: Wrong Answer
K, S = map(int, input().split())
print([x+y+z == S for x in range(K+1) for y in range(K+1) for z in range(K+1)])
# Judge status: Wrong Answer
child_num = input("子供の数")
child_num = int(child_num)
candy_num = int((child_num**2 + child_num) / 2)
print(candy_num)
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n==1 and m==1:
    print(1)
elif n==1:
    print(m-2)
else:
    print((m-2)*(n-2))
# Judge status: Accepted
n=int(input())
a=[]
b=[]
for i in range(n):
  x,y=(int(i) for i in input().split())
  a.append(x-y)
  b.append(x+y)
a.sort()
b.sort()
print(max(a[-1]-a[0],b[-1]-b[0]))
# Judge status: Accepted
n = int(input())
print('ABC') if n < 1000 else print('ABD')
# Judge status: Wrong Answer
n = int(input())
MOD = 10**9 + 7
if n == 1:
    print(0)
elif n == 2:
    print(1)
else:
    ans = pow(10, n, MOD) + pow(8, n, MOD) - 2 * pow(9, n, MOD)
    print(ans % MOD)
# Judge status: Accepted
s = list(sorted(set(input())))
lst = [chr(i) for i in range(97, 97+26)]

for i in lst:
    if not(i in s):
        print(i)
        exit()
else:
    print("None")
# Judge status: Accepted
N, X, T = map(int, input().split())
result = N // X * T
if N % X > 0:
  result += T
print(result)
# Judge status: Accepted
s = input()
n = len(s)
for i in range(n):
    if i % 2 == 0:
        if s[i:i+2] != "hi":
            print("No")
            exit()
print("Yes")
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, A, B = mapint()
if abs(A-B)%2==0:
    print(abs(A-B)//2)
else:
    if A>B:
        A, B, = B, A
    c = A + (B-A-1)//2
    d = (N-B+1) + (B-A-1)//2
    print(min(c, d))
# Judge status: Accepted
s = input()
t = input()

s_char = [x for x in s]
t_char = [x for x in t]

s_char.sort()
t_char.sort(reverse=True)

new_s = ''
new_t = ''

for x in s_char:
    new_s += x

for x in t_char:
    new_t += x

print('Yes' if new_s < new_t else 'No')
# Judge status: Accepted
s = input()
k = int(input())

ns = []
for c in s[:-1]:
    if c == 'a':
        ns.append(c)
        continue

    ofstoa = ord('z')+1-ord(c)
    if k >= ofstoa:
        ns.append(chr(ord(c) + ofstoa - 26))
        k -= ofstoa
    else:
        ns.append(c)

last = ord(s[-1])
k = k%26
if last + k > ord('z'):
    ns.append(chr(last + k - 26))
else:
    ns.append(chr(last + k))
print(''.join(ns))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Max=0
for i in range(N):
  if A[i]>=B[i]:
    Max+=B[i]
  else:
    B[i]-=A[i]
    if A[i+1]>=B[i]:
      A[i+1]-=B[i]
      Max+=A[i]+B[i]
    else:
      A[i+1]=0
      Max+=A[i]+A[i+1]
print(Max)
# Judge status: Accepted
N=int(input())
E=[int(i) for i in input().split()]
E.sort()
s=sum(E)
if E[-1]<s-E[-1]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = [0 for i in range(n+1)]
leaf = sum(a)

b[0] = 1 - a[0]
leaf -= a[0]
ans = 1
for i in range(1,n+1):
    kosu = min(b[i-1] * 2,leaf)
    ans += kosu
    b[i] = kosu - a[i]
    if b[i] < 0:
        print(-1)
        exit()
    leaf -= a[i]
print(ans)
# Judge status: Accepted
n=int(input())
S=[0 if i=='.' else 1 for i in input()]
if sum(S)==0 or sum(S)==n:
    print(0)
    exit()
sS=sum(S)
allblack=n-sum(S)
allwhite=sum(S)
bw=10**6
from itertools import accumulate
accS=list(accumulate(S))
for i in range(n):
    bw=min(bw,accS[i]+(n-(i+1))-(sS-accS[i]))
print(min(bw,allblack,allwhite))
# Judge status: Wrong Answer
S = input()
if S[5:7] >= "04":
	print("TBD")
else:
	print("Heisei")
# Judge status: Wrong Answer
N, M = map(int, input().split())
memo = {}
b = {}
for i in range(M):
  val = int(input())
  b[val] = True

for i in range(N+1):
  if i == 0:
    memo[i] = 0
    continue
  if i == 1:
    memo[i] = 1
    continue
  memo[i] = memo[i-1] + memo[i-2]
  
ans = memo[N]
print(ans % 1000000007)
# Judge status: Accepted
h = int(input())
w = int(input())
n = int(input())

i=1
while n > max(h,w)*i:
    i += 1
else: print(i)
# Judge status: Accepted
import sys
from collections import deque

input = sys.stdin.readline


def dfs(N):
    alphabet = "abcdefghij"
    stack = deque(["a"])
    ans = []
    while stack:
        s = stack.pop()
        if len(s) == N:
            ans.append(s)
            continue
        for suffix in reversed(alphabet[:len(set(s)) + 1]):
            stack.append("".join((s, suffix)))
    return ans


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

    ans = dfs(N)
    print("\n".join(ans))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s=list(input())
t=list(input())
s.sort()
t.sort()
for i in range(min(len(s),len(t))):
  if s[-1*(i+1)]==t[-1*(i+1)]:
    x=1
    continue
  elif ord(s[-1*(i+1)])>ord(t[-1*(i+1)]):
    print('No')
    x=0
    break
  else:
    x=0
    print('Yes')
    break
if x==1:
  if len(s)<len(t):
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
r, g, b = input().split()

if int(r+g+b) % 4 == 0:
  print("YES")
else:
  print( "NO")
# Judge status: Accepted
N, K = map(int, input().split())

answer = [1] * N

for i in range(K):
	d = int(input())
	tmp = map(int, input().split())

	for j in tmp:
		answer[j-1] = 0

print(sum(answer))
# Judge status: Accepted
import sys
input = sys.stdin.readline

x,y = list(map(int,input().split()))
dxy = abs(abs(x)-abs(y))
if y-x == -1 * dxy:
    ans = dxy+2
    if x == 0 or y ==0:
        ans -=1    
elif y-x == dxy:
    ans = dxy
else:
    ans = dxy+1
    
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
res = 0
for a in A:
    res = res ^ a

for a in A:
    print(a ^ res)
# Judge status: Accepted
def main():
    s = input()
    k = int(input())
    ans = 0
    tyou = 500000000000000
    for v in s:
        if v == '1':
            ans += 1
        else:
            ans += tyou ** int(v)
        if ans >= k:
            print(v)
            exit()


if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,C,X,Y = map(int,input().split())

if X>Y:
    A,B,X,Y = B,A,Y,X

if 2*C < B:
    print(C*2*Y)

elif 2*C < A + B:
    print(C*2*X+B*(Y-X))

else:
    print(A*X+B*Y)
# Judge status: Accepted
N = int(input())
from collections import Counter
S = [Counter(list(input())) for _ in range(N)]

def intersection(X):
    Res = X[0]
    if len(X) == 1:
        return Res
    for x in X[1:]:
        Res = {k:min(Res[k],x[k]) for k in Res if k in x}
    return Counter(Res)

print(''.join(sorted(intersection(S).elements())))
# Judge status: Wrong Answer
import fractions
a,b=2,3
c=fractions.gcd(a,b)
ans=a*b/c
print(int(ans))
# Judge status: Accepted
N = int(input())
txn = []
for i in range(N):
  txn.append([int(i) for i in input().split()])

ima = [0,0,0]
for i in range(N):
  dist = abs(ima[1] - txn[i][1]) + abs(ima[2] - txn[i][2])

  if dist > (txn[i][0] - ima[0]) :
    print("No")
    exit()
  
  if dist%2 != (txn[i][0] - ima[0])%2 :
    print("No")
    exit()
  
  ima = txn[i]

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

N = int(input())
A=list(map(int,input().split()))
c=dict(Counter(A))
#print(c)
e=[]
f=[]

for i in c:
  if c[i]>1:
    e.append(i)
  if c[i]>=4:
    f.append(i)

e.sort(reverse=True)
f.sort(reverse=True)
if len(f)>=1:
  if f[0]>=e[0]:
    print(f[0]**2)
  else:
    if len(e)>=2:
      print(e[0]*e[1])
    else:
      print(0)
else:
  if len(e)>=2:
    print(e[0]*e[1])
  else:
    print(0)
# Judge status: Wrong Answer

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

    ans = 0
    for i in range(N - 1):
        ans += A[i] // 2
        A[i] %= 2
        if A[i] > 0 and A[i + 1] > 0:
            ans += 1
            A[i] -= 1
            A[i + 1] -= 1

    print(ans)


if __name__ == "__main__":
    resolve()
# Judge status: Accepted
s = str(input())

for i in range(3):
    if s[i] == s[i+1]:
        print('Bad')
        break
else:
    print('Good')
# Judge status: Accepted
l,r = map(int,input().split())
if r-l >=2019:
    print(0)
else:
    ans = 2019
    for i in range(l,r):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%2019)
    print(ans)
# Judge status: Accepted
import numpy as np

N = int(input())
mod = 10**9 + 7
A = np.array(input().split(), int)

ans = 0
for i in range(60):
    b = np.count_nonzero(A >> i & 1)
    ans += 2**i*(b*(N-b))
    ans %= mod
    c = np.count_nonzero(A >> i & 1)
print(ans)
# Judge status: Accepted
# D - Sum of Divisors
N = int(input())
ans = 0

for i in range(1, N + 1):
	j = 1
	
	while True:
		if i * j <= N:
			#print(i * j)
			
			ans += i * j
			j += 1
		else:
			break

print(ans)
# Judge status: Wrong Answer
s = []
s.append(list(input()))
s.append(list(input()))
s.append(list(input()))

a = ['A', 'B', 'C']
n = s[0].pop()
while True:
  i = 0
  if n == 'a':
    i = 0
  elif n == 'b':
    i = 1
  elif n == 'c':
    i = 2
  if len(s[i]) == 0:
    print(a[i].upper())
    exit()
  else:
    n = s[i].pop()
# Judge status: Accepted
A, B, C, K = map(int, input().split())

print(A - B) if K % 2 == 0 else print(B - A)
# Judge status: Wrong Answer
import math

n = int(input())
for i in range(1,n):
    if math.floor(i * 1.08) == n:
        print(i)
        exit(0)
print(":(")
# Judge status: Wrong Answer
a, b , c = map(int, input().split())
flag = a*b*c==175 and a+b+c==17 
print('Yes' if flag else 'No')
# Judge status: Wrong Answer
s=list(input())
if s==s[::-1]:
  n=len(s)
  if s[:n//2-1]==s[:n//2-1:-1]:
    if s[n//2+1:]==s[n//2+1::-1]:
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
a,b,c=map(int,input().split())
print("YES"if b-a==c-b else "NO")
# Judge status: Wrong Answer
N,M = map(int,input().split())
A = [ int(a) // 2 for a in input().split()]
from math import ceil
from fractions import gcd
def main():
    x = 1
    for a in A:
        if x%a != 0:
            x *= a // gcd(a,x)
    print(ceil((M // x)/2))
    return

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
S = input()
a = 0
b = 0
for s in S:
  if s == 'c':
    print('No')
  elif s == 'a':
    if a + b <= A + B:
      print('Yes')
      a += 1
    else:
      print('No')
  else:
    if a + b <= A + B and b <= B:
      print('Yes')
      b += 1
    else:
      print('No')
# Judge status: Wrong Answer
N = int(input())
print(10**N - (9**N + 9**N- 8**N))
# Judge status: Accepted
#n=int(input())
x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

ans=1
v=x
while v*2<=y:
    ans+=1
    v*=2

print(ans)
# Judge status: Accepted
k=int(input())
s=input()
n=len(s)
if k>=n:
  print(s)
else:
  ans =""
  for i in range(k):
    ans+=s[i]
  ans+="..."
  print(ans)
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = len([a for a in A[::2] if a % 2 == 1])
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
P = [ int(s) for s in input().split() ]
P_S = sorted(P)

if sum(map(lambda x: x[0] != x[1], zip(P,P_S))) <= 2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
c=0
ans=0
for i in range(len(s)):
  if s[i]=='T':
    c+=1
  if s[i]=='S':
    c-=1
  ans = max(ans,c)
print(ans*2)
# Judge status: Accepted
n=int(input())
s=input()
R=s.count("R")
G=s.count("G")
B=s.count("B")
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    if j-i <= n-1-j:
      if s[i]!=s[j] and s[j]!=s[2*j-i] and s[i]!=s[2*j-i]:
        cnt+=1
print(R*G*B-cnt)
# Judge status: Wrong Answer
N,M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
threshold = sum(A) / (4 * M)
A = [i for i in A if i > threshold ]
if len(A) >= M:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
# 奇数回目 -> 6
# 偶数回目 -> 5
x = int(input())

p,q = divmod(x, 11)
p *= 2
if q == 0:
    pass
elif q <= 6:
    p += 1
else:
    p += 2

print(p)
# Judge status: Accepted
l = int(input())
s = l/3
print(s**3)
# Judge status: Wrong Answer
S=input()
li=[S.count("a"),S.count("b"),S.count("c")]
print("YES" if max(li)-min(li)<=1 else "No")
# Judge status: Wrong Answer
from bisect import bisect


n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
print(sum(len(a[bisect(a, b[i]):]) * len(c[bisect(c, b[i]):]) for i in range(n)))
# Judge status: Wrong Answer
from math import floor
a,b = [e for e in input().split(" ")]
a = int(a)
b = round(float(b),2)
r = a*b
print(floor(r))
# Judge status: Accepted
n = int(input())
a_l = list(map(int,input().split()))

a_l_dict = {}
for val in a_l:
    a_l_dict[val] = 0
for val in a_l:
    a_l_dict[val] += 1

ans = 0
for key in a_l_dict.keys():
    ans = max(ans, a_l_dict[key] + a_l_dict.get(key-1,0) + a_l_dict.get(key+1,0))

print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
if abs(c - a) <= d:
    print("yes")

elif abs(b - a) <= d and abs(c - b) <= d:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#053_B
s=list(input())
print(len(s)-s[::-1].index('Z')-s.index('A'))
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(n):
  if (i+1) % 3 != 0 and (i+1) % 5 != 0:
    ans += i+1
print(ans)
# Judge status: Accepted
n, x, y = map(int, input().split())
l = [0]*n

for i in range(1, n):
    for j in range(i + 1, n + 1):
        diff1 = j - i
        diff2 = abs(x - i) + abs(y - j) + 1
        diff = min(diff1, diff2)
        l[diff] = l[diff] + 1

for i in range(1, n):
    print(l[i])
# Judge status: Accepted
x = int(input())
a = x // 100
b = x - a * 100

while b > 5:
	b = b - 5
	a -= 1

if a>=1:
	print(1)
else:
	print(0)
# Judge status: Accepted
A,B,C=map(int,input().split())
K=int(input())
while A>=B:
  B*=2
  K-=1
while B>=C:
  C*=2
  K-=1
if K>=0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
B = [-1] + [int(b) for b in input().split()]

A = []
for i in range(1, N+1):
    if i == 1:
        A.append(B[1])
    elif i == N:
        A.append(B[N-1])
    else:
        A.append(min(B[i-1], B[i]))

print(sum(A))
# Judge status: Accepted
N=int(input())
a = []
b = []
for i in range(N):
  x,y=map(int,input().split())
  a.append(x+y)
  b.append(x-y)
A = max(a)-min(a)
B = max(b)-min(b)
print(max(A,B))
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))

ao = list(map(lambda x:x%2, a))
if 1 in ao:
    print(1)
else:
    print(min(a))
# Judge status: Accepted
A,B=map(int,input().split())
if A >=13:
    print(B)
elif 6<=A<=12:
    print(B//2)
else:
    print(0)
# Judge status: Accepted
n,m = map(int,input().split())
a = set()
b = set()
for i in range(m):
    a_,b_ = map(int,input().split())
    if a_ == 1:
        a.add(b_)
    if b_ == n:
        b.add(a_)
print("POSSIBLE" if a&b else "IMPOSSIBLE")
# Judge status: Accepted
x, y, z = map(int, input().split())

l = y + 2*z
ans = 0
while l <= x:
    l += y + z
    ans += 1

print(ans)
# Judge status: Accepted
T = str(input())
ans = ''
for t in T:
    if t != '?':
        ans += t
    else:
        ans += 'D'
print(ans)
# Judge status: Accepted
N = int(input())

print((N-1)*N//2)
# Judge status: Wrong Answer
p,q,r = map(int, input().split())

print(r-q + q-p)
# Judge status: Accepted
import sys
import math
x = int(input())
ans = 0
for i in range(1, x+1):
    for j in range(2, x+2):
        if pow(i, j) <= x:
            ans = max(pow(i, j), ans)
        else:
            break
print(ans)
# Judge status: Accepted
n,r=map(int,input().split())
if n<10:
    print(r + 100*(10-n))
else:
    print(r)
# Judge status: Wrong Answer
def resolve():
    a = list(map(int, input().split()))
    K = int(input())
    print(sum(a)-max(a)+max(a)*2*K)
resolve()
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

A, B, C = map(int, readline().split())

if A == B and B == C and A % 2 == 0:
    print(-1)
    exit()

ans = 0
while True:
    if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
        break
    half_A = A // 2
    half_B = B // 2
    half_C = C // 2

    A = half_B + half_C
    B = half_A + half_C
    C = half_A + half_B
    ans += 1

print(ans)
# Judge status: Accepted
N,Y=map(int,input().split())

for i in range(N+1):
    for j in range(N-i+1):
        ans=10000*(N-i-j)+5000*j+1000*i
        if ans==Y:
            print(N-i-j,j,i)
            exit()
print(-1,-1,-1)
# Judge status: Accepted
n = int(input())
print(n*800-n//15*200)
# Judge status: Accepted
def fact(n, k, mod):
    res = 1
    for i in range(k):
        res = res * (n - i) % mod
    return res

def c(x, y, mod):
    y = min(x, x - y)
    return (fact(x, y, mod) * pow(fact(y, y, mod), mod - 2 , mod)) % mod

P = 10**9 + 7
X, Y = map(int, input().split())
if (X + Y) % 3 > 0:
    print(0)
    exit()
n = (X + Y) // 3
x = X - n
y = Y - n
if 0 > x or 0 > y:
    print(0)
    exit()
print(c(x + y, x, P))
# Judge status: Accepted
n, m = map(int, input().split())
if n == 1 or m == 1:
    print(1 if n * m == 1 else max(n, m) - 2)
else:
    print((n - 2) * (m - 2))
# Judge status: Accepted
#!/usr/bin/env python3

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
s = set(input())
a_z = set('abcdefghijklmnopqrstuvwxyz')
comp_s = sorted(list(a_z - s))
print(comp_s[0] if len(comp_s) else 'None')
# Judge status: Accepted
import math
a,b,c=map(int,input().split())
d=c-a-b
if(d>0 and 4*a*b < d**2):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np
n,m=map(int, input().split())

if n>=m/2:
  print(n)
else:
  m_aft = m -2*n
  m_fin = m_aft//4
  print(n+m_fin)
# Judge status: Accepted
import math
a, b, c, d = list(map(int, input().split()))

a_div_c = (a-1) // c
a_div_d = (a-1) // d
a_div_cd = (a-1) // (c * d // math.gcd(c, d))
b_div_c = b // c
b_div_d = b // d
b_div_cd = b // (c * d // math.gcd(c, d))

y = b - (b_div_c + b_div_d - b_div_cd)
x = (a - 1) - (a_div_c + a_div_d - a_div_cd)

print(y-x)
# Judge status: Wrong Answer

s=int(input())

def c(a,p):
    x=1
    for y in range(p+1,a+1):
        x*=y
    for y in range(2,a-p+1):
        x//=y
    return x
    

mod=10**9+7
ss=s//3
icnt=0
for sss in range(ss):
    r=s-3*sss
    icnt+=c(ss+r,r)

print(icnt)
# Judge status: Wrong Answer
def main():
    X = int(input())
    for i in range(1, 89500):
        if X == i:
            print(i)
            break
        elif X - i < i + 1:
            pass
        else:
            X -= i
            
if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
k = int(input().rstrip())
s = list(input().rstrip())

def print_len(k,s):
    for i in range(min(k,len(s))):
        print(s[i],end="")
    for i in range(len(s)-k):
        print('.',end="")
    print()
    
print_len(k,s)
# Judge status: Accepted
import math
N, D = map(int, input().split())

arr = [list(map(int, input().split())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i+1, N, 1):
        kyori = 0
        for k in range(D):
            kyori += (arr[i][k]-arr[j][k])**2
        if math.sqrt(kyori) == int(math.sqrt(kyori)):
            ans += 1

print(ans)