Harryxun/stf_run huggingface dataset:
N,M = list(map(int,input().split()))

edges = [[] for _ in range(N)]

for i in range(M):
    L,R,D = list(map(int,input().split()))
    edges[L - 1].append((R -1,D))
    edges[R - 1].append((L-1, -D))


visited = [None] * N
place = [0] * N
inf = 10 ** 10


def walk(i):
    if visited[i]:
        return (place[i], place[i])
    visited[i] = True
    (n,m) = (inf, - inf)
    for j,d in edges[i]:
        #print(j,d)
        if visited[j] and place[j] != place[i] + d:
            print("No")
            exit()
        place[j] = place[i] + d
        (x,y) = walk(j)
        (n,m) = (min(n,x),max(m,y))
    return (n,m)

for i in range(N):
    if not visited[i]:
        place[i] = 0
    # 連結成分のminとmax
        (n,m) = walk(i)
        if m - n > 10 ** 9:
            print("No")
            exit()
print("Yes")

### FIXED CODE ###

from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

setrecursionlimit(1000000)
N,M = list(map(int,input().split()))

edges = [[] for _ in range(N)]

for i in range(M):
    L,R,D = list(map(int,input().split()))
    edges[L - 1].append((R -1,D))
    edges[R - 1].append((L-1, -D))


visited = [None] * N
place = [0] * N
inf = 10 ** 10


def walk(i):
    if visited[i]:
        return (place[i], place[i])
    visited[i] = True
    (n,m) = (inf, - inf)
    for j,d in edges[i]:
        #print(j,d)
        if visited[j] and place[j] != place[i] + d:
            print("No")
            exit()
        place[j] = place[i] + d
        (x,y) = walk(j)
        (n,m) = (min(n,x),max(m,y))
    return (n,m)


for i in range(N):
    if not visited[i]:
        place[i] = 0
    # 連結成分のminとmax
        (n,m) = walk(i)
        if m - n > 10 ** 9:
            print("No")
            exit()

print("Yes")
import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) == 0 or len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if d[(line[i],line[i+1])]:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans

### FIXED CODE ###

import sys

s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
    for t in range(1, 6):
        d[(str(y),str(t))] = s[0]
        s = s[1:]

for line in sys.stdin:
    line = line.rstrip()
    if len(line) % 2 != 0:
        print 'NA'
        continue
    ans = ''
    for i in range(0, len(line), 2):
        if (line[i],line[i+1]) in d:
            ans += d[(line[i],line[i+1])]
        else:
            print 'NA'
            break
    else:
        print ans
K = int(input())
list = [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]
print(list[K])

### FIXED CODE ###

K = int(input())
list = [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]
print(list[K-1])
# -*- coding: utf-8 -*-
import math
from scipy.special import comb
#from operator import mul
#from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

X,Y = (int(x) for x in input().split())
count = 0
if (X+Y)%3!=0 or 2*X<Y or 2*Y<X:
    print("0")
    exit()
else:
    N=(X+Y)/3 # 合計移動回数
    mov_x=(2*X-Y)/3 #(2,1)の移動回数 ]

    #print(combinations_count(N, mov_x)%(pow(10,9)+7))
    #print(comb(N, mov_x, exact=True)%(pow(10,9)+7))
    print(cmb(int(N), int(mov_x))%(pow(10,9)+7))


### FIXED CODE ###

# -*- coding: utf-8 -*-

mod = int(1e9+7)

