Harryxun/stf_run huggingface dataset:
import numpy as np

n=int(input())
xy=[]
for i in range(n):
    xy.append(list(map(int,input().split())))

ans=0

x=0
y=0
for i in range(n):
    if xy[0]>=0 and xy[1]>=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))

x=0
y=0
for i in range(n):
    if xy[0]>=0 and xy[1]<=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))

x=0
y=0
for i in range(n):
    if xy[0]<=0 and xy[1]>=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))

x=0
y=0
for i in range(n):
    if xy[0]<=0 and xy[1]<=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))

x=0
y=0
for i in range(n):
    if xy[0]>=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))
x=0
y=0
for i in range(n):
    if xy[0]<=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))
x=0
y=0
for i in range(n):
    if xy[1]>=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))
x=0
y=0
for i in range(n):
    if xy[1]<=0:
        x+=xy[0]
        y+=xy[1]
ans=max(ans,np.sqrt(x**2+y**2))

print(ans)





### FIXED CODE ###

import numpy as np

n=int(input())
xy=[]
for i in range(n):
    xy.append(list(map(int,input().split())))

def naiseki(a,b):
    if (a[0]*b[0]+a[1]*b[1])>0.0:
        return True
    else:
        return False
    
ans=0

for i in range(1001):
    xl=np.cos(np.pi*2.0*i/1000.0)
    yl=np.sin(np.pi*2.0*i/1000.0)
    x=0
    y=0
    for j in range(n):
        if naiseki([xl,yl],xy[j]):
            x+=xy[j][0]
            y+=xy[j][1]
    ans=max(ans,np.sqrt(x**2+y**2))
print(ans)
#coding: utf-8
N = int(input())
S = list(input())
ans = 0
for j in range(i, N):
    if S[j] == ".":
        ans += 1
print(ans)

### FIXED CODE ###

#coding: utf-8
N = int(input())
S = list(input())
ans = S.count(".")
cnt = ans
for i in range(N):
    if S[i] == "#":
        cnt += 1
    else:
        cnt -= 1
    ans = min(ans, cnt)
