Harryxun/stf_run huggingface dataset:
s = input()
ans = 0
for i in N:
  for j in range(i+1,N):
    for k in range(j+1,N):
      if k<i+j and i!=j and j!=k:
        ans +=1

### FIXED CODE ###

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

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] != l[k]:
                if l[i] + l[j] > l[k]:
                    ans += 1
print(ans)
n=int(input())
s=input()
ans=0
for i in range(n):
  if s[i]='I':
    tmp=ans+1
  else:
    tmp=ans-1
  if tmp>ans:
    ans=tmp
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
res=0
ans=0
for i in range(n):
  if s[i]=='I':
    tmp=res+1
  else:
    tmp=res-1
  if tmp>ans:
    ans=tmp
  res=tmp
print(ans)
n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = 0
a = 0
res = 0

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)]

while(ans + max_score[a] <= g):
    ans += max_score[a]
    a += 1

for i in range(a):
    res += howmany[i]
    
rest = g - ans
x = -(-rest // score[a])
    
#print(max_score)
#print(score)
#print(howmany)
#print(res)
print(res + x)

### FIXED CODE ###

n, g = map(int, input().split())
List = [list(map(int, input().split())) for i in range(n)]

ans = []

max_score = [(i+1)*100*List[i][0]+List[i][1] for i in range(n-1, -1, -1)] #全て答えたときのスコアを算出(逆順)
score = [(i+1)*100 for i in range(n-1, -1, -1)] #各レベルの点数を算出しておく(逆順)
howmany = [List[i][0] for i in range(n-1, -1, -1)] #回数も逆順に出しておく

for i in range(2**n):
    s = 0
    m = 0
    max = 0 #残りの中で最も得点の単位が大きいもの
    for j in range(n):
        if((i >> j) & 1):
            max += 1
            s += max_score[j]
            m += howmany[j]
    if(s >= g):
        ans.append(m)
    else:
        if(max < n):
            rest = g - s
            k = -(-rest // score[max]) #最も得点の単位の高い問題を何問解くか
            if(k < howmany[max]):
                m += k
                ans.append(m)

print(min(ans))
A = int(input())
B = int(input())

Answer = [1, 2, 3]

remove.Answer(A)
remove.Answer(B)

print(Answer[0])

### FIXED CODE ###

A = int(input())
B = int(input())
 
Answer = [1, 2, 3]
 
Answer.remove(A)
Answer.remove(B)
 
print(Answer[0])
x,y = map(int,input().split())
z = int(str(x)+str(y))
for i in range(int(z**(1/2))+1):
  if i**2 = z:
    print("Yes")
    exit()
print("No")

### FIXED CODE ###

a,b=map(int,input().split())
c=int(str(a)+str(b))
for i in range(int(c**(1/2))+1) :
  if i**2==c :
    print("Yes")
    exit()
print("No")
a,b,c=input().spit()
if a[-1] ==b[0] and b[-1] ==c[0]:print("YES")
else:print("NO")

### FIXED CODE ###

a,b,c=input().split()
if a[-1] ==b[0] and b[-1] ==c[0]:print("YES")
else:print("NO")
s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print(Bad)
else:
  print(Good)

### FIXED CODE ###

s=input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")
A,B,N = map(int,input().split())
x = min(B-1,N)
print((A*x)//b - A*(x//b))


### FIXED CODE ###

A,B,N = map(int,input().split())
x = min(B-1,N)
print((A*x)//B-A*(x//B))
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
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():
    P=list(input())
    ct_a=0
    ct_s=0
    for x in P:
        if x=='A' :
            ct_a+=1
        elif x=='S':
            ct_s+=1
    if ct_a==2 an ct_s==2:
        print('Yes')
    else:
        print('No')




if  __name__=='__main__':
    main()


### 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
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=set(s)
    if len(t)==2:
        print('Yes')
    else:
        print('No')


if  __name__=='__main__':
    main()
N = int(input())
ls = list(map(int, input().split())

print(max(ls) - min(ls))

### FIXED CODE ###

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

print(max(ls) - min(ls))
from collections import deque

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(n):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)
q = deque([1])
while q:
    now = q.popleft()
    visit[now] = 1
    for i in graph[now]:
        if visit[i] == 0:
            q.append(i)


def dfs(now, count, seen):
    global ans
    if count == depth:
        ans += 1
    else:
        for i in graph[now]:
            if seen[i] == 0:
                seen[now] = 1
                dfs(i, count + 1, seen)
                seen[now] = 0


depth = sum(visit)
ans = 0
seen = [0] * (n + 1)
dfs(1, 1, seen)
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)


def dfs(now, depth):
    if visit[now]:
        return 0
    if depth == n:
        return 1

    count = 0
    visit[now] = 1
    if graph[now]:
        for i in graph[now]:
            count += dfs(i, depth + 1)
    visit[now] = 0

    return count


ans = dfs(1, 1)
print(ans)
H,W=map(int,input().split())
S=list(list(input())for _ in range(H))

def dfsr(h,w):
    if 0<=h<=H-1 and 0<=w<=W-1 and S[h][w]=='.':
        global ans
        ans+=1
        dfsr(h,w+1)
    else:return
def dfsl(h,w):
    if 0<=h<=H-1 and 0<=w<=W-1 and S[h][w]=='.':
        global ans
        ans+=1
        dfsl(h,w-1)
    else:return

def dfsd(h,w):
    if 0<=h<=H-1 and 0<=w<=W-1 and S[h][w]=='.':
        global ans
        ans+=1
        dfsd(h+1,w)
    else:return

def dfsu(h,w):
    if 0<=h<=H-1 and 0<=w<=W-1 and S[h][w]=='.':
        global ans
        ans+=1
        dfsu(h-1,w)
    else:return

rans=0
ans=0
for h in range(H):
    for w in range(W):
        ans=0
        if S[h][w]=='.':
            dfsr(h,w+1)
            dfsl(h,w-1)
            dfsu(h-1,w)
            dfsd(h+1,w)
            ans+=1
            rans=max(ans,rans)
print(rans)

### FIXED CODE ###

H,W=map(int,input().split())
S=list(list(input()) for _ in range(H))
ans=0
for i in S:
    for j in range(W):
        if i[j]!='#' and j!=W-1:
            ans+=1
        elif i[j]!='#'and j==W-1 :
            for k in range(ans+1):
                i[j-k]=ans+1
            ans=0
        else:
            for k in range(1,ans+1):
                i[j-k]=ans
            ans=0
S_t=list(map(list,zip(*S)))
ans=0
for i in S_t:
    for j in range(H):
        if i[j]!='#' and j!=H-1:
            ans+=1
        elif i[j]!='#'and j==H-1 :
            for k in range(ans+1):
                i[j-k]+=ans+1
            ans=0
        else:
            for k in range(1,ans+1):
                i[j-k]+=ans
            ans=0
            i[j]=0
c=0
for i in S_t:
    c=max(c,max(i))
print(c-1)
import math
import copy
from copy import deepcopy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics
import heapq

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

n = getInputInt()
data = getInputListInt()
l = len(data)

ans = []

for i in range(l-1, -1, -1):
    cnt = 0
    for j in ans:
        if j % (i+1) == 0:
            cnt += 1
    if data[i] != cnt % 2:
        ans.append(i+1)

if len(ans) == 0:
    print(0)
else:
    print(len(ans))
    print(*ans, sep=" ")




### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    b = [0 for i in range(n)]
    ans = []

    for i in range(n // 2, n):
        if a[i] == 1:
            b[i] = a[i]
            ans.append(i + 1)

    for i in range(n // 2 - 1, -1, -1):
        cnt = 0
        for j in range(i * 2 + 1, n, i + 1):
            cnt ^= b[j]
        if cnt != a[i]:
            b[i] = 1
            ans.append(i + 1)

    tmp = len(ans)
    print(tmp)
    if tmp > 0:
        print(*ans, sep=" ")


if __name__ == '__main__':
    main()
from copy import deepcopy
string_in = input("input : ")
check_str = "hi"

max_count = string_in.count(check_str)
check_obj = ["hi"*i for i in range(1,max_count+1)][::-1]
string_in4 = deepcopy(string_in)
count = 0
for i in range(len(check_obj)):
  i_str = str(check_obj[i])
  string_in4 = string_in4.replace(i_str, '%d'%(i))
  count += string_in4.count('%d'%(i))

  if count==0:
    print("No")
    else:
      print("Yes")

### FIXED CODE ###


string_in = input()
n_str = len(string_in)
string_in = string_in.replace("hi", '%d'%(1))
if n_str == string_in.count('%d'%(1))*2:
  print("Yes")
else:
  print("No")
N = int(input())
a = list(map(int, input().split()))

ave = sum(a) / N

aa =[abs(a[i] - ave) for i in range(N)]

x = min(aa)

print(aa.find(x))

### FIXED CODE ###

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

ave = sum(a) / N

aa =[abs(a[i] - ave) for i in range(N)]

x = min(aa)

print(aa.index(x))
def gcd(a, b):
	if(a > b):
		a -= b
		return gcd(a, b)
	elif(a < b):
		b -= a
		return gcd(a, b)
	else:
		return a

import numpy as np
n, x = map(int, input().split())
a = np.abs(np.array(list(map(int, input().split())))-x)

if(a.shape[0] == 1):
	r = a[0]
else:
	r = gcd(a[0], a[1])
	for i in range(n-2):
		r = gcd(r, a[i+2])
print(r)

### FIXED CODE ###

def gcd(a, b):
	if(a < b):
		a, b = b, a
	if(b == 0):
		return a
	else:
		return gcd(b, a % b)

import numpy as np
n, x = map(int, input().split())
a = np.abs(np.array(list(map(int, input().split())))-x)

if(a.shape[0] == 1):
	r = a[0]
else:
	r = gcd(a[0], a[1])
	for i in range(n-2):
		r = gcd(r, a[i+2])
print(r)
import bisect as bi

if __name__ == '__main__':

	x,n = map(int,input().split())
	A = list(map(int,input().split()))
	B = [i for i in range(101)]
	
	#差分を求める
	C = list(set(B) - set(A))
	
	#二分探索自身の位置を調べる
	ind = bi.bisect_left(C,x)

	if ind == 0:
		print(C[0])
	elif ind == x - n:
		print(C[ind])
	else:
		tmp_l = abs(C[ind-1] - x)
		tmp_r = abs(C[ind] - x)
		if tmp_l > tmp_r:
			print(C[ind])
		else:
			print(C[ind-1])



### FIXED CODE ###

import bisect as bi

if __name__ == '__main__':

    x,n = map(int,input().split())
    A = list(map(int,input().split()))
    B = [i for i in range(102)]
    
    #差分を求める
    C = list(set(B) - set(A))

    #二分探索自身の位置を調べる
    ind = bi.bisect_left(C,x)

    if ind == 0:
        print(C[0])
    elif ind == x - n:
        print(C[ind])
    else:
        tmp_l = abs(C[ind-1] - x)
        tmp_r = abs(C[ind] - x)
        if tmp_l > tmp_r:
            print(C[ind])
        else:
            print(C[ind-1])
from heapq import heappop,heapify
n,k=map(int,input().split())
q=[-int(i) for i in input().split()]
heapify(q)
for i in range(k):
  x=heappop(q)
print(-sum(q))

### FIXED CODE ###

n,k=map(int,input().split())
q=[int(i) for i in input().split()]
q.sort(reverse=True)
print(sum(q[k:]))
input_a = input()
input_b = input()
	
print input_a*input_b," ",2*input_a+2*input_b

### FIXED CODE ###

n, m = map(int, raw_input().split())
print n*m, 2*n+2*m
import numpy as np
N, W = map(int, input().split(" "))

dp = np.zeros(W+1,dtype=int)
for i in range(N):
    w,v = map(int, input().split(" "))
    dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(int(dp[-1]))

### FIXED CODE ###

import numpy as np
INF = 10 ** 12

N, W = map(int, input().split(" "))
wv = np.array([[int(i) for i in input().split(" ")] for _ in range(N)])

sumv = np.sum(wv[:,1])

dp = np.zeros((N + 1, sumv + 1), dtype=np.int64)
dp[0][1:] = INF

for i in range(N):
    dp[i+1][:wv[i][1]] = dp[i][:wv[i][1]]
    dp[i+1][wv[i][1]:] = np.minimum(dp[i][wv[i][1]:], dp[i][:-wv[i][1]]+wv[i][0])

ans = 0
for v, w in enumerate(dp[N]):
    if w <= W:
        ans = max(v, ans)

print(ans)
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力の取得
A, B, C, D = list(map(int, input().split()))


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


# 求解処理
div_C = (B // C) - ((A - 1) // C)
div_D = (B // D) - ((A - 1) // D)
lcm_CD = lcm(C, D)
div_lcm_CD = (B // lcm_CD) - ((A - 1) // lcm_CD)
result = (B - A + 1) - div_C - div_D + div_lcm_CD

# 結果出力
print(result)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# モジュールのインポート
from fractions import gcd

# 標準入力の取得
A, B, C, D = list(map(int, input().split()))


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


# 求解処理
div_C = (B // C) - ((A - 1) // C)
div_D = (B // D) - ((A - 1) // D)
lcm_CD = lcm(C, D)
div_lcm_CD = (B // lcm_CD) - ((A - 1) // lcm_CD)
result = (B - A + 1) - div_C - div_D + div_lcm_CD

# 結果出力
print(result)
N=int(input())
f=[]
for i in range(1,(N+1)//2):
    if N%i==0:
        f.append(max(len(str(i)),len(str(N//i))))
print(min(f))

### FIXED CODE ###

N=int(input())
ans=float('inf')

for i in range(1,int(N**0.5+1)):
    if N%i==0:
        ans=min(ans,len(str(N//i)))
print(ans)
S = input()
print(500 + 100*S.count(o))

### FIXED CODE ###

S = input()
print(700 + 100*S.count('o'))
N=int(input())
P=list(map(int,input().split()))
s=0
for i in range(N):
  if P[i]<=min(P[0:i]):
    s+=1
print(s)
  

### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
s=1
m=P[0]
for i in range(1,N):
  if P[i]<=m:
    m=P[i]
    s+=1
print(s)
def debug(arg):
    if __debug__:
        pass
    else:
        import sys
        print(arg, file=sys.stderr)



k = (int(x) for x in input().split())

n = 3
c = {} 
t = 0
for x in range(k, 0, -1):
    c[x] = (k // x) ** n
    c[x] = c[x] - sum(c[x * y] for y in range(2, k // x + 1))
    s = c[x] * x
    t += s
    # t = t % 1000000007

print(t)

### FIXED CODE ###

import itertools
import math

n = int(input())
c1 = range(1, n + 1)
c2 = itertools.combinations(range(1, n + 1), 2)
c3 = itertools.combinations(range(1, n + 1), 3)

t1 = sum(list(c1))
t2 = sum(list(map(lambda x: math.gcd(x[0], x[1]), c2))) * 6
t3 = sum(list(map(lambda x: math.gcd(x[0], math.gcd(x[1], x[2])), c3))) * 6

print(sum([t1, t2, t3]))
a,b,c = map(int,input().split())

if a==b and b!=c:
  print("Yes")
elif c==b! and b=a:
  print("Yes")
elif a!=b and b==c:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

if a==b and b==c:
  print("No")
elif a==b or b==c or c==a :
  print("Yes")
  
else:
  print("No")
c = input()
a, b = (int, c.split())

if a > b:
print("a > b")
elif a < b:
print("b>a")
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")
print(1/int(input))

### FIXED CODE ###

ans = int(input())
if ans == 1: print(ans)
elif ans % 2 == 1:
    print( (int(ans/2)+1)/ans )
elif ans % 2 ==0:
    print((int(ans/2))/ans)
N = int(input())
nokori = N
kaburi = set()
ans = 0
A = list(map(int,input().rstrip().split(" ")))
A2 = set()
rem = set()
for i in A:
    if i in A2:
        kaburi.add(i)
    else:
        A2.add(i)
for i in kaburi:
    A2.remove(i)
for i in kaburi:
    k = i
    for i2 in A2:
        if i2 % k == 0:
            rem.add(i2)
    for i2 in rem:
        A2.remove(rem)
    rem.clear()
while len(A2) != 0:
    i = min(A2)
    ans += 1
    for i2 in A2:
        if i2 % i == 0:
            rem.add(i2)
    for i2 in rem:
        A2.remove(i2)
    rem.clear()
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
A = list(map(int,input().rstrip().split(" ")))
A.sort()
A2 = [True for i in range(A[-1] + 1)]
for i in range(len(A)):
    k = A[i] * 2
    if A2[A[i]]:
        if i != 0 and A[i-1] == A[i]:
            A2[A[i]] = False
        while(k < len(A2)):
            A2[k] = False
            k += A[i]
for i in A:
    if A2[i]:
        ans += 1
print(ans)
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    grid.append(array)
list_N = list(range(1,N+1))
grid.sort()
a = 0
count = 0
for j in range(N) :
  list_a = list(range(grid[j][0]-grid[j][1]+1, grid[j][0]+grid[j][1]-1))
  list_b = list(set(list_a) - set(list_N))
  if list_b == []:
    list_N = list(set(list_N) - set(list_a))
    count += 0
  else:
    count += 1
print(N - count)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())
a = max(h,w)
b = a
count = 0
if h*w == n:
  print(h)
elif b >= n:
  print(1)
else:
 while b*count < n:
   count += 1
 print(count)
from math import gcd
a = list(map(int,input().split()))

def fun(x,c,d):
    return x - div(x,c) - div(x,d) + div(x,c*d//gcd(c,d))

def div(a,b):
    return a // b

print(fun(a[1],a[2],a[3])-fun(a[0]-1,a[2],a[3]))

### FIXED CODE ###

from fractions import gcd
a = list(map(int,input().split()))

def fun(x,c,d):
    return x - div(x,c) - div(x,d) + div(x,c*d//gcd(c,d))

def div(a,b):
    return a // b

print(fun(a[1],a[2],a[3])-fun(a[0]-1,a[2],a[3]))
INT_MAX = 10**8
h, n = map(int, input().split())
e = tuple(tuple(map(int, input().split())))

dp = [0] + [INT_MAX]* h
for i in range(1, h+1):
  v = INT_MAX
  for a, b in e:
    c = dp[max(0, i - a)] + b
    v = min(v, c)
  dp[i] = v
print(dp[h])

### FIXED CODE ###

INT_MAX = 10**8
h, n = map(int, input().split())
e = tuple(tuple(map(int, input().split())) for _ in range(n))

dp = [INT_MAX] * (h+1)
dp[0] = 0
for i in range(1, h+1):
  for a, b in e:
    c = dp[max(0, i - a)] + b
    dp[i] = min(dp[i], c)

print(dp[h])
import functools, sys


@functools.lru_cache(maxsize=None)
def rec(c):
    if c == 0:
        return 0
    ret = INF
    for coin in coins:
        if c - coin >= 0:
            ret = min(ret, rec(c-coin) + 1)
    return ret

INF = 10**6
N, M = map(int, input().split())
coins = [int(x) for x in input().split()]
sys.setrecursionlimit(INF)
print(rec(N))

### FIXED CODE ###

n, m = map(int, input().split())
C = list(map(int, input().split()))
INF = 10**5
dp = [INF for _ in range(n+1)]
dp[0] = 0
for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1)
print(dp[n])
n, k = map(int, input().split())
mod = 10**9+7
mina = [0]*(n-k+2)
maxa = [0]*(n-k+2)
mina[0] = (k-1)*k//2
for i in range(k):
    maxa[0] += n-i
for i in range(1, n-k+2):
    mina[i] = mina[i-1]+i+k-1
    maxa[i] = maxa[i-1]+(n-k-i+1)
    if mina[i-k+1]>=mod and maxa[i-k+1]>=mod:
        mina[i-k+1] %= mod
        maxa[i-k+1] %= mod
ans = 0
for i in range(n-k+2):
    ans += maxa[i]-mina[i]+1
    ans %= mod
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
mod = 10**9+7
mina = [0]*(n-k+2)
maxa = [0]*(n-k+2)
mina[0] = (k-1)*k//2
for i in range(k):
    maxa[0] += n-i
for i in range(1, n-k+2):
    mina[i] = mina[i-1]+i+k-1
    maxa[i] = maxa[i-1]+(n-k-i+1)
    if mina[i]>=mod and maxa[i]>=mod:
        mina[i] %= mod
        maxa[i] %= mod
ans = 0
for i in range(n-k+2):
    ans += maxa[i]-mina[i]+1
    ans %= mod
print(ans%mod)
n=int(input())
dat=list(map(int, input().split()))

for e in dat:
       e = bin(e)[2:]
       e = list(e).reverse()
       e = "".join(e)
re = []

for e in dat:
      
      try:
          w=e.index('1')
          re.append(w)
      except Exception:
          re.append(0)

print(min(re))

### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
roadcnt,money = (int(n) for n in input().split(" "))
while True:
    road = []
    for r in range(roadcnt):
        road.append([int(n) for n in input().split(" ")])
    road = sorted(road,key=lambda x:x[1])
    while money > 0:
        if road[-1][0] - money < 0:
            money -= road[-1][0]
            road.pop()
        else:
            road[-1][0] -= money
            break
    ans = 0
    for ro in road:
        ans += ro[0] * ro[1]
    print(ans)
    roadcnt,money = (int(n) for n in input().split(" "))
    if roadcnt == 0 and money == 0:
        break

### FIXED CODE ###

roadcnt,money = (int(n) for n in input().split(" "))
while True:
    road = []
    for r in range(roadcnt):
        road.append([int(n) for n in input().split(" ")])
    road = sorted(road,key=lambda x:x[1])
    while money > 0 and len(road) > 0:
        if road[-1][0] - money < 0:
            money -= road[-1][0]
            road.pop()
        else:
            road[-1][0] -= money
            break
    ans = 0
    for ro in road:
        ans += ro[0] * ro[1]
    print(ans)
    roadcnt,money = (int(n) for n in input().split(" "))
    if roadcnt == 0 and money == 0:
        break