qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
# -*- coding: utf-8 -*-

from sys import stdin

def load():
    n = stdin.readline()
    return n

def calc(n):
    return n.count("2")

n = load()
a,b,c = [ int(x) for x in n.split(' ')]

if (a+b>c and b+c>a and c+a>b):
    print('Yes')
else:
    print('No')

# Fixed code:
# -*- coding: utf-8 -*-

from sys import stdin

def load():
    n = stdin.readline()
    return n

def calc(n):
    return n.count("2")

n = load()
a,b,c = [ int(x) for x in n.split(' ')]

if (a==b and b==c):
    print('Yes')
else:
    print('No')
# Buggy code:
# coding: utf-8

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

if A == B && B == C:
  print('Yes')
else:
  print('No')

# Fixed code:
# coding: utf-8

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

if A == B and B == C:
  print('Yes')
else:
  print('No')
# Buggy code:
A,B,C=map(int,input().split())
if A==B&&A==C:
  print("Yes")
else:
  print("No")

# Fixed code:
A,B,C=map(int,input().split())
if A==B and A==C:
  print("Yes")
else:
  print("No")
# Buggy code:
DATA=list(map(int, input().split(" ")))
DATA=sorted(DATA)
if DATA[0] == DATA[-1]:
    print("Yes")
else;
    print("No")

# Fixed code:
DATA=list(map(int, input().split(" ")))
DATA=sorted(DATA)
if DATA[0] == DATA[-1]:
    print("Yes")
else:
    print("No")
# Buggy code:
a, b, c = map(int, input().split())
if (a+b > c) & (b+c > a) & (c+a > b):
    print("Yes")
else:
    print("No")

# Fixed code:
a, b, c = map(int, input().split())
if (a == b) & (b == c):
    print("Yes")
else:
    print("No")
# Buggy code:
A = list(map(int,input().split()))
if A[0] + A[1] > A[2]:
    print("Yes")
else:
    print("No")

# Fixed code:
A = list(map(int,input().split()))
if A[0] == A[1] == A[2]:
    print("Yes")
else:
    print("No")
# Buggy code:
A, B, C = map(lambda x: int(x), input().split(" "))
if A=B and B=C:
  print("Yes")
else:
  print("No")

# Fixed code:
A,B,C = map(int,input().split())
if A == B and B == C:
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int, input().split())
if a + b > c and b + c > a and c + a > b:
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c = map(int, input().split())
if a == b and b == c:
    print('Yes')
else:
    print('No')
# Buggy code:
A, B, C = map(int, input().split())
msg = 'Yes' if A == B and B == C else 'No'
print(mssg)

# Fixed code:
A, B, C = map(int, input().split())
msg = 'Yes' if A == B and B == C else 'No'
print(msg)
# Buggy code:
A,B,C = map(int, input().split())

print(A,B,C)

if A == B and B == C:
  print('Yes')
else:
  print('No')

# Fixed code:
A,B,C = map(int,input().split())

if A==B==C:
    print('Yes')
else:
    print('No')
# Buggy code:
a, b, c = map(int(input().split()))

if a == b == c:
    print('Yes')
else:
    print('No')

# Fixed code:
a,b,c=list(map(int,input().split()))
if c==a and c==b and a==b:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c == map(int,input().split())

if a==b and b==c:
  print("Yes")
else:
  print("No")

# Fixed code:
a, b, c = map(int,input().split())
if a== b and b == c:
  print("Yes")
else:
  print("No")
# Buggy code:
A,B,C = map(int,input().split())
if (A==B)and(B==C):
  print"Yes"
else:
  print"No"

# Fixed code:
A,B,C = map(int, input().split())
if(A==B==C):
    print('Yes')
else:
    print('No')
# Buggy code:
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    a, b, c = map(int, input().split())
    if max(a, b, c) < a + b + c - max(a, b, c):
        print('Yes')
    else:
        print('No')








if __name__ == '__main__':
    main()


# Fixed code:
from collections import Counter, defaultdict
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools


import queue
from collections import deque


def main():
    a, b, c = map(int, input().split())
    if a == b == c:
        print('Yes')
    else:
        print('No')








if __name__ == '__main__':
    main()
