Harryxun/stf_run huggingface dataset:
N, K, Q = map(int, input().split())
L = []
for i in range(N):
 L.append(0)
for i in range(Q)
 a = int(input()) - 1
 L[a] += 1
for i in range(N):
 print("Yes" if K - Q + L.count(i+1) > 0 else "No")

### FIXED CODE ###

N, K, Q = map(int, input().split())
L = []
for i in range(N):
 L.append(0)
for i in range(Q):
 a = int(input()) - 1
 L[a] += 1
for i in range(N):
 print("Yes" if K - Q + L[i] > 0 else "No")
b=input()
 
if b="A":
    print("T")
elif b="T":
    print("A")
elif b="G":
    print("C")
elif b="C":
    print("G")

### FIXED CODE ###

b=input()
 
if b=="A":
    print("T")
elif b=="T":
    print("A")
elif b=="G":
    print("C")
elif b=="C":
    print("G")
from collections import Counter

N = int(input())
s = [0]*(N-1)
for i in range(N-1):
    #s[i] = ''.join(sorted(list(input())))
    s[i] = int(input())

ct = Counter(s)

for i in range(1,N):
    if i in ct.keys():
        print(ct[i])
    else:
        print(0)
#print(0)


### FIXED CODE ###

import collections

N = int(input())
s = list(map(int, input().split()))

ct = collections.Counter(s)

for i in range(N):
    print(ct[i+1])
r, d, x = map(int, input().split())

for i in range(10):
    ans = x * r - d
    print(ans)
    x = ans

### FIXED CODE ###

age, price = map(int, input().split())
ans = 0

if age <= 5:
    ans = 0
elif age >= 6 and age <= 12:
    ans = price // 2
else:
    ans = price 

print(ans)
import numpy as np

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

### FIXED CODE ###

N = input()

print(N**3)
n=int(input())

s=input()

s=s+str(X)

counter=1

lists=[]

for i in range(n):

  if s[i]==s[i+1]:

    counter+=1

  else:

    lists.append(counter)

    counter=1

ans=1
13
for i in lists:

  ans=ans*i%(10**9+7)

print(ans)

### FIXED CODE ###

n=int(input())
s=input()
import collections
s=dict(collections.Counter(s))
ans=1
for i in s.values():
    ans*=(i+1)
    ans=(ans)%(10**9+7)
print(ans-1)
s=set(input())
if len(s)%2==0:
  if s==set("SN") or s==set("WE"):
    print("Yes")
else:
    print("No")
else:
  print("No")

### FIXED CODE ###

s=set(input())
if len(s)%2==0:
  if s==set("SN") or s==set("WE") or s==set("SENW"):
    print("Yes")
  else:
    print("No")
else:
  print("No")
import collections 
N = int(input())
A = [int(i) for i in input().split()]
A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[0],reverse = True)
e = []

for k,v in A:
  if v >= 4:
    e.append([k]*2)
  elif v >= 2:
    e.append(k)
  if len(e) >= 2:
    break
if len(e) < 2:
  ans = 0
else:
  ans = e[0]*e[1]
print(ans)

### FIXED CODE ###

import collections 
N = int(input())
A = [int(i) for i in input().split()]
A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[0],reverse = True)
e = []

for k,v in A:
  if v >= 4:
    e.append(k)
    e.append(k)
  elif v >= 2:
    e.append(k)
  if len(e) >= 2:
    break
if len(e) < 2:
  ans = 0
else:
  ans = e[0]*e[1]
print(ans)
#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
for i in range(N-1):
    T[i]=T[i]/math.gcd(T[i], T[i+1])
for i in range(N):
    ans=ans*T[i]
print(int(ans))

### FIXED CODE ###

#ABC070C
import math
from functools import reduce
N=int(input())
T=[int(input()) for i in range(N)]
#def lcm_base(x, y):
#    interium=x//math.gcd(x, y)
#    return (interium*y)
#print(reduce(lcm_base, T))
ans=1
def grcode(x, y):
    if y==0:
        return (x)
    else:
        return grcode(y, x%y)
for i in range(N-1):
    T[i]=T[i]//grcode(T[i],T[i+1])
    T[i+1]=T[i]*T[i+1]
