Harryxun/stf_run huggingface dataset:
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5,6]

for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
n, t = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
l = []
flag = False
for i in range(n):
    if a[i][2] <= t:
        l.append(a[i][0])
        flag = True
if flag:
    print(min(l))
else:
    print('TLE')

### FIXED CODE ###

n, t = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
l = []
flag = False
for i in range(n):
    if a[i][1] <= t:
        l.append(a[i][0])
        flag = True
if flag:
    print(min(l))
else:
    print('TLE')
n = int(input())
h = list(map(int, input().split()))
p = 0
flag = 0an = int(input())
h = list(map(int, input().split()))
p = 0
flag = 0
for i in range(1, len(h) - 1):
  # 左チェック
  if (h[i - 1] - h[i]) > 1:
    print('No')
    exit()
  elif (h[i - 1] - h[i]) == 1:
    if flag == 1:
      print('No')
      exit()
    else:
      flag == 1
  elif (h[i - 1] - h[i]) == 0:
    flag == 1
  # 右チェック
  elif (h[i + 1] - h[i]) < 0:
    if flag == 1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) < -1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) == -1:
      if flag == 1:
        print('No')
        exit()
      else:
        flag = 1
  elif (h[i + 1] - h[i]) >= 0 and flag == 1:
    flag == 0
print('Yes')
for i in range(1, len(h) - 1):
  # 左チェック
  if (h[i - 1] - h[i]) > 1:
    print('No')
    exit()
  elif (h[i - 1] - h[i]) == 1:
    if flag == 1:
      print('No')
      exit()
    else:
      flag == 1
  elif (h[i - 1] - h[i]) == 0:
    flag == 1
  # 右チェック
  elif (h[i + 1] - h[i]) < 0:
    if flag == 1:
      print('No')
      exit()
    elif (h[i + 1] - h[i]) < -1:
      print('No')
      exit()
print('Yes')

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
p = h[-1]
flag = 0
for i in h[::-1]:
  if i <= p:
    p = i
    continue
  elif (i - p) == 1:
    p = i - 1
  else:
    print('No')
    exit()
print('Yes')
mod=10**9+7

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
  
z=(x+y)//3

x-=z
y-=z

n=x+y
r=x

xxx=lst[n]
xxx*=pow(lst[n-r],10**9+5,mod)
xxx%=mod
xxx*=pow(lst[r],10**9+5,mod)
xxx%=mod

print(xxx)



### FIXED CODE ###

mod=10**9+7

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
  
if x*2<y or y*2<x:
  print(0)
  exit()
  
z=(x+y)//3

x-=z
y-=z

n=x+y
r=x

if x==0 or y==0:
  print(1)
  exit()
  

lst=[0]+[1]
for i in range(2,n+10):
  lst.append((lst[-1]*i)%mod)


xxx=lst[n]
xxx*=pow(lst[n-r],10**9+5,mod)
xxx%=mod
xxx*=pow(lst[r],10**9+5,mod)
xxx%=mod

print(xxx)
count = 0
a = str(input())
print(a)
for i in range(len(a))
if a[i] == 1:
    count = count + 1

### FIXED CODE ###

print(int(input()) % 9)
i = 0
takahasi = 0
while i < 4:
    if S[i:i+1] == "+":
        takahasi += 1
    else:
        takahasi -= 1
    i += 1
print(takahasi)

### FIXED CODE ###

from sys import stdin
S = str(stdin.readline().rstrip())
i = 0
takahasi = 0
while i < 4:
  if S[i:i+1] == "+":
    takahasi += 1
  elif S[i:i+1] == "-":
    takahasi -= 1
  i += 1
print(takahasi)
n,x = map(int, input().split())
if 1 < x < (2*n - 1):
    print("Yes")
    if x != 2:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) //2
        ans[k-1] = x-1
        ans[k] = x
        ans[k+1] = x+1
        ans[k+2] = x-2
        used = set([x-1,x,x+1,x-2])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
    else:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) //2
        ans[k-1] = x+2
        ans[k] = x
        ans[k+1] = x-1
        ans[k+2] = x+1
        used = set([x-1,x,x+1,x-2])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
else:
    print("No")