# Buggy code:
a,b,c = map(int, input().split())

if a=b=c:
  print('Yes')
else:
  print('No')

# Fixed code:
a,b,c = map( int, input().split())
if a == b and b == c:
    print("Yes")
else:
    print("No")
# Buggy code:
if __name__ == '__main__':
	a, b, c = map(int, input().split(' '))
    if a == b and b == c:
		print('Yes')
	else:
		print('No')

# Fixed code:
if __name__ == '__main__':
	a, b, c = list(map(int, input().split(' ')))
	if a == b and b == c:
		print('Yes')
	else:
		print('No')
# Buggy code:
a,b,c = map(int, input().split())
if a+b > c and b+c > a and c + a > b:
    print("Yes")
else:
    print("No")

# Fixed code:
a,b,c = map(int,input().split())
if a==b and b==c:
    print("Yes")
else:
    print("No")
# Buggy code:
A, B, C = (int, input().split())

if A == B == C :
    print("Yes")
else :
    print("No")

# Fixed code:
A, B, C = map(int, input().split())

if A == B == C:
  print('Yes')
else:
  print('No')
# Buggy code:
A,B,C = map(int, input().split())

if A<B+C and B<A+C and C<A+B:
  print("Yes")
else:
  print("No")



# Fixed code:
A,B,C = map(int,input().split())
if A == B and B == C and C == A:
  print('Yes')
else:
  print('No')
# Buggy code:
#!venv/bin/python

import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 

A, B, C = [int(x) for x in input().split()]

if A == B and B == C:
    print ("Yes")
else:
    print ("no")


# Fixed code:
#!venv/bin/python
 
import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 
 
A, B, C = [int(x) for x in input().split()]
 
if A == B and B == C:
    print ("Yes")
else:
    print ("No")
# Buggy code:
A, B, C = map(int, input().split( ))
if A == B & B==C:
        print('Yes')
    else: 
        print('No')

# Fixed code:
A,B,C = map(int,input().split(" "))
if A == B and B == C:
	print("Yes")
else:
	print("No")
# Buggy code:
print( 'Yes' if len(collections.Counter(map(int,input().split())).items()) == 1 else 'No' )

# Fixed code:
import collections
print( 'Yes' if len(collections.Counter(map(int,input().split())).items()) == 1 else 'No' )
# Buggy code:
a,b,c=map(int,input().split())
if a=b=c:
  print('Yes')
else:
  print('No')

# Fixed code:
a, b, c = map(int, input().strip().split(' '))
if a==b and b==c:
    print("Yes")
else:
    print("No")
# Buggy code:
a,b,c =map(int,input().split())
if(a==b==c):
  print("Yes")
  else:
    print("No")

# Fixed code:
a,b,c = map(int,input().split())

if a == b and b == c and c == a:
    print("Yes")
else:
    print("No")
# Buggy code:
N=int(input())
s=list(input().split())
r=s.count('R')
b=s.count('B')
if r>b:
  print('Yes')
else:
  print('No')

# Fixed code:
N=int(input())
s=input()
r=s.count('R')
b=s.count('B')
if r>b:
  print('Yes')
else:
  print('No')
# Buggy code:
num = int(input())
col = input()
r = clo.count("R")
b = num - r
if r > b :
    ans = "Yes"
else :
    ans = "No"
print (ans)

# Fixed code:
num = int(input())
col = input()
r = col.count("R")
b = num - r
if r > b :
    ans = "Yes"
else :
    ans = "No"
print (ans)
# Buggy code:
n = int(input())
s = [i for i in input().split()]

red = count('R')
blue = count('B')

if red > blue:
  print('Yes')
else:
  print ('No')

# Fixed code:
n = int(input())
s = [i for i in input()]

red = s.count('R')
blue = s.count('B')

if red > blue:
  print('Yes')
else:
  print ('No')
# Buggy code:
l = int(input())
s = input()
r  = l.count("R")
b = l.count("B")
if (r > b):
    print("Yes")
else:
    print("No")

# Fixed code:
l = int(input())
s = input()
r  = s.count("R")
b = s.count("B")
if (r > b):
    print("Yes")
else:
    print("No")
