Harryxun/stf_run huggingface dataset:
import math
from collections import Counter

def read():
    return int(input())

def readmap():
    return map(int, input().split())

def readlist():
    return list(map(int, input().split()))

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def root_cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    
    return True


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__ == "__main__":
    a, b = readmap()
    g = math.gcd(a, b)

    c = Counter(prime_factorize(g))

    print(len(c) + 1)

### FIXED CODE ###

import math
import fractions
from collections import Counter

def read():
    return int(input())

def readmap():
    return map(int, input().split())

def readlist():
    return list(map(int, input().split()))

def cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def root_cf(x1,x2):
    cf=[]
    for i in range(1,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    
    return True


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__ == "__main__":
    a, b = readmap()
    g = fractions.gcd(a, b)

    c = Counter(prime_factorize(g))

    print(len(c) + 1)
import sys
import heapq

input = sys.stdin.readline

X, Y, Z, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

q = [[(A[0]+B[0]+C[0])*(-1),0,0,0]]
heapq.heapify(q)
count = 0
x, y, z = 0, 0, 0
alr = [[1,1,1]]

while count < K:
    poped = heapq.heappop(q)
    ans = poped[0]*(-1)
    print(ans)
    i, j, k = poped[1], poped[2], poped[3]
    if i+1 < X and not [i+1,j,k] in alr:
        heapq.heappush(q, [(A[i+1]+B[j]+C[k])*(-1), i+1, j, k])
        alr.append([i+1,j,k])
    if j+1 < Y and not [i,j+1,k] in alr:
        heapq.heappush(q, [(A[i]+B[j+1]+C[k])*(-1), i, j+1, k])
        alr.append([i,j+1,k])
    if k+1 < Z and not [i,j,k+1] in alr:
        heapq.heappush(q, [(A[i]+B[j]+C[k+1])*(-1), i, j, k+1])
        alr.append([i,j,k+1])
    count += 1


### FIXED CODE ###

import sys

input = sys.stdin.readline

X, Y, Z, K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
AB = []
ABC = []

for a in A:
    for b in B:
        AB.append(a+b)

AB.sort(reverse=True)
for i in range(min(len(AB), 3000)):
    for c in C:
        ABC.append(AB[i]+c)
        
ABC.sort(reverse=True)

for i in range(K):
    print(ABC[i])
n=int(input())
a=[map(int,input().split())]
print(max(a)-min(a))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))
def main():
    n, m = map(int, input().split())
    s = [0] * n
    c = [0] * n
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = [None, None, None]
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == None:
            ans[s[i]-1] = c[i]
        if ans[s[i]-1] == c[i]:
            continue
        else:
            print(-1)
            exit()
    if ans[0] == None:
        ans[0] = 1
    if ans[1] == None:
        ans[1] = 0
    if ans[2] == None:
        ans[2] = 0
    print(*ans, sep='')

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    s = [0] * m
    c = [0] * m
    for i in range(m):
        s[i], c[i] = map(int, input().split())
    ans = list()
    for i in range(n):
        ans.append(0)
    for i in range(m):
        if n != 1 and s[i] == 1 and c[i] == 0:
            print(-1)
            exit()
        if ans[s[i]-1] == 0 or ans[s[i]-1] == c[i]:
            ans[s[i]-1] = c[i]
        elif ans[s[i]-1] != 0 and ans[s[i]-1] != c[i]:
            print(-1)
            exit()
    if n != 1:
        if ans[0] == 0:
            ans[0] = 1
        print(*ans, sep='')
    else:
        print(*ans, sep='')

if __name__ == '__main__':
    main()
S = raw_input()

s = S % 60
h = (S - S % 3600) / 3600
m = (S - s - h * 3600) / 60

print"%d:%d:%d" %(h,m,s)

### FIXED CODE ###

S = input()
h = S / 3600
s = S % 60
m = (S - h * 3600 - s) / 60