### FIXED CODE ###

n,x = map(int, input().split())
if 1 < x < (2*n - 1):
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
        exit()
    if x != 2:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) //2
        ans[k-1] = x-1
        ans[k] = x
        ans[k+1] = x+1
        ans[k+2] = x-2
        used = set([x-1,x,x+1,x-2])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
    else:
        ans = [-1 for i in range(2*n-1)]
        k = (n*2-1) // 2
        ans[k-1] = x+2
        ans[k] = x
        ans[k+1] = x-1
        ans[k+2] = x+1
        used = set([x+1,x,x+2,x-1])
        insert = iter([i+1 for i in range(n*2-1) if (i+1) not in used])
        for i in range(2*n-1):
            if ans[i] == -1:
                ans[i] = insert.__next__()
        for i in range(n*2-1):
            print(ans[i])
else:
    print("No")
n, k = map(int, input().split())
v = list(map(int, input().split()))
M = 0

for left in range(k + 1):
    for right in range(k - left + 1):
        if left + right > n:
            break
        hold = []
        hold.extend(v[:left])
        hold.extend(v[n-right:])
        hold.sort()
        total = sum(hold)
        for i in range(min(k - left - right)):
            if 0 <= hold[i]:
                break
            total -= hold[i]
        M = max(M, total)

print(M)



### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))
M = 0

for left in range(k + 1):
    for right in range(k - left + 1):
        if left + right > n:
            break
        hold = []
        hold.extend(v[:left])
        hold.extend(v[n-right:])
        hold.sort()
        total = sum(hold)
        for i in range(min(k - left - right, left + right)):
            if 0 <= hold[i]:
                break
            total -= hold[i]
        M = max(M, total)

print(M)
n=int(input())
a=[]
for i in range(n):
  a.appent(int(input()))
i=0
count=1
while(1):
  if a[i]==1:
    frag=-1
    break
  elif a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)  

### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
i=0
count=1
frag=-1
for j in range(n):
  if a[i]==2:
    frag=count
    break
  else:
    i=a[i]-1
    count+=1
print(frag)
x,a,b=map(int,input().split())
print((x+a)%b)

### FIXED CODE ###

x=int(input())
a=int(input())
b=int(input())
print((x-a)%b)
s=input()
for i in range(2**3):
  f=s[0]
  for j in range(3):
    if i>>j&1:
      f+="+"
    f+=s[j+1]
  if eval(f)==7:
    print(f+"=7")
    break


### FIXED CODE ###

ss=input()
s=[0]*4
for i in range(len(ss)):
  s[i]=int(ss[i])
dif=7-s[0]
ans=str(s[0])
found=False
for b in [s[1],-s[1]]:
  for c in [s[2],-s[2]]:
    for d in [s[3],-s[3]]:
      if b+c+d==dif:
        if b==s[1]:
          ans+="+"
        else:
          ans+="-"
        ans+=str(s[1])
        if c==s[2]:
          ans+="+"
        else:
          ans+="-"
        ans+=str(s[2])
        if d==s[3]:
          ans+="+"
        else:
          ans+="-"
        ans+=str(s[3])
        found=True
        break
    if found:
      break
  if found:
    break
print(ans+"=7")
num = input().split()

if num[0] * num[1] % 2 == 0 :
  print("No")
else:
  print("Yes")

### FIXED CODE ###

if __name__ == '__main__':
  
	num = input().split()

	if int(num[0]) * int(num[1]) % 2 ==0:
		print("No")
	else:
  		print("Yes")
N = int(input())
s = [0]*N
t = [0]*N
for i in range(N):
    s[i],t[i] = input().split()
s = [int(x) for x in s]
t = [int(x) for x in t]
def sel(a,b):
    u = []
    c = 0
    for i in range(len(a)-3):
        if abs(a[i+1] - a[i]) < b[i+1] + b[i]:
            c = c + 1
            a.pop(i)
            b.pop(i)
            a1 = a
            b1 = b
            sel(a1,b1)
            c = 0
    if c == 0:
        u.append(len(a))
    return u
u1 = sorted(sel(s,t))
print(u1[-1])

### FIXED CODE ###

