Harryxun/stf_run huggingface dataset:
from math import factorial
def combi(n,r):
  res = factorial(n) / factorial(r) / factorial(n - r)
  return int(res)

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

data = {}

tmp = 0
for i in range(N):
  tmp += a[i]
  if tmp%M not in data:
    data[tmp%M] = 1
  else:
    data[tmp%M] += 1
else:
  data[0] += 1

cnt = list(data.values())
ans = 0
for i in cnt:
  if i == 1:
    continue
  elif i == 2:
    ans += 1
  else:
    ans += combi(i,2)
print(ans)


### FIXED CODE ###

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

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

S = {0 : 1}
t = 0
for i in range(N):
  t = (t + D[i]) % M
  if t in S:
    S[t] += 1
  else:
    S[t] = 1

r = 0

for i in S.values():
  r += i * (i - 1) // 2
  
print(r)
import math

n = int(input())
p = map(int, input().split())
size = math.ceil(math.sqrt(n))
array = []
square = []
for i in range(size ** 2):
    if i < n:
        array.append(p.__next__())
    else:
        array.append(0)
for i in range(size):
    m1, m2 = max(array[i * size], array[i * size + 1]), min(array[i * size], array[i * size + 1])
    for j in range(2, size):
        if m1 < array[i * size + j]:
            m1, m2 = array[i * size + j], m1
        elif m2 < array[i * size + j]:
            m2 = array[i * size + j]
    square.append((m1, m2))