print(T[N-1])
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = [i for i in range(a[-1])]
    ans = a[-1]
    for i in range(1,n):
        if len(x)==0:
            x = [i for i in range(a[-1-i])]
        e = x.pop(-1)
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = [i for i in range(a[-1-i])]
            ans += a[-1-i]
    if len(x)==0:
        print(ans) 
    else:
        print(-1) 

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = a[-1]
    ans = a[-1]
    for i in range(1,n):
        if x==0:
            x = a[-1-i]
        e = x-1
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = a[-1-i]
            ans += a[-1-i]
        else:
            x -= 1
    if x==0:
        print(ans)
    else:
        print(-1) 

if __name__ == "__main__":
    main()
from math import atan, degrees
a, b, x = map(int, input().split())
x = x / a ** 2
if x >= b / 2:
    print(90-degrees(atan(a / (2 * b - 2 * x))))
else:
    print(90-degrees(atan(2 * a * x / b ** 2)))


### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())
if x == a * b * b:
    print(0)
else:
    x = x / a ** 2
    if x >= b / 2:
        print(90-degrees(atan(a / (2 * b - 2 * x))))
    else:
        print(90-degrees(atan(2 * a * x / b ** 2)))
import sys
n,q=map(int,input().split())
s=input()
l=[[i for i in l.split()] for l in sys.stdin]
def right_fallen(x):
  stack=x
  for i in range(n):
    if stack==n:
      return True
    if stack==-1:
      return False
    if l[i][0]==s[stack]:
      if l[i][1]=='R':
        stack+=1
      else:
        stack-=1
  return False
def left_fallen(x):
  stack=x
  for i in range(n):
    if stack==n:
      return False
    if stack==-1:
      return True
    if l[i][0]==s[stack]:
      if l[i][1]=='R':
        stack+=1
      else:
        stack-=1
  return False
def binary_search():
  ok=n
  ng=-1
  while(abs(ok-ng)>1):
    mid=(ok+ng)//2
    if right_fallen(mid):
      ok=mid
    else:
      ng=mid
  return ok
def binary_search2():
  ok=-1
  ng=n
  while(abs(ok-ng)>1):
    mid=(ok+ng)//2
    if left_fallen(mid):
      ok=mid
    else:
      ng=mid
  return ok
print(binary_search()-binary_search2()-1)

### FIXED CODE ###

import sys
n,q=map(int,input().split())
s=input()
l=[[i for i in l.split()] for l in sys.stdin]
def right_fallen(x):
  stack=x
  for i in range(q):
    if stack==n:
      return True
    if stack==-1:
      return False
    if l[i][0]==s[stack]:
      if l[i][1]=='R':
        stack+=1
      else:
        stack-=1
  if stack==n:
    return True
  return False
def left_fallen(x):
  stack=x
  for i in range(q):
    if stack==n:
      return False
    if stack==-1:
      return True
    if l[i][0]==s[stack]:
      if l[i][1]=='R':
        stack+=1
      else:
        stack-=1
  if stack==-1:
    return True
  return False
def binary_search():
  ok=n
  ng=-1
  while(abs(ok-ng)>1):
    mid=(ok+ng)//2
    if right_fallen(mid):
      ok=mid
    else:
      ng=mid
  return ok
def binary_search2():
  ok=-1
  ng=n
  while(abs(ok-ng)>1):
    mid=(ok+ng)//2
    if left_fallen(mid):
      ok=mid
    else:
      ng=mid
  return ok
print(binary_search()-binary_search2()-1)
input_line = input().split()
a = int(input_line[0])
b = int(input_line[1])
c = int(input_line[2])
k = int(input_line[3])

def return_answer(a,b,c,k):
    answer = 0
    if a < k:
        answer += a
        count = k - a

        if b < k:
            count -= b
            answer -= count

    elif a >= k:
        answer = k

    return answer

print(return_answer(a,b,c,k))


### FIXED CODE ###

s = input()
t = input()
if s == t[:-1] :
    print("Yes")

else:
    print("No")
from collections import defaultdict

V = defaultdict(list)
N = int(input())
for _ in range(N-1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)
*c, = map(int, input().split())
c.sort(reverse=True)

