Harryxun/stf_run huggingface dataset:
import numpy as np
(n, m) = list(map(int, input().split()))
a = np.array(list(map(int, input().split()))).astype("int64") 
a = np.cumsum(a)
a %= m
count = np.sum(a == 0)
(key, counts) = np.unique(a, return_counts=True) 

### FIXED CODE ###

import numpy as np
(n, m) = list(map(int, input().split()))
a = np.array(list(map(int, input().split()))).astype("int64") 
a = np.cumsum(a)
a %= m
count = np.sum(a == 0)
a.sort()
tc = 1
for i in range(1, n):
    if a[i - 1] == a[i]:
        tc += 1
    else:
        count += tc * (tc - 1) // 2
        tc = 1
else:
    count += tc * (tc - 1) // 2
print(count)
h, w = map(int, input().split())
s = [0] * w
for _ in range(h):
    s[_] = [c for c in input()]

# print(s)
# print(s[1][1])

ok = True
for hi in range(h):
    for wi in range(w):
        if s[hi][wi] == '#':
            drawable = False
            # check
            if hi > 0:
                drawable = (s[hi-1][wi] == '#') | drawable
            
            if hi < h-1:
                drawable = (s[hi+1][wi] == '#') | drawable
            
            if wi > 0:
                drawable = (s[hi][wi-1] == '#') | drawable
            
            if wi < w-1:
                drawable = (s[hi][wi+1] == '#') | drawable

            if not drawable:
                ok = False
                break

print("Yes" if ok else "No")


### FIXED CODE ###

h, w = map(int, input().split())
s = [0] * h
for _ in range(h):
    s[_] = input()

# print(s)
# print(s[1][1])

ok = True
for hi in range(h):
    for wi in range(w):
        if s[hi][wi] == '#':
            drawable = False
            # check
            if hi >= 1:
                drawable = (s[hi-1][wi] == '#') | drawable
            
            if hi <= h-2:
                drawable = (s[hi+1][wi] == '#') | drawable
            
            if wi >= 1:
                drawable = (s[hi][wi-1] == '#') | drawable
            
            if wi <= w-2:
                drawable = (s[hi][wi+1] == '#') | drawable

            # if hi >= 1:
            #     if s[hi-1][wi] == 

            if not drawable:
                ok = False

print("Yes" if ok else "No")
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k])

### FIXED CODE ###

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(a[k - 1])
import fractions as ft
#import math as ft


prime = 10**9+7

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

an.sort()


lcm_ = 1
for a in an :
    lcm_ = a*lcm_ // ft.gcd(a,lcm_)
#    print(lcm_)
    
ans = 0
for i, a in an:
    t = lcm_ // a
    ans += t 
    ans = ans % prime if ans >= prime else ans

print(ans)

### FIXED CODE ###


import fractions as fr
import functools as ft
#import math as fr


prime = 10**9+7

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

an.sort()


lcm_ = 1
for a in an :
    lcm_ = a*lcm_ // fr.gcd(a, lcm_)
#    print(lcm_)
    
#ans = 0
#for a in an:
#    ans += lcm_ // a
#    ans = ans % prime if ans >= prime else ans

ans = ft.reduce(lambda x,y: (x + lcm_//y), an ,0 )

print(ans%prime)
a=input()
b=""
for i in range(len(a),0,-1):
  b+=a[i]
if a==b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
b=""
for i in range(1,len(a)+1):
  b+=a[-i]
if a==b:
  print("Yes")
else:
  print("No")
n = int(input())
a = list(map(int,input().split()))
c=a[n-1]
a.sort()
a=list(set(a))
#fuct = [i for i in range(1,n+1)]
b=[0]
i = 0
ans = 0
while True:
    if a[0] != 1:
        print(-1)
        break
    if b[i]+1 == a[i]:
        b.append(a[i])
        if a[i] == c:
            print(n - len(b) + 1)
            
            break
    elif b[i] == a[i]:
        ans += 0
    i += 1

### FIXED CODE ###

n = int(input())
a = [int(s) - 1 for s in input().split()]

result = 0
for i in range(n):
    if a[i] != (i - result):
        result += 1
if result == n:
    print(-1)
else:
    print(result)
s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p] == 0):
    print(x.upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]

