Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=[0 for i in range(N+1)]
if(N<max(s)):
    print('-1')
    exit()

else:
    for i in range(M-1):
        if(ans[s[i]]==0):
            ans[s[i]]=c[i]
        for j in range(i+1,M):
            if(s[i]==s[j]):
                if(c[i]!=c[j]):
                    print('-1')
                    exit()


an=0
for i in range(1,N+1):
    if(ans[i]==0):
        pass
    else:
        an=ans[i]*10**(N-i)+an

if(an<=0):
    print('-1')
    exit()
print(an)


### FIXED CODE ###

N,M=map(int,input().split())
s=[0]*M
c=[0]*M
for i in range(M):
    s[i],c[i]=map(int,input().split())
ans=['#' for i in range(N+1)]

for i in range(M):
    if(ans[s[i]]=='#'):
        ans[s[i]]=str(c[i])
    for j in range(i+1,M):
        if(s[i]==s[j]):
            if(c[i]!=c[j]):
                print('-1')
                exit()

if(2<=N):
    if(ans[1]=='#'):
        ans[1]='1'
    elif(ans[1]=='0'):
        print('-1')
        exit()
else:
    if(ans[1]=='#'):
        ans[1]=0
        pass
    print(ans[1])
    exit()
a=ans[1:]

a=''.join(a).replace('#','0')
print(a)
input1 = int(input())
input2 = input()
inputbox = list(input2)
i=0
count = 0
for i in range(1000):
        c = [int(i/100),int(i/10)%10,i%10]
        f = 0
        for j in range(input1):
            if int(inputbox[j])==c[f]:
                f=f+1
            if f==3:
                break
        if f==3:
            count = count + 1
            
print(count)

### FIXED CODE ###

input1 = input()
input2 = input()
inputbox1 = input1.split()
inputbox2 = input2.split()

if inputbox1[0] == inputbox2[0]:
    print("0")
else:
    print("1")
import math
N=float(input())
a=math.ceil(N/(1.08))
for i in range(a,N):
    if math.floot(i*1.08)==N:
        print(a)
        break
    else:
        print(':(')

### FIXED CODE ###

import math
N=int(input())
a=math.ceil(N/(1.08))
if math.floor(a*1.08)==N:
        print(a)
else:
        print(':(')
s = list(input())
t = list(input())