# Buggy code:
from sys import stdin

n = int(stdin.readline().rstrip())
data = stdin.readline().rstrip().split()
print(type(data))
s = str(data[0])
count_red, count_blue = 0,0
for i in range(len(s)):
    if s[i] == "R":
        count_red += 1
    else:
        count_blue += 1

if count_red > count_blue:
    print("Yes")
else:
    print("No")


# Fixed code:
from sys import stdin

n = int(stdin.readline().rstrip())
data = stdin.readline().rstrip().split()
s = str(data[0])
count_red, count_blue = 0,0
for i in range(len(s)):
    if s[i] == "R":
        count_red += 1
    else:
        count_blue += 1

if count_red > count_blue:
    print("Yes")
else:
    print("No")
# Buggy code:
s = input()
R = s.count('R')
B = s.count('B')

if R > B:
    print('Yes')
else:
    print('No')

# Fixed code:
N = input()
s = input()
R = s.count('R')
B = s.count('B')

if R > B:
    print('Yes')
else:
    print('No')
# Buggy code:
n = input()
x= input()

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")


# Fixed code:
n = int(input())
x= input()

count = 0
me = 0
for i in range(n):
  if x[i] == "R":
    count +=1
  else:
    me +=1
    

if count > me:
  print("Yes")
else:
  print("No")
# Buggy code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
N = int(input())
s = input().split()
r = 0
b = 0

for i in range(0, len(s)):
    if s[i] == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print("Yes")
else:
    print("No")


# Fixed code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline
N = int(input())
s = input().strip()
r = 0
b = 0

for i in range(0, len(s)):
    if s[i] == 'R':
        r += 1
    else:
        b += 1

if r > b:
    print("Yes")
else:
    print("No")
# Buggy code:
N = int(input())
S = input()
print("Yes" if S.count("B") > S.count("R") else "No")

# Fixed code:
N = int(input())
S = input()


print("Yes" if S.count("R") > S.count("B") else "No")
# Buggy code:
input1 = input()
N = int(input1)
input2 = input()
S = input2
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

# Fixed code:
input1 = input()
N = int(input1)
input2 = input()
S = list(input2)
 
R = 0
B = 0
h = 'No'
 
for i in range(N):
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)
# Buggy code:
N = int(input())
S = input()
print("Yes" if N/2 < S.count(R) else "No")

# Fixed code:
N = int(input())
S = input()
print("Yes" if N/2 < S.count("R") else "No")
# Buggy code:
from sys import stdin

N= int(input())
l = input()
print(l.count("R"))

if N - l.count("R") < l.count("R"):
    print("Yes")
else:
    print("No")


# Fixed code:
from sys import stdin

N= int(input())
l = input()

if l.count("B") < l.count("R"):
    print("Yes")
else:
    print("No")
# Buggy code:
N = int(input())
S = input()

cnt = 0
for s in S:
  if "R" == cnt:
    cnt += 1

if cnt > N - cnt:
  print("Yes")
else:
  print("No")

# Fixed code:
N = int(input())
S = input()

cnt = 0
for s in S:
  if "R" == s:
    cnt += 1

if cnt > N - cnt:
  print("Yes")
else:
  print("No")
# Buggy code:
n = int(input())
s = input()
R = s.count('R')
B = len(s)-R
if R > B:
  print('Yes')
else:
  peint('No')

# Fixed code:
n = int(input())
s = input()

R = s.count('R')
B = len(s)-R

if R > B:
  print('Yes')
else:
  print('No')
# Buggy code:
s = list(input())

if s.count('R') > s.count('B'):
  print('Yes')
else:
  print('No')



# Fixed code:
input()
s = input()

if s.count('R') > s.count('B'):
    print('Yes')
else:
    print('No')
# Buggy code:
n=int(input())
#s = input().split()
print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")

# Fixed code:
n=int(input())
s = input()
#print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")
# Buggy code:
N = int(input())
S = input()
r = s.count('R')
b = s.count('B')
msg = 'Yes' if r > b else 'No'
print(msg)

# Fixed code:
N = int(input())
S = input()
r = S.count('R')
b = S.count('B')
msg = 'Yes' if r > b else 'No'
print(msg)
# Buggy code:
n=int(input())
s=input()
ans "Yes" if s.count("R") > n//2 eise "No" 
print(ans)