### FIXED CODE ###

s = open(0).read().split()
x = s[0][0]
s[0] = s[0][1:]
 
while True:
  p = ord(x)-97
  if len(s[p]) == 0:
    print(x.upper())
    break
  x = s[p][0]
  s[p] = s[p][1:]
n = int(input())
a = list(map(int, input().split()))
import numpy as np
na = np.array(a).cumsum()
cnt = 0
if(na[0] > 0):
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 0 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta 
    elif(i % 2 == 1 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
else:
  for i in range(n):
    delta = abs(na[i]) + 1
    if(i % 2 == 1 and na[i] <= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] += delta
    elif(i % 2 == 0 and na[i] >= 0):
      cnt = cnt + delta
      for j in range(i, n):
        na[j] -= delta
    else:
      na[i]
print(cnt)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
import numpy as np
na1 = np.array(a).cumsum()
na2 = np.array(a).cumsum()
cnt1 = 0
hoge1 = 0
cnt2 = 0
hoge2 = 0
delta1 = 0
delta2 = 0
for i in range(n):
  na1[i] += hoge1
  na2[i] += hoge2
  if(i % 2 == 0 and na1[i] <= 0):
    delta1 = abs(na1[i]) + 1
    cnt1 = cnt1 + delta1
    hoge1 += delta1
    na1[i] += delta1
  elif(i % 2 == 1 and na1[i] >= 0):
    delta1 = abs(na1[i]) + 1 
    cnt1 = cnt1 + delta1
    hoge1 -= delta1
    na1[i] -= delta1    
  if(i % 2 == 1 and na2[i] <= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 += delta2
    na2[i] += delta2  
  elif(i % 2 == 0 and na2[i] >= 0):
    delta2 = abs(na2[i]) + 1
    cnt2 = cnt2 + delta2
    hoge2 -= delta2
    na2[i] -= delta2
  else:
    na1[i]
print(min([abs(cnt1),abs(cnt2)]))
import sys

input=sys.stdin.readline
sys.setrecursionlimit(1000000)

N,M=map(int,input().split())
edge=[[] for i in range(0,N)]
dedge=[0 for i in range(0,N)]
data=[]
dic={}
for i in range(M):
    a,b=map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    dedge[a-1]+=1
    dic[(a-1,b-1)]=0
    dic[(b-1,a-1)]=0
    dic[(a-1,b-1)]=i
    dic[(b-1,a-1)]=i
    data.append([a-1,b-1,0])

if M%2==1:
    print(-1)
    exit()

ans=[0 for i in range(M)]
treeedge=[[] for i in range(0,N)]
visit=set([0])
q=set([0])
sub=set([])
while q:
    while q:
        x=q.pop()
        for i in edge[x]:
            if i not in visit:
                treeedge[x].append(i)
                treeedge[i].append(x)
                visit.add(i)
                sub.add(i)

        if not q:
            q=sub
            sub=set([])
            break



def dfs(v,pv):
    if len(treeedge[v])==1 and v!=0:
        ans[v]=(dedge[v]%2,pv)
        return dedge[v]%2

    A=dedge[v]%2
    for i in edge[v]:
        if i!=pv:
            A+=dfs(i,v)
    ans[v]=(A%2,pv)
    return ans[v][0]

dfs(0,-1)

for i in range(1,N):
    val,parent=ans[i]
    if val==1:
        index=dic[(i,parent)]
        data[index][2]=1



for i in range(M):
    a,b,val=data[i]
    if val==0:
        print(a+1,b+1)
    else:
        print(b+1,a+1)


### FIXED CODE ###

import sys

input=sys.stdin.readline
sys.setrecursionlimit(1000000)

N,M=map(int,input().split())
edge=[[] for i in range(0,N)]
dedge=[0 for i in range(0,N)]
data=[]
dic={}
for i in range(M):
    a,b=map(int,input().split())
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)
    dedge[a-1]+=1
    dic[(a-1,b-1)]=0
    dic[(b-1,a-1)]=0
    dic[(a-1,b-1)]=i
    dic[(b-1,a-1)]=i
    data.append([a-1,b-1,0])

if M%2==1:
    print(-1)
    exit()

ans=[0 for i in range(N)]
treeedge=[[] for i in range(0,N)]
visit=set([0])
q=set([0])
sub=set([])
while q:
    while q:
        x=q.pop()
        for i in edge[x]:
            if i not in visit:
                treeedge[x].append(i)
                treeedge[i].append(x)
                visit.add(i)
                sub.add(i)

        if not q:
            q=sub
            sub=set([])
            break



def dfs(v,pv):
    if len(treeedge[v])==1 and v!=0:
        ans[v]=(dedge[v]%2,pv)
        return dedge[v]%2

    A=dedge[v]%2
    for i in treeedge[v]:
        if i!=pv:
            A+=dfs(i,v)
    ans[v]=(A%2,pv)
    return ans[v][0]

dfs(0,-1)

for i in range(1,N):
    val,parent=ans[i]
    if val==1:
        index=dic[(i,parent)]
        data[index][2]=1

for i in range(M):
    a,b,val=data[i]
    if val==0:
        print(a+1,b+1)
    else:
        print(b+1,a+1)
x=input()
print(x**3)



### FIXED CODE ###

x=int(input())
print(x**3)
r = int(input())

s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979

print(s, end = " ")
print(l)

### FIXED CODE ###

r = float(input())

s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979
 
print(s, end = " ")
print(l)
#!/usr/bin/env python3


def solv(n, m, a, s):
    a = sorted(a)
    s = sorted(s, key=lambda x: -x[1])
    i = 0
    for (b, c) in s:
        for _ in range(b):
            if c <= a[i]:
                return sum(a)
            elif i >= n:
                return sum(a)
            a[i] = c
            i += 1
    return sum(a)


if __name__ == '__main__':

    n, m = map(int, input().split())
    a = map(int, input().split())
    s = []
    for _ in range(m):
        b, c = map(int, input().split())
        s.append((b, c))

    ans = solv(n, m, a, s)

    print(ans)


### FIXED CODE ###

#!/usr/bin/env python3


def solv(n, m, a, s):
    a = sorted(a)
    s = sorted(s, key=lambda x: -x[1])
    i = 0
    sum0 = 0
    for (b, c) in s:
        if (i+b) < n and a[i+b] < c:
            sum0 += b*c
            i += b
        else:
            for _ in range(b):
                if i >= n:
                    return sum0
                elif c <= a[i]:
                    return sum0 + sum(a[i:])
                sum0 += c
                i += 1
    if i >= n:
        return sum0
    return sum0 + sum(a[i:])


if __name__ == '__main__':

    n, m = map(int, input().split())
    a = map(int, input().split())
    s = []
    for _ in range(m):
        b, c = map(int, input().split())
        s.append((b, c))

    ans = solv(n, m, a, s)

    print(ans)
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]

