Harryxun/stf_run huggingface dataset:
a[]
for i in range(3):
	a.append(input())
a.sort()
if a[2]-a[1]==a[1]-a[0]:
	print('YES')
else:
	print('NO')

### FIXED CODE ###

a,b,c=input().split()
d=[]
d.append(int(a))
d.append(int(b))
d.append(int(c))
if d[2]-d[1]==d[1]-d[0]:
	print('YES')
else:
	print('NO')
H1 = int(input())
M1 = int(input())
H2 = int(input())
M2 = int(input())
K = int(input())
if H1<H2:
    print((M2 + H2*60 - (M1 + H1*60)) - K)
else:
    print(M2 + H2*60 + ((60-M1)+(24-H1)*60) - K)

### FIXED CODE ###

h1,m1,h2,m2,k = map(int, input().split())
print(m2-m1+(h2-h1)*60-k)
# ABC113 C
N, M = map(int, input().split())
cities = [list(map(int, input().split())) for _ in range(M)]

cities = [[i, city[0], city[1]] for i, city in enumerate(cities)]
city_count = [0]*(M+1)
cities.sort(key=lambda x: x[2])
ids = []
for city in cities:
    city_count[city[1]] += 1
    ids.append([city[0], '{:0>6}{:0>6}'.format(city[1], city_count[city[1]])])
ids.sort(key=lambda x: x[0])
for city in ids:
    print(city[1])

### FIXED CODE ###

# ABC113 C
N, M = map(int, input().split())
cities = [list(map(int, input().split())) for _ in range(M)]

cities = [[i, city[0], city[1]] for i, city in enumerate(cities)]
city_count = [0]*(N+1)
cities.sort(key=lambda x: x[2])
ids = []
for city in cities:
    city_count[city[1]] += 1
    ids.append([city[0], '{:0>6}{:0>6}'.format(city[1], city_count[city[1]])])
ids.sort(key=lambda x: x[0])
for city in ids:
    print(city[1])
M1,D1=map(int,input().split())
M2,D2=map(int,input().split())

if D2=1:
    print(1)
else:
    print(0)


### FIXED CODE ###

M1,D1=map(int,input().split())
M2,D2=map(int,input().split())

if D2==1:
    print(1)
else:
    print(0)
N,K = map(int,input().split())
X = []
for i in range(N):
    t,d = map(int,input().split())
    X.append((d,t))

X.sort(reverse=True)

p,v = 0,set([])
pp = []
for i in range(K):
    p += X[i][0]
    if X[i][1] not in v:
        v.add(X[i][1])
    else:
        pp.append((X[i][0],X[i][1]))

Ans = p + len(v)**2
ans = Ans
for i in range(K,N):
    if X[i][1] not in v:
        ans = ans - pp[0][0] + X[i][0] - len(v)**2 + (len(v)+1)**2
        v.add(X[i][1])
        Ans = max(Ans,ans)
        pp = pp[1:]
    

print(Ans)


### FIXED CODE ###

N,K = map(int,input().split())
X = []
for i in range(N):
    t,d = map(int,input().split())
    X.append((d,t))

X.sort(reverse=True)

p,v = 0,set([])
pp = []
for i in range(K):
    p += X[i][0]
    if X[i][1] not in v:
        v.add(X[i][1])
    else:
        pp.append((X[i][0],X[i][1]))

Ans = p + len(v)**2
ans = Ans
for i in range(K,N):
    if X[i][1] not in v and len(pp)>0:
        temp = pp[-1]
        pp = pp[:len(pp)-1]
        ans = ans - temp[0] + X[i][0] - len(v)**2 + (len(v)+1)**2
        v.add(X[i][1])
        Ans = max(Ans,ans)

print(Ans)
N = int(input())
t_old, x_old, y_old = 0, 0, 0

