TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
from collections import defaultdict
import sys
import time

sys.setrecursionlimit(2000)
N, M, K = [int(i) for i in input().split(" ")]

class UnionNode():
    def __init__(self, number):
        self.number = number
        self.volume = 1
        self.master = None

    @property
    def rootnum(self):
        return self.root.number

    @property
    def root(self):
        if self.master:
            return self.master.root
        else:
            return self


    def same(self, target):
        if self.root == target.root:
            return True
        else:
            return False

    def unite(self, target):
        seroot = self.root
        taroot = target.root
        if seroot.number == taroot.number:
            pass
        else:
            #print(f"unite {target.rootnum}({target.root.volume}), {self.rootnum}({self.root.volume})")
            if seroot.number < taroot.number:
                seroot.volume += taroot.volume
                taroot.master = seroot
            else:
                taroot.volume += seroot.volume
                seroot.master = taroot

nodes = [UnionNode(i) for i in range(N)]

outlist = defaultdict(lambda :[])

for i in range(M):
    s = input()
    a, b = s.split(" ")
    a = int(a) - 1
    b = int(b) - 1
    nodes[a].unite(nodes[b])
    outlist[a].append(b)
    outlist[b].append(a)

for i in range(K):
    s = input()
    a, b = s.split(" ")
    a = int(a) - 1
    b = int(b) - 1
    outlist[a].append(b)
    outlist[b].append(a)

result = []
for i in range(N):
    node = nodes[i]
    ret = node.root.volume - 1
    for out in outlist[i]:
        if nodes[out].rootnum == node.rootnum:
            ret -=1
    result.append(ret)


#    print(result[i])

print(" ".join([str(i) for i in result]))


a = int(input()) + 1
print(int(a/2))

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n=int(input())

if n % 2 ==0:
    print(n/2)
else:
    print((n-1)/2+1)

n=int(input())

if n % 2 == 0:
    print(int(n/2))
else:
    print(int((n-1)/2+1))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
from sys import stdin

N = stdin.readline().rstrip()
print('Yes' if '7' in N else 'No')