def comb_mod(n, r, mod):
    if n < r:
        return 0
    elif n < 0 or r < 0:
        return 0
    else:
        fac = [1, 1]
        finv = [1, 1]
        inv = [0, 1]
        for i in range(2, n + 1):
            fac.append(fac[-1] * i % mod)
            inv.append(-inv[mod % i] * (mod // i) % mod)
            finv.append((finv[-1] * inv[-1]) % mod)
        return int(fac[n] * finv[r] * finv[n - r] % mod)

X,Y = (int(x) for x in input().split())
count = 0
if (X+Y)%3!=0 or 2*X<Y or 2*Y<X:
    print("0")
    exit()
else:
    N=(X+Y)/3 # 合計移動回数
    mov_x=(2*X-Y)/3 #(+2,+1)の移動回数
    print(comb_mod(int(N), int(mov_x), mod))
if k<=a:
    print(k)
else:
    x = k-a
    if x<=b:
        print(a)
    else:
        print(a-(x-b))

### FIXED CODE ###


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

if k<=a:
    print(k)
else:
    x = k-a
    if x<=b:
        print(a)
    else:
        print(a-(x-b))
all=input().split()
T=all[0]
X=all[1]
round(T/X,10)

### FIXED CODE ###

all=input().split();T=int(all[0]);X=int(all[1]);print(str(round(T/X,10)))
import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))

A=np.array(A)

A_pos=np.sort(A[A>0])
A_neg=np.sort(A[A<0])
A_neg2=np.sort(-A_neg)

np=len(A_pos)
nn=len(A_neg)
nz=N-np-nn
n_post=np*(np-1)//2+(nn*(nn-1))//2
n_zero=nz*(np+nn)+nz*(nz-1)//2
n_neg=np*nn

#array内で積がx未満になるペアの数
def syakutori_pos1(x):
    res=0
    j=n-1
    for i in range(n_pos):
        tmp=0
