Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!

if __name__ == '__main__':
    n=int(input())
    a_list=[int(x)-1 for x in input().split()]
    b_list=[int(x) for x in input().split()]
    c_list=[int(x) for x in input().split()]
    score=sum(b_list)
    pre_a=-100
    for a in a_list:
        if(a-pre_a==1):
            score+=c_list[pre_a]
        pre_a=a
    print(score)
  

### FIXED CODE ###

if __name__ == '__main__':
    n=int(input())
    a=[]
    b=[int(x) for x in input().split()]
    a.append(b[0])
    for i in range(n-2):
        a.append(min([b[i],b[i+1]]))
    a.append(b[-1])
    print(sum(a))
import collections

def prime_factorize(n):
    a = []
    while n%2 == 0:
        a.append(2)
        n //=  2
    f = 3
    while f*f <= n :
        if n % f ==0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__=="__main__":
    N = int(input())
    count = 0
    counter = collections.Counter(prime_factorize(N))
    output = 0
    for prime in counter:
        num_prime = 1
        count = 1
        while True:
            if counter[prime] >= wa:
                output += 1
                count += 1
                num_prime += count
            else:
                break
    print(output)

### FIXED CODE ###

import collections

def prime_factorize(n):
    a = []
    while n%2 == 0:
        a.append(2)
        n //=  2
    f = 3
    while f*f <= n :
        if n % f ==0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


if __name__=="__main__":
    N = int(input())
    count = 0
    counter = collections.Counter(prime_factorize(N))
    output = 0
    for prime in counter:
        num_prime = 1
        count = 1
        while True:
            if counter[prime] >= num_prime:
                output += 1
                count += 1
                num_prime += count
            else:
                break
    print(output)
h, w, k = [int(i) for i in input().split()]
masu = [input() for _ in range(h)]
ans = 0
for mark_h in range(2**h):
    for mark_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (mark_h>>i)&1==1 and (mark_w>>j)&1==1:
                    if c[i][j]=="#":
                        black+=1
        if black=k:
            ans+=1
print(ans)

### FIXED CODE ###

h, w, k = [int(i) for i in input().split()]
masu = [input() for _ in range(h)]
ans = 0
for mark_h in range(2**h):
    for mark_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (mark_h>>i)&1==1 and (mark_w>>j)&1==1:
                    if masu[i][j]=="#":
                        black+=1
        if black==k:
            ans+=1
print(ans)
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n = ni()

    one = n % 10

    a = set(2, 4, 5, 7, 9)
    b = set(0, 1, 6, 8)
    if one in a:
        print('hon')
    elif one in b:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()

### FIXED CODE ###

import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    n = ni()

    one = n % 10

    a = set([2, 4, 5, 7, 9])
    b = set([0, 1, 6, 8])
    if one in a:
        print('hon')
    elif one in b:
        print('pon')
    else:
        print('bon')


if __name__ == '__main__':
    main()
n, a, b = map(int, input().split())
v = n

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()


if n > a + b and n < a + a + b:
    print(a+(n - (a + b)))
    exit()

c = n % (a +b)
if n % (a +b) > a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    eixt()


### FIXED CODE ###

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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()
a,b = map(int,input().split())
 
print(max(int(a+b,a-b,a*b)))

### FIXED CODE ###

a,b = map(int,input().split())
 
