Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**9)

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

class Union_Find:
    def __init__(self,n):
        self.parent = [i for i in range(n)]
        self.rank = [1 for i in range(n)]
    
    def find(self,x):
        if self.parent[x] == x:
            return x
        else:
            return self.find(self.parent[x])
    
    def unite(self, x, y):
        if self.rank[x] == self.rank[y]:
            self.parent[y] = x
            self.rank[x] += 1
        elif self.rank[x] > self.rank[y]:
            self.parent[y] = x
        else:
            self.parent[x] = y

uftree = Union_Find(N+1)

for i in range(M):
    x, y, _ = map(int, input().split())
    uftree.unite(x, y)

result = 0
for i in range(1, N+1):
    if uftree.find(i) == i:
        result += 1

print(result)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N, M = map(int, input().split())
paths = [[] for _ in range(N)]

for _ in range(M):
    a, b, z = map(int, input().split())
    paths[a-1].append(b-1)
    paths[b-1].append(a-1)

visited = [False] * N

def dfs(node, prev):
    if visited[node]:
        return
    visited[node] = True
    for n in paths[node]:
        if n != prev:
            dfs(n, node)
count = 0
for i in range(N):
    if visited[i] == False:
        count += 1
        dfs(i,-1)

print(count)
t,a,k = [x for x in list(map(int,input().split()))]
if k>=t:
  if abs(t-k) > a:
    t = 0
    a = 0
  else:
    t = 0
    a = a-abs(t-k)
   print(t,a)
else:
  t = t-k
  print(t,a)
  

### FIXED CODE ###

t,a,k = [x for x in list(map(int,input().split()))]
if k>=t:
    if k-t > a:
        t = 0
        a = 0
    else:
        a = a - (k-t)
        t = 0
    print(t,a)
else:
    t = t-k
    print(t,a)
n,a,b=map(int,input().split())
s=input()
for i in s:
    if a+b>0:
        if i=="a":
            a-=1
            print("Yes")
            continue
        elif i=="b" and b>0:
            b-=1
            print("Yes")
            continue
    print("No")


### FIXED CODE ###

s=input()
v="CODEFESTIVAL2016"
cnt=0
for i in range(16):
    if s[i]==v[i]:
        cnt+=1
print(16-cnt)
def candy():
    N = int(input())
    x = int(input())
    a = int(input().split)

    s = 0
    for i in range(1, N-1):
        if (a[i] + a[i-1]) > x:
            s = s + (a[i] + a[i-1] - x)
            a[i] = x - a[i-1]
    print(s)
    
candy()

### FIXED CODE ###

def candy():
    boxNum, x = [int(i) for i in input().split()]
    ain = input()
    alist = ain.split(' ')

    s = 0
    
    for i in range(0, boxNum-1):
        if int(alist[i+1]) + int(alist[i]) > x:
            s = s + (int(alist[i+1]) + int(alist[i]) - x)
            alist[i+1] = x - int(alist[i])
            if int(alist[i+1]) < 0:
                alist[i] = int(alist[i]) + int(alist[i+1])
                alist[i+1] = 0
        
    print(s)
    
candy()
N = int(input())
alphabets = {i: chr(i + 96) for i in range(1, 27)}

queue = []
while N > 0:
    queue.insert(0, alphabets[N % 26])
    N //= 26
    
print(''.join(queue))

### FIXED CODE ###

N = int(input())
alphabets = {i: chr(i + 96) for i in range(1, 26)}
alphabets[0] = 'z'

queue = []
if N <= 26:
    print(alphabets[N])
else:
    while N > 0:
        queue.insert(0, alphabets[N % 26])
        N -= 1
        N //= 26

    print(''.join(queue))
# N個のスペース区切りの数値を取得
N = int(input())
A = [int(N) for N in input().split()]


# 奇数番目と偶数番目に出てくる数字の頻度順にそれぞれソートして、
odd = []
even = []

for i in range(N):
    if i%2 == 0:
        odd.append(A[i])
    else:
        even.append(A[i])

import collections
c_odd = collections.Counter(odd)
c_even = collections.Counter(even)
#print(c_odd.most_common()[0][0], c_even.most_common()[0][0])