N,K,S = map(int,input().split())
t = [999999999]*N
for i in range(K):
    t[i] = S
print(*t)
n=int(input())
n=int(input())
for i in range(n):
	inputs=list(map(str,input().split()))
	ans=""
	for j in inputs:
		if j[:7]=="Hoshino":
			ans+="Hoshina "
			#print("Hoshina",end=" ")
		else:
			ans+=j+" "
			#print(j,end=" ")
	ans=ans[:-1]
	print(ans)

### FIXED CODE ###

n=int(input())
for i in range(n):
	print(input().replace("Hoshino","Hoshina"))
while True:
  mem = {}
  p, q = map(int, raw_input().split())
  a, b, c = "", p % q, 0
  while True:
    b = (b % q) * 10
    if b in mem or not b: 
      break
    mem[b] = len(a)
    a += str(b // q)
  print(a)
  if b != 0:
    print(" " * mem[b] + "^" * (len(a) - mem[b]))

### FIXED CODE ###

while True:
  mem = {}
  try:
    p, q = map(int, raw_input().split())
  except EOFError:
    break
  a, b, c = "", p % q, 0
  while True:
    b = (b % q) * 10
    if b in mem or not b: 
      break
    mem[b] = len(a)
    a += str(b // q)
  print(a)
  if b != 0:
    print(" " * mem[b] + "^" * (len(a) - mem[b]))
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
  ptr = n - 1 - i
  if a[ptr] % 2 == 1:
    for j in range(1, int(math.sqrt(ptr+1))+1):
      if (ptr + 1) % (j + 1) == 0:
        a[j] += 1
      
cnt = 0
que = []
for  i in range(n):
  if a[i]:
    cnt += 1
    que.append(a[i])

print(cnt)
print(' '.join(map(str, que)))

### FIXED CODE ###

import math

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

for i in range(n-1):
  ptr = n - 1 - i
  if a[ptr] % 2 == 1:
    a[0] += 1
    for j in range(2, int(math.sqrt(ptr+1))+1):
      if (ptr + 1) % j == 0:
        a[j-1] += 1
        if (ptr + 1) // j != j:
          a[(ptr + 1) // j - 1] += 1
      
cnt = 0
que = []
for  i in range(n):
  if a[i] % 2 == 1:
    cnt += 1
    que.append(i+1)

print(cnt)
if cnt > 0:
  print(' '.join(map(str, que)))
def isdreame(s) :
    res = -1

    if len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "erase" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        res = isdreame(s[0:len(s)-5])
      else :
          res = 1

    elif len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "dream" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        res = isdreame(s[0:len(s)-5])
      else :
          res = 1

    elif len(s) - 6 >= 0 and s[len(s)-6:len(s)] == "eraser" :
      #print(s[0:len(s)-6])
      if len(s) - 6 > 0 :
        res = isdreame(s[0:len(s)-6])
      else :
          res = 1

    elif len(s) - 7 >= 0 and s[len(s)-7:len(s)] == "dreamer" :
      #print(s[0:len(s)-7])
      if len(s) - 7 > 0 :
        res = isdreame(s[0:len(s)-7])
      else :
          res = 1

    else :
        res = 0

    return res

s = input()
res = isdreame(s)

if res==1 :
    print("YES")
else :
    #print(res)
    print("NO")

### FIXED CODE ###

s = input()
res = -1

while len(s) > 0 :

    if len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "erase" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        s = s[0:len(s)-5]
      else :
          res = 1
          s = s[0:len(s)-5]

    elif len(s) - 5 >= 0 and s[len(s)-5:len(s)] == "dream" :
      #print(s[0:len(s)-5])
      if len(s) - 5 > 0 :
        s = s[0:len(s)-5]
      else :
          res = 1
          s = s[0:len(s)-5]

    elif len(s) - 6 >= 0 and s[len(s)-6:len(s)] == "eraser" :
      #print(s[0:len(s)-6])
      if len(s) - 6 > 0 :
        s = s[0:len(s)-6]
      else :
          res = 1
          s = s[0:len(s)-6]

    elif len(s) - 7 >= 0 and s[len(s)-7:len(s)] == "dreamer" :
      #print(s[0:len(s)-7])
      if len(s) - 7 > 0 :
        s = s[0:len(s)-7]
      else :
          res = 1
          s = s[0:len(s)-7]

    else :
        res = 0
        s = ""


if res==1 :
    print("YES")
else :
    #print(res)
    print("NO")
def main():
    M=10**9+7
    n,k,*a=map(int,open(0).read().split())
    x,y=[],[]
    for i in a:
        if i>0:x+=i,
        if i<0:y+=i,
    if len(x)+len(y)<k or k%2 and not x and len(y)<n:
        print(0)
        break
    if k%2 and not x:
        c=1
        for i in sorted(y)[-k:]:
            c=c*i%M
        print(c)
        break
    x=sorted(x)[::-1][:k]
    i=len(x)
    y.sort()
    m=len(y)
    j=k-i
    if j%2:
        x=x[:-1]
        i-=1
        j+=1
    x+=y[:j]
    if len(x)!=k:
        print(0)
        break
    while i>1 and j+1<m and x[i-1]*x[i-2]<y[j]*y[j+1]:
        x[i-1],x[i-2]=y[j],y[j+1]
        i-=2
        j+=2
    c=1
    for i in x:
        c=c*i%M
    print(c)
main()

### FIXED CODE ###

def main():
    M=10**9+7
    n,k,*a=map(int,open(0).read().split())
    x,y=[],[]
    for i in a:
        if i>0:x+=i,
        if i<0:y+=i,
    if len(x)+len(y)<k or k%2 and not x and len(y)<n:
        print(0)
        return
    if n==k or k%2 and not x:
        c=1
        for i in sorted(x+y)[-k:]:
            c=c*i%M
        print(c)
        return
    x=sorted(x)[::-1][:k]
    i=len(x)
    y.sort()
    m=len(y)
    j=k-i
    if j%2:
        x=x[:-1]
        i-=1
        j+=1
    x+=y[:j]
    while i>1 and j+1<m and x[i-1]*x[i-2]<y[j]*y[j+1]:
        x[i-1],x[i-2]=y[j],y[j+1]
        i-=2
        j+=2
    c=1
    for i in x:
        c=c*i%M
    print(c)
main()
N = int(input())
ans = 0
for i in range(1,N/2+1):
  if i != N-i:
    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1,N//2+1):
  if i != N-i:
    ans += 1
print(ans)
N,T=map(int,input().split())
k=1000
l=1
for i in range(N):
    c,t = int(input())
    if t[i] <= T:
        l=0
        if c[i] < k:
            k = c[i]
if l==1:
    print('TLE')
else:
    print(k)

### FIXED CODE ###

N,T=map(int,input().split())
k=1000
l=1
for i in range(N):
    c,t=map(int,input().split())
    if t <= T:
        l=0
        if c < k:
            k = c
if l==1:
    print('TLE')
else:
    print(k)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

if __name__ == "__main__":
    a = int(input())
    a = int(a)
    b = prime_factorize(a)
    print(b)
    c = len(b)
    if c==1:
        if b[0]<=9 and b[0]>=1:
            print('yes')
        else :
            print('no')
    elif c==2:
        if b[0]<=9 and b[0]>=1 and b[1]<=9 and b[1]>=1:
            print('yes')
        else :
            print('no')
    else :
        while len(b) > 2:
            b1 = b.pop(0)
            b2 = b.pop(0)
            b.append(b1*b2)
        print(b)
        if b[0]<=9 and b[0]>=1 and b[1]<=9 and b[1]>=1:
            print('yes')
        else :
            print('no')

### FIXED CODE ###

if __name__ == "__main__":
    a = int(input())
    a = int(a)
    flag=False
    for i in range(1, 10):
        for j in range(1, 10):
            if a == i*j:
                flag=True
                break
        if flag:
            break
            
    if flag==False :
        print('No')
    else :
        print('Yes')
azzel
apple

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    s = list(input())
    t = list(input())
    n = len(s)
    s_dict = defaultdict(int)
    t_dict = defaultdict(int)
    for i in range(n):
        s_dict[s[i]] += 1
        t_dict[t[i]] += 1

    #print(s_dict)
    #print(t_dict)

    if sorted(list(s_dict.values()))== sorted(list(t_dict.values())):
        print('Yes')
    else:
        print('No')
        

if  __name__=='__main__':
    main()
n, k = map(int,input().split())
S = input()
S[k-1] = S[k-1].lower
print(S)

### FIXED CODE ###

n, k = map(int,input().split())
S = input()
S = S[:k-1] + S[k-1].lower() + S[k:]
print(S)
N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) ans = 0
for i in range(N): d = min(A[i], B[i])
ans += d
A[i] -= d
B[i] -= d
d = min(A[i + 1], B[i])
ans += d
A[i + 1] -= d
B[i] -= d

print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
 
for i in range(N):
    k = B[i] - A[i]
    if k > 0:
        ans += A[i]
        A[i] = 0 
        if A[i+1] < k:
            ans += A[i+1]
            A[i+1] = 0
        else:
            ans += k
            A[i+1] -= k
    else:
        ans += B[i]
        A[i] =- k

print(ans)
import fractions

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

g_memo = {}

def my_gcd(i_list):
    global g_memo

    k = str(sorted(i_list))

    if k in g_memo.keys():
        return g_memo[k]

    if len(i_list) == 2:
        g_memo[k] = fractions.gcd(i_list[0], i_list[1])
        return g_memo[k]

    g_memo[k] = fractions.gcd(i_list[0], my_gcd(i_list[1:]))
    return g_memo[k]

if len(A) == 2:
    print(max(A))
else:
    max_gcd = 0
    for i in range(N):
        i_list = A[:i] + A[i+1:]
        gcd = my_gcd(i_list)
        if max_gcd < gcd:
            max_gcd = gcd

    print(max_gcd)

### FIXED CODE ###

from fractions import gcd

def main():
    N = int(input())
    A = list(map(int, input().split()))

    if len(A) == 2:
        print(max(A))
        return

    if len(A) == 3:
        gcd1 = gcd(A[0], A[1])
        gcd2 = gcd(A[0], A[2])
        gcd3 = gcd(A[1], A[2])
        print(max(gcd1, gcd2, gcd3))
        return

    gcd1 = gcd(A[0], A[1])
    gcd2 = gcd(A[0], A[2])
    gcd3 = gcd(A[1], A[2])
    yet_used_gcd = max(gcd1, gcd2, gcd3)
    not_used_gcd = gcd(gcd1, A[2])

    for i in range(3, N):
        yet_used_gcd = gcd(yet_used_gcd, A[i])
        if yet_used_gcd < not_used_gcd:
            yet_used_gcd = not_used_gcd
        not_used_gcd = gcd(not_used_gcd, A[i])

    if yet_used_gcd > not_used_gcd:
        print(yet_used_gcd)
    else:
        print(not_used_gcd)

main()
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[1000 for i in range(t)] for j in range(n-1)]
for i in range(t):
    for j in range(n):
        if j + 2**i > n-1:
            break
        kprv[j][i] = x[j+2**i] - x[j]

L = int(input())
q = int(input())

for _ in range(q):
    a , b = map(lambda x:int(x)-1,input().split())
    cou = 0
    if a > b:
        a , b = b , a
    now = a
    while now < b:
        cou += 1
        p = L
        while True:
            nex = bisect(kprv[now],p)
            if nex == 0:
                break
            else:
                p -= kprv[now][nex-1]
                now += 2**(nex-1)
    print(cou)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)  # 変更
