Harryxun/stf_run huggingface dataset:
n, m = [int(_) for _ in input().split()]
c = []
flag = True
g = [[-1, -1] for _ in range(n)]
g_num = 0
for i in range(m):
    l, r, d = [int(_) for _ in input().split()]
    l -= 1
    r -= 1
    if g[l][0] != -1 and g[r][0] != -1 and g[l][0] == g[r][0]:
        if c[g[l][0]][g[r][1]][1] - c[g[l][0]][g[l][1]][1] != d:
            flag = False
            break
    elif g[l][0] != -1 and g[r][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        r_pos = c[g[r][0]][g[r][1]][1]

        for j in c[g[r][0]]:
            j[1] += l_pos + d - r_pos
        c[g[l][0]].extend(c[g[r][0]])
        del c[g[r][0]]
    elif g[l][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        c[g[l][0]].append([r, l_pos+d])
        g[r][0] = g[l][0]
        g[r][1] = g[c[g[l][0]][-2][0]][1]+1
    elif g[r][0] != -1:
        r_pos = c[g[r][0]][g[r][1]][1]
        c[g[r][0]].append([l, r_pos-d])
        g[l][0] = g[r][0]
        g[l][1] = g[c[g[r][0]][-2][0]][1]+1
    else:
        c.append([[l, 0], [r, d]])
        g[l][0] = g_num
        g[r][0] = g[l][0]
        g[l][1] = 0
        g[r][1] = 1
        g_num += 1
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n, m = [int(_) for _ in input().split()]
c = []
flag = True
g = [[-1, -1] for _ in range(n)]
g_num = 0
for i in range(m):
    l, r, d = [int(_) for _ in input().split()]
    l -= 1
    r -= 1
    if g[l][0] != -1 and g[r][0] != -1 and g[l][0] == g[r][0]:
        if c[g[l][0]][g[r][1]][1] - c[g[l][0]][g[l][1]][1] != d:
            flag = False
            break
    elif g[l][0] != -1 and g[r][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        r_pos = c[g[r][0]][g[r][1]][1]
        if r_pos > l_pos+d:
            for j in c[g[l][0]]:
                j[1] += r_pos - d - l_pos
                if j[1] > 10**9:
                    flag = False
                    break
                g[j[0]][1] += g[c[g[r][0]][-1][0]][1] + 1
            c[g[r][0]].extend(c[g[l][0]])
            for j in c[g[l][0]]:
                g[j[0]][0] = g[r][0]

        else:
            for j in c[g[r][0]]:
                j[1] += l_pos + d - r_pos
                if j[1] > 10**9:
                    flag = False
                    break
                g[j[0]][1] += g[c[g[l][0]][-1][0]][1] + 1
            c[g[l][0]].extend(c[g[r][0]])
            for j in c[g[r][0]]:
                g[j[0]][0] = g[l][0]

    elif g[l][0] != -1:
        l_pos = c[g[l][0]][g[l][1]][1]
        c[g[l][0]].append([r, l_pos+d])
        g[r][0] = g[l][0]
        g[r][1] = g[c[g[l][0]][-2][0]][1]+1
    elif g[r][0] != -1:
        r_pos = c[g[r][0]][g[r][1]][1]
        c[g[r][0]].append([l, r_pos-d])
        g[l][0] = g[r][0]
        g[l][1] = g[c[g[r][0]][-2][0]][1]+1
    else:
        c.append([[l, 0], [r, d]])
        g[l][0] = g_num
        g[r][0] = g[l][0]
        g[l][1] = 0
        g[r][1] = 1
        g_num += 1
    if not flag:
        break
if flag:
    print("Yes")
else:
    print("No")
import math
import collections


def main():
  N = int(input())
  S = [int(input()) for _ in range(N)]
  
  A = collections.Counter(S)
  
  print('AC × ' + A['AC'])
  print('WA × ' + A['WA'])
  print('TLE × ' + A['TLE'])
  print('RE × ' + A['RE'])
  
  
  
main()

### FIXED CODE ###

import math
import collections


def main():
  N = int(input())
  S = [input() for _ in range(N)]
  
  A = collections.Counter(S)
  
  
  print('AC x ' + str(A['AC']))
  print('WA x ' + str(A['WA']))
  print('TLE x ' + str(A['TLE']))
  print('RE x ' + str(A['RE']))
  
  
  
main()
s=str(input())
for i in range(len(s)):
  if s[i]==" ":
    s[i]=""
print[s]

### FIXED CODE ###

s = input().split()
print(s[1]+s[0])
n, l = map(int,input().split())
a = []
for x in range(n):
    a.append(input())
a.sort()
print("".join(a))

### FIXED CODE ###

a = sorted(list(map(int,input().split())))
if a == [5,5,7]:
	print("YES")
else:
	print("NO")
import sys
sys.setrecursionlimit(10000)
a,b,c,d=list(map(str,input()))
def solve(m,n):
    if eval(m)==7:
        print(m+"=7")
        exit(0)
    else:
        solve(m,n+2)
        solve(m[:n]+"-"+m[n+1:],n+2)
solve(a+"+"+b+"+"+c+"+"+d,1)

### FIXED CODE ###

s=input()
op=["+","-"]
for i in range(2):
    for j in range(2):
        for k in range(2):
            formula=s[0]+op[i]+s[1]+op[j]+s[2]+op[k]+s[3]
            if eval(formula)==7:
                print(formula+"=7")
                exit(0)
from collections import Counter

N = int(input())
S = input()

if N == 1 or N == 2:
    ans = 0
else:
    c = Counter(S)
    tmp = c.most_common()
    rgb = tmp[0][1] * tmp[1][1] * tmp[2][1]

    count = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            k = 2 * j - i
            if j + 1 <= k < N and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                count += 1
    ans = rgb - count

print(ans)

### FIXED CODE ###

N = int(input())
S = input()

if N == 1 or N == 2:
    ans = 0
else:
    R = S.count('R')
    G = S.count('G')
    B = S.count('B')
    rgb = R * G * B

    count = 0
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            k = 2 * j - i
            if k >= N:
                break 
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                count += 1
    ans = rgb - count

print(ans)
n, b, r = map(int, input().split())

num = 0
count = 0
res = ''

while num <= n:
  if count % 2 == 0:
    res += 'b'*b
    num += b
  else:
    res += 'r'*r
    num += r
  count += 1

ans = 0
for i in range(n):
  if res[i] == 'b':
    ans += 1
print(ans)

### FIXED CODE ###

n, b, r = map(int, input().split())

cnt_blk = n // (b+r)
res_b = cnt_blk*b
num = cnt_blk*(b+r) + b

if num > n:
  res_b += b - (num - n)
else:
  res_b += b
      
print(res_b)
import sys
import copy
n=int(input())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))

day=0

match=[0 for i in range(n)]
jyunban=[i for i in range(n)]

while True:
  jyunban_n=[]
  day+=1
  check=[True for i in range(n)]
  for i in jyunban:
    if match[i]>=n-1:
      check[i]=False
    if check[i]==False:
      continue
    else:
      vs=a[i][match[i]]-1
      if check[i] and check[vs] and a[i][match[i]]-1==vs and a[vs][match[vs]]-1==i:
        match[i]+=1
        match[vs]+=1
        check[i]=False
        check[vs]=False
        jyunban_n.push(i)
        jyunban_n.push(vs)
      
    if i==jyunban[-1]:
      if not False in check:
        print(-1)
        sys.exit()
  if min(match)==n-1 and max(match)==n-1:
    break
  jyunban=copy.copy(jyunban_n)
        
print(day)


### FIXED CODE ###

import sys
MAX_INT = int(10e9)
MIN_NUM = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()
 
N = I()
a = [IL()[::-1] for i in range(N)]
 
used = [-1]*N
updatelist = [i for i in range(N)]
total = N*(N-1)//2
cnt = 0
days = 0
ul = []
while updatelist:
  ul = []
  for i in updatelist:
    #print(a)
    #print(i+1)
    if len(a[i]) > 0 and used[i] != days:
      numIND = a[i][-1] -1
      #print(numIND+1)
      if a[numIND][-1] == i+1 and used[numIND] != days:
        a[i].pop(-1)
        a[numIND].pop(-1)
        used[i] = days
        used[numIND] = days
        ul.append(i)
        ul.append(numIND)
        cnt += 1
  else:
    updatelist = ul[:]
    if len(ul) != 0:
      days += 1
#print(a)
#print(cnt)
if cnt == total:
  print(days)
else:
  print(-1)
n, k, x, y = [int(input()) for _ in range(4)]
ans = k * x + max(n-k, 0) * y
print(ans)
n, k, x, y = [int(input()) for _ in range(4)]
if k < n:
    ans = k * x + (n-k) * y
else:
    ans = n * x
print(ans)


### FIXED CODE ###

n, k, x, y = [int(input()) for _ in range(4)]
if k < n:
    ans = k * x + (n-k) * y
else:
    ans = n * x
print(ans)
if N * A < B:
    print(N*A)
else:
    print(B)

### FIXED CODE ###

N,A,B= map(int, input().split())

if N * A < B:
    print(N*A)
else:
    print(B)
import sys

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))