print(max(int(a+b),int(a-b),int(a*b)))
N A B = tuple(input().split())
print((N // (A + B)) * A + N % (A + B))

### FIXED CODE ###

inp = input().split()
inp = [int(i) for i in inp]
N, A, B = inp
ans = (N//(A+B))*A
rem = N%(A+B)
ans += min(rem, A)
print(ans)
impotr re
s = input()

pattern = 'hi'
m = re.search(pattern, s)
if m:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()

num = len(s)
if num % 2 != 0:
    print('No')
else:
    hitachi = 'hi' * int(num / 2)
    if hitachi == s:
        print('Yes')
    else:
        print('No')
n=int(input())
a=[]
while n>0:
    b=n%26
    if b==0:
        b=26
        t=1
    c=lambda b:chr(b+64)
    a.append(c(b))
    n//=26
    if t==1:
        n-=1
        t=0
d=len(a)
e=[]
for i in range(d):
    e.append(a[-1-i])
ans=''.join(e)
ans=ans.lower()
print(ans)

### FIXED CODE ###

n=int(input())
a=[]
t=0
while n>0:
    b=n%26
    if b==0:
        b=26
        t=1
    c=lambda b:chr(b+64)
    a.append(c(b))
    n//=26
    if t==1:
        n-=1
        t=0
d=len(a)
e=[]
for i in range(d):
    e.append(a[-1-i])
ans=''.join(e)
ans=ans.lower()
print(ans)
n = int(input())
a = list(map(int, input().split()))
r = [0] * 9
for i in a:
    r[i//400] += 1

if sum([1 for i in r[:-1] if i != 0]) == 0:
    print(1, n)
else:
    mi = sum([1 for i in r[:-1] if i != 0])
    print(mi, mi+r[-1])

### FIXED CODE ###

from bisect import bisect_right

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

r = [400, 800, 1200, 1600, 2000, 2400, 2800, 3200]
c = [0] * 9

for score in a:
	i = bisect_right(r, score)
	c[i] += 1

ans = 8 - c[:-1].count(0)

print(max(1, ans), ans + c[8])
n, m = map(int, input().split())
al = []
bl = []
for i in range(n):
    a, b = map(int, input().split())
    al.append([a, b])
for j in range(m):
    c, d = map(int, input().split())
    bl.append([c,d])

def check(a,b):
    x = a[0] - b[0]
    y = a[1] - b[1]
    if x < 0:
        x = -x
    if y < 0:
        y = -y
    return x + y

for a in al:
    min = 100000000
    cnt = 1
    for b in bl:
        tmp = check(a,b)
        if tmp < min:
            ans = cnt
            min = tmp
        cnt += 1
    print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
al = []
bl = []
for i in range(n):
    a, b = map(int, input().split())
    al.append([a, b])
for j in range(m):
    c, d = map(int, input().split())
    bl.append([c,d])

def check(a,b):
    x = a[0] - b[0]
    y = a[1] - b[1]
    if x < 0:
        x = -x
    if y < 0:
        y = -y
    return x + y

for a in al:
    min = 1000000000
    cnt = 1
    for b in bl:
        tmp = check(a,b)
        if tmp < min:
            ans = cnt
            min = tmp
        cnt += 1
    print(ans)
N,M = map(int,input().split())

par = [i for i in range(N+M)]
def root(a):
    if par[a] == a: return a
    par[a] = root(par[a])
    return par[a]

def same(a,b):
    return root(a) == root(b)

def unite(a,b):
   ra,rb = root(a),root(b)
   if ra == rb: return
   par[ra] = rb

for i in range(N):
    src = list(map(lambda x:int(x)-1,input().split()))
    if len(src) == 1: continue
    for j in src[1:]:
        unite(i,N+j)

for i in range(1,N):
    if not same(0,i):
        print('NO')
        exit()
print('YES')


### FIXED CODE ###

import sys
sys.setrecursionlimit(2 * 10**5)
N,M = map(int,input().split())

par = [i for i in range(N+M)]
def root(a):
    if par[a] == a: return a
    par[a] = root(par[a])
    return par[a]

def same(a,b):
    return root(a) == root(b)

def unite(a,b):
   ra,rb = root(a),root(b)
   if ra == rb: return
   par[ra] = rb

for i in range(N):
    src = list(map(lambda x:int(x)-1,input().split()))
    if len(src) == 1: continue
    for j in src[1:]:
        unite(i,N+j)

for i in range(1,N):
    if not same(0,i):
        print('NO')
        exit()
print('YES')
N = int(input())
S = input()
T = list()
for i in range(int(N / 2), N):
    t = S[i]
    T.append(t)
y = 0
n = 0
for i, k in zip(T, S):
    if i == k:
        y += 1
    else:
        n += 1
if y == int(N / 2):
    print('Yes') 
else:
    print('No')       

### FIXED CODE ###

r = int(input())
print(r ** 2)
h, a = input()
print(int(h)/int(a) + 1)

### FIXED CODE ###

import math

h, a = input().split()
print(math.ceil(int(h)/int(a)))
#!/usr/bin/python3
# -*- coding:utf-8 -*-

class UnionFindTree:
  def __init__(self, n):
    self.nodes = [-1]*n
    
  def find(self, x):
      parent = self.nodes[x]
      if parent < 0:
        return x
      else:
        self.nodes[x] = self.find(self.nodes[x])
        return self.nodes[x]
  
  def unite(self, x, y):
    xp = self.find(x)
    yp = self.find(y)
    self.nodes[xp] += self.nodes[yp]
    self.nodes[yp] = xp  
  
  def size(self, x):
    return -self.nodes[self.find(x)]


def main():
  n, m = map(int, input().split())
  edges = []
  
  for _ in range(m):
    a, b = map(lambda x:int(x)-1, input().split())
    edges.append((a, b))
  uftree = UnionFindTree(n)
  scores = []
  
  for a, b in edges[::-1]:
    ap = uftree.find(a)
    bp = uftree.find(b)
    if  ap != bp:
      scores.append(uftree.size(ap) * uftree.size(bp))
      uftree.unite(a, b)    
    else:
      scores.append(0)
      
  sum = 0
  for score in scores[::-1]:
    sum += score
    print(sum)

if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

class UnionFindTree:
  def __init__(self, n):
    self.nodes = [-1]*n
    
  def find(self, x):
      parent = self.nodes[x]
      if parent < 0:
        return x
      else:
        self.nodes[x] = self.find(self.nodes[x])
        return self.nodes[x]
  
  def unite(self, x, y):
    xp = self.find(x)
    yp = self.find(y)
    if self.nodes[xp] > self.nodes[yp]:
      xp, yp = yp, xp
    self.nodes[xp] += self.nodes[yp]
    self.nodes[yp] = xp  
  
  def size(self, x):
    return -self.nodes[self.find(x)]


def main():
  n, m = map(int, input().split())
  edges = []
  
  for _ in range(m):
    a, b = map(lambda x:int(x)-1, input().split())
    edges.append((a, b))
  uftree = UnionFindTree(n)
  scores = []
  
  for a, b in edges[::-1]:
    ap = uftree.find(a)
    bp = uftree.find(b)
    if  ap != bp:
      scores.append(uftree.size(ap) * uftree.size(bp))
      uftree.unite(a, b)    
    else:
      scores.append(0)
      
  sum = 0
  for score in scores[::-1]:
    sum += score
    print(sum)

if __name__=='__main__':
  main()
N,M = map(int, input().split())
A = list(map(int,input().split())).sort()

for i in range(N):
	A[N] = A[N]// 2
	A.sort()

B = sum(A)

print(B)

### FIXED CODE ###

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

A.sort(reverse = True)
i = 0
for j in range(M):
	A[i] = A[i]//2
	if i <= N-2 and A[i] < A[i+1] and A[0] < A[i+1]:
		i += 1
	else :
		A.sort(reverse=True)
		i = 0
print(str(sum(A)))
N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>0:
    b=X[K]
elif X[0]==0:
    b=X[K-1]
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K-a+2,N-2*a+2)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K-a+2,N-2*a+2)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)

### FIXED CODE ###

N,K=map(int,input().split())
X=list(map(int,input().split()))
if X[0]>=0:
    b=X[K-1]
elif X[-1]<=0:
    b=abs(X[-K])
elif 0 in X:
    a=0
    b=10**9
    for i in range(N):
        if X[i]==0:
            a=i
            break
    for j in range(max(0,K-1-a),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
else:
    a=0
    b=10**9
    for i in range(N):
        if X[i]>0:
            a=i
            break
    for j in range(max(-1,K-a-1),min(K,N-a)):
        if b>X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1])):
            b=X[a+j]-X[a+j-K+1]+min(abs(X[a+j]),abs(X[a+j-K+1]))