for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - t_old
  dx = x - x_old
  dy = y - y_old
  t_old = t
  x_old = x
  y_old = y
  if abs(dx) + abs(dy) =< dt and (dt - (abs(dx) + abs(dy))) % 2 == 0:
    if i == N - 1:
      print('Yes')
  else:
    print('No')
    break
    


### FIXED CODE ###

a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
import numpy as np
from operator import itemgetter

N=int(input())
List=[str(input()) for i in range(N)]
SetList=list(set(List))
nc=[List.count(SetList[i]) for i in range(len(SetList))]

indexmax=np.where(np.array(nc) == np.array(nc).max())[0]
if(len(indexmax)==1):
    print(itemgetter(*indexmax)(SetList))
else:
    for i in sorted(itemgetter(*indexmax)(SetList)):
        print(i) 


### FIXED CODE ###

A, B, C=map(int,input().split())
if((A==B) & (B!=C)):
    ans='Yes'
elif((A==C) & (B!=C)):
    ans='Yes'
elif((B==C) & (B!=A)):
    ans='Yes'
else:
    ans='No'
print(ans)
a, b = map(int,raw_input().split())
if(a > 8 || b > 8):
	print ":("
else:
	print "Yay!"

### FIXED CODE ###

a, b = map(int, input().split())
if(a > 8 or b > 8):
	print(":(")
else:
	print("Yay!")
import numpy as np
N = int(input())
A = list(map(int,input().split()))
a = np.prod(A)
if a > 10**18:
  print(-1)
else:
  print(a)

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
def solve(x):
    # 0123の周期でXORはリセットされるため剰余だけ考える
    if x % 4 == 3:
        return 0
    elif x % 4 == 0:
        return x
    elif x % 4 == 1:
        return x ^ (x　-　1)
    elif x % 4 == 2:
        return x ^ (x　-　1) ^ (x　-　2)


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


print(solve(a - 1) ^ solve(b))

### FIXED CODE ###

# 0123の周期でXORはリセットされるため剰余だけ考える
def solve(x):
    if x % 4 == 3:
        return 0
    elif x % 4 == 0:
        return x
    elif x % 4 == 1:
        return x ^ (x - 1)
    elif x % 4 == 2:
        return x ^ (x - 1) ^ (x - 2)


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


print(solve(a - 1) ^ solve(b))
# https://atcoder.jp/contests/abc112/tasks/abc112_c


# ピラミッドの中心は必ず0-100の中にある
# Hは1以上
# 与えられる情報だけで一意に定まる

# 中心座標をa,bと置いたとき、ある点x,yにおける高さは
# h(x,y; a,b)=max(H-|x-a|-|y-b|,0)である。
# ここで、真の高さとの誤差としてe(x,y;a,b)=|h(x,y;a,b) - h(x,y;Cx,Cy)|とすると。
# 任意のx,yでe=0となるa,bが答え。しかしHはわからないので0とする。
# そうすると任意のx,yでe(x,y;a,b)=constとなるa,bが答え。(ただしmaxの扱いが面倒なのでh==0は無視して処理を行う)
# またその定数constはHである

# 座標は10**4点。Nはたかだか100なので 最悪10**6回計算。間に合う。

import numpy as np
from itertools import product

N = int(input())
X, Y, H = [], [], []
for n in range(N):
    x, y, h = list(map(int, input().split()))
    # if h == 0:
    #     continue
    X.append(x)
    Y.append(y)
    H.append(h)

if N == 1:
    print(x, y, h)
    exit()

X = np.array(X)
Y = np.array(Y)
H = np.array(H)


def is_eq_loss(X, Y, H, a, b):
    loss = np.abs(-np.abs(X - a) - np.abs(Y - b) - H)
    if (loss[-1] == loss).all():
        return True, loss[-1]
    else:
        return False, False


# def sum_loss(X, Y, H, a, b):
#     loss = np.abs(-np.abs(X - a) - np.abs(Y - b) - H)
#     return loss.sum()