from sys import stdin
N = int(stdin.readline().rstrip())
if N%2==1:
    print(N//2+1)
else:
    print(N//2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())
print n//2

import math
n = int(input())
print(math.ceil(n/2))	

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
a

import math
n = int(input())

print(math.ceil(n/2))

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
l=[]
for i in range(3):
    l.append(list(map(int, input().split())))
n = int(input())
for i in range(n):
    m = int(input())

    for j in range(3):
        for k in range(3):
            if l[j][k] == m:
                l[j][k] = -1
o=0
p=0
for j in range(3):
    for k in range(3):
        o+=l[j][k]
        p+=l[k][j]
    if o==-3 or p==-3:
        print('Yes')
        exit()
    o=0
    p=0
if l[0][0]+l[1][1]+l[2][2]==-3 or l[0][2]+l[1][1]+l[2][0]==-3:
    print('Yes')
else:
    print('No')

n = int(input()) // 2
print(n)

q, mod = divmod(int(input()), 2)
if mod == 1:
  q+=1
print(q)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
num=int(input())
if num % 2 == 0:
    ans=num/2
else:
    ans=math.floor(num//2)+1
print(int(ans))

num=int(input())
if num % 2 == 0:
    ans=num/2
else:
    ans=math.floor(num//2)+1
print(int(ans))

n = int(input())
print((n+1)//2)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]
ans = []
SC = sorted(SC)

for x, item in enumerate(SC):
    if len(ans) + 1 < item[0]:
        if len(ans) == 0:
            ans.append(1)
        for y in range(item[0] -len(ans) - 1):
            ans.append(0)
    if len(ans) + 1 == item[0]:
        ans.append(item[1])
    elif len(ans) == item[0]:
        continue

if len(ans) < N:
    for x in range(N - len(ans)):
        ans.append(0)

if ans(0) == 0 and len(ans) != 0:
    print(-1)
else:
    ans = map(str, ans)
    print("".join(ans))

N = int(input())

print(-(-N // 2))

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N = input()

if N % 2 == 0:
    print(N / 2)
else:
    print(N // 2 + 1)

N = int(input())

if N % 2 == 0:
    print(int(N / 2))
else:
    print(int(N // 2 + 1))

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.root = [-1]*n
    self.rank = [0]*n
    
  def find_root(self, e):
    if self.root[e] < 0:
      return e
    else:
      r = self.find_root(self.root[e])
      self.root[e] = r
      return r
    
  def combine(self, e1, e2):
    root1 = self.find_root(e1)
    root2 = self.find_root(e2)
    if root1 == root2:
      pass
    elif self.rank[root1] < self.rank[root2]:
      self.root[root1] += self.root[root2]
      self.root[root2] = root1
      self.rank[root1] = self.rank[root2] + 1
    elif self.rank[root2] < self.rank[root1]:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] = self.rank[root1] + 1
    else:
      self.root[root2] += self.root[root1]
      self.root[root1] = root2
      self.rank[root2] += 1
      
  def in_the_same_group(self, e1, e2):
      r1 = self.find_root(e1)
      r2 = self.find_root(e2)
      if r1 == r2:
        return True
      return False
  

NMK = input().split()
N = int(NMK[0])
M = int(NMK[1])
K = int(NMK[2])
uf = UnionFind(N)
from collections import defaultdict
friend_list = [0]*N
for _ in range(M):
  AB = input().split()
  A = int(AB[0])-1
  B = int(AB[1])-1
  uf.combine(A,B)
  friend_list[A] += 1
  friend_list[B] += 1

block_list = [0]*N
for _ in range(K):
  CD = input().split()
  C = int(CD[0])-1
  D = int(CD[1])-1
  if uf.in_the_same_group(C, D):
    block_list[C] += 1
    block_list[D] += 1

cnt = defaultdict(int)
ans = []
for i in range(N):
  cnt[i] = -uf.root[uf.find_root(i)] - 1 - friend_list[i] - block_list[i]
  ans.append(str(cnt[i]))

print(" ".join(ans))

N = int(input())

if N % 2 == 0:
  print(N//2)
else:
  print(N//2+1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N,M = map(int,input().split())
Output = [0] * N
num = ""

for i in range(M):
    s,c = map(int,input().split())
    if(Output[s-1]==0 or Output[s-1]>c):
        Output[s-1] = c
    if(c==0):
        print(-1)

if(Output[0]==0):
    print(-1)
else:
    for i in Output:
        if(i>9):
            print(-1)
        num += str(i)
    print(num)

N = int(input())

if N % 2 == 0:
    print(N//2)
else:
    print(N//2+1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())
if n%2 == 0:
    print(n/2)
else:
    print(int(2*n+1)/2)


n = int(input())
if n%2 == 0:
    print(int(n/2))
else:
    print(int((n+1)/2))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = N/2 + 0.5
  
print(ans)


N = int(input())
ans = 0
if(N%2 == 0):
  ans = N/2
else:
  ans = N/2 + 1
  
print(ans)

N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = math.floor(N/2) + 1
  
print(ans)


N = int(input())
ans = 0
if(N%2 == 0):
  ans = n/2
else:
  ans = n/2 + 1
print(ans)

N = int(input())
ans = 0

if(N%2 == 0):
  ans = N/2
else:
  ans = N/2 + 0.5
  
ans = int(ans)
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
def make_label(x, y, a, b, label, m):
    h = False
    g = []
    for i in range(m):
        if a[i] == x and label[b[i] - 1] == 0:
            label[b[i] - 1] = y
            g.append(b[i])
            h = True
        elif b[i] == x and label[a[i] - 1] == 0:
            label[a[i] - 1] = y
            h = True
            g.append(a[i])
        
    if h:
        for i in range(len(g)):
            return make_label(g[i], y, a, b, label, m)
    else:
        return label  
        


n, m, k = map(int, input().split())
a = [0] * m
b = [0] * m
c = [0] * k
d = [0] * k

label = [0] * n
kosu_label = 1

friend = [0] * n
block = [0] * n

ans = [0] * n

for i in range(m):
    a[i], b[i] = map(int, input().split())
    
for i in range(k):
    c[i], d[i] = map(int, input().split())
    
for i in range(n):
    if label[i] == 0:
        label[i] = kosu_label
        label = make_label(i + 1, kosu_label, a, b, label, m)
        kosu_label = kosu_label + 1

label_s = [0] * kosu_label

for i in range(n):
    label_s[label[i]] = label_s[label[i]] + 1
    
for i in range(n):
    for j in range(m):
        if a[j] == i + 1 or b[j] == i + 1:
            friend[i] = friend[i] + 1
    for w in range(k):
        if (c[w] == i + 1 or d[w] == i + 1) and label[c[w] - 1] == label[d[w] - 1]:
            block[i] = block[i] + 1
    ans[i] = label_s[label[i]] - friend[i] - block[i] - 1

for i in range(n):
    print(ans[i], end = '')

N = int(input())

if N % 2 == 0:
  print(N // 2)
else:
  print(N // 2 + 1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
1<= N and N<=100

N = input()
if N%2 ==0:
  n = N/2
else:
  n = N/2+1
  
print(int(n))

N = input()
N =int(N)

if 1<= N and N<=100:
    if N%2 ==0:
        n = N/2
    else:
        n = N/2+1
  
print(int(n))

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())
print(n/2 if n % 2 == 0 else (n+1)/2)

n = int(input())
print(n//2 if n % 2 == 0 else (n+1)//2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
import math
n = int(input())
print(math.floor(n/2))

import math
n  int(input())
print(math.ceil(n/2))

import math
n = int(input())
print(math.ceil(n/2))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
import math
n = int(input())
math.ceil(n/2)

import math
math.ceil(n/2)

n = int(input())
import math
print(math.ceil(n/2))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N=int(input())
if N%2==0:
  print(N/2)
else:
  print(N+1/2)

N=int(input())
if N%2==0:
  print(N//2)
else:
  print((N+1)//2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input().strip())
print(n+1//2)

n = int(input().strip())
print((n+1)//2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N = int(input())

print(N//2)

from math import ceil
N = int(input())
print(ceil(N/2))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
input = int(input("Enter N number: "))
if input >= 1 and input <= 100:
    result = input - input // 2
    print(result)
else:
    print('Invalid input')


input = int(input())
if input % 2 == 0:
    result = input / 2
    print(int(result))
else:
    result = (input / 2) + 1
    print(int(result))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
a = int(input())
if a % 2:
  b = (a + 1) / 2
else:
  b = a / 2
print(b)

a = int(input())
if a % 2:
  b = (a + 1) / 2
else:
  b = a / 2
print(int(b))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())

if n % 2 == 0:
  print(n/2)
else:
  print(n/2+1)


n = int(input())

if n % 2 == 0:
  a = n // 2
  
else:
  a = n // 2 + 1
  
print(a)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
import sys
n = int(sys.stdin.readline())
rem = n%2
return n/2 + 1

import sys
n = int(sys.stdin.readline())
rem = n%2
print(n/2 + rem)


import sys

n = int(sys.stdin.readline())
rem = n%2
print(n//2 + rem)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
num = int(input())
print(round(num/2))

num = int(input())
if 1 == num%2:
    print(round((num+1)/2))
else:
    print(round(num/2))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())
if n % 2 == 0:
    print(n//2)
else:
    print(n//2)+1

n = int(input())
if n % 2 == 0:
    print(n//2)
else:
    print(n//2+1)

Verdicts: Runtime Error

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n=int(input())
print(int((n+0.5)/2))

n=int(input())
print(int(n/2))

import math
n=int(input())
print(int(math.ceil(n/2)))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n = int(input())
print(n // 2 + n % 1)

n = int(input())
print(n // 2 + (n % 2))


Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
a=int(input())
print((a+1)/2)

a=int(input())
print((a+1)//2)

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
N=int(input())
if N % 2==0:
    print(N/2)
else:
    print(N/2+0.5)

N=int(input())
if N % 2==0:
    print(int(N/2))
else:
    print(int(N/2+0.5))

Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
#N=int(input())
pages=N // 2
if N % 2==0:
  	pass
  else:
    pages=pages+1
print(pages)

N=int(input())
pages=N // 2
if N%2==0:
  else:
    pages=pages+1
print(pages)

N=int(input())
pages=N // 2
if N % 2==0:
  else:
    pages=pages+1
print(pages)

N=int(input())
pages=N // 2
if N % 2==0:
  	pass
  else:
    pages=pages+1
print(pages)

N=int(input())
pages=N // 2
if N % 2==0:
  	else:
    	pages=pages+1
print(pages)

pages=N // 2
print(pages)

N=int(input())
pages=N // 2
print(pages)

N=int(input())
pages=N // 2
if N % 2==0:
        pass
else:
    pages=pages+1
print(pages)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
page = int(input())

if page % 2 == 0:
  print(page/2)
else:
  print(page/2 + 1)

N = int(input())
print(N//2 + N%2)


Verdicts: Wrong Answer

Accepted
Problem: Takahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.  At least how many sheets of paper does he need?

Submission attempts (in order):
n=int(input())
print(n//2)

n=int(input())
print(n/2)

n=int(input())
print(n//2) if n%2==0 else print(n//2+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = int(input())
X = list(map(int, input().split(' ')))

s = 0
for xi in X:
    s += xi
si = round(s / N)
ps = 0
for xi in X:
    ps += int(math.pow(xi-si, 2))
print(ps)

import math
N = int(input())
X = list(map(int, input().split(' ')))

s = 0
for xi in X:
    s += xi
si = round(s / N)
ps = 0
for xi in X:
    ps += int(math.pow(xi-si, 2))
print(ps)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
import math
N = int(input())
x = list(map(int, input().split()))

s = float(x[0])
for i in range(N-1):
	s = (s + x[i+1]) / 2

min = math.floor(s)

print(min)

import math
N = int(input())
x = list(map(int, input().split()))
 
s = float((x[0] + x[1])/2)
for i in range(2,N-1):
	s = (s + x[i]) / 2
 
min = math.floor(s)
 
print(min)

import math
N = int(input())
x = list(map(int, input().split()))

s = float(x[0])
for i in range(N-1):
	t = (s + x[i+1]) / 2

min = math.floor(t)

print(min)

import math
N = int(input())
x = list(map(int, input().split()))
 
t = 0
min = 0

for i in range(0,N-1):
     t += x[i]/N

s = math.floor(t)
print(s)
for i in range(0,N-1):
    min += (x[i] - s) **2

print(min)

N = int(input())
x = list(map(int, input().split()))
 
t = 0
min = 0

for i in range(0,N):
     t += x[i]/N

s = round(t)
for i in range(0,N):
    min += (x[i] - s) **2

print(min)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = input()
X = list( map(int, input().split()))
X.sort()

min_a = X[0]
max_a = X[-1]
mid = (min + max) // 2

sum_min = 0
sum_max = 0
    
def calc(x, min, max):
    mid = (min + max) // 2
    sum_min = 0
    sum_max = 0
    for value in x:
        sum_min += (value - min) ** 2
        sum_max += (value - max) ** 2
    
    if abs(min - max) <= 1:
        if sum_min < sum_max:
            return int(sum_min)
        else:
            return int(sum_max)
    elif sum_min < sum_max:
        return calc(x, min, mid)
    else:
        return calc(x, mid, max)
    
    return -1
    
ans = calc(X, min_a, max_a)
print(ans)

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

min_a = X[0]
max_a = X[-1]

sum_min = 0
sum_max = 0
    
def calc(x, min, max):
    mid = (min + max) // 2
    sum_min = 0
    sum_max = 0
    for value in x:
        sum_min += (value - min) ** 2
        sum_max += (value - max) ** 2
    
    if abs(min - max) <= 1:
        if sum_min < sum_max:
            return int(sum_min)
        else:
            return int(sum_max)
    elif sum_min < sum_max:
        return calc(x, min, mid)
    else:
        return calc(x, mid, max)
    
    return -1
    
ans = calc(X, min_a, max_a)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = int(iput())
X = list(map(int,input().split()))
Ans = 0
M = Rn (sum(X)/N)
for i in X:
  Ans +=(i-M)**2
print(Ans)

N = int(input())
X = list(map(int,input().split()))
Ans = 0
M = round(sum(X)/N)
for i in X:
    Ans +=(i-M)**2
print(Ans)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
num = [int(n) for n in input().split()] 
    
s = sum(num[1:num[0]+1])/num[0]
s = round(s)
r = 0
for i in range(1,num[0]+1):
    r += pow(num[i]-s,2)
print(r)

import numpy as np
import decimal as dec

num = [int(n) for n in input().split()] 
    
s = sum(num[1:num[0]+1])/num[0]
s = round(s)
r = 0
for i in range(1,num[0]+1):
    r += pow(num[i]-s,2)
print(r)

import sys

num = []

while True:
    try:
        num.extend([int(n) for n in input().split()])
    except EOFError:
        break
    
s = sum(num[1:num[0]+1])/num[0]
s = round(s)
r = 0
for i in range(1,num[0]+1):
    r += pow(num[i]-s,2)
print(r)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
M = 10**9 + 7
n, a, b = map(int, input().split())
r = (pow(2, n, M) - 1) % M
f = c = 1
for i in range(b):
  f = f * (i + 1) % M
  c = c * (n - i) % M
  if i + 1 == a:
    r = (r - c * pow(f, M - 2, M)) % M
print((r - c * pow(f, M - 2, M) % M))


M = 10**9 + 7
n, a, b = map(int, input().split())
r = (pow(2, n, M) - 1) % M
f = c = 1
for i in range(b):
  f = f * (i + 1) % M
  c = c * (n - i) % M
  if i + 1 == a:
    r = (r - c * pow(f, M - 2, M)) % M
print((r - c * pow(f, M - 2, M) % M)


input()
a = list(map(int, input().split()))
print(min(sum((x - p)**2 for x in a) for p in range(1, 101)))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    a = list((x[n]-n)**2) 

print(sum(a))

n = int(input())
x = list(map(int, input().split()))
p = round(sum(x) / len(x))
a = 0

for i in range(n):
    a += ((x[i]-p)**2)
print((a))

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N=int(input())
people=[]
cost=[]

for i in range(N):
  people.append(int(input())
                
for p in range(len(people)):
  cost.append(0)
  for person in people:
    cost[-1]+=(person-p)**2
                
print(min(cost))

N=int(input())
people=[]
cost=[]
 
people=list(map(int,input().split()))

for p in range(101):
    cost.append(0)
    for person in people:
      cost[-1]+=(person-(p+1))**2

print(min(cost))

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
X = list(int(x)for x in input().split())
ams = []
for p in range(min(X),max(X)):
  total = 0
  for x in X:
    total += (x-p)**2
  ans.append(total)
print(min(ans))

n = int(input())
X = list(int(x)for x in input().split())
ans = []
for p in range(min(X),max(X)+1):
  total = 0 
  for x in X:
    total += (x-p)**2
  ans.append(total)
print(min(ans))

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n=int(input())
x=list(map(int,input().split()))
x.sort()
min = 10**10
su=0
print(x)
print(x[0],x[n-1])
for j in range(x[0],x[n-1]):
    for i in x:
        su=(i-j)**2+su
    
    if min>su:
        min=su
    su = 0
print(min)
        

n=int(input())
x=list(map(int,input().split()))
x.sort()
min = 10**15
su=0
for j in range(x[0],x[n-1]):
    for i in x:
        su=(i-j)**2+su  
    if min>su:
        min=su
    su = 0
if min==10**15:
    print(0)
else:
    print(min)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N=int(input())
X=list(map(int,input().split()))
c=0
d=sum(X)/N
for i in X:
   c+=(i-d)**2
print(c)

N=int(input())
X=list(map(int,input().split()))
c=0
d=round(sum(X)/N)
for i in X:
   c+=(i-d)**2
print(c)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(l, r):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)
    print(cost)

print(min(costs))



n = int(input())

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

l = min(xs)
r = max(xs)

costs = []
for i in range(l-1, r+1):
    cost = 0
    for j in xs:
        cost += (j - i) * (j - i)
    costs.append(cost)

print(min(costs))



Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = list(map(int,input().split()))
S = sum(x)
Ave = sum(x) // n
m = 10**6
score = 0
count = 0

for p in range(Ave-100,Ave+101): 
    for i in range(n):
        score += (x[i]-p)**2
    if score < m:
        m = score
        score = 0
print(m,p)


n = int(input())
x = list(map(int,input().split()))
Ave = sum(x) / n
point = 0


for i in range(n):
    point += (x[i]-round(Ave))**2 
print(point)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
xs = [int(elem) for elem in input().split()]

min_ = min(xs)
max_ = max(xs)
result = []
for p in range(min_, max_+1):
  print(p)
  res = 0
  for x in xs:
    res += (x - p) ** 2
  result.append(res)
print(min(result))

n = int(input())
xs = [int(elem) for elem in input().split()]
 
min_ = min(xs)
max_ = max(xs)
result = []
for p in range(min_, max_+1):
  res = 0
  for x in xs:
    res += (x - p) ** 2
  result.append(res)
print(min(result))

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = list(map(int, input().split()))
s = sum(x)
p = (s+n-1)/n
r = 0
for y in x:
    r += (y - p)**2
print(r)

n = int(input())
x = list(map(int, input().split()))
s = sum(x)
p = (s+0.5*n)//n
r = 0
for y in x:
    r += (y - p)**2
print(int(r))

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
from sys import stdin
n = int(stdin.readline().rstrip())
data = list(map(int, stdin.readline().rstrip().split()))
Sum = sum(data)
a = Sum / n

print(a)

from sys import stdin
n = int(stdin.readline().rstrip())
data = list(map(int, stdin.readline().rstrip().split()))
p = sum(data) / n
 
Sum = 0
for i in data:
	Sum  += (i - p) ** 2 
print(Sum)

from sys import stdin
from decimal import Decimal, ROUND_HALF_UP

n = int(stdin.readline().rstrip())
data = list(map(int, stdin.readline().rstrip().split()))
p = sum(data) / n

#p should be int
p_int = (Decimal(p).quantize(Decimal('1'), ROUND_HALF_UP))

Sum = 0
for i in data:
	Sum  += (i - p_int) ** 2 
print(Sum)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
import numpy as np

N = int(input())
X = np.array(list(map(int, input().split())))
best_score = None
for i in range(np.min(X), np.max(X)+1):
    score = np.sum(np.power(X - i, 2))
    if best_score is None:
        best_score = score
    elif best_score > score:
        best_score = score

import numpy as np

N = int(input())
X = np.array(list(map(int, input().split())))
best_score = None
for i in range(np.min(X), np.max(X)+1):
    score = np.sum(np.power(X - i, 2))
    if best_score is None:
        best_score = score
    elif best_score > score:
        best_score = score
print(best_score)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = list(map(int, input().split()))
for p in range(1, n+1):
    cnt = 0
    for i in x:
        cnt += (i-p)**2
    ans = min(ans, cnt)
print(ans)

n = int(input())
x = list(map(int, input().split()))
ans1 = 0
ans2 = 0
xa = sum(x) // n
for i in x:
    ans1 += (abs(i-xa))**2

for i in x:
    ans2 += (abs(i-xa-1))**2

print(min(ans1, ans2))


Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = int(input())
Xs = list(map(int,input().split()))
ans = 0
ansCandidate = 0
for j in range(min(Xs),max(Xs)):
    ansCandidate = 0
    for i in range(N):
        ansCandidate += (Xs[i] - j)**2
    print(ansCandidate)
    if j == min(Xs):
        ans = ansCandidate
    ans = min(ans,ansCandidate)
print(ans)


N = int(input())
Xs = list(map(int,input().split()))
ans = 0
ansCandidate = 0
for j in range(min(Xs),max(Xs)):
    ansCandidate = 0
    for i in range(N):
        ansCandidate += (Xs[i] - j)**2
    if j == min(Xs):
        ans = ansCandidate
    ans = min(ans,ansCandidate)
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = int(input())
X = list(map(int, input().split()))

ans = float("inf")

i = 1
while i < max(X):
    cnt = 0
    if i not in X:
        for j in range(N):
            cnt += abs(i-X[j])**2

        if isinstance(i, int):
            ans = min(ans, cnt)

    i += 1

print(i)
print(ans)


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

ans = float("inf")

for i in range(1, 100):
    cnt = 0
    for j in X:
        cnt += (i-j)**2

    ans = min(cnt, ans)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = input()
for i in N:
	A = [int(i) for i in input().split()]
P=round(sum(A)/N)
B=0
for i in N:
	B=B+(A[i]-P)**2
print(B)


N = int(input())
A = list(map(int, input().split())) 
P=round(sum(A)/N)
B=0
for i in range(N):
    B=B+(A[i]-P)**2
print(B)



Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = input().split(" ")
x = [int(i) for i in x]
answer = 0
for index,i in enumerate(x):
    answer += pow((i - index), 2)
print(answer)

n = int(input())
x = list(map(int, input().split()))
m = round(sum(x)/n)
answer = 0
for i in x:
    answer += (i-m)**2
print(answer)

n = int(input())
x = list(map(int, input().split()))
m = round(sum(x)/n)
answer = 0
for i in x:
    answer += (i-m)**2
print(answer)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N=int(input())
X=list(map(int,input().split()))
ans=10**9

for i in range(1,101):
  temp=0
  for j in range(N):
    temp+=(X[i]-j)**2
  else:
    ans=min(ans,temp)
print(ans)

N=int(input())
X=list(map(int,input().split()))
ans=10**9
 
for i in range(1,101):
  temp=0
  for j in range(N):
    temp+=(X[j]-i)**2
  else:
    ans=min(ans,temp)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N,*X=map(int,open(0).read().split());print(sum(map(lambda x:(round(sum(X)/N,0)-x)**2,X)))

N,*X=map(int,open(0).read().split());print(sum(map(lambda x:(round(sum(X)/N)-x)**2,X)))

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n=input()
Xs=list(map(int,input().split()))
Xs.sort()
a=Xs[0]
b=Xs[-1]
ans=inf
for p in range(a,b+1):
    m=0
    for x in Xs:
        m+=(x-p)**2
    if m<ans:
        ans=m
print(ans)


n=int(input())
Xs=list(map(int,input().split()))
Xs.sort()
a=Xs[0]
b=Xs[-1]
ans=float("inf")
for p in range(a,b+1):
    m=0
    for x in Xs:
        m+=(x-p)**2
    if m<ans:
        ans=m
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
# -*- coding: utf-8 -*-
n = int(input())
x = list(map(int, input().split()))

left = min(x)
right = max(x)

min_cost = 100000000000000
min_pos=-1

for i in range(left,right+1):
  cost=0
  for j in range(n):
    cost = cost + (x[j]-i)*(x[j]-i)
  if min_cost>cost:
    min_cost=cost
    min_pos=i

print(min_pos)

# -*- coding: utf-8 -*-
n = int(input())
x = list(map(int, input().split()))

left = min(x)
right = max(x)

min_cost = 100000000000000
min_pos=-1

for i in range(left,right+1):
  cost=0
  for j in range(n):
    cost = cost + (x[j]-i)*(x[j]-i)
  if min_cost>cost:
    min_cost=cost
    min_pos=i

print(min_cost)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
N = int(input())
cc = list(map(int,input().split()))
count = 0
min_sum = float('inf')
for i in range(1,101):
  for j in cc:
    count += (i-j)**2
  min_sum = min(min_sum,count)
print(min_sum)
    
  

N = int(input())
cc = list(map(int,input().split()))
min_sum = float('inf')
for i in range(1,101):
  count = 0
  for j in cc:
    count += (i-j)**2
  min_sum = min(min_sum,count)
print(min_sum)

Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
def calc(a):
    y = 0
    for xx in x:
        y += (a - xx) ** 2
    return y


n = int(input())
x = [int(i) for i in input().split()]
left = min(x)
right = max(x)
while (right - left > 1):
    l = calc(left)
    r = calc(right)
    if (l < r):
        right = (right + left) // 2
    else:
        left = (right + left) // 2
print(r)

def calc(a):
    y = 0
    for xx in x:
        y += (a - xx) ** 2
    return y


n = int(input())
x = [int(i) for i in input().split()]
left = min(x)
right = max(x)
while (right - left > 1):
    l = calc(left)
    r = calc(right)
    if (l < r):
        right = (right + left) // 2
    else:
        left = (right + left) // 2
print(min(calc(left), calc(right)))

Verdicts: Runtime Error

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n = int(input())
x = list(map(int, input().split()))

min_p = (1 / n) * sum(x)

stamina = sum((x[i] - min_p) ** 2 for i in range(n))

print(stamina)


def main():

    n = int(input())
    x = list(map(int, input().split()))
    min_p = round((1 / n) * sum(x))
    stamina = sum((x[i] - min_p) ** 2 for i in range(n))
    print(stamina)

main()


Verdicts: Wrong Answer

Accepted
Problem: There are N people living on a number line.  The i-th person lives at coordinate X_i.  You are going to hold a meeting that all N people have to attend.  The meeting can be held at any **integer coordinate**. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.  Find the minimum total points of stamina the N people have to spend.

Submission attempts (in order):
n=int(input())
x=list(map(int,input().split()))
res=10**6
for i in range(1,101):
  tmp = sum([(i-y)**2 for y in x])
  if res > tmp:
    res = tmp


n=int(input())
x=list(map(int,input().split()))
res=10**6
for i in range(1,101):
  tmp = sum([(i-y)**2 for y in x])
  if res > tmp:
    res = tmp
print(res)

Verdicts: Wrong Answer

Accepted