def second(l, r):
    _m1, _m2 = 0, 0
    for i in range(l, l + (-l % size)):
        if _m1 < array[i]:
            _m1, _m2 = array[i], _m1
        elif _m2 < array[i]:
            _m2 = array[i]
    for i in range(math.ceil(l / size), r // size):
        if _m1 < square[i][0]:
            _m1, _m2 = square[i][0], _m1
        elif _m2 < square[i][0]:
            _m2 = square[i][0]
        if _m1 < square[i][1]:
            _m1, _m2 = square[i][1], _m1
        elif _m2 < square[i][1]:
            _m2 = square[i][1]
    for i in range((r // size) * size, r):
        if _m1 < array[i]:
            _m1, _m2 = array[i], _m1
        elif _m2 < array[i]:
            _m2 = array[i]
    return _m2


ans = 0
for i in range(n - 1):
    for j in range(i + 2, n + 1):
        ans += second(i, j)
print(ans)

### FIXED CODE ###

n=int(input())
print(n**3)
n=int(input())
s=list(input())
count=0

for i in range(n):
  if i<=48 :
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      count+=1
    
print(count)


### FIXED CODE ###

n=int(input())
s=list(input())
count=0
for i in range(n-2):
  if i<=48 :
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      count+=1
    
print(count)
x = int(input())

y = itertools.combinations(range(-50,50), 2)
i = 0
for n in y:
    if (n[0]**5 - n[1]**5) == x:
        print(n[0], n[1])
        break
    elif (n[1]**5 - n[0]**5) == x:
        print(n[1], n[0])
        break

### FIXED CODE ###

a = input()

if a == "ABC":
    print("ARC")
else:
    print("ABC")
import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()

import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print( max([gcd_list(A_li[:i]+A_li[i+1:]) for i in range(len(A_li))]) )


### FIXED CODE ###

import sys
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()

import fractions
from functools import reduce
from functools import lru_cache

@lru_cache(maxsize=None)
def calc_gcd(a, b):
    return fractions.gcd(a, b)

def gcd_list(numbers):
    if len(numbers) == 0: return None
    elif len(numbers) == 1: return numbers[0]
    else: return reduce(calc_gcd, numbers)

left_gcd = [None,A_li[0]]
prev_gcd = A_li[0]
for i in range(1,N-1):
    prev_gcd = calc_gcd(prev_gcd, A_li[i])
    left_gcd.append(prev_gcd)

right_gcd = [None, A_li[N-1]]
prev_gcd = A_li[N-1]
for i in range(1,N-1):
    prev_gcd = calc_gcd(prev_gcd, A_li[N-1-i])
    right_gcd.append(prev_gcd)
right_gcd.reverse()

print(max([right_gcd[0]]+[calc_gcd(left_gcd[i], right_gcd[i]) for i in range(1,len(A_li)-1)]+[left_gcd[N-1]]))
N = int(input())
a = map(int, input().split())


total_cost = float('inf')
for n in range(-100, 101):
    cost = 0
    for i in range(N):
        cost += (a[i] - n) ** 2
    total_cost = min(total_cost, cost)
print(total_cost)

### FIXED CODE ###

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

total_cost = float('inf')
for n in range(-100, 101):
    cost = 0
    for i in range(N):
        cost += (a[i] - n) ** 2
    total_cost = min(total_cost, cost)
print(total_cost)
a, b, c, x, y = map(int, input().split())

price = a * x + b * y

if (a + b) // 2 > c:
    if x >= y:
        price = min(2 * x * c, 2 * y * c + (x - y) * a)

    else:
        price = min(2 * x * c + (y - x) * b,  2 * y * c)

print(price)

### FIXED CODE ###

c_1 = list(map(int, input().split()))
c_2 = list(map(int, input().split()))
c_3 = list(map(int, input().split()))
c = c_1 + c_2 + c_3
if sum(c) == 3 * (c_1[0] + c_2[1] + c_3[2]):
    print('Yes')
else:
    print('No')
import sys
sys.setrecursionlimit(100000)  # set the maximum depth as 10000

n=int(input())
A=[int(x) for x in input().split()]

q=int(input())
M=[int(x) for x in input().split()]


def solve(i,m):
    global n
    global A
    
    if m==0:
        return True
    if i>=n:
        return False
    
    return solve(i+1,m) or solve(i+1,m-A[i])
    
    
for m in M:
    if solve(0,m):
        print('yes')
    else:
        print('no')


### FIXED CODE ###

input()
X = [int(x) for x in input().split()]
input()
Y = [int(x) for x in input().split()]

flag = [False]*2000
for j in range(1 << len(X)):
    n = 0
    for i in range(len(X)):
        if 1 & (j >> i) == 1:
            n += X[i]
    flag[n] = True

for m in Y:
    print("yes" if flag[m] else "no")
# N,Kの把握
l1 = list(map(int, input().split()))
N = l1[0]
K = l1[1]

#空リストを作成。a,bを把握し、リストにaを追加、b回。これをN回くりかえし
l3 = []
for i in range(N):
	l2 = list(map(int, input().split()))
	a = l2[0]
	b = l2[1]
	if b <= K:
		for j in range(b):
			l3.append(a):
	else
		for j in range(K):
			l3.append(a)

# リストをソートし、K番目を出力
l3.sort()
print(str(l3[K-1]))

### FIXED CODE ###

# N,Kの把握
l1 = list(map(int, input().split()))
N = l1[0]
K = l1[1]

#リストをすぐに作成するのが悪手。数値と回数をセット作成
dic = {}
for i in range(N):
	l2 = list(map(int, input().split()))
	a = l2[0]
	b = l2[1]
	if a in dic:
		dic[a] += b #既に存在する数値であればそのまま回数を＋
	else:
		dic.update({a: b}) #新規の数値であれば追加

dic = sorted(dic.items(), key=lambda x:x[0])

x = 0
for key, value in dic: #回数値を足していき、総回数＞＝Kとなったときの数値を出力する。
	x += value
	if x >= K:
		print(str(key))
		break
import collections

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

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n

for i in range(n//2):
    if max(dic.values()) == 1:
        break

    if len(ls) == 1 and dic[ls[0]] == 2:
        ans -= 2
        dic[ls[0]] -= 1
        break
    else:
        dic[ls[0]] -= 1
        dic[ls[-1]] -= 1
        ans -= 2

    if dic[ls[0]] <= 1:
        ls.popleft()
    if dic[ls[-1]] <= 1:
        ls.pop()

print(ans)


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]

import collections

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

dic = collections.defaultdict(int)
for i in range(n):
    dic[a[i]] += 1

ls = collections.deque()
for i in dic.keys():
    if dic[i] > 1:
        ls.append(i)

ans = n
if len(ls) > 0:
#n/2回ループ
    for i in range(n//2):
        if len(ls) == 1 and dic[ls[0]] == 2:
            ans -= 2
            dic[ls[0]] -= 1
            break
        else:
            if len(ls) == 1:
                dic[ls[0]] -= 2
            else:
                dic[ls[0]] -= 1
                dic[ls[-1]] -= 1
            ans -= 2

        if len(ls) > 1:
            if dic[ls[-1]] <= 1:
                ls.pop()
        if dic[ls[0]] <= 1:
            ls.popleft()

        if len(ls) == 0:
            break
print(ans)
n=int(input())
if n%2==0:
  print(1/2)
else:
  print((n+1)/2n)


### FIXED CODE ###

n=int(input())
if n%2==0:
  print(1/2)
else:
  print((n+1)/(2*n))
N, M, P = map(int, input().split())

E = [[0, 0, 0] for n in range(M)]
for n in range(N):
    A, B, C = map(int, input().split())
    E[n][0] = A - 1
    E[n][1] = B - 1
    E[n][2] = P - C


def BellmanFord(edges, num_v, source, end):
    inf = float("inf")
    dist = [inf for i in range(num_v)]
    dist[source] = 0

    for i in range(num_v):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]] + edge[2]

    end1 = dist[end]
    for i in range(num_v):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]] + edge[2]

    end2 = dist[end]

    return max(0, -end1) if end1 == end2 else -1