q = [0] * (10 ** 9 + 1)
for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    else:
        print("NO")
        exit()

print("YES")


### FIXED CODE ###

import sys
from collections import defaultdict

N = int(input())
D = list(map(int, sys.stdin.readline().rsplit()))
M = int(input())
T = list(map(int, sys.stdin.readline().rsplit()))
q = defaultdict(int)

for d in D:
    q[d] += 1

for t in T:
    if q[t] > 0:
        q[t] -= 1
    else:
        print("NO")
        exit()

print("YES")
a, b = map(int, input().split())
op =int()

print(a+b if op = "+" else a-b)

### FIXED CODE ###

a, op, b = map(str, input().split())

 
print(int(a)+int(b) if op == "+" else int(a)-int(b))
from collections import defaultdict

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

d = defaultdict(list)
class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self,rank,parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor == parent:
                continue
            neighbor.set_rank(rank=rank+1,parent=self)



trees = {i:Tree(i) for i in range(1,N+1)}

for a,b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
trees[1].set_rank(1,None)

group0 = [node.v for node in  trees.values() if node.rank %2 ==0]
group1 = [node.v for node in  trees.values() if node.rank %2]
x = [set(),set(),set()]
for i in range(1,N+1):
    x[i%3].add(i)
if len(group1) < len(group0):
    group1,group0 = group0,group1