dp = [["" for _ in range(len(s)+2)] for _ in range(len(t)+2)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            if len(dp[i][j]) + 1 > len(dp[i][j+1]) and len(dp[i][j]) + 1 > len(dp[i+1][j]):
                dp[i+1][j+1] = dp[i][j] + s[i]
            elif len(dp[i][j+1]) > len(dp[i][j]) + 1 and len(dp[i][j+1]) > len(dp[i+1][j]):
                dp[i+1][j+1] = dp[i][j+1]
            else:
                dp[i+1][j+1] = dp[i+1][j]
        else:
            if len(dp[i+1][j]) > len(dp[i][j+1]):
                dp[i+1][j+1] = dp[i+1][j]
            else:
                dp[i+1][j+1] = dp[i][j+1]

print(dp[len(s)][len(t)])

### FIXED CODE ###

s = input()
t = input()

def solve(S, T):
    L1 = len(S)
    L2 = len(T)
    dp = [[0]*(L2+1) for i in range(L1+1)]

    for i in range(L1-1, -1, -1):
        for j in range(L2-1, -1, -1):
            r = max(dp[i+1][j], dp[i][j+1])
            if S[i] == T[j]:
                r = max(r, dp[i+1][j+1] + 1)
            dp[i][j] = r

    # dp[0][0] が長さの解

    # ここからは復元処理
    res = []
    i = 0; j = 0
    while i < L1 and j < L2:
        if S[i] == T[j]:
            res.append(S[i])
            i += 1; j += 1
        elif dp[i][j] == dp[i+1][j]:
            i += 1
        elif dp[i][j] == dp[i][j+1]:
            j += 1
    return "".join(res)

print(solve(s,t))
s = input()
q = int(input())
exchange = 0

for _ in range(q):
  query = input()
  if query == '1':
    excnange += 1
  else:
    t, f, c = query.split()
    if f == '1':
      s = c + s
    else:
      s = s + c
      
if exchange % 2 == 0:
  print(s)
else:
  print(s[::-1])


### FIXED CODE ###

import sys
input = sys.stdin.readline

s = input().strip()
q = int(input())
query = [list(input().strip().split()) for _ in range(q)]

left = ''
right = ''
t = False
for ls in query:
    if len(ls) == 1:
        t = not t
    else:
        two, f, c = ls
        if f == '1':
            if t:
                right += c
            else:
                left += c
        else:
            if t:
                left += c
            else:
                right += c

if t:
    print(right[::-1] + s[::-1] + left)
else:
    print(left[::-1] + s + right)
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

MOD = 998244353

def comb(n, r):
    if n == 0 or r == 0: return 1
    return ( comb(n, r-1) % MOD) * (n-r+1) / r
    
N,A,B,K = Is()
ans = 0
for x in range(N+1):
    if (K-A*x)/B >= 0 and (K-A*x)/B == int((K-A*x)/B):
        ans += comb(N,x)*comb(N,(K-A*x)/B) % MOD
print(int(ans))


### FIXED CODE ###

import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 998244353 #出力の制限
N = 3*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,A,B,K = Is()
ans = 0
for x in range(N+1):
    y = (K-A*x)/B
    if 0 <= y <= N and y.is_integer():
        ans += cmb(N,x,mod)*cmb(N,int(y),mod) % mod
print(ans % mod)
import numpy as np
K = int(input())
a = np.arrange(a,K+1)
b = np.gcd.outer(np.gcd.outer(a, a), a)
print(np.sum(b))

### FIXED CODE ###

import numpy as np
K = int(input())
a = np.arange(1,K+1)
b = np.gcd.outer(np.gcd.outer(a, a), a)
print(np.sum(b))
import sys
sys.setrecursionlimit(10 ** 9)

n = int(input())
x = input()

p = [-1 for _ in range(2*(10**7)+1)]
cnt = x.count('1')

def calc(a):
  #print('a=',a)
  if 0 <= a <= 2*(10**7) and  p[a] != -1:
    return p[a]
  else:
    if a == 0:
      ret = 0
    else:
      b = bin(a).count('1')
      ret = 1+calc(a%b)
    if 0 <= a <= 2*(10**7):
      p[a] = ret
    return ret

x0 = int(x,2)%(cnt-1)
x1 = int(x,2)%(cnt+1)
xx0 = [1]
for i in range(n+1):
  xx0.append((xx0[-1]*2)%(cnt-1))
xx1 = [1]
for i in range(n+1):
  xx1.append((xx1[-1]*2)%(cnt+1))

y = list(x)  
for i in range(n):
  if y[i] == '0':
    xx = xx1[n-i-1]
    print(calc((x1+xx)%(cnt+1))+1)
  else:
    if cnt == 1:
      print(1)
    else:
      xx = xx0[n-i-1]
      print(calc((x0-xx)%(cnt-1))+1)
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n = int(input())
x = input()

p = [-1 for _ in range(2*(10**7)+1)]
cnt = x.count('1')

def calc(a):
  #print('a=',a)
  if 0 <= a <= 2*(10**7) and  p[a] != -1:
    return p[a]
  else:
    if a == 0:
      ret = 0
    else:
      b = bin(a).count('1')
      ret = 1+calc(a%b)
    if 0 <= a <= 2*(10**7):
      p[a] = ret
    return ret

if cnt > 1:
  x0 = int(x,2)%(cnt-1)
  xx0 = [1]
  for i in range(n+1):
    xx0.append((xx0[-1]*2)%(cnt-1))
x1 = int(x,2)%(cnt+1)
xx1 = [1]
for i in range(n+1):
  xx1.append((xx1[-1]*2)%(cnt+1))

y = list(x)  
for i in range(n):
  if y[i] == '0':
    xx = xx1[n-i-1]
    print(calc((x1+xx)%(cnt+1))+1)
  else:
    if cnt == 1:
      print(0)
    else:
      xx = xx0[n-i-1]
      print(calc((x0-xx)%(cnt-1))+1)
from collections import deque
from collections import defaultdict
import heapq

N,M=map(int, raw_input().split())
cost=map(int, raw_input().split())

if M==N-1:
	print 0
	quit()

nl=[ [] for i in range(N) ]

for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)


