Harryxun/stf_run huggingface dataset:
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
#from collections import deque
#from collections import defaultdict
# from collections import Counter
#from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n,*a=map(int,read().split())
	
	aa=max(a)
	
	li=[[] for _ in range(aa+1)]
	
	for i in range(n):
		li[a[i]].append(i)
	
	if len(li[0])>3:
		print(0)
		exit(0)
	else:
		ans=3 if len(li[0])==1 else 6

	for i in range(1,aa+1):
		if len(li[i])>3:
			print(0)
			exit(0)
		else:
			k=bisect.bisect_right(li[i-1],li[i][0])
			ans*=k
			ans%=MOD
			
			if len(li[i])>1:
				k=bisect.bisect_right(li[i-1],li[i][1])-1
				ans *= k
				ans %= MOD
		
	print(ans)
	
	
if __name__ == "__main__":
		main()


### FIXED CODE ###

import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
#from collections import deque
#from collections import defaultdict
# from collections import Counter
#from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n,*a=map(int,read().split())
	
	aa=max(a)
	
	li=[[] for _ in range(aa+1)]
	
	for i in range(n):
		li[a[i]].append(i)
	
	if len(li[0])>3 or len(li[0])==0:
		print(0)
		exit(0)
	else:
		ans=3 if len(li[0])==1 else 6
	for i in range(1,aa+1):
		if len(li[i])>3 or len(li[i])==0 or len(li[i])>len(li[i-1]):
			print(0)
			exit(0)
		else:
			k=bisect.bisect_right(li[i-1],li[i][0])
			ans*=k
			ans%=MOD
			
			if len(li[i])>1:
				k=bisect.bisect_right(li[i-1],li[i][1])-1
				ans *= k
				ans %= MOD
		
	print(ans)
	
	
if __name__ == "__main__":
		main()
#-------------
N = int(input())
#-------------

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k):
  cmb.append([i , N-i])

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-2):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)

print(min(ans))

### FIXED CODE ###

#-------------
N = int(input())
#-------------

if N%2 == 0:
  k = N//2
else:
  k = (N+1)//2

cmb = []
for i in range(1,k+1):
  cmb.append([i , N-i])
  
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

ans = []
for i in range(k-1):
  X = digitSum(cmb[i][0])
  Y = digitSum(cmb[i][1])
  ans.append(X+Y)


if ans == []:
  print("2")
else:
  print(min(ans))
a,b,c,d,e,f = map(int,input().split())

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
w,s = anss[0][1],anss[0][2]
print(w+s,s)


### FIXED CODE ###

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