N,S = map(int,input().split())
MOD = 998244353
A = list(map(int,input().split()))
dp = np.zeros(N)
if A[0] <= S:
    dp[0][A[0]] = 1
dp[0][0] = 2
for i in range(1,N):
    a = A[i]
    for j in range(S+1):
        dp[i][j] += 2*dp[i-1][j] % MOD
        if j - a < 0:
            continue
        else:
            dp[i][j] += dp[i-1][j-a]
        dp[i][j] %= MOD
print(dp[N-1][S])

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())[:-1]
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [list(input())[:-1] for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]

N,S = map(int,input().split())
MOD = 998244353
A = list(map(int,input().split()))
dp = [[0]*(S+1) for _ in range(N)]
if A[0] <= S:
    dp[0][A[0]] = 1
dp[0][0] = 2
for i in range(1,N):
    a = A[i]
    for j in range(S+1):
        dp[i][j] += 2*dp[i-1][j] % MOD
        if j - a < 0:
            continue
        else:
            dp[i][j] += dp[i-1][j-a]
        dp[i][j] %= MOD
print(dp[N-1][S])
n = input()
print(n ** 3)


### FIXED CODE ###

s = input()
n = int(s)
print(n ** 3)
import fractions
import sys
from functools import reduce
import math

input = sys.stdin.readline