#         j=n-1
        y=-(-x//A_pos[i])
        while j!=-1:
            
            if A_pos[j]>=y:
                j-=1
            else:
                break
        
        tmp+=j+1
        if A_pos[i]**2<x:
            tmp-=1

        res+=tmp
    res=res//2
    return res

def syakutori_pos2(x):
    res=0
    j=n-1
    for i in range(n_neg):
        tmp=0
#         j=n-1
        y=-(-x//A_neg2[i])
        while j!=-1:
            
            if A_neg2[j]>=y:
                j-=1
            else:
                break
        
        tmp+=j+1
        if A_neg2[i]**2<x:
            tmp-=1

        res+=tmp
    res=res//2
    return res


#array内で積がx未満になるペアの数
def syakutori_neg(x):
    y=x//A_neg
#     print(A_pos,y)
    res=0
    i=0
    j=np-1
    for z in reversed(y):
        while(j!=-1):
            if z<A_pos[j]:
                j-=1
            else:
                break
#         print(z,j+1)
        res+=j+1
    return np*nn-res



def syakutori(x):
    if x>0:
        return syakutori_pos1(x)+syakutori_pos2(x)+n_neg+n_zero
    elif x==0:
        return n_neg
    else:
        return syakutori_neg(x)




r=10**18
l=-10**18
while(r-l>1):
    mid=(l+r)//2
    z=syakutori(mid)
#     z= count_pair(mid)
#     print(l,r)
    if z < K:
        l=mid
    else:
        r=mid
print(l)

### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
A=list(map(int,input().split()))

A=np.array(A)

A_pos=np.sort(A[A>0])
A_neg=np.sort(A[A<0])
A_neg2=-A_neg[::-1]
n_pos=len(A_pos)
n_neg=len(A_neg)
n_zero=N-n_pos-n_neg

def position_in_neg(x):
    y=n_pos-np.searchsorted(A_pos,x//A_neg,side='right')
    return y.sum()

def position_in_pos(x):
    z=np.searchsorted(A_pos,-(-x//A_pos),side='left')
    w=np.searchsorted(A_neg2,-(-x//A_neg2),side='left')
    tmp=len(A_pos[A_pos**2<x])+len(A_neg2[A_neg2**2<x])
    return (z.sum()+w.sum()-tmp)//2

def position(x):
    if x<0:
        return position_in_neg(x)
    elif x==0:
        return n_pos*n_neg
    else:
        return position_in_pos(x)+n_pos*n_neg+(n_pos+n_neg)*n_zero+n_zero*(n_zero-1)//2

l=-pow(10,18)
r=pow(10,18)
while(r-l>1):
    mid=(l+r)//2
    if position(mid)<K:
        l=mid
    else:
        r=mid
print(l)
n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)

# print(first_digit)
t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10
print(t - (10 - min(first_digit)))

### FIXED CODE ###

n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)


# print(first_digit)
t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10
if len(first_digit) == 0:
    print(t)
else:
    print(t - (10 - min(first_digit)))
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
print(*(A[::-2]+A[N%2::2]))
m = map(int,raw_input().split())
for i in range(1,len(m)+1):
 if(m[i-1]==0):
  break
 print"Case %d* %d",%(i,m[i-1])

### FIXED CODE ###

i=0

while True:
    a = int(input())
    if(a==0):
      break
    i = i+1
    print "Case %d: %d" %  (i,a)
from math import sqrt, ceil

primes = [2]
for n in range(3, 101):
    if any(n % i == 0 for i in range(2, n)):
        continue
    primes.append(n)

def fact(n):
    p = 1
    for i in range(2, n+1):
        p *= i
    return p

def calc_factors(n):
    factors = {}
    for p in primes:
        while n % p == 0:
            factors[p] = factors.get(p, 0)+1
            n //= p
    return factors

def solve(N):
    n = fact(N)
    factors = calc_factors(n)
    print("fact(%d)=%d" % (N, n))
    print("factors=", factors)
    #print("factors=", calc_factors(32400))
    print((2**8)*(3**4)*(5**2)*7)

    nums = {}
    for p, c in factors.items():
        if c >= 2:
            nums[3] = nums.get(3,0)+1
        if c >= 4:
            nums[5] = nums.get(5,0)+1
        if c >= 14:
            nums[15] = nums.get(15,0)+1
        if c >= 24:
            nums[25] = nums.get(25,0)+1
        if c >= 74:
            nums[75] = nums.get(75,0)+1
    print(sum([
            nums[5] * (nums[5] - 1) * (nums[3]-2) // 2,
            nums[15] * (nums[5] - 1) ,
            nums[25] * (nums[3] - 1) ,
            nums[75] ]))
N = int(input())
solve(N)


### FIXED CODE ###


from math import sqrt, ceil

primes = [2]
for n in range(3, 101):
    if any(n % i == 0 for i in range(2, n)):
        continue
    primes.append(n)

def fact(n):
    p = 1
    for i in range(2, n+1):
        p *= i
    return p

def calc_factors(n):
    factors = {}
    for p in primes:
        while n % p == 0:
            factors[p] = factors.get(p, 0)+1
            n //= p
    return factors

def solve(N):
    n = fact(N)
    factors = calc_factors(n)

    nums = {3:0,5:0,15:0,25:0,75:0}
    for p, c in factors.items():
        if c >= 2:
            nums[3] = nums.get(3,0)+1
        if c >= 4:
            nums[5] = nums.get(5,0)+1
        if c >= 14:
            nums[15] = nums.get(15,0)+1
        if c >= 24:
            nums[25] = nums.get(25,0)+1
        if c >= 74:
            nums[75] = nums.get(75,0)+1
    print(sum([
            nums[5] * (nums[5] - 1) * (nums[3]-2) // 2,
            nums[15] * (nums[5] - 1) ,
            nums[25] * (nums[3] - 1) ,
            nums[75] ]))
N = int(input())
solve(N)
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
edge = [[] for _ in range(N)]
for idx, (a, b) in enumerate(ab):
    a, b = a-1, b-1
    edge[a].append([b, a, 0, idx])

next_list = []
now_list = [0]
colors = [0] * (N-1)
color_list = set()
now_color = 2
max_color = 0
while len(now_list) > 0:
    for v in now_list:
        for idx, nextv in enumerate(edge[v]):
            if v == nextv[0]:
                continue
            colors[nextv[0]] += 1
            edge[v][idx][2] = colors[nextv[0]]
            max_color = max(max_color, now_color-1)
            next_list.append(nextv[0])
    
    now_list = list(next_list)
    next_list = []

ret = []
for ed in edge:
    for e in ed:
        ret.append(e)
ret.sort(key=lambda  x:x[3])
print(max_color)
for ed in ret:
    print(ed[2])


### FIXED CODE ###

class ColorMgmt:
    from heapq import heappop, heappush
    def __init__(self, n):
        self.colors_hash = [set() for _ in range(n)]
        self.next_colors = [1] * n
    
    def set_color(self, v, c):
        self.colors_hash[v].add(c)
        while self.next_colors[v] in self.colors_hash[v]:
            self.next_colors[v] += 1
    
    def get_color(self, v):
        return self.next_colors[v]


N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
edge = [[] for _ in range(N)]
edge_cnt = [0] * N
for idx, (a, b) in enumerate(ab):
    a, b = a-1, b-1
    edge[a].append([b, a, 0, idx])
    edge_cnt[a] += 1
    edge_cnt[b] += 1
K = max(edge_cnt)

next_list = []
now_list = [0]
color_mgmt = ColorMgmt(N)
while len(now_list) > 0:
    for v in now_list:
        for idx, nextv in enumerate(edge[v]):
            if v == nextv[0]:
                continue
            colors1 = color_mgmt.get_color(nextv[1])
            colors2 = color_mgmt.get_color(nextv[0])
            color = max(colors1, colors2)
            color_mgmt.set_color(nextv[1], color)
            color_mgmt.set_color(nextv[0], color)
            edge[v][idx][2] = color
            next_list.append(nextv[0])
    
    now_list = list(next_list)
    next_list = []

ret = []
for edges in edge:
    for e in edges:
        ret.append(e)
ret.sort(key=lambda x:x[3])
print(K)
for r in ret:
    print(r[2])
import sys
 
H,W,M = list(map(int, input().split()))
U = 3 * 10**5
hw = [[0] * (U) for _ in range(U)]
 
w = [0] * (U)
h = [0] * (U)
mxw = []
mxw_v = 0
mxh = []
mxh_v = 0
 
 
for i in range(M):
    h_i, w_j = list(map(int, input().split()))
    hw[h_i][w_j] = 1
    h[h_i] += 1
    w[w_j] += 1
    if mxw_v < w[w_j]:
        mxw_v = w[w_j]
        mxw = [w_j]
    elif mxw_v == w[w_j]:
        mxw.append(w_j)
 
    if mxh_v < h[h_i]:
        mxh_v = h[h_i]
        mxh = [h_i]
    elif mxh_v == h[h_i]:
        mxh.append(h_i)
a = 0
for i in mxh:
    for j in mxw:
        d = hw[i][j]
        a = max(a, h[i]+w[j]-d)
print(a)

### FIXED CODE ###

H,W,M = list(map(int, input().split()))

hw = set()
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.add((h_i-1) + (w_j-1)*3*10**6)
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not(i + j*3*10**6 in hw):
            print(mxh_v+mxw_v)
            exit()
print(mxh_v+mxw_v-d)
N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] < D*D:
        ans += 1

print(cnt)

### FIXED CODE ###

N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] <= D*D:
        ans += 1

print(ans)
n = int(input())
a = input()
x = []
x.extend([int(i) for i in a])

if len(x) > 1:
    x = [abs(x[i] - x[i + 1]) for i in range(len(x) - 1)]


# もし1と0だけだったら簡単そう
# 2は012を210にする効果しかない
# 1が混ざっている条件で最後の答えが2になることはあり得ない->2を0と考えてよい
if 1 in x:
    flag = True
    x = [1 if i == 1 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 2 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n)
if x[0]==1:
    c+=1
for i in range(1,n):
    tmp_nck = int(n_b == (bin(r) or bin(n-r)))
    if x[i] == 1:
        c+=tmp_nck
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)

### FIXED CODE ###

n = int(input())
a = input()
x = []
x.extend([int(i) for i in a])

# 1,2,3 を0,1,2として考えてもよい(差は変わらないから)
# もし1と0だけだったら簡単そう
# 2は012を210にする効果しかない 1 or 0,2 と考えたら同値
# 1が混ざっている条件で最後の答えが2になることはあり得ない->2を0と考えてよい
if 2 in x:
    flag = True
    x = [1 if i == 2 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 3 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n-1)
if x[0]==1:
    c+=1
for i in range(1,n-1):
    tmp_nck = int((n-1) == (i | (n-1-i)))
    if x[i] == 1:
        c+=tmp_nck
if x[n-1]==1:
    c+=1
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)
import (n)
a = n*n*n
print a

### FIXED CODE ###

x = raw_input()
x = int(x)
x = x ** 3
print x
def MI(): return map(int, input().split())
from collections import deque
H,W=MI()
#Map=[[]*W for _ in range(H)]
Map=[]
white=0
for _ in range(H):
  Map.append(list(input()))
def bfs():
  dx=[-1,0,1,0]
  dy=[0,-1,0,1]
  INF=float('inf')
  dist=[[INF]*W for _ in range(H)]
  dist[0][0]=0
  que=deque()
  que.append((0,(0,0)))

  while que:
    d,(x,y) =que.popleft()
    for i in range(4):
      nx=x+dx[i]
      ny=y+dy[i]
      if 0<=nx<H and 0<=ny<W:
        if Map[nx][ny]!='#':
          if dist[nx][ny]==INF:
            dist[nx][ny]=d+1
            que.append((d+1,(nx,ny)))
  return dist
res=bfs()  
for i in range(H):
  for j in range(W):
    if Map[i][j]=='.':
      white+=1
ans=white-res[H-1][W-1]-1
if 0<ans<INF:
  print(ans)
else:
  print(-1)

### FIXED CODE ###

from collections import deque


def bfs():
    d = [[float("inf")] * w for i in range(h)]

    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    que = deque([])
    que.append((sx, sy))
    d[sx][sy] = 0

    while que:
        p = que.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]

            if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]] + 1

    return d[gx][gy]


