Harryxun/stf_run huggingface dataset:
ope = {0:'+', 1:'-'}
ABCD = input()
for i in range(8):
    i = [i & (1<<j) for j in range(3)]
    fomula = ABCD[0] + ope[i[0]] + ABCD[1] + ope[i[1]] + ABCD[2] + ope[i[2]] + ABCD[3]
    if eval(fomula) == 7:
        print(f'{fomula}=7')
        break

### FIXED CODE ###

List = [int(n) for n in input()]
ans = [List[0]] * 4
for i in range(8):
    for j in range(3):
        if i & (1<<j):
            ans[j+1]= -List[j+1]
        else:
            ans[j+1] = List[j+1]
    if sum(ans) == 7:
        break
ans = [str(ans[0])] + ['+' + str(x) if x>=0 else str(x) for x in ans[1:]]
print("".join(ans) + '=7')
n=int(input())
a=[int(j) for j in input().split()]

def f(l,m):
    if l==[]:
        return -10**100
    if m==1:
        return max(l)
    if -(-len(l)//2)<m:
        return -10**100
    return max(f(l[1:],m),l[0]+f(l[2:],m-1))

print(f(a,n//2))

### FIXED CODE ###

n=int(input())
a=[int(j) for j in input().split()]
p=[0]*n
d=[0]*n
for i in range(n):
    p[i]=a[i]+p[i-2]
    if (i&1):
        d[i]=max(p[i-1],a[i]+d[i-2])
    else:
        d[i]=max(d[i-1],a[i]+d[i-2])
print(d[-1])
n, m = list(map(int, input().split()))
if m > 0:
  a = [int(input()) for i in range(m)]
else:
  a = []

if n == 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

pat = (pt[-1] % 1000000007)
print(pat)


### FIXED CODE ###

n, m = list(map(int, input().split()))
if m > 0:
  a = set([int(input()) for i in range(m)])
else:
  a = set([])

if n == 1:
  pat = 1
else:
  pt = [1]
  if (1 in a):
    pt.append(0)
  else:
    pt.append(1)

  for i in range(2, n + 1):
    if (i in a):
      pt.append(0)
    else:
      if (i-1 in a):
        pt.append(pt[i-2])
      else:
        pt.append(pt[i-1] + pt[i-2])

  pat = (pt[-1] % 1000000007)
print(pat)
a, b = map(int, input().split())
if (a*b % 2 == 0):
  return 'Even'
else:
  return 'Odd'

### FIXED CODE ###

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

if (a*b % 2 == 0):
  print('Even')
else:
  print('Odd')
from itertools  import product
N,M=map(int,input().split())
L=list([0]*M for _ in range(N))
ans=0
for x in range(N):
    for y in range(M):
        count=0
        for dx,dy in list(product([-1,0,1],repeat=2)):
            if 0<=x+dx<=N-1 and 0<=y+dy<=M-1:
                count+=1
        if count%2==1:
            ans+=1
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
if N>=2 and M>=2:
    print((N-2)*(M-2))
elif max(N,M)>=2 and min(N,M)==1:
    print(max(N,M)-2)
else:
    print(1)
K,N=map(int,input().split())
mod=998244353
table=[1]*(2*N+5)
t=1
for i in range(1,2*N+5):
    t*=i
    t%=mod
    table[i]=t
rtable=[1]*(2*N+5)
t=1
for i in range(1,2*N+5):
    t*=pow(i,mod-2,mod)
    t%=mod
    rtable[i]=t
ans=[]
for k in range(2,K+2):
    num=0
    if k%2==1:
        l=k//2
        p=l
        r=K-2*l
        for q in range(l+1):
            if N-q>=0 and r+q-1>=0:
                s=(table[l]*rtable[q]*rtable[l-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-1]*rtable[N-q]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num=num%mod
                #print(10,q,k,l,p,num,s)
        ans.append(num)
    else:
        l=k//2
        p=l-1
        r=K-k+1
        for q in range(p+1):
            if N-q-1>=0 and r+q-1>=0:
                s=(table[p]*rtable[q]*rtable[p-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-2]*rtable[N-q-1]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num%=mod
                #print(9,q,k,l,p,num,s)
            if N-q>=0 and r+q-1>=0:
                s=(table[p]*rtable[q]*rtable[p-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-1]*rtable[N-q]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num%=mod 
                #print(10,q,k,l,p,num,s)
        ans.append(num)
print('\n'.join(map(str,ans)))
ans=ans[::-1]
print('\n'.join(map(str,ans[1:])))

### FIXED CODE ###

K,N=map(int,input().split())
mod=998244353
L=max(K,N)
table=[1]*(3*L+5)
t=1
for i in range(1,3*L+5):
    t*=i
    t%=mod
    table[i]=t
rtable=[1]*(3*L+5)
t=1
for i in range(1,3*L+5):
    t*=pow(i,mod-2,mod)
    t%=mod
    rtable[i]=t
ans=[]
for k in range(2,K+2):
    num=0
    if k%2==1:
        l=k//2
        p=l
        r=K-2*l
        for q in range(l+1):
            if N-q>=0 and r+q-1>=0:
                s=(table[l]*rtable[q]*rtable[l-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-1]*rtable[N-q]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num=num%mod
                #print(10,q,k,l,p,num,s)
        ans.append(num)
    else:
        l=k//2
        p=l-1
        r=K-k+1
        for q in range(p+1):
            if N-q-1>=0 and r+q-1>=0:
                s=(table[p]*rtable[q]*rtable[p-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-2]*rtable[N-q-1]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num%=mod
                #print(9,q,k,l,p,num,s)
            if N-q>=0 and r+q-1>=0:
                s=(table[p]*rtable[q]*rtable[p-q])%mod
                s=(s*pow(2,q,mod))%mod
                t=(table[N+r-1]*rtable[N-q]*rtable[r+q-1])%mod
                s=(s*t)%mod
                num+=s
                num%=mod 
                #print(10,q,k,l,p,num,s)
        ans.append(num)
print('\n'.join(map(str,ans)))
ans=ans[::-1]
print('\n'.join(map(str,ans[1:])))
a, b, c = map(int, input().split())
divisores = [1]
    
for i in range(2, min(a,b) + 1):
    if a % i == 0 and b % i == 0:
        divisores.append(i)
print(divisores[-4])

### FIXED CODE ###

li=[int(i) for i in input().split()]
a=li[0]
b=li[1]
k=li[2]
c=[]
for i in range(1,min(a,b)+1):
    if(a%i==0 and b%i==0):
        c+=[i]

print(c[-k])
a,b,c,d = map(int,input().split())
count = 0
e = b - a
for i in range(a,d):
    if(i % c != 0 and i % d != 0):
        count += 1
for i in range(d,b + 1):
    if(i % c != 0 and i % d != 0):
        count += 1 
print(count)

### FIXED CODE ###

s = int(input())
n = []
f = 0

while s > 0:
    n.append(s % 10)
    s = s // 10

n.reverse()
if(len(n) < 3):
    f = 1

for i in range(1,len(n)):
    if(n[i] == n[i -1]):
        f = 1
        break

if(f == 1):
    print('Bad')
else:
    print('Good')
a,b=map(int,input())
print((a+b)%24)

### FIXED CODE ###

a,b=map(int,input().split())
print((a+b)%24)
import math
N=int(input())
for i in range(int(math.sqrt(N))-1,N+1):
    if N%i==0:
        print(len(str(i)))
        exit(0)

### FIXED CODE ###

N=int(input())
for i in range(int(N ** 0.5 + 1),-1,-1):
    if N % i == 0:
        print(len(str(N // i)))
        exit(0)
import math
def main():
	n=int(input())
	a=round(math.log10(n))
	count=0
	result=0
		while count<=a:
			if a<=1:
				result += n+1
				break
			else:
			if count==a:
				result += n-10**count + 1
				count += 2
			else:
				if  count==0:
					result+=10
					count +=2
				else:
					result += 10**(count+1)-10**count
					count += 2
	aaa=result-1
	print(aaa)
main()

### FIXED CODE ###

n=int(input())
re=0
for i in range(1,n+1):
  if len(str(i))%2==1:
    re+=1
print(re)
(a+b)*h/2

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2))
n=int(input())
import math
s=int(math.sqrt(n))
for i in range(1,n+1):
    count = 0
    for x in range(1,s):
        for y in range(1,s):
            for z in range(1,s):
                if x*x+y*y+z*z+x*y+y*z+z*x == i:
                        count += 1
    print(count)

### FIXED CODE ###

L,R,D=map(int,input().split())
startno = L
while startno % D != 0:
    startno += 1 
lista=list(range(startno,R+1,D))
#print(lista)
print(len(lista))
A,B,C,D = map(int, input().split())

while True:
    C -= B
    if C<=0:
        print("Yes")
        break
    if C>0:
        A -= D
        if A<=0:
            print("No")
            break
    i += 1

### FIXED CODE ###

A,B,C,D = map(int, input().split())
i = 0
while True:
    C -= B
    if C<=0:
        print("Yes")
        break
    if C>0:
        A -= D
        if A<=0:
            print("No")
            break
    i += 1
n=int(input())
a=list(int(input()))
ans=1
if 0 in a:
  print(0)
else:
  for i in range(n):
    ans*=a[i]
    if ans>10**18:
      print(-1)
      exit()
  print(ans)
  
  
  
       
       

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=1
if 0 in a:
  print(0)
else:
  for i in range(n):
    ans*=a[i]
    if ans>10**18:
      print(-1)
      exit()
  print(ans)
H, W = map(int, intput().split())
M = [input().split() for _ in range(H)]
for i, r in enumerate(M):
  for j, c in enumerate(r):
    if c == 'snuke':
      print("%s%d" %(chr(ord('A')+j), i))

### FIXED CODE ###

H, W = map(int, input().split())
M = [input().split() for _ in range(H)]
for i, r in enumerate(M):
  for j, c in enumerate(r):
    if c == 'snuke':
      print("%s%d" %(chr(ord('A')+j), i+1))
def d_menagerie(N, S):
    s = S + S[0:2]  # 円環状に並んでいることを考慮
    for ans in ['SS', 'SW', 'WS', 'WW']:  # Sは羊、Wは狼。1番と2番の種類を仮定する
        for i in range(1, N + 1):
            if (ans[-1] == 'S' and s[i] == 'o') or (ans[-1] == 'W' and s[i] == 'x'):
                # この場合、今注目している動物の両隣は同じ種類。
                # よって、今注目している動物の右隣を左隣と同じにする。
                ans += ans[-2]
            else:
                # 両隣は違う種類。右隣を左隣と逆にする。
                ans += ('S' if ans[-2] == 'W' else 'W')
        if ans[:2] == ans[N:]:
            # sの最初の2文字(仮定)と最後の2文字が一致した文字列のみ受理する。
            # 1つ見つければ良いので、すぐにbreakする
            ans = ans[:N]
            break
    else:  # どの割り当て方も矛盾した
        ans = '-1'
    return ans

N = int(input())
S = input().strip()
print(d_Menagerie(N, S))

### FIXED CODE ###

def d_Menagerie(N, S):
    s = S + S[0:2]  # 円環状に並んでいることを考慮
    for ans in ['SS', 'SW', 'WS', 'WW']:  # Sは羊、Wは狼。1番と2番の種類を仮定する
        cond = False
        for i in range(1, N + 1):
            if (ans[-1] == 'S' and s[i] == 'o') or (ans[-1] == 'W' and s[i] == 'x'):
                # この場合、今注目している動物の両隣は同じ種類。
                # よって、今注目している動物の右隣を左隣と同じにする。
                ans += ans[-2]
            else:
                # 両隣は違う種類。右隣を左隣と逆にする。
                ans += ('S' if ans[-2] == 'W' else 'W')
        if ans[:2] == ans[N:]:
            # sの最初の2文字(仮定)と最後の2文字が一致した文字列のみ受理する。
            # 1つ見つければ良いので、すぐにbreakする
            cond = True
            ans = ans[:N]
            break
    # 目的の文字列が存在すればその文字列を返し、存在しなければ-1を返す
    if cond:
        return ans
    else:
        return '-1'
    return None

N = int(input())
S = input().strip()
print(d_Menagerie(N, S))
N = int(input())


if N < 10:
  print(N)
  
elif N < 100:
  print(9)
  
elif N < 1000:
  print(9+ N-99)
  
elif N < 10000:
  print(909)

elif N < 100000:
  print(909 + N - 9999)

else:
  print(90909)


### FIXED CODE ###

A, B, C = (int(i) for i in input().split(" "))
 
D = A - B

 
if C - D <= 0:
  print(0)
else:
  print(C-D)
import math

A, B, C, D = map(int, input().split())

A -= 1

Z = ((C * D) // math.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)



### FIXED CODE ###

import fractions

A, B, C, D = map(int, input().split())

A -= 1

Z = ((C * D) // fractions.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)
s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(len(s_rev)):
  del s_rev[0]
    if len(s_rev) % 2 == 1:
      continue
    elif s[0:len(s_rev) // 2] != s[len(s_rev) // 2:len(s_rev)]:
      continue  
    elif len(s_rev) != 0:
      print(len(s_rev))
    

### FIXED CODE ###

s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(n):
  del s_rev[0]
  if len(s_rev) % 2 == 1:
    continue
  elif s[0:len(s_rev)// 2] != s[(len(s_rev) // 2):len(s_rev)]:
    continue  
  elif len(s_rev) != 0:
    print(len(s_rev))
    break
def main():
    n = int(input())
    ans = 0
    for i in range(n):
        if (i%3==0) and (i%5==0):
            continue
        if (i%3==0):
            continue
        if (i%5==0):
            continue
        ans += i
    print(ans)
main(

### FIXED CODE ###

def main():
    n = int(input())
    ans = 0
    for i in range(1, n+1):
        if (i%3==0) and (i%5==0):
            continue
        if (i%3==0):
            continue
        if (i%5==0):
            continue
        ans += i
    print(ans)
main()
while True:
    s=raw_input()
    if s=="0":break
    s+="".join([raw_input() for i in range(2)])
    L=[(i,i+1,i+2) for i in range(0,9,3)]+
    [(i,i+3,i+6) for i in range(3)]+
    [(0,4,8),(2,4,6)]
    for i,j,k in L:
        if s[i]==s[j]==s[k]:
            print "b" if s[i]=="b" else "w"
            break
    else:
        print "NA"

### FIXED CODE ###

while True:
    s=raw_input()
    if s=="0":break
    s+="".join([raw_input() for i in range(2)])
    L=[(i,i+1,i+2) for i in range(0,9,3)]+[(i,i+3,i+6) for i in range(3)]+[(0,4\
,8),(2,4,6)]
    for i,j,k in L:
        if s[i]==s[j]==s[k]!="+":
            print "b" if s[i]=="b" else "w"
            break
    else:
        print "NA"
def run(n, a):
    cnt = 0
    for i in range(n):
        while a[i] % 2 == 0:
            a[i] /= 2
            cnt += 1
    return cnt


def read_line():
    n = input().split()
    a = input().split()
    n = int(n)
    a = [int(a[i] for i in range(len(a)))]
    return (n, a)


def main():
    n, a = read_line()
    print(run(n, a))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def run(n, a):
    cnt = 0
    for i in range(n):
        while a[i] % 2 == 0:
            a[i] /= 2
            cnt += 1
    return cnt


def read_line():
    n, = input().split()
    a = input().split()
    n = int(n)
    a = [int(a[i]) for i in range(n)]
    return (n, a)


def main():
    n, a = read_line()
    print(run(n, a))


if __name__ == '__main__':
    main()
import numpy as np

N, K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    temp = list(map(int, input().split()))
    A = A + temp
hito = np.ones(N)
for i in range(len(A)):
    hito[A[i]] = 0
print(int(np.sum(hito)))

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
A = []
for i in range(K):
    d = int(input())
    temp = list(map(int, input().split()))
    A = A + temp
hito = np.ones(N)
for i in range(len(A)):
    hito[A[i]-1] = 0
print(int(np.sum(hito)))
def search(x, num):
    nodes.remove(x)
    for y in edge[x]:
        if x in edge[y]:
            edge[y].remove(x)
    for y in list(edge[x]):
        if y in nodes:
            num = search(y, num)
    return num + 1

(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in list(nodes):
    if x in nodes:
        ans = max(ans, search(x, 0))
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e6))

def search(x, num):
    nodes.remove(x)
#     for y in edge[x]:
#         edge[y].discard(x)
#     for y in list(edge[x]):
    for y in edge[x]:
        if y in nodes:
            num = search(y, num)
    return num + 1

(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in list(nodes):
    if x in nodes:
        ans = max(ans, search(x, 0))
print(ans)
import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
if m%n>10000:
  for i in range(1,n):
    if m%i==0 and is_prime(i) and is_prime(m//i) and (i==1 or m//i<n):
      print('1')
      exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m%(m-i+1)==0
    print(m-i+1)
    break


### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
elif N == 2:
    A = int(input(''))
    B = int(input(''))
    print(A + B)
a, b, c = map(int, input().split())
if (a==b) and (b!=c):
  print('Yes")
elif (b==c) and (c!=a):
  print('Yes")
elif (a==c) and (c!=b):
  print('Yes")
else:
  print('No')


### FIXED CODE ###

a, b, c = map(int, input().split())
if (a==b) and (b!=c):
  print('Yes')
elif (b==c) and (c!=a):
  print('Yes')
elif (a==c) and (c!=b):
  print('Yes')
else:
  print('No')
from collections import deque

H,W = map(int,input().split())
maze = [[] for i in range(H)]
con = 0
inf = 10 ** 9
distance = [[inf] * W for i in range(H)]

for i in range(H):
  m = list(input())
  maze[i] = m
  con += m.count("#")

def bfs(maze, disrance, sh, sw):
  queue = deque([[sh, sw]])
  distance[sh][sw] = 0
  while queue:
    h,w = queue.popleft()

    if h == H - 1 and w == W - 1:
      return distance[h][w] - 1
    for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
      new_h, new_w = h + j, w + k
      if new_h < 0 or new_h >= H or \
        new_w < 0 or new_w >= W:
          continue
      elif maze[new_h][new_w] != "#" and \
        distance[new_h][new_w] == inf:
        distance[new_h][new_w] = distance[h][w] + 1

        queue.append([new_h, new_w])
        
minpath = bfs(maze,distance,0,0)

print(H * W - con - minpath)

### FIXED CODE ###

from collections import deque

H,W = map(int,input().split())
maze = [[] for i in range(H)]
con = 0
inf = 10 ** 6
distance = [[inf] * W for i in range(H)]

for i in range(H):
  m = list(input())
  maze[i] = m
  con += m.count("#")

def bfs(maze, distance, sh, sw):
  queue = deque([[sh, sw]])
  distance[sh][sw] = 0
  while queue:
    h,w = queue.popleft()
    if h == H - 1 and w == W - 1:
      return distance[H - 1][W - 1]
    for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
      new_h, new_w = h + j, w + k
      if new_h < 0 or new_h >= H or \
        new_w < 0 or new_w >= W:
          continue
      elif maze[new_h][new_w] != "#" and \
        distance[new_h][new_w] > distance[h][w] + 1:
        distance[new_h][new_w] = distance[h][w] + 1

        queue.append([new_h, new_w])
  
minpath = bfs(maze,distance,0,0)

if minpath == None:
  print(-1)
else:
  print(H * W - minpath - con - 1)
n, m=map(int, input().split())
list = [list(map(int, input().split())) for _ in range(m)]
node = [i for i in range(0, n+1)]
ans = [0] * (m+1)
# print(node)
# print(ans)

def root(x):
    # print('ROOT!!')
    if node[x] == x:
        return x
    else:
        node[x] == root(node[x])
        return node[x]


def same(x, y):
    # print('SAME!!')
    return bool(root(x) == root(y))


def unite(x, y):
    # print('UNITE!!')
    x = root(x)
    y = root(y)
    if x == y:
        return
    node[x] = y
    # print('NODE')
    # print(node)


def find(x):
    # print('FIND!!!')
    # print(root(x))
    # print(node.count(root(x)))
    # print('NODE')
    # print(node)
    return node.count(root(x))


ans[0] = n*(n-1)//2


for i, element in enumerate(list[::-1]):
    # print('i,element')
    # if i == 0:
    #    continue
    # print(i, element)
    if same(element[0], element[1]):
        ans[i+1] = ans[i]
    else:
        ans[i+1] = ans[i]-find(element[0])*find(element[1])
        unite(element[0], element[1])
    # print('node')
    # print(node)
    # print('ans')
    # print(ans)
    # print('===============')

# print(ans)
# print(ans[:m:][::-1])
for i in ans[:m:][::-1]:
    print(i)


### FIXED CODE ###

from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def same(x, y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:
        return x
    else:
        node[x] = root(node[x])
        return node[x]
def unite(x, y):
    x, y = root(x), root(y)
    if x == y:
        return  # 結合不要
    if size[x] < size[y]:
        x, y = y, x
    node[y] = x
    size[x] += size[y]
def return_size(x):
    return size[root(x)]
    

n, m = MI()
ans = [0] * (m + 1)
bridge = [LI() for _ in range(m)]
# union-find
node = [i for i in range(n)]
size = [1 for i in range(n)]
# 辺を追加していない状態
ans[0] = (n * (n - 1)) // 2
i = 0 
for a, b in bridge[::-1]:
    if same(a - 1, b - 1):  # 辺を追加する以前のもともと連結であった
        ans[i + 1] = ans[i]
    else:
        ans[i + 1] = ans[i] - return_size(a - 1) * return_size(b - 1)
    unite(a - 1, b - 1)
    i += 1
for i in ans[:m][::-1]:
    print(i)
N = int(input())
l = []
for i in range(N):
    l.append(int(input()))
print(len(set(l)))


### FIXED CODE ###

N = int(input())
l = [input() for i in range(N)]
print(len(set(l)))
x,y=map(int,input().split)
if x%y==0:
  print(-1)
else:
  flag=0
  for i in range(10**18//x):
    if (i*x)%y!=0:
      print(i*x)
      flag=1
      break
    if flag==0:
      print(-1)

### FIXED CODE ###

x,y=map(int,input().split())
if x%y==0:
  print(-1)
else:
  flag=0
  for i in range(10**18//x):
    if (i*x)%y!=0:
      print(i*x)
      flag=1
      break
  if flag==0:
    print(-1)
import numpy as np
import numpy

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

S = numpy.cumsum(P)
P.append(0)
M = S[2]

for i in range(0,N):
    if P[i+K] == 0:
        break
    A = S[i+K] - S[i]
    M = max(M, A)

ans = 0.5 * (M + K)

print(ans)

### FIXED CODE ###

import numpy as np
import numpy

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

S = numpy.cumsum(P)
P.append(0)
M = S[K-1]

for i in range(0,N):
    if P[i+K] == 0:
        break
    A = S[i+K] - S[i]
    M = max(M, A)

ans = 0.5 * (M + K)

print(ans)
import math
N, X = map(int, input().split())
x = map(int, input().split())
r = next(x)-X
for i in x:
    r = math.gcd(r, i-X)
print(r)

### FIXED CODE ###

import fractions
N, X = map(int, input().split())
x = map(int, input().split())
r = abs(next(x)-X)
for i in x:
    r = fractions.gcd(r, abs(i-X))
print(r)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
print(string.ascii_lowercase[string.ascii_lowercase.index(input()+1])

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
print(string.ascii_lowercase[string.ascii_lowercase.index(input())+1])