print(b)
def solve():
    d = int(input())
    eves = 25 - d
    return "Christmas" + " Eve" + eves


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

def solve():
    d = int(input())
    eves = 25 - d
    return "Christmas" + " Eve" * eves


if __name__ == "__main__":
    print(solve())
N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

def search_max(sorted_coord_list, M, key):
    len_list = len(sorted_coord_list)
    if M == len_list:
        total_x, total_y, total_z = 0, 0, 0
        for x, y, z in sorted_coord_list:
            total_x += x
            total_y += y
            total_z += z
        total = abs(total_x) + abs(total_y) + abs(total_z)
        return total
    elif M == 1:
        x, y, z = sorted_coord_list[0]
        total = abs(x) + abs(y) + abs(z)
        return total
        
    # 2 <= M < N
    else:
        if sorted_coord_list[M - 1][key] == sorted_coord_list[M][key]:
            considering_val = coord_list[M - 1][key]
            current_idx = M - 1
            candidate_list = list()
            while coord_list[current_idx][key] == considering_val:
                candidate_list.append(sorted_coord_list[current_idx])
                current_idx += 1
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M - 1]:
                total_x += x
                total_y += y
                total_z += z
            max_total = 0
            for x, y, z in candidate_list:
                total = abs(total_x + x) + abs(total_y + y) + abs(total_z + z)
                max_total = max(max_total, total)
            return max_total
    
        else:
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M]:
                total_x += x
                total_y += y
                total_z += z
            total = abs(total_x) + abs(total_y) + abs(total_z)
            return total


