Harryxun/stf_run huggingface dataset:
s=input()
t=input()
ls=len(s)
lt=len(t)
sa=[]

def change_to_a(sd):
    new_sd=""
    for i in range(len(sd)):
        if sd[i]=="?":
            new_sd+="a"
        else:
            new_sd+=sd[i]
    return new_sd

if lt > ls:
    print("UNRESTORABLE")
elif lt==ls:
    for i in range(ls):
        if s[j]!=t[j-i] and s[j]!="?":
            print("UNRESTORABLE")
            break
    else:
        print(t)
else:
    for i in range(0,ls-lt+1):
        for j in range(i,i+lt):
            if s[j]!=t[j-i] and s[j]!="?":
                break
            if j==i+lt-1:
                if i==0:
                    sa.append(t+change_to_a(s[lt:]))
                elif i==ls-lt:
                    sa.append(change_to_a(s[:ls-lt])+t)
                else:
                    sa.append(change_to_a(s[:i])+t+change_to_a(s[i+lt:]))

    if sa == []:
        print("UNRESTORABLE")
    else:
        print(min(sa))


### FIXED CODE ###

s=input()
t=input()
ls=len(s)
lt=len(t)
sa=[]

def change_to_a(sd):
    new_sd=""
    for i in range(len(sd)):
        if sd[i]=="?":
            new_sd+="a"
        else:
            new_sd+=sd[i]
    return new_sd

if lt > ls:
    print("UNRESTORABLE")
elif lt==ls:
    for i in range(ls):
        if s[i]!=t[i] and s[i]!="?":
            print("UNRESTORABLE")
            break
    else:
        print(t)
else:
    for i in range(0,ls-lt+1):
        for j in range(i,i+lt):
            if s[j]!=t[j-i] and s[j]!="?":
                break
            if j==i+lt-1:
                if i==0:
                    #print(0)
                    sa.append(t+change_to_a(s[lt:]))
                elif i==ls-lt:
                    #print(0)
                    sa.append(change_to_a(s[:ls-lt])+t)
                else:
                    #print(0)
                    sa.append(change_to_a(s[:i])+t+change_to_a(s[i+lt:]))

    if sa == []:
        print("UNRESTORABLE")
    else:
        print(min(sa))