result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()]= x[0].pop()
    if group0:
        import time
        time.sleep(100)
    y = x[0]|x[1]|x[2]
    while group1:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()

print(' '.join(str(result[i]) for i in range(1,N+1)))



### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]


class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self, rank, parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor is parent:
                continue
            neighbor.set_rank(rank=rank + 1, parent=self)


trees = {i: Tree(i) for i in range(1, N + 1)}

for a, b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
try:
    trees[1].set_rank(1, None)
except:
    print(-1)
    exit()

group0 = [node.v for node in trees.values() if node.rank % 2 == 0]
group1 = [node.v for node in trees.values() if node.rank % 2]
x = [set(), set(), set()]
for i in range(1, N + 1):
    x[i % 3].add(i)
if len(group1) < len(group0):
    group1, group0 = group0, group1
result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    y = x[0] | x[1] | x[2]
    while group1 and y:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()
    if group0 or group1:
        print(-1)
        exit()

print(' '.join(str(result[i]) for i in range(1, N + 1)))
N = int(input())
a = list(map(int,input().split()))
a.sorted()
alice = 0
bob = 0
for i in range(N) :
    if i%2 == 0 : 
        alice += a[i]
    elif i%2 == 1 :
        bob += a[i]
print(alice-bob)
    


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
a.sort()
a.reverse()
alice = 0
bob = 0
for i in range(N) :
    if i%2 == 0 : 
        alice += a[i]
    elif i%2 == 1 :
        bob += a[i]
print(alice-bob)
n = int(input())
s = [int(i) for i in input().split()]
l = 0
for i in range(n):
  for j in range(n):
    if (s[i] == s[j] or s[i]%s[j] == 0) and (i != j):
      l += 1
      break
print(len(s)-l)


### FIXED CODE ###

x = [int(i) for i in input().split()]
print(x.index(0)+1)
def dfs(y, x, y0, x0, d=0):
    if y < 0 or y >= H or x < 0 or x >= W:
        return

    if seen[y][x]:
        return

    seen[y][x] = True

    if maze[y][x] == "#":
        return

    if d > dist[y0][x0]:
        dist[y0][x0] = d

    dfs(y, x+1, y0, x0, d+1)
    dfs(y+1, x, y0, x0, d+1)
    dfs(y, x-1, y0, x0, d+1)
    dfs(y-1, x, y0, x0, d+1)


dist = [[0] * W for _ in range(H)]

for i in range(H):
    for j in range(W):
        seen = [[False] * W for _ in range(H)]
        dfs(i, j, i, j)

ans = 0
for row in dist:
    for d in row:
        ans = max(ans, d)

print(ans)

### FIXED CODE ###

from collections import deque

def bfs(h, w):
    q = deque([[h, w]])
    dist[h][w] = 0

    while len(q) != 0:
        y, x = q.popleft()

        for step in steps:
            nx = x + step[0]
            ny = y + step[1]
            if nx < 0 or nx >= W or ny < 0 or ny >= H:
                continue
            if maze[ny][nx] == "#":
                continue
            if dist[ny][nx] != -1:
                continue
            dist[ny][nx] = dist[y][x] + 1
            q.append([ny, nx])