print "%d:%d:%d" %(h,m,s)
n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] = v
for i, v in enumerate(A, 1):
    print(' '.join([str(p) for p in v]))
    if i == 3 ori == 6 or i == 9:
        print('####################')


### FIXED CODE ###

n = int(input())
A = [[0]*10 for i in range(12)] 

for _ in range(n):
    b, f, r, v = map(int, input().split())
    A[(b-1)*3 + (f-1)][r-1] += v
for i, v in enumerate(A, 1):
    print(' ' + ' '.join([str(p) for p in v]))
    if i == 3 or i == 6 or i == 9:
        print('####################')
s = [int x for x in input().split()]
max_int = s.pop(s.index(max(s)))
print(max_int * 10 + sum(s))

### FIXED CODE ###

s = [int(x) for x in input().split()]
max_int = s.pop(s.index(max(s)))
print(max_int * 10 + sum(s))
import fractions
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
def func(x,y):
    return (x*y)//fractions.gcd(x,y)
AB = reduce(func, A, 1)
sumB = 0
for ii in range(N):
    sumB += AB/A[ii]
print(int(sumB%(10**9+7)))

### FIXED CODE ###

import fractions
N = int(input())
A = list(map(int, input().split()))
AB = 1
for i in A:
    AB = AB*i//fractions.gcd(AB,i)
sumB = 0
for i in A:
    sumB += AB//i
print(int(sumB%(10**9+7)))
r,d,x=map(int,input().split)
for i in range(10):
  x=x*r-d
  print(x)


### FIXED CODE ###

r,d,x=map(int,input().split())
for i in range(10):
  x=x*r-d
  print(x)
n = int(input().rstrip())
values = list(map(int,input().rstrip().
    ssplit()))

m = 500000000 #max divide
for i in range(len(values)):
	nowV = values[i]
	nm = 0
	for j in range(500000000):
		if nowV % 2 == 0:
			nm += 1
			nowV = nowV / 2
			m = min(m,n)
		else:
			break 
print(m)
			


### FIXED CODE ###


n = int(input().rstrip())
values = list(map(int,input().rstrip().split()))

m = 500000000 #max divide
for i in range(len(values)):
	nowV = values[i]
	nm = 0
	for j in range(500000000):
		if nowV % 2 == 0:
			nm += 1
			nowV = nowV / 2
		else:
			break 
	m = min(m,nm)
print(m)
import math
A,B = map(int, input().split())

print(math.ceil(B/(A-1))

### FIXED CODE ###

import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)
a=input()

if a=="hi"*(len(a)//2):
	print("Yes")
else:
	print"No"

### FIXED CODE ###

a=input()

if a=="hi"*(len(a)//2):
	print("Yes")
else:
	print("No")
H, W = [int(_) for _ in input().split()]
if H == 1 and W == 1:
    print(1)
elif H %2 == 0:
    print(int(H*W/2))
else:
    print(int((H-1)*W/2) + int(math.ceil(W/2)))

### FIXED CODE ###

import math
 
H, W = [int(_) for _ in input().split()]
if H == 1 or W == 1:
    print(1)
elif H %2 == 0:
    print(int(H*W/2))
else:
    print(int((H-1)*W/2) + int(math.ceil(W/2)))
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

ans = []
l = range(1, N + 1)
import itertools


for v in itertools.permutations(l, N):
    if list(v) == P:
      a = v.index(P)
        
    if list(v) == Q:
      b = v.index(Q)  
    

print(abs(b - a))


### FIXED CODE ###

K,X = map(int,input().split())

if 500*K >= X:
  print('Yes')
else:
  print('No')
re = input().split())
a = int(re[0])
b = float(re[1]])
for i in range(10):
    if i <= b <i+1:
        c = int(i)
        d = int(100 * (b - i))
        break
    
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)

### FIXED CODE ###

re = input().split()
a = int(re[0])
b = re[1]

c = int(b[0])
d = int(b[2] + b[3])
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)
# coding:utf-8
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans = 0
time = 0

