peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split(" ")))
print(int((sum(a)**2-sum([i**2 for i in a]))/2)%(10**9+7))
# Judge status: Accepted
MOD = 10 ** 9 + 7

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

sum = 0
for x in a:
    sum += x
    sum %= MOD

ans = 0
for i in range(n):
    sum -= a[i]
    if sum < 0:
        sum += MOD
    ans += a[i] * sum
    ans %= MOD

print(ans)
# Judge status: Accepted
a=input()

if a.isupper()==True:
  print("A")
else:
  print("a")
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)
    a *= -1
    a //= 2
    a *= -1
    heapq.heappush(A, a)

A = [-1 * a for a in A]
print(sum(A))
# Judge status: Accepted
import sys,collections

t = sys.stdin.readline().rstrip()
print(t.replace('?','D'))
# Judge status: Accepted
n = int(input())
sum = float('inf')
 
for i in range(1, n):
    k = 0
    for j in range(len(str(i))):
        k += float(str(i)[j])
    for l in range(len(str(n-i))):
        k += float(str(n-i)[l])
    sum = min(sum, k)
 
print(int(sum))
# Judge status: Wrong Answer
import heapq

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

A = list(map(int, input().split()))
A = list(map(lambda x:x*(-1), A))

heapq.heapify(A)

