Harryxun/stf_run huggingface dataset:
from collections import deque
n,m,k = map(int,input().split())
la = list(map(int,input().split()))
lb = list(map(int,input().split()))
ls = la + lb[::-1]
ls = deque(ls)
inf = float("inf")
dp = [[-inf]*(k+1) for _ in range(n+m+1)]
for j in range(k+1):
    dp[0][j] = 0
for i in range(n+m):
    if ls == deque([]):
        break
    elif ls[0] <= ls[-1]:
        s = ls.popleft()
    else:
        s = ls.pop()
    for l in range(k+1):
        if l-s >=0:
            dp[i+1][l] = max(dp[i][l],dp[i][l-s]+1)
        else:
            dp[i+1][l] = dp[i][l]
print(dp[-1][k])        

### FIXED CODE ###

n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
la = [0]
lb = [0]
mx = 0
for i in range(n): 
    if la[i] + a[i] > k:
        break
    la.append(la[i]+a[i])
for j in range(m):
    if lb[j] + b[j] > k:
        break
    lb.append(lb[j]+b[j])
now = len(lb)-1
for l in range(len(la)):
    cnt = l
    q = now
    while la[l] + lb[q] > k:
        q -= 1
    now = q
    cnt += q
    if cnt > mx:
        mx = cnt
print(mx)
input = sys.stdin.readline
 
n = int(input())
robots = []
for i in range(n):
    x, l = [int(item) for item in input().split()]
    robots.append((x+l, x-l))
 
robots.sort()
 
cnt = 0
node = -10**12
for end, start in robots:
    if start >= node:
        node = end
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
robots, count = [], 0
for x in range(N):
    X, L = map(int, input().split())
    robots.append((X+L, X-L))
robots.sort()
node = -10**12
for end, start in robots:
    if start >= node:
        node = end
        count += 1
print(count)
n=int(nput())
print('ABC' if n < 1200 else 'ARC' if 1200 <= n < 2800 else 'AGC')


### FIXED CODE ###

n=int(input())
print('ABC' if n < 1200 else 'ARC' if 1200 <= n < 2800 else 'AGC')
n=int(input())
a=list(map(int,input().split()))
c=[0]*n
c[0]=3
cnt=1
for i in a:
  cnt*=c[i]
  c[i]-=1
  c[i+1]+=1

print(cnt%1000000007)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
c=[0]*(n+1)
c[0]=3
cnt=1
for i in a:
  cnt=cnt*c[i]%1000000007
  c[i]-=1
  c[i+1]+=1
print(cnt)
age,money=map(float, input().split())
assert 1<=age<=100 and 2<=money<=1000 and money%2==0
if age<=5:
    print('0')
elif 6<=age<=12:
    print(money/2)
else:
    print(money)



### FIXED CODE ###