res = BellmanFord(E, N, 0, N - 1)
print(res)


### FIXED CODE ###

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

E = [[0, 0, 0] for m in range(M)]
for m in range(M):
    A, B, C = map(int, input().split())
    E[m][0] = A - 1
    E[m][1] = B - 1
    E[m][2] = P - C


def BellmanFord(edges, num_v, source, end):
    inf = 10 ** 12
    dist = [inf for i in range(num_v)]
    dist[source] = 0
    parent = [-1 for i in range(num_v)]

    for i in range(num_v):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]] + edge[2]
                parent[edge[1]] = edge[0]

    end1 = dist[end]
    trace1 = []
    r = end
    for n in range(num_v):
        trace1.append(r)
        r = parent[r]
        if r == -1:
            break

    for i in range(num_v):
        for edge in edges:
            if dist[edge[1]] > dist[edge[0]] + edge[2]:
                dist[edge[1]] = dist[edge[0]] + edge[2]
                parent[edge[1]] = edge[0]

    end2 = dist[end]
    trace2 = []
    r = end
    for n in range(num_v + 10):
        trace2.append(r)
        r = parent[r]
        if r == -1:
            break

    if trace2[-1] != source:
        return -1

    return max(0, -end1) if end1 == end2 else -1


res = BellmanFord(E, N, 0, N - 1)
print(res)
'''input
100000 1
1 100000 100
'''

N, M = [int(x) for x in input().split()]

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

for _ in range(M):
	a, b, w = [int(x) for x in input().split()]
	a -= 1
	b -= 1
	w = w & 1
	vien[a].append(b)
	vien[b].append(a)

been = [False]*N
ats = 0
def dfs(x):
	been[x] = True
	for u in vien[x]:
		if not been[u]:
			dfs(u)


for i in range(N):
	if been[i]: continue

	ats += 1
	dfs(i)

print(ats)

### FIXED CODE ###

'''input
100000 1
1 100000 100
'''
import sys
sys.setrecursionlimit(100100)
N, M = [int(x) for x in input().split()]

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

for _ in range(M):
	a, b, w = [int(x) for x in input().split()]
	a -= 1
	b -= 1
	w = w & 1
	vien[a].append(b)
	vien[b].append(a)

been = [False]*N
ats = 0
def dfs(x):
	been[x] = True
	for u in vien[x]:
		if not been[u]:
			dfs(u)


for i in range(N):
	if been[i]: continue

	ats += 1
	dfs(i)