# 作れるか判定
def check(goal,ac,bd):
    flag = 0
    for x in range(int(goal//ac)+1):
            if (goal-ac*x)%bd == 0 : flag = 1 ; break
    return flag

# 水W、砂糖Sをまわす
anss = []
for w in range(100,f+1,100):
    for s in range(1,f-w+1):
        if check(w,100*a,100*b) and check(s,c,d) and s<=((w*e)/100):
            conc = 100*s/(w+s) # concentration
            anss.append([conc,w,s])

anss.sort(reverse=1)
if anss: w,s = anss[0][1],anss[0][2]
else: w,s = 100*a,0
print(w+s,s)
N = int(input())
A = list(map(int, input().split()))

step = 0
while True:
  flag = False
  for i in range(N):
    if A[i] %2 == 0:
      A[i] = A[i]/2
      else:
        flag = True
        break
        
        if flag:
          break
          step +=1

print(step)         

### FIXED CODE ###

s = input()

cnt = 0

for c in s:
  if c == "1":
    cnt += 1

print(cnt)
N, A, B = map(int, input().split())
MOD = 10**9 + 7

import numpy as np
 
def prepare(n, MOD):
    nrt = int(n ** 0.5) + 1
    nsq = nrt * nrt
    facts = np.arange(nsq, dtype=np.int64).reshape(nrt, nrt)
    facts[0, 0] = 1
    for i in range(1, nrt):
        facts[:, i] = facts[:, i] * facts[:, i - 1] % MOD
    for i in range(1, nrt):
        facts[i] = facts[i] * facts[i - 1, -1] % MOD
    facts = facts.ravel().tolist()
 
    invs = np.arange(1, nsq + 1, dtype=np.int64).reshape(nrt, nrt)
    invs[-1, -1] = pow(facts[-1], MOD - 2, MOD)
    for i in range(nrt - 2, -1, -1):
        invs[:, i] = invs[:, i] * invs[:, i + 1] % MOD
    for i in range(nrt - 2, -1, -1):
        invs[i] = invs[i] * invs[i + 1, 0] % MOD
    invs = invs.ravel().tolist()
 
    return facts, invs
s, _ = prepare(N, MOD)
print((2**N - s[N]//(s[A]*s[N-A]) - s[N]//(s[B] * s[N-B]) - 1) % MOD)

### FIXED CODE ###

N, A, B = map(int, input().split())
MOD = 10**9 + 7

def pow(x, y):
  if y == 0:
    return 1
  K = 1
  while y > 1:
    if y % 2 == 0:
      y = y // 2
      x = (x * x) % MOD
    else:
      K = (K * x) % MOD
      y -= 1
  return (K * (x ** y)) % MOD

def comb_mod(p, q):
  bunsi = 1
  bunbo = 1
  for i in range(q):
    bunsi = (bunsi * (p-i)) % MOD
    bunbo = (bunbo * (i+1)) % MOD
  return ((bunsi * pow(bunbo, MOD - 2)) % MOD)

print((pow(2,N) - 1 - comb_mod(N, A) - comb_mod(N, B)) % MOD)
W=raw_input()
Text=[]
while True:
    text=raw_input()
    if text=='END_OF_TEXT':
        break
    Text.extend(text.split())
print('%d'%Text.count(W))

### FIXED CODE ###

w=input()
W=w.lower()
Text=[]
while True:
    text=input()
    if text=='END_OF_TEXT':
        break
    Text.extend(text.split())
for i in range(len(Text)):
    Text[i]=Text[i].lower()
print('%d'%Text.count(W))
max = 0
i = 0
j = 0
k = 0
n_max = 10

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            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
import sys
input = sys.stdin.readline

def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    if find(x) == find(y):
        return True
    else:
        return False

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if rank[x] > rank[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x

def uCnt(x):
    return -par[find(x)]

N, M, K = map(int, input().split())
par = [-1 for i in range(N + 1)]
rank = [0] * N
frendCnt = [0] * N
bloc = [[] for _ in range(N + 1)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    frendCnt[a] += 1
    frendCnt[b] += 1
    unite(a, b)

#for i in range(K):
#    c, d = map(int, input().split())
#    c -= 1
#    d -= 1
#    bloc[c].append(d)
#    bloc[d].append(c)

#for i in range(N):
#    ans = uCnt(i) - frendCnt[i] - 1
#    for j in bloc[i]:
#      if same(i, j):
#           ans -= 1
#    print(ans, end=' ')

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

#Union Find

#xの根を求める
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
#xとyの属する集合の併合
def unite(x,y):
    x = find(x)
    y = find(y)

    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
        par[x] += par[y]
        par[y] = x
        return True

#xとyが同じ集合に属するかの判定
def same(x,y):
    return find(x) == find(y)

#xが属する集合の個数
def size(x):
    return -par[find(x)]

#初期化
#根なら-size,子なら親の頂点
par = [-1]*n

num = [0]*n

for i in range(m):
    a,b = map(int,input().split())
    unite(a-1,b-1)
    num[a-1] += 1
    num[b-1] += 1

edge = [[] for i in range(n)]

for i in range(k):
    c,d = map(int,input().split())
    edge[c-1].append(d-1)
    edge[d-1].append(c-1)


for i in range(n):
    cnt = size(i) - num[i] - 1
    for e in edge[i]:
        if same(e,i):
            cnt -= 1
    print(cnt,end=' ')
a = int(input())
toprint = False
while N > 0 :
 	last_digit = a % 10
 		a = a // 10
	if last_digit == 7 :
   		toprint = True
 
	elif toprint == True :
 		print ("Yes")
	else :
 		print ("No")

### FIXED CODE ###

a = int(input())
toprint = False
while a > 0 :
 last_digit = a % 10
 a = a // 10
 if last_digit == 7 :
   toprint = True
 
if toprint == True :
 print ("Yes")
else :
 print ("No")
N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = 0
for a in A:
    if a % 2 != 0:
        odd += 1

if odd == 0
    if P == 1:
        res = 0
    else:
        res = 2 ** N
else:
    res = 2 ** (N - 1)

print(res)

### FIXED CODE ###

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

odd = 0
for a in A:
    if a % 2 != 0:
        odd += 1

if odd == 0:
    if P == 1:
        res = 0
    else:
        res = 2 ** N
else:
    res = 2 ** (N - 1)

print(res)
m,d = map(int(input().split()))
count = 0
for month in range(1,m+1):
  for day in range(1,d):
    if (day%10) >= 2 and (day//10) >= 2:
      if (day%10)*(day//10) == m:
        count += 1
print(count)

### FIXED CODE ###

m,d = map(int,input().split())
count = 0
for month in range(1,m+1):
  for day in range(1,d+1):
    if (day%10) >= 2 and (day//10) >= 2:
      if (day%10)*(day//10) == month:
        #print(month,day)
        count += 1
print(count)
n=int(input())
h=[int,input().split() for _ in range(n)]
for i in range(n-1):
    if(h[i]<h[i+1]):
        h[i+1]-=1
    if(h[i]>h[i+1]):
        print('No')
        return
print('Yes')

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
for i in range(n-1):
    if(h[i]<h[i+1]):
        h[i+1]-=1
    if(h[i]>h[i+1]):
        print('No')
        exit()
print('Yes')
from math import sqrt

n = int(input())
lim_n = int(sqrt(n * 2))
for i in range(1, i+1):
  print(func(i))

def func(num):
  for i in range(2, lim_n+1):
    for j in range(2, i+1):
      for k in range(2, j+1):
        if i**2 + j ** 2 + k ** 2 == 2 * n:
          if i == j and j == k:
            return 1
          elif i != j and j != k:
            return 6
          else:
            return 3
  return 0

### FIXED CODE ###

from math import sqrt

n = int(input())
lim_n = int(sqrt(n*2))
result = [0] * n

for i in range(2, lim_n+1):
    for j in range(2, i+1):
        for k in range(2, j+1):
            p = i**2+j**2+k**2
            if p > 2*n:
                break
            if p % 2 == 1:
                continue
            if (j + k) - i < 2:
                continue
            if i == j and j == k:
                if i  % 2 ==1:
                    continue
                result[p//2-1] += 1
            elif i != j and j != k:
                result[p//2-1] += 6
            else:
                result[p//2-1] += 3

for item in result:
    print(item)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()

def Base_10_to_n(i10, n, ans_list:list):
    # 各桁を0-indexにするために1減らす
    i10 -= 1
    if(int(i10/n)):
        ans_list.append(Base_10_to_n(int(i10/n), n, ans_list))
        return str(i10%n)
    return str(i10%n)


def resolve():
    n = int(input().rstrip())
    n_list = []
    ans_list = []

    n_list.append(Base_10_to_n(n, 26, n_list))

    for n26 in n_list:
        string = ord("a") + n26
        ans_list.append(chr(string))

    ans_string = ""
    for st in ans_list:
        ans_string += st
    print(ans_string.rstrip())

if __name__ == "__main__":
    resolve()



### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def input():
    return sys.stdin.readline()

def Base_10_to_n(i10, n, ans_list:list):
    i10 -= 1
    if(int(i10/n)):
        ans_list.append(Base_10_to_n(int(i10/n), n, ans_list))
        return str(i10%n)
    return str(i10%n)


def resolve():
    n = int(input().rstrip())
    n_list = []

    ans_list = []

    n_list.append(Base_10_to_n(n, 26, n_list))
    n26_list =[]
    for n26 in n_list:
        n26_list.append(int(n26))

    for n26 in n26_list:
        string = ord("a") + n26
        ans_list.append(chr(string))

    ans_string = ""
    for st in ans_list:
        ans_string += st
    print(ans_string.rstrip())

if __name__ == "__main__":
    resolve()
n = int(input())
for i in range(50000):
    x = int(i * 1.08)
    if (n == x):
        print(float(i))
        exit()
print(':(')


### FIXED CODE ###

a,b = map(int,input().split())
c,d = map(int,input().split())
if d == 1:
    print(1)
else:
    print(0)
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")
MOD = 1000000007


def bellman_ford(edges, num_v, sv):
    #グラフの初期化
    dist = [INF] * num_v
    dist[sv]=0
    
    #辺の緩和
    for i in range(num_v):
        for edge in edges:
            s, t, d = edge[0], edge[1], edge[2]
            if dist[s] != INF and dist[t] > dist[s] + d:
                dist[t] = dist[s] + d
                if i == num_v - 1:
                    return -1       # 負の閉路が存在する
    
    return dist


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

    edges = []
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1; b -= 1; c *= -1
        edges.append([a, b, c])
    
    dist = bellman_ford(edges, N, 0)

    if dist == 0:
        print("inf")
    else:
        print(-dist[N-1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

N, M = map(int, input().split())
a = [0]*M
b = [0]*M
c = [0]*M
for i in range(M):
	x, y, z = map(int, input().split())
	a[i] = x
	b[i] = y
	c[i] = -z

INF = float('inf')
d = [INF]*N
d[0] = 0

for _ in range(N-1):
	for i in range(M):
		if d[a[i]-1]==INF:
			continue
		if d[b[i]-1]>d[a[i]-1]+c[i]:
			d[b[i]-1] = d[a[i]-1] + c[i]

ans = -d[N-1]

negative = [False]*N
for _ in range(N):
	for i in range(M):
		if d[a[i]-1]==INF:
			continue
		if d[b[i]-1]>d[a[i]-1]+c[i]:
			d[b[i]-1] = d[a[i]-1] + c[i]
			negative[b[i]-1] = True
		if negative[a[i]-1]==True:
			negative[b[i]-1] = True

if negative[N-1]==True:
	print('inf')
else:
	print(ans)
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a < 0:
    if 0 < b:
        print("Zero")
        exit()
    elif numbers.index(-1) % 2 != 0:
        print("Positive")
    else:
        print("Negative")
else:
    print("Positive")


### FIXED CODE ###

a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")

elif a <= b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")

    else:
        print("Negative")
elif a <= 0 <= b:
    print("Zero")
w = input()
flag = False
arr = []
for i in range(w):
  arr.append(i)
  
set_arr = list(set(arr))
for i in set_arr:
  cout_num = arr.count(i)
  if count_num % 2 != 0:
    flag = True
    break
if flag:
  print("No")
else:
  print("Yes")


### FIXED CODE ###

w = input()
flag = False
arr = []
for i in w:
  arr.append(i)
  
set_arr = list(set(arr))
for i in set_arr:
  count_num = arr.count(i)
  if count_num % 2 != 0:
    flag = True
    break
if flag:
  print("No")
else:
  print("Yes")
N = int(input())
A = list(map(int,input().split()))
ans = 0
while all( A%2 == 0 for a in A ):
    a = [ i/2 for i in a ]
    ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
while all(A%2 == 0 for A in a):
	a = [i/2 for i in a ]
	ans += 1
print(ans)
def main():
    x, y = map(int, input().split())
    d = {1: 30_000, 2: 20_000, 3: 10_000}
    a = 0
    a += d.get(x, 0)
    a += d.get(y, 0)
    a = a + 40_000 if a==60_000 else a
    print(a)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    x, y = map(int, input().split())
    def get_prize(a):
        if a==1:
            return 300000
        elif a==2:
            return 200000
        elif a==3:
            return 100000
        else:
            return 0
    a = 0
    a += get_prize(x)
    a += get_prize(y)
    a = a + 400000 if a==600000 else a
    print(a)

if __name__ == "__main__":
    main()
N = int(input())
candies_i = list(map(int, input().split()))
candies_j = list(map(int, input().split()))

l = []

for i range(N):
    total_li = sum(candies_i[:i])
    total_lj = sum(candies_j[i:])
    total = ( total_li + total_lj )
    l.append(total)

print(max(l))


### FIXED CODE ###

N = int(input())
candies_i = list(map(int, input().split()))
candies_j = list(map(int, input().split()))

l = []

for i in range(N):
    total_li = sum(candies_i[:i+1])
    total_lj = sum(candies_j[i:])
    total = total_li + total_lj
    l.append(total)

print(max(l))
n, m = [int(x) for x in input().split()]
img_a = [input() for _ in range(n)]
img_b = [input() for _ in range(m)]

found = False
for a in range(n - m + 1):
    border = 0
    isok = True
    while isok and not flag:
        for b in range(m):
            if img_b[b] in img_a[b+a][border:]:
                if b == 0:
                    index = img_a[a].index(img_b[0], border)
                current_index = img_a[b+a].index(img_b[b], border)
                if current_index == index:
                    continue
                elif current_index > index:
                    border = current_index
                    break
                else:
                    border = index
                    break
            else:   # if not substring in string.
                isok = False
                break

        else: # if not loop broken.
            ans = "Yes"
            found = True
            break
    if found:
        break
else: # if not 'found==True' even after last loop, then it means B is not in A.
    ans = "No"
        
print(ans)

### FIXED CODE ###

n, m = [int(x) for x in input().split()]
img_a = []
img_b = []

for i in range(n):
    img_a.append(input())

for i in range(m):
    img_b.append(input())

ans = "No"
for a in range(n - m + 1):
    border = 0
    flag = True
    while flag:
        for b in range(m):
            if img_b[b] in img_a[b+a][border:]:
                if b == 0:
                    index = img_a[a].index(img_b[0], border)
                current_index = img_a[b+a].index(img_b[b], border)
                if current_index == index:
                    continue
                elif current_index > index:
                    border = current_index
                    break
                else:
                    border = index
                    break
            else:   # if not substring in string.
                flag = False
                break

        else: # if not loop broken.
            ans = "Yes"
            break
        

print(ans)
N = int(input())
d = [int(x) for x in input().split()]
f = sum(d)
s = 0

for i in f:
  s += i * (f-i)

print(s//2)


### FIXED CODE ###

N = int(input())
d = [int(x) for x in input().split()]

f = sum(d)
s = 0

for i in d:
  s += i * (f-i)
print(s//2)
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix

n = int(input()) 
ixy = [[i] + [int(x) for x in input().split()] for i in range(n)]
f = []
t = []
d = []

ixy = sorted(ixy, key=lambda x:(x[1], x[2]))
for i in range(n-1):
    j, k = ixy[i][0], ixy[i+1][0]
    d.append(ixy[i+1][1] - ixy[i][1])
    f.append(j)
    f.append(k)

ixy = sorted(ixy, key=lambda x:(x[2], x[1]))
for i in range(n-1):
    j, k = ixy[i][0], ixy[i+1][0]
    d.append(ixy[i+1][2] - ixy[i][2])
    t.append(k)
    f.append(j)

csr_ = csr_matrix((d, (f, t)), shape=(n, n))
mst = minimum_spanning_tree(csr_).astype(int)
print(mst.sum())

### FIXED CODE ###

from operator import itemgetter
from scipy.sparse import csr_matrix
import numpy as np

N = int(input())

XY = [[i] + [int(x) for x in input().split()] for i in range(N)]

edge = set()
for key in [itemgetter(1),itemgetter(2)]:
  XY.sort(key = key)
  for i in range(N-1):
    i1,x1,y1 = XY[i]
    i2,x2,y2 = XY[i+1]
    d = min(abs(x1-x2),abs(y1-y2))
    edge.add((i1,i2,d))
    
# csr形式に直す
row,col,value = zip(*edge)
value = np.array(value,dtype=int)
graph = csr_matrix((value,(row,col)),shape=(N,N))

# 最小全域木
from scipy.sparse.csgraph import minimum_spanning_tree
tree = minimum_spanning_tree(graph, overwrite = True).astype(int)
answer = tree.sum()
print(answer)
a,b,c,d,e,f=map(int,input().split())
a*=100
b*=100
x=set()
for i in range(f//a+1):
    for j in range(f//b+1):
        if 0<(a*i+b*j)<=f:
            x.add(a*i+b*j)
y=set()
for i in range(f//c+1):
    for j in range(f//d+1):
        if 0<(c*i+d*j)<=f:
            y.add(c*i+d*j)

ans=[]
noudoma=e/100
for n in x:
    for m in y:
        if n==0:
            continue
        if m/n<=noudoma and (n+m)<=f:
            ans.append([n+m,m,m/(n+m)])

ans.sort(key=lambda x:x[2], reverse=True)


print(ans[0][0],ans[0][1])


### FIXED CODE ###

n=int(input())
a=int(input())

print(n**2-a)
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring = list(set(substring))
substring.sort()
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

### FIXED CODE ###

s = input()
K = int(input())
substr = set()
for i in range(len(s)):
    for j in range(i+1, i+K+1):
        substr.add(s[i:j])
print(sorted(substr)[K-1])
l = raw_int(input(),16).split()

if l[0] < l[1]:
  print("<")
elif l[0] = l[1]:
  print ("=")
elif l[0] > l[1]:
  print(">")

### FIXED CODE ###

l = input().split()
l2 = [int(s, 16) for s in l]

if l2[0] < l2[1]:
  print("<")
elif l2[0] == l2[1]:
  print ("=")
elif l2[0] > l2[1]:
  print(">")
N=int(input())
L=list(map(int,input().split()))

def mincost(n,cost,dp):
    if not dp.__contains__(n):
        if n==0:
            return 0
        elif n==1:
            dp[n]=abs(cost[1]-cost[0])
            return dp[n]
        else:
            dp[n]=min(abs(cost[n]-cost[n-1])+mincost(n-1,cost,dp),abs(cost[n]-cost[n-2])+mincost(n-2,cost,dp))
            return dp[n]
    else:
        return dp[n]
    
print(mincost(N-1,L,dict()))

### FIXED CODE ###

n=int(input())
c=list(map(int,input().split()))
dp=[0]
if n>1:
    dp.append(abs(c[1]-c[0]))
    for i in range(2,n):
        dp.append(min(dp[-1]+abs(c[i-1]-c[i]),dp[-2]+abs(c[i-2]-c[i])))
print(dp[-1])