max_candidates = [0] * 6
for i in range(3):
    # sort coord_list: O(NlogN)
    sorted_coord_list = sorted(coord_list, key=lambda x: x[i])
    max_candidates[2 * i] = search_max(sorted_coord_list, M, i)
    max_candidates[2 * i + 1] = search_max(sorted_coord_list[::-1], M, i)

print(max(max_candidates))


### FIXED CODE ###

from itertools import product

N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

max_total = 0
for f_x, f_y, f_z in product([-1, 1], repeat=3):
    sum_list = [(f_x * x + f_y * y + f_z * z, i) for i, (x, y, z) in enumerate(coord_list)]
    # sort with index
    sum_list = sorted(sum_list, key=lambda x: x[0])[::-1]
    total_x, total_y, total_z = 0, 0, 0
    for _, idx in sum_list[:M]:
        total_x += coord_list[idx][0]
        total_y += coord_list[idx][1]
        total_z += coord_list[idx][2]
    total = abs(total_x) + abs(total_y) + abs(total_z)
    max_total = max(total, max_total)

print(max_total)
A, B = map(int, input().split())

for i in range(1, 20):
  c = (A-1)*(i-1) + A
  if C >= B:
    break
    
print(i)

### FIXED CODE ###

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

for i in range(1, 20):
  if B > 1:
    c = (A-1)*(i-1) + A
    if c >= B:
      break
  else:
    i = 0
    break

print(i)
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N,X = map(int, input().split())
*x, = map(int, input().split())

dl = []
for i in range(N):
    dl.append(abs(x[i]-X))

print(gcd_list(dl))

### FIXED CODE ###

import fractions

def gcd_list(a):
    ans = a[0]
    for i in range(1, N):
        ans = fractions.gcd(ans, a[i])
    return ans

N,X = map(int, input().split())
*x, = map(int, input().split())

dl = []
for i in range(N):
    dl.append(abs(x[i]-X))

print(gcd_list(dl))
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
P = np.array(lr(), np.float64)
P += 1; P /= 2
P = [0] + P
Pcum = P.cumsum()
expectation = Pcum[K:] - Pcum[:-K]
answer = expectation.max()
print(answer)


### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
P = np.array([0] + lr())
P = (P+1) / 2
Pcum = P.cumsum()
X = Pcum[K:] - Pcum[:-K]
answer = X.max()
print(answer)
n=int(input())
l=list(map(int,input().split()))
n4=sum([i%4==0 for i in l])
n2=sum([i%2==0 for i in l])-n4
if n4>=max(n//2,1):
    print("Yes")
else:
    if (n//2)*2-n4*2<=n2:
        print("Yes"):
    else:print("No")

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
n4=sum([i%4==0 for i in l])
n2=sum([i%2==0 for i in l])-n4
if n4>=max(n//2,1):
    print("Yes")
else:
    if (n//2)*2-n4*2<=n2:
        print("Yes")
    else:print("No")
n = int(input())
a_l = list(map(int, input().split()))
a_d = {}
for i, p in enumerate(a_l):
    a_d[p] = i
res_l = []
for k in sorted(list(a_d.keys())):
    res_l.append(str(a_dt[k]+1))
print(' '.join(res_l))

### FIXED CODE ###

n = int(input())
p_list = list(map(int, input().split()))
p_dict = {}
for i, p in enumerate(p_list):
    p_dict[p] = i
res_list = []
for key in sorted(list(p_dict.keys())):
    res_list.append(str(p_dict[key]+1))
print(' '.join(res_list))
from collections import deque
n, m = map(int, input().split())
INF = 100000000

to = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
print('Yes')
q = deque([])
dist = [INF] * n
pre = [-1] * n
dist[0] = 0
q.append(0)

while len(q) > 0:
    v = q.popleft()
    for i in to[v]:
        if dist[i] != INF:
            continue
        dist[i] = dist[v+1]
        pre[i] = v
        q.append(i)

for i in range(n):
    ans = pre[i]
    ans += 1
    print(ans)


### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
INF = 100000000

to = [[] for _ in range(100005)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
print('Yes')
q = deque([])
dist = [INF] * n
pre = [-1] * n
dist[0] = 0
q.append(0)

while len(q) > 0:
    v = q.popleft()
    for i in to[v]:
        if dist[i] != INF:
            continue
        dist[i] = dist[v] + 1
        pre[i] = v
        q.append(i)

for i in range(1, n):
    ans = pre[i]
    ans += 1
    print(ans)
a,b = map(int,input().split())
if a >=13:
    print(b)
elif  6 <= a <= 12:
    print(b//2)
else:
    prnt(0)

### FIXED CODE ###

a,b = map(int,input().split())
if a >=13:
    print(b)
elif  6 <= a <= 12:
    print(b//2)
else:
    print(0)
num=int(input())
a,b=num.split()

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

### FIXED CODE ###

import math
num=input().split()
a=int(num[0])
b=int(num[1])

if a!=2 and b!=2:
    print("Yes")
else:
    print("No")
H,W,M = list(map(int,input().split()))

h = [0] * H
w = [0] * W

hw = []

for _ in range(H):
    hw.append([0] * W)

for _ in range(M):
    a,b = list(map(int,input().split()))
    h[a - 1] += 1
    w[b - 1] += 1
    hw[a - 1][b - 1] += 1
    
hm = max(h)
wm = max(w)

hp = [i for i, v in enumerate(h) if v == hm]
wp = [i for i, v in enumerate(w) if v == wm]

for x in hp:
    for y in wp:
        if hw[x][y] == 0:
            print(hm + wm)
            exit()
else:
    print(hm + wm - 1)



### FIXED CODE ###


H, W, M = list(map(int, input().split()))

h = [0] * H
w = [0] * W

hw = {}

for _ in range(M):
    a, b = list(map(int, input().split()))
    h[a - 1] += 1
    w[b - 1] += 1
    temp = "x" + str(a - 1) + "y" + str(b - 1)
    hw[temp] = 1

hm = max(h)
wm = max(w)

hp = [i for i, v in enumerate(h) if v == hm]
wp = [i for i, v in enumerate(w) if v == wm]

for x in hp:
    for y in wp:
        temp = "x" + str(x) + "y" + str(y)
        if temp not in hw:
            print(hm + wm)
            exit()
else:
    print(hm + wm - 1)
N, M = map(int, input().split())
ils = [map(int, input().split()) for _ in range(M)]

par = [i for i in range(N)]
size = [1] * N

def root(x):
    if par[x] == x:
        return x
    else:
        par[x] = root(par[x])
        
def unit(x, y):
    x = root(x)
    y = root(y)
    if x == y:
      return
    par[x] = y
    size[y] += size[x]
    size[x] = size[y]
    
    
inconv = N * (N - 1) // 2
inconvs = [inconv]
for A, B in ils[::-1]
    inconv -= size(root(A)) * size(root(B))
    unite(A, B)
    inconvs.insert(0, inconv)
    
print('\n'.join(inconvs))
  
    

### FIXED CODE ###

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

par = [-1 for i in range(N)]

def root(x):
    if par[x] < 0:
        return x
    else:
        par[x] = root(par[x])
        return par[x]
        
def unite(x, y):
    x = root(x)
    y = root(y)
    if x == y:
        return
    if size(x) < size(y):
        x, y = y, x
    par[x] += par[y]
    par[y] = x
    
def same(x, y):
    return root(x) == root(y)

def size(x):
    return - par[root(x)]
    
    
inconv = N * (N - 1) // 2
result = [0] * M
for i in range(M - 1, -1, -1):
    A, B = ils[i]
    A -= 1
    B -= 1
    result[i] = inconv
    if not same(A, B):
        inconv -= size(A) * size(B)
        unite(A, B)
    
for i in result:
    print(i)
import math
a,b,c=map(int,input().split())
ar=math.sqrt(a)
br=math.sqrt(b)
cr=math.sqrt(c)
if (a-b)/(cr*(ar-br))<1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if 4*a*b<(c-a-b)**2 and c-a-b>0:
    print("Yes")
else:
    print("No")
# 2019-11-24 20:59:47(JST)
import sys
from string import ascii_uppercase as alphabet

# alpha_num = dict((alpha, num) for num, alpha in enumerate(alphabet, 0))
alpha_ind = dict((alphabet[i], i) for i in range(26))

def main():
    n, s = sys.stdin.read().split()
    n = int(n)

    t = ''
    for char in s:
        t += alphabet[(alpha_num[char] + n) % 26]
    
    print(t)

if __name__ == '__main__':
    main()


### FIXED CODE ###

# 2019-11-24 20:59:47(JST)
import sys
# import numpy as np
from string import ascii_uppercase as alphabet

alphabet = alphabet[-1] + alphabet[0:]

alpha_num = enumerate(alphabet, 0)

alpha_num = dict((alpha, num) for num, alpha in alpha_num)

def main():
    n, s = sys.stdin.read().split()
    n = int(n)

    t = ''
    for c in s:
        t += alphabet[(alpha_num[c] + n) % 26]
    
    print(t)


if __name__ == '__main__':
    main()