s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s756732142
p04031
u117095520
1477673050
Python
Python (2.7.6)
py
Accepted
16
2568
148
N = int(raw_input()) a = map(int, raw_input().split()) avg = int(round(sum(a) / float(N))) ans = 0 for ai in a: ans += (ai - avg) ** 2 print ans
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,681
s436557598
p04031
u386349298
1477662906
Python
Python (3.4.3)
py
Accepted
23
3064
490
n = int(input()) data = input().split(" ") sum = 0 for i in data: sum += int(i) r1 = int(round(sum / n, 0)) r2 = int(round(sum / n + 0.5, 0)) r3 = int(round(sum / n - 0.5, 0)) res = 0 keep = 0 def search(intvalue, data): sum = 0 for i in data: k = abs(intvalue - int(i)) if k == 0: ...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,682
s499005119
p04031
u425448230
1477610380
Python
Python (3.4.3)
py
Accepted
23
3064
170
#C from math import ceil N = int(input()) a = [int(i) for i in input().split()] ave = float(sum(a)) / float(len(a)) print(sum([(a[i] - round(ave))**2 for i in range(N)]))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,683
s572693551
p04031
u647537044
1477254921
Python
Python (3.4.3)
py
Accepted
23
3064
203
N = int(input()) a_list = list(map(int,input().split())) b = 0 for ai in a_list: b += ai average = int(round(b/N)) sigma = 0 for ai in a_list: sigma += (ai - average) ** 2 print(sigma)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,684
s986994133
p04031
u731028462
1477254884
Python
Python (3.4.2)
py
Accepted
29
3684
188
from functools import reduce n = int(input()) arr = list(map(int, input().split())) s = reduce(lambda sum,x: sum+x, arr) h = round(s/n) m = 0 for a in arr: m += (a-h)**2 print(int(m))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,685
s520221454
p04031
u647537044
1477253949
Python
Python (3.4.3)
py
Accepted
23
3064
319
N = int(input()) a_list = list(map(int,input().split())) b = 0 for ai in a_list: b += ai average = int(b/N) sigma = 0 sigma2 = 0 sigma3 = 0 for ai in a_list: sigma += (ai - average) ** 2 sigma2 += (ai - (average-1)) ** 2 sigma3 += (ai - (average+1)) ** 2 print(min(sigma,sigma2,sigma3))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,686
s377213309
p04031
u901307908
1477163536
Python
Python (3.4.3)
py
Accepted
24
3188
163
n = int(input()) a = input() a = list(map(int, a.split())) #print(a) x_min = round(sum(a) / n ) cost = sum([(x_min - i) * (x_min - i) for i in a]) print(cost)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,687
s564945923
p04031
u471797506
1476589992
Python
Python (2.7.6)
py
Accepted
32
4008
293
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N = int(raw_input()) a = map(int, raw_input().split()) ans = 1e10 for b in xrange(-100, 101): tmp = 0 for ai in a: tmp += (ai - b)**2 ans = min(ans, tmp) print ans
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,688
s923711969
p04031
u065683101
1475674839
Python
Python (3.4.3)
py
Accepted
31
3064
272
def read(): return int(input()) def reads(sep=None): return list(map(int, input().split(sep))) def main(): n = read() a = reads() r = float('inf') for i in range(-100, 100+1): r = min(r, sum([abs(x-i)**2 for x in a])) print(r) main()
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,689
s898325889
p04031
u550734883
1475291079
Python
Python (3.4.3)
py
Accepted
27
3064
212
N=int(input()) a=list(map(int,input().split())) m,M=min(a),max(a) min_cost=4000000 for i in range(m,M+1): cost=sum(map(lambda x:(x-i)*(x-i),a)) min_cost=cost if cost<min_cost else min_cost print(min_cost)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,690
s597307669
p04031
u361243145
1473900095
Python
Python (2.7.6)
py
Accepted
28
2820
301
class BeTogether: def getMinimumValue(self,N,a): average = round(float(sum(a))/len(a),0) cost = [(a[i]-int(average))**2 for i in range(len(a))] print sum(cost) if __name__ == "__main__": N = int(raw_input()) x = [int(i) for i in raw_input().split()] b = BeTogether() b.getMinimumValue(N,x)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,691
s275175641
p04031
u098968285
1473714866
Python
Python (3.4.3)
py
Accepted
46
3064
172
n = int(input()) a = list(map(int, input().split())) ans = int(1e9) for i in range(-100, 101): res = sum(map(lambda x: (x-i)*(x-i), a)) ans = min(ans, res) print(ans)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,692
s046398724
p04031
u095015466
1473284954
Python
Python (2.7.6)
py
Accepted
41
2692
302
N = int(raw_input()) alist = raw_input().split() a = {} for i in range(len(alist)): a[i] = int(alist[i]) minv = -101 minsum = 99999999 for i in range(-100, 101): sums = 0 for k in range(len(a)): sums += (a[k] - i) * (a[k] - i) if sums < minsum: minv = i minsum = sums print minsum
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,693
s216522381
p04031
u816175360
1473166742
Python
Python (3.4.3)
py
Accepted
53
3188
213
n=int(input()) s=[int(x) for x in input().split()] s.sort() a=s[0] b=s[-1] m=9999999999999 for i in range(a,b+1): sum=0 for j in s: sum+=(j-i)**2 if sum < m: m=sum print(m)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,694
s735933279
p04031
u544337787
1473125786
Python
Python (2.7.6)
py
Accepted
30
2568
177
raw_input() a = map(int, raw_input().split()) res = 10**9+7 for i in range(min(a), max(a)+1): tmp = sum([(i-x)**2 for x in a]) if tmp < res: res = tmp print res
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,695
s616559934
p04031
u712335892
1472963579
Python
Python (3.4.3)
py
Accepted
50
3064
384
def calc_cost(a, i): cost = 0 for num in a: cost += (num - i) ** 2 return cost if __name__ == '__main__': N = int(input()) a = [int(x) for x in input().split()] max_num = max(a) min_cost = calc_cost(a, a[0]) for i in range(-100, 101): cost = calc_cost(a, i) if c...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,696
s915802092
p04031
u411544692
1472619126
Python
Python (2.7.6)
py
Accepted
27
2568
165
N = input() An = map(int, raw_input().split()) avg = sum(An)*1.0/len(An) avg = int(round(avg)) avg_cost = 0 for a in An: avg_cost += (a-avg)**2 print avg_cost
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,697
s133052405
p04031
u411544692
1472618783
Python
Python (2.7.6)
py
Accepted
27
2692
492
N = input() An = map(int, raw_input().split()) avg = sum(An)*1.0/len(An) avg = int(round(avg)) avg_cost = 0 for a in An: avg_cost += (a-avg)**2 while True: l_avg = avg g_avg = avg l_avg -= 1 g_avg += 1 l_cost = 0 g_cost = 0 for a in An: l_cost += (a-l_avg)**2 g_cost +...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,698
s162340032
p04031
u732844340
1472472201
Python
Python (3.4.3)
py
Accepted
68
3956
459
from functools import reduce n = int(input()) a = list(map(int,input().split())) end = max(a) ansAry = [] b = min(a) while(True): suma = [] for i in range(0,len(a)): if b == a[i]: pass else: suma.append((a[i] - b)*(a[i] - b)) try: ansAry.append(reduce(lamb...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,699
s840753114
p04031
u706147596
1472418061
Python
Python (2.7.6)
py
Accepted
33
2568
372
N = int(raw_input()) numbers = map(int, raw_input().split()) min_num = min(numbers) max_num = max(numbers) min_cost = None for result in xrange(min_num, max_num+1): cost = 0 for number in numbers: cost += (number - result)**2 if min_cost: if min_cost >= cost: min_cost = cos...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,700
s199246657
p04031
u159043787
1472349150
Python
Python (2.7.6)
py
Accepted
28
2568
217
N=input() a=map(int,raw_input().split( )) mean=sum(a)/len(a) meanU=mean+1 cost=0 costU=0 for i in a: cost+=(mean-i)*(mean-i) costU+=(meanU-i)*(meanU-i) if cost < costU: print cost else: print costU
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,701
s004681629
p04031
u783939477
1472244048
Python
Python (3.4.3)
py
Accepted
39
3188
238
from sys import stdout, stdin stdin.readline() nums = stdin.readline().strip() nums = [int(c) for c in nums.split()] target = round(sum(nums) / float(len(nums))) res = sum([abs(n - target) ** 2 for n in nums]) stdout.write(str(res))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,702
s645866731
p04031
u343675824
1471891921
Python
Python (3.4.3)
py
Accepted
39
3064
137
n = float(input()) a = list(map(int,input().split())) ave = int( round(sum(a)/n) ) ans = 0 for i in a: ans += (ave-i)**2 print(ans)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,703
s604025300
p04031
u385672078
1471820152
Python
Python (3.4.3)
py
Accepted
41
3064
286
N = int(input()) a = list(map(int, input().split(' '))) def cal(l, x): ret = 0 for i in l: ret += (i - x) * (i - x) return ret aver = int(sum(a) / len(a)) ans = 1e9 for i in range(aver - 3, aver + 3): f = cal(a, i) if f < ans: ans = f print(ans)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,704
s343023698
p04031
u642062207
1471812954
Python
Python (3.4.3)
py
Accepted
51
3064
203
N=int(input()) A=[] A=list(map(int,list(input().split()))) S=[0]*201 C=10**7 for k in range(0,201): for i in range(N): B=(k-100)-A[i] S[k]+=B*B if C>S[k]: C=S[k] print(C)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,705
s400262088
p04031
u039623862
1471733415
Python
Python (3.4.3)
py
Accepted
39
3064
232
import math n=int(input()) a=list(map(int, input().split())) ave = sum(a)/n if math.ceil(ave)-ave > ave-math.floor(ave): t = math.floor(ave) else: t = math.ceil(ave) total = 0 for v in a: total += (t-v) ** 2 print(total)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,706
s002522701
p04031
u337931720
1471689390
Python
Python (2.7.6)
py
Accepted
44
2568
164
raw_input() a = [int(x) for x in raw_input().split()] bsc = 1e10 for i in range(-101, 102): sc = 0 for j in a: sc += (j-i)**2 bsc = min(bsc, sc) print bsc
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,707
s151573406
p04031
u417874416
1471470520
Python
Python (3.4.3)
py
Accepted
51
3064
252
def sqsum(a, x): s = 0 for i in range(len(a)): s += (a[i]-x)**2 return s n = int(input()) a = [int(i) for i in input().strip().split()] s = sum(a) sq = [] for x in range(-100, 101): sq.append(sqsum(a, x)) print(min(sq))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,708
s552261483
p04031
u338686846
1471465776
Python
Python (2.7.6)
py
Accepted
28
2568
118
N = input() S = map(float, raw_input().split()) a = round(sum(S)/N) c = 0 for i in S: c += (i-a)**2 print int(c)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,709
s089084612
p04031
u713368238
1471356617
Python
Python (3.4.3)
py
Accepted
54
3064
210
n = int(input()) a = list(map(int, input().split())) cost_list = [] cost = 0 for i in range(-100, 101): cost = 0 for j in a: cost += (j - i) ** 2 cost_list.append(cost) print(min(cost_list))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,710
s018353696
p04031
u857605629
1471323277
Python
Python (2.7.6)
py
Accepted
29
2688
182
from __future__ import division n = input() a = map(int, raw_input().split(' ')) tot = 0 ave = round(reduce((lambda x,y: x+y),a) / n) for x in a: tot += (x-ave)**2 print int(tot)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,711
s491567826
p04031
u226155577
1471320520
Python
Python (2.7.6)
py
Accepted
30
2568
102
input() A = map(int, raw_input().split()) print min(sum((e-x)**2 for e in A) for x in range(-100,101))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,712
s119041862
p04031
u518732500
1471289038
Python
Python (3.4.3)
py
Accepted
40
3064
285
def cost(a, x): c = 0 for ai in a: c += (ai - x) * (ai - x) return c N = int(input()) a = list(map(int, input().split())) avg = 0 for n in a: avg += n if avg % N == 0: print(cost(a, avg // N)) else: print(min(cost(a, avg // N), cost(a, avg // N + 1)))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,713
s639666748
p04031
u830390742
1471269851
Python
Python (2.7.6)
py
Accepted
29
2568
115
N = input() a = map(int, raw_input().split()) m = int(round(sum(a)/float(N))) print sum(map(lambda x:(x-m)**2, a))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,714
s647632589
p04031
u726905855
1471241195
Python
Python (3.4.3)
py
Accepted
50
3064
174
N = int(input()) A = list(map(int, input().split())) mn = 1 << 30 for x in range(-100, 101): v = 0 for a in A: v += (a - x) ** 2 mn = min(v, mn) print(mn)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,715
s480082091
p04031
u187430339
1471225382
Python
Python (2.7.6)
py
Accepted
33
2568
289
import sys #sys.stdin = open('c_4.txt', 'r') min_cost = sys.maxint N = int(raw_input()) num_list = map(int, raw_input().split()) for x in range(-100, 101, 1): new_cost = 0 for y in range(N): new_cost += (num_list[y] - x) ** 2 min_cost = min(new_cost, min_cost) print str(min_cost)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,716
s789503793
p04031
u751047721
1471220783
Python
Python (3.4.3)
py
Accepted
51
3064
263
n = int(input()) list_n = [int(n) for n in input().split(' ')] A = 0 for n in list_n: A += (100-n)**2 for n in range(-100,100): B = 0 for num in list_n: B += (n-num)**2 if A > B: A = B print(A)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,717
s035094405
p04031
u521667517
1471210415
Python
Python (2.7.6)
py
Accepted
33
2568
332
# coding: utf-8 import sys n = int(raw_input()) list_num = [int(num) for num in raw_input().split(' ')] cost = 0 for num in list_num: cost += (100-num)**2 for ans in range(-100, 100): cost_tmp = 0 for num in list_num: cost_tmp += (ans-num)**2 if cost > cost_tmp: cost = cost_tmp...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,718
s782461872
p04031
u886545507
1471198775
Python
Python (2.7.6)
py
Accepted
32
2568
211
#coding: utf-8 #ABC043C import sys n=int(raw_input()) l=map(int,raw_input().split()) res=float("inf") cost=0 for i in xrange(-100,101): for j in l: cost+=(j-i)**2 if cost<res: res=cost cost=0 print res
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,719
s522698571
p04031
u077080573
1471148166
Python
Python (3.4.3)
py
Accepted
55
3064
241
N = input() l = list(map(int,list(input().split()))) cost_min = (200**2)*100 cost = 0 for i in range(-100,101): for j in l: cost += (j - i)**2 if cost < cost_min: cost_min = cost cost = 0 print(cost_min)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,720
s190647397
p04031
u048744861
1471142321
Python
Python (2.7.6)
py
Accepted
31
2692
373
import math as m def main(): n = raw_input() a = map(float,raw_input().split()) avg = m.ceil( sum(a)/len(a) ) avg2 = m.floor( sum(a)/len(a) ) cost = 0 for i in a: cost += (avg - i) ** 2 cost2 = 0 for i in a: cost2 += (avg2 - i) ** 2 print int(min(...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,721
s689154999
p04031
u307757209
1471141671
Python
Python (2.7.6)
py
Accepted
30
2820
392
# -*- coding: utf-8 -*- """ Created on Sat Aug 13 20:59:33 2016 @author: kt """ max=-1000 min=1000 N=input() i=0 minx=0 l = map(int, raw_input().split()) sum=0 for var in l: sum+=var sum=float(sum)/float(N) isum=int(sum) if sum==isum: minx=sum elif isum+1-sum >sum-isum: minx=isum else: minx=isum+1 re...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,722
s452088978
p04031
u869328641
1471141325
Python
Python (3.4.3)
py
Accepted
48
3064
129
n = int(input()) A = list(map(int,input().split())) S = [sum((i-a)**2 for a in A) for i in range(min(A),max(A)+1)] print(min(S))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,723
s728979204
p04031
u124139453
1471140861
Python
Python (2.7.6)
py
Accepted
32
2692
233
import math,sys n = input() a = map(int, raw_input().split()) if len(set(a)) == 1: print 0 sys.exit() res = [] for af in range(-100,101): ans = 0 for i in a: ans += (i-af)**2 res.append(ans) print min(res)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,724
s202871229
p04031
u952939556
1471140756
Python
Python (3.4.3)
py
Accepted
53
3064
228
n=int(input()) I=[int(i) for i in input().split(" ")] MAX=max(I) MIN=min(I) ans=10000000000000000000000000000 for x in range(MIN,MAX+1): SUM=0 for i in I: SUM+=(i-x)**2 if SUM<ans: ans=SUM print(ans)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,725
s795457936
p04031
u562283476
1471140605
Python
Python (3.4.3)
py
Accepted
39
3064
164
from math import floor out = 0 N = int(input()) a = list(map(int, input().split())) t = int(round(sum(a) / N)) for i in a: out += (i - t)**2 print(int(out))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,726
s328619600
p04031
u352021237
1471139326
Python
Python (2.7.6)
py
Accepted
31
2568
154
n=int(raw_input()) N=map(int,raw_input().split()) add=count=0 b=sum(N)/n a=b+1 for i in N: add+=(a-i)**2 count+=(b-i)**2 print min(add,count)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,727
s630852984
p04031
u687470137
1471139142
Python
Python (3.4.3)
py
Accepted
53
3064
398
n = int(input()) data = list(map(int,input().split())) mini = 100000 maxi = -100000 for i in range(n): if mini > data[i]: mini = data[i] if maxi < data[i]: maxi = data[i] mincost = 1000000000 ans = 0 for i in range(mini,maxi+1): cost = 0 for j in range(n): cost += (data[j] - i)**...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,728
s672416628
p04031
u472492255
1471138684
Python
Python (3.4.3)
py
Accepted
39
3316
440
# coding: utf-8 count = int(input()) numbers = [int(i) for i in input().rstrip().split(" ")] average = sum(numbers) / count def calc_single_cost(x, y): return (x - y) ** 2 def calc_total_cost(avg, targets): cost = 0 for x in targets: cost += calc_single_cost(avg, x) return cost cost = [] for...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,729
s677081580
p04031
u391812144
1471138549
Python
Python (3.4.3)
py
Accepted
53
3064
298
n = int(input()) retu = input().split() for i in range(0,n): retu[i] = int(retu[i]) retuS = sorted(retu) resultA = [] for j in range(retuS[0],retuS[n-1]+1): result = 0 for k in retu: result = result + (k - j) * (k - j) resultA.append(result) resultA.sort() print(resultA[0])
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,730
s895633927
p04031
u966695411
1471138467
Python
Python (3.4.3)
py
Accepted
42
3064
193
#! /usr/bin/env python3 input() a = list(map(int, input().split())) s = sorted(a) cost = [] for y in range(s[0], s[-1]+1): cost += [sum((x - y) * (x - y) for x in a)] print(sorted(cost)[0])
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,731
s863329843
p04031
u107077660
1471138431
Python
Python (3.4.3)
py
Accepted
40
3188
320
N = int(input()) a = list(map(int,input().split())) b = 0 for i in range(N): b += a[i] if type(b/N) == int: m = b/N c = 0 for i in range(N): c += (a[i] - m)**2 print(int(c)) else: m = int(b/N) + 1 n = int(b/N) c = 0 d = 0 for i in range(N): c += (a[i] - m)**2 d += (a[i] - n)**2 e = min(c,d) print(e)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,732
s853635912
p04031
u986399983
1471138237
Python
Python (2.7.6)
py
Accepted
27
2568
242
n = int(raw_input()) a = map(int, raw_input().split()) sum = sum(a) if(sum >= 0): ave = int(float(sum) / n + 0.5) else: ave = int(float(sum) / n - 0.5) cost = 0 for item in a: cost += pow(abs(item - ave), 2) print cost,
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,733
s679545380
p04031
u982653403
1471138167
Python
Python (3.4.3)
py
Accepted
41
3188
114
n=int(input()) a=list(map(int, input().split())) avg=round(sum(a)/n) print(sum(map(lambda x:(x-avg)*(x-avg), a)))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,734
s486993711
p04031
u341469181
1471138021
Python
Python (3.4.3)
py
Accepted
41
3064
148
def solve(a): mean = round(sum(a) / len(a)) return sum(((aa - mean) ** 2 for aa in a)) input() print(solve(list(map(int, input().split(' ')))))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,735
s229863741
p04031
u123756661
1471137912
Python
Python (2.7.6)
py
Accepted
33
2696
641
IS=float('inf') xy=[(1,0),(-1,0),(0,1),(0,-1)] bs=[(-1,-1),(-1,1),(1,1),(1,-1)] def niten(a,b): return abs(a-b) if a>=0 and b>=0 else a+abs(b) if a>=0 else abs(a)+b if b>=0 else abs(abs(a)-abs(b)) def gcd(a,b): return a if b==0 else gcd(b,a%b) def lcm(a,b): return a*b/gcd(a,b) def euclid_dis(x1,y1,x2,y2): return ((x1-...
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,736
s616248792
p04031
u948287304
1471137842
Python
Python (2.7.6)
py
Accepted
32
2568
150
input() a = [int(i) for i in raw_input().split()] b = [] for i in range(min(a), max(a) + 1): b.append(sum(pow(j - i, 2) for j in a)) print min(b)
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,737
s405391404
p04031
u010110540
1471137811
Python
Python (3.4.3)
py
Accepted
50
3064
218
n = int(input()) li = list(map(int, input().split())) minli = min(li) maxli = max(li) somme = [] for i in range(minli,maxli+1): s = 0 for j in range(len(li)): s += (li[j] - i)**2 somme.append(s) print(min(somme))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,738
s986729272
p04031
u821262411
1471137797
Python
Python (3.4.3)
py
Accepted
39
3064
188
n=int(input()) ans1=0 ans2=0 a=list(map(int,input().split())) avg=sum(a)/n m1=int(avg) m2=m1+1 for i in range(n): ans1 += (a[i]-m1)**2 ans2 += (a[i]-m2)**2 print(min(ans1,ans2))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,739
s136907250
p04031
u492932526
1471137718
Python
Python (2.7.6)
py
Accepted
27
2568
229
n = int(raw_input()) a = map(int,raw_input().split()) ave = float(sum(a))/float(len(a)) if ave - int(ave) >= 0.5: ave = int(ave)+1 else: ave = int(ave) cost = 0 for var in a: cost = cost + (var-ave)**2 print cost
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,740
s095762146
p04031
u758661720
1471137156
Python
Python (2.7.6)
py
Accepted
30
2568
232
n = input() a = raw_input() a = [int(i) for i in a.split()] min_cost = 1000000000 for i in range(min(a),max(a)+1): cost = 0 for j in a: cost += (i-j)**2 if(cost<min_cost): min_cost = cost print min_cost
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,741
s493986383
p04031
u786082266
1471137097
Python
Python (2.7.6)
py
Accepted
31
2568
181
a = input() l = map(int, raw_input().split()) s = 100000000 ma = max(l) mi = min(l) for i in range(mi, ma + 1): t = 0 for j in l: t += (j - i) ** 2 if t < s: s = t print s
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,742
s258467545
p04031
u776189585
1471136914
Python
Python (2.7.6)
py
Accepted
27
2568
123
n = int(raw_input()) a = map(int, raw_input().split()) ave = round(float(sum(a))/n) print int(sum([(x-ave)**2 for x in a]))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,743
s164727611
p04031
u327854949
1471136849
Python
Python (2.7.6)
py
Accepted
32
2568
218
n = int(raw_input()) t = [int(i) for i in raw_input().split()] miin = 1000000000000000000 for tar in range(-100, 101): s = 0 for e in t: s += (tar-e)*(tar-e) if s<miin: miin = s print miin
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,744
s911399998
p04031
u010733367
1471136808
Python
Python (3.4.3)
py
Accepted
41
3064
212
def fn(m): res = 0 for a in A: res += (a - m) ** 2 return res N = int(input()) A = list(map(int, input().split())) mean = int(sum(A) // N) lo = fn(mean) hi = fn(mean + 1) print(min(lo, hi))
p04031
<span class="lang-en"> <p>Score : <var>200</var> points</p> <div class="part"> <section> <h3>Problem Statement</h3><p>Evi has <var>N</var> integers <var>a_1,a_2,..,a_N</var>. His objective is to have <var>N</var> equal <strong>integers</strong> by transforming some of them.</p> <p>He may transform each integer at most ...
2 4 8
8
1,207,745
s079686474
p04033
u785573018
1601435170
Python
Python (3.8.2)
py
Accepted
27
9148
129
a, b = map(int, input().split()) if a*b < 0: print("Zero") elif b < 0 and (b-a)%2 == 0: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,182
s428319789
p04033
u924828749
1601431262
Python
Python (3.8.2)
py
Accepted
28
9176
192
a,b = [int(x) for x in input().split()] if a > 0: print("Positive") elif a < 0 and b > 0: print("Zero") else: if (b - a + 1) % 2 == 1: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,183
s221709869
p04033
u598684283
1601246992
Python
PyPy3 (7.3.0)
py
Accepted
65
61772
200
a,b = map(int,input().split()) if 0 < a <= b: print("Positive") elif a <= b < 0: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative") else: print("Zero")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,184
s683203372
p04033
u834832056
1601068445
Python
Python (3.8.2)
py
Accepted
25
9000
213
a, b = map(int, input().split()) if a > 0 and b > 0: print("Positive") elif a < 0 and b > 0: print("Zero") else: if (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,185
s336860005
p04033
u422272120
1601066197
Python
Python (3.8.2)
py
Accepted
29
9052
292
a,b = map(int,input().split()) if a == 0 or b == 0 or (a < 0 and 0 < b) or (0 < a and b < 0): print ("Zero") else: x = b - a if 0 < a and 0 < b: print ("Positive") else: if x%2 == 0: print ("Negative") else: print ("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,186
s301139571
p04033
u687574784
1601034829
Python
Python (3.8.2)
py
Accepted
28
9056
158
a,b = list(map(int, input().split())) if a <= 0 <= b: print('Zero') elif a <= b < 0 and (b-a) % 2 == 0: print('Negative') else: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,187
s051685324
p04033
u476068053
1601003357
Python
PyPy3 (7.3.0)
py
Accepted
73
61900
400
def main(): a, b = map(int, input().split()) num_neg = 0 if a <= 0 and b >= 0: print('Zero') return elif a > 0: print('Positive') return else: num_neg = b - a if num_neg % 2 == 1: print('Positive') return else: ...
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,188
s846924085
p04033
u666550725
1600961163
Python
PyPy3 (7.3.0)
py
Accepted
70
61828
181
a, b = map(int, input().split()) if a <= 0 <= b: print("Zero") elif 0 < a: print("Positive") else: if (b - a + 1) % 2 == 1: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,189
s089448453
p04033
u045953894
1600937651
Python
Python (3.8.2)
py
Accepted
24
9184
220
a,b = map(int,input().split()) t = b-a+1 if a < 0 and b < 0: if t % 2 == 0: print('Positive') else: print('Negative') elif a<0 and b>0 or a>0 and b<0: print('Zero') else: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,190
s066751268
p04033
u626337957
1600908824
Python
PyPy3 (7.3.0)
py
Accepted
63
61676
189
A, B = map(int, input().split()) if A <= 0 and B >= 0: print('Zero') elif A > 0 and B > 0: print('Positive') else: if (B-A)%2 != 0: print('Positive') else: print('Negative')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,191
s114524167
p04033
u453630968
1600900505
Python
Python (3.8.2)
py
Accepted
27
9088
192
a, b = map(int,input().split()) if a > 0 and b > 0: print("Positive") elif a <= 0 and b >= 0: print("Zero") elif (b - a + 1) % 2 == 0: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,192
s207790488
p04033
u629540524
1600891077
Python
PyPy3 (7.3.0)
py
Accepted
63
61828
133
a,b = map(int,input().split()) if a*b<=0: print("Zero") elif b<0 and(b-a)%2==0: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,193
s367577209
p04033
u629540524
1600891071
Python
Python (3.8.2)
py
Accepted
28
9144
133
a,b = map(int,input().split()) if a*b<=0: print("Zero") elif b<0 and(b-a)%2==0: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,194
s454265846
p04033
u244434589
1600875837
Python
Python (3.8.2)
py
Accepted
26
9124
228
a,b=map(int,input().split()) if a <0 and b > 0: print('Zero') exit() elif a>0 and b > 0: print('Positive') exit() else: n = b-a+1 if n%2 == 0: print('Positive') else: print('Negative')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,195
s958091334
p04033
u314089899
1600835690
Python
Python (3.8.2)
py
Accepted
30
9172
155
a,b = map(int, input().split()) if a <= 0 <= b: print("Zero") elif (a>0 and b>0) or (abs(b-a)%2==1): print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,196
s106877936
p04033
u235261693
1600826854
Python
Python (3.8.2)
py
Accepted
27
9176
249
a,b= list(map(int,input().split())) if a==0 or b==0: print("Zero") elif a>0 and b>0: print("Positive") elif a<0 and b>0: print("Zero") else: c = abs(b-a) if c%2 == 0: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,197
s876536778
p04033
u556358547
1600806178
Python
PyPy3 (7.3.0)
py
Accepted
71
61808
747
#!/usr/bin/env python3 import sys def solve(a: int, b: int): if a <= 0 <= b: print("Zero") return if 0 < a: print("Positive") return if (abs(a-b)+1) % 2 == 1: print("Negative") return print("Positive") return # Generated by 1.1.7.1 https://github....
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,198
s887285705
p04033
u572032237
1600665807
Python
Python (3.8.2)
py
Accepted
28
9080
167
a, b = map(int, input().split()) if a <= 0 and b >= 0: print('Zero') elif (b - a) % 2 == 0 and a < 0 and b < 0: print('Negative') else: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,199
s473401316
p04033
u821251381
1600613989
Python
Python (3.8.2)
py
Accepted
27
9172
140
a,b = map(int,input().split()) if a*b<=0: print("Zero") elif (a>0 and b>0) or (a-b)%2 ==1: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,200
s751518580
p04033
u000513658
1600528922
Python
Python (3.8.2)
py
Accepted
29
9176
202
a, b = map(int, input().split()) if a <= 0 and b >= 0: print('Zero') if b < 0: if (b - a) % 2 == 0: print('Negative') else: print('Positive') if a > 0: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,201
s430187438
p04033
u724428568
1600453899
Python
Python (3.8.2)
py
Accepted
29
9064
222
a, b = map(int, input().split()) if (0 < a): res = "Positive" elif a <= 0 <= b: res = "Zero" else: if a == b: res = "Positive" elif (b-a) % 2 == 1: res = "Positive" else: res = "Negative" print(res)
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,202
s928308301
p04033
u724428568
1600453817
Python
Python (3.8.2)
py
Accepted
25
9152
238
a, b = map(int, input().split()) if (0 < a): res = "Positive" elif (a * b == 0) or (a * b < 0): res = "Zero" else: if a == b: res = "Positive" elif (b-a) % 2 == 1: res = "Positive" else: res = "Negative" print(res)
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,203
s693636179
p04033
u555587832
1600452958
Python
Python (3.8.2)
py
Accepted
25
9056
160
a,b = map(int,input().split()) if a<=0<=b: print('Zero') else: if a<b<0 and (b-a+1)%2!=0: print('Negative') else: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,204
s149796785
p04033
u301302814
1600393009
Python
Python (3.8.2)
py
Accepted
25
9068
264
# coding: utf-8 def main(): a, b = map(int, input().split()) ans = 'Positive' if a <= 0 and b >= 0: ans = 'Zero' elif b < 0: if (b - a) % 2 == 0: ans = 'Negative' print(ans) if __name__ == "__main__": main()
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,205
s337193465
p04033
u805011545
1600315772
Python
Python (3.8.2)
py
Accepted
27
9124
198
a, b = [int(x) for x in input().split()] if(a>0): print('Positive') elif(a<=0 and b>=0): print('Zero') else: delab = b-a+1 if(delab%2==0): print('Positive') else: print('Negative')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,206
s536012514
p04033
u675269406
1600151101
Python
Python (3.8.2)
py
Accepted
28
9164
156
a, b = map(int, input().split(' ')) result = 'Positive' if a <= 0 <= b: result = 'Zero' elif b < 0 and (b - a) % 2 == 0: result = 'Negative' print(result)
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,207
s285099028
p04033
u318427318
1600120254
Python
Python (3.8.2)
py
Accepted
27
9056
388
#-*-coding:utf-8-*- import sys input=sys.stdin.readline def main(): a,b = map(int,input().split()) if a == 0 or b ==0 or (a<0 and b>0): print("Zero") exit() else: if a > 0 and b > 0: print("Positive") elif abs(a-b)%2!=0: print("Positive") else...
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,208
s953452508
p04033
u977605150
1600094535
Python
Python (3.8.2)
py
Accepted
28
8976
207
a, b = map(int, input().split()) c = b - a if a <= 0 <= b: print("Zero") elif a > 0: print("Positive") elif b < 0: if c % 2 == 1: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,209
s549741242
p04033
u395672550
1600018690
Python
Python (3.8.2)
py
Accepted
28
9144
227
a,b = map(int, input().split()) if a < 0 and b < 0: if (a - b) % 2 == 0: print('Negative') else: print('Positive') if a < 0 and b >= 0: print('Zero') if a == 0: print('Zero') if a > 0: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,210
s794783694
p04033
u833416137
1599966881
Python
PyPy3 (7.3.0)
py
Accepted
70
61812
172
a,b = map(int,input().split()) if a <= 0 and b >= 0: print("Zero") elif b < 0: print("Positive") if (b - a + 1) % 2 == 0 else print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,211
s694883409
p04033
u022215787
1599916581
Python
Python (3.8.2)
py
Accepted
26
9112
208
a, b = map(int, input().split()) if a < 0 and b < 0: if abs(b-a)%2 == 0: print('Negative') else: print('Positive') elif a <= 0 and b >=0: print('Zero') else: print('Positive')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,212
s927676383
p04033
u282813849
1599883165
Python
Python (3.8.2)
py
Accepted
28
9060
311
a,b = map(int,input().split()) if a > 0: print("Positive") exit(0) if (a == 0 or b == 0) or (a < 0 and b > 0): print("Zero") exit(0) # only negative a,b cases left from this point on if (a == b): print("Negative") exit(0) if (a - b) % 2 == 1: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,213
s633908049
p04033
u391589398
1599878159
Python
PyPy3 (7.3.0)
py
Accepted
64
61860
185
a, b = map(int, input().split()) if a <= 0 <= b: print('Zero') elif 0 < a: print('Positive') else: if (b-a)%2: print('Positive') else: print('Negative')
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,214
s509705716
p04033
u460745860
1599878121
Python
Python (3.8.2)
py
Accepted
27
9152
214
# A a,b =map(int,input().split()) if 0 < a and 0 < b: print("Positive") elif (a == 0 or b == 0) or (a < 0 and 0 < b): print("Zero") else: if (a-b)%2 == 0: print("Negative") else: print("Positive")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,215
s422453236
p04033
u740157634
1599865975
Python
Python (3.8.2)
py
Accepted
24
9116
233
A = list(map(int, input().split())) A.sort() a = A[0] b = A[1] c = b-a if a <= 0 <= b: print("Zero") elif a > 0: print("Positive") elif b < 0: if c%2 == 1: print("Positive") else: print("Negative")
p04033
<span class="lang-en"> <div class="part"> <section> <h3>Problem Statement</h3><p>You are given two integers <var>a</var> and <var>b</var> (<var>a≤b</var>). Determine if the product of the integers <var>a</var>, <var>a+1</var>, <var>…</var>, <var>b</var> is positive, negative or zero.</p> </section> </div> <div class="p...
1 3
Positive
1,208,216