def main():
    n, m = input_list()
    x = list(sorted(input_list()))
    diffs = []
    for i in range(1, m):
        a = x[i] - x[i-1]
        diffs.append((i, a))
    dd = list(sorted(diffs, key=lambda v: v[1], reverse=True))
    args = [d[0] for d in dd[:n-1]]
    r = divide_list(x, args)
    ans = 0
    for xx in r:
        ans += max(xx) - min(xx)
    print(ans)


def divide_list(l, args):
    result = []
    pre = 0
    for i, a in enumerate(args):
        if i != 0:
            pre = args[i-1]
        result.append(l[pre:a])
        if i == len(args) - 1:
            result.append(l[a:])
    return result

def divide_two(n):
    c = 0
    while True:
        if c >= 2:
            break
        if n % 2 != 0:
            break
        n //= 2
        c += 1
    return c

def get_camulative(l):
    import itertools
    # 累積和
    return [0] + list(itertools.accumulate(l))

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


if __name__ == "__main__":
    main()


### FIXED CODE ###

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

if M <= N:
  print(0)
  exit(0)
  
X.sort()
intervals = []
for i in range(M-1):
  intervals.append(X[i+1] - X[i])
  
intervals.sort()
R = max(X) - min(X)
for _ in range(N-1):
  R -= intervals.pop()
  
print(R)
s = int(input())
print("{0}:{1}:{2}".format(map(int, [s/3600, s/60, s])))

### FIXED CODE ###

s = int(input())
print("{0}:{1}:{2}".format(*map(int, [s/3600, s%3600/60, s%60])))
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(0)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

# stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(1)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)
N,M,S = map(int,input().split())
edges = [[] for _ in range(2500*50 + 5)]
def indexer(city,coin):
    return 50*coin + city

for _ in range(M):
    u,v,a,b = map(int,input().split())
    u -= 1
    v -= 1
    for scoin in range(a,2501):
        edges[indexer(u,scoin)].append([b,indexer(v,scoin-a)])
        edges[indexer(v,scoin)].append([b,indexer(u,scoin-a)])
## 両替
for i in range(N):
    c,d = map(int,input().split())
    for scoin in range(c,2501):
        edges[indexer(i,scoin-c)].append([d,indexer(i,scoin)])


def dijkstra(s,n,edges):
    import heapq
    dist = [float('inf')] * n
    fixed = [False]*n
    dist[s] = 0
    fixed[s] = True
    priority_que = []
    for e in edges[s]:
        heapq.heappush(priority_que,e)

    while len(priority_que):
        edge = heapq.heappop(priority_que)
        if fixed[edge[1]]:
            continue
        v = edge[1]
        dist[v] = edge[0]
        fixed[v] = True
        for ne in edges[v]:
            heapq.heappush(priority_que,[ne[0]+dist[v], ne[1]])
    return dist

d=dijkstra(indexer(0,min(2500,S)),2500*50 + 5,edges)
for i in range(1,N):
    ans = float('inf')
    for j in range(2501):
        ans = min(ans,d[indexer(i,j)])
    print(ans)

### FIXED CODE ###

N,M,S = map(int,input().split())
edges = [[] for _ in range(2500*50 + 100)]
def indexer(city,coin):
    return 50*coin + city

for _ in range(M):
    u,v,a,b = map(int,input().split())
    u -= 1
    v -= 1
    for scoin in range(a,2501):
        edges[indexer(u,scoin)].append((b,indexer(v,scoin-a)))
        edges[indexer(v,scoin)].append((b,indexer(u,scoin-a)))