print(ans)
import math
a,b = map(int, input().split())
print(a*b//math.gcd(a,b))

### FIXED CODE ###

import fractions
a,b = map(int, input().split())
print(a*b//fractions.gcd(a,b))
n=int(input())
a=list(map(int,input().split()))
x=max(a)
y=a.index(x)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    a.pop(y)
    print(max(a))
  


### FIXED CODE ###

n=int(input())
a=[]

for j in range(0,n):
  a.append(int(input()))
  
x=max(a)
y=a.index(x)
del a[y]
z=max(a)

for i in range(0,n):
  if i!=y:
    print(x)
  else:
    print(z)
S, T = map(input().split())
A, B = map(int,input().split)
U = input()

if S == U:
    print(A-1 " " B)
else:
    print(A " " B-1)


### FIXED CODE ###

S, T = input().split()
A, B = map(int,input().split())
U = input()
 
if S == U:
    print(A-1 , B)
else:
    print(A , B-1)
import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
S = input().rstrip()
Query = []
for _ in range(Q):
    Alp, LR = map(str, input().rstrip().split())
    Query.append((Alp, LR))

left = 0
for Alp, LR in reversed(Query):
    if S[left] == Alp and LR == "L":
        left += 1
right = 0
for Alp, LR in reversed(Query):
    if S[N-1-right] == Alp and LR == "R":
        right += 1
print(max(0, N-left-right))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
S = input().rstrip()
TD = [list(map(str, input().split())) for _ in range(Q)]

l = 0
r = N
while r - l > 1:
    m = (l+r)//2
    right_over = False
    pl = m
    for t, d in TD:
        if S[pl] == t:
            if d == 'L':
                pl -= 1
                if pl == -1:
                    break
            else:
                pl += 1
                if pl == N:
                    right_over = True
                    break
    if right_over:
        r = m
    else:
        l = m

right = l

l = 0
r = N
while r - l > 1:
    m = (l+r)//2
    left_over = False
    pl = m
    for t, d in TD:
        if S[pl] == t:
            if d == 'L':
                pl -= 1
                if pl == -1:
                    left_over = True
                    break
            else:
                pl += 1
                if pl == N:
                    break
    if left_over:
        l = m
    else:
        r = m

left = l

print(right-left)
n = int(input())
L = list(map(int,input().split()))
m = 10**9+7
def gcd(x,y):
  while y != 0:
    cur = x
    x = y
    y = cur%y
  return x
lcm = L[0]*L[1]//gcd(L[0],L[1])
for i in range(2,n):
  p = gcd(L[i],lcm)
  lcm = L[i]*lcm//p
ans = 0
for i in range(n):
  ans = (ans+((lcm//L[i])%m))%m
print(ans)

### FIXED CODE ###

n = int(input())
L = list(map(int,input().split()))
m = 10**9+7
ans = 0
def gcd(x,y):
  while y != 0:
    cur = x
    x = y
    y = cur%y
  return x
if n != 1:
  lcm = L[0]*L[1]//gcd(L[0],L[1])
  for i in range(2,n):
    p = gcd(L[i],lcm)
    lcm = L[i]*lcm//p
  for i in range(n):
    k = (lcm%m)*pow(L[i],10**9+5,m)
    ans = (ans+k)%m
else:
  ans = 1
print(ans)
i = int(input)
fizz=[]
for x in i:
  if x % 3 ==0 and x%5==0:
    return 
  elif x % 3==0:
    return
  elif x%5==0:
    return 
  else:
    fizz.append(i)
print(sum(fizz))

### FIXED CODE ###

i = int(input())
fizz=[]
for x in range(1, i+1):
  if x % 3 ==0 and x%5==0:
    continue
  elif x % 3==0:
    continue
  elif x%5==0:
    continue 
  else:
    fizz.append(x)
print(sum(fizz))
n = int(input())
S = []
for _ in range(2):
    s = str(input())
    S.append(s)

count = 0
mod = (10**9) +7

if S[0][0] == S[1][0]:
    ans = 3
else:
    ans = 6

while count < n-1:
    if (S[0][count] == S[1][count]) and (S[0][count+1] == S[1][count+1]):
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif S[0][count] == S[1][count]:
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif S[0][count+2] == S[1][count+2]:
        ans = ans
        count += 2
    else:
        ans = ans * 3
        ans = ans % mod
        count += 2
print(ans)
    
         

### FIXED CODE ###

n = int(input())
S = []
for _ in range(2):
    s = str(input())
    S.append(s)

count = 0
mod = (10**9) +7

if S[0][0] == S[1][0]:
    ans = 3
else:
    ans = 6

while count < n-1:
    if (S[0][count] == S[1][count]) and (S[0][count+1] == S[1][count+1]):
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif S[0][count] == S[1][count]:
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif count >= n-2:
        break
    elif S[0][count+2] == S[1][count+2]:
        ans = ans
        count += 2
    else:
        ans = ans * 3
        ans = ans % mod
        count += 2
print(ans)
n, m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))
dp = []
dp.append(1)
j = 0
if 1 == a[j]:
    dp.append(0)
    j += 1
else:
    dp.append(1)

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

print(dp[n]%(1000000007))

### FIXED CODE ###

n, m = map(int,input().split())
a = []
for i in range(m):
    a.append(int(input()))
dp = []
dp.append(1)
if m == 0:
    a.append(-1)
j = 0
k = len(a)-1
if 1 == a[j]:
    dp.append(0)
    j = min(k,j+1)
else:
    dp.append(1)

for i in range(2,n+1):
    if i == a[j]:
        dp.append(0)
        j = min(k,j+1)
    else:
        dp.append(dp[i-1] + dp[i-2])

print(dp[n]%(1000000007))
N = int(input())
tracks = [tuple(map(int, input().split())) for _ in range(N)]
X = input()
sleep = False
ans = 0
for s, t in tracks:
    if sleep:
        ans += t
    if s == X:
        sleep = True
print(ans)

### FIXED CODE ###

N = int(input())
tracks = [tuple(input().split()) for _ in range(N)]
X = input()
sleep = False
ans = 0
for s, t in tracks:
    t = int(t)
    if sleep:
        ans += t
    if s == X:
        sleep = True
print(ans)
a = input()
s = input()
if a>= 3200:
  print(s)
else:
  print('red')

### FIXED CODE ###

a = int(input())
s = input()
if a>= 3200:
  print(s)
else:
  print('red')
s = list(str(input()))
for i in range(1, len(s)+1):
  if (i%2 and s[i]=='L') or (i%2==0 and s[i]=='R'):
    print('No')
 	exit()
print('Yes')

### FIXED CODE ###

s = list(str(input()))
for i in range(len(s)):
  if ((i+1)%2 and s[i]=='L') or ((i+1)%2==0 and s[i]=='R'):
    print('No')
    exit()
print('Yes')
a,b,c=list(map(int,input().split()))
if a==b:
  print(c)
elif b==c:
  print(a)
eles:
  print(b)

### FIXED CODE ###

a,b,c=list(map(int,input().split()))
if a==b:
  print(c)
elif b==c:
  print(a)
else:
  print(b)
import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())

d = [None for i in range(4)]
d[0] = abs(x*1+y*(-1)+w*h)/math.sqrt(1**2 + (-1)**2)
d[1] = abs(x*(-h/w)+y*(-1)+h)/math.sqrt((-h/w)**2 + (-1)**2)
d[2] = abs(x-w*0.5)
d[3] = abs(y-h*0.5)

print(1,1)
eixt()
if int(w-2*x)==0 and int(h-2*y)==0:
  print(w*h/2.0, 1)
  exit()
elif int(w-2*x)==0 or int(h-2*y)==0:
  print(w*h/2.0, 0)
  exit()

if int(d1) == 0 or int(d2) == 0:
  if int(w-2*x)==0 and int(h-2*y)==0:
    print(w*h/2.0, 1)
  else:
    print(w*h/2.0, 0)
elif d.index().min(d) == 0:
  if x > 0.5*w:
    if y < h/w*x:
      print((x*w*w)/y*0.5, 0)
    else:
      print((x*h*h)/y*0.5, 0)
  else:
    b = h - (h-y)/(w-x)*w
    if y < h/w*x:
      print(h*(w-b*(w-x)/(h-y))*0.5, 0)
    else:
      print(w*(h-b)*0.5, 0)
elif d.index().min(d) == 1:
  if int(d[0]-d[1]) == 0:
    casenum = 1
  else:
    casenum = 0
    
  if x > 0.5*w:
    if  y > -h/w*x+h:
      print(w*(-(y-h)*w/x)*0.5, casenum)
    else:
      print(h*x*h/(h-y)*0.5, casenum)
  else:
    b = (h + y*w/(x-w)) * (x-w)/y
    if  y > -h/w*x+h:
      print(h*(w-(b-h)*x/(y-h))*0.5, casenum)
    else:
      print(w*(h-b)*0.5, casenum)
elif d.index().min(d) == 2:
  if y > 0.5*h:
    b = w*y/(w-2*x)
    x1=(x-0.5*w)/y*(b-h)
    if x > 0.5*w:
      print(h*(0.5*w+w-x1)*0.5, 0)
    else:
      print(h*(0.5*w+0.5*w-x1)*0.5, 0)
  else:
    b = h - 0.5*w*y/(x-0.5*w)
    x1=b*y/(0.5*w-x)
    if x > 0.5*w:
      print(0.5*h(0.5*w+w-x1), 0)
    else:
      print(0.5*h(0.5*w+0.5*w-x1), 0)    
elif d.index().min(d) == 3:
  if int(d[2]-d[3]) == 0:
    casenum = 1
  else:
    casenum = 0
  if x > 0.5*w:
    if y > 0.5*h:
      print(0.5*w*(0.5*h+h-(y-0.5*h)/x*w+0.5*h), casenum)
    else:
      print(0.5*w*(0.5*h+0.5*h-(y-0.5*h)/x*w+0.5*h), casenum)
  else:
    if y > 0.5*h:
      print(0.5*w*(0.5*h+h-(0.5*h-w*(y-0.5*h)/(x-w))), casenum)
    else:
      print(0.5*w*(0.5*h+0.5*h-(0.5*h-w*(y-0.5*h)/(x-w))), casenum)    

### FIXED CODE ###

import sys
import math
w, h, x, y = map(int, sys.stdin.readline().split())
S = w*h/2

if x == w/2 and y == h/2:
  print(S,1)
else:
  print(S, 0)
a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(x)

### FIXED CODE ###

a,b=map(int,input().split())
if a%b==0:
    print(-1)
else:
    print(a)
import math
from functools import reduce

N=int(input())
a_list = list(map(int, input().split()))
lst = []
for i, a in enumerate(a_list):
    tmp = a_list[:i] + a_list[i+1:]
    lst.append(reduce(math.gcd, tmp))
print(max(lst))


### FIXED CODE ###

from fractions import gcd
N=int(input())
a_list = list(map(int, input().split()))
gcd_l = [0] * (N+1) 
gcd_r = [0] * (N+1) 
for i, a in enumerate(a_list):
    gcd_l[i+1] = gcd(gcd_l[i], a)
for i in range(N, 0, -1):
    a = a_list[i-1]
    gcd_r[i-1] = gcd(gcd_r[i], a)
ans = 1
# print(gcd_l, gcd_r)
for i in range(N):
    tmp = gcd(gcd_l[i], gcd_r[i+1])
    if (ans < tmp):
        ans = tmp
print(ans)
N, K = map(int, input().split())
S = input()
if S[K] == "A":
  S[K] = "a"
if S[K] == "B":
  S[K] = "b"
if S[K] == "C":
  S[K] = "c"
print(S)


### FIXED CODE ###

N, K = map(int, input().split())
S = list(input())
if S[K-1] == "A":
  S[K-1] = "a"
elif S[K-1] == "B":
  S[K-1] = "b"
else:
  S[K-1] = "c"
ans = "".join(S)
print(ans)
import math
import sys

def main():

    n = int(input())
    a = n//1000
    print(n%(a*1000))
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

import math
import sys

def main():

    input = sys.stdin.buffer.readline
    n = int(input())
    if(n%1000 == 0):
        print(0)
    else:
        a = n // 1000
        print((a+1)*1000-n)

if __name__ == "__main__":
    main()
n = int(input())
x = list(map(int,input().split()))

for i in range(N):
  for j in range(1,101):
    print(min(sum(j-x[i])**2))

### FIXED CODE ###

N = int(input())
X = list(map(int,input().split()))
s = sum(X)
l = len(X)
ave = s/l
if ave - float(int(ave)) <= 0.5:
  avei = int(s/l)
else:
  avei = int(s/l) + 1
ans = 0
for i in range(N):
  ans += (X[i] - avei)**2
print(ans)
a = int(raw_input())
b = int(raw_input())

if a == 1:
	a = 14

if b == 1:
	b = 14

if a > b:
	print "Alice"
elif a < b:
	print "Bob"
else:
	print "Draw"


### FIXED CODE ###

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

if a == 1:
	a = 14

if b == 1:
	b = 14

if a > b:
	print "Alice"
elif a < b:
	print "Bob"
else:
	print "Draw"
input = input()

if input = 'ABC':
  return 'ARC'
else:
  return 'ABC'

### FIXED CODE ###

inputStr = input()

if inputStr == 'ABC':
 	print('ARC')
else:
	print('ABC')
n=int(input())
s=input()
#n=39
#s="RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB"

r=[]
g=[]
b=[]

for i in range(n):
    if s[i]=="R":
        r.append(i+1)
    elif s[i]=="G":
        g.append(i+1)
    else:
        b.append(i+1)

lenr=len(r)
leng=len(g)
lenb=len(b)

isum=0
for ir in range(len(r)):
    for ig in range(len(g)):
        imin=max(r[ir],g[ig])
        bi=bisect(b,imin)
        if abs(r[ir]-g[ig])+imin in b: 
            isum=isum+lenb-bi-1
        else:
            isum=isum+lenb-bi
for ir in range(len(r)):
    for ib in range(len(b)):
        imin=max(r[ir],b[ib])
        gi=bisect(g,imin)
        if abs(r[ir]-b[ib])+imin in g: 
            isum=isum+leng-gi-1
        else:
            isum=isum+leng-gi
for ig in range(len(g)):
    for ib in range(len(b)):
        imin=max(g[ig],b[ib])
        ri=bisect(r,imin)
        if abs(g[ig]-b[ib])+imin in r: 
            isum=isum+lenr-ri-1
        else:
            isum=isum+lenr-ri
                
print(isum)
                


### FIXED CODE ###

n=int(input())
s=input()

r=set()
g=set()
b=set()

for i in range(n):
    if s[i]=="R":
        r.add(i+1)
    elif s[i]=="G":
        g.add(i+1)
    else:
        b.add(i+1)

lenr=len(r)
leng=len(g)
lenb=len(b)

isum=0
for ir in r:
    for ig in g:
        if (ir+ig)/2 in b: 
            isum=isum+1
for ir in r:
    for ib in b:
        if (ir+ib)/2  in g: 
            isum=isum+1
for ig in g:
    for ib in b:
        if (ig+ib)/2  in r: 
            isum=isum+1

isum=lenr*leng*lenb-isum
                
print(isum)
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

s, = input()
ans = 'No'
if s[2] == s[3] and s[5] == s[6]:
    ans = 'Yes'
print(ans)

### FIXED CODE ###

import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

s = input()
ans = 'No'
if s[2] == s[3] and s[4] == s[5]:
    ans = 'Yes'
print(ans)
n=int(input())
colors={}

#print("####################")

inputA=[]
for i in range(n-1):
    inputA.append(list(map(int,input().split())))

colors[1]=[1]
colors[2]=[1]

resultCorors=[1]

kindOfcolor=1

for item in inputA[1:]:
    #print(i,colors)
    pati, chil = item[0],item[1]
    if chil not in colors:
        colors[chil]=[]

    temp=set(colors[pati])|set(colors[chil])
    for j in range(1,n+2):
        if j not in temp:
            colors[chil].append(j)
            colors[pati].append(j)
            resultCorors.append(j)
            kindOfcolor=max(kindOfcolor,j)
            break

print(kindOfcolor)
for item in resultCorors:
    print(item)



### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float('inf')
MOD=10**9+7
input=sys.stdin.readline

n=int(input())

#初期値が0の辞書
from collections import defaultdict
tree = defaultdict(lambda: set([])) 

color={}
key=[]

for _ in range(n-1):
    a,b=map(int,input().split())
    tree[a-1].add(b-1)
    tree[b-1].add(a-1)
    color[(a-1,b-1)]=0
    key.append((a-1,b-1))

checked=[0]*n
cnt=0

def DEF(parent_color,node_no):
    global color,checked,tree,cnt
    checked[node_no]=1
    cnt=max(cnt,parent_color)
    i=1
    #print("node_no",node_no)
    for item in tree[node_no]:
        if checked[item]==0:
            if i==parent_color:
                i+=1
            
            color[(min(item,node_no),max(item,node_no))]=i
            DEF(i,item)
            i+=1
DEF(0,1)

print(cnt)
for item in key:
    print(color[item])
n=int(input())
a=[]

x,y,k=-1,-1,-1

for _ in range(n):
    s=list(map(int,input().split()))
    if s[2] != 0:
        a.append(s)
for i in range(101):
    for j in range(101):
        h=a[0][2]+abs(a[0][0]-i)+abs(a[0][1]-j)
        d=True

        for l in range(n):
            if a[l][2] > 0 and h != a[l][2]+abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            if a[l][2]==0 and h>abs(a[l][0]-i)+abs(a[l][1]-j):
                d=False
            
        if d:
            x,y,k=i,j,h
            print(x,y,k)
            exit()



### FIXED CODE ###

n=int(input())
xyh=[]

x,y,h=-1,-1,-1
nonzero=-1

for i in range(n):
    xyh.append(list(map(int,input().split())))
    if xyh[i][2] != 0:
        nonzero = i

for px in range(101):
    for py in range(101):
        nh = xyh[nonzero][2]+abs(xyh[nonzero][0]-px)+abs(xyh[nonzero][1]-py)
        ok = True

        for nn in range(n):
            if xyh[nn][2] > 0 and nh != xyh[nn][2]+abs(xyh[nn][0]-px) + abs(xyh[nn][1]-py):
                ok=False
            if xyh[nn][2] == 0 and nh > abs(xyh[nn][0]-px) +abs(xyh[nn][1]-py):
                ok=False
        
        if ok:
            x,y,h = px,py,nh
            print(x,y,h)
            exit()
a,b=map(int,input().split())
ans=6-(a+b)
print(ans)

### FIXED CODE ###

a=int(input())
b=int(input())
ans=6-(a+b)
print(ans)
from collections import deque, Counter


class UnionFind:
    def __init__(self, v):
        self.v = v
        self._tree = list(range(v + 1))
        self._counter = Counter(self._tree)

    def _root(self, a):
        queue = deque()
        while self._tree[a] != a:
            queue.append(a)
            a = self._tree[a]
        while queue:
            index = queue.popleft()
            self._tree[index] = a
        return a

    def union(self, a, b):
        root_a = self._root(a)
        root_b = self._root(b)
        if root_a == root_b:
            return

        self._tree[root_b] = root_a
        ca = self._counter[root_a]
        cb = self._counter[root_b]
        self._counter[root_a] += cb
        self._counter[root_b] = 0
        return ca * cb

    def find(self, a, b):
        return self._root(a) == self._root(b)


N, M = map(int, input().split(' '))
edges = [tuple(map(int, input().split(' '))) for _ in range(M)]

dp = [0] * (M + 1)
dp[-1] = N * (N - 1) // 2
union_find = UnionFind(N)

i = M - 1
for a, b in reversed(edges):
    minus = union_find.union(a, b)
    dp[i] = dp[i + 1] - minus
    if dp[i] == 0:
        break
    i -= 1

for i in range(1, M + 1):
    print(dp[i])


### FIXED CODE ###

from collections import deque, Counter


class UnionFind:
    def __init__(self, v):
        self.v = v
        self._tree = list(range(v + 1))
        self._counter = Counter(self._tree)

    def _root(self, a):
        queue = deque()
        while self._tree[a] != a:
            queue.append(a)
            a = self._tree[a]
        while queue:
            index = queue.popleft()
            self._tree[index] = a
        return a

    def union(self, a, b):
        root_a = self._root(a)
        root_b = self._root(b)
        if root_a == root_b:
            return 0

        self._tree[root_b] = root_a
        ca = self._counter[root_a]
        cb = self._counter[root_b]
        self._counter[root_a] += cb
        self._counter[root_b] = 0
        return ca * cb

    def find(self, a, b):
        return self._root(a) == self._root(b)


N, M = map(int, input().split(' '))
edges = [tuple(map(int, input().split(' '))) for _ in range(M)]

score = N * (N - 1) // 2
union_find = UnionFind(N)
scores = []

for a, b in reversed(edges):
    scores.append(score)
    if score == 0:
        continue
    minus = union_find.union(a, b)
    score -= minus

for s in reversed(scores):
    print(s)
N, M = map(int, input().split())
P = [int(i) for i in input().split()]

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [-1 for _ in range(n)]
        
    def same(self, x, y):
        return self.root(x)==self.root(y)
 
    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
 
        if self.par[x] > self.par[y]:
            x,y = y,x
 
        self.par[x] += self.par[y]
        self.par[y] = x
        
uf = UnionFind(N)

for i in range(M):
    x, y = map(int, input().split())
    uf.unite(x - 1, y - 1)
    
cnt = 0
for i in range(N):
    if uf.same(i, P[i] - 1):
        cnt += 1
        #print(i, P[i])
        
print(cnt)

### FIXED CODE ###

N, M = map(int, input().split())
P = [int(i) for i in input().split()]

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.par = [-1 for _ in range(n)]
        
    def same(self, x, y):
        return self.root(x)==self.root(y)
 
    def root(self, x):
        if self.par[x]<0:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]
 
    def unite(self,x,y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
 
        if self.par[x] > self.par[y]:
            x,y = y,x
 
        self.par[x] += self.par[y]
        self.par[y] = x
        
uf = UnionFind(N)

for i in range(M):
    x, y = map(int, input().split())
    uf.unite(x - 1, y - 1)
    
cnt = 0
for i in range(N):
    if uf.same(i, P[i] - 1):
        cnt += 1
        #print(i, P[i])
        
print(cnt)
list = list(map(int,input().split(" ")))

olist = []
cnt = 0
for i in range(1, int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    olist.append(i)
    cnt = 1
if (cnt == 1):
  print(olist[len(olist) + 1 - list[2]])
else:
  print(1)

### FIXED CODE ###

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

X = []
cnt = 0
for i in range(1, 1 + int(min(list[0],list[1]))):
  if(list[0] % i == 0 and list[1] % i == 0):
    X.append(i)
    cnt = 1
X.sort(reverse=True)
if (cnt == 1):
  print(X[list[2]-1])
else:
  print(1)
k = int(input())
a,b = map (int, input().split())
res = "NG"
for i in range(a,b+1):
  if((i%k==0):
     res="OK"
     break
print(res)

### FIXED CODE ###

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

res = "NG"
for i in range(a,b+1):
    if (i%k==0):
        res = "OK"
        break
print(res)