Harryxun/stf_run huggingface dataset:
解説AC



n, m = map(int, input().split())
A, B, C = [], [], []
for _ in range(m):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    c = list(map(int, input().split()))
    now = 0
    for i in range(b-1, -1, -1):
        now += 2**(c[i]-1)
    C.append(now)

INF = 10**9
DP = [[INF for _ in range(2**n)] for _ in range(m+1)]
DP[0][0] = 0

for i in range(m):
    for j in range(2**n):
        c = C[i]
        # 鍵を使用しない
        DP[i+1][j] = min(DP[i][j], DP[i+1][j])
        # 鍵を使用する
        nex = j | c
        DP[i+1][nex] = min(DP[i+1][nex], DP[i][j]+A[i])

ans = 10**9
for i in range(m):
    ans = min(DP[i][-1], ans)

if ans == 10**9:
    ans = -1

print(ans)

### FIXED CODE ###

# 解説AC
# 参考1: https://drken1215.hatenablog.com/entry/2019/09/29/103500
# 参考2: https://www.slideshare.net/chokudai/wap-atcoder4


n, m = map(int, input().split())
A, B, C = [], [], []
for _ in range(m):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    c = list(map(int, input().split()))
    now = 0
    for i in range(b-1, -1, -1):
        now += 2**(c[i]-1)
    C.append(now)

INF = 10**9
DP = [[INF for _ in range(2**n)] for _ in range(m+1)]
DP[0][0] = 0

for i in range(m):
    for j in range(2**n):
        c = C[i]
        # 鍵を使用しない
        DP[i+1][j] = min(DP[i][j], DP[i+1][j])
        # 鍵を使用する
        nex = j | c
        DP[i+1][nex] = min(DP[i+1][nex], DP[i][j]+A[i])

ans = 10**9
for i in range(m):
    ans = min(DP[i][-1], ans)

if ans == 10**9:
    ans = -1