from bisect import bisect_left,bisect

n = int(input())
x = list(map(int,input().split()))
L = int(input())
t = n.bit_length()
prv = [n-1] * n
for i in range(n):
    prv[i] = bisect(x,x[i]+L) - 1
kprv = [prv]
S = prv
for i in range(t-1):
    kar = [n-1] * n
    for j in range(n):
        kar[j] = S[S[j]]
    kprv.append(kar)
    S = kar

q = int(input())
for _ in range(q):
    a , b = map(lambda x:int(x)-1,input().split())
    if a > b:
        a , b = b , a
    lef = 0
    rig = n-1
    while rig - lef > 1:
        mid = (rig+lef)//2
        p = mid.bit_length()
        now = a
        for i in range(p):
            if (mid>>i) & 1 == 1:
                now = kprv[i][now]
        if now >= b:
            rig = mid
        elif now < b:
            lef = mid
    print(rig)
# coding: utf-8
import math
n, k = map(int, input().split())
if n % k
print(int(math.log(n, k)) + 1)


### FIXED CODE ###

# coding: utf-8
import math
n, k = map(int, input().split())
print(int(math.log(n, k)) + 1)
n,l=map(int,input().split())
taste_list=[]
for i in range(1,n+1):
    taste_list.append(l+i-1)