s = {}

cost = [-1]*(N+1)
p = 0
ans = 0
for v, l in sorted(V.items(),key=lambda x:-len(x[1])):
    print(cost[v], v, p, cost)
    if cost[v]==-1:
        cost[v] = c[p]
        p += 1

    for i in l:
        if cost[i]!=-1:continue
        cost[i] = c[p]
        s[(v, i)] = min(cost[i], cost[v])
        p += 1

print(sum(s.values()))
print(*cost[1:])

### FIXED CODE ###

from collections import defaultdict

V = defaultdict(list)
N = int(input())
for _ in range(N-1):
    a, b = map(int, input().split())
    V[a].append(b)
    V[b].append(a)
*c, = map(int, input().split())
c.sort(reverse=True)

root, _ = max(V.items(), key=lambda x:len(x[1]))
visited = [False] * (N+1)
identifier = [0] * (N+1)

p = 0
q = [root]
while q:
    a = q.pop()
    visited[a] = True
    identifier[a] = p

    p+=1

    for i in V[a]:
        if visited[i]:continue
        q.append(i)

cost = 0
visited = [False] * (N+1)
q = [root]
while q:
    a = q.pop()
    visited[a] = True
    p+=1

    for b in V[a]:
        if visited[b]:continue
        cost += min(c[identifier[a]], c[identifier[b]])
        q.append(b)

print(cost)
print(*[c[i] for i in identifier[1:]])
n = list(int(input()))

for i in n:
  if i == 9:
    print("Yes")
    break
    
print("No")
  

### FIXED CODE ###

def solve(): # 073A- September 9
    n = int(input())
    n_10 = n // 10
    n_1 = n - n_10 * 10

    if n_10 == 9 or n_1 == 9:
        print("Yes")
    else:
        print("No")
        

solve()
x = 1

for i,d in zip(reversed(range(len(D))), reversed(D)):
  if Q[-1][0] == i:
    result[Q[-1][1]] = P[i] >= x
    Q.pop()
    if not Q:
      break

  if abs(x-d) < x:
    x += d

for r in result:
  print('YES' if r else 'NO')

### FIXED CODE ###

N,start = map(int,input().split())
D = list(map(int,input().split()))
input()
Q = list(map(int,input().split()))

Q = [(k-1,i) for i,k in enumerate(Q)]
Q.sort()

P = [start]
for d in D:
  a = P[-1]
  b = abs(a-d)
  P.append(min(a,b))

result = [None]*len(Q)

x = 1

for i,d in zip(reversed(range(len(D))), reversed(D)):
  if Q[-1][0] == i:
    result[Q[-1][1]] = P[i] >= x
    Q.pop()
    if not Q:
      break

  if abs(x-d) < x:
    x += d

for r in result:
  print('YES' if r else 'NO')
import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(ans, score):
  LastDay = [0]*26
  for i in range(D):
    score += s[i][ans[i]-1]
  for i in range(D):
    score += (D - i+1) * (i+1 - LastDay[ans[i]-1])*c[i]
  return score

D = I()
c = IL()
s = [IL() for i in range(D)]
ans = [I() for i in range(D)]

score = 0
for i in range(26):
  score -= D * (2*c[i] + (D - 1)*c[i])//2

print(max(0, 10**6 + tami(ans, score)))

### FIXED CODE ###

import sys
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def tami(date, LastDay, type, score):
  res = score
  res += s[date-1][type]
  for i in range(26):
    if i == type:
      continue
    res -= (date - LastDay[i]) *c[i]
  return res

D = I()
c = IL()
s = [IL() for i in range(D)]
ans = [I() for i in range(D)]

LastDay = [0]*26
score = 0
for d in range(D):
  score = tami(d+1, LastDay, ans[d]-1, score)
  LastDay[ans[d]-1] = d+1
  print(score)
n = int(input())
for _ in range(n):
  t, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")


### FIXED CODE ###

n = int(input())
for _ in range(n):
  dt, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")
import sys
input = sys.stdin.readline

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

arr = sorted([i for i in range(a, b+1)])
arr_slice = set(arr[:k] | arr[-k:])
[print(i) for i in sorted(arr_slice)]

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

