Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

a = [input().split() for i in range(m)]

s = []
c = []

for i in range(m):
    s.append(a[i][0])
    c.append(a[i][1])

S = [int(i) for i in s]
C = [int(i) for i in c]

x = 0
z = 0

for i in range(m):
    x += C[i] * (10 ** (n-S[i]))
    for k in range(m):
        if n >= 2 and S[i] == 1 and C[i] == 0:
            z += 1
            break
        if S[i] == S[k] and C[i] != C[k]:
            z += 1
            break
        if S[i] == S[k] and C[i] == C[k] and i > k:
            x -= C[i] * (10 ** (n-S[i]))
            break

if z == 0:
    if '1' in S or m == 0:
        print(x)
    else:
        print(x+10**(n-1))

else:
    print('-1')

Fixed submission:
n = int(input())

print((n + 1) // 2)
Buggy python submission (verdict: Runtime Error):
n, k, m = map(int, input().split())
a = list(map(int, input().split()))

if n * m - sum(a) <= 0:
    print(0)

elif n * m - sum(a) > k:
    print('-1')
    
else:
    print(n * m - sum(a))

Fixed submission:
alp = input()
asc = ord(alp)
print(chr(asc + 1))

Buggy python submission (verdict: Runtime Error):
n, k, m = map(int, input().split())
a = map(int, input().split())

if m * n - sum(a) <= 0:
    print(0)

elif 0 < m * n - sum(a) <= k:
    print(m * n - sum(a))
    
else:
    print('-1')

Fixed submission:
alp = input()
asc = ord(alp)
print(chr(asc + 1))
Buggy python submission (verdict: Runtime Error):
A = list((int(input().split())))
 
if sum(A) > 21:
  print('bust')
else:
  print('win')

Fixed submission:
a = input()
b = a.split()

if int(b[0]) + int(b[1]) + int(b[2]) >= 22:
    print('bust')
    
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
 = input()
b = a.split()

if int(b[0]) + int(b[1]) + int(b[2]) >= 22:
    print("bust")
    
else:
    print("win")

Fixed submission:
a = input()
b = a.split()

if int(b[0]) + int(b[1]) + int(b[2]) >= 22:
    print('bust')
    
else:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ans = 0
for a in range(1, n):
    for b in range(1, n //a + 1):
        if a * b < n:
            ans += 1

print(ans)

Fixed submission:
n = int(input())

ans = 0
for a in range(1, n):
    for b in range(1, n //a + 1):
        if a * b < n:
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = input().split()
A = list(map(int, A))

d = 10**9 + 7

ans = 0
for i in range(len(A) - 1):
    ans += A[i] * (sum(A[i+1:]))
print(ans % d)

Fixed submission:
n = int(input())
A = input().split()
A = [int(t) for t in A]

d = 10**9 + 7
s = sum(A)
ans = 0
for i in range(len(A) - 1):
    s = s - A[i]
    ans += A[i] * (s)

print(ans % d)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = input().split()
A = [int(t) for t in A]

d = 10**9 + 7

ans = 0
for i in range(len(A) - 1):
    ans += A[i] * (sum(A[i+1:]))
print(ans % d)

Fixed submission:
n = int(input())
A = input().split()
A = [int(t) for t in A]

d = 10**9 + 7
s = sum(A)
ans = 0
for i in range(len(A) - 1):
    s = s - A[i]
    ans += A[i] * (s)

print(ans % d)
Buggy python submission (verdict: Runtime Error):
g = a - 1
d, r = divmod(b - 1, g)
if r == 0:
    print(d)
else:
    print(d + 1)

Fixed submission:
a, b = map(int, input().split())

g = a - 1
d, r = divmod(b - 1, g)
if r == 0:
    print(d)
else:
    print(d + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
xn = list(map(int, input().split()))
for i in range(len(xn)):
    tmp = xn.copy()
    tmp.pop(i)
    tmp.sort()
    print(tmp[int((int(n) - 1) / 2)])

Fixed submission:
n = int(input())
xn = list(map(int, input().split()))
xn_s = sorted(xn)
m1 = xn_s[n//2 - 1]
m2 = xn_s[n//2]
for x in xn:
    if x <= m1:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

r = [t for t in range(a, b + 1)]
r = r[:k] + r[-k:]
r = list(set(r))
r = sorted(r)

for _r in r:
    print(_r)

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

r = range(a, b + 1)
r = list(set(r[:k]) | set(r[-k:]))
r.sort()

for _r in r:
    print(_r)
Buggy python submission (verdict: Runtime Error):
s = input()
r = set(map(chr, range(97, 97+26)))
r = r - set(s)
r = min(r)
print(r)

Fixed submission:
s = input()
r = set(map(chr, range(97, 97+26)))
r = r - set(s)
if len(r) == 0:
    print('None')
else:
    r = min(r)
    print(r)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
x = 1
for i in range(n):
    #print(a[i])
    x = x*a[i]
if x>1000000000000000000:
    print(-1)
else:
    print(x)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
x = 1
f = 0
a.sort()
for i in range(n):
    #print(a[i])
    x = x*a[i]
    if x == 0:
        print(0)
        f = 1
        break
    elif x > 1000000000000000000:
        print(-1)
        f = 1
        break
if f == 0:
    print(x)
Buggy python submission (verdict: Runtime Error):
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define F first
#define S second
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())
#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;
ll vis[N],res[N];

int solve() 
{
	//happy coding

	 ll n;cin>>n;
	 string s; cin>>s;
	 ll idx = find(all(s),'.') - s.begin();
	 ll a = stoi(s.substr(0,idx));
	 ll b = stoi(s.substr(idx+1));
	 ll mn = a*100+b;
	 cout<<(mn*n)/100<<endl;
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}



Fixed submission:
a,b = input().split()
a = int(a);
b = list(b.split("."))
b = int(b[0])*100+int(b[1])
print(a*b//100)
Buggy python submission (verdict: Runtime Error):
N,M = list(map(int,input().split()))
MAX = 1000000000
S = []
Room = [MAX for i in range(N)]#2 - N
Room[0] = 0
ACCESS = [0 for i in range(N-1)]
for _ in range(M):
    a,b = list(map(int,input().split()))
    S.append([a,b])
    S.append([b,a])
for i in S:
    if i[0] == 1:
        Room[i[1]-1] = 1
        ACCESS[i[1]-2] = 1
        S.remove(i)
depth = 1
while max(Room) > MAX/2:
    for i in range(len(Room)):
        if Room[i] ==depth:
            k = 0
            for _ in range(len(S)):
                j = S[k]
                if (j[0] == i+1)*(Room[j[1]-1]>MAX/2):
                    Room[j[1]-1] = depth+1
                    ACCESS[j[1]-2] = i+1
                    S.remove(j)
                    S.remove(j[::-1])
                    k -= 1
                k += 1
    depth += 1
print('Yes')
for i in ACCESS:
    print(i)

Fixed submission:
N,M = list(map(int,input().split()))
MAX = 1000000000
import queue
dist = [MAX for i in range(N)]
pre = [-1 for i in range(N)]
To = [[] for i in range(N)]#indexに向かっている部屋番号の集合

que = queue.Queue()

for _ in range(M):
    a,b = list(map(int,input().split()))
    a -= 1
    b -= 1
    To[a].append(b)
    To[b].append(a)
dist[0] = 0
que.put(0)
while(not que.empty()):
    v = que.get()
    for u in To[v]:
        if pre[u] != -1: continue
        dist[u] = dist[v] + 1
        que.put(u)
        pre[u] = v
        
        
print('Yes')
for i in pre[1:N]:
    print(i+1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
MAX = 1000000000
S = []
Room = [MAX for i in range(N)]#2 - N
Room[0] = 0
ACCESS = [0 for i in range(N-1)]
for _ in range(M):
    a,b = list(map(int,input().split()))
    S.append([a,b])
    S.append([b,a])
for i in S:
    if i[0] == 1:
        Room[i[1]-1] = 1
        ACCESS[i[1]-2] = 1
        #S.remove(i)
depth = 1
while max(Room) > MAX/2:
    for i in range(len(Room)):
        if Room[i] ==depth:
            for j in S:
                if (j[0] == i+1)*(Room[j[1]-1]>MAX/2):
                    Room[j[1]-1] = depth+1
                    ACCESS[j[1]-2] = i+1
    depth += 1
print('Yes')
for i in ACCESS:
    print(i)

Fixed submission:
N,M = list(map(int,input().split()))
MAX = 1000000000
import queue
dist = [MAX for i in range(N)]
pre = [-1 for i in range(N)]
To = [[] for i in range(N)]#indexに向かっている部屋番号の集合

que = queue.Queue()

for _ in range(M):
    a,b = list(map(int,input().split()))
    a -= 1
    b -= 1
    To[a].append(b)
    To[b].append(a)
dist[0] = 0
que.put(0)
while(not que.empty()):
    v = que.get()
    for u in To[v]:
        if pre[u] != -1: continue
        dist[u] = dist[v] + 1
        que.put(u)
        pre[u] = v
        
        
print('Yes')
for i in pre[1:N]:
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
def readinput():
    n,k=map(int,input().split())
    lr=[]
    for _ in range(k):
        l,r=map(int,input().split())
        lr.append((l,r))
    return n,k,lr

def main(n,k,lr):
    lrs=sorted(lr,key=lambda x:x[0])
    MOD=998244353
    dp=[0]*(n+1)
    dp[1]=1
    for i in range(1,n):
        #print(i)
        if dp[i]==0:
            continue
        skip=False
        for l,r in lrs:
            for j in range(l,r+1):
                #print('i+j: {}'.format(i+j))
                if i+j>n:
                    skip=True
                    break
                dp[i+j]=(dp[i+j]+dp[i])%MOD
                #print(dp)
            if skip:
                break
    return dp[n]

if __name__=='__main__':
    n,k,lr=readinput()
    ans=main(n,k,lr)
    print(ans)


Fixed submission:
def readinput():
    n,k=map(int,input().split())
    lr=[]
    for _ in range(k):
        l,r=map(int,input().split())
        lr.append((l,r))
    return n,k,lr

def main(n,k,lr):
    lrs=sorted(lr,key=lambda x:x[0])
    MOD=998244353
    dp=[0]*(n+1)
    dp[1]=1
    for i in range(1,n):
        #print(i)
        if dp[i]==0:
            continue
        skip=False
        for l,r in lrs:
            for j in range(l,r+1):
                #print('i+j: {}'.format(i+j))
                if i+j>n:
                    skip=True
                    break
                dp[i+j]=(dp[i+j]+dp[i])%MOD
                #print(dp)
            if skip:
                break
    return dp[n]

def main2(n,k,lr):
    lrs=sorted(lr,key=lambda x:x[0])
    MOD=998244353
    dp=[0]*(n+1)
    ruiseki=[0]*(n+1)
    dp[1]=1
    ruiseki[1]=1
    for i in range(2,n+1):
        for l,r in lrs:
            if i-l<1:
                break
            dp[i]+=ruiseki[i-l]-ruiseki[max(1,i-r)-1]
        dp[i]=dp[i]%MOD
        ruiseki[i]=(ruiseki[i-1]+dp[i])%MOD
    return dp[n]

if __name__=='__main__':
    n,k,lr=readinput()
    ans=main2(n,k,lr)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def readinput():
    n=int(input())
    return n

def main(n):
    sum=0
    while(n>0):
        sum+=n%10
        n=n//10
    if sum%9==0:
        return 'Yes'
    else:
        return 'No'

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)


Fixed submission:
def readinput():
    n=input()
    return n

def main(n):
    sum=0
    j=len(n)-1
    while(j>=0):
        sum+=int(n[j])
        j-=1
    if sum%9==0:
        return 'Yes'
    else:
        return 'No'

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt

def readinput():
    n=int(input())
    return n

def main(n):
    f=[0]*n
    for i in range(1,n+1):
        sqrt2n=int(sqrt(2*i))+1
        #print(i,sqrt2n)
        for x in range(1,sqrt2n):
            for y in range(1,sqrt2n-x+1):
                if (x+y)**2>2*i:
                    break
                for z in range(1,sqrt2n-x+1):
                    v=(x+y)**2+(y+z)**2+(z+x)**2
                    if v>2*i:
                        break
                    #print(v)
                    if v==2*i:
                        f[i-1]+=1
                        #print('found')
                        #print(x,y,z,i)
    return f

if __name__=='__main__':
    n=readinput()
    ans=main(n)
    for f in ans:
        print(f)


Fixed submission:
from math import sqrt

def readinput():
    n=int(input())
    return n

def main(n):
    f=[0]*n
    for i in range(1,n+1):
        sqrt2n=int(sqrt(2*i))+1
        #print(i,sqrt2n)
        for x in range(1,sqrt2n):
            for y in range(1,sqrt2n-x+1):
                if (x+y)**2>2*i:
                    break
                for z in range(1,sqrt2n-x+1):
                    v=(x+y)**2+(y+z)**2+(z+x)**2
                    if v>2*i:
                        break
                    #print(v)
                    if v==2*i:
                        f[i-1]+=1
                        #print('found')
                        #print(x,y,z,i)
    return f

def F(x,y,z):
    return ((x+y)**2+(y+z)**2+(z+x)**2)//2

def main2(n):
    sqrt2n=int(sqrt(2*n))+1
    cntbl=[0]*(10**4+1)
    for x in range(1,sqrt2n):
        for y in range(1,sqrt2n):
            for z in range(1,sqrt2n):
                v=F(x,y,z)
                if v>n:
                    break
                cntbl[v]+=1
    return cntbl


if __name__=='__main__':
    n=readinput()
    ans=main2(n)
    for i in range(1,n+1):
        print(ans[i])
Buggy python submission (verdict: Runtime Error):
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    maxa=2*10**5
    isprime=[True]*(maxa+1)
    sa=sorted(a)

    prevx=0
    for x in sa:
        if isprime[x]==False:
            continue
        if prevx==x:
            isprime[x]=False
            continue

        i=x*2
        while(i<=maxa):
            isprime[i]=False
            i+=x
        prevx=x
    
    count=0
    for x in sa:
        if isprime[x]==True:
            count+=1
    return count

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)


Fixed submission:
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    maxa=10**6
    isprime=[True]*(maxa+1)
    sa=sorted(a)

    prevx=0
    for x in sa:
        if isprime[x]==False:
            continue
        if prevx==x:
            isprime[x]=False
            continue

        i=x*2
        while(i<=maxa):
            isprime[i]=False
            i+=x
        prevx=x
    
    count=0
    for x in sa:
        if isprime[x]==True:
            count+=1
    return count

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)
Buggy python submission (verdict: Runtime Error):
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    if(a.count(0)!=0):
        return 0
        
    res=a[0]
    for i in range(1,n):
        res*=a[i]
        if res>INFTY:
            return -1
    return res

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)

Fixed submission:
INFTY=10**18

def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    if(a.count(0)!=0):
        return 0
        
    res=a[0]
    for i in range(1,n):
        res*=a[i]
        if res>INFTY:
            return -1
    return res

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def readinput():
    n=int(input())
    s=input()
    s=' '+s
    return n,s

def main(n,s):
    count=0
    all=set(['R','G','B'])
    for i in range(1, n-1):
        l1=s[i]
        for j in range(i+1, n):
            l2=s[j]
            if l1==l2:
                continue
            l3=(all - set([l1,l2])).pop()
            ij=j-i
            sub1=s[j+1:j+ij]
            sub2=s[j+ij+1:]
            count+=sub1.count(l3)
            count+=sub2.count(l3)
    return count

if __name__=='__main__':
    n,s=readinput()
    ans=main(n,s)
    print(ans)
       

Fixed submission:
def readinput():
    n=int(input())
    s=input()
    s=' '+s
    return n,s

def main(n,s):
    count=0
    all=set(['R','G','B'])
    for i in range(1, n-1):
        l1=s[i]
        for j in range(i+1, n):
            l2=s[j]
            if l1==l2:
                continue
            l3=(all - set([l1,l2])).pop()
            ij=j-i
            sub1=s[j+1:j+ij]
            sub2=s[j+ij+1:]
            count+=sub1.count(l3)
            count+=sub2.count(l3)
    return count

def main2(n,s):
    count=0
    nr=s.count('R')
    ng=s.count('G')
    nb=s.count('B')
    all=set(['R','G','B'])
    for i in range(1, n-1):
        l1=s[i]
        for j in range(i+1, n):
            l2=s[j]
            if l1==l2:
                continue
            ij=j-i
            jk=ij
            k=j+jk
            if(k>n):
                break
            l3=s[k]
            if l3==l1 or l3==l2:
                continue
            count+=1
    return nr*ng*nb-count



if __name__=='__main__':
    n,s=readinput()
    ans=main2(n,s)
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import heappush, heappop
import sys
INFTY=sys.maxsize

def readinput():
    n,x,y=list(map(int,input().split()))
    return n,x,y

def dijkstra(s,n,nList):
    '''優先度付きキューを使用したダイクストラ法

    パラメーター
    s: 始点
    n: 頂点の数
    nList: [ 
        [vertex1, cost1], [vertex2, cost2], ...
        [vertex1, cost1], [vertex2, cost2], ...
        ...
    ]

    返り値
    d: 始点sから各頂点vまでの最短経路上の辺の重みの総和d[v]のリスト
    '''

    WHITE=0
    GRAY=1
    BLACK=2
    color=[WHITE]*n
    d=[INFTY]*n

    HQ=[]

    d[s]=0
    heappush(HQ,(d[s],s))

    while(len(HQ)>0):
        #print(HQ)
        du,u=heappop(HQ)
        color[u]=BLACK

        if d[u]<du:
            continue

        for v in nList[u]:
            vw=1
            if color[v]!=BLACK:
                if d[u] + vw < d[v]:
                    d[v] = d[u] + vw
                    color[v]=GRAY
                    heappush(HQ, (d[v], v))
    return d

def main(n,x,y):
    nList=[]
    #nList.append([])
    nList.append([1])
    for i in range(1,n-1):
        nList.append([i-1,i+1])
    nList.append([n-2])
    nList[x-1].append(y-1)
    nList[y-1].append(x-1)
    #print(nList)

    dList=[]
    for i in range(n):
        dList.append(dijkstra(i,n,nList))
    #print(dList)
    
    hist=[0]*n
    for i in range(n-1):
        for j in range(i+1,n):
            hist[dList[i][j]]+=1
    
    for i in range(1,n):
        print(hist[i])


if __name__=='__main__':
    n,x,y=readinput()
    main(n,x,y)


Fixed submission:
from heapq import heappush, heappop
import sys
INFTY=sys.maxsize

def readinput():
    n,x,y=list(map(int,input().split()))
    return n,x,y

def dijkstra(s,n,nList):
    '''優先度付きキューを使用したダイクストラ法

    パラメーター
    s: 始点
    n: 頂点の数
    nList: [ 
        [vertex1, cost1], [vertex2, cost2], ...
        [vertex1, cost1], [vertex2, cost2], ...
        ...
    ]

    返り値
    d: 始点sから各頂点vまでの最短経路上の辺の重みの総和d[v]のリスト
    '''

    WHITE=0
    GRAY=1
    BLACK=2
    color=[WHITE]*n
    d=[INFTY]*n

    HQ=[]

    d[s]=0
    heappush(HQ,(d[s],s))

    while(len(HQ)>0):
        #print(HQ)
        du,u=heappop(HQ)
        color[u]=BLACK

        if d[u]<du:
            continue

        for v in nList[u]:
            vw=1
            if color[v]!=BLACK:
                if d[u] + vw < d[v]:
                    d[v] = d[u] + vw
                    color[v]=GRAY
                    heappush(HQ, (d[v], v))
    return d

def main(n,x,y):
    nList=[]
    #nList.append([])
    nList.append([1])
    for i in range(1,n-1):
        nList.append([i-1,i+1])
    nList.append([n-2])
    nList[x-1].append(y-1)
    nList[y-1].append(x-1)
    #print(nList)

    dList=[]
    for i in range(n):
        dList.append(dijkstra(i,n,nList))
    #print(dList)
    
    hist=[0]*n
    for i in range(n-1):
        for j in range(i+1,n):
            hist[dList[i][j]]+=1
    
    for i in range(1,n):
        print(hist[i])


if __name__=='__main__':
    n,x,y=readinput()
    main(n,x,y)
Buggy python submission (verdict: Runtime Error):

def mean(x):
    sum=0
    for _ in x:
        sum+=_
    return sum/len(x)

def rss(x,xbar):
    sum=0
    for _ in x:
        sum+=(_-xbar)**2
    return sum

def main(n,x):
    ans=0
    xbar=mean(x)
    xbar_int=xbar//1
    if(xbar-xbar_int >0.5):
        xbar_int+=1
    ans=rss(x,xbar_int)
    return int(ans)

def main2(n,x):
    xmin=min(x)
    xmax=max(x)
    minsum=1000000

    for p in range(xmin,xmax+1):
        sum=0
        for xx in x:
            sum+=(xx-p)**2
        if(sum<minsum):
            minsum=sum

    return minsum

if __name__=='__main__':
    n,x=readinput()
    ans=main(n,x)
    print(ans)

Fixed submission:
def readinput():
    n=int(input())
    x=list(map(int,input().split()))
    return n,x

def mean(x):
    sum=0
    for _ in x:
        sum+=_
    return sum/len(x)

def rss(x,xbar):
    sum=0
    for _ in x:
        sum+=(_-xbar)**2
    return sum

def main(n,x):
    ans=0
    xbar=mean(x)
    xbar_int=xbar//1
    if(xbar-xbar_int >0.5):
        xbar_int+=1
    ans=rss(x,xbar_int)
    return int(ans)

def main2(n,x):
    xmin=min(x)
    xmax=max(x)
    minsum=1000000

    for p in range(xmin,xmax+1):
        sum=0
        for xx in x:
            sum+=(xx-p)**2
        if(sum<minsum):
            minsum=sum

    return minsum

if __name__=='__main__':
    n,x=readinput()
    ans=main2(n,x)
    print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,x = list(map(int,input().split()))

if(x<a+b):
    print(0)
    exit()

# 桁数を求める
r=0
s=0
j=0
for i in range(10):
    j+=1         # Nの桁数
    r=10**i      # j桁の最小整数
    s=a*r+b*j
    if(s>x):
        break    # j桁の最小数がxを超えた

# Nはj-1桁
j=j-1

xr = x - b*j
n = xr // a
if (n>10**9):
    n=10**9

#print('j: {}'.format(j))

print(n)


Fixed submission:
weekday = {0:'SUN', 1:'MON', 2:'TUE', 3:'WED', 4:'THU', 5:'FRI', 6:'SAT'}
s=input()
for i in range(0, 7):
    if (weekday[i] == s):
        print(7-i)