if int(input()) % 2 == 0:
    print(int(input()) // 2)
else:
    print(int(input()) // 2 + 1)


### FIXED CODE ###

a = int(input())
if a % 2 == 0:
  print(a//2)
else:
  print(a//2 + 1)
n = [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(n[k+1]

### FIXED CODE ###

n = [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())-1
print(n[k])
from numba import njit

@njit('i8(i8)', cache=True)
def popcount(n):
    a = 0
    while n != 0:
        a += n & 1
        n >>= 1
    return a

@njit('i8(i8)', cache=True)
def fun(n):
    ops = 0
    while n:
        bits = popcount(n)
        n %= bits
        ops += 1
    return ops

def funwrap(n, pc):
    if n == 0:
        return 0
    return 1 + fun(n % pc)

n = int(input())
xs = list(map(int, input()))

from functools import reduce
sm = reduce(lambda x,y: x*2+y, xs)
pc = xs.count(1)

for i in range(n):
    df = 1 if xs[i] ^ 1 == 1 else -1

    dn = 1 << (n - (i + 1))
    smi = sm + dn * df
    pci = pc + df

    print(funwrap(smi, pci))


### FIXED CODE ###

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

a = sum(1 if d <= n and n % d == 0 else 0 for n in range(l, r+1))
print(a)
a=input()
b=a.replace(1,9)
c=b.replace(9,1)
print(b)

### FIXED CODE ###

a=int(input())
b=1110-a
print(b)
print(chr(ord((input())+1))

### FIXED CODE ###

print(chr(ord(input())+1))
N, H = map(int, input().split())
weapon = [list(map(int, input().split())) for _ in range(N)]

count = 0

max_atack = -1
for i in range(N):
    max_atack = max(max_atack, weapon[i][0]) 


flag = True
for i in range(N):
    if weapon[i][1] >= max_atack:
        count += 1
        H -= weapon[i][1]
        
        if H <= 0:
            flag = False
            break

if flag:
    if H % max_atack == 0:
        count += H // max_atack
    else:
        count += H // max_atack + 1


print(count)

### FIXED CODE ###

S = input()
S = S.replace('2017', '2018')

print(S)
N = int(input())
A = [map(int, input()split()) for _ in range(N)]
for i in range(N) :
    k = A[i]
    del A[i]
    print(max(A))
    A.insert(i, k)


### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
A_sort = sorted(A)
for i in range(N) :
    if A[i] == A_sort[-1] :
        print(A_sort[-2])
    else :
        print(A_sort[-1])
import sys

x = sys.argv[1]

x3 = x ** 3

print x3

### FIXED CODE ###

import sys

x = sys.stdin.readline()

x3 = int(x) ** 3

print x3
[A, B, C, D] = list(map(int, input().split()))
X = A / D
Y = C / B
if (X - Y) > 1 
    print('Yes')
else:
    if Y > X:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

[A, B, C, D] = list(map(int, input().split()))
while A > 0:
    C -= B
    if C <= 0:
        print('Yes')
        break
    A -= D
    if A <= 0:
        print('No')
        break
from heapq import heappush, heappop, heappushpop
def inpl(): return list(map(int, input().split()))

Q = int(input())
L = []
R = []

B = 0
M = 0

for _ in range(Q):
    q = inpl()
    if len(q) == 3:
        B += q[2]
        if len(R) == 0:
            L.append(-q[1])
            R.append(q[1])
            continue

        M += min(abs(-L[0] - q[1]), abs(R[0] - q[1])) * (not (-L[0] <= q[1] <= R[0]))
        if q[1] < R[0]:
            heappush(L, -q[1])
            heappush(R, -heappushpop(L, -q[1]))
        else:
            heappush(R, q[1])
            heappush(L, -heappushpop(R, Q[1]))
    else:
        print(-L[0], B+M)

### FIXED CODE ###

from heapq import heappush, heappop
def inpl(): return list(map(int, input().split()))

Q = int(input())
L = []
R = []

B = 0
M = 0

for _ in range(Q):
    q = inpl()
    if len(q) == 3:
        B += q[2]
        if len(R) == 0:
            L.append(-q[1])
            R.append(q[1])
            continue

        M += min(abs(-L[0] - q[1]), abs(R[0] - q[1])) * (not (-L[0] <= q[1] <= R[0]))
        if q[1] < R[0]:
            heappush(L, -q[1])
            heappush(L, -q[1])
            heappush(R, -heappop(L))
        else:
            heappush(R, q[1])
            heappush(R, q[1])
            heappush(L, -heappop(R))
    else:
        print(-L[0], B+M)
import sys
sys.setrecursionlimit(4 * (10 ** 9))
lst = [[1,2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
# print (A)

def num(k):
    return lst[k-1][1]

# for i in A:
    # print (num(i), end = ', ')
# print ()

INF = 10 ** 5
dp_lst = [-INF] * (N + 1)
dp_lst[0] = 0
def dp(i):
    if dp_lst[i] != -INF:
        return dp_lst[i]
    tmp = -INF
    for j in A:
        if i >= num(j):
            tmp = max(tmp, dp(i - num(j)) + 1)
    dp_lst[i] = tmp
    return dp_lst[i]

a = dp(N)
# print (a)
# print (dp_lst)   
# print ([0] * 10 +[i+1 for i in range(20)])

# print (len(str(71111111111111111111111111111111111111111111111111)))

def check(A):
    if dp_lst[N-num(A)] == dp_lst[N] - 1:
        return True
    else:
        return False

# print (a)
while a > 0:
    for i in A:
        if check(i):
            print (i, end = '')
            N -= num(i)
            a -= 1
            break
        else:
            pass
            # print ('B')
print ()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)
lst = [[1,2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
# print (A)

def num(k):
    return lst[k-1][1]

# for i in A:
    # print (num(i), end = ', ')
# print ()

INF = 10 ** 5
dp_lst = [-INF] * (N + 1)
dp_lst[0] = 0
def dp(i):
    if dp_lst[i] != -INF:
        return dp_lst[i]
    tmp = -INF
    for j in A:
        if i >= num(j):
            tmp = max(tmp, dp(i - num(j)) + 1)
    dp_lst[i] = tmp
    return dp_lst[i]

a = dp(N)
# print (a)
# print (dp_lst)   
# print ([0] * 10 +[i+1 for i in range(20)])

# print (len(str(71111111111111111111111111111111111111111111111111)))

def check(A):
    if N - num(A) < 0:
        return False
    if dp_lst[N-num(A)] == dp_lst[N] - 1:
        return True
    else:
        return False

# print (a)
while a > 0:
    for i in A:
        if check(i):
            print (i, end = '')
            N -= num(i)
            a -= 1
            break
        else:
            pass
            # print ('B')
print ()
N,K = map(int,input().split())
h_s = list(map(int,input().split()))
INF = 1000000
dp = [INF]*N
dp[0] = 0
K = min(K,N-1)
for i in range(1,K):
    for j_j in range(i):
        j = j_j + 1
        dp[i] = min((dp[i-j] + abs(h_s[i] - h_s[i-j])),dp[i])
    print(dp)
for i in range(K,N):
    for j_j in range(K):
        j = j_j + 1
        dp[i] = min((dp[i-j] + abs(h_s[i] - h_s[i-j])),dp[i])
    print(dp)
print(dp[-1])


### FIXED CODE ###

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

dp = [1e9]*N
dp[0] = 0
for i, b in enumerate(H):
  if i != 0:
    x = max(0, i-K)
    dp[i] = min([abs(b-d)+p for d, p in zip(H[x:i], dp[x:i])])
print(dp[-1])
N,M = (int(x) for x in input().split(" "))
List= [int(y) for y in input().split(" ")]

if sum(List)>N:
  print(-1)
else:
  print(N -sum(List))

### FIXED CODE ###

import math
a = input()
b = math.pi
print(2*int(a)*b)
import sys
h,w,m = map(int,input().split())
h_lst = [[0,i] for i in range(h)]
w_lst = [[0,i] for i in range(w)]
memo = []

for i in range(m):
  x,y = map(int,input().split())
  h_lst[x-1][0] += 1
  w_lst[y-1][0] += 1
  memo.append((x-1,y-1))

h_lst.sort(reverse = True)
w_lst.sort(reverse = True)
Max_h = h_lst[0][0]
Max_w = w_lst[0][0]
h_ans = [h_lst[0][1]]
w_ans = [w_lst[0][1]]
if h != 1:
  s = 1
  while h_lst[s][0] == Max_h:
    h_ans.append(h_lst[s][1])
    s+= 1  
if w!= 1:  
  t=1  
  while w_lst[t][0] == Max_w:
    w_ans.append(w_lst[t][1])
    t += 1
  

memo = set(memo)

#探索するリストは、最大を取るものの集合でなければ計算量はO(m)にはならない！             
for j in h_ans:
  for k in w_ans:
    if (j,k) not in memo:
      print(Max_h+Max_w)
      sys.exit()
print((Max_h+Max_w)-1)        
  



### FIXED CODE ###

import sys
h,w,m = map(int,input().split())
h_lst = [[0,i] for i in range(h)]
w_lst = [[0,i] for i in range(w)]
memo = []

for i in range(m):
  x,y = map(int,input().split())
  h_lst[x-1][0] += 1
  w_lst[y-1][0] += 1
  memo.append((x-1,y-1))

h_lst.sort(reverse = True)
w_lst.sort(reverse = True)
Max_h = h_lst[0][0]
Max_w = w_lst[0][0]
h_ans = [h_lst[0][1]]
w_ans = [w_lst[0][1]]
if h != 1:
  s = 1
  while s < h and h_lst[s][0] == Max_h:
    h_ans.append(h_lst[s][1])
    s+= 1  
if w!= 1:  
  t=1  
  while t < w and w_lst[t][0] == Max_w:
    w_ans.append(w_lst[t][1])
    t += 1
  

memo = set(memo)

#探索するリストは、最大を取るものの集合でなければ計算量はO(m)にはならない！             
for j in h_ans:
  for k in w_ans:
    if (j,k) not in memo:
      print(Max_h+Max_w)
      sys.exit()
print((Max_h+Max_w)-1)
a=input()
b=input()
c=input()
  
a=int(a)
b=int(b)
c=int(c)
x=int(x)

x=b//a
  
if x>=c:
  print(c)
else 
  print(x)


### FIXED CODE ###

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

x=b//a
x=int(x)

if x>=c:
  print(c)
else :
  print(x)
# 168 B
K = int(input())
S = input()
if len(str(S)) =< K:
    print(S)
else:
    print(S[:K]+'...')

### FIXED CODE ###

# 168 B
K = int(input())
S = input()
if len(str(S)) <= K:
    print(S)
else:
    print(S[:K]+'...')
import math
N = input()
N = int(N)
x = N / 3
x = int(x)
p = 10 ** 9 + 7
sum = 0
if x == 0:
  print(0)
else:
  for k in range(x):
    y =  N - 3*k - 3
    l = k 
    M = y + l
    a = math.factorial(l)
    b = math.factorial(M) 
    c = math.factorial(y)
    z = b / a / c 
    z = z % p
    sum += z
    sum = sum %p

  sum = int(sum)
  print(sum)

  

  

### FIXED CODE ###

import math
N = input()
N = int(N)
x = N // 3
x = int(x)
p = 10 ** 9 + 7
sum = 0
if x == 0:
  print(0)
else:
  for k in range(x):
    y =  N - 3*k - 3
    l = k 
    M = y + l
    a = math.factorial(l)
    b = math.factorial(M) 
    c = math.factorial(y)
    d = a * c
    z = b // d
    z = z % p
    sum += z
    sum = sum %p

  sum = int(sum)
  print(sum)
S = input()
K = int(input())
N = len(S)
cnt = 0
flg1 = False
flg2 = False
flg3 = False
flg4 = False
if N == 2:
    a = S[10000]
for i in range(N-1):
    if S[i] != S[i+1]:
        flg3 = True
        break
if (flg3 == False) and N % 2 == 1:
    print((N*K)//2)
    exit()
if (S[0] == S[N-1]) and K != 1:
    if S[0] != S[1]:
        cnt += 1
        flg1 = True
if (S[N-2] == S[N-1]):
    flg4 = True
for i in range(N-1):
    if flg2:
        flg2 = False
        continue
    if (i == N - 2) and flg1:
        break
    if S[i] == S[i+1]:
        cnt += 1
        flg2 = True
if flg1 and flg4 == False:
    print(cnt*K-1)
else:
    print(cnt*K)

### FIXED CODE ###

def f(s,n):
    res = 0
    flg = False
    for i in range(1,n):
        if flg:
            flg = False
            continue
        if S[i] == S[i-1]:
            flg = True
            res += 1
    return res
S = input()
K = int(input())
if len(set(list(S))) == 1:
    print(len(S)*K//2)
    exit()
ans = f(S,len(S))
S = S * 2
print(ans + (f(S,len(S)) - ans) * (K-1))
def divide(x, y):
    s = 1
    if(x < 0):s *= -1
    if(y < 0):s *= -1
    if x == 0:exit()
    return abs(x) / abs(y) * s     
 
def _split(_src):
    c = 0
    l = len(_src)
    if l == 0:
        return []
    while c < l and ord('0') <= ord(_src[c]) <= ord('9'):
        c += 1
    if c == 0:
        return [_src[0]] + _split(_src[1:])
    else:
        return [int(_src[:c])] + _split(_src[c:])
         
 
def evaluate(src):
    if len(src) == 1:
        return src[0]
         
    if "(" in src:
        l = src.index("(")
        r = len(src) - 1 - src[::-1].index(")")
        mid = evaluate(src[l + 1:r])
        return evaluate( src[:l] + [mid] + src[r + 1:])
     
    operators = [("+", lambda x,y:x + y),
                 ("-", lambda x,y:x - y),
                 ("*", lambda x,y:x * y),
                 ("/", divide)
                ]  
     
    for (op,func) in operators:
        if op in src:
            p = src.index(op)
            l = evaluate(src[:p])
            r = evaluate(src[p + 1:])
            return func(l, r)
     
for t in xrange(input()):
    _src = raw_input()[:-1]
    src = _split(_src)
    print evaluate(src)

### FIXED CODE ###

def divide(x, y):
    s = 1
    if(x < 0):s *= -1
    if(y < 0):s *= -1
    return abs(x) / abs(y) * s     

operator = {"+":(lambda x,y: x+y),
            "-":(lambda x,y: x-y),
            "*":(lambda x,y: x*y),
            "/":divide
            }

def ind(src, x):
    if x not in src:return 1<<30
    return src.index(x)
 
def _split(_src):
    c = 0
    l = len(_src)
    if l == 0:
        return []
    while c < l and ord('0') <= ord(_src[c]) <= ord('9'):
        c += 1

    if c == 0:
        return [_src[0]] + _split(_src[1:])
    else:
        return [int(_src[:c])] + _split(_src[c:])
         
 
def evaluate(src):
    if len(src) == 1:
        return src[0]
         
    if "(" in src:
        l = src.index("(")
        r = l
        st = 1
        while st:
            r += 1
            if src[r] == "(": st += 1
            if src[r] == ")": st -= 1
        
        mid = evaluate(src[l + 1:r])
        return evaluate( src[:l] + [mid] + src[r + 1:])
    
    pos = min(ind(src, "*"), ind(src,"/"))
    if(pos == 1<<30):
        pos = min(ind(src, "+"), ind(src, "-"))
    op = src[pos]
    l, r = src[pos - 1], src[pos + 1]
    mid = operator[op](l, r)
    return evaluate(src[:pos - 1] + [mid] + src[pos + 2:])

     
for t in xrange(input()):
    _src = raw_input().strip("=")
    src = _split(_src)
    print evaluate(src)
a,b,c=map(int,input().split())
if abs(a-c)<=d:
  print('Yes')
elif abs(a-b)<=d and abs(a-c)<=d:
  print('Yes')


### FIXED CODE ###

a,b,c,d=map(int,input().split())
if abs(a-c)<=d:
  print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')
N = int(input())
A = list(map(int,input().split()))
B = [-10000 for i in range(N)]
for i in range(N):
    if (N-i)%2 != 0:#from front
        index = (N-i)//2
        B[index] = A[i]
    else:# from backward
        index = N - (N-i)//2
        B[index] = A[i]
print(" ".join(B))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [-10000 for i in range(N)]
for i in range(N):
    if (N-i)%2 != 0:#from front
        index = (N-i)//2
        B[index] = A[i]
    else:# from backward
        index = N - (N-i)//2
        B[index] = A[i]
ans = ''
for e in B:
    ans += str(e)+' '
print(ans[:-1])
n = int(input())
count = 1
rcount = 1
h = list(map(int,input().split()))
for i in range(n-1):
    if h[i] >= h[i + 1]:
        count += 1
    else:
        recount = max(recount,count)
        count = 0
print(max(recount,count))


### FIXED CODE ###

n = int(input())
count = 0
recount = -1
h = list(map(int,input().split()))
for i in range(n-1):
    if h[i] >= h[i + 1]:
        count += 1
    else:
        recount = max(recount,count)
        count = 0
print(max(recount,count))
import sys

for line in sys.stdin:
    result =, 0
    d = int(line)
    x = d
    while x < 600:
        result += x**2 * d
    print result

### FIXED CODE ###

import sys

for line in sys.stdin:
    result = 0
    d = int(line)
    x = d
    while x < 600:
        result += x**2 * d
        x += d
    print result
s = input()
n = len(s)

res = 0

def part_sum(cur, i):
  if i != n:
    part_sum(cur+s[i], i+1)
    part_sum(cur+"+"+s[i], i+1)
  else:
    cur += s[i]
    res += sum(list(map(int, res.split("+")))) 
  
part_sum([], 0)
print(res)

### FIXED CODE ###

s = input()
n = len(s)

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))
s,l=map(int,input().split())
m=sorted([input() for _ in range(l)])
print("".join(m))


### FIXED CODE ###

n,l=map(int,input().split())
m=sorted([input() for _ in range(n)])
print("".join(m))
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

cnt = 0

for i in range(n):
  if i == 0 and a[i+1] == a[i]:
    continue
  elif i == n-1 and a[i-1] == a[i]:
    continue
  elif i > 0 and i < n-1 and (a[i+1] == a[i] or a[i-1] == a[i]):
    continue
  
  flag = True
  for j in range(i):
    if a[i] % a[j] == 0:
      flag = False
      break
  if flag:
    cnt += 1
    
print(cnt)
  

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
m = [True] * (10**6+1)
s = list(set(a))
for u in s:
    t = u * 2
    while t <= 10 ** 6:
        m[t] = False
        t += u
r = 0
for u in s:
    if c[u] == 1 and m[u] == True:
        r += 1
print(r)
import sys
sys.setrecursionlimit(200000)

from collections import deque

n, m, p = map(int, input().split())
edge = [[] for _ in range(n)]
coin = [[0]*n for _ in range(n)]
for i in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    coin[a][b] = c - p


visited = [0] * n
def dfs(v):
    for u in edge[v]:
        if visited[u] == 0:
            visited[u] = 1
            dfs(u)
visited[0] = 1
dfs(0)
# print(visited)
flag = [vi for vi in visited]

def dfs2(v):
    for u in edge[v]:
        if u == n - 1:
            visited2[u] = 1
            break
        if visited2[u] == 0:
            visited2[u] = 1
            dfs2(u)

for i in range(1, n):
    if flag[i] == 0:
        continue
    visited2 = [0] * n
    visited2[i] = 1
    dfs2(i)
    if visited2[n-1] == 0 and flag[i] == 1:
        flag[i] = 0

# print(flag)
target_v = set([i for i in range(n) if flag[i] == 1])
# print(target_v)

q = deque()
visited3 = [0] * n
visited3[0] = 1
q.append((0, 0, visited3))
ans = [0] * n
iter = 0
impossible = False
while q:
    v, c, visited3 = q.popleft()
    for u in edge[v]:
        if u not in target_v:
            continue
        if visited3[u] == 0:
            ans[u] = c + coin[v][u]
            visited3[u] = 1
            q.append((u, c + coin[v][u]))
        else:
            if ans[u] <= c + coin[v][u]:
                impossible = True
                break

    if impossible:
        break

if impossible:
    print(-1)
else:
    print(max(0, ans[n-1]))


### FIXED CODE ###

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

INF = float('inf')
d = [INF] * n
d[0] = 0
for i in range(n):
    for v_from, v_to, cost in edge:
        if d[v_from] != INF and d[v_to] > d[v_from] + cost:
            d[v_to] = d[v_from] + cost

exist = True
for i in range(n):
    for v_from, v_to, cost in edge:
        if d[v_from] != INF and d[v_to] > d[v_from] + cost:
            d[v_to] = d[v_from] + cost
            if v_to == n - 1:
                exist = False

if not exist:
    print(-1)
else:
    print(max(0, -d[n-1]))
# coding: utf-8
# Your code here!

a, b = 12, 10


takahashi = 0
 
# till last month
for x in range(1, a-1):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(i, b+1):
    if x == a:
        takahashi += 1
print(takahashi)

### FIXED CODE ###

a, b = map(int, input().split())
takahashi = 0
 
for x in range(1, a):
    for y in range(1, 31):
        if x == y:
            takahashi += 1
 
for x in range(1, b+1):
    if x == a:
        takahashi += 1
print(takahashi)
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
        tmp = tmp/2
	p = p+tmp
print(p)

### FIXED CODE ###

a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
		tmp = tmp/2
	p = p+tmp
print(p)
A,B,K = map(int, input().split())
L = list(range(A,B+1))
left = list(set(L[:K]))
right = list(set(L[-K:]))
N = sorted(list(set(left + right)))
for i in range(len(N)):
  print(N[i])

### FIXED CODE ###

a,b,k = map(int,input().split())
if (b-a+1) >= (2*k):
  for i in range(k):
    print(a+i)
  for i in reversed(range(0,k)):
    print(b-i)
else:
  for i in range(a,b+1):
    print(i)
n = int(intput_n)
l = [int(x) for x in input_l.split()]
max_h = l[0]
result = 1
for i in range(1,n):
    if max_h <= l[i]:
        result += 1
        max_h = l[i]
    else:
        continue
print(result)

### FIXED CODE ###

n = int(input())
l = [int(x) for x in input().split()]
max_h = l[0]
result = 1
for i in range(1,n):
    if max_h <= l[i]:
        result += 1
        max_h = l[i]
    else:
        continue
print(result)
import decimal
import math
a,b=map(str,input().split())
c=Decimal('a')
d=Decimal('b')
e=c*d
f=math.floor(e)
print(f)

### FIXED CODE ###

from decimal import *
import math
a,b=map(str,input().split())
c=Decimal(a)
d=Decimal(b)
e=Decimal(c*d)
f=math.floor(e)
print(f)