d=[ None for i in range(N) ]
V=[ None for i in range(N) ]

group_cost=defaultdict(lambda: [])

def dfs(start):
	q = deque([]) 
	V[start]=start
	d[start]=0
	heapq.heappush(group_cost[start],cost[start])
	q.append(start)

	while len(q)!=0:
		v=q.pop()
		for i in nl[v]:
			if V[i] is None:
				V[i]=start
				q.append(i)
				heapq.heappush(group_cost[start],cost[i])

for i in range(N):
	if V[i] is None:
		dfs(i)

edges=(N-M-1)*2

ans=0
for i in group_cost.keys():
	ans+=heapq.heappop(group_cost[i])
	edges-=1


nokori_cost=[]
if edges==0:
	print ans
	quit()
else:
	nokori_cost=heapq.merge(*group_cost.values())

	if len(list(nokori_cost))<edges:
		print "Impossible"
		quit()

	for i in range(edges):
		ans+=heapq.heappop()
	print ans




### FIXED CODE ###

from collections import deque
from collections import defaultdict
import heapq

N,M=map(int, raw_input().split())
cost=map(int, raw_input().split())

if M==N-1:
	print 0
	quit()

nl=[ [] for i in range(N) ]

for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)


d=[ None for i in range(N) ]
V=[ None for i in range(N) ]

group_cost=defaultdict(lambda: [])

def dfs(start):
	q = deque([]) 
	V[start]=start
	d[start]=0
	heapq.heappush(group_cost[start],cost[start])
	q.append(start)

	while len(q)!=0:
		v=q.pop()
		for i in nl[v]:
			if V[i] is None:
				V[i]=start
				q.append(i)
				heapq.heappush(group_cost[start],cost[i])

for i in range(N):
	if V[i] is None:
		dfs(i)


H = []

ans=0
for v in group_cost.values():
	v=sorted(v)
	ans+=v[0]
	H.append(v[1:])

nokori_cost=list(heapq.merge(*H))


if N < 2*(N-M-1):
	print "Impossible"
elif M == N-1:
	print 0
else:
	ans += sum(nokori_cost[:2*(N-M-1) - len(group_cost.keys())])
	print ans
a=int(input().split())
if a[0]<a[1]:
    print("a < b")
elif a[0]>a[1]:
    print("a > b")
else:
    print("a == b")


### FIXED CODE ###

a,b=map(int,input().split())
if a<b:
    print("a < b")
elif a>b:
    print("a > b")
else:
    print("a == b")
from functools import reduce

MOD = 1_000_000_000 + 7
LETTERS = ["A", "C", "G", "T"]
PROHIBIT = ["AGC", "ACG", "GAC", "AGGC", "AGTC", "ATGC"]

def main():
    n = int(input().strip())

    table = {}

    for first in LETTERS:
        for second in LETTERS:
            for third in LETTERS:
                codon = first+second+third
                if not codon in PROHIBIT:
                    table[codon] = [1]

    for i in range(n-3):
        for codon in table.keys():
            table[codon].append(0)

        for codon in table.keys():
            for append in LETTERS:
                three_letters = codon[1:] + append
                four_letters = codon + append

                if (not four_letters in PROHIBIT) and (not three_letters in PROHIBIT):
                    table[three_letters][i+1] = (table[three_letters][i+1] + table[codon][i]) % MOD

    print(reduce(lambda acc, x: (acc + x[-1]) % MOD, table.values(), 0))

if __name__ == "__main__":
    main()


### FIXED CODE ###

from functools import reduce