# 最頻な数字が一致してない場合はそれぞれの最頻値以外の合計値、
if c_odd.most_common()[0][0] != c_even.most_common()[0][0] :
    print(len(set(odd))-1 + len(set(even))-1)
    exit()


# 一致してる場合は片方が最頻を諦めた場合の合計値を両パターン求めて小さい方
if c_odd.most_common()[0][0] == c_even.most_common()[0][0] :

    # 偶数と奇数の数列が完全一致のパターンでないかチェック
    if len(c_odd.most_common()) == 1 and len(c_even.most_common()) == 1:
        print(N//2)

    # oddが1種類しかない場合
    elif len(c_odd.most_common()) == 1:
        print(N//2 - c_even.most_common()[1][1])
    # evenが1種類しかない場合
    elif len(c_even.most_common()) == 1:
        print(N//2 - c_odd.most_common()[1][1])
    #両方が2種類以上で構成されている場合
    else:
        ans = N - max(c_odd.most_common()[0][1]+c_even.most_common()[1][1], c_odd.most_common()[1][1]+c_even.most_common()[0][1] )
        print(ans)


### FIXED CODE ###

# N個のスペース区切りの数値を取得
N = int(input())
A = [int(N) for N in input().split()]


# 奇数番目と偶数番目に出てくる数字の頻度順にそれぞれソートして、
odd = []
even = []

for i in range(N):
    if i%2 == 0:
        odd.append(A[i])
    else:
        even.append(A[i])

import collections
c_odd = collections.Counter(odd)
c_even = collections.Counter(even)
#print(c_odd.most_common()[0][0], c_even.most_common()[0][0])



# 最頻な数字が一致してない場合はそれぞれの最頻値以外の合計値、
if c_odd.most_common()[0][0] != c_even.most_common()[0][0] :
    #print(len(set(odd))-1 + len(set(even))-1)
    print(N - c_odd.most_common()[0][1] - c_even.most_common()[0][1])
    exit()


# 一致してる場合は片方が最頻を諦めた場合の合計値を両パターン求めて小さい方
if c_odd.most_common()[0][0] == c_even.most_common()[0][0] :

    # 偶数と奇数の数列が完全一致のパターンでないかチェック
    if len(c_odd.most_common()) == 1 and len(c_even.most_common()) == 1:
        print(N//2)

    # oddが1種類しかない場合
    elif len(c_odd.most_common()) == 1:
        print(N//2 - c_even.most_common()[1][1])
    # evenが1種類しかない場合
    elif len(c_even.most_common()) == 1:
        print(N//2 - c_odd.most_common()[1][1])
    #両方が2種類以上で構成されている場合
    else:
        ans = N - max(c_odd.most_common()[0][1]+c_even.most_common()[1][1], c_odd.most_common()[1][1]+c_even.most_common()[0][1] )
        print(ans)

'''
        # 最頻を諦める ＝ 2番めに頻出な数値を採用
        temp_odd_retire = N//2 - c_odd.most_common()[1][1] #個数
        temp_even_retire = N//2 - c_even.most_common()[1][1] #個数
        #print('temps are ', temp_odd_retire, temp_even_retire)

        # oddを諦めたほうが良い場合
        if temp_odd_retire < temp_even_retire:
            print(temp_odd_retire + N//2 - c_even.most_common()[0][1])
        # even()
        else:
            print(temp_even_retire + N//2 - c_odd.most_common()[0][1])
        exit()
'''
#!/usr/bin/env python3
import sys


def solve(S: int):
    a, b = str(S)[:2], str(S)[2:]
    if a == '00' or b == '00':
        print('NA')
        return
    fa, fb = False, False
    if int(a) > 12:
        fa = True
    if int(b) > 12:
        fb = True
    if fa and fb:
        print('NA')
        return
    if fa and not fb:
        print('YYMM')
        return
    if not fa and fb:
        print('MMYY')
        return
    if not fa and not fb:
        print('AMBIGUOUS')
        return
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(S: int):
    s = '{:04d}'.format(S)
    a, b = str(s)[:2], str(s)[2:]

    def judge(s):
        if s == '00' or int(s) > 12:
            return 'y'
        return 'ym'

    fa, fb = judge(a), judge(b)

    if fa == 'y' and fb == 'y':
        print('NA')
    elif fa == 'y' and fb == 'ym':
        print('YYMM')
    elif fa == 'ym' and fb == 'y':
        print('MMYY')
    elif fa == 'ym' and fb == 'ym':
        print('AMBIGUOUS')
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == '__main__':
    main()
enki = {"A":"T", "C":"G", "G":"C", "T":"A"}
print(enki[str(input())])


### FIXED CODE ###

S = input()
count = 0
ans = 0
for s in S:
    if s in "ACGT":
        count += 1
    else:
        if ans < count:
            ans = count
        count = 0
    if ans < count:
        ans = count
        
print(ans)
N = int(input())

print('Yes' if '7' in str(N))

### FIXED CODE ###

N = input()

print('Yes' if '7' in str(N) else 'No')
import random
A, B = map(int, input().split())
r = random.randrange(5)
if r == 0:
    print(1/0)
elif r == 1:
    print(A+B)
elif r == 2:
    while True:
        B += 1
elif r == 3:
    print(999)
else:
    X = [[0] * 10**4 for _ in range(10**5)]

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A*2-1,A+B,B*2-1))
n, k =map(int, input().split())
mod = 10 ** 9 + 7
def com(a, b):
  b = min(b, a-b)
  sum = 1
  for i in range(a-b+1, a+1):
    sum *= i
  for j in range(1, b+1):
    sum //= j
  return sum % mod
for i in range(1, k+1):
  ans = com(n-k+1, i) * com(k-1, i-1) % mod
  print(ans)

### FIXED CODE ###

s = str(input())
letter_list = []
for letter in s:
    letter_list.append(letter)
letter_list.sort()
l1 = letter_list[0]
l2 = letter_list[2]
if letter_list.count(l1) == 2 and letter_list.count(l2) == 2:
    print('Yes')
else:
    print('No')
from functools import lru_cache

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

AB = []
for i in range(N):
  A, B = map(int, input().split())
  AB.append((A, B))

@lru_cache(maxsize=None)
def f(h):
    if h <= 0:
        return 0
    return min(b + f(h - a) for a, b in AB)

print(f(H))


### FIXED CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(1000000)

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

AB = []
for i in range(N):
  A, B = map(int, input().split())
  AB.append((A, B))

'''
H = 10000
N = 1000
import random
AB = []
for i in range(N):
    A = random.randint(1, 10000)
    B = random.randint(1, 10000)
    AB.append((A, B))
'''




@lru_cache(maxsize=None)
def f(h):
    if h <= 0:
        return 0
    best = float('inf')
    for a, b in AB:
        val = b + f(h - a)
        if val < best:
            best = val
        else:
            break
    return best

AB.sort(key=lambda ab: (ab[0] / ab[1], -ab[0]), reverse=True)
bestA, bestB = AB[0]
threshold = sum(a for a, b in AB)

ans = None
times = (H - threshold) // bestA
if times > 0:
    ans = bestB * times + f(H - bestA * times)
else:
    ans = f(H)

print(ans)
r,d,x=map(int,input().split())
for i in range(10)
  x=r*x-d
  print(x)


### FIXED CODE ###

r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)
N = int(input())
An = list(map(int, input().split()))
An_s = collections.Counter(An)
total = 0
for k in An_s:
    total += k
ans = 0
for A, v in An_s.items():
    At = A * (total-A)*v
#     print(A, total, At, ans)
    ans = (ans+At) % (10**9+7)
#     print(ans)
print(ans//2)

### FIXED CODE ###

N = int(input())
An = list(map(int, input().split()))
tt = sum(An)
total = tt
ans = 0
for A in An:
    At = A * (total-A)
#     if v == 1:
#         At = A * (tt-A)
#     else:
#         At = A * (tt-A*v)*v
#     print(A, total, At, ans)
#     md = At % (10**9+7)
    ans = (ans+At) % (10**9+7)
    total -= A
#     print(ans)
print(ans)
#!/usr/bin/env python3
import sys
import math

def main():
    N, X = map(int, input().split())
    x = list(map(int, input().split()))
    x = [abs(i - X) for i in x]
    if len(x) == 1:
        print(x[0])
        exit()
    
    ans = math.gcd(x[0], x[1])
    for i in range(2,N):
        ans = math.gcd(ans,x[i])

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import fractions

def main():
    N, X = map(int, input().split())
    x = list(map(int, input().split()))
    x = [abs(i - X) for i in x]
    if len(x) == 1:
        print(x[0])
        exit()
    
    ans = fractions.gcd(x[0], x[1])
    for i in range(2,N):
        ans = fractions.gcd(ans,x[i])

    print(ans)

if __name__ == '__main__':
    main()
N = int(input())
cake = 4
donut = 7
ac = False
for i in range(25):
    for j in range(14):
        if N == (cake * i + donut * j):
            ac = True
if ac:
    print('Yes')
else:
    print('No)

### FIXED CODE ###

N = int(input())
cake = 4
donut = 7
ac = False
for i in range(25):
    for j in range(14):
        if N == (cake * i + donut * j):
            ac = True
if ac:
    print('Yes')
else:
    print('No')
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 10 ** 9 + 7


n, c = LI()
L = [0] * 10 ** 5
for s, t, c in LIR(n):
    L[s] += 1
    L[t + 1] -= 1



print(max(accumulate(L)))


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left
import random
from itertools import permutations, accumulate, combinations
import sys
import string


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 10 ** 9 + 7


n, c = LI()
L = [0] * (10 ** 5 + 2)
each_channel = [[] for _ in range(c)]
for s, t, k in LIR(n):
    each_channel[k - 1] += [(s, t)]



for i in each_channel:
    i.sort()


for i in range(c):
    pre_t = -1
    for j in range(len(each_channel[i])):
        s, t = each_channel[i][j]
        if j >= 1 and pre_t == s:
            L[pre_t + 1] += 1
            L[t + 1] -= 1
        else:
            L[s] += 1
            L[t + 1] -= 1
        pre_t = t


print(max(accumulate(L)))
s, w = map(int, input().split()) # split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
if s > w
	print ("safe")
else print ("unsafe")

### FIXED CODE ###

s, w = map(int, input().split()) # split()で空白区切りでリスト化、その際map()でint型にキャストし変数に代入。
if s > w:
	print("safe")
else:
	print("unsafe")
s=input()
n=s.split(" ")[0]
m=s.split(" ")[1]
 
n=n-1
m=m-1
 
r=n*m
 
print(m)

### FIXED CODE ###

s=input()
n=int(s.split(" ")[0])
m=int(s.split(" ")[1])
n=n-1

m=m-1
r=n*m
print(r)
N = int(input())
A = list(map(int, input().split()))

if 0 in A:
    print(0)
    exit()
          
n = 1
for i in range(N):
    n *= A[i]
    if n > 10**18:
        print(-1)
        exit()

print(n)


### FIXED CODE ###

A, B, C, K = map(int, input().split())
if K <= A:
    print(K)
elif K <= A + B:
    print(A)
else:
    print(A - (K - A - B))
n = int(input())
DEBT = 100000

for interest in range(n):
	DEBT = DEBT * 1.05
	ROUND = DEBT % 1000
	if ROUND != 0:
		DEBT = (DEBT // 1000 + 1) * 1000
print(int(DEBT)

### FIXED CODE ###

n = int(input())
debt = 100000

for i in range(n):
	debt = debt * 1.05
	round = debt % 1000
	if round != 0:
		debt = (debt // 1000 + 1) * 1000

print(int(debt))
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    r,g,b = inputMap()
    
    tmp = str(r) + str(g) + str(b)
    tmp1 = int(tmp)
    
    if tmp % 4 == 0:
        print("YES")
    else:
        print("NO")
    
        
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    r,g,b = inputMap()
    
    tmp = str(r) + str(g) + str(b)
    tmp1 = int(tmp)
    
    if tmp1 % 4 == 0:
        print("YES")
    else:
        print("NO")
    
        
if __name__ == "__main__":
	main()
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
h, w, d = map(int, read().split())
num = h * w
mass = np.array([[0, 0] for _ in range(num + 1)])
mp = np.zeros(num+1, dtype=int)
for i in range(h):
    for j, a in enumerate(map(int, readline().split())):
        mass[a] = [i, j]
for i in range(d+1, num+1):
    mp[i] = mp[i-d] + np.sum(abs(mass[i]-mass[i-d]))
q = int(read())
for _ in range(q):
    l, r = map(int, read().split())
    print(mp[r]-mp[l])


### FIXED CODE ###

import sys
input = sys.stdin.readline
h, w, d = map(int, input().split())
num = h * w
x = [0] * (num + 1)
y = [0] * (num + 1)
mp = [0] * (num + 1)
for i in range(h):
    for j, a in enumerate(map(int, input().split())):
        x[a], y[a] = [i+1, j+1]
for i in range(d+1, num+1):
    mp[i] = mp[i-d] + abs(x[i] - x[i-d]) + abs(y[i] - y[i-d])
q = int(input())
for _ in range(q):
    l, r = map(int, input().split())
    print(mp[r]-mp[l])
n, m =map(int, input().split())  #複数数値入力
list_h=list(map(int, input().split()))  #リスト入力
# 繰り返しリスト入力
a = []
for i in range(m):
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)

booler = [True] * n
for i in range(n):
    a_copy = copy.deepcopy(a)
    for j in range(m):
        if i in a_copy[j] :
            a_copy[j].remove(i)
#             print(a_copy)
            if list_h[i] > list_h[a_copy[j][0]-1]:
                continue
            else:
                booler[i] = False
        else:
            continue

print(booler.count(True))

### FIXED CODE ###

import copy
n, m =map(int, input().split())  #複数数値入力
list_h=list(map(int, input().split()))  #リスト入力
# 繰り返しリスト入力
a = []
for i in range(m):
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)

for i in a:
    i.sort()
a = list(map(list, set(map(tuple, a))))

booler = [True] * n
for j in a:
    if list_h[j[0]-1] < list_h[j[1]-1]:
        booler[j[0]-1] = False
    elif list_h[j[0]-1] > list_h[j[1]-1]:
        booler[j[1]-1] = False
    else :
        booler[j[0]-1] = False
        booler[j[1]-1] = False
print(booler.count(True))
N = int(input())
money = int(input())
Y = money//(10**4)
H = money//(10**3)
N = money//(10**2)
for i in range(Y+1):
  for k in range(H+1):
    for m in range(N+1):
       if money = (10**4)*i +(10**3)*k+(10**2)*m:
          print(i,k,m,sep=" ")
        
      

### FIXED CODE ###

N,Y=map(int,input().split())
for i in range(N+1):
  for k in range(N+1-i):
    m = N-i-k
    if 10000*i + 5000*k + 1000*m == Y:
      print(i,k,m)
      exit()
print(-1,-1,-1)
from math import gcd

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

a = [0, 300000, 200000, 100000, 0]
ans = 0

x = min(x, 4)
y = min(y, 4)

ans = a[x] + a[y]
if x == 1 and y == 1:
    ans += 400000

print(ans)

### FIXED CODE ###

x, y = map(int, input().split())
 
a = [0, 300000, 200000, 100000, 0]
ans = 0
 
x = min(x, 4)
y = min(y, 4)
 
ans = a[x] + a[y]
if x == 1 and y == 1:
    ans += 400000
 
print(ans)
weight_num = int(input())
weight_list = input().split(" ")
t = int(input())
heavy_list = []
light_list = []
for i in range(len(weight_list)):
    weight_list[i] = int(weight_list[i])

    if i>=t:
        heavy_list.append(weight_list[i])
    else:
        light_list.append(weight_list[i])

s1=sum(heavy_list)
s2=sum(light_list)
if s1-s2>0:
    print(s1-s2)
else:
    print(s2-s1)

### FIXED CODE ###

weight_num = int(input())
weight_list = input().split(" ")
heavy_list = []
light_list = []
s1 = 0
s2 = 0
for i in range(len(weight_list)):
    weight_list[i] = int(weight_list[i])
max_sum = sum(weight_list)
for i in range(len(weight_list)):
    s1 += weight_list[i]
    s2 = sum(weight_list[i+1:])
    if (s1-s2)>0:
        absolute_num1 = s1-s2 
        s1 -= weight_list[i]
        s2 = sum(weight_list[i:])
        absolute_num2 = s2-s1
        if absolute_num1>absolute_num2:
            print(absolute_num2)
        else:
            print(absolute_num1)
        break
    else:
        pass
from heapq import heappop, heapify


N, K, *V = map(int, open(0).read().split())

# i: 操作回数
# j: iのうち戻す回数
# k: i - j のうち左から取り出す範囲 [0, k)
ans = 0
for i in range(K + 1):
    res = 0
    pq = []
    for j in range(i // 2 + 1):
        for k in range(i - j + 1):
            put_out_cnt = j
            tmp = V[:k]
            l = i - j - k
            if l > 0:
                tmp += V[-l:]
            heapify(tmp)
            while put_out_cnt > 0:
                heappop(tmp)
                put_out_cnt -= 1
            ans = max(ans, sum(tmp))
print(ans)



### FIXED CODE ###

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

ans = 0
for a_plus_b in range(min(N, K) + 1):
    for a in range(a_plus_b + 1):
        b = a_plus_b - a
        gems = V[:a]
        if b > 0:
            gems += V[-b:]
        gems.sort()
        negative_gems = [g for g in gems if g < 0]
        ans = max(ans, sum(gems) - sum(negative_gems[:K - a_plus_b]))
print(ans)
w, h = map(int, input().split())
S = [list(map(int, input().split())) for i in range(h)]
SW = [[0]*w for i in range(h)]
SH = [[0]*w for i in range(h)]
for i in range(h):
    cnt = 0
    for j in range(w-1, -1, -1):
        cnt += S[i][j]
        SW[i][j] = cnt
for j in range(w):
    cnt = 0
    for i in range(h-1, -1, -1):
        cnt += S[i][j]
        SH[i][j] = cnt
memo = {}
def dfs(x, y):
    if (x, y) in memo:
        return memo[x, y]
    if x == w or y == h:
        return 0
    if (x+y) % 2 == 0:
        # first
        res = max(dfs(x+1, y) - SH[y][x], dfs(x, y+1) + SW[y][x])
    else:
        # second
        res = min(dfs(x+1, y) - SH[y][x], dfs(x, y+1) + SW[y][x])
    memo[x, y] = res
    return res
print(abs(dfs(0, 0)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
w, h = map(int, input().split())
S = [list(map(int, input().split())) for i in range(h)]
SW = [[0]*w for i in range(h)]
SH = [[0]*w for i in range(h)]
for i in range(h):
    cnt = 0
    for j in range(w-1, -1, -1):
        cnt += S[i][j]
        SW[i][j] = cnt
for j in range(w):
    cnt = 0
    for i in range(h-1, -1, -1):
        cnt += S[i][j]
        SH[i][j] = cnt
memo = {}
def dfs(x, y):
    if (x, y) in memo:
        return memo[x, y]
    if x == w or y == h:
        return 0
    if (x+y) % 2 == 0:
        # first
        res = max(dfs(x+1, y) - SH[y][x], dfs(x, y+1) + SW[y][x])
    else:
        # second
        res = min(dfs(x+1, y) - SH[y][x], dfs(x, y+1) + SW[y][x])
    memo[x, y] = res
    return res
print(abs(dfs(0, 0)))
A = input()
B = input()
if A == B:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N,M = map(int, input().split())
 
if N == M:
  print("Yes")
else:
  print("No")
N=-int(input())
if N=0:
    print(0)
else:
    tmp=[]
    while N!=0:
        tmp.insert(0,N%(2))
        N=-N//2
    s=''.join([str(_) for _ in tmp])
    print(s)


### FIXED CODE ###

N=-int(input())
if N==0:
    print(0)
else:
    tmp=[]
    while N!=0:
        tmp.insert(0,N%(2))
        N=-N//2
    s=''.join([str(_) for _ in tmp])
    print(s)
n=int(input())
A=list(map(int,input(),split()))
print("YES" if len(list(set(A)))==len(A) else "NO")


### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
print("YES" if len(set(A))==len(A) else "NO")
(T // A) *B

### FIXED CODE ###

a, b, t = map(int, input().split())
print(int((t+0.5)//a*b))