if taste_list[0]>0:
    print(taste-taste_list[0])
elif taste_list[0]<0:
    print(taste-taste_list[n-1])

### FIXED CODE ###

n,l=map(int,input().split())
taste_list=[]
for i in range(1,n+1):
    taste_list.append(l+i-1)
taste=sum(taste_list)
if taste_list[0]>0:
    print(taste-taste_list[0])
elif 0 in taste_list:
    print(taste)
else:
    print(taste-taste_list[n-1])
N = int(input())
graph = [[] for  _ in range(N)]
now = 0
for _ in range(N-1):
    x,y,w = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append((y,w))
    graph[y].append((x,w))
    now = x
    
vis = [0 for _ in range(N)]

even = set()
odd = set()

def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[1])
            else:
                odd.add(nv[1])
        else:
            if now in even:
                odd.add(nv[1])
            else:
                even.add(nv[1])
        vis[nv[0]] = 1
        dfs(nv[0])
vis[x] = 1
even.add(x)
dfs(x)

for i in range(N):
    if i in even:
        print(1)
    else:
        print(0)



### FIXED CODE ###

N = int(input())
graph = [[] for  _ in range(N)]
now = 0
for _ in range(N-1):
    x,y,w = map(int,input().split())
    x -= 1
    y -= 1
    graph[x].append((y,w))
    graph[y].append((x,w))
    now = x
    