pre_arr = [i for i in range(a, min(a+k, b+1))]
back_arr = [i for i in range(max(b-k+1, a), b+1)]
arr_slice = set(pre_arr) | set(back_arr)
[print(i) for i in sorted(arr_slice)]
be=input()
af=input()
ans=0
for i in range (3):
  	if be[i]==af[i]:
    	ans+=1
print(ans)


### FIXED CODE ###

be=input()
af=input()
ans=0
for i in range (3):
    if be[i]==af[i]:
        ans+=1
print(ans)
# -*- coding: utf-8 -*-
from math import sqrt,ceil,log10

n = int(input())

nsr = sqrt(n)

x = -1
for i in range(1,ceil(nsr)):
    if n%i==0:
        x = n//i

ret = ceil(log10(x))
if 10**(ret)==int(x):
    print(ret+1)
else:
    print(ret)


### FIXED CODE ###

# -*- coding: utf-8 -*-

n = int(input())

def cntd(x):
    digits = 0

    while x/10>0:
        x = x//10
        digits += 1
    return digits

ans = cntd(n)

a = 1
while a*a<=n:
    if n%a!=0:
        a += 1
        continue

    b = n//a
    cur = max(cntd(a), cntd(b))
    if ans>cur:
        ans = cur
    a += 1

print(ans)
import itertools
import collections
N = int(input())
A = [int(_) for _ in input().split()]
c = sorted(collections.Counter(A).values())
acc = list(itertools.accumulate([0] + c))
n = len(acc) - 1
j = 0
for i in range(1, N + 1):
    r = 0
    while i - j > 0:
        if (i - j) * c[-1 - j] <= acc[-1 - j]:
            r = acc[-1 - j] // (i - j)
            break
        else:
            j += 1
    print(r)


### FIXED CODE ###

import itertools
import collections
N = int(input())
A = [int(_) for _ in input().split()]
c = sorted(collections.Counter(A).values())
acc = list(itertools.accumulate([0] + c))
n = len(acc) - 1
j = 0
for i in range(1, n + 1):
    r = 0
    while i - j > 0:
        if (i - j) * c[-1 - j] <= acc[-1 - j]:
            r = acc[-1 - j] // (i - j)
            break
        else:
            j += 1
    print(r)
for _ in range(N - n):
    print(0)
def resolve():
    import math
    a,b,x = map(int, input().split())
    area = x/a
    height = x/(a**2)
    if area >= (a*b/2):
        c = b-height
        angle = math.degrees(math.atan(a/(2*c)))
        print(90-angle)
    else:
        d = area*2/b
        angle = math.degrees(math.atan(d/b))
        print(90-angle)
resolve()

### FIXED CODE ###

def resolve():
    import math
    a,b,x = map(int, input().split())
    area = x/a
    height = x/(a**2)
    if height == b:
        print(0)
    elif area >= (a*b/2):
        c = b-height
        angle = math.degrees(math.atan(a/(2*c)))
        print(90-angle)
    else:
        d = area*2/b
        angle = math.degrees(math.atan(d/b))
        print(90-angle)
resolve()
mod = 10**9+7
MAX = 10**5
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i)%mod
inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod%i]*(mod-mod//i)%mod
fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1]*inv[i]%mod
def comb(n, r):
    if n < r:
        return 0
    return fact[n]*fact_inv[n-r]*fact_inv[r] % mod

n = int(input())
L = list(map(int,input().split()))
M = []
for i in range(n+1):
    M.append(L[i])
M.sort()
dou = 1 #重複する数
for i in range(n+1):
    if M[i] == dou:
        dou += 1
    else:
        dou = M[i]
        break
l = 0
r = 0
cnt = 0
for i in range(n+1):
    if L[i] == dou and cnt == 0:
        l = i+1
        cnt += 1
    elif L[i] == dou and cnt == 1:
        r = i+1
        break
for i in range(1,n+1):
    print((comb(n+1,i)-comb(l+n-r,i-1))%mod)
print(1)


### FIXED CODE ###

mod = 10**9+7
MAX = 10**5+1
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i)%mod
inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod%i]*(mod-mod//i)%mod
fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1]*inv[i]%mod
def comb(n, r):
    if n < r:
        return 0
    return fact[n]*fact_inv[n-r]*fact_inv[r] % mod