print(ans)
n, a, b = map(int,input().split())
print((n//(a+b))*a+min([a,n%(a+b)]))


### FIXED CODE ###

s = input()
if "A" in s and "B" in s:
    print("Yes")
else:
    print("No")
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,d = ma()
cnt=0
for i in range(n):
    p,q = ma()
    if p**2 + q**2 <=D**2:
        cnt+=1
print(cnt)


### FIXED CODE ###

ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n,d = ma()
cnt=0
for i in range(n):
    p,q = ma()
    if p**2 + q**2 <=d**2:
        cnt+=1
print(cnt)
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n, k = line_to_each_int()
p = line_to_list()

p = sorted(p)
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

x = line_to_list()
print(x.index(0)+1)
class unionFind:
    parent = []
    count = 0

    def __init__(self, N):
        self.parent = [i for i in range(N)]
        self.nums = [1]*N

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.nums[y] += self.nums[x]
            self.nums[x] = 0
            return


N, M = map(int, input().split())
G = unionFind(N)
ans = [0]*M
ab = [tuple(map(int, input().split())) for i in range(M)]

tmp = (N * (N-1)) // 2
for i, x in enumerate(reversed(ab)):
    a, b = x[0], x[1]
    ans[M-1-i] = tmp
    if a <= 0 or b <= 0:
        continue
    a = G.root(a-1)
    b = G.root(b-1)
    if a == b:
        continue
    else:
        tmp -= G.nums[a] * G.nums[b]
        G.parent[a] = b
        G.nums[b] += G.nums[a]
        G.nums[a] = 0


for i in range(M):
    print(ans[i])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)


class unionFind:
    parent = []
    nums = []

    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.nums = [1]*n

    def root(self, x):
        if self.parent[x] == x:
            return(x)
        else:
            self.parent[x] = self.root(self.parent[x])
            return(self.parent[x])

    def same(self, x, y):
        x, y = x-1, y-1
        return(self.root(x) == self.root(y))

    def unite(self, x, y):
        x, y = x-1, y-1
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        else:
            self.parent[x] = y
            self.nums[y] += self.nums[x]
            self.nums[x] = 0
            return


N, M = map(int, input().split())
G = unionFind(N)
ans = [0]*M
ab = [tuple(map(int, input().split())) for i in range(M)]

tmp = (N * (N-1)) // 2
for i, x in enumerate(reversed(ab)):
    a, b = x[0], x[1]
    ans[M-1-i] = tmp
    a = G.root(a-1)
    b = G.root(b-1)
    if a == b:
        continue
    else:
        tmp -= G.nums[a] * G.nums[b]
        G.parent[a] = b
        G.nums[b] += G.nums[a]
        G.nums[a] = 0


for i in range(M):
    print(ans[i])
from math import fractorial;print(fractorial(int(input()))%(10**9+7))

### FIXED CODE ###

from math import factorial;print(factorial(int(input()))%(10**9+7))
import sys

sys.setrecursionlimit(10000)

def f(b, n):
    if n < b:
        return n
    else:
        q, r = divmod(n, b)
        return f(b, q) + r

n = int(input())
s = int(input())
if n == s:
    print(n+1)
else:
    b = 2
    while b*b <= n:
        if f(b, n) == s:
            print(b)
            break
        b += 1
    else:
        p = 1
        ans = 10**13
        while p*p <= n:
            b = (n - s) // p + 1
            if f(b, n) == s:
                ans = min(ans, b)
            p += 1
        if ans == 10**13:
            print(-1)
        else:
            print(ans)

### FIXED CODE ###

def f(b, n):
    if n < b:
        return n
    else:
        q, r = divmod(n, b)
        return f(b, q) + r

n = int(input())
s = int(input())
if n == s:
    print(n+1)
else:
    b = 2
    while b*b <= n:
        if f(b, n) == s:
            print(b)
            break
        b += 1
    else:
        p = 1
        ans = 10**13
        while p*p <= n:
            b = (n - s) // p + 1
            if p < b and s - p < b and f(b, n) == s:
                ans = min(ans, b)
            p += 1
        if ans == 10**13:
            print(-1)
        else:
            print(ans)
input_train_price1=input("電車の通常の切符の料金を入力:")
input_train_price2=input("電車の乗り放題切符の料金を入力":)
input_bus_price1=input("バスの通常の切符の料金を入力:")
input_bus_price2=input("バスの乗り放題切符の料金を入力":)

train_price1=int(input_train_price1)
train_price2=int(input_train_price2)
bus_price1=int(input_bus_price1)
bus_price2=int(input_bus_price2)

train_price=["train_price1,train_price2"]
bus_price=["bus_price1,bus_price2"]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

print("運賃の合計の最小値は"+best_train_price+best_bus_price+"円です。")

### FIXED CODE ###

input_train_price1=input()
input_train_price2=input()
input_bus_price1=input()
input_bus_price2=input()

train_price=[int(input_train_price1),int(input_train_price2)]
bus_price=[int(input_bus_price1),int(input_bus_price2)]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

#print(best_train_price+"+"+best_bus_price)

total_price=best_train_price+best_bus_price

print(str(total_price))
import math

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

dighour = 360 * ((H+M/60)/12)
digmin = 360 * (M/60)
length = 0
cosin = 0
if dighour > digmin and abs(dighour - digmin) <= 180:
    cosin = round(math.cos(math.radians(abs(dighour-digmin))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour > digmin and abs(dighour - digmin) > 180:
    cosin = round(math.cos(math.radians(360 - abs(dighour-digmin)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    cosin = round(math.cos(math.radians(abs(digmin-dighour))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) > 180:
    cosin = round(math.cos(math.radians(360 - abs(digmin-dighour)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))

print(length)

### FIXED CODE ###

import math

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

dighour:float = 30*H + M*0.5
digmin:float =  M * 6
length:float = 0

deg = abs(dighour-digmin)
length = math.sqrt(A**2 + B**2 - (2 * A * B * math.cos(math.radians(deg))))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)
t = int(input())
for _ in range(t):
    n = int(input())
    h = list(map(int, input().split()))
    maxv = 0, minv = 0
    for i in range(len(h)-1):
        maxv = max(maxv, h[i+1]-h[i])
        minv = max(minv, h[i]-h[i+1])
    print(maxv, minv)

### FIXED CODE ###

t = int(input())
for _ in range(t):
    n = int(input())
    blocks = list(map(int, input().split()))
    maxv = minv = 0
    for i in range(1, n):
        maxv = max(maxv, blocks[i] - blocks[i-1])
        minv = max(minv, blocks[i-1] - blocks[i])
    print(maxv, minv)
N = int(input())
HL = list(map(int,input().split()))
HL.append(10**9+1)  #HLの最後に(最大値+1)をappend
cnt = 0
tmp_c = 0

for i in range(N):
    if HL[i] >= HL[i+1]:
        tmp_c += 1
    else:
        if cnt <= tmp_c:
            cnt = tmp_c
            tmp_c = 0
        else:
            tmp_c = 0

print(cnt)

### FIXED CODE ###

S = input()
T = input()
ans = 0

if S[0] == T[0]:
    ans += 1
if S[1] == T[1]:
    ans += 1
if S[2] == T[2]:
    ans += 1

print(ans)
S=input()
lenS=len(S)
L=[0]*10000
j=0
i=0
s=0
while(True):
    if(lenS==i):
        print("YES")
        exit()
    if(S[i:i+7]=="dreamer" and s<1):
        L[j]=1
        j+=1
        i+=7
        s=0
        continue
    if(S[i:i+5]=="dream" and s<2):
        L[j]=2
        j+=1
        i+=5
        s=0
        continue
    if(S[i:i+6]=="eraser" and s<3):
        L[j]=3
        j+=1
        i+=6
        s=0
        continue
    if(S[i:i+5]=="erase" and s<4):
        L[j]=4
        j+=1
        i+=5
        s=0
        continue
    j-=1
    if(j<0):
        print("NO")
        exit()
    if(L[j]==1):
        i-=7
        s=1
    elif(L[j]==2):
        i-=5
        s=2
    elif(L[j]==3):
        i-=6
        s=3    
    elif(L[j]==4):
        i-=5
        s=4






### FIXED CODE ###

S = input()
S = S[::-1]
#print(S)

while True:
    if len(S) >= 7 and S[:7] =='remaerd':
        S = S[7:]
    elif len(S) >= 6 and S[:6] =='resare':
        S = S[6:]
    elif len(S) >= 5 and S[:5] =='maerd':
        S = S[5:]
    elif len(S) >= 5 and S[:5] =='esare':
        S = S[5:]
    else:
        print("NO")
        exit()
    if len(S) == 0:
        print("YES")
        exit()
B = [False]*10010
C = [0]*10010
for i in range(2,10005):
    if not B[i]:
        j = i+i
        while j < 10005:
            B[j]= True
            j+=i
for i in range(3,10005,2):
    if not B[i] and not int(B[(i+1)/2]):
        C[i]+=1
for i in range(3,10005):
    C[i]=C[i]+C[i-1]
    
N = int(input())
for _ in range(N):
    a, b = map(int,input().split())
    print(C[b]-C[a-1])

### FIXED CODE ###

B = [False]*100005
C = [0]*100005
for i in range(2,100001):
    if not B[i]:
      	for j in range(i+i,100001,i):
          	B[j]=True
for i in range(3,100001,2):
    if not B[i] and not B[(i+1)//2]:
        C[i]+=1
for i in range(3,100001):
    C[i]=C[i]+C[i-1]
    
N = int(input())
for _ in range(N):
    a, b = map(int,input().split())
    print(C[b]-C[a-1])
a=input()
b=input()

print(a*b)
print(2*(a+b))

### FIXED CODE ###

x,y = map(int,raw_input().split())
print x*y,2*(x+y)
for i in range(len(S)):
  bottom_num=S[i-1]
  try:
    if S[i]<=S[i+1]:
      pass
    elif S[i]-1==S[i+1]:
      S[i]-=1  
      if S[i]<bottom_num:
        indication=False
        break      
    else: 
      indication=False
      break
  except:
    pass
print(S)
if indication:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

for i in reversed(range(N - 1)):
  if H[i + 1] - H[i] == -1:
    H[i] -= 1
  elif H[i + 1] - H[i] < -1:
        print('No')
        exit()
print('Yes')
import math 
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)

while(right-left>=1):
    numofcut=0
    mid=(left+right)//2
    for i in range(N):
        if A[i]%mid==0:
            numofcut+=A[i]//mid -1
        else:
            numofcut+=A[i]//mid
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    max((left+right)//2,1)

print(mid)

### FIXED CODE ###

import math 
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)

while(right-left>=1):
    numofcut=0
    
    for i in range(N):
        if A[i]%mid==0:
            numofcut+=(A[i]//mid) -1
        else:
            numofcut+=A[i]//mid
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)
import math
import itertools
from decimal import Decimal
N = int(input())
z = []
A = []
for i in range(N):
  xy = list(map(int,input().split()))
  z.append(xy)
for j in range(N):
  for k in range(j+1,N):
    A.append(Decimal(math.sqrt((z[j][0]-z[k][0])**2+(z[j][1]-z[k][1])**2)))
B = list(itertools.permutations(A, 2))
for l in range(math.factorial(N)):
  B[l] = sum(B[l])
print(sum(B)/math.factorial(N))

### FIXED CODE ###

import itertools
N = int(input())
zahyo =[list(map(int,input().split())) for _ in range(N)]
N_list = [i for i in range(N)]
P = itertools.permutations(N_list,N)
P = list(P)
sm = 0
for p in P:
    for i,j in zip(p,p[1:]):
        xi,yi = zahyo[i]
        xj,yj = zahyo[j]
        sm += (((xi-xj)**2+(yi-yj)**2)**0.5)
print(sm/len(P))
# coding: utf-8

# In[1]:

import sys
import math
#input = sys.stdin.readline
N = int(input())


# In[5]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N+0.5))+1):
    if N%i == 0:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:





### FIXED CODE ###


# coding: utf-8

# In[ ]:

import sys
input = sys.stdin.readline
N, K = map(int, input().split())
#A = list(map(int, input().split()))


# In[ ]:

print(N-K+1)
a,b = map(int, input().split())
p = a*b
if p%2 ==　0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a,b = map(int, input().split())
p = a*b
if p%2 == 0:
  print("Even")
else:
  print("Odd")
s = input()
m = s.replace(2017,2018)
print(m)


### FIXED CODE ###

s= input()
print(s.replace('2017','2018'))
s = input()
s[3] = '8'
print(s)

### FIXED CODE ###

s = input()
l = list(s)
l[3] = '8'
s = "".join(l)
print(s)
n,a,b = map(int,input().split())

class ModComb:
    def __init__(self, MAX, mod=10 ** 9 + 7):
        fac = [1, 1]
        finv = [1, 1]
        inv = [0, 1]
        for i in range(2, MAX):
            fac.append(fac[i - 1] * i % mod)
            inv.append(mod - inv[mod % i] * (mod // i) % mod)
            finv.append(finv[i - 1] * inv[i] % mod)
        self.fac, self.finv, self.mod = fac, finv, mod

    def nCk(self, n, k):
        if n < k or n < 0 or k < 0:
            return 0
        fac, finv, mod = self.fac, self.finv, self.mod
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod


mod = 10 ** 9 + 7
mc = ModComb(1000000, mod=mod) 

minus = (mc.nCk(n, a) % mod) + (mc.nCk(n, b) % mod)

print((2 ** (n) - 1) - minus)

### FIXED CODE ###

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

MOD=10**9+7
def comb(n,k):
    if n<k:
        return 0
    if n<0 or k<0:
        return 0
    k=min(n-k,k)
    ans=1
    inv=[1]*(k+1)
    if k>=1:
        ans*=(n-k+1)%MOD
    for i in range(2,k+1):
        inv[i]=MOD-inv[MOD%i]*(MOD//i)%MOD
        ans=ans*(n-k+i)*inv[i]%MOD
    return ans

nCa = comb(n,a)
nCb = comb(n,b)

ans = (pow(2,n,MOD) - 1) - nCa - nCb
 
if ans < 0:
    print((ans+MOD)%MOD)
else:
    print(ans%MOD)
day = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRY":2, "SAT":1}
s = input()
print(day[s])
  

### FIXED CODE ###

day = {"SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3, "FRI":2, "SAT":1}
s = input()
print(day[s])
l = map(int,raw_input().split())
s = l[0] * l[1]
shu = l[0] * 2 + l[1] * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)

### FIXED CODE ###

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

s = a * b
shu = a * 2 + b * 2
fmt = "{s} {shu}"
s = fmt.format(s = s,shu = shu)
print(s)
def solve(target):
    n = int(target / 100)
    if n  100 <= target <= n  105:
        print(1)
    else:
        print(0)

solve(int(input()))

### FIXED CODE ###

def solve(target):
    n = int(target / 100)
    if n * 100 <= target <= n * 105:
        print(1)
    else:
        print(0)

solve(int(input()))
s = input()
a = s[::2].count('0') + s[1::2].count('1')
a = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))

### FIXED CODE ###

s = input()
a = s[::2].count('0') + s[1::2].count('1')
b = s[::2].count('1') + s[1::2].count('0')
print(min(a, b))
N,M=map(int, input().split())
l=[[]for j in range(N)]
field=[True]*N
for i in range(M):
    a,b=map(int,input().split())
    l[min(a,b)-1].append(max(a,b)-1)
for i in range(N):
    l[i]=list(set(l[i]))

def dfs(x):
    conn=1
    field[x]=False
    for j in range(len(l[x])):
        if field[l[x][j]]:
            conn+=dfs(l[x][j])
    return conn

nax=0
for i in range(N):
    temp=dfs(i)
    nax=max(nax,temp)

print(nax)


### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M=map(int,input().split())
uf=UnionFind(N)
for i in range(M):
    A,B=map(int,input().split())
    uf.union(A-1,B-1)
ans=0
for i in range(N):
    ans=max(ans,uf.size(i))

print(ans)
K=int(input())

from collections import deque
num=deque()
for i in range(1,10):
  num.append(i)

for j in range(K):
  l=num.popleft()
  if ans%10 !=0:
    num.append(l*10+(l%10-1))
  num.append(l*10)
  if ans%10 != 9:
    num.append(l*10+(l%10+1))

print(l)
  
  

### FIXED CODE ###

K=int(input())

from collections import deque
num=deque()
for i in range(1,10):
  num.append(i)

for j in range(K):
  l=num.popleft()
  if l%10 !=0:
    num.append(l*10+(l%10-1))
  num.append(l*10+(l %10))
  if l%10 != 9:
    num.append(l*10+(l%10+1))

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

def check(a, b, i):
  if (a + 1) * 10 ** i + b - 10 <= N:
    return 10 ** (i - 1)
  else:
    ret = 0
    for j in range(10 ** (i - 1)):
      if a * 10 ** i + j * 10 + a <= N:
        ret += 1
      else:
        return ret
ans = 0
for a in range(1, 10):
  for b in range(a, 10):
    if a == b:
      n = 0
      if a * 10 + b <= N:
        n += 2
      elif a <= N:
        n += 1
      for i in range(2, 6):
        n += check(a, b, i)
      ans += n ** 2
    else:
      n, m = 0, 0
      if a * 10 + b <= N:
        n += 1
      if b * 10 + a <= N:
        m += 1
      for i in range(2, 6):
        n += check(a, b, i)
        m += check(b, a, i)
      ans += n * m * 2
print(ans)

### FIXED CODE ###

N = int(input())

c = [[0 for _ in range(9)] for _ in range(9)]
for i in range(1, 10):
  for j in range(1, 10):
    cnt = 0
    for n in range(1, N + 1):
      if n // (10 ** (len(str(n)) - 1)) == i and n % 10 == j:
        cnt += 1
    c[i - 1][j - 1] = cnt

ans = 0
for i in range(9):
  for j in range(9):
    ans += c[i][j] * c[j][i]
print(ans)
import math

num=int(input())
target=list(map(int, input().split()))
def comb(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))

for i in range(num):
    A=target.copy()
    A.pop(i)
    B=[x for x in set(A) if A.count(x) > 1]
    out=0 
    for j in B:
        base = comb(A.count(j),2)
        out=out+base
    print(out)
        

### FIXED CODE ###

import math
N,M=map(int, input().split())
def comb(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
try :
    base = comb(N,2)
except:
    base=0
def comb2(M, r):
    return math.factorial(M) // (math.factorial(M - r) * math.factorial(r))
try:
    base2 = comb2(M,2)
except:
    base2=0

print(base+base2)
N=int(input())
a=list(map(int, input().split()))
Flag=True

#print(bin(a[N-1] ^ a[1]))
#print(bin(a[0]))

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    if N!=3:
      for i in range(0,N-3):
        #print(bin(a[N] ^ a[N+2]),bin(a[N+1]))
        if Flag:
          if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
            Flag=False
            break  
      if Flag:
        print("Yes")
    else:
      if bin(a[0] ^ a[2]) == bin(a[1]):
        print("Yes")
      else:
        print("No")
  else:
    print("No")    
else:
  print("No")
    

### FIXED CODE ###

from collections import Counter,OrderedDict

N=int(input())
a=list(map(int,input().split()))
d=OrderedDict(Counter(a))
e=list(d)
e.sort()

if len(d)>3:
    ans="No"
else:
    ans="No"
    if len(d)==1:
        if e[0]==0:
            ans="Yes"
    elif len(d)==2:
        if N%3==0:
            if e[0]==0 and d[0]==N//3 and d[e[1]]==2*N//3:
                ans="Yes"
    else:
        if N%3==0:
            if d[e[0]]==d[e[1]]==d[e[2]]:
                if e[0]^e[1]^e[2]==0:
                    ans="Yes"
                   
print(ans)