for i in range(M):
    x = (heapq.heappop(A))*(-1)
    heapq.heappush(A, -(x//2))

print(A)
print(sum(A)*(-1))
# Judge status: Accepted
N,*L = map(int, open(0).read().split())
ans = 0
inf = [0]*(N-1)
for i,(c,s,f) in enumerate(zip(*[iter(L)]*3)):
  inf[i] = (c,s,f)
for i in range(N-1):
  ans = 0
  for j in range(i,N-1):
    c,s,f = inf[j]
    m = ((ans-1)//f+1)*f
    ans = max(m,s)
    ans += c
  print(ans)
print(0)
# Judge status: Accepted
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = LI()
x.sort(reverse=1)
ans = x[0]*10 + x[1] + x[2]
print(ans)
# Judge status: Accepted
a, b, c, k = map(int, input().split())

if k % 2 == 1:
    print(b - a)
elif k % 2 == 0:
    print(a - b)
# Judge status: Accepted
N,K = map(int,input().split())
h = sorted([int(input()) for _ in range(N)])
result = 10**9
for i in range(N-K+1):
  result = min(result,h[i+K-1]-h[i])
print(result)
# Judge status: Wrong Answer
k,a,b=map(int,input().split())
if b/a<=2 or k-1<=a:
    print(1+k)
else:
    print((k-a+1)//2*(b-a)+(k-a+1)%2+a)
# Judge status: Accepted
N,K = map(int,input().split())

n = N % K

ans = min(n,K-n)

print(ans)
# Judge status: Accepted
m=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
ans=0 ; s=a[-1]
for i in range(n-2,-1,-1):
    ans=(ans+s*a[i])%m
    s=(s+a[i])%m
print(ans%m)
# Judge status: Accepted
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

l,r = nm()

MOD = 2019

ans = 10**9
for i in range(l,min(r,l+2019)+1):
  for j in range(i+1,min(r,i+MOD)+1):
    ans=min(ans,((i%MOD)*(j%MOD))%MOD)

print(ans)
# Judge status: Accepted
n=int(input())
arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  t1,x1,y1=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t2-t1:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t2-t1)%2:
    print('No')
    exit()
print('Yes')
# Judge status: Accepted
from decimal import *
a,b,c=map(Decimal,input().split())
print("Yes" if a.sqrt()+b.sqrt()<c.sqrt() else "No")
# Judge status: Wrong Answer
k= int(input())
s= input()
if len(s)<=k:
	print(s)
else:
	print(s[1:k]+'...')
# Judge status: Accepted
x, y = map(int, input().split())
ans = x + y//2
print(ans)
# Judge status: Wrong Answer
import math
A, B, N = list(map(int, input().split(" ")))
res = []

for n,i in enumerate(range(1,N+1)):
  r = math.floor(A*i/B) - A*math.floor(i/B)
  res.append(r)
  if n >= 1:
    if res[n-1] <= res[n]:
      break
print(max(res))
# Judge status: Accepted
h,n=map(int,input().split())
a = list(map(int,input().split()))

a.sort(reverse=True)


print(sum(a[n:]))
# Judge status: Accepted
n, k = map(int, input().split())
A = [*map(int, input().split())]
ng, ok = 0, max(A) # (ng,ok] = (l,r]
while ok - ng > 1:
    m = (ng + ok) // 2
    c = 0
    for a in A: c += (a-1) // m
    if c <= k: ok = m
    else: ng = m
print(ok)
# Judge status: Accepted
# import sys
# sys.setrecursionlimit

from fractions import gcd

getarr = lambda _f: list(map(_f, input().split()))

a, b = getarr(int)

m = gcd(a, b)

i = 2
ans = 1
while i * i <= m:
    if m % i == 0:
        ans += 1
        while m % i == 0:
            m //= i
    i += 1

if m > 1:
    ans += 1
print(ans)
# Judge status: Accepted
X, K, D = map(int, input().split())
X = abs(X)
if X-K*D>=0:
  print(X-K*D)
else:
  a = X//D
  if (K-a)%2==0:
    print(X-D*a)
  else:
    print(D*(a+1)-X)
# Judge status: Accepted
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(*S, sep="")
# Judge status: Wrong Answer
n = int(input())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
bl.append(0)

mons = 0
b0 = 0

for a, b in zip(al, bl):
    if a >= (b0 + b):
        mons += b0 + b
    else:
        mons += a
        b0 = b - max(a-b, 0)

print(mons)
# Judge status: Wrong Answer
#a値段,b本数
n,m = list(map(int, input().split()))
a_lis =[]
b_lis = []
for _ in range(n):
    a,b = list(map(int, input().split()))
    a_lis.append(a)
    b_lis.append(b)
cp_lis = a_lis.copy()
cp_lis.sort()
ans = 0
num = 0

for i in cp_lis:
    ans += b_lis[a_lis.index(i)]*i
    num += b_lis[a_lis.index(i)]
    if num >= m:
        i_stop = cp_lis.index(i)
        break


     
diff_num = num - m
ans -= cp_lis[i_stop]*diff_num

print(ans)
# Judge status: Accepted
N = int(input())
C = input()

tmp = 0
for i in range(N):
    if C[i] == "R":
        tmp += 1

ans = 0
for i in range(tmp):
    if C[i] == "W":
        ans += 1
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
r=[0]*8
f=0

for i in range(n):
    if(a[i]>=3200):
        f+=1
    else:
        r[a[i]//400]=1;

c=sum(r)

print(1 if(c==0) else c,end=" ")
print(f+c)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.sort()
ans = 0

for i in range(-2, -2 * N - 1, -2):
    ans += a[i]
    # print(a[i])

print(ans)
# Judge status: Accepted
k,a,b = map(int,input().split())
ans0 = 1+k
#a<bの時のみ交換を行う。1>>aになるまで加算し、そのあとはa-bを繰り返す。

if a+2>=b:
    print(1+k)
else:
    q=(k-a+1)//2
    if q==0:
        print(1+k)
    else:
        print(1+(k-2*q)+q*(b-a))
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

allCount = 0
c = Counter(A)

for i, v in c.items():
    if (v == 1):
        continue
    else:
        allCount += v * (v - 1) // 2


if (allCount == 0):
    for i in range(N):
        print(0)
    exit()

for i in range(N):
    a = allCount
    num = c[A[i]] - 1
    if (num == 1 or num == 0):
        print(allCount - num)
        continue
    old = A[i] * (A[i] - 1) // 2
    count = num * (num - 1) // 2
    print(a - old + count)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N-K):
    if A[i+K] > A[i]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n,m = map(int,input().split())

if(2*n>=m):
	print(m//2)
else:
	remaining = m- n*2
	ans = remaining//4 + n
	print(ans)
# Judge status: Accepted
from collections import Counter

def Get_nC2(n):
    return int(n*(n-1) / 2)


N = int(input())
A_i = list(map(int, input().split()))

c = Counter(A_i)


total = sum(list(map(Get_nC2, c.values())))

for a_i in A_i:
    result =  total - Get_nC2(c[a_i]) + Get_nC2(c[a_i]-1)
    print(result)
# Judge status: Wrong Answer
def check(A):
	if A[0][0] == 0 and A[1][1] == 0 and A[2][2] == 0:
			return 1
	for i in range(3):
		if A[0][i] == 0 and A[1][i] == 0 and A[2][i] == 0:
			return 1
		elif A[i][0] == 0 and A[i][1] == 0 and A[i][2] == 0:
			return 1
	return 0
			


A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
	for j in range(3):
		if A[i][j] in b:
			A[i][j] = 0

if check(A):
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
del l[0:N][0]
#print(l)
sum = []
for i in range(N-1):
  sum += list(set(l[i])&set(l[i+1]))

print(len(sum))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = []
if n%2 == 0:
    for i in range(0,(n//2)+2,2):
        b.append(a[i])
        b.insert(0,a[i+1])
else:
    b.append(a[0])
    for h in range(1,(n//2)+1,2):
        b.append(a[h])
        b.insert(0,a[h+1])
print(*b)
# Judge status: Wrong Answer
n = int(input())
A = sorted(map(int, input().split()), reverse=True)
b = 0
#print(A)
for i in range(n):
  if i != 0:
    if A[i] == A[i-1]:
      continue
#  j = i+1
  if i == n-1:
    b += 1
    continue
  j = n-1
  while j > i:
    if A[i]%A[j] == 0:
      break
    if j == i+1 or 2*A[j] > A[i]:
      b += 1
      break
    j -= 1
print(b)
# Judge status: Accepted
n = int(input())
ans = 0
ans += 1000 * (n//500)
n -= (n//500) * 500
ans += n//5 * 5
print(ans)
# Judge status: Accepted
import math
a,b=map(int,input().split())
n=math.ceil((a*100)/8)
m=int((a*100)/10)
result=[]
for i in range(m-100,n+100):
    if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
        result.append(i)
if result==[]:
    print(-1)
    exit()
print(min(result))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
cnt = [0] * (max(a)+2)
for i in a:
    cnt[i]+=1
    cnt[i-1]+=1
    cnt[i+1]+=1
print(max(cnt))
# Judge status: Accepted
from decimal import *

getcontext().prec = 20
 
N = list(map(str, input().split()))
A = Decimal(N[0])
B = Decimal(N[1])
  
print(int(A*B))
# Judge status: Accepted
import math
X, K, D = map(int, input().split())
X = abs(X) 

mini = math.ceil(X/D)

if mini >= K:
    print(abs(X-D*K))
else:
    if (K-mini)%2 == 0:
        print(abs(X-D*mini))
    else:
        print(X-D*(mini-1))
# Judge status: Accepted
from collections import Counter

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = str(input())
ans = 0
pre = [0] * k
d = Counter(t)
for i in range(0, n+(k-1)//k, k):
    L = list(t[i:i+k])
    for j in range(len(L)):
        if pre[j] == L[j]:
            d[L[j]] -= 1
            L[j] = 'x'
    pre = L
ans = d['r'] * p + d['s'] * r + d['p'] * s
print(ans)
# Judge status: Wrong Answer
for i in range(100):
  print(i%26+1)
# Judge status: Wrong Answer
h_ = int(input())
h = h_
ans = 0
count = 1
for i in range(h):
  if h <= 1:
    print(count)
    break
  count += 1
  h = h//2

print((2 ** count)-1)
'''
if h <= 1:
  print(1)
else:
for i in range(1, h+1):
  if h <= 1:
    #ans += h_
    print(ans+1)
    break
  else:
    h = h/2
    ans += h_/h
    print(h_/h, h)
#print(ans)
'''
# Judge status: Accepted
A,B,K = [int(num) for num in input().split(' ')]

if A >= K:
	print('{} {}'.format(A-K, B))
elif (A < K) and (K-A <= B):
	print('{} {}'.format(0, B-(K-A)))
else:
	print('{} {}'.format(0, 0))
# Judge status: Accepted
N, W = map(int, input().split())

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

print(dp[N][W])
# Judge status: Accepted
K=int(input())
S=input()

if len(S)<=K:
    print(S)
else:
    print(S[:K]+'...')
# Judge status: Accepted
import math
s=int(input())
thre = math.ceil(s**0.5)
left = thre**2
rem = left - s
for i in range(1,10**7):
    if rem%i == 0:
        a,b = i,rem//i
        break
print(0,0,thre,b,a,thre)
# Judge status: Accepted
d=int(input())
s=" Eve"*(25-d)
print("Christmas"+s)
# Judge status: Accepted
n = input()
t = n[0] + '0'*(len(n)-1)
t = str(int(t)-1)
r1 = sum(list(int(d) for d in t))
r2 = sum(list(int(d) for d in n))
print(max(r1,r2))
# Judge status: Wrong Answer
from math import pi
r = int(input('Enter a number: '))
print(r*pi*2)
# Judge status: Accepted
num = sum(int(d) for d in input())
a = ['No', 'Yes'][num % 9 == 0]
print(a)
# Judge status: Accepted
import math
n, m = map(int, input().split())
ans = 0

ans += min(n, m // 2)
m -= 2 * min(n, m // 2)

ans += math.floor(m / 4)

print(ans)
# Judge status: Wrong Answer
print([":(", "Yay!"][sum(list(map(int, input().split()))) <= 8])
# Judge status: Accepted
# coding: utf-8

A, B, C = map(int, input().split())
# print(A, B, C)

num = B // A
# print(num)

print(min(num, C))
# Judge status: Accepted
s=input()

from collections import deque

stack=deque()

for i in s:
  if i=="S":
    stack.append(i)
  if i=="T":
    if len(stack)>0 and stack[-1]=="S":
      stack.pop()
    else:
      stack.append(i)
      
  #print(stack)
print(len(stack))
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if b >= a:
    print(round(b/a))
elif round(b/a) > c:
    print(c)
else:
    print('0')
# Judge status: Wrong Answer
N = int(input())
l = []
for i in range(N):
    i = input()
    l.append(i)

b = l.count("AC")
c = l.count("WA")
d = l.count("TLE")
e = l.count("RE")

print("AC ×",b)
print("WA ×",c)
print("TLE ×",d)
print("RE ×",e)
# Judge status: Accepted
def INT():
    return int(input())

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

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

N = INT()
S = input()
x = 0
ans = 0

for s in S:
    if s == "I":
        x += 1
    else:
        x -= 1
        
    ans = max(ans, x)
        
print(ans)
# Judge status: Accepted
import itertools
N = int(input())
L = list(map(int,input().split()))

C = list(itertools.combinations(L,3))

counter = 0
for c in C:
    if c[0] != c[1] and c[1] != c[2] and c[2] != c[0] and c[0]+c[1] > c[2] and c[1]+c[2] > c[0] and c[2]+c[0] > c[1]:
        counter += 1

print(counter)
# Judge status: Accepted
n, m = map(int, input().split())

if n > 8 or m > 8:
  print(':(')
else:
  print('Yay!')
# Judge status: Accepted
s_list = list(input())

result = None

for s_uni in range(ord('a'), ord('z') + 1):
    if not chr(s_uni) in s_list:
        result = chr(s_uni)
        break

if result:
    print(result)
else:
    print('None')
# Judge status: Accepted
N = [int(i) for i in list(input())][::-1]

if len(N) == 1:
    print(N[0])
    exit()

p = N[-1]
q = sum(N)

ans = 0
for i in range(len(N)-1):
    if N[i] != 9:
        for j in range(i,len(N)):
            if N[j] != 0:
                N[j] -= 1
                N[i] = 9
            else:
                N[j] = 9

N[-1] = p-1
print(max(sum(N),q))
# Judge status: Accepted
import math
a, b, x = map(int, input().split())

if a*a*b / 2 > x:
    h = x / b * 2 / a
    deg = math.atan(h/b)
    deg = math.degrees(deg)
    deg = 90 - deg
else:
    x = a*a*b - x
    h = x / a * 2 / a
    deg = math.atan(h/a)
    deg = math.degrees(deg)
print(deg)
# Judge status: Wrong Answer
variable = input().split()
print(variable.index("0"))
# Judge status: Accepted
n,x = map(int,input().split())
a = list(map(int,input().split()))

count = 0

for i in range(n-1):
    if a[i] > x:
        count += a[i] - x
        a[i] = x
        
        count += a[i+1]
        a[i+1] = 0
        
    elif a[i]+a[i+1] > x:
        count = count + a[i+1] + a[i] - x
        a[i+1] = x - a[i] 
    
print(count)
# Judge status: Accepted
S = input().strip()
N = len(S)
for i in range(2,N,2):
    x = S[:-i]
    if x[:(N-i)//2]==x[(N-i)//2:]:
        print(N-i)
        break
# Judge status: Wrong Answer
print('Yes' if len(set(input().split())) == 3 else 'No')
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
count=0

for i in range(n):
    if x<a[i]:
        count+=a[i]-x
        a[i]=x
#print(a)
for i in range(n-1):
    if a[i]+a[i+1]>x:
        count+=a[i]+a[i+1]-x
        a[i+1]-=a[i]+a[i+1]-x
#print(a)
print(count)
# Judge status: Accepted
N = int(input())
OK = False
for i in range(100//4+1):
    for j in range(100//7+1):
        if N == 4 * i + 7 * j:
            OK = True

if OK:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from math import floor, ceil

n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
l = 0
r = max(a)
while r - l > 1:
    c = (l+r)//2
    cnt = 0
    for i in a:
        cnt += max(ceil(i/c) - 1, 0)
    if cnt <= k:
        r = c
    else:
        l = c
print(r)
# Judge status: Accepted
x = int(input())

c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:c=max(c,b**p)
        else:break
print(c)
# Judge status: Accepted
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
limit = min(a,b,c,d,e)
r,q = divmod(n, limit)

print(5+r+min(q,1)-1)
# Judge status: Accepted
n, k = map(int, input().split())
A = [*map(int, input().split())]
for i in range(k, n): print('Yes' if A[i-k] < A[i] else 'No')
# Judge status: Accepted
n = int(input())
a = [int(input()) for i in range(n)]

a.sort()
cnt = 1
ans = 0
for i in range(1,n):
    if a[i] == a[i-1]:
        cnt += 1
    else:
        if cnt%2 != 0:
            ans += 1
        cnt = 1
else:
    if cnt%2 != 0:
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
sta = list(map(int, input().split()))
min_i = sta[0]
count_i = 0
for i in sta:
    if min_i > i:
        min_i = i
    if i <= min_i:
        count_i += 1

print(count_i)
# Judge status: Wrong Answer
def main():
    n, W, *wv = map(int, open(0).read().split())
    dp = [0] * (W + 1)
    for i in range(n):
        w = wv[i * 2]
        v = wv[i * 2 + 1]
        pv = dp[w]
        dp = [max(dp[j], dp[j - w] + v) if j >= w else pv for j in range(0, W + 1)]
    print(dp[W])

main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n):
    if i%2==0 and a[i]%2==1:
        c+=1
print(c)
# Judge status: Accepted
s = list(input())
for i in range(len(s)):
    if s[i] == "?":
        s[i] = "D"
print("".join(s))
# Judge status: Accepted
K = int(input())

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

def gcd_3(a,b,c):
    g = gcd(a,b)
    g = gcd(g,c)
    return g

sm = 0
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            sm += gcd_3(a,b,c)

print(sm)
# Judge status: Accepted
age = int(input())

if age == 3 or age == 5 or age == 7:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
N, M = map(int, input().split())
S = [[i for i in input().split()] for _ in range(M)]

if M > 0:
    wa = [0] * N
    ac = set()
    ans = [0, 0]
    for s in S:
        if s[1] == "AC":
            ac.add(int(s[0])-1)
        elif s[1] == "WA" and int(s[0])-1 not in ac:
            wa[int(s[0])-1] += 1
    print(len(ac), sum(wa))
else:
    print(0, 0)
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
*A, = map(int, input().split())
c = Counter(A)
ac = [(k, v) for k, v in c.items()]
ac.sort()
ac.reverse()

ans = 0
for k, v in ac:
    if v >= 2:
        if ans == 0:
            ans = -k
        else:
            ans *= -k
            break
print(max(ans, 0))
# Judge status: Wrong Answer
from itertools import product

a = list(str(input()))


for bit in product([0,1],repeat=3): # 01の組み合わせ
    x = ["+","+","+"]
    for i,j in enumerate(bit): 
        #print(bit,i,j)
        print(j)
        if j == 1:
            x[i] = "-"
    if eval(a[0]+x[0]+a[1]+x[1]+a[2]+x[2]+a[3]) == 7:
        print(a[0]+x[0]+a[1]+x[1]+a[2]+x[2]+a[3]+"=7")
        break
# Judge status: Accepted
s=input()
print(2*min(s.count("0"),s.count("1")))
# Judge status: Accepted
N,x=map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
a.sort()
for i in a:
    if x >= i:
        x -= i
        cnt +=1
    else:
        print(cnt)
        exit()
if x ==0:
    print(cnt)
else:
    print(cnt-1)
# Judge status: Accepted
N,K=map(int,input().split())
ans = 0
for i in range(1,N+1):
    if i>= K:
        ans += (1/N)
    else:
        cnt = 0
        t = i
        while(True):
            i *= 2
            cnt += 1
            if i >= K:
                ans += (t/N)*(1/i)
                break
print(ans)
# Judge status: Accepted
s = list(input())
ans = "WA"

if s[0] == "A":
    if s[2:-1].count("C") == 1:
        s.remove("C")
        k = "".join(s[1:])
        if k.islower():
            ans = "AC"
print(ans)
# Judge status: Wrong Answer
import heapq
n,m = map(int,input().split())
B = [set() for _ in range(m)]
for i in range(n):
    a,b = map(int,input().split())
    if 1 <= a <= m:
        B[a-1].add(b)
task = []
heapq.heapify(task)
ans = 0
for i in range(m):
    for t in B[i]:
        heapq.heappush(task,-t)
    if task:
        ans += heapq.heappop(task)
print(-ans)
# Judge status: Accepted
# coding: utf-8
N=int(input())
ans=0

for i in range(N):
    num=i+1
    cnt=0
    
    while num%2==0:
        cnt+=1
        num=num//2
    ans=max(ans,cnt)

print(2**(ans))
# Judge status: Accepted
S = str(input())
ans = 0
p = ''
q = ''
for s in S:
  p += s
  if p != q:
    ans += 1
    q = p
    p = ''
print(ans)
# Judge status: Accepted
ans=0
n=int(input())
lst=[]
for i in range(n):
  lst.append(input())
m=int(input())
x=[]
for j in range(m):
  x.append(input())
for k in set(lst):
  c=lst.count(k)-x.count(k)
  ans=max(ans,c)
print(ans)
# Judge status: Accepted
def main():
    K = int(input())
    a = 7 % K
    for i in range(1, K+1):
        if a == 0:
            print(i)
            return
        a = a * 10 + 7
        a %= K
    print(-1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# ABC067c
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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


def cum(array):
    result = [0]
    for i in range(len(array)):
        result.append(array[i]+result[i])
    return result


cumArray = cum(a)
# print(cumArray)

ans = 10**9
for i in range(n+1):
    ans = min(ans, abs(cumArray[i]-(cumArray[n]-cumArray[i])))

print(ans)
# Judge status: Accepted
n,l=map(int,input().split())
s=[input() for _ in range(n)]
s.sort()

print("".join(s))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i+1] < p[i] < p[i-1]:
        ans += 1

print(ans)
# Judge status: Accepted
# coding: utf-8
# Your code here!
N=int(input())
S=[list(map(str,input().split())) for i in range(N)]

A=sorted(S,key=lambda x:int(x[1]), reverse=True)
B=sorted(A,key=lambda x:x[0])
#print(B)
for i in range(N):
    ans=S.index(B[i])+1
    print(ans)
# Judge status: Accepted
n = int(input())
ans = 10**5+1
for a in range(1, n//2+1):
    a,b = list(str(a)), list(str(n-a))
    ans = min(ans, sum(list(map(int, a)))+sum(list(map(int,b))))
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
X = tuple(map(int, input().split()))
print(min(X[i + K - 1] - X[i] + min(abs(X[i]), abs(X[i + K - 1])) for i in range(N - K + 1)))
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

r = ini()
print(r * r)
# Judge status: Wrong Answer
a,b = map(int,input().split())

if  a>13:
    print(b)
elif 12 >= a >= 6:
    print(int(b/2))
else:
    print(0)
# Judge status: Wrong Answer
x,y = list(map(int,input().split(" ")))
a = (2*x - y)//3
b = (2*y - x)//3

mod = 10**9+7

g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, 666667):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)


def nChoosem(n,m):
    return g1[n] * g2[n-m] * g2[m] % mod

res = nChoosem(a+b,a)
print(res)