MOD = 1000000000 + 7
LETTERS = ["A", "C", "G", "T"]
PROHIBIT = ["AGC", "ACG", "GAC", "AGGC", "AGTC", "ATGC"]

def main():
    n = int(input().strip())

    table = {}

    for first in LETTERS:
        for second in LETTERS:
            for third in LETTERS:
                codon = first+second+third
                if not codon in PROHIBIT:
                    table[codon] = [1]

    for i in range(n-3):
        for codon in table.keys():
            table[codon].append(0)

        for codon in table.keys():
            for append in LETTERS:
                three_letters = codon[1:] + append
                four_letters = codon + append

                if (not four_letters in PROHIBIT) and (not three_letters in PROHIBIT):
                    table[three_letters][i+1] = (table[three_letters][i+1] + table[codon][i]) % MOD

    print(reduce(lambda acc, x: (acc + x[-1]) % MOD, table.values(), 0))

if __name__ == "__main__":
    main()
N, A, B = map(int, input().split())

X = N*(A*'b' + B*'r')
print(X)

cnt = X.count('b', 0, N)
print(cnt)

### FIXED CODE ###

N, A, B = map(int,input().split())
 
x = A * (N // (A+B))
 
y = N % (A+B)
 
ans = x + min(A, y)
 
print(ans)
a,b,c=map(int,input.split());print(["No","Yes"][bool((a==b+c)or(b==a+c)or(c==a+b))])


### FIXED CODE ###

a,b,c=map(int,input().split());print(["No","Yes"][(a+b==c)+(b+c==a)+(c+a==b)])
a,b=map(int,input().aplit())
if abs(a-c)==abs(b-c):
  print(c)
else:
  print('IMPOSSIBLE')

### FIXED CODE ###

a,b=map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')
def h(temp):
    if temp[0] == "m":
        a = 0
    elif temp[0] == "r":
        if temp[2] == "m":
            a = 1
        else:
            a = 3
    else:
        a = 2
    return a 

def H(temp,y,a):
    c = 0
    if a == 0 or a == 2:
        for j in range(5):
            if y[a][4-j] != temp[0]:
                return c
            temp.remove(temp[0])
        c = 1
    else:
        for j in range(7):
            if y[a][6-j] != temp[0]:
                break
        c = 1
    return c,temp


s = input()
y = ['dream','dreamer','erase','eraser'] 
temp = []
t = []
k = len(s)
for i in range(k):
    temp.append(s[k-i-1])
a = h(temp)
c = 1

while len(temp) != 0 and c == 1:
    c = H(temp,y,a)
    a = h(temp)
if c[0] == 1:
    print("YES")
else :
    print("NO")

### FIXED CODE ###

def h(temp):
    if temp[0] == "m":
        a = 0
    elif temp[0] == "r":
        if temp[2] == "m":
            a = 1
        else:
            a = 3
    else:
        a = 2
    return a 

def H(temp,y,a):
    c = 0
    if a == 0 or a == 2:
        for j in range(5):
            if y[a][4-j] != temp[0]:
                return c
            temp.remove(temp[0])
        c = 1
    elif a == 3:
        for j in range(6):
            if y[a][5-j] != temp[0]:
                return c
            temp.remove(temp[0])
        c = 1
    else:
        for j in range(7):
            if y[a][6-j] != temp[0]:
                return c
            temp.remove(temp[0])
        c = 1
    return c


s = input()
y = ['dream','dreamer','erase','eraser'] 
temp = []
t = []
k = len(s)
for i in range(k):
    temp.append(s[k-i-1])
c = 1
while len(temp) != 0 and c == 1:
    a = h(temp)
    c = H(temp,y,a)
if c == 1:
    print("YES")
else :
    print("NO")
import sys
from fractions import gcd
for line in sys.stdin:
    a, b = map(int, raw_input().split())
    print gcd(a, b), a*b/gcd(a,b)

### FIXED CODE ###

import sys
from fractions import gcd
for line in sys.stdin:
    a, b = map(int, line.split())
    print gcd(a, b), a*b/gcd(a,b)
import math


n, k = [int(i) for i in input().split()]
prob = 0
for i in range(1, n + 1):
    if i >= k:
        exp = 0
    else:
        exp = math.ceil(math.log2(k) - math.log2(i))
    prob += (1 / n) * (1 / 2) ** exp
print(prob)


### FIXED CODE ###

import math


n, k = [int(i) for i in input().split()]
prob = 0
for i in range(1, n + 1):
    if i >= k:
        exp = 0
    else:
        exp = math.ceil(math.log2(k) - math.log2(i))
    prob += (1 / n) * (1 / 2) ** exp
print(prob)
import numpy as np

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

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

win = 0
for i in range(N):
	for j in range(i+1, N):
		if x[i] + x[j] >= H:
			win = 1
			print("Yes")
			break
	if win == 1:
		break


if win == 0:
	print("No")

### FIXED CODE ###

import numpy as np

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

ans = N // A

if N%A>0:
	ans += 1

print(ans)
def resolve():
    N = int(input())
    list = list(map(int, input().split()))
    no = 0
    non = 0
    ans = 1
    lens = 0
    if (list.count("0") >= 1):
      print("0")
      exit()
    else:
      for i in range(N):
        lens = lens + len(list[non])
        non += 1
    if (lens >= 19):
      print("-1")
      exit()
    else:
      for j in range(N):
        ans = ans * list[no]
        no += 1
    print(ans)
resolve()

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
resolve()
s1, s2, s3 = map(int, input().split())
list = [s1, s2, s3]
bidama_num = 0
for item in list:
  if item == 1:
    bidama_num += 1
  
  

### FIXED CODE ###

print(sum([int(i) for i in input()]))
import numpy as np
a, b = map(int, input().split(' '))
print(np.lcm(a, b))

### FIXED CODE ###

def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x

def lcm(x, y):
    return (x * y) // gcd(x, y)

a, b = list(map(int, input().split()))
print(lcm(a, b))
s=input();print(~-int(s[:2])*~-int(s[2:]))

### FIXED CODE ###

a,b=map(lambda x:int(x)-1,input().split())
print(a*b)
if int(input())==1:
    print("Hello World!")
else:
    a,b = map(int, input().split())
    print(a+b)

### FIXED CODE ###

n = int(input())
if n == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
N, Y = map(int, input().split())

for i in range(N+1):
    for j in range(N-i+1):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")

### FIXED CODE ###

n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")
a = input()
b = raw_input()
x = 0
for i in range(1,n):
    z = s[0:i]
    y = s[i:n]
    arr = []
    for l in y:
        for m in z:
            if l == m and l not in arr:
                arr.append(l)
    if len(arr) > x:
        x = len(arr)
print x

### FIXED CODE ###

a = input()
b = raw_input()
x = 0
for i in range(1,a):
    z = b[0:i]
    y = b[i:a]
    arr = []
    for l in y:
        for m in z:
            if l == m and l not in arr:
                arr.append(l)
    if len(arr) > x:
        x = len(arr)
print x
from bisect import bisect_left

s = input()
n = len(s)
ans = [0] * n
l = [i for i in range(n - 1) if s[i] == 'R' and s[i + 1] == 'L']
for i in range(n):
    b = bisect_left(l, i)
    print(b, l)
    if s[i] == 'R':
        if (l[b] - i) % 2 == 1:
            ans[l[b] + 1] += 1
        else:
            ans[l[b]] += 1
    elif s[i] == 'L':
        if (i - l[b - 1]) % 2 == 1:
            ans[l[b - 1] + 1] += 1
        else:
            ans[l[b - 1]] += 1
print(ans)

### FIXED CODE ###

from bisect import bisect_left

s = input()
n = len(s)
ans = [0] * n
l = [i for i in range(n - 1) if s[i] == 'R' and s[i + 1] == 'L']
for i in range(n):
    b = bisect_left(l, i)
    if s[i] == 'R':
        if (l[b] - i) % 2 == 1:
            ans[l[b] + 1] += 1
        else:
            ans[l[b]] += 1
    elif s[i] == 'L':
        if (i - l[b - 1]) % 2 == 1:
            ans[l[b - 1] + 1] += 1
        else:
            ans[l[b - 1]] += 1
a = ''
for i in range(n):
    if i != n - 1:
        a += str(ans[i]) + " "
    else:
        a += str(ans[i])
print(a)
import sys
print "\n".join([len(str(sum([int(x) for x in l.split(' ')]))) for l in sys.stdin])

### FIXED CODE ###

import sys
print "\n".join(str(len(str(sum(int(x) for x in l.split(' '))))) for l in sys.stdin)
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline


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

def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n+1):
        if not is_prime[i]:
            continue
        for j in range(i*2, n+1, i):
            is_prime[j] = False
    return [i for i in range(2, n+1) if is_prime[i]]

