Harryxun/stf_run huggingface dataset:
N, x = map(int, input())
child_list = list(map(int, input()))

nokori = x - min(child_list)
please_child = 0 
while nokori >=0:
    please_child +=1
    mini = min(child_list)
    child_list.remove(mini)
    if child_list == []:
        break
    nokori -= min(child_list)
print(please_child)

### FIXED CODE ###

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

if len(child_list) == 1:
    if x > min(child_list):
        please_child = 0
    elif x == min(child_list):
        please_child = 1
elif len(child_list) > 1:
    nokori = x - min(child_list)
    please_child = 0 
    while nokori >=0:
        please_child +=1
        mini = min(child_list)
        child_list.remove(mini)
        if child_list == []:
            break
        if len(child_list) == 1:
            if nokori == min(child_list):
                please_child += 1
            if nokori > min(child_list):
                break
            else:
            	break
        else:    
            nokori -= min(child_list)
print(please_child)
l = map(int, input().split())
S = l[0] * l[1]
L = 2 * (l[0] + l[1])
 
print(S, L)


### FIXED CODE ###

l = input().split()
a, b = int(l[0]), int(l[1])
print(a * b, 2 * (a + b))
s=input()
t=input()

d={}
for i in range(len(s)):
  if s[i]!=t[i]:
    if s[i] in d:
      if d[s[i]]!=t[i]
        print('No')
        exit()
      else:
       pass
    else:
      d[s[i]]=t[i]
  else:
    if s[i] in d and d[s[i]]!=t[i]:
      print('No')
      exit()
print('Yes')

### FIXED CODE ###

from collections import Counter
s=input()
t=input()
c1=Counter(s)
c2=Counter(t)
if sorted(c1.values())==sorted(c2.values()):
    print('Yes')
else:
    print('No')
n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
cal=lambda x:(1+x)/2
a=list(map(cal,a))
#print(a)
now=sum(a[:k])
#print(now)
d=a[0]
for i in range(1,n-k+1):
    #print(i)
    tmp=now-d+a[i+k-1]
    ans=max(now,tmp)
    d=a[i]
    now=tmp
    #print(now)
    #print()
print(ans)

### FIXED CODE ###

n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
cal=lambda x:(1+x)/2
a=list(map(cal,a))
#print(a)
now=sum(a[:k])
ans=now
#print(now)
d=a[0]
for i in range(1,n-k+1):
    #print(i)
    tmp=now-d+a[i+k-1]
    ans=max(ans,tmp)
    d=a[i]
    now=tmp
    #print(now)
    #print()
print(ans)
a,b = map(int,raw_input().split())
print(max(a+b,a-b,a*b))


### FIXED CODE ###