vis = [0 for _ in range(N)]

even = set()
odd = set()
import sys
sys.setrecursionlimit(10000000)


def dfs(now):
    #print(now)
    for nv in graph[now]:
        if vis[nv[0]]: continue
        if nv[1] % 2 == 0:
            if now in even:
                even.add(nv[0])
            else:
                odd.add(nv[0])
        else:
            if now in even:
                odd.add(nv[0])
            else:
                even.add(nv[0])
        vis[nv[0]] = 1
        dfs(nv[0])
vis[x] = 1
even.add(x)
dfs(x)

for i in range(N):
    if i in even:
        print(1)
    else:
        print(0)
n, m = int(input()), 0
for i in range(1, **.5 + 1):
  if n%i == 0:
    m = max(m, i)
print(len(str(n // m)))

### FIXED CODE ###

n, m = int(input()), 0
for i in range(1, int(n**.5)+1):
    if not n%i:
        m = max(m, i)
print(len(str(n//m)))
import math
N, K = input().split()
print(math.floor(math.log(K) / math.log(N)) + 1)

### FIXED CODE ###

def base_changer(number,base):
    buff=97+abs(base-10)
    dic={};buff2='';buff3=10
    for i in range(97,buff+1):
        dic[buff3]=chr(i)
        buff3+=1   
    while(number>=base):
        mod=int(number%base)
        number=int(number//base)
        if (mod) in dic.keys():
            buff2+=dic[mod]
            continue
        buff2+=str(mod)
    if (number) in dic.keys():
        buff2+=dic[number]
    else:
        buff2+=str(number)

    return buff2[::-1]  
N,K = map(int, input().split())
print(len(base_changer(N,K)))
s=input()
print("Yes" if lens(set(s))==1 else "No")

### FIXED CODE ###

s=input()
print("Yes" if len(set(s))==2 else "No")
a,b,c,d = map(int,input().split())
from fractions import gcd

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

### FIXED CODE ###

a,b,c,d = map(int,input().split())
from fractions import gcd

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)
N = input()
if N <= 999:
  pirnt("ABC")
else:
  print("ABD")

### FIXED CODE ###

N = int(input())
if N <= 999:
  print("ABC")
else:
  print("ABD")