print(ats)
monster_num, special_num = input().split()
monster_list = [input() for _ in range(monster_num)]


monster_list = sorted(monster_list)

for _ in range(special_num):
  monster_list = monster_list[:-1]
  
print(sum(monster_list))
  

### FIXED CODE ###

monster_num, special_num = map(int ,input().split())
monster_list = list(map(int, input().split()))
 
monster_list = sorted(monster_list)[::-1]
 
monster_list = monster_list[special_num:]
  
print(sum(monster_list))
S = input()
S[3:4] = '8'
print(S)

### FIXED CODE ###

S = input()
print('2018' + S[4:])
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(n):
  s,c = map(int,input().split())
  if ans[s-1] != -1 and ans[s-1] != str(c):
    print(-1)
    exit()
  ans[s-1] = str(c)
for i in range(n):
  if ans[i] == -1:
    ans[i] = "0"
print(int("".join(ans)))

### FIXED CODE ###

n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(m):
  s,c = map(int,input().split())
  if s == 1 and c == 0 and n != 1:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != str(c):
    print(-1)
    exit()
  ans[s-1] = str(c)
for i in range(n):
  if ans[i] == -1:
    if i == 0 and n != 1:
      ans[0] = "1"
    else:
      ans[i] = "0"
print(int("".join(ans)))
s = list(input())
def easy_step(s) :
    s_even = s[::2]
    s_odd = [1::2]
    if ("L" in s_odd) or ("R" in s_even) :
        print("No")
    else :
        print("Yes")
easy_step(s)

### FIXED CODE ###

def easy_step(s) :
    s_odd = s[::2]
    s_even = s[1::2]
    if ("L" in s_odd) or ("R" in s_even) :
        print("No")
    else :
        print("Yes")
s = list(input())
easy_step(s)
import math

def solve():
    a, b = map(int, input().split())
    return a//math.gcd(a, b)*b

print(solve())

### FIXED CODE ###

from fractions import gcd

def solve():
    a, b = map(int, input().split())
    return  a * b // gcd(a,b)

print(solve())
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
count = 0
if s[0][0] == "#":
    count = 1

dp = [[100000]*w for _ in range(h)]
dp[0][0] = count
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for j in range(h):
    for i in range(w):
        if i+1 < w:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < h:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[w-1][h-1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for i in range(h):
    for j in range(w):
        if i+1 < h:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < w:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])
import sys
input=sys.stdin.readline

def dfs(now, prev):
    ans[now]+=(h[now]+ans[prev])
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next != prev:
            if memo[next]==True:
                # 過去に訪れていれば閉路
                return False
            else:
                memo[next] = True
                dfs(next, now)


n, q = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)

h=[0]*n
for i in range(q):
    u, v = map(int, input().split())
    u -= 1
    h[u]+=v

ans=[0]*n
memo = [False for i in range(n)]
dfs(0,0)