# Fixed code:
n=int(input())
s=input()
ans= "Yes" if s.count("R") > n//2 else "No" 
print(ans)
# Buggy code:
i = input()
if i.count('R') > i.count('B'):
	print('Yes')
else :
	print('No')

# Fixed code:
input()
i = input()
if i.count('R') > i.count('B'): print('Yes')
else : print('No')
# Buggy code:
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

if s.cound("R") > s.count("B"):
    print("Yes")
else:
    print("No")

# Fixed code:
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

if s.count("R") > s.count("B"):
    print("Yes")
else:
    print("No")
# Buggy code:
N = int(input())
s = input().split()
print('Yes') if s.count('R') > s.count('B') else print('No')

# Fixed code:
N = int(input())
s = input()
print('Yes') if s.count('R')>s.count('B') else print('No')
# Buggy code:
s = input()
if s.count("R")>s.count("B"):
  print("Yes")
else:
  print("No")

# Fixed code:
N=input()
s = input()
if s.count("R")>s.count("B"):
  print("Yes")
else:
  print("No")
# Buggy code:
num = int(input())
hats = input()

rhat = len([hat for hat in fats if hat == "R"])
bhat = len([hat for hat in fats if hat == "B"])

if rhat > bhat:
    print("Yes")
else:
    print("No")

# Fixed code:
num = int(input())
hats = input()

rhat = len([hat for hat in hats if hat == "R"])
bhat = len([hat for hat in hats if hat == "B"])

if rhat > bhat:
    print("Yes")
else:
    print("No")
# Buggy code:
N = int(input())
s = str(input())
print(s)
cntA = 0
cntB = 0

for i in  s:
    if i == "R":
        cntA = cntA + 1
    else:
        cntB = cntB + 1
        
if cntA > cntB:
    print("Yes")
else:
    print("No")

# Fixed code:
N = int(input())
s = str(input())
cntA = 0
cntB = 0

for i in  s:
    if i == "R":
        cntA = cntA + 1
    else:
        cntB = cntB + 1
        
if cntA > cntB:
    print("Yes")
else:
    print("No")
# Buggy code:
n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    pritn('No')

# Fixed code:
n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    print('No')
# Buggy code:
N = int(input())
S = input()

red = 0
blue = 0
for s in S:
    if s == 'R':
        red++
    else:
        blue++

if red > blue:
    print('Yes')
else
    print('No')

# Fixed code:
N = int(input())
S = input()

red = 0
blue = 0
for s in S:
    if s == 'R':
        red = red+1
    else:
        blue = blue+1

if red > blue:
    print('Yes')
else:
    print('No')
# Buggy code:
n = int(input())
a = str(input())
if a.count("r") > n /2:
  print("Yes")
else:
  print("No")

# Fixed code:
n = int(input())
a = str(input())
if a.count("R") > n /2:
  print("Yes")
else:
  print("No")
# Buggy code:
n = int(input())
s=input()

red=0
for i in s:
    if i=='R':
        red+=1