H, W = map(int, input().split())
maze = [[s for s in input()] for _ in range(H)]

steps = [[1, 0], [0, 1], [-1, 0], [0, -1]]
max_dist = [[0]*W for _ in range(H)]

for h in range(H):
    for w in range(W):
        if maze[h][w] == "#":
            continue
        dist = [[-1]*W for _ in range(H)]
        bfs(h, w)
        for row in dist:
            for d in row:
                max_dist[h][w] = max(max_dist[h][w], d)

ans = 0
for row in max_dist:
    for d in row:
        ans = max(ans, d)

print(ans)
upperbase,bottom,high = map(int,input().split())
print((upperbase + bottom) * high // 2)

### FIXED CODE ###

lis = [int(input()) for i in range(3)]
print((lis[0]+lis[1]) * lis[2] // 2)
n = int(input())
a = list(map(int, input().split()))

babies = [(a, i) for i, a in enumerate(a)]
babies.sort(reverse=True)

dp = [[0 for _ in range(n)] for _ in range(n)]
ans = 0
for l in range(n):
  for r in range(n):
    if l+r == n:
      ans = max(ans, dp[l][r])
      break
    activeness, ind = babies[l+r]
    dp[l+1][r] = max(dp[l+1][r], dp[l][r] + activeness * abs(ind - l))
    dp[l][r+1] = max(dp[l][r+1], dp[l][r] + activeness * abs(ind - (n - 1 - r)))
print(ans)

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
babies = [(a, i) for i, a in enumerate(a)]
babies.sort(reverse=True)

dp = [[0]*(n+1) for i in range(n+1)]

ans = 0

for l in range(n):
  for r in range(n):
    if l+r == n:
      ans = max(ans, dp[l][r])
      break
    activeness, ind = babies[l+r]
    dp[l+1][r] = max(dp[l+1][r], dp[l][r] + abs(ind - l) * activeness)
    dp[l][r+1] = max(dp[l][r+1], dp[l][r] + abs(ind - (n-1-r)) * activeness)
print(ans)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

for Cx in range(101):
    for Cy in range (101):
        for i in range (N):
            ls = []
            x = xyh[i][0]
            y = xyh[i][1]
            h = max(H-abs(x-Cx)-abs(y-Cy),0)
            ls.append([x,y,h])
        
        if set(ls) == set(xyh)
        ans = [Cx,Cy,h]

print(ans.split()) 
        


### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N = int(input())
xyh = []
for _ in range (N):
    xyh.append([int(x) for x in input().split()])

count = 0
while True:
    if xyh[count][2] > 0:
        xstd = xyh[count][0]
        ystd = xyh[count][1]
        hstd = xyh[count][2]
        break
    else:
        count += 1

for x in range (101):
    for y in range (101):
        Cx = x
        Cy = y
        H = hstd + abs(xstd-Cx) + abs (ystd - Cy)
        xyhcand = []
        for k in range (N) :
            xi = xyh[k][0]
            yi = xyh[k][1]
            h = max(H-abs(xi-Cx)-abs(yi-Cy),0)
            xyhls = [xi,yi,h]
            xyhcand.append(xyhls)
            xyhls = []
        if sorted(xyh) == sorted(xyhcand):
            ans = " ".join([str(x),str(y),str(H)])
            break
        
print(ans)
n,m = map(int,input().split())
x = list(map(int,input().split()))

x.sort()
interval = [0]*(m-1)

for i in range(m-1):
    interval[i] = x[i+1] - x[i]

interval.sort(reverse = True)

answer = x[m-1] - x[0]
for i in range(n-1):
    answer -= interval[i]

print(answer)


### FIXED CODE ###

n,m = map(int,input().split())
x = list(map(int,input().split()))

if n >= m:
    print(0)
else:
    x.sort()
    interval = [0]*(m-1)
    for i in range(m-1):
        interval[i] = x[i+1] - x[i]
    interval.sort(reverse = True)
    answer = x[m-1] - x[0]
    for i in range(min(m,n-1)):
        answer -= interval[i]
    print(answer)
def mian():
    a,b=map(jnt,input().split(' '))
    print(max(a+b,a-b,a*b))
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    a,b = map(int,input().split(' '))
    print(max(a+b,a-b,a*b))
if __name__ == '__main__':
    main()
import math

def hurui(a):
    ret = [True for i in range(a+1)]
    for i in range(2, int(math.sqrt(a))+2):
        for j in range(i*2, a+1, i):
            ret[j] = False

    return ret

n = int(input())
l = hurui(10000)
ans = 0
for i in range(n):
    a = int(input())
    if l[a]:
        ans += 1

print(ans)

### FIXED CODE ###

ans = 0
N = int(input())
for i in range(N):
    a = int(input())
    if a == 2:
        ans += 1
    elif a%2 == 0:
        continue
    else:
        if pow(2, a-1, a) == 1:
            ans += 1

print(ans)
#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    return cover
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        return ret
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
 
while True:
    data = raw_input()
    if data == "0":
        break
    m, n = map(int, data.split())
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()

### FIXED CODE ###

#Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
     ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
    q = [(y, x, 0)]
    cover = [[-1] * m for _ in xrange(n)]
    while len(q) != 0:
        y, x, step = q.pop(0)
        if cover[y][x] >= 0:
            continue
        cover[y][x] = step
        for dx, dy in D[y % 2]:           
            ny, nx = y + dy, x + dx
            if 0 <= ny < n and 0 <= nx < m:
                q.append((ny, nx, step + 1))
    return cover
 
def solve():
    scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
    min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
    def count(cover):
        ret = 0
        for y in xrange(n):
            for x in xrange(m):
                if cover[y][x] < min_cover[y][x]:
                    ret += 1
        return ret
    return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)

while True:
    data = raw_input()
    m, n = map(int, data.split())
    if m == 0:
        break
    s = input()
    spos = [map(int, raw_input().split()) for _ in xrange(s)]
    t = input()
    tpos = [map(int, raw_input().split()) for _ in xrange(t)]
    print solve()
N, M = map(int, input().split())

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    x,y = y,x
  par[y] = x
  size[x] += size[y]
  if rank[x]==rank[y]:
    rank[x]
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))