def main():
    """ main """
    A,B = map(int, input().split())
    g = gcd(A,B)
    ps = primes(g)
    ans = 1
    for p in ps:
        if g%p == 0: ans += 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline


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

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    ass.sort()
    return ass

def main():
    """ main """
    A,B = map(int, input().split())
    ds = divisor(gcd(A,B))
    if len(ds) == 1:
        print(1)
        return 0
    ds = ds[1:]
    dp = [1]*len(ds)
    for i in range(len(ds)):
        if dp[i]:
            for j in range(i+1,len(ds)):
                if ds[j]%ds[i] == 0:
                    dp[j] = 0
    ans = 1
    for d in dp:
        if d == 1: ans += 1
    print(ans)

if __name__ == '__main__':
    main()
n,l = map(int,input().split())

if l <= 0 <= n+l-1:
  print((n+l)*(n+l-1)//2 - (-l)*(-l+1)//2)
elif n+l-1 < 0:
  print((n-1)*(n+2l-2)//2)
else:
  print((n-1)*(n+2l)//2)
  

### FIXED CODE ###

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

if l <= 0 <= n+l-1:
  print((n+l)*(n+l-1)//2 - (-l)*(-l+1)//2)
elif n+l-1 < 0:
  print((n-1)*(n+2*l-2)//2)
else:
  print((n-1)*(n+2*l)//2)
n = int(input())
a_list = list(map(int, input().split())) # list()を忘れずに

def odd_detector(a_list):
    is_odd = 0
    for a_i in a_list:
        if a_i % 2 == 1:
            is_odd = 1
            break
    return is_odd

n_division = 0
while odd_detector(a_list) == 0:
    a_list = [a / 2 for a in a_list]
    n_division += 1

print(n_division)


### FIXED CODE ###

print(input().count("1"))
A, B = map(float, input().split())
print(int((A*(B*100))/100)

### FIXED CODE ###

A, B = input().split()
ans = 0
A = int(A)
B = B.replace(".", "")
ans = A*int(B)
print(ans//100)
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

#2Lあたり
Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_A = N//2
    cnt_B = N%2
    pay = a*cnt_A + (cnt_B/B)*(b/(2/B))
else:
    pay = (N//A) * (a/(2/A))
print(int(pay))

### FIXED CODE ###

#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = D*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
import numpy as np
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n, k = MAP()
a = LIST()

def update(a):
    b = np.zeros((n, n), dtype = np.int64)
    for i in range(n):
        b[i, max(0, i-a[i]):min(n, i+a[i]+1)] = 1
    return np.sum(b, axis=0)
end = [n]*n

for i in range(k):
    if a == end:
        break
    a = list(update(a))
for i in range(n):
    print(str(int(a[i]))+" ",end = "" )

### FIXED CODE ###

import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n, k = MAP()
a = LIST()


end = [n]*n

for i in range(min(k, 41)):
    b = [0]*(n+1)
    for j in range(n):
        b[max(j-a[j], 0)] +=1
        if j+a[j] <n:
            b[j+a[j]+1] -=1
    for j in range(1,n):
        b[j] += b[j-1]
    a = b[:n]

for i in range(n):
    print(str(int(a[i]))+" ",end = "" )