if red>=-(-n//2): print('Yes')
else: print('No')

# Fixed code:
n = int(input())
s=input()

red=0
for i in s:
    if i=='R':
        red+=1

if red>n-red: print('Yes')
else: print('No')
# Buggy code:
import sys
 
input = sys.stdin.readlines()
 
n = int(input[0])
print(input[1])
hatList = list(input[1])
counter = 0

for i in range (n):
  if(hatList[i] == "R"):
    counter += 1
  if counter >= (n/2 + 1):
    print("Yes")
    exit()
    
print("No")

# Fixed code:
import sys
 
input = sys.stdin.readlines()
 
n = int(input[0])
hatList = list(input[1])
counter = 0

for i in range (n):
  if(hatList[i] == "R"):
    counter += 1
    
if counter > (n/2):
    print("Yes")
else:
	print("No")
# Buggy code:
N = input(int)
L = input()
R_list = [s for s in L if 'R' in s]
B_list = [s for s in L if 'B' in s]

if len(R_list) >len(B_list):
    print('Yes')
else:
    print('No')

# Fixed code:
N = input()
L = input()
R_list = [s for s in L if 'R' in s]
B_list = [s for s in L if 'B' in s]
if len(R_list) >len(B_list):
    print('Yes')
else:
    print('No')
# Buggy code:
def main():
    N, M = (int(i) for i in input().split())
    par = [i for i in range(N)]
    rank = [0]*N

    def find_root(x):
        if par[x] == x:
            return x
        else:
            par[x] = find_root(par[x])
            return par[x]

    def is_same_group(x, y):
        return find_root(x) == find_root(y)

    def unite(x, y):
        x = find_root(x)
        y = find_root(y)
        if x == y:
            return
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x] == rank[y]:
                rank[x] += 1

    def size(x):
        return rank[find_root(x)]

    ans = [N*(N-1)//2]
    AB = [[int(i)-1 for i in input().split()] for j in range(M)]
    for a, b in AB[::-1]:
        if is_same_group(a, b):
            ans.append(ans[-1])
        else:
            p = size(a) + 1
            q = size(b) + 1
            unite(a, b)
            ans.append(ans[-1] - p * q)

    for a in ans[::-1]:
        print(a)


if __name__ == '__main__':
    main()


# Fixed code:
def main():
    N, M = (int(i) for i in input().split())
    par = [i for i in range(N)]
    rank = [1]*N

    def find_root(x):
        if par[x] == x:
            return x
        else:
            par[x] = find_root(par[x])
            return par[x]

    def is_same_group(x, y):
        return find_root(x) == find_root(y)

    def unite(x, y):
        x = find_root(x)
        y = find_root(y)
        if x == y:
            return
        if rank[x] < rank[y]:
            x, y = y, x
        rank[x] += rank[y]
        par[y] = x

    def size(x):
        return rank[find_root(x)]

    ans = [N*(N-1)//2]
    AB = [[int(i)-1 for i in input().split()] for j in range(M)]
    for a, b in AB[::-1]:
        if is_same_group(a, b):
            ans.append(ans[-1])
        else:
            p = size(a)
            q = size(b)
            # print(a, b, p, q)
            unite(a, b)
            ans.append(ans[-1] - p * q)
    ans = ans[::-1]
    for a in ans[1:]:
        print(a)


if __name__ == '__main__':
    main()
# Buggy code:
N, M = map(int, input().split())

root = [i for i in range(N + 1)]
comp_size = [1] * (N+1)

def root_find(x):
  y = root[x]
  if x == y:
    return x
  else:
    z = root_find(y)
    root[x] = z
    return z

def merge(x, y):
  #print(x, y)
  rx = root_find(x)
  ry = root_find(y)
  sx = comp_size[rx]
  sy = comp_size[ry]
  if rx == ry:
    return 0
  else:
    if sx >= sy:
      root[ry] = rx
      comp_size[rx] = sx + sy
    else:
      root[rx] = ry
      comp_size[ry] = sx + sy
    return sx * sy

network = 0
answer = []
for i in range(M):
  a, b = map(int, input().split())
  answer.append(N * (N - 1) // 2 - network)
  network += merge(a, b)

answer = answer[::-1]
for a in answer:
  print(a)

# Fixed code:
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

AB = AB[::-1]

root = [i for i in range(N + 1)]
comp_size = [1] * (N+1)

def root_find(x):
  y = root[x]
  if x == y:
    return x
  else:
    z = root_find(y)
    root[x] = z
    return z

def merge(x, y):
  #print(x, y)
  rx = root_find(x)
  ry = root_find(y)
  sx = comp_size[rx]
  sy = comp_size[ry]
  if rx == ry:
    return 0
  else:
    if sx >= sy:
      root[ry] = rx
      comp_size[rx] = sx + sy
    else:
      root[rx] = ry
      comp_size[ry] = sx + sy
    return sx * sy

network = 0
answer = []
for a, b in AB:
  #print(a, b, root)
  answer.append(N * (N - 1) // 2 - network)
  network += merge(a, b)

answer = answer[::-1]
for a in answer:
  print(a)
# Buggy code:
class UnionFind:
  def __init__(self, n):
    self.par = [-1 for _ in range(n)]
  def root(self, x):
    return x if self.par[x] < 0 else self.root(self.par[x])
  def unite(self, x, y):
    x, y = self.root(x), self.root(y)
    if x != y:
      if self.par[y] < self.par[x]:
        x, y = y, x
      self.par[x] += self.par[y]
      self.par[y] = x
    return x != y
  def find(self, x, y):
    return self.root(x) == self.root(y)
  def size(self, x):
    return -self.par[self.root(x)]

n, m = map(int, input().split())
tree = UnionFind(n)
b = []
for _ in range(m):
  a, c = map(int, input().split())
  b.append([a - 1, c - 1])
b.reverse()
ans = [sum(range(n))]
for i, p in enumerate(b):
  if not tree.find(p[0], p[1]):
    ans.append(ans[-1] - tree.size(p[0])*tree.size(p[1]))
    tree.unite(p[0], p[1])
  elif i != m - 1:
    ans.append(ans[-1])
for i in reversed(ans):
  print(i)


# Fixed code:
class UnionFind:
  def __init__(self, n):
    self.par = [-1 for _ in range(n)]
  def root(self, x):
    return x if self.par[x] < 0 else self.root(self.par[x])
  def unite(self, x, y):
    x, y = self.root(x), self.root(y)
    if x != y:
      if self.par[y] < self.par[x]:
        x, y = y, x
      self.par[x] += self.par[y]
      self.par[y] = x
    return x != y
  def find(self, x, y):
    return self.root(x) == self.root(y)
  def size(self, x):
    return -self.par[self.root(x)]

n, m = map(int, input().split())
tree = UnionFind(n)
b = []
for _ in range(m):
  a, c = map(int, input().split())
  b.append([a - 1, c - 1])
b.reverse()
ans = [sum(range(n))]
for i, p in enumerate(b):
  tmp = ans[-1]
  if not tree.find(p[0], p[1]):
    tmp -= tree.size(p[0])*tree.size(p[1])
    tree.unite(p[0], p[1])
  ans.append(tmp)
for i in reversed(ans[:-1]):
  print(i)
# Buggy code:
n,m=map(int,input().split())
bridge=[[] for i in range(m)]
leader=[i for i in range(n+1)]
member=[1 for i in range(n+1)]
for i in range(m):
    bridge[i]=list(map(int,input().split()))
ans=[0 for i in range(m+1)]
ans[0]=int((n-1)*n/2)
k=1
for i in reversed(bridge):
    print(leader)
    print(member)
    le0=leader[i[0]]
    le1=leader[i[1]]
    if le0!=le1:
        ans[k]=ans[k-1]-member[le0]*member[le1]
        if member[le0]>=member[le1]:
            member[le0]+=member[le[1]]
            leader[i[1]]=le0
        else:
            member[le1]+=member[le0]
            leader[i[0]]=le1
    else:
        ans[k]=ans[k-1]
    if ans[k]==0:
        ans[k:]=[0 for l in range(m-k)]
        break
    k+=1
for i in range(m):
    print(ans[m-1-i])

# Fixed code:
n,m=map(int,input().split())
bridge=[[] for i in range(m)]
leader=[i for i in range(n+1)]
member=[1 for i in range(n+1)]
for i in range(m):
    bridge[i]=list(map(int,input().split()))
ans=[0 for i in range(m+1)]
ans[0]=int((n-1)*n/2)
k=1
for i in reversed(bridge):
    le0=leader[i[0]]
    le1=leader[i[1]]
    while le0!=leader[le0]:
        le0=leader[le0]
        leader[i[0]]=le0
        
    while le1!=leader[le1]:
        le1=leader[le1]
        leader[i[1]]=le1
        
    if le0!=le1:
        ans[k]=ans[k-1]-member[le0]*member[le1]
        if member[le0]>=member[le1]:
            member[le0]+=member[le1]
            leader[le1]=le0
        else:
            member[le1]+=member[le0]
            leader[le0]=le1
    else:
        ans[k]=ans[k-1]
    if ans[k]==0:
        ans[k:]=[0 for l in range(m-k)]
        break
    k+=1
for i in range(m):
    print(ans[m-1-i])