a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
n = int(input())
sum = 0
discount = 0
for _ in range(n):
  p = int(input())
  sum += p
  discount = max(discount, p // 2)

print(max - discount)


### FIXED CODE ###

n = int(input())
ans = 0
d = 0
for _ in range(n):
    p = int(input())
    ans += p
    d = max(d, p // 2)

print(ans - d)
n = int(input())
for i in range(0, n) :
  a, b = list(map(int, input().split()))
  sum = a + b
  if str(sum).length() > 80 :
    print("overflow")
  else :
    print(sum)

### FIXED CODE ###

n = int(input())
for i in range(0, n) :
  a = int(input())
  b = int(input())
  sum = a + b
  if len(str(sum)) > 80 :
    print("overflow")
  else :
    print(sum)
q=int(input())
l=[0]
c=0
def prime(n):
  if n==2:
    return True
  elif n==1:
    return False
  else:
    return pow(2,n-1,n)==1
for i in range(1,100001):
  if prime(n)==True and prime((n+1)//2)=True:
    c+=1
  l.append(c)
for i in range(q):
  a,b=map(int,input().split())
  print(l[b]-l[a-1])
  
  

### FIXED CODE ###

def prime(n):
  if n==1:
    return False
  elif n==2:
    return True
  else:
    for i in range(2,int((n)**(1/2))+1):
      if n%i==0:
        return False
    return True
list=[True]*100001
for i in range(1,100001):
  if not prime(i):
    list[i]=False
list1=[0]
count=0
for i in range(1,100001):
  if i%2==1:
    if list[i] and list[(i+1)//2]:
      count+=1
  list1.append(count)
n=int(input())
for i in range(n):
  a,b=map(int,input().split())
  print(list1[b]-list1[a-1])
s = str(input())
t = s.replace("2017","2018")
pirnt(t)


### FIXED CODE ###

s = str(input())
t = s.replace("2017","2018")
print(t)
n,m = map(int,input().split())
numList = list(map(int,input().split()))

for i in numList:
	sum += i

for _ in numList:
  if _ > sum/(4*m):
    continue
  else:
    print("No")
    exit
    
print("Yes")

### FIXED CODE ###

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

sum = 0

for i in Ai:
	sum += i

S = sorted(Ai,reverse=True)

if S[m-1] >= sum/(4*m):
  print("Yes")
else:
  print("No")
n, m = int(input())
a = [list(map(int, input().split())) for i in range(n)]

x = [True] * m

for i in a:
    y = i[0]
    xx = [False] * m
    for j in range(y):
        x[i[j + 1]] = True
    for j in range(m):
        if xx[j] == False:
            x[j] = False

print(sum(x))

### FIXED CODE ###

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

S = set(range(1, m + 1))

for i in range(n):
    K, *a = map(int, input().split())
    S = S & set(a)

print(len(S))
a, b, c = list(map(int, input().split()))
if a-b = b-c:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a, b, c = list(map(int, input().split()))
if a-b == b-c:
  print('YES')
else:
  print('NO')
A = list(map(int , input().split()))
B = list(map(int , input().split()))
ki = [1+(0.5*(i-1)) for i in B]
print(max([sum(ki[i:i+A[1]]) for i in range(0,len(ki)-A[1])]))

### FIXED CODE ###

A = list(map(int , input().split()))
B = list(map(int , input().split()))
kitaiti =[(i+1)/2 for i in B]
ans = []
dd = [0]
for i in range(A[0]):
    dd.append(dd[i] + kitaiti[i])
for i in range(A[1] , A[0]+1):
    ans.append(dd[i] - dd[i - A[1]])
print(max(ans))
X, Y = map(int, input().split())
2 ans = 'No'
3 for a in range(X + 1):
4 b = X - a
5 if 2 * a + 4 * b == Y:
6 ans = 'Yes'
7 print(ans)


### FIXED CODE ###

input = input()
 
nums = input.split(" ")
 
animals = int(nums[0])
legs = int(nums[1])
 
turu = (4*animals -legs)/2.0
kame = (legs-2*animals)/2.0
 
if turu.is_integer() and kame.is_integer() and turu>=0 and kame>=0:
    print("Yes")
else:
    print("No")
n,sin=map(int,input().split(' '))
while n>=sin:
    ls.append(n%sin)
    n=n//sin
ls.append(n)
print(len(ls))

### FIXED CODE ###

n,sin=map(int,input().split(' '))
ls=[]
while n>=sin:
    ls.append(n%sin)
    n=n//sin
ls.append(n)

print(len(ls))
a, b = int(input())

if(a > b);
    print('a > b')

if(a < b);
    print('a < b')

if(a == b);
    print('a == b')
    


### FIXED CODE ###

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

if a > b:
    print('a > b')
elif a < b:
    print('a < b')
else:
    print('a == b')
S = input()
Q = int(input())

ans = S
flag = 1
for i in range(Q):
    qry = list(input().split())

    if qry[0] == '1' and flag:
        flag = 0
    elif qry[0] == '1' and not flag:
        flag = 1

    elif qry[0] == '2' and flag:
        if qry[1] == '1':
            ans = qry[2] + ans
        elif qry[1] == '2':
            ans += qry[2]
    elif qry[0] == '2' and not flag:
        if qry[1] == '1':
            ans += qry[2]
        elif qry[1] == '2':
            ans = qry[2] + ans

if flag:
    print(ans)
else:
    for i in range(len(ans)//2):
        ans[i], ans[-1-i] = ans[-1-i], ans[i]

    print(ans)

### FIXED CODE ###

from collections import deque

S = deque(input())
Q = int(input())

flag = 1
for i in range(Q):
    qry = input().split()

    if qry[0] == '1':
        if flag:
            flag = 0
        else:
            flag = 1
    
    elif qry[0] == '2':
        if flag:
            if qry[1] == '1':
                S.appendleft(qry[2])
            else:
                S.append(qry[2])
        else:
            if qry[1] == '1':
                S.append(qry[2])
            else:
                S.appendleft(qry[2])

S = ''.join(S)

if flag:
    print(S)
else:
    print(S[::-1])
S=input()
al=[chr(ord('a') + i) for i in range(26)]
ss=set(al)

for str in S:
  if str in ss:
    ss.remove(str)

print(sorted(ss)[0])

### FIXED CODE ###

S=input()
al=[chr(ord('a') + i) for i in range(26)]
ss=set(al)

for str in S:
  if str in ss:
    ss.remove(str)

if len(ss)>0:
  print(sorted(ss)[0])
else:
  print("None")
import math
a,b,h,m=map(int,input().split())
m_=6*m
h_=30*h
if h>6:
    h_op=h-6
elif h<6:
    h_op=h+6
else:
    h_op=12
if m/5<h_op and m/5>h:
    radians=m_-h_
elif m/5<h_op and m/5<h:
    radians=m_-h_+360
elif m/5>h_op and m/5>h:
    radians=h_-m_+360
elif m/5>h_op and m/5<h:
    radians=h_-m_
degree=math.radians(radians)
out=math.sqrt(pow(a,2)+pow(b,2)-2*a*b*math.cos(degree))
print(out)

### FIXED CODE ###

import math
tempList = tuple(map(int, input().split()))
a = tempList[0]
b = tempList[1]
hour = tempList[2]
minute = tempList[3]
time = hour * 60 + minute
mypi = math.pi
hourAngle = time/(12*60)
minuteAngle = minute/60
diff = abs(hourAngle - minuteAngle)
if diff > 0.5:
    diff = 1 - diff
angle = diff * mypi * 2
result = a*a + b*b - 2*a*b*math.cos(angle)
print(math.sqrt(result))
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    r = 0

    if a[-1] > t[-1] or a[0] < t[0]:
        return 0

    for i in range(1,n):
        if m > a[i]:
            m = a[i]
        if (t[i-1] < t[i] and t[i] > m) or t[i] < t[i-1]:
            return 0
    for i in range(n-2,-1,-1):
        if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
            return 0

    r = 1
    for i in range(1,n-1):
        if t[i] != t[i-1] or a[i] != a[i+1]:
            continue
        if t[i] < a[i]:
            r = r * t[i] % mod
        else:
            r = r * a[i] % mod

    return r


print(f())


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def f():
    n = int(input())
    t = list(map(int, input().split()))
    a = list(map(int, input().split()))
    r = 0

    if a[-1] > t[-1] or a[0] < t[0]:
        return 0

    for i in range(1,n):
        if (t[i-1] < t[i] and t[i] > a[i]) or t[i] < t[i-1]:
            return 0

    for i in range(n-2,-1,-1):
        if (a[i+1] < a[i] and a[i] > t[i]) or a[i] < a[i+1]:
            return 0

    r = 1
    for i in range(1,n-1):
        if t[i] != t[i-1] or a[i] != a[i+1]:
            continue
        if t[i] < a[i]:
            r = r * t[i] % mod
        else:
            r = r * a[i] % mod

    return r


print(f())
n = int(input())
w = input().split(" ")

a = []
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
       a[i] *= -1
       k = not(k)
    if i == 1:
        min = a[i]
    if a[i] < min:
        min = a[i]
2
sum = sum(a)
if k:
    sum -= min
print(sum)

### FIXED CODE ###

n = int(input())
w = input().split(" ")

a = []
m = 0
k = False
for i in range(n):
    a.append(int(w[i]))
    if a[i] < 0:
        a[i] *= -1
        k = not (k)
    if i == 0:
        m = a[i]
    if a[i] < m:
        m = a[i]

sum = sum(a)
if k:
    sum -= m*2
print(sum)
X, K, D = map(int, input().split())
if X == 0:
  if (K % 2 == 0):
    a = 0
  else:
    a = D
else:
  if X < 0:
    X = -X
  s = int(X/D)
  if K <= s:
    a = X - K * D
  else:
    if (K - s) % 2 == 1:
      a = abs(X - (s + 1) * D)
    else:
      a = abs(X - s * D)
print(a)

### FIXED CODE ###

S = str(input())
a = 0
w = 0
for i in range(len(S)):
    if S[i] == 'R':
        w = w + 1
    else:
        if (w > a):
          a = w
        w = 0
if (w > a):
  a = w
print(a)
A,B,M=map(int,input().split())

al=[]
a=input().split()
for i in a:
    al.append(int(i))
bl = []
b=input().split()
for i in b:
    bl.append(int(i))
l=[]
cl=[]
for i in range(M):
    c = input().split()
    for i in c:
        l.append(int(i))
    cl.append(l)

l=[]
for cl in cl:
    a=0
    a=al[cl[0]]+bl[cl[1]]-cl[2]
    l.append(a)

print(a)
        
    

### FIXED CODE ###

A,B,M=map(int,input().split())

al=[]
a=input().split()
for i in a:
    al.append(int(i))
bl = []
b=input().split()
for i in b:
    bl.append(int(i))

cl=[]
for i in range(M):
    l=[]
    c = input().split()
    for i in c:
        l.append(int(i))
    cl.append(l)
    
l=[]
for i in cl:
    a=0
    a=al[i[0]-1]+bl[i[1]-1]-i[2]
    l.append(a)

Min=min(al) + min(bl)
if min(l) < Min:
    print(min(l))
else:
    print(Min)
import numpy as np

N = int(input())
a = [input() for _ in range(H)]

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == np.max(counts_elements)]
for i in elements:
    print(i)


### FIXED CODE ###

import numpy as np

N = int(input())
a = [input() for _ in range(N)]

a = np.sort(np.array(a))

unique_elements, index_elements = np.unique(a, return_index = True)
l = []
for i in range(index_elements.size -1):
  m = index_elements[i + 1] - index_elements[i]
  l.append(m)
l.append(a.size - index_elements[-1])    
elements = unique_elements[l == max(l)]


for i in elements:
	print(i)
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

if n==1:
  x=a[0]
else:
  x=gcd(a[0],a[1])
  for i in range(2,n):
    x=gcd(x,a[i])

if max(a)>=k and k%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

if n==1:
  x=a[0]
else:
  x=gcd(a[0],a[1])
  for i in range(2,n):
    x=gcd(x,a[i])

if max(a)>=k and k%x==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
A, B = map(int, raw_input().split(' '))

if (A * B) % 2 == 0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

A, B = map(int, input().split())
x = A * B
if x % 2 == 0:
    print('No')
else:
    print('Yes')
N,K = map(int,list(input().replace(" ","")))
if K > N//2:
  print("NO")
else:
  print("YES")

### FIXED CODE ###

from sys import stdin
N,K=[int(x) for x in stdin.readline().rstrip().split()]
if K == 1:
    print("YES")
else:
    if N+1-(K*2) >=0:
        print("YES")
    else:
        print("NO")
mod = 10 ** 9 + 7
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N-K+1):
    now_A = A[i]
    tmp = 1
    count = 1
    for k in range(i+K-1, N):
        ans += (A[k] - now_A) * tmp
        ans %= mod
        tmp *= (K - 2 + count) / count
        tmp = int(tmp)
        count += 1
        ##print(ans, tmp, count)

print(ans)

### FIXED CODE ###

# 組み合わせ(高速，フェルマーの小定理を利用)
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 = 10**9+7 #出力の制限
N = 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 )

mod = 10 ** 9 + 7
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ans_max = 0
ans_min = 0
# ans_minを求める
for i in range(N-K+1):
    ans_min += A[i] * cmb(N-1-i, K-1, mod)
    ans_min %= mod
for i in range(K-1, N):
    ans_max += A[i] * cmb(i, K-1, mod)
    ans_max %= mod
##print(ans_max, ans_min)
print((ans_max - ans_min + mod)%mod)
n, k = map(int, input().split())
a = list(map(int, input().split()))

zyun = [a[0]]
alr = [False]*n
alr[0] = True
crr = a[0]

key = True

while key:
    if not alr[crr - 1]:
        alr[crr - 1] = True
        crr = a[crr - 1]
        zyun.append(crr)
        continue
    else:
        index1 = crr
        key = False

p = zyun[index1]
# print(zyun, p, zyun.index(p))

if zyun.index(p) - 1 == 0:
    zyun1 = zyun
    zyun2 = zyun
else:
    zyun1 = zyun[:zyun.index(p)]
    zyun2 = zyun[zyun.index(p):]

# print(zyun1, zyun2)

if len(zyun1) >= k:
    print(zyun1[k])
else:
    ind = (k - len(zyun1)) % len(zyun2)
    if ind == 0:
        print(zyun2[-1])
    else:
        print(zyun2[ind - 1])

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(n) - 1 for n in input().split()]  # indexに合うように調整する
v = [-1] * n  # 到達してるかどうかを格納するリスト

D = [0]  # Dは循環するもののindexを格納する
v[0] = 0  # 初期スタート位置の到達ステータスは0

cur = a[0]  # 初期位置はindex=0
i = 1

while v[cur] == -1:
    D.append(cur)
    v[cur] = i # 到達済みに変更(iは何番目に到達したか）
    if k == i:  # 循環が発生する前にkの上限に達してしまった場合
        print(cur + 1)
        exit()

    i += 1
    cur = a[cur]

# 循環している場合を考える
k -= v[cur]  # 1回目の到達点を引く
k %= (i - v[cur])  # kを循環する回数で割った余りを考える = 循環した中でどれかという事が分かる

print(D[v[cur] + k] + 1)  # v[cur]で循環しない部分を表し、kで循環した中でどこかを表す
from itertools import combinations
from bisect import bisect_left
N, K = map(int,input().split())
A = list(map(int,input().split()))

ans=0

for i,j in combinations(range(N+2),2):
  l = sorted(A[0:i]+A[j-1:N])
  if len(l)<=K:
    m = bisect_left(l,0)
  	ans = max(ans,sum(l[min(K-len(l),m):]))
print(ans)


### FIXED CODE ###

from itertools import combinations
from bisect import bisect_left
N, K = map(int,input().split())
A = list(map(int,input().split()))

ans=0

for i,j in combinations(range(N+2),2):
  l = sorted(A[0:i]+A[j-1:N])
  if len(l)<=K:
    m = bisect_left(l,0)
    ans = max(ans,sum(l[min(K-len(l),m):]))
print(ans)
from collections import Counter
li=[]
d={}
for i in range(int(input())):
    p=input()
    if(p in d):
        d[p]+=1
    else:
    	d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])