n = int(input())
L = list(map(int,input().split()))
M = []
for i in range(n+1):
    M.append(L[i])
M.sort()
dou = 1 #重複する数
for i in range(n+1):
    if M[i] == dou:
        dou += 1
    else:
        dou = M[i]
        break
l = 0
r = 0
cnt = 0
for i in range(n+1):
    if L[i] == dou and cnt == 0:
        l = i+1
        cnt += 1
    elif L[i] == dou and cnt == 1:
        r = i+1
        break
for i in range(1,n+1):
    print((comb(n+1,i)-comb(l+n-r,i-1))%mod)
print(1)
H,N = (input()).split(" ")
H=(int)(H)
N=(int)(N)
As = (input()).split(" ")

sum=0

for A in As:
  sum+=(int)(A)
  
if sum>=A:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

H,N = (input()).split(" ")
H=(int)(H)
N=(int)(N)
As = (input()).split(" ")
 
sum=0
 
for A in As:
  sum+=(int)(A)
  
if sum>=H:
  print("Yes")
else:
  print("No")
A, B, C = stdin.readline().rstrip().split()
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)

### FIXED CODE ###

A, B, C = map(int, input().split())
ans = C-(A-B)
if ans > 0:
  print(ans)
else:
  print(0)
n = int(input())

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

l.sort()

ans = 0
if n <3:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k]　and l[j] + l[k] > l[i]　and l[k] + l[i] > l[j]:
          ans += 1
  print(ans)

### FIXED CODE ###

n = int(input())

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

l.sort()
ans = 0

if n < 2:
  print(0)
else:
  for i in range(n-2):
    for j in range(i+1,n-1):
      for k in range(j+1,n):
        if l[i] + l[j] > l[k] and l[i] < l[j] < l[k]:
          ans += 1
  print(ans)
def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i  <a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    #r+=1
  print(r)
main()


### FIXED CODE ###

def main():
  n=int(input())
  a=sorted(map(int,input().split()))
  maxa=a[-1]+1
  tf=[False]*maxa
  r=0
  n-=1
  for i in range(n):
    a_i=a[i]
    if tf[a_i] ==False:
      for j in range(a_i,maxa,a_i):
        tf[j]=True
      if a_i  <a[i+1]:
        #print(a_i)
        r+=1
  if tf[-1] ==False:
    r+=1
  print(r)
main()
n,x = list(map(int,input().split()))

l = [int(s) for s in input().split()]
d = 0
i = 1
d = [0] * (n+1)
count = 0
if n == 1 and x >= l[0]:
    print(1)
elif n == 1 and x < l[0] :
    print(0)
else:

    while True:
        
        
        d[i] = d[i-1] + l[i-1]
        count += 1
        
        if d[i] > x:
            break
        
        i += 1
        if i > n:
            print(count)-1
            exit()

    print(count)


### FIXED CODE ###

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

l = [int(s) for s in input().split()]
d = 0
i = 1
d = [0] * (n+1)
count = 0
if n == 1 and x >= l[0]:
    print(1)
elif n == 1 and x < l[0] :
    print(0)
else:

    while True:
        
        
        d[i] = d[i-1] + l[i-1]
        count += 1
        
        if d[i] > x:
            break
        
        i += 1
        if i > n:
            print(count+1)
            exit()

    print(count)
#!/usr/bin/env python3
import math
import numpy as np

n = int(input())
ans = np.inf
for i in range(1, int(math.sqrt(n))):
    if n%i==0:
        q = n/i 
        tmp = i+q 
        if tmp <= ans:
            ans = tmp 
print(int(ans-2))


### FIXED CODE ###

#!/usr/bin/env python3
import math
import numpy as np

n = int(input())
ans = np.inf
for i in range(1, int(math.sqrt(n))+1):
    if n%i==0:
        q = n//i
        tmp = i+q 
        if tmp <= ans:
            ans = tmp 
            i_ = i 
            q_ = q 

print(ans-2)
import heapq as hp

n,m =[int(i) for i in input().split()]
lists = [[] for i in range(m)]