h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]
sx, sy = 0, 0
gx, gy = h - 1, w - 1

# 白いマスを数える
white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            white += 1

res = bfs()
if 0 < res < float("inf"):
    # 白いマスの数から最短経路でかかるコスト分を引く
    # ゴールを黒いマスに変えることはできないためその分も引く
    print(white - res - 1)
else:
    print(-1)
import numpy as np

def main():
    N, M, C = np.array([int(x) for x in input().split(' ')])
    b_arr = np.array([int(x) for x in input().split(' ')])
    a_mat = np.zeros((N,M))

    for i in range(N):
        a_mat[i] = np.array([int(x) for x in input.split(' ')])

    print ( len(list( np.where( a_mat.dot(b_arr)> -C ) )[0]) )

if __name__ == '__main__':
    main()


### FIXED CODE ###

H, W = map(int, input().split())
h, w = map(int, input().split())

res = (H-h)*(W-w)

print(res)
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
cnt = [0] * 10001
r_n = int(math.sqrt(n)) + 1
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

for i in range(1, n + 1):
    print(cnt[i])


### FIXED CODE ###

import math
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
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 S(): return input()
def LS(): return input().split()


INF = float('inf')


def f(m):
    res = 0
    r_m = math.sqrt(m)
    for i in range(1, int(r_m) + 1):
        for j in range(1, int(r_m) + 1):
            for k in range(1, int(r_m) + 1):
                if i ** 2 + j ** 2 + k ** 2 + i * j + j * k + k * i == m:
                    print(f'{(m, i, j, k)=}')
                    res += 1
    return res