print(' '.join(map(str, ans)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def dfs(now, prev):
    ans[now]+=(h[now]+ans[prev])
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next != prev:
            if memo[next]==True:
                # 過去に訪れていれば終わらせる
                return False
            else:
                memo[next] = True
                dfs(next, now)
 
#木構造の取り込み 
n, q = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
 
#操作の取り込み
h=[0]*n
for i in range(q):
    u, v = map(int, input().split())
    u -= 1
    h[u]+=v
 
#初期のカウンター
ans=[0]*n
memo = [False for i in range(n)]
 
#DFSでカウンターを動かす
dfs(0,0)
 
print(' '.join(map(str, ans)))
k= int(input())
cont=0
a, b= input().split()
a= int(a)
b= int(b)
while 1:
    cont+= k
    if a<= cont <= b:
        print("OK")
        break
    if x > b:
        print("NG")
        break

### FIXED CODE ###

k= int(input())
a, b= input().split()
a= int(a)
b= int(b)
cont=0
while 1:
    cont+= k
    if a<= cont <= b:
        print("OK")
        break
    if cont > b:
        print("NG")
        break
a = str(input())
if a == isupper():
    print('A')
elif a == islower():
    print('a')


### FIXED CODE ###

a=input()
if a.isupper():
    print('A')
elif a.lower():
    print('a')
import math
x1, y1, x2, y2 = map(int, input().split())
print(f'{math.sqrt((x2-x1)**2+(y2-y1)**2):.8f}')


### FIXED CODE ###

import math
x1, y1, x2, y2 = map(float, input().split())
print(f'{math.sqrt((x2-x1)**2+(y2-y1)**2):.8f}')
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
l = [
    b - a, c - a, d - a, e - a, c - b, d - b, e - b, d - c, e - c, e - d
]


for i in l:
    print(i)
    if l[i] > k:
        print(":(")
        break
else:
    print("Yay!")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
l = [
    b - a, c - a, d - a, e - a, c - b, d - b, e - b, d - c, e - c, e - d
]

for i in l:
    if i > k:
        print(":(")
        break
else:
    print("Yay!")
n=int(input())
a=list(map(int,input().split()))
a.sort()
m=a[n-1]
dp=[0]*(m)
ans=0
for i in a:
  for j in range(i,m+1,i):
    dp[j]+=1
for i in a:
  if dp[i]==1:
    ans+=1
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.sort()
m=a[n-1]
dp=[0]*(m+1)
ans=0
for i in a:
  for j in range(i,m+1,i):
    dp[j]+=1
for i in a:
  if dp[i]==1:
    ans+=1
print(ans)
a,b = map(int, input().split())

if b<10:
    N=10*a+b
elif b<100:
    N=100*a+b
else:
    N=1000*a+b
    
flag = -1

for i in range(317):
    if i*i == N:
        flag=1

if flag==1
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if b<10:
    N=10*a+b
elif b<100:
    N=100*a+b
else:
    N=1000*a+b
    
flag = -1

for i in range(317):
    if i*i == N:
        flag=1

if flag==1:
    print("Yes")
else:
    print("No")
import sys
S = input()
if S[0] != 'A' or :
    print('WA')
    sys.exit()
    
n = len(S)
ct = 0
for i in range(1, n):
    if S[i].islower():
        if i == 1 or i == n - 1 or S[i] != 'C':
            print('WA')
            sys.exit()
        ct += 1
if ct == 1:
    print('AC')
else:
    print('WA')

### FIXED CODE ###

import sys
S = input()
if S[0] != 'A':
    print('WA')
    sys.exit()
    
n = len(S)
ct = 0
for i in range(1, n):
    if S[i].islower() == False:
        if i == 1 or i == n - 1 or S[i] != 'C':
            print('WA')
            sys.exit()
        ct += 1
if ct == 1:
    print('AC')
else:
    print('WA')
from fractions import gcd

def lcm(a, b):
    _gcd = gcd(a, b)
    return int((a * b) / _gcd)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)

### FIXED CODE ###

from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t, ans)
print(ans)
q=input()
a=input().split()
b=map(int,a)
maximum=max(b)
minimum=min(b)
print(maximum-minimum)

### FIXED CODE ###

q=input()
a=input().split()
b=[int(i) for i in a]
maximum=max(b)
minimum=min(b)
print(maximum-minimum)
n = int(input())
S = [input() for i in range(n)]
cnt = 0
a = 0
b = 0
ba = 0
for i in range(n):
    cnt += S[i].count("AB")
    if S[i].startswith("B") and S[i].endswith("A")
        ba += 1
    elif S[i].startswith("B"):
        a += 1
    elif S[i].endswith("A"):
        b += 1
cnt += ba - 1
if a >= 1:
    cnt += 1
if b >= 1:
    cnt += 1
print(cnt)


### FIXED CODE ###

n = int(input())
S = [input() for i in range(n)]
cnt = 0
a = 0
b = 0
ba = 0
for i in range(n):
    cnt += S[i].count("AB")
    if S[i].startswith("B") and S[i].endswith("A"):
        ba += 1
    elif S[i].startswith("B"):
        b += 1
    elif S[i].endswith("A"):
        a += 1