### FIXED CODE ###

import math
n=int(input())
d=n/1000
g=math.ceil(d)
print(g*1000-n)
x,y = map(int, input())

a = x
ans = 1

while a <= y:
    a = a * 2
    ans += 1

print(ans)

### FIXED CODE ###

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

a = x
ans = 0

while a <= y:
    a = a * 2
    ans += 1

print(ans)
N = int(input())
str_row = ['z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y']
result = []

while N > 26:
    r = N % 26
    result.append(str_row[r])
    N = int(N / 26)
result.append(str_row[N])

for i in result[::-1]:
    print(str(i), end='')

### FIXED CODE ###

n = int(input())
ans = ''
check = 'abcdefghijklmnopqrstuvwxyz'
while n != 0:
    n -= 1
    ans += check[n%26]
    n //= 26
print(ans[::-1])
, B, C, D = map(int, input().split())

if A%C == 0:
    cnt_c = A//C - 1
else:
    cnt_c = A//C

if A%D == 0:
    cnt_d = A//D - 1
else:
    cnt_d = A//D

if A%(C*D) == 0:
    cnt_cd = A//(C*D) - 1
else:
    cnt_cd = A//(C*D)

num = (B//C)+(B//D)-(B//(C*D)) - (cnt_c + cnt_d - cnt_cd)
print(B-A+1-num)

### FIXED CODE ###

from fractions import gcd
def lcm(x,y):
    return x*y//gcd(x,y)
lcm_num = lcm
A, B, C, D = map(int, input().split())

lcm_num = lcm(C, D)

if A%C == 0:
    cnt_c = A//C - 1
else:
    cnt_c = A//C

if A%D == 0:
    cnt_d = A//D - 1
else:
    cnt_d = A//D

if A%(lcm_num) == 0:
    cnt_cd = A//(lcm_num) - 1
else:
    cnt_cd = A//(lcm_num)



num = (B//C)+(B//D)-(B//(lcm_num)) - (cnt_c + cnt_d - cnt_cd)
print(B-A+1-num)
import statistics
a, b, c = map(int, input().split())

mn = min(a, b, c)
md = statistics.median([a, b, c])
mx = max(a, b, c)

if (md - mn) % 2 == 0:
    print((md - mn) // 2 + (mx - md))
else:
    print((md+1) // mn + (mx - 2 - md) + 2)

### FIXED CODE ###

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

l.sort()

count = 0
while l[2] - l[0] > 1:
    l[0] += 2
    count += 1
    l.sort()

if l[2] == l[1] != l[0]:
    count += 2
elif l[0] == l[1] != l[2]:
    count += 1

print(count)
# coding:utf-8
class Tree(object):
    def __init__(self, N):
        self.tree   = [[] for _ in range(N)]
        self.colors = [0  for _ in range(N)]

    def add_node(self, a, b):
        self.tree[a].append(b)
    # 二部グラフか判定する関数
    def is_bipartite_graph(self, v, color):
        self.colors[v] = color
        for to in self.tree[v]:
            if self.colors[to] == color:
                return False
            if self.colors[to] == 0 and not self.is_bipartite_graph(to, -color):
                return False
        return True
    
    def count_node(self, color):
        return self.colors.count(color)
    
if __name__ == "__main__":

    # input data
    N, M = map(int, input().split())
    tree = Tree(N)
    for _ in range(M):
        a, b = map(int, input().split())
        tree.add_node(a-1, b-1)
        tree.add_node(b-1, a-1)
    
    # tree dp
    is_bpr = tree.is_bipartite_graph(0, 1)
    if is_bpr:
        bla = tree.count_node(1)
        whi = N - bla
        print(bla*whi-M)
    else:
        print(int(N*(N-1)/2-M))



### FIXED CODE ###

# coding:utf-8
class Tree(object):
    def __init__(self, N):
        self.tree   = [[] for _ in range(N)]
        self.colors = [0  for _ in range(N)]

    def add_node(self, a, b):
        self.tree[a].append(b)
    # 二部グラフか判定する関数
    def is_bipartite_graph(self, v, color):
        self.colors[v] = color
        for to in self.tree[v]:
            if self.colors[to] == color:
                return False
            if self.colors[to] == 0 and not self.is_bipartite_graph(to, -color):
                return False
        return True
    
    def count_node(self, color):
        return self.colors.count(color)
    
if __name__ == "__main__":

    import sys
    sys.setrecursionlimit(200000)
    # input data
    N, M = map(int, input().split())
    tree = Tree(N)
    for _ in range(M):
        a, b = map(int, input().split())
        tree.add_node(a-1, b-1)
        tree.add_node(b-1, a-1)
    
    # tree dp
    is_bpr = tree.is_bipartite_graph(0, 1)
    if is_bpr:
        bla = tree.count_node(1)
        whi = N - bla
        print(bla*whi-M)
    else:
        print(int(N*(N-1)/2-M))
N,M,X=[int(x) for x in input().rstrip().split()]
l=[]
for i in range(N):
  ca=[int(x) for x in input().rstrip().split()]
  l.append(ca)

cost=float('inf')
A=[0]*(M+2)
flag=1
ans=float('inf')
for i in range(2**N):
  flag=1
  cost=0
  for j in range(N):
    if i>>j & 1:
      now=l[N-j-1]
      cost+=now[0]
      for s in range(M):
        A[s]+=now[s+1]
  for t in range(M):
    if X<=A[t]:
      continue
    else:
      flag=0
      break
  if flag==1:
    ans=min(ans,cost)

  A=[0]*N
if ans==float('inf'):
  print(-1)
else:
  print(ans)
      



### FIXED CODE ###

N,M,X=[int(x) for x in input().rstrip().split()]
l=[]
for i in range(N):
  ca=[int(x) for x in input().rstrip().split()]
  l.append(ca)

A=[0 for i in range(M+2)]
flag=1
ans=10**10
cnt=0
for i in range(2**N):
  flag=1
  cost=0
  for j in range(N):
    if i>>j & 1:
      now=l[N-j-1]
      cost+=now[0]
      for s in range(M):
        A[s]+=now[s+1]
  for t in range(M):
    if X<=A[t]:
      continue
    else:
      flag=0
      break
  if flag==1:
    ans=min(ans,cost)
    cnt+=1

  A=[0 for v in range(M+2)]

if cnt==0:
  print(-1)
else:
  print(ans)
n,m = map(int,input().split())
a = list(map(int,iuput().split()))
x = n - sum(a)
if x >= 0:
    print(x)
else:
    print("-1")

### FIXED CODE ###

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = n-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)
from sys import stdin

n = int(stdin.readline().rstrip())
L = stdin.readline().rstrip()

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)


### FIXED CODE ###


from sys import stdin

n = int(stdin.readline().rstrip())
L = list(map(int,input().split()))

j = 1
for i in range(n):
 if int(L[i]) == j:
  j = j + 1

if (j == 1):
 print(-1)
else:
 print (n - j + 1)
N = int(input())
H = list(map(int,input().split()))
result = 1
for i in range(1,len(H)):
  if H[i] < H[i+1]:
    result += 1
  else:
    break
print(result)

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
A = H[0]
result = 0
for i in range(len(H)):
  if A <= H[i]:
    result += 1
    A = H[i]
  else:
    None
print(result)