n = I()
cnt = [0] * 10001
r_n = int(math.sqrt(n)) + 1
for x in range(1, r_n):
    for y in range(1, r_n):
        for z in range(1, r_n):
            v = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if v <= n:
                cnt[v] += 1

for i in range(1, n + 1):
    print(cnt[i])
from sys import stdin
import sys
# import itertools
# import math

S = input()
if S == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    sys.exit()
a = [chr(i) for i in range(97, 97+26)]
b = [0 for i in range(26)]
d = dict(zip(a, b))
d1 = d
for i, v in enumerate(S):
    d[v] = d.get(v, 0)+1
for i, v in enumerate(a):
    if d[v] != 1:
        print(S+v)
        sys.exit()
temp = []
for i in range(26):
    temp.append(S[-1-i])
    if S[-1-i-1] < min(temp):
        print(S[:-1-i-1]+min(temp))
        sys.exit()

### FIXED CODE ###

from sys import stdin
import sys
# import itertools
# import math

S = input()
if S == 'zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    sys.exit()
a = [chr(i) for i in range(97, 97+26)]
b = [0 for i in range(26)]
d = dict(zip(a, b))
d1 = d
for i, v in enumerate(S):
    d[v] = d.get(v, 0)+1
for i, v in enumerate(a):
    if d[v] != 1:
        print(S+v)
        sys.exit()
