Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Fixed submission:
import sys

n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

sys.setrecursionlimit(10**6)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Fixed submission:
import sys

n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

sys.setrecursionlimit(10**6)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * n

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Fixed submission:
import sys

n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

sys.setrecursionlimit(10**6)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * (n + 1)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)

Fixed submission:
import sys

n, m = [int(i) for i in input().split(" ")]
e = []
par = [i for i in range(0, n + 1)]
count = [1] * (n + 1)
unu = [0] * m

sys.setrecursionlimit(10**6)

for i in range(0, m):
    e.append([int(j) for j in input().split(" ")])

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

def unite(x, y, e):
    x = root(x)
    y = root(y)
    if x == y:
        return
    else:
        unu[e] = count[x] * count[y]
        count[y] += count[x]
        par[x] = y

for i in reversed(range(0, m)):
    unite(e[i][0], e[i][1], i)

s = 0
for i in range(0, m):
    s += unu[i]
    print(s)