try:
    age,money=map(int, input().split())
    assert 0<=age<=100 and 2<=money<=1000 and money%2==0
    if age<=5:
        print('0')
    elif 6<=age<=12:
        print(money//2)
    else:
        print(money)
except AssertionError:
    print('')
from collections import deque

h,w = map(int,input().split())
ch, cw = map(int,input().split())
dh, dw = map(int,input().split())

G = []
for i in range(h):
    G.append(list(input()))

queue = deque([ch-1, cw-1])
S = [[float("inf")]*w for _ in range(h)]
S[ch-1][cw-1] = 0

while queue:
    y, x = queue.popleft()
    dx_dy = [[1,0],[0,1],[-1,0],[0,-1]]
    for i, j in dx_dy:
        if 0 <= x+i < h and 0 <= y < w:
            if S[y+j][x+i] > S[y][x] and G[y+j][x+i] == ".":
                S[y+j][x+i] = S[y][x]
                queue.appendleft((y+j, x+i))

    for i in range(-2, 3):
        for j in range(-2, 3):
            if i != 0 and j != 0:
                if 0 <= x+i < h and 0 <= y < w:
                    if S[y+j][x+i] > S[y][x] and G[y+j][x+i] == "."::
                        S[y+j][x+i] = S[y][x] + 1
                        queue.append((y+j, x+i))


if S[dh+1][dw+1] == float("inf"):
    print(-1)
else:
    print(S[dh-1][dw-1])


### FIXED CODE ###

from collections import deque


h, w = map(int,input().split())
ch, cw = map(lambda x: int(x) - 1, input().split())
dh, dw = map(lambda x: int(x) - 1, input().split())

G = []
for i in range(h):
    G.append(list(input()))

queue = deque([(ch, cw)])
S = [[float("inf")]*w for _ in range(h)]
S[ch][cw] = 0

while queue:
    y, x = queue.popleft()
    dx_dy = ((1,0),(0,1),(-1,0),(0,-1))
    ans = S[y][x]

    if (y, x) == (dh, dw):
            S[y][x] = ans
            break

    for j, i in dx_dy:
        if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
            queue.appendleft((y+j, x+i))
            S[y+j][x+i] = ans
            

    ans += 1
    for i in range(-2, 3):
        for j in range(-2, 3):
            if 0 <= x+i < w and 0 <= y+j < h and S[y+j][x+i] > ans and G[y+j][x+i] == ".":
                S[y+j][x+i] = ans
                queue.append((y+j, x+i))


if S[dh][dw] == float("inf"):
    print(-1)
else:
    print(S[dh][dw])
n = Input()
ht = false
for char in n:
       if char == ‘9’:
               ht = true
               break
 
if ht :
     print(“Yes”)
else : 
    print(“No”)

### FIXED CODE ###

n = input()
if n.find("9") >= 0:
  print("Yes")
else:
  print("No")
if S == "ARC":
    print("ABc")
else:
    print("ARC")

### FIXED CODE ###

S =input()
if S == "ARC":
    print("ABC")
else:
    print("ARC")
from collections import deque
def main():
    H,W,K = map(int,input().split())
    S = [[int(s) for s in input()]for _ in range(H)]
    ans = 2**60
    for i in range(2**(H-1)):
        aa = 0
        for j in range(H-1):
            if (i>>j)&1 == 1:
                aa+=1
        c = aa
        b = [0 for _ in range(c+1)]
        OK = True
        for j in range(W):
            k = 0
            for h in range(H):
                if S[h][j]:b[k] += 1
                if (i>>j)&1==1:k+=1
            
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:
                aa += 1
                b = [0]*(c+1)
                k = 0
                for h in range(H):
                    if S[h][j]:b[k] += 1
                    if (i>>j)&1==1:k+=1
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:OK = False;break                
    if OK:ans = min(ans,aa)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    H,W,K = map(int,input().split())
    S = [input()for _ in range(H)]
    ans = 10**9
    for i in range(2**(H-1)):
        aa = 0
        for j in range(H-1):
            if (i>>j)&1 == 1:
                aa+=1
        c = aa
        b = [0]*(c+1)
        OK = True
        for j in range(W):
            k = 0
            for h in range(H):
                if S[h][j] == "1":b[k] += 1
                if (i>>h)&1==1:k+=1
            
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:
                aa += 1
                b = [0]*(c+1)
                
                k = 0
                for h in range(H):
                    if S[h][j]=="1":b[k] += 1
                    if (i>>h)&1==1:k+=1
                ok = True
                for p in b:
                    if p > K:ok = False
                if not ok:OK = False;break                
        if OK:ans = min(ans,aa)
    print(ans)

if __name__ == "__main__":
    main()
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

node_num = int(input())
nodes=input().split()



for _ in range(node_num):
    route_list=[ 99999 for _ in range(node_num)]


mi_count=0
for i in range(node_num-1):
    if i+2<node_num:
        route_list[i][i+1]=abs(int(nodes[i+1])-int(nodes[i])) if abs(int(nodes[i+1])-int(nodes[i])) != 0 else 0.0000001
        route_list[i][i+2]=abs(int(nodes[i+2])-int(nodes[i])) if abs(int(nodes[i+2])-int(nodes[i])) != 0 else 0.0000001
    else:
        route_list[i][i+1]=abs(int(nodes[i+1])-int(nodes[i])) if abs(int(nodes[i+1])-int(nodes[i])) != 0 else 0.0000001


route_list = csr_matrix(route_list)
#print(route_list)
dist_matrix= dijkstra(csgraph=route_list, directed=False, indices=0, return_predecessors=False)

dis=dist_matrix[-1]

print(int(dis))

### FIXED CODE ###

N = int(input())
H = [0] + [int(h) for h in input().split()]
dp = [999999999 for _ in range(N + 1)]
dp[0] = 0
dp[1] = 0
dp[2] = abs(H[2] - H[1])
for i in range(3, N + 1):
    dp[i] = min(dp[i], dp[i - 1] + abs(H[i - 1] - H[i]), dp[i - 2] + abs(H[i - 2] - H[i]))

print(dp[N])
from collections import deque
from itertools import product
h, w = list(map(int,input().split()))
sy, sx = list(map(int,input().split()))
gy, gx = list(map(int,input().split()))
sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
 
G = [list(input()) for _ in range(h)]
G[sy][sx] = '#'
D = [[10**6]*w for _ in range(h)]
D[sy][sx] = 0
Q = deque([(sy, sx)])
while Q:
    y, x = Q.pop()
    d = D[y][x]
    for dy, dx in product(range(-2, 3), repeat=2):
        if dx+dy==0:
            G[y][x] = '#'
        ny, nx = y+dy, x+dx
        elif any((ny<0, h<=ny, nx<0, w<=nx)):
            continue
        elif G[ny][nx] == '#':
            continue
        elif abs(dy)+abs(dx)<=1 and D[ny][nx] > d:
            G[ny][nx] = '#'
            D[ny][nx] = d
            Q.append((ny, nx))
        elif D[ny][nx] > d+1:
            D[ny][nx] = d+1
            Q.appendleft((ny, nx))
            
if D[gy][gx] == 10**6:
    print(-1)
else:
    print(D[gy][gx])

### FIXED CODE ###

from collections import deque
from itertools import product
h, w = list(map(int,input().split()))
sy, sx = list(map(int,input().split()))
gy, gx = list(map(int,input().split()))
sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
 
G = [list(input()) for _ in range(h)]
D = [[10**6]*w for _ in range(h)]
D[sy][sx] = 0
Q = deque([(sy, sx)])
while Q:
    y, x = Q.pop()
    for dy, dx in product(range(-2, 3), repeat=2):
        ny, nx = y+dy, x+dx
        if dx==dy==0:
            G[y][x] = '#'
            continue
        elif ny<0 or h<=ny or nx<0 or w<=nx:
            continue
        elif G[ny][nx] == '#':
            continue
        elif abs(dy)+abs(dx)<=1:
            G[ny][nx] = '#'
            D[ny][nx] = D[y][x]
            Q.append((ny, nx))
        elif D[ny][nx] == 10**6:
            D[ny][nx] = D[y][x]+1
            Q.appendleft((ny, nx))
            
if D[gy][gx] == 10**6:
    print(-1)
else:
    print(D[gy][gx])
import math
A, B = map(double, input().split())
B *= 1000
mul = A * B
mul2 = math.floor(mul//1000)
print(mul2)

### FIXED CODE ###

import math
from decimal import Decimal

A, B = map(Decimal, input().split())
mul = A * B
mul2 = math.floor(mul)
print(mul2)
l = [i*100**d for i in range(1,n+1) if i*100**d % 100 != 0]

### FIXED CODE ###

d,n = map(int, input().split())
if n == 100:
    n += 1
a = n*100**d
print(a)
#intの場合


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

for i in range(len[huga]):
    if huga[i] == 0:
        print(huga[i])

### FIXED CODE ###

#intの場合


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

if huga[0] == 0:
    print(1)
if huga[1] == 0:
    print(2)
if huga[2] == 0:
    print(3)
if huga[3] == 0:
    print(4)
if huga[4] == 0:
    print(5)
from collections import deque
N = int(input())
lis = []

A = []
B = []
for i in range(N):
    Ain,Bin = map(int,input().split())
    A.append(Ain)
    B.append(Bin)
    lis.append((Ain+Bin,i))
lis.sort()
lis.reverse()
lis = deque(lis)

takacnt = 0
aocnt = 0

# print(taka)
# print(ao)

for i in range(N):
    if i % 2 == 0:
        val = lis.popleft()
        st.add(val[1])
        takacnt += A[val[1]]
    else:
        val = lis.popleft()
        st.add(val[1])
        aocnt += B[val[1]]
print(takacnt-aocnt)


### FIXED CODE ###

from collections import deque
N = int(input())
taka = []
ao = []
A = []
B = []
for i in range(N):
    Ain,Bin = map(int,input().split())
    A.append(Ain)
    B.append(Bin)
    taka.append((Bin+Ain,i))
    ao.append((Ain+Bin,i))
taka.sort()
taka.reverse()
ao.sort()
ao.reverse()
taka = deque(taka)
ao = deque(ao)
takacnt = 0
aocnt = 0
st = set()

# print(taka)
# print(ao)

for i in range(N):
    if i % 2 == 0:
        while True:
            val = taka.popleft()
            if not val[1] in st:
                break
        st.add(val[1])
        takacnt += A[val[1]]
    else:
        while True:
            val = ao.popleft()
            if not val[1] in st:
                break
        st.add(val[1])
        aocnt += B[val[1]]
print(takacnt-aocnt)
import sys
i = 1
while True:
    x = sys.stdin.read()
    if x.strip() == 0:
        break
    print('Case {}: {}'.format(i,x))
    x + 1

### FIXED CODE ###

l = []
y = 1
while True:
    x = int(input())
    if x == 0:
        break
    l.append(x)
    print('Case {}: {}'.format(y,x))
    y += 1
a,b,c=map(int,input());print(a*b//2)

### FIXED CODE ###

a,b,c=map(int,input().split());print(a*b//2)
import sys
h,w = map(int,input().split())
s = ['']*w
for i in range(h):
  s[i] = input()

for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      if j != w and s[i][j + 1] == '#':
        continue
      elif  j != 0 and s[i][j - 1] == '#':
        continue
      elif i != h and s[i + 1][j] == '#':
        continue
      elif i != 0 and s[i - 1][j] == '#':
        continue
      else:
        print('No')
        sys.exit()
print('Yes')
  

### FIXED CODE ###

import sys
h,w = map(int,input().split())
s = ['']*h
for i in range(h):
  s[i] = input()
 
black = False
for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      if j != w - 1:
        if s[i][j + 1] == '#':
          continue
      if  j != 0:
        if s[i][j - 1] == '#':
          continue
      if i != h - 1:
        if s[i + 1][j] == '#':
          continue
      if i != 0:
        if s[i - 1][j] == '#':
          continue
      print('No')
      sys.exit()       
print('Yes')
import math

n=int(input())
x = list(map(int, input().split()))
ans=0
mod=10**9+7


for i in range(1,n):
    print(x[n-1],x[i])
    ans+=(x[n-1]-x[i-1])/i
    ans%=mod

ans*=math.factorial(n-1)
ans%=mod

print(int(ans))

### FIXED CODE ###

import math

n = int(input())
x = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7
f = 1
for i in range(1,n):
  f *= i
  f %= mod

for i in range(n-1):
    ans+=(x[n-1]-x[i])*pow(i+1,mod-2,mod)

ans*=f
ans%=mod


print(ans)
a, b, c = map(int, input().split())
 if a < b < c:
   print('YES')
 elif a > b > c:
   print('NO')
 else:
   print('none')

### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b < c:
  print("Yes")
else:
  print("No")
a=set(list(map,input().split()))
print(len(a))

### FIXED CODE ###

a=set(map(int,input().split()))
print(len(a))
import sys
N = int(input())
H = list(map(int, input().split()))
if N == 1:
    print('Yes')
else:
    for i in range(1, N):
        if H[i] -H[i+1] > 1: print('No');sys.exit()
        elif H[i] - H[i+1] == 1: H[i] -= 1
        else: continue
    print('Yes')


### FIXED CODE ###

import sys
N = int(input())
H = list(map(int, input().split()))
if N == 1:
    print('Yes')
else:
    for i in reversed(range(N-1)):
        if H[i] -H[i+1] > 1: print('No');sys.exit()
        elif H[i] - H[i+1] == 1: H[i] -= 1
        else: continue
    print('Yes')
Num = int(input())
Indata = [0] * num;
Indata = [int(i) for i in input().split()]
MinVal = min(Indata)
MaxVal = max(Indata)
SumVal = sum(Indata)

print(Minval, MaxVal, SumVal)


### FIXED CODE ###

num = int(input())
inData = [0] * num
inData = [int(i) for i in input().split()]
minVal = min(inData)
maxVal = max(inData)
sumVal = sum(inData)

print(minVal, maxVal, sumVal)
N, M = map(int, input().split())
li = [[] for _ in range(N+1)]
for i in range(M):
    p, y = map(int, input().split())
    li[p].append([i, y])
ans = [0 for _ in range(M)]
for i in range(1, N+1):
    iy = li[i]
    iy.sort(key=lambda x: x[1])
    for j in range(len(iy)):
        ans[iy[j][0]] = (i, j+1)
for shi in ans:
    print(f'{shi[0]:06}{shi[1]:06}')

### FIXED CODE ###

N, M = map(int, input().split())
li = [[] for _ in range(N+1)]
for i in range(M):
    p, y = map(int, input().split())
    li[p].append([i, y])
ans = [0 for _ in range(M)]
for i in range(1, N+1):
    iy = li[i]
    iy.sort(key=lambda x: x[1])
    for j in range(len(iy)):
        ans[iy[j][0]] = (i, j+1)
for shi in ans:
    print('{:06d}{:06d}'.format(shi[0], shi[1]))
import math
a=int(input())
b=int(input())
h=int(input())
m=int(input())
rad=abs(math.radians(30*h-6*m))
if(rad>180):
    rad=2*math.pi()-rad
ans=a**2+b**2-2*a*b*math.cos(rad)
print(math.sqrt(ans))

### FIXED CODE ###

import math
a,b,h,m=map(int,input().split())
rad=abs(math.radians(30*(h+m/60)-6*m))
# if(rad>180):
#     rad=2*math.pi()-rad
ans=a**2+b**2-2*a*b*math.cos(rad)
print(math.sqrt(ans))
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

### FIXED CODE ###

a, b = map(int, input().split()) 
print((3*a + b) // 2)
h,w = map(int,input().split(" "))
if h == 1 or w == 1:
    print(1)
    exit()
if h % 2 == 0:
    print((h // 2) * w)
else:
    if w % 2 == 0:
        print((h // 2) * w + (w // 2))
    else:
        print((h // 2) * w + (w // 2) + 1)

### FIXED CODE ###

ar = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(ar[k-1])
N = int(input())

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

lis.sort()

Ans = 0

p = 0

while(True):
	
	if p >= N:
		break
	
	if lis[p] > lis.count(lis[p]):
		Ans += lis.count(lis[p])
		p += lis.count(lis[p])
	
	if lis[p] == lis.count(lis[p]):
		p += lis.count(lis[p])
	
	if lis[p] < lis.count(lis[p]):
		Ans += lis.count(lis[p]) - lis[p]
		p += lis.count(lis[p])
		
print(Ans)

### FIXED CODE ###

from collections import Counter

N = int(input())

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

counter = Counter(numList)

ans = 0

for k, v in counter.items():
	if(k == v):
		continue
	elif(k < v):
		ans += v-k
	elif(k > v):
		ans += v

print(ans)
s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
print(max(l))

### FIXED CODE ###

s = str(input())
w = ""
l = []
for i in s:
    if i=='A' or i=='C' or i=='G' or i=='T':
        w += i
    else:
        l.append(len(w))
        w = ""
l.append(len(w))
print(max(l))
# input
X = int( input() )
maxA = 1000
pow5 = list()
for aa in range(maxA):
    pow5.append( aa**5 )
    
# calc    
ans = False
a = 0
b = 0
for ii in range(maxA):  
    if( ans==False ):
        X1 = X - pow5[ii]
        X2 = X + pow5[ii]
        if( X1 in pow5 ):
            b = - ii
            a = pow5.index( X1 )
            ans = True
        
    if( ans==False ):
        if( X2 in pow5 ):
            b = ii
            a = pow5.index( X1 )
            ans = True

# out
print( str(a)+' '+str(b) )

### FIXED CODE ###

# input
X = int( input() )
maxA = 1000
pow5 = list()
for aa in range(maxA):
    pow5.append( aa**5 )
    
# calc    
ans = False
for ii in range(maxA):  
    if( ans==False ):
        X1 = X - pow5[ii]
        X2 = X + pow5[ii]
        if( X1 in pow5 ):
            b = - ii
            a = pow5.index( X1 )
            ans = True
        
    if( ans==False ):
        if( X2 in pow5 ):
            b = ii
            a = pow5.index( X2 )
            ans = True

# out
if(ans):
    print( str(a)+' '+str(b) )
from sys import stdin
input = stdin.readline

S = int(input())

A = [-1] * (S + 1)
mod = 10 ** 9 + 7

for i in range(3):
    A[i] = 0

for i in range(3, 6):
    A[i] = 1


def dfs(n):
    if A[n] != -1:
        return A[n]
    else:
        A[n] = (dfs(n - 3) + dfs(n - 1)) % mod
        return A[n]


print(dfs(S))


### FIXED CODE ###

from sys import stdin
input = stdin.readline

S = int(input())

A = [-1] * (2001)
mod = 10 ** 9 + 7

for i in range(3):
    A[i] = 0

for i in range(3, 6):
    A[i] = 1


def dfs(n):
    if A[n] != -1:
        return A[n]
    else:
        A[n] = (dfs(n - 3) + dfs(n - 1)) % mod
        return A[n]


print(dfs(S))
from collections import Counter

def fn(n):
    if n <= 1:
        return 0
    return n - 1 + fn(n-1)

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

c = Counter(A)
kumi = 0
for k, v in c.items():
    kumi += fn(v)

for ai in A:
    print(kumi - (c[ai] - 1))


### FIXED CODE ###

from collections import Counter
import sys

sys.setrecursionlimit(10**6)

def fn(n):
    if n <= 1:
        return 0
    return n - 1 + fn(n-1)

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

c = Counter(A)
kumi = 0
for k, v in c.items():
    kumi += fn(v)

for ai in A:
    print(kumi - (c[ai] - 1))
N=int(input())
# S=input()
S = ["#" for i in range(200000)]
S[0] = "."
S = "".join(S)
cnt1 = 0
cnt2 = 0
for idx,s in enumerate(S):
    if s == "#" and idx < N-1:
        cnt1+=1
    if s=="." and N==0:
        cnt2+=1
if cnt1 < cnt2:
    print(cnt1)
else:
    print(cnt2)

### FIXED CODE ###

X= [int(i) for i in input().split()]
if (X[0] > X[2] and X[1] < X[2]) or (X[0] < X[2] and X[1] > X[2]) :
    print("Yes")
else:
    print("No")
n = int(input())
s = list(map(int, input().split()))

dp = [[0 for _ in range(2 ** n)] for _ in range(18)]
dp[0] = [] + s

#for x in dp: print(x)

m = (n-1) ** 2
for a in range(n):
    #print(dp[a])
    for i in range(1 << (n-a-1)):
        #print(a, i)
        if dp[a][i*2] == dp[a][i*2+1]:
            print('No')
            exit()
        else:
            dp[a+1][i] = max(dp[a][i*2], dp[a][i*2+1])
    #m //= 2
    #print(dp[a+1])

print('Yes')

### FIXED CODE ###

n = int(input())
s = [list(map(int, input().split()))]

s[0].sort(reverse=True)

t = [s[0].pop(0)]
s.append([0 for _ in range(2 ** n - 1)])
a = 0
b = 1
p = 1
q = 2 ** n - 1
for _ in range(n):
    #print(s)
    j = 0
    k = 0
    for i in range(p):
        if j >= q:
            print('No')
            exit()
        #print(i, t, s)
        while t[i] <= s[a][j]:
            s[b][k] = s[a][j]
            j += 1
            k += 1
            if j >= q:
                print('No')
                exit()
        t.append(s[a][j])
        j += 1
    t.sort(reverse=True)

    #print(i, j, q)
    while j < q:
        s[b][k] = s[a][j]
        k += 1
        j += 1
    a, b = b, a
    #print(s)
    q -= p
    p *= 2
print('Yes')
nx = map(int, raw_input().split())
l = map(int, raw_input().split())

x = nx[1]

d = 0
i = 0

while d <= x:
    d = d + l[i]
    i = i + 1

print(i)


### FIXED CODE ###

nx = map(int, raw_input().split())
l = map(int, raw_input().split())
 
n = nx[0]
x = nx[1]
 
d = 0
i = 1
 
while True:
    if d <= x:
        d += l[i-1]
        i += 1
    if d > x:
        print(i-1)
        break
    if i == n + 1:
      print(i)
      break
def main():
    input = stdin.buffer.readline
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    e = [i * (i + 1) / (2 * i) for i in range(1, 1001)]

    sum = [0] * n
    sum[0] = e[p[0] - 1]
    for i in range(1, n):
        sum[i] = sum[i - 1] + e[p[i] - 1]

    max = sum[k - 1]
    for i in range(k, n):
        if max < sum[i] - sum[i - k]:
            max = sum[i] - sum[i - k]

    print(max)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit


def main():
    n, k = map(int, stdin.readline().split())
    p = list(map(int, stdin.readline().split()))

    sp = [0] * 1001

    for i in range(1, 1001):
        sp[i] = sum(range(i + 1)) / i

    summary = [0] * n
    summary[0] = sp[p[0]]
    for i in range(1, n):
        summary[i] = summary[i - 1] + sp[p[i]]

    max = summary[k - 1]
    for i in range(k, n):
        tmp = summary[i] - summary[i - k]
        if tmp > max:
            max = tmp
    print(max)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
N, M = list(map(int, input().split()))
a = []
b = []
c = []

for i in range(M):
    a_i, b_i, c_i = list(map(int, input().split()))
    a.append(a_i)
    b.append(b_i)
    c.append(c_i)


cost = [-float('inf') for i in range(N)]
cost[0] = 0
flag = True

while flag:
    for k in range(M):
        cost[b[k] - 1] = max(cost[b[k] - 1], cost[a[k] - 1] + c[k])
        if k == M - 2:
            flag = False

def check():
    for k in range(M):
        if cost[b[k] - 1] < cost[a[k] - 1] + c[k]:
            return 'inf'
    return cost[N - 1]




print(check())


### FIXED CODE ###

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

if c >= a and c <= b:
    print('Yes')
else:
    print('No')
import math
A, B = input().split()
B *= 100
print((A*B)/100))


### FIXED CODE ###

A, B = input().split()
BA, BB = B.split(".")
#print(A, BA, BB)
print((int(A)*(int(BA)*100+int(BB))//100))