temp = []
temp1 = []

for i in range(25):
    temp1 = []
    temp.append(S[-1-i])
    # print(S[-1-i], S[-1-i-1])
    for k, v in enumerate(temp):
        # print("v="+v)
        # print(S[-1-i-1], ord(S[-1-i-1]), ord(v))
        if S[-1-i-1] < v:
            temp1.append(v)
    # print(temp, temp1)
    if len(temp1) > 0:
        temp1.sort()
        print(S[:-1-i-1]+temp1[0])
        sys.exit()
n = input()

count = 0

l = len(n)

#kisu
if l % 2:
  num = n[1:l]
  count += int(num) + 1
  l -= 1
#gusu
for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= tmp / 10
    count += tmp
    
print(int(count))

### FIXED CODE ###

n = input()

count = 0

l = len(n)

if l % 2:
  num = n[0:l]
  tmp = 1
  for i in range(l-1):
    tmp *= 10
  count += int(num) - tmp + 1
  l -= 1

for i in range(l):
  tmp = 1
  if (i+1) % 2:
    for j in range(i+1):
      tmp *= 10
    tmp -= int(float(tmp) / float(10))
    count += tmp
    
print(count)
S = input()

S[4] = '8'
print(S)

### FIXED CODE ###

S = input()
print(S.replace('2017', '2018'))
from collections import Counter

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

xy.sort(key=lambda x: x[1])
xy.sort(key=lambda x: x[0])

ans = N
diff = []

for i in range(N-1):
    for j in range(i+1, N):
        diff.append((xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]))

c = Counter(diff)
print(N - c.most_common()[0][1])

### FIXED CODE ###

from collections import Counter

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

if N == 1:
    print(1)
    exit()

xy.sort(key=lambda x: x[1])
xy.sort(key=lambda x: x[0])

ans = N
diff = []

for i in range(N-1):
    for j in range(i+1, N):
        diff.append((xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]))

c = Counter(diff)
print(N - c.most_common()[0][1])
def gcd3(a, b, c):
    return gcd(gcd(a,b), c)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

k = int(input())
sum = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            if a == 0 or b == 0 or c == 0:
                sum += 1
            else
                sum += gcd3(a+1,b+1,c+1)
print(sum)

### FIXED CODE ###

import math
def gcd3(a, b, c):
    return math.gcd(math.gcd(a,b), c)

k = int(input())
sum = 0
for a in range(k):
    if a == 0:
        sum += k * k
        continue
    else:
        for b in range(k):
            if b == 0:
                sum += k
                continue
            else:
                for c in range(k):
                    if c == 0:
                        sum += 1
                    else:
                        sum += gcd3(a+1,b+1,c+1)
print(sum)
n = int(input())
a = [0,int(input()) for i in range(n)]
cnt = 1
next_a = a[1]
while cnt <= 10**5:
    next_a = a[next_a]
    cnt += 1
    if next_a == 2:
        break

if cnt < 10**5:
    print(cnt)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = [0] + [int(input()) for i in range(n)]
cnt = 1
next_a = a[1]

if a[1] == 2:
    print(cnt)

else:
    while cnt <= 10**5:
        next_a = a[next_a]
        cnt += 1
        if next_a == 2:
            break

    if cnt <= 10**5:
        print(cnt)
    else:
        print(-1)
s=list(input())
s2=''
for i in range(len(s)):
  if i%==0:
    s2+=s[i]
print(s2)

### FIXED CODE ###

s=list(input())
s2=''
for i in range(len(s)):
  if i%2==0:
    s2+=s[i]
print(s2)