## 両替
for i in range(N):
    c,d = map(int,input().split())
    for scoin in range(c,2501):
        edges[indexer(i,scoin-c)].append((d,indexer(i,scoin)))


def dijkstra(s,n,edges):
    import heapq
    dist = [float('inf')] * n
    fixed = [False]*n
    dist[s] = 0
    fixed[s] = True
    priority_que = []
    for e in edges[s]:
        heapq.heappush(priority_que,e)

    while len(priority_que):
        edge = heapq.heappop(priority_que)
        if fixed[edge[1]]:
            continue
        v = edge[1]
        dist[v] = edge[0]
        fixed[v] = True
        for ne in edges[v]:
            heapq.heappush(priority_que,(ne[0]+dist[v], ne[1]))
    return dist

d=dijkstra(indexer(0,min(2500,S)),2500*50 + 100,edges)
for i in range(1,N):
    ans = float('inf')
    for j in range(2501):
        ans = min(ans,d[indexer(i,j)])
    print(ans)
S=input()
N=len(S)

c=S.index("C")
S=S[::-1]
f=N-S.index("F")-1
#print(c,f)

print("Yes" if c<f else "No")

### FIXED CODE ###

S=input()
N=len(S)

if "C" in S and "F" in S:
  c=S.index("C")
  S=S[::-1]
  f=N-S.index("F")-1
  #print(c,f)
  print("Yes" if c<f else "No")
else: 
  print("No")
N, K = map(int, input().split())
V = list(map(int, input().split()))

value = 0

for cd in range(K):
    ab = min(N, K-cd)
    for left_ab in range(ab+1):
        right_ab = ab - left_ab
        pick = V[:left_ab] + V[-right_ab:]
        pick.sort()
        neg = 0
        while True:
            if pick[neg]<0:
                neg+=1
                continue
            else:
                break
        v = sum(pick[min(neg,K):])
        value = max(value,v)
        
print(value)

### FIXED CODE ###

N, K = map(int, input().split())
V = list(map(int, input().split()))
value = 0

for cd in range(K):
    ab = min(N, K-cd)
    for left_ab in range(ab+1):
        right_ab = ab - left_ab
        if right_ab > 0:
            pick = V[:left_ab] + V[-right_ab:]
        else:
            pick = V[:left_ab]
        pick.sort()
        neg = 0
        while neg < len(pick):
            if pick[neg]<0:
                neg+=1
                continue
            else:
                break
        v = sum(pick[min(neg,cd):])
        value = max(value,v)
        
print(value)
n,t = list(map(int,input().split()))

m = 0
while m < n+1:
	if m*4 + (n-m)*2 == t:
      print('Yes')
      break
      
    m += 1
    
if m == (n+1):
  print('No')

### FIXED CODE ###

n,t = list(map(int,input().split()))
 
m = 0
while m < n+1:
  if m*4 + (n-m)*2 == t:
    print('Yes')
    break
      
  m += 1
    
if m == (n+1):
  print('No')
#!/usr/bin/env python
# -*- coding:utf-8 -*-

s = input()
if len(s) % 2 == 0 ^ s[0] == s[-1]:
    print("Second")
else:
    print("First")


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding:utf-8 -*-

s = input()
if (len(s) % 2 == 0) and (s[0] == s[-1]):
    print("First")
elif (len(s) % 2 == 0) or (s[0] == s[-1]):
    print("Second")
else:
    print("First")
n, k = map(int, input().split())
a = 1
b = 1 + (n - k)
if k == 1:
    print(0)
else:
    print(b - a)

### FIXED CODE ###

n, k = map(int, input().split())
a = 1
b = 1 + (n - k)
if k == 1:
    print(0)
else:
    print(b - a)
line = input().split(' ')
print(line[0],line[1],line[2])

### FIXED CODE ###

line = input().split(',')
print(line[0],line[1],line[2])
import math

N=int(input())
A = list(map(int,input().split()))
cnt=[]
B=[]
for i in range(1,N):
	cnt.append(A.count(i))
	