for _ in range(n):
  a,b = [int(i) for i in input().split()]
  lists[a-1].append(b)
  
h = []
ans = 0
for day in range(m):
  for v in lists[day]:
    hp.heappush(h, -v)
  ans -= hp.heappop(h)
  
print(ans)
  

### FIXED CODE ###

import heapq as hp

n,m =[int(i) for i in input().split()]
lists = [[] for i in range(m)]

for _ in range(n):
  a,b = [int(i) for i in input().split()]
  if a<=m:
  	lists[a-1].append(b)
  
h = []
ans = 0
for day in range(m):
  for v in lists[day]:
    hp.heappush(h, -v)
  if len(h)>0:
    ans -= hp.heappop(h)
print(ans)
N=int(input())
arare=list(input())
if Y in arare:
  print('Four')
else:
  print('Three')

### FIXED CODE ###

N=int(input())
arare=list(input())
if 'Y' in arare:
  print('Four')
else:
  print('Three')
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def _main():
    input()
    an = list(get_ints())

    t = 0
    old = 1000000000
    while 1:
        ans = sq(t, an)
        g = sq(t+1, an) - ans
        t -= g / abs(g)
        if old > ans:
            old = ans
        else:
            break
    print(int(old))


def sq(t, an):
    ans = 0
    for ai in an:
        ans += pow(ai - t, 2)
    return ans


if __name__ == "__main__":
    _main()


### FIXED CODE ###

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def std_in():
    return sys.stdin.readline().strip()


def _main():
    N = int(std_in())
    r = range(1, N + 1)
    print(sum(r))


if __name__ == "__main__":
    _main()
import numpy as np

H, W, K = input().split(' ')
H = int(H)
W = int(W)
K = int(K)
c = [list(str(input())) for i in range(H)]
cnp = np.array(c)

countAll = np.count_nonzero(cnp == '#')
countH = []
countW = []
for i in range(H):
    countH.append(np.count_nonzero(cnp[i] == '#'))
for i in range(W):
    countW.append(np.count_nonzero(cnp[:, i] == '#'))

ans = 0
for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        tmp = countAll
        tmp2 = []
        choiceH = format(i, '0' + str(H) + 'b')
        for m in range(len(choiceH)):
            if int(choiceH[m]):
                tmp -= countH[m]
                tmp2.append(m)
        choiceW = format(j, '0' + str(W) + 'b')
        for n in range(len(choiceW)):
            if int(choiceW[n]):
                tmp -= countW[n]
                for o in range(len(tmp2)):
                    if cnp[tmp2[o], n] == '#':
                        tmp += 1
        if tmp == K:
            ans += 1

print(ans)

### FIXED CODE ###

import numpy as np

H, W, K = input().split(' ')
H = int(H)
W = int(W)
K = int(K)
c = [list(str(input())) for i in range(H)]
cnp = np.array(c)

countAll = np.count_nonzero(cnp == '#')
countH = []
countW = []
for i in range(H):
    countH.append(np.count_nonzero(cnp[i] == '#'))
for i in range(W):
    countW.append(np.count_nonzero(cnp[:, i] == '#'))

ans = 0
for i in range(2 ** H - 1):
    for j in range(2 ** W - 1):
        tmp = countAll
        tmp2 = []
        choiceH = format(i, '0' + str(H) + 'b')
        for m in range(len(choiceH)):
            if int(choiceH[m]):
                tmp -= countH[m]
                tmp2.append(m)
        choiceW = format(j, '0' + str(W) + 'b')
        for n in range(len(choiceW)):
            if int(choiceW[n]):
                tmp -= countW[n]
                for o in range(len(tmp2)):
                    if cnp[tmp2[o], n] == '#':
                        tmp += 1
        if tmp == K:
            ans += 1

print(ans)
s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
elif s == 'Rainy'
  print('Sunny')

### FIXED CODE ###

s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
elif s == 'Rainy':
  print('Sunny')
n, k = map(int, input())
total = []
for _ in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    total.append(a)
ans = n - len(set(total))
print(ans)
  


### FIXED CODE ###

n, k = map(int, input().split())
total = []
for _ in range(k):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    total.append(a)
ans = n - len(set(total))
print(ans)