for a, b in product(range(101), range(101)):
    flg, ansH = is_eq_loss(X, Y, H, a, b)
    if flg:
        ans = (a, b, ansH)

# for a, b in product(range(101), range(101)):
#     flg, ansH = is_eq_loss(X, Y, H, a, b)
#     if flg:
#         ans = (a, b, ansH)

print(*ans)


### FIXED CODE ###

# https://atcoder.jp/contests/abc112/tasks/abc112_c


# ピラミッドの中心は必ず0-100の中にある
# Hは1以上
# 与えられる情報だけで一意に定まる

# 中心座標をa,bと置いたとき、ある点x,yにおける高さは
# h(x,y; a,b)=max(H-|x-a|-|y-b|,0)である。
# ここで、真の高さとの誤差としてe(x,y;a,b)=|h(x,y;a,b) - h(x,y;Cx,Cy)|とすると。
# 任意のx,yでe=0となるa,bが答え。しかしHはわからないので0とする。
# そうすると任意のx,yでe(x,y;a,b)=constとなるa,bが答え。(ただしmaxの扱いが面倒なのでh==0は無視して処理を行う)
# またその定数constはHである

# 座標は10**4点。Nはたかだか100なので 最悪10**6回計算。間に合う。

import numpy as np
from itertools import product

N = int(input())
X, Y, H = [], [], []
for n in range(N):
    x, y, h = list(map(int, input().split()))
    # if h == 0:
    #     continue
    X.append(x)
    Y.append(y)
    H.append(h)

if N == 1:
    print(x, y, h)
    exit()

X = np.array(X)
Y = np.array(Y)
H = np.array(H)


def is_eq_loss(X, Y, H, a, b):
    loss = np.abs(- np.abs(X - a) - np.abs(Y - b) - H)
    mask = (H == 0)  # 高さがない疑いのところは最小値に合わせる
    if np.any(mask):
        loss[mask] = loss.min()
    # print(loss[-1])
    if (loss[-1] == loss).all():
        return True, loss[-1]
    else:
        return False, False


for a, b in product(range(101), range(101)):
    flg, ansH = is_eq_loss(X, Y, H, a, b)
    if flg:
        ans = (a, b, ansH)

print(*ans)
r=input()#入力を受け取れる
ans = r*2*3.14
print(ans)

### FIXED CODE ###

import math

def main():
    n = int(input())
    print(math.tau*n)

if __name__ == "__main__":
    main()
s = list(map(int,list(input())))
k = int(input())

for j in range(1,5*(10**15)):
  a = ''
  for i in range(len(s)):
    a += str(s[i])*s[i]**j
  if len(a) >= k:
    print(a[k-1])
    break


### FIXED CODE ###

s = list(map(int,list(input())))
k = int(input())

a = 0
i = 0

while a < k:
  a += min(s[i]**70, k)
  i +=1

print(s[i-1])
r,D,x = map(int,input().split())

def func(a):
    return r*func(a-1) - D

for i in range(10):
  print(func(x))

### FIXED CODE ###

r,D,x = map(int,input().split())

for i in range(10):
  x = r*x-D
  print(x)
N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]

for CX in range(101):
    for CY in range(101):
        ans = True
        i = 0
        for x, y, h in xyh:
            if h != 0:
                if i == 0:
                    H = h + abs(x - CX) + abs(y - CY)
                if H != h + abs(x - CX) + abs(y - CY):
                    ans = False
                    break
            i += 1
            if not ans:
                break
        for x, y, h in xyh:
            if not ans:
                break
            if h == 0:
                if h != max(H - abs(x - CX) + abs(y - CY), 0):
                    ans = False
        if ans:
            print(CX, CY, H)
    if ans:
        break

### FIXED CODE ###