if sum(a) + sum(b) <= k:
    print(len(a) + len(b))
    exit()

while time <= k:
    if len(a) == 0 and len(b) == 0:
        print(ans)
        exit()
    elif len(a) == 0:
        book = b[0]
    elif len(b) == 0:
        book = a[0]
    else:
        book = min(a[0], b[0])

    time += book
    if time > k:
        print(ans)
        exit()
    ans += 1
    if book == a[0]:
        a.pop(0)
    else:
        b.pop(0)



### FIXED CODE ###

# coding:utf-8
import itertools
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
j = m

aa = [0] + list(itertools.accumulate(a))
bb = [0] + list(itertools.accumulate(b))
# print(aa)
# print(bb)


# しゃくとり法 / Aの山だけ読みつつ、そこにBからいくつ取り出すかで考える
for i, a_item in enumerate(aa):
    if a_item > k:
        break
    while a_item + bb[j] > k:
        j -= 1
    ans = max(i + j, ans)
print(ans)
N,X = map(int,input().split())
x = list(map(int,input().split()))
for i in range(N):
  x[i] -= X
import fractions
g = fractions.gcd(x[0],x[1])
for i in range(2,N):
  g = fractions.gcd(g,x[i])
print(g)


### FIXED CODE ###

N,X=map(int,input().split())
xs = list(map(int,input().split()))

def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return(x)
    

xs[0] -= X
g = xs[0]
import math
for i in range(1,N):
    xs[i] -= X
    g = gcd(g,xs[i])
print(abs(g))
n,t,a=int(input()),map(int,input().split())
h=list(map(int,input().split()))
print(min(h).index()+1)

### FIXED CODE ###

n=int(input()),
t,a=map(int,input().split())
h=list(map(int,input().split()))
x=[abs(a-t+0.006*i) for i in h]
print(x.index(min(x))+1)
s_num, c_num = map(int, input().split())
if s_num * 2 > c_num:
    print(s_num)
else:
    ans = s_num
    c_num -= s_num * 2
    ans += c_num // 4
    print(ans)
    


### FIXED CODE ###

