peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
x,k,d = map(int,input().split())
if k == 1000000000000000 and x == 1000000000000000 and d == 1000000000000000:
    print(1000000000000000)
    exit()
for i in range(k):
    x = min(abs(x-d),abs(x+d),x)
print(x)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(1, n):
    ans += a[i]
print(ans)
# Judge status: Wrong Answer
from collections import Counter
import numpy as np
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
candidate = np.array(list(c.keys()))[np.array(list(c.values())) == max(c.values())]
for i in range(len(candidate)):
  print(candidate[i])
# Judge status: Wrong Answer
a,b,t=map(int,input().split())


if t>=a:
    print(b*t//a)
else:
    print(0)
# Judge status: Wrong Answer
icase=0    
if icase==0:
    a,b,c,d=map(int,input().split())
    if abs(a-b)<=d and (b-c)<=d:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
n,m,x,y=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
s=max(X)
t=min(Y)
ans='War'
for i in range(x+1,y+1):
    if i>s:
        if i<=t:
            ans='No War'
            break

print(ans)
# Judge status: Accepted
N=int(input())
X=input().split()

X=[int(n) for n in X]

S=0
for x in X:
    S+=x

P=round(S/N)

V=0
for x in X:
    V+= (x-P)**2

print(V)
# Judge status: Accepted
s, w = list(map(int, input().split(" ")))
if s <= w:
  print("unsafe")
else:
  print("safe")
# Judge status: Accepted
S = input()
mid = len(S)
mid = (mid + 2 - 1) // 2
cnt = 0
for i in range(mid):
  if S[i] != S[-(i + 1)]:
    cnt += 1
print(cnt)
# Judge status: Accepted
n, m = map(int, input().split())

A = [-1] * n

for i in range(m):
	s, c = map(int, input().split())
	if A[s-1] == c:
		continue
	if A[s-1] != -1:
	# if A[s-1] != -1 or (s == 1 and c == 0):
		print(-1)
		exit()
	A[s-1] = c
if n == 1:
	print(0 if A[0] == -1 else A[0])
else:
	if A[0] == 0:
		print(-1)
		exit()
	else:
		print(1 if A[0] == -1 else A[0], end='')
		for a in A[1:]:
			print(0 if a == -1 else a, end='')
# Judge status: Wrong Answer
A,B = map(int,input().split())
if(A % B == 0 or B % A == 0):
	print(-1)
	exit()
else:
	flag = False
	cnt = 2
	while True:
		if A * cnt % B != 0:
			break
		cnt+=1
print(A * cnt)
# Judge status: Accepted
N=input()
for i in N:
    if(i=='9'):
        print("Yes")
        exit()
print('No')
# Judge status: Wrong Answer
O = input()
E = input()
s = ""
for so,se in zip(O,E):
    s += so+se
print(*s,sep="")
# Judge status: Wrong Answer
N=int(input())
sum=0
for i in range(2,N+1):
    sum+=N//i
print(sum)
# Judge status: Wrong Answer
x,y=map(int,input().split())
a=[1,3,5,7,8,10.12]
b=[4,6,9.11]
c=3 if x==2 else 1 if x in a else 2
d=3 if y==2 else 1 if y in a else 2
print('Yes' if c==d else 'No')
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    A, B, C, D = map(int, input().split())

    if B <= C or D <= A:
        ans = 0
    else:
        ans = min(B, D) - max(A, C)

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
x = input()

ans = len(x)
l = 0
r = 0
for i in range(len(x)):
    if x[i] == "S":
        l += 1
    else:
        l -= 1

        if l < 0:
            l = 0
        else:
            ans -= 2

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
l = len(a)
min = float("INF")
for i in range(l - 1):
    x = a[i + 1] - a[i]
    if min > x:
        min = x
ans = float("INF")
for i in range(l):
    a[i] = a[i] % min
    if a[i] == 0:
        a[i] += min
    if ans > a[i]:
        ans = a[i]
print(ans)
# Judge status: Wrong Answer
n = int(input())
m = n
count = 0
for i in range(n): 
    m = m - 1
    if m == 1: 
        n = n//2
    else:
        count += 1
for i in range(n): 
    count += 2

print(count)
# Judge status: Accepted


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

A=str(K)
i=int(A)
j=0
while j<=N-K:
    #BList=AList[j:i]
    if j==0:
        MAE=AList[j]
    elif MAE>=AList[i-1]:
        print("No")
        MAE=AList[j]
    elif MAE<AList[i-1]:
        print("Yes")
        MAE=AList[j]
    i+=1
    j+=1
# Judge status: Wrong Answer
t = list(input())

if t[len(t)-1] == "?":
    t[len(t)-1] = "D"

for i in range(len(t)-1):
    if t[len(t)-2-i] == "?":
        if t[len(t)-1-i] == "P":
            t[len(t)-2-i] = "D"
        else:
            t[len(t)-2-i] = "P"

ans = ""

for i in range(len(t)):
    ans += t[i]

print(ans)
# Judge status: Accepted
X=int(input())
for i in range(1,100000):
    if X*i%360==0:
        print(i)
        break
# Judge status: Accepted
def main():
    x = int(input())
    ans = x//11
    chk = x%11
    if chk == 0:
        print(2*ans)
    elif chk <=6:
        print(2*ans+1)
    else:
        print(2*ans+2)

if __name__ == "__main__":
    main()
# Judge status: Accepted

k=int(input())

a=[]
judge=0
a.append("")
a.append(7%k)
for i in range(2,10**6+1):
    a.append((a[i-1]*10+7)%k)
for i in range(1,k+1):
    if a[i]==0:
        print(i)
        judge=1
        break
if judge==0:
    print(-1)
# Judge status: Accepted
n = int(len(input()))
print('x'*n)
# Judge status: Accepted
n = int(input())
al = list(map(int, input().split()))

cnt = [0]*(10**6+10)
for a in al:
    if cnt[a]>1:
        continue
    for i in range(0,10**6+10,a):
        cnt[i] += 1

res = 0
for a in al:
    if cnt[a]==1:
        res += 1
print(res)
# Judge status: Accepted
from math import gcd

N = int(input())
A = tuple(map(int, input().split(' ')))

left = []
right = []

left.append(A[0])
for a in A[1:]:
    left.append(gcd(left[-1], a))

right.append(A[-1])
for a in A[-2::-1]:
    right.append(gcd(right[-1], a))

right = list(reversed(right))

ans = [left[-2], right[1]]

for i in range(1, len(left) - 1):
    ans.append(gcd(left[i - 1], right[i + 1]))

print(max(ans))
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!
s = input()

word_list = ["dreamer","dream","eraser","erase"]
for i in word_list:
    s = s.replace(i,".")

if len(set(s)) == 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
s=input()
S=[s[i] for i in range(len(s))]
c=1
for i in range(len(S)-1):
  if S[i] in S[i+1:]:
    c=0
    break
if c==1:
  print('yes')
else:
  print('no')
# Judge status: Accepted
K, S = map(int, input().split())
s = 0
for x in range(min(S,K)+1):
  for y in range(min(S-x,K)+1):
    if S-x-y<=K:
      s += 1
print(s)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
T.append(10**12)

ans = 0
now = T[0]
i = 0

while i < N:
    ans += 1
    num = 0
    while i < N and T[i] <= now+K and num < C:
        num += 1
        i += 1
    now = T[i]
print(ans)
# Judge status: Accepted
A, B, C, K = list(map(int, input().split( )))
     
if(K < A):
      score = K
elif(K >= A and K <= A+B):
      score = A
else:
     score = A - (K - A - B)
     
print(score)
# Judge status: Wrong Answer
s = input().split()
print(s.count("1"))
# Judge status: Accepted
a,b=map(int,input().split())
if b<a:
	print("No")
else:
	print("Yes")
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())
route = ""
dx, dy = tx - sx, ty - sy
path1 = "R" * dx + "U" * dy
path2 = "L" * dx + "D" * dy
dx, dy = dx + 1, dy + 1
path3 = "D" + "R" * dx + "U" * dy + "L"
path4 = "U" + "L" * dx + "D" * dy + "R"
ans =path1 + path2 + path3 + path4
print( ans)
# Judge status: Accepted
a, b = input().split()
a = int(a)
b = int(b[0])*100 + int(b[2])*10 + int(b[3])
print((a*b)//100)
# Judge status: Accepted
n = int(input())
s = input()
res = 'Yes' if s[0:n//2] == s[n//2:] else 'No'
print(res)
# Judge status: Accepted
x,a,b = map(int, input().split())

if a-b>=0:
    print('delicious')
    quit()
elif a+x-b>=0:
    print('safe')
    quit()
else:
    print('dangerous')
# Judge status: Wrong Answer
l=[int(input()) for i in range(5)]

num=0
su=0
for i in l:
  a=round(i+5,-1)
  su+=a
  num=max(num,a-i)
  
print(su-num)
# Judge status: Accepted
N, M = map(int, input().split())
a = N*(N-1)//2
b = M*(M-1)//2
print(a+b)
# Judge status: Accepted
a,b = (int(T) for T in input().split())
print(((b-a)*(b-a+1)//2)-b)
# Judge status: Accepted
N, T = map(int, input().split())
D = []
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        D.append(c)
if D:
    print(min(D))
else:
    print("TLE")
# Judge status: Accepted
def resolve():
    n,a, b = map(int, input().split())
    if (b-a)%2 == 1:
        ans=min(a-1,n-b)+1+(b-a-1)//2
    else:
        ans=((b-a)//2)

    print(ans)


resolve()
# Judge status: Wrong Answer
n = int(input())
a_list = list(map(int,input().split()))

print(sum(a_list)-1)
# Judge status: Accepted
n = int(input())
m = n//100
a = n%100
if a > m*5:
  print(0)
else:
  print(1)
# Judge status: Wrong Answer
N=int(input())
count=1
size=1
p=list(map(int,input().split()))
q=[p[0]]
for i in range (1,N):
  if p[i]!=p[i-1]:
    q.append(p[i])
    size+=1
j=0
while True:
  if j>=size-2:
    break
  while (q[j]-q[j+1])*(q[j+1]-q[j+2])>=0:
    j+=1
    if j>=size-2:
      break
  count+=1
  j+=2
print(count)
# Judge status: Wrong Answer
def main():
    N = [int(x) for x in input()]
    dp0 = 0
    dp1 = 1e100
    for n in N:
        # そのまま払う
        a = min(dp0 + n, dp1 + 10 - n)
        # 1多めに払う
        b = min(dp0 + n + 1, dp1 + 10 - (n+1))
        dp0, dp1 = a, b

    print(dp0)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b=input().split()
n=int(a+b)
if n**.5==int(n**.5):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n=int(input())
s=input()
t=""
k=""
ans=0
l=[]
for i in range(1,n):
    ans1=0
    t=sorted(set(s[:i]))
    k=sorted(set(s[i:]))
    for i in t:
        for j in k:
            if i==j:
                ans1+=1
            l.append(ans1)
print(max(l))
# Judge status: Accepted
def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    N = ii()
    A = [list(mi()) for _ in range(2)]
    m = -1
    for i in range(N):
        m = max(m, sum(A[0][:i+1])+sum(A[1][i:]))
    print(m)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import re
a, b = map(int, input().split())
print("Yes" if re.search("\d{{{}}}-\d{{{}}}".format(a, b), input()) else "No")
# Judge status: Accepted
x,y=map(int,input().split())
a=0
while x<=y:
    x*=2
    a+=1
print(a)
# Judge status: Accepted
n = int(input())
a_list = list(map(int, input().split())) 
x_list = [0 for i in range(n-1)]
a = 0
for i in range(n-1):
	a += a_list[i]
	x_list[i] = a
total = sum(a_list)
r = abs(total - x_list[0]*2)
for x in x_list:
	r = min(r, abs(total - x*2))
print(r)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * n
for i in range(1, n):
    dp[i] = min(dp[j] + abs(h[j] - h[i]) for j in range(max(i-k,0),i))
print(dp[-1])
# Judge status: Accepted
from math import ceil

X = int(input())

if X <= 6:
    print(1)
    exit(0)

r = X % 11

# 11, 22, 33, ...
if r == 0:
    print((X // 11) * 2)
elif r <= 6:
    print(ceil(X / 11) * 2 - 1)
else:
    print(ceil(X / 11) * 2)
# Judge status: Accepted
W, H, N = map(int, input().split())

min_x = 0
max_x = W
min_y = 0
max_y = H

for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        min_x = max(min_x, x)
    elif a == 2:
        max_x = min(max_x, x)
    elif a == 3:
        min_y = max(min_y, y)
    else:
        max_y = min(max_y, y)

print((max_x - min_x) * (max_y - min_y) if max_x > min_x and max_y > min_y else 0)
# Judge status: Wrong Answer
N=int(input())
if N%7==0:
    print("Yes")
elif N%4==0:
    print("Yes")
elif (N%7)%4==0:
    print("Yes")
elif (N%4)%7==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
kmax = 0
x = 0
for i in range(1,N+1):
    k = 0
    y = i
    while y%2==0:
        y = y//2
        k += 1
    if k>kmax:
        x=i
        kmax = k
print(x)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
x=[0]*(M-m+3)
for i in a:
  x[i-m]+=1
  x[i-m+1]+=1
  x[i-m+2]+=1
print(max(x))
# Judge status: Wrong Answer
S = input()
print("Heisei" if S<="2019/4/30" else "TBD")
# Judge status: Accepted
N, H = map(int, input().split())

A = []
B = []
Amax = 0
for _ in range(N):
    a, b = map(int, input().split())
    Amax = max(a, Amax)
    B.append(b)

B.sort(reverse=True)

res = 0
for b in B:
    if b > Amax:
        res += 1
        if H <= b:
            print(res)
            exit()
        H -= b
    else:
        break

print(res + (H // Amax + int(H % Amax != 0)))
# Judge status: Wrong Answer
mod = pow(10, 9) + 7
n = int(input())

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

sq = sum([x**2 for x in lt])
st = sum(lt)**2
ans = (st - sq + mod)%mod
ans = (ans/2)%mod
print(ans)
# Judge status: Wrong Answer
import itertools

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

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))
# Judge status: Accepted
import math


def main():
    a, b = map(int, input().split())
    gcd = math.gcd(a, b)
    ans = [1]
    while gcd % 2 == 0:
        ans.append(2)
        gcd = gcd // 2
    f = 3
    while f * f <= gcd:
        if gcd % f == 0:
            ans.append(f)
            gcd = gcd // f
        else:
            f += 2
    if gcd != 1:
        ans.append(gcd)
    print(len(set(ans)))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x,y = map(int,input().split())
#print(x,y)

a = [1,3,5,7,8,12]
#print(a)
b = [4,6,9,11]
c = 2

if x in a and y in a:
  print("YES")
elif x in b and y in b:
  print("YES")
elif x==c and y==c:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
N = int(input())

flag = 1
for i in range(1,10):
    if N%i==0:
        if N/i<10:
            flag=0
            print("Yes")
            break
if flag==1:
    print("No")
# Judge status: Accepted
from sys import exit

N = int(input())
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
    t[i],x[i],y[i] = map(int,input().split())

for i in range(N):
    d = abs(x[i]-x[i+1]) + abs(y[i]-y[i+1])
    s = t[i+1] -t[i]
    if d > s or d%2!=s%2:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
import numpy as np

a = list(int(input()) for i in range(5))
b = np.array(a)
c = np.ceil(b/10)*10
d = max(c-b)

print(int(sum(c)-d))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

taoshita = 0
for i in range(n):
  taoshita += min(a[i], b[i])
  yoryoku = max(b[i]-a[i], 0)
  taoshita += min(a[i+1], yoryoku)
  a[i+1] = max(yoryoku-a[i+1], 0)

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

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

con = 0

while all(i % 2 == 0 for i in A):
  A = list(map(lambda x: int(x / 2), A))
  con += 1

print(con)
# Judge status: Accepted
n = int(input())
S = [input() for i in range(n)]
import sys, copy, math, heapq, bisect
from itertools import accumulate
from collections import deque, defaultdict, Counter
input = sys.stdin.readline # 文字列の入力のとき'/n'まで受け取るので注意!!!
sys.setrecursionlimit(500000)

ans = [5000]*26
for i in range(n):
    a = [0]*26
    for j in range(len(S[i])):
        a[ord(list(S[i])[j])-ord('a')] += 1

    for j in range(26):
        ans[j] = min(ans[j],a[j])

print(''.join(sorted(list(''.join([chr(ord('a')+i)*ans[i] for i in range(26)])))))
# Judge status: Wrong Answer
W, H, x, y = map(int, input().split())

area1 = min(H * x, H * (W - x))
area2 = min(W * y, W * (H - y))

method = "0"
if x == 0 and y == 0:
    pass
elif x == W and y == H:
    pass
elif area1 == area2:
    method = "1"


ans = max(area1, area2)
print(ans, method)
# Judge status: Accepted
s = input()
ans = 'YES'
 
while len(s) > 0:
    if s.endswith('dreamer'):
        s = s[:-7]
    elif s.endswith('dream'):
        s = s[:-5]
    elif s.endswith('eraser'):
        s = s[:-6]
    elif s.endswith('erase'):
        s = s[:-5]
    else:
        ans = 'NO'
        break
 
print(ans)
# Judge status: Accepted
from collections import Counter, defaultdict
S = input()
T = input()

S_count = Counter(S)
T_count = Counter(T)

d_S = defaultdict(int)
d_T = defaultdict(int)
for i in range(len(S)):
    d_S[S_count[S[i]]] += 1
    d_T[T_count[T[i]]] += 1

if (d_S == d_T):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
S = input()+"00"

r_cnt = 0
g_cnt = 0
b_cnt = 0
rgb_cnt = 0

for i in range(N):

    if S[i] == "R":
        r_cnt += 1
    elif S[i] == "G":
        g_cnt += 1
    elif S[i] == "B":
        b_cnt += 1

    if "R" in S[i:i+3] and "G" in S[i:i+3] and "B" in S[i:i+3]:
        rgb_cnt += 1

print((r_cnt*g_cnt*b_cnt)-rgb_cnt)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())

count4=sum(a%4==0 for a in A)
c_odd=sum(a%2==1 for a in A)

if N%2==1:
    print('YNeos'[c_odd>count4+1::2])
else:
    print('YNeos'[c_odd>count4::2])
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline

S = readline().strip().decode('utf-8')
N = len(S)
ans = 'No'
if N%2 == 0:
    for i in range(N//2):
        if S[2*i] != 'h' or S[2*i+1] != 'i':
            break
        
    else:
        ans = 'Yes'

print(ans)
# Judge status: Wrong Answer
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
 
sum = []
a,b = [0],[0]
ans = 0
 
for i in range(N):
  a.append(a[i]+A[i])
for i in range(M):
  b.append(b[i]+B[i])
  
for i in range(N+M+1):
  tmp = 0
  for j in range(i):
    if a[j]+b[i-j] < K:
      tmp = i
      ans = max(ans,tmp)
      break
  if tmp ==0:
    break

print(ans)
# Judge status: Wrong Answer
from math import factorial
n = int(input())
d = {}
for i in range(n):
    s = input()
    ns = ''.join(sorted(s))
    if ns not in d.keys():
        d[ns] = 1
    else:
        d[ns] += 1
ans = 0
for i, v in d.items():
    if v != 1:
        ans += factorial(v) /(factorial(v-2)*2)
print(str(ans)[:-2])
# Judge status: Wrong Answer
D = int(input())

cs = [int(i) for i in input().split()]

last = {n: 0 for n in range(1, 27)}
ans = []
for day in range(1, D-26):
    ss = [int(i) for i in input().split()]
    max_score = 0
    max_i = 1
    for i, s in enumerate(ss, 1):
        human = day-last[i]
        s_human = s + cs[i-1] * (human*2)
        if s_human > max_score:
            max_score = s_human
            max_i = i
    ans.append(max_i)
    last[max_i] = day

for a in ans:
    print(a)
# Judge status: Wrong Answer
import random
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(d)]
#t = [int(input()) for _ in range(d)]
ans = 0
last = [0]*26
for i in range(1,d+1):
    x = 0
    #x = t[i-1]-1
    #x = random.randrange(26)
    last[x] = i
    ans += s[i-1][x]
    for j in range(26):
        ans -= c[j]*(i-last[j])
    print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
if a>=13:
  print(b)
elif 12>=a>=6:
  print(b//2)
else:
  print(0)
# Judge status: Accepted
a,b,c,k=map(int,input().split())
if a==b==c:
    print(0)
    exit()
elif abs(a-b)>10**18:
    print("Unfair")
elif k%2==1:
    print(b-a)
else:
    print(a-b)
# Judge status: Wrong Answer
m,d =map(int,input().split())
print(m if m>=d else m-1)
# Judge status: Accepted
n = int(input())
nums = sorted([int(i) for i in input().split()])
# n = 3
# nums = [1, 1, 3]

median = nums[n//2]
mean = sum(nums) // n

ans = 10 ** 10
for diff in range(min(median, mean), max(median, mean)+2):
    diff_sum = 0
    for num in nums:
        diff_sum += (num - diff) ** 2
    ans = min(ans, diff_sum)

print(ans)
# Judge status: Accepted
S = list(input())
a = S.count("a")
b = S.count("b")
c = S.count("c")

mi = min(a, b, c)
a -= mi
b -= mi
c -= mi
if a > 1 or b > 1 or c > 1:
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
a,b = map(int,input().split())
print((b-a-1)*(b-a)//2 + a)
# Judge status: Accepted
N,K = map(int,input().split())
A = list(map(int, input().split()))

for k in range(K):
  imos = [0] * (N+1)
  for i, a in enumerate(A):
    l = max(0, i-a)
    r = min(N, i+1+a)
    imos[l] += 1
    imos[r] -= 1
  imos[0] = min(N, imos[0])
  for i in range(N):
    imos[i+1] = min(N, imos[i] + imos[i+1])
  A = imos[:-1]
  if all(a==N for a in A):
    break

print(*A)
# Judge status: Accepted
h,w = map(int, input().split())

if h%2 == 0:
    ans = (h//2) * w
elif w%2 == 0:
    ans = h * (w//2)
else:
    ans = h * (w//2) + h//2 + 1

if h == 1 or w == 1:
    ans = 1
print(ans)
# Judge status: Wrong Answer
import math

a, b, x = map(int,input().split())

s = 2 * (a*a*b - x) / (a**3)
print(math.degrees(math.atan(s)))
# Judge status: Wrong Answer

N=int(input())
S=input()
if S[:N//2]==S[N//2+1:] and N%2==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s = str(input())
arr = [int(s[i:i + 3]) for i in range(len(s) - 2)]
ans = []
for i in arr:
    ans.append(abs(753 - i))
print(min(ans))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

sum = n * (n - 1) // 2
if 1 < m:
    sum += m * (m - 1) // 2
print(sum)
# Judge status: Accepted
import sys
input = sys.stdin.readline
A,B = [int(i) for i in input().split()]
ma = A % 3
mb = B % 3
mp = (A+B) % 3
if ma == 0 or mb == 0 or mp == 0 :
    print("Possible")
else :
    print("Impossible")
# Judge status: Accepted
S = input()
if S[-1] == 's':
    print(S+'es')
else:
    print(S+'s')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
boxes = [0]*N
for i in reversed(range(N)):
    x = N //(i + 1)
    boxes[i] = (a[i] + sum([boxes[j*(i + 1) - 1] for j in range(2, x+1)]))%2
print(sum(boxes))
ans = []
for i in range(N):
    if boxes[i] == 1:
        ans.append(i + 1)
print(*ans)
# Judge status: Accepted
A, B = map(int, input().split())
if (A+B) % 2 == 0:
  print((A + B) // 2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
N = int(input())
R = []
for _ in range(N):
    x, L = map(int, input().split())
    R.append([x - L, x + L])

R.sort(key=lambda x: x[1])

ans = 1
for i in range(N):
    if (i == 0):
        first = R[0][1]
        continue

    if first <= R[i][0]:
        first = R[i][1]
        ans += 1

print(ans)
# Judge status: Accepted
from math import factorial

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

a = 10**9+7
if abs(N-M) >= 2:
    print(0)

elif N == M:
    print((2*factorial(N)*factorial(M)) % a)

else:
    print((factorial(N)*factorial(M)) % a)
# Judge status: Accepted
n = int(input())

n_origin = int(n * 100 / 108.)

if int(n_origin * 108 / 100) == n:
  print(n_origin)
elif int((n_origin+1) * 108 / 100) == n:
  print(n_origin+1)
else:
  print(":(")
# Judge status: Wrong Answer
n = int(input())

s = str(n)
val = 0

for letter in s:
    val += int(letter)

if val % 9 == 0 and val > 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# -*- coding: utf-8 -*-
a, b, c, d, e = map(int, input().split())
 
suuji_list = ["", a, b, c, d, e]
 
print(suuji_list.index(0))
# Judge status: Wrong Answer
X = input()

s, t = 0, len(X)//2
cnt = 0

for x in X:
    if x == 'S':
        s += 1
        if t > 0:
            cnt += 1
    else:
        t -= 1

print(len(X)-cnt*2)
# Judge status: Accepted
N,M = map(int, input().split())
s1 = []
s2 = []
flg = True
for i in range(M):
  n1,n2 = map(int,input().split())
  s1.append(n1)
  s2.append(n2)
for i in range(1000):
  flg = True
  num = [int(x) for x in list(str(i))]
  if len(num) == N:
    for j in range(M):
      if s2[j] != num[s1[j] - 1]:
        flg = False
    if flg:
      print(i)
      exit()
print(-1)
# Judge status: Accepted
S = input()
ok = True
for i, s in enumerate(S):
  if not i % 2 and s == 'L':
    ok = False
    break
  if i % 2 and s == 'R':
    ok = False
    break
if ok:
  print('Yes')
else:
  print('No')