N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
key = False
for CX in range(101):
    for CY in range(101):
        ans = True
        H = -1
        for x, y, h in xyh:
            if h > 0:
                tmp = h + abs(x - CX) + abs(y - CY)
                if H == -1:
                    H = tmp
                else:
                    if H != tmp:
                        H = -2
                        break

        if H == -2:
            continue

        for x, y, h in xyh:
            if h == 0:
                dist = abs(x - CX) + abs(y - CY)
                if H > dist:
                    H = -2
                    break
                
        if H == -2:
            continue
        
        print(CX, CY, H)
        key = True
        break
        
    if key:
        break
h,a=map(int,input.split())
cnt=0
while h>=0:
    h-=a
    cnt+=1
print cnt

### FIXED CODE ###

h,a=map(int,input().split())
cnt=0
while True:
    h-=a
    cnt+=1
    if h<=0:
        break
print(cnt)
N, M = map(int, input().split())
A = list(map(int, input().split()))

def dfs(choices, s, cost, i):
    if i == len(choices):
        return -1
    if cost == 0:
        return int(s)
    if cost < 0:
        return -1
    
    if choices[i][0] == 1:
        if cost % 2 == 0:
            return int(s + (cost // 2) * '1')
        else:
            return -1
    
    
    tmp1 = dfs(
        choices,
        s + str(choices[i][0]),
        cost - choices[i][1],
        i
    )
    if i+1 == len(choices):
        tmp2 = -1
    else:
        tmp2 = dfs(
            choices,
            s,
            cost,
            i + 1
        )
    
    ret = max(tmp1, tmp2)
    return ret

match = [-100,2,5,5,4,5,6,3,7,6]
choices = []
for i in A:
    if (i == 6) and (9 in A):
        continue
    if (i == 3) and (5 in A):
        continue
    if (i == 2) and (3 in A or 5 in A):
        continue
    choices.append([i, match[i]])

choices.sort(reverse=True)

ans = dfs(choices, '', N, 0)
print(ans)
    


### FIXED CODE ###

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

import sys
INT_MIN = sys.maxsize * -1
match = [-100,2,5,5,4,5,6,3,7,6]
CHOICES = []
for i in A:
    if (i == 6) and (9 in A):
        continue
    if (i == 3) and (5 in A):
        continue
    if (i == 2) and (3 in A or 5 in A):
        continue
    CHOICES.append([i, match[i]])
CHOICES.sort(reverse=True)

ans = [0]
#print(CHOICES)
for i in range(1,N+1):
    ans.append(INT_MIN)
    for c in CHOICES:
        #if  i - c[1] == 0:
        #    ans[i] = max(ans[i], int(str(c[0])))
        #elif i - c[1] >= 0 and ans[i - c[1]] != INT_MIN:
        #    ans[i] = max(ans[i], int(str(c[0]) + str(ans[i - c[1]])))

        if i - c[1] >= 0 and ans[i - c[1]] != INT_MIN:
            ans[i] = max(ans[i], c[0] + ans[i - c[1]] * 10)

print(ans[N])
A, B  = (int(i) for i in input().split())

import math

print((A * B) // math.gcd(A, B))

### FIXED CODE ###

A, B  = (int(i) for i in input().split())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
  
print((A * B) // gcd(A, B))
h, w, d = map(int, input().split())
x = []
z = [None for i in range(h * w)]
for i in range(h):
    x.append(list(map(int, input().split())))
    for j in range(w):
        z[x[i][j] - 1] = [i + 1, j + 1]

s = [None for _ in range(d)]
for i in range(d):
    a = z[i - 1]
    b = z[d + i - 1]
    s[i] = [abs(a[0] - b[0]) + abs(a[1] - b[1])]
    j = 1
    while(True):
        if d * (j + 1) + i <= h * w:
            a = z[d * j + i - 1]
            b = z[d * (j + 1) + i - 1]
            s[i].append(s[i][-1] + abs(a[0] - b[0]) + abs(a[1] - b[1]))
            j += 1
        else:
            break

Q = int(input())
ans = [None for _ in range(Q)]
for i in range(Q):
    L, R = map(int, input().split())
    if L == R:
        ans[i] = 0
    elif L // d - 1 < 0:
        ans[i] = s[R % d][R // d - 1]
    else:
        ans[i] = s[R % d][R // d - 1] - s[L % d][L // d - 1]
for i in range(Q):
    print(ans[i])

### FIXED CODE ###

h, w, d = map(int, input().split())
x = []
z = [None for i in range(h * w)]
for i in range(h):
    x.append(list(map(int, input().split())))
    for j in range(w):
        z[x[i][j] - 1] = [i + 1, j + 1]

s = [None for _ in range(d)]
for i in range(min(d, h * w - d + 1)):
    a = z[max(0, i - 1)]
    b = z[d + i - 1]
    s[i] = [abs(a[0] - b[0]) + abs(a[1] - b[1])]
    j = 1
    while(True):
        if d * (j + 1) + i <= h * w:
            a = z[d * j + i - 1]
            b = z[d * (j + 1) + i - 1]
            s[i].append(s[i][-1] + abs(a[0] - b[0]) + abs(a[1] - b[1]))
            j += 1
        else:
            break

Q = int(input())
ans = [None for _ in range(Q)]
for i in range(Q):
    L, R = map(int, input().split())
    if L == R:
        ans[i] = 0
    elif L // d - 1 < 0:
        ans[i] = s[R % d][R // d - 1]
    else:
        ans[i] = s[R % d][R // d - 1] - s[L % d][L // d - 1]
for i in range(Q):
    print(ans[i])
import math
n,k=map(int,input().split())

waru=(10**9)+7

# redkaijou=math.factorial(n-k+1)
# for i in range(blue):
#     bluekaijou*=i+1
# print(bluekaijou)

for i in range(k):
    ans=math.factorial(n-k+1)//math.factorial(i+1)//math.factorial(n-k-i)*((i+1)**(k-i-1))
    print(ans%waru)


### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

waru=(10**9)+7
# if n==k:
#     print(1)
#     for i in range(k-1):
#         print(0)
#     quit()

for i in range(k):
    if n-k+1<i+1:
        print(0)
    else:
        ans=combinations_count(n-k+1, i+1)
        ans*=combinations_count(k-1, i)
        print(ans%waru)
N, M = map(int, input().split())
num = ['a'] * N
for i in range(M):
    s, c = map(int, input().split())
    if num[s-1] == 'a':
        num[s-1] = str(c)
    elif num[s-1] == str(c):
        continue
    else:
        num.append('B')

if M == 0 and N != 1:
    num[0] = 1
elif M == 0 and N == 1:
    num[0] = 0
if num[0] == 'a' and M != 0:
    num[0] = '1'

for i in range(1,N):
    if num[i] == 'a':
        num[i] = '0'

if num[-1] == 'B':
    print(-1)
elif N == 1:
    print(''.join(num) if num[-1] != 'B' else -1)
elif num[0] == '0':
    print(-1)
else:
    print(''.join(num) if num[-1] != 'B' else -1)

### FIXED CODE ###

import sys
N,M = map(int, input().split())
num = ['B'] * N
for _ in range(M):
    s,c = map(int, input().split())
    if num[s-1] != 'B' and num[s-1] != c:
        num.append('No')
    else:
        num[s-1] = c

if N == 1 and num[0] == 'B':
    num[0] = 0
    
if N > 1 and num[0] == 'B':
    num[0] = 1

if 'No' in num:
    print(-1)
    sys.exit()
elif N > 1 and num[0] == 0:
    print(-1)
    sys.exit()
    
for i in range(1,N):
    if num[i] == 'B':
        num[i] = 0

for i in range(N):
    num[i] = str(num[i])

print(''.join(num))
List=list(map(int,input().split()))
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for i,j = zip(List,a):
	if i != j:
      c1 += 1

for i,j = zip(List,b):
	if i != j:
      c2 += 1

if a >= b:
	print(b)
else:
    print(a)

### FIXED CODE ###

List=input()
s = len(List)
a = [0] * s
b = [0] * s
b[1::2] = [1] * (s//2)
if s % 2 == 0:
	a[0::2] = [1] * (s//2)
else:
	a[0::2] = [1] * (s//2 + 1)

c1 = 0
c2 = 0

for (i,j) in zip(List,a):
	if int(i) != int(j):
		c1 += 1

for (i,j) in zip(List,b):
	if int(i) != int(j):
		c2 += 1

if c1 >= c2:
	print(c2)
else:
    print(c1)
a, b = map(int, input().split())
if a/b==1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b = map(int, input().split())
if b/a==1:
    print("Yes")
else:
    print("No")
n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n+1):
        if listA[0][j] not in listA[i] and listA[0][j] == listA[i][0]:
            break
        x += 1
print(x)

### FIXED CODE ###

n,m = map(int,input().split())
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
x = 0
for j in range(1,listA[0][0]+1):
    for i in range(1,n):
        listB = []
        for k in range(1,listA[i][0]+1):
          listB.append(listA[i][k])
        if listA[0][j] not in listB:
          break
    else:
    	x += 1
print(x)
(n,m),*xy = [list(map(int,r.split())) for r in open(0)]
g = [[] for _ in range(n)]
dp = [0 for _ in range(n)]

for i in xy:
    x,y = i[0],i[1]
    x -= 1
    y -= 1
    g[y].append(x)

def rec(node):
    if dp[node] > 0:
        return dp[node]
    
    if not g[node]:
        dp[node] = 0
        return 0

    for child in g[node]:
        dp[node] = max(dp[node], rec(child) + 1)

    return dp[node]

ans = 0
for i in range(n):
    ans = max(ans, rec(i))
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
(n,m),*xy = [list(map(int,r.split())) for r in open(0)]
g = [[] for _ in range(n)]
dp = [0 for _ in range(n)]

for i in xy:
    x,y = i[0],i[1]
    x -= 1
    y -= 1
    g[y].append(x)

def rec(node):
    if dp[node] > 0:
        return dp[node]
    
    if not g[node]:
        dp[node] = 0
        return 0

    for child in g[node]:
        dp[node] = max(dp[node], rec(child) + 1)

    return dp[node]

ans = 0
for i in range(n):
    ans = max(ans, rec(i))
print(ans)
n=int(input())
h=list(map(int,input().split()))
temp=0
if n==1:
  print("Yes")
else:
  for i in h:
    if h[i]<temp:
      print("No")
      break
    temp=max(temp,h[i]-1)
  else:
    print("Yes")

### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
base=0
for h in H:
    if base>h:
        print("No")
        break
    base=max(base,h-1)
else:
    print("Yes")
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4*h*n*w/(h*n+n*w+h*w) = N
    n*w+h*w = (n+h)*w = k*h*n  => k = (n+h)*w/(h*n)

    4hnw/(k+1)hn=4w/(k+1) = N
    """
    N = read_int()
    for w in range(1, 3501):
        if (4*w)%N == 0:
            k = (4*w)//N-1
            for n in range(1, 3501):
                if k*n-w > 0 and (n*w)%(k*n-w) == 0:
                    h = n*w//(k*n-w)
                    return h, n, w



if __name__ == '__main__':
    print(*solve())


### FIXED CODE ###



def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4/N = 1/h+1/n+1/w
    1/h = 4/N-1/n-1/w = 4nw-Nw-Nn / Nnw
    """
    N = read_int()
    for w in range(1, 3501):
        for n in range(1, 3501):
            if (4*n*w-N*w-N*n) != 0 and (N*n*w)%(4*n*w-N*w-N*n) == 0:
                h = (N*n*w)//(4*n*w-N*w-N*n)
                if h > 0:
                    return h, n, w


if __name__ == '__main__':
    print(*solve())
while True:

    a, b, c = map(int, raw_input().split())
    if(a | b | c == 0):break

    i = 0
    canArrive = False
    now = 0
    while True:
        if now <= c and c <= now + b:
            canArrive = True
            break
    
        now += (a + b)
        now %= 60

        if now == 0 : break

        i += 1

    if canArrive:
        print c + 60 * i
    else:
        print -1

### FIXED CODE ###


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

#if(a | b | c == 0):break

canArrive = False
i = 0
now = 0
while True:
    if now % 60 <= c and c <= now % 60 + a:
        canArrive = True
        break
    #end if
    now += (a + b)
    if now % 60 == 0 : break
#end while
if canArrive:
    print c + 60 * (now // 60)
else:
    print -1
    #end if

#end while
n = int(input())
m = int(input())
print((n - 1) * (m - 1))

### FIXED CODE ###

n, m = list(map(int,input().split(" ")))
print((n - 1) * (m - 1))
#18:09
r,g = map(int,input().split())
print ( 2 * g - r )

### FIXED CODE ###

#18:09
r = int(input())
g = int(input())
print ( 2 * g - r )
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    ptint("yes")
else:
    print("No")

### FIXED CODE ###

x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")
N = raw_input()
likes = raw_input()
pairs = 0
counter = 0
rabbit = 1
while counter < (int(N) * 2):
    if int(likes[((int(likes[counter]) -1 ) * 2)]) == rabbit:
        pairs += 1
        rabbit += 1
        counter += 2
    else:
        rabbit += 1
        counter += 2
pairs = pairs / 2
print pairs

### FIXED CODE ###

N = int(raw_input())
likes = map(int, raw_input().split())
pairs = 0
counter = 0
rabbit = 1
while counter < N:
    if likes[(likes[counter] - 1)] == rabbit:
        pairs += 1
        rabbit += 1
        counter += 1
    else:
        rabbit += 1
        counter += 1
pairs = pairs / 2
print pairs
s = str(input())
t = str(input())

t = t[：-1]

if s == t:
	print("Yes")
else:
  	print("No")

### FIXED CODE ###

s = str(input())
t = str(input())

if s == t[:-1]:
	print("Yes")
else:
  	print("No")
import sys
import math
from collections import deque
from collections import Counter

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    S = SI()
    l = len(S)
    T = [0] * (l+1)
    for i in range(l):
        T[i] = int(S[i:]) % 2019
    C = Counter(Counter(T).values())
    ans = 0
    for n, x in C.items():
        if n == 1: continue
        ans += cmb(n, 2) * x
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import math
from collections import deque
from collections import Counter

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

#nCr
def cmb(n, r):
    return math.factorial(n) // math.factorial(r) // math.factorial(n - r)


def main():
    S = SI()
    l = len(S)
    T = [0] * (l+1)
    inv_S = S[::-1]
    for i, s in enumerate(inv_S):
        s = int(s)
        T[i+1] = (T[i] + s * pow(10, i, 2019)) % 2019
    C = Counter(Counter(T).values())
    ans = 0
    for n, x in C.items():
        if n == 1: continue
        ans += cmb(n, 2) * x
    print(ans)


if __name__ == "__main__":
    main()
n = int(input())
a = list(map(int, input().split()))

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    count+= counta_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)

### FIXED CODE ###

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

count_list = {}
s = 0
for i in range(n):
  s += a[i]
  count_list[s] = count_list.get(s, 0) + 1

count = 0
count += count_list.get(0, 0) * (count_list.get(0, 0)+1)
for i in count_list.keys():
  if i!=0:
    #count+= count_list[i] * count_list.get(-i, 0)
    count += count_list[i] * (count_list[i]-1)
print(count//2)