#!/usr/bin/env python3
n = int(input())
x = n * 800
y = (n // 15) * 200
ans = x - y
print(ans)
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(1,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dd
    for j in range(1,10):
        if result % 10 ==0:
            break
        result+=1

print(result+buf)


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

dish = [a,b,c,d,e]
result=0

mx=-1

for dd in dish:
    for i in range(0,10):
        if (dd+i) % 10 == 0:
            tmp=i
            break
    if tmp > mx:
        mx = tmp
        buf=dd

dish.remove(buf)

for dd in dish:
    result+=dd
    for i in range(1,10):
        if result % 10 == 0:
            break
        result+=1
        
print(result+buf)
import itertools

N, M, Q = [int(i) for i in input().split()]
pos_A = sorted([i for i in range(1, M+1)] * N)
comb_A = list(itertools.combinations(pos_A, N))

for i in range(Q):
    a, b, c, d  = [int(i) for i in input().split()]
    for j, k in enumerate(comb_A):
        if k[b-1] - k[a-1] == c:
            score[j] += d
print(max(score))


### FIXED CODE ###

import itertools

N, M, Q = [int(i) for i in input().split()]
ABCD = [list(map(int, input().split())) for i in range(Q)]
score = 0
for A in itertools.combinations_with_replacement(range(1, M+1), N):
    tmp = 0
    for a, b, c, d in ABCD:
        if A[b-1] - A[a-1] == c:
            tmp += d
    score = max(score, tmp)
print(score)
import sys
sys.setrecursionlimit(2000)

n = int(input())
x = input()

def f(n):
    t = int(n,2) % list(n).count('1')
    if t == 0:
        return 1
    else:
        return f(str(bin(t))) + 1

for i in range(n):
    xb = list(x)
    xb[i] = '0' if xb[i] == '1' else '1'
    print(f(''.join(xb)))

### FIXED CODE ###

n = int(input())
X = input()
x = int(X,2)
bitx = bin(x).count('1')
 
ans = [0]*(bitx+2)
for i in range(1,bitx+2):
    ans[i] = 1 + ans[i%bin(i).count('1')]
#print(ans)
l = []
bitp = bitx + 1
bitm = bitx - 1
xmp = 0
xmm = 0


if bitx != 1:
    for i in range(n):
        if X[i] == '1':
            xmp += pow(2, n-(i+1), bitp)
            xmm += pow(2, n-(i+1), bitm)
    for i in range(n):
        if X[i] == '1':
            xm = (xmm - pow(2,n-i-1,bitm)) % bitm
            l.append(str(1+ans[xm]))
        else:
            xm = (xmp + pow(2,n-i-1,bitp))%bitp
            l.append(str(1+ans[xm]))
 
else:
    for i in range(n):
        if X[i] == '1':
            xmp += pow(2, n-(i+1), bitp)
    for i in range(n):
        if X[i] == '1':
            l.append(str(0))
        else:
            xm = (xmp + pow(2,n-i-1,bitp))%bitp
            l.append(str(1+ans[xm]))
 
print('\n'.join(l))
n = 0
a = []
b = []
c = []

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

# print(n)
# print(a)
# print(b)
# print(c)

sum = 0
tmp = 0
cc = 0

for m in range(n):
    i = a[m]
    print(f"i = {i}")
    print(f"tmp = {tmp}")
    if tmp == i-1:
        cc = c[i-2]
        print(f"cc = {cc}")
    else:
        cc = 0
    sum += b[i-1]
    sum += cc
    tmp = i

print(sum)


### FIXED CODE ###

n = 0
a = []
b = []
c = []

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

sum = 0
tmp = 0
cc = 0

for m in range(n):
    i = a[m]
    if i-1 <=0:
        cc = 0
    elif tmp == i-1:
        cc = c[i-2]
    else:
        cc = 0
    sum += b[i-1]
    sum += cc
    tmp = i

print(sum)
n = int(input())
t1 = 0
x1 = 0
y1 = 0
boolean = True

for _ in range(n):
    t, x, y = [int(_) for _ in input().split()]
    if boolean:
        temp1 = x
        temp2 = t
        x = abs(x - x1) + abs(y - y1)
        t -= t1
        x1 = temp
        y1 = y
        t1 = temp2
        if x > t or (x + t) % 2 == 1:
            boolean = False
if boolean:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import numpy as np
n = int(input())
T = []
X = []
Y = []
t1 = 0
x1 = 0
y1 = 0
for i in range(n):
    m = input().split()
    T.append(int(m[0]) - t1)
    t1 = int(m[0])
    X.append(abs(int(m[1]) - x1))
    x1 = int(m[1])
    Y.append(abs(int(m[2]) - y1))
    y1 = int(m[2])
T = np.array(T)
X = np.array(X)
Y = np.array(Y)
for i in range(n):
    if X[i] + Y[i] > T[i] or (X[i] + Y[i] + T[i]) % 2 == 1:
        print('No')
        break
else:
    print('Yes')
x, t = map(int, input().split())
print(x - t if x -t > 0 else 0)

### FIXED CODE ###

print('Yes' if '9' in input() else 'No')
h, w, k = map(int, raw_input().split())
b = [[0] * w for i in xrange(h)]
c = "YGBR"
for i in xrange(h):
    for j in xrange(w):
        b[i][j] = c[(i+j)/k%2+(i-j)/k%2*2]
    print "".join(b[i])


### FIXED CODE ###

print "Yes" if raw_input().startswith("YAKI") else "No"
from typing import List, Tuple


def main():
    n, m = map(int, input().split())
    g = []
    for _ in range(m):
        a, b = map(int, input().split())
        g.append((a, b))
    print(b(n, m, g))


def b(n: int, m: int, g: List[Tuple[int, int]]):
    ret = 0
    for i in range(m):
        v = set()
        w = [1]
        while w:
            now = w.pop()
            v.add(now)
            for j, node in enumerate(g):
                if j == i:
                    continue
                if node[0] == now and node[1] not in v:
                    w.append(node[1])
                elif node[1] == now and node[0] not in v:
                    w.append(node[0])
        if len(v) != n:
            ret += 1
    return ret


if __name__ == '__main__':
    main()


### FIXED CODE ###

from typing import List, Tuple


def main():
    n, m = map(int, input().split())
    g = []
    for _ in range(m):
        a, b = map(int, input().split())
        g.append((a, b))
    print(bb(n, m, g))


def bb(n: int, m: int, g: List[Tuple[int, int]]):
    ret = 0
    for i in range(m):
        v = set()
        w = [1]
        while w:
            now = w.pop()
            v.add(now)
            for j, node in enumerate(g):
                if j == i:
                    continue
                if node[0] == now and node[1] not in v:
                    w.append(node[1])
                elif node[1] == now and node[0] not in v:
                    w.append(node[0])
        if len(v) != n:
            ret += 1
    return ret


if __name__ == '__main__':
    main()
b

### FIXED CODE ###

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

import sys
import os
import math

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

A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1

    A[a] += 1
    A[b] += 1

for i in range(N):
    print(A[i])
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=B[A[0]-1]
for i in range(1,n):
  ans+=B[A[i]-1]
  if A[i-1]+1==A[i]:
    ans+=C[i-1]
print(ans)


### FIXED CODE ###

print(int(input())**3)
#051_D
from heapq import heappop, heappush
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
    d[i][i] = 0
n, m = map(int, input().split())
edges = []
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    edges.append((a-1, b-1))

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
                
warshall_floyd(d)

ans = 0
for u, v in edges:
    for i in range(n):
        if i == u or i == v:
            continue
        if d[u][i] + d[i][v] == d[u][v]:
            ans += 1
            break

print(ans)

### FIXED CODE ###

#051_D
inf = 10 ** 10
n, m = map(int, input().split())
d = [[inf for _ in range(n)] for _ in range(n)]
for i in range(n):
    d[i][i] = 0
edges = []
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    edges.append((a-1, b-1, c))

def warshall_floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
                
warshall_floyd(d)

ans = m
for u, v, c in edges:
    flg = False
    for i in range(n):
        if d[i][v] + c == d[i][u]:
            flg = True
    
    if flg:
        ans -= 1

print(ans)
a,b,c,d=map(int,input().split())
e=a//d
f=c//b
x=a-e*d
y=c-f*b
if x==y==0:
  if f<=e:
    print('Yes')
  else:
    print('N0')
elif x==0 and y!=0:
  if f+1<=e:
    print('Yes')
  else:
    print('No')
elif y==0 and x!=0:
  if f<=e+1:
    print('Yes')
  else:
    print('NO')
else:
  if f<=e:
    print('Yes')
  else:
    print('No')
  

### FIXED CODE ###

S,W=map(int,input().split())
if S<=W:
  print('unsafe')
else:
  print('safe')
N = int(input())
A = [i for i in str(N)]
result = 0
for j in range(len(A)):
  result += A[j]
if result == 0 and A[0] == 1:
  print(10)
else:
  print(result)

### FIXED CODE ###

N = int(input())
A = [i for i in str(N)]
result = 0
for j in range(len(A)):
  result += int(A[j])
if result == 1 and A[0] == "1":
  print(10)
else:
  print(result)
import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
n=len(p)
for i in range(n):a,b=p[i];c,d=p[-~i%n];s+=a*d-b*c
print(s/2)

//      abs abs


### FIXED CODE ###

import sys
s=0
p=[list(map(float,e.split(',')))for e in sys.stdin]
n=len(p)
for i in range(n):a,b=p[i];c,d=p[-~i%n];s+=a*d-b*c
print(abs(s)/2)
w = input()
a = abcdefghijklmnopqrstuvwxyz
co = 0
ch = True
for i in a:
    for j in w:
        if i = j:
            co += 1:
    if co % 2:
        ch = False
        break
if ch:
    print("yes")
else:
    print("No")

### FIXED CODE ###

w = input()
a = "abcdefghijklmnopqrstuvwxyz"
co = 0
ch = True
for i in a:
    for j in w:
        if i == j:
            co += 1
    if co % 2:
        ch = False
        break
    co = 0
    
    
if ch:
    print("Yes")
else:
    print("No")
import operator

#リスト内包表記
N = int(input())
A = [int(x) for x in input().split()]

#リストの総積を計算する
seki = reduce(operator.mul, a, 1)

if seki > 10**18:
    print("-1")
else:
    print(seki)

### FIXED CODE ###

A,B = map(int, input().split())
print(A*B)
S=input()

h = S/3600
S = S%3600

m = S/60
s = S%60

print(':'.join(map(str,[h,m,s])))

### FIXED CODE ###

S=int(input())

h = S//3600
S = S%3600

m = S//60
s = S%60

print(h,m,s,sep=":")
A, B, K = map(int, raw_input().split())
AB = range(A, B + 1)
if len(AB) > 2 * K:
	for i in AB[:K]:
		print i
for i in AB[-K:]:
	print i


### FIXED CODE ###

A, B, K = map(int, raw_input().split())
if B - A + 1 > 2 * K:
	for i in range(A, A + K):
		print i
	for i in range(B - K + 1, B + 1):
		print i
else:
	for i in range(A, B + 1):
		print i
n = input()

if n[0] == n[3]:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n = input()

if n[0] == n[2]:
  print("Yes")
else:
  print("No")
def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    dist = dx + dy
    if (dt % 2) != (dist % 2) or dist > dt:
        return True
    else:
        return False

if __name__ == '__main__':
    n = int(input())
    t, x, y = list(), list(), list()
    t[0], x[0], y[0] = 0, 0, 0
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = map(int, input().split())

    for i in range(1,n+1):
        dt = t[i] -  t[i-1]
        dx = abs(x[i] -  x[i-1])
        dy = abs(y[i] -  y[i-1])
        if BlCannotGo(dt, dx, dy):
            print('NO')    
            exit()

    print('YES')


### FIXED CODE ###

def BlCannotGo(dt, dx, dy): ## 行けないならTrue
    if (dt % 2) != ((dx + dy) % 2) or (dx + dy) > dt:
        return True
    else:
        return False

if __name__ == '__main__':
    n = int(input())
    l = list(list(map(int, input().split())) for _ in range(n))

    dt = l[0][0]
    dx = l[0][1]
    dy = l[0][2]
    if BlCannotGo(dt, dx, dy):
        print('No')    
        exit()
        
    for i in range(1,n):
        dt = l[i][0] -  l[i-1][0] 
        dx = l[i][1] -  l[i-1][1]
        dy = l[i][2] -  l[i-1][2]
        if BlCannotGo(dt, dx, dy):
            print('No')    
            exit()

    print('Yes')
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    h = list(map(int,input().split()))
    def fr(i):
        if i == 1:
            return abs(h[1]-h[0])
        elif i == 0:
            return 0
        else:
            return min(fr(i-1)+abs(h[i]-h[i-1]),\
                    fr(i-2)+abs(h[i]-h[i-2]))

    print(fr(N-1))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N = int(input())
    h = list(map(int,input().split()))
    dp = [0 for _ in range(N)]
    dp[0] = 0
    dp[1] = abs(h[1]-h[0])
    cost = h
    for i in range(1,N-1):
        dp[i+1] = min(dp[i]+abs(cost[i+1]-cost[i]),\
            dp[i-1]+abs(cost[i+1]-cost[i-1]))
    print(dp[-1])

if __name__ == "__main__":
    main()