for i in range(1,N):
	B.append((cnt[i-1]*(cnt[i-1]-1))//2)
	if cnt[i-1]==0:
		B[i-1]=0
		
ans=0
for i in range(1,N):
	ans+=B[i-1]

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)

### FIXED CODE ###

import math

N=int(input())
A = list(map(int,input().split()))
cnt=[0]*(N+1)
for i in range(0,N):
	cnt[A[i]-1]+=1
ans=0
for i in range(0,N+1):
	if cnt[i]==0:
		ans+=0
	else:
		ans+=cnt[i]*(cnt[i]-1)//2

for i in range(0,N):
	point=A[i]
	deff=(cnt[point-1]*(cnt[point-1]-1))//2-((cnt[point-1]-1)*(cnt[point-1]-2))//2
	print(ans-deff)
x , y = map(int, input().split()))

ans = False
c = 0
t = x

while ans = False :
    if t = -1 :
        break 
        elif c*2+t*4 == y :
            ans = True
        elif : 
            c += 1
            t += -1

if ans :
    print(Yes)
    elif :
      print(No)
    

### FIXED CODE ###

x, y = map(int, input().split())

c = 0

while x >= 0:
    if c * 2 + x * 4 == y:
        break
    c += 1
    x += -1
else:
    print("No")
    exit()

print("Yes")
n,q=map(int,input().split())

tree = [[] for _ in range(n)]
ope = [0]*n
opef=[False]*n
ret=[0]*n

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

def counter(target,num):
    global ret
    global ope
    global opef
    

    ret[target]+=num
    if not tree[target]:
        return
    for i in tree[target]:
        tmp=0
        if opef[i]==False:
            tmp=ope[i]
            opef[i]=True
        counter(i,num+tmp)

for _ in range(q):
    p,x=map(int,input().split())
    ope[p-1]+=x

for i in range(n):
    if opef[i]==False:
        opef[i]=True
        counter(i,ope[i])

print(*ret)

### FIXED CODE ###

n,q = map(int,input().split())
rl = [0] * n
al = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a -1
for j in range(q):
    p,x = map(int,input().split())
    al[p-1] += x
for k in range(1,n):
    al[k] += al[rl[k]]
print(*al)
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

if N % 3 != 0:
    ans = "Yes" if sum(A) == 0 else "No"
else:
    B = Counter(A)
    keys = tuple(B.keys())
    vals = tuple(B.values())
    if len(B) == 3:  # 3種類ならa^b^cかつNa==Nb==NCでおけ
        a, b, c = keys
        Na, Nb, Nc = vals
        if Na == Nb and Nb == Nc:
            a, b, c = keys
            ans = "No" if a ^ b ^ c else "Yes"
        else:
            ans = "No"
    elif len(B) == 2:  # 2種類なら、a^a==0かつb==0かつNa==2Nbでおけ
        a, b = keys
        Na, Nb = vals
        if a == 0:
            ans = "Yes" if Na == 2*Nb else "No"
        elif b == 0:
            ans = "Yes" if 2*Na == Nb else "No"
        else:
            ans = "No"
    elif len(B) == 1:
        a = keys[0]
        ans == "Yes" if a == 0 else "No"
    else:
        ans = "No"


print(ans)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))


def xor_circle(N, A):
    if sum(A) == 0:
        return "Yes"
    if N % 3 != 0:
        return "No"

    B = Counter(A)
    if len(B) == 3:
        a, b, c = B.keys()
        Na, Nb, Nc = B.values()
        if a ^ b ^ c == 0 and Na == Nb == Nc:
            return "Yes"
        else:
            return "No"
    elif len(B) == 2:
        a, b = B.keys()
        Na, Nb = B.values()
        if a == 0 and 2*Na == Nb:
            return "Yes"
        elif b == 0 and Na == 2*Nb:
            return "Yes"
        else:
            return "No"
    else:
        return "No"


ans = xor_circle(N, A)
print(ans)