if ba >= 1:
    cnt += ba - 1
    if a >= 1:
        cnt += 1
        a -= 1
    if b >= 1:
        cnt += 1
        b -= 1
    cnt += min(a, b)
elif a >= 1 and b >= 1:
    cnt += min(a, b)
print(cnt)
n = import()

print n*n*n

### FIXED CODE ###

x = raw_input()
x = int(x)
x = x ** 3
print x
def resolve():
	x = int(input())
	for i in range(1000):
		for j in range(-1000, 1000):
			if i**5 - j**5 == x:
				print(i, j)
				return

resolve()

### FIXED CODE ###

def resolve():
	s = input()
	if s == 'ABC':
		print('ARC')
	else:
		print('ABC')
resolve()
import numpy as np
MOD = 10**9+7

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

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)

### FIXED CODE ###

import numpy as np

N = int(input())
A = np.array(list(map(int,input().split())), dtype = 'int64')
a1 = np.min(A)
a2 = np.max(A)

ans = 1000000
for p in range(a1,a2+1):
    B = (A-p)**2
    s = np.sum(B)
    if s < ans:
        ans = s

print(ans)
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    ll a;
    double b;
    cin >> a >> b;
    ll y = ceil(b * 100.0);

    ll ans = a * y;

    ans /= 100;

    cout << ans << endl;
}


### FIXED CODE ###

import decimal

a, b = input().split()

a = int(a)
b = decimal.Decimal(b)
b *= 100

ans = a * b

ans //= 100

print(ans)
S=input()
src={}
ans=0
pre=0
for s in range(len(S)):
  a=(int(S[-(s+1)])*(10**s)+pre)%2019
  if a not in src.keys():
    src[a]=1
  else:
    ans+=src[a]
    src[a]+=1
  pre+=int(S[-(s+1)])*(10**s)
print(ans+src[0])

### FIXED CODE ###

S=input()
N=len(S)

a=0
t=1
d=[0]*2019
d[0]=1
for i in range(N):
  a+=int(S[N-1-i])*t
  a%=2019
  t*=10
  t%=2019
  d[a]+=1

ans=0
for n in d:
  ans += n*(n-1)//2
print(ans)
a = list(map(int,input()))
N = a[0]
A = a[1]
B = a[2]
ans = []
for a in range(10):
  for b in range(10):
    for c in range(10):
      for d in range(10):
        for e in range(10):
          if 10000*a+1000*b+100*c+10*d+e <= N and a+b+c+d+e >=A and a+b+c+d+e <= B:
            ans.append(10000*a+1000*b+100*c+10*d+e)
print(len(ans))

  

### FIXED CODE ###

n,a,b=map(int,input().split())
print(sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b))
xy=input().split()
x1=int(hw[0])
y1=int(hw[1])
x2=int(hw[2])
y2=int(hw[3])
a=x2-x1
b=y2-y1
print(x2-b,y2+a,x1-b,y1+a)

### FIXED CODE ###

xy=input().split()
x1=int(xy[0])
y1=int(xy[1])
x2=int(xy[2])
y2=int(xy[3])
a=x2-x1
b=y2-y1
print(x2-b,y2+a,x1-b,y1+a)
def solve():
    ans = 0
    N, M, P = map(int, input().split())
    edge = []
    for i in range(M):
        a,b,c = map(int, input().split())
        edge.append([P-c,a-1,b-1])
    d = [10**10]*N
    d[0]=0
    n = 0
    while True:
        n += 1
        update = False
        if n==N:
            updateN = False
        for i in range(M):
            w,u,v = edge[i]
            if d[u]<10**10 and d[v]>d[u]+w:
                d[v] = d[u]+w
                update = True
                if n>=N and v==N-1:
                    updateN = True
        if not update:
            break
        if n==N+M:
            if updateN:
                return -1
            break
    return max(0,-d[-1])
print(solve())

### FIXED CODE ###

def solve():
    ans = 0
    A, B = map(int, input().split())
    ans = max([A+B,A-B,A*B])
    return ans
print(solve())