### FIXED CODE ###

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

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    par[x]=y
    size[y]+= size[x]
  else:
    par[y] = x
    size[x] += size[y]
    if rank[x]==rank[y]:
      rank[x]+=1
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

l = p[:x] + q[:y]
l.sort()

i = 0
while l[i] < r[i] and i < len(l) and i < len(r):
    l[i] = r[i]
    i += 1

print(sum(l))

### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

l = p[:x] + q[:y]
l.sort()

i = 0
while i < len(l) and i < len(r):
  if l[i] < r[i]:
    l[i] = r[i]
    i += 1
  else:
    break

print(sum(l))
a = list(map(int,input().split()))

k = max(abs(a[0]-a[1]),abs(a[1]-a[2]),abs(a[2]-a[1]))

print(abs(a[0]-a[1])+abs(a[1]-a[2])+abs(a[2]-a[0])-k

### FIXED CODE ###

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

print(abs(a[0]-a[1])+abs(a[1]-a[2]))
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
i_max = 0
i_count = 0
j_count = 0

for x in range(1, A[2]+1):
  if i_max < ((A[0]*x)//A[1]-A[0]*(x//A[1])):
    i_max = ((A[0]*x)//A[1]-A[0]*(x//A[1]))
    i_count = x
  if (x - i_count) == 1:
    j_count = j_count + 1
  if (j_count == 2):
    break
    
print(i_count)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))  # 入力のときに N を使う必要はありません
icount = 0
if A[1] - A[0] >= N:
  print('OK')
  icount = icount + 1
else:
  for i in range(A[0], A[1]+1):
    if i % N == 0:
      print('OK')
      icount = icount + 1
      if icount == 1:
        break
      
if icount == 0:
  print('NG')
from scipy.special import comb

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

ans = 0
for i in range(k, n+2):
    ans += ((n*2-i+1)*i)/2 - i*(i-1)/2 + 1

#print(ans)
print(ans%(10**9+7))


### FIXED CODE ###

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

ans = 0
for i in range(k, n+2):
    ans += ((n*2-i+1)*i)/2 - i*(i-1)/2 + 1

#print(ans)
print(int(ans%(10**9+7)))
n,k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
a = []
for i in range(len(p)-k):
  mx = sum(p[:i+k]) - sum(p[:i])
  a.append(mx)
max_a = max(a)
ans = (max_a + k)/2
print(ans)



### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()
[a,b]=list(map(int,input().split()))
if a*b=15:
  print("*")
else:
  if a+b=15:
    print("+")
    else:
      print("x")

### FIXED CODE ###

[a,b]=map(int,input().split())
if a*b==15:
  print("*")
else:
  if a+b==15:
    print("+")
  else:
    print("x")