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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s573178507 | p04030 | u289792007 | 1472691836 | Python | Python (2.7.6) | py | Accepted | 26 | 2568 | 219 | moji = []
s = raw_input()
for i in s:
if i == '0':
moji.append('0')
if i == '1':
moji.append('1')
if i == 'B':
if len(moji) != 0:
moji.pop(len(moji)-1)
print ''.join(moji) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,481 |
s117330997 | p04030 | u411544692 | 1472617521 | Python | Python (2.7.6) | py | Accepted | 29 | 2568 | 248 | s = raw_input()
def type(l, letters):
if l == '0' or l == '1':
letters += l
elif l == 'B':
if len(letters) != 0:
letters = letters[:-1]
return letters
ans = ''
for l in s:
ans = type(l, ans)
print ans
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,482 |
s439760759 | p04030 | u461954362 | 1472561649 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 217 | #!/usr/bin/env python
s = input()
ans = [''] * len(s)
point = 0
for word in s:
if word == 'B':
point = max(0, point - 1)
else:
ans[point] = word
point += 1
print("".join(ans[:point]))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,483 |
s776765905 | p04030 | u706147596 | 1472413489 | Python | Python (2.7.6) | py | Accepted | 29 | 2568 | 269 | keyinputs = raw_input()
output = ''
for i in xrange(len(keyinputs)):
keyinput = keyinputs[i]
if keyinput == '1' or keyinput == '0':
output+= keyinput
elif keyinput == 'B':
if not output == '':
output = output[:-1]
print output | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,484 |
s408611906 | p04030 | u783939477 | 1472243226 | Python | Python (3.4.3) | py | Accepted | 40 | 3188 | 249 | from sys import stdin, stdout
s = stdin.read()
s = list(s)
display = []
for c in s:
if c == 'B' and len(display) != 0:
display.pop(-1)
elif c == '1' or c == '0':
display.append(c)
res = ''.join(display)
stdout.write(res) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,485 |
s589269131 | p04030 | u542939897 | 1472186762 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 226 | s=raw_input()
output=""
for c in s:
if c=='B' and len(output)==0:
continue
elif c=='B':
output = output[:-1]
elif c=='0':
output += '0'
elif c=='1':
output += '1'
print output | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,486 |
s724885147 | p04030 | u824147251 | 1471953612 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 122 | s = input()
c = ''
for i in s:
if i == '0' or i == '1':
c += i
elif i == 'B':
c = c[:-1]
print(c)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,487 |
s981175259 | p04030 | u438131499 | 1471902098 | Python | Python (2.7.6) | py | Accepted | 26 | 2568 | 189 | s=raw_input()
a=""
for k in range(len(s)):
if s[k]=="0":
a=a+"0"
elif s[k]=="1":
a=a+"1"
elif s[k]=="B":
if len(a)>0:
a=a[0:len(a)-1]
print a | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,488 |
s207695263 | p04030 | u343675824 | 1471891611 | Python | Python (3.4.3) | py | Accepted | 40 | 3064 | 128 | input_key = input()
ans = ''
for i in input_key:
if i == 'B':
ans = ans[:-1]
else:
ans += i
print(ans)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,489 |
s604778502 | p04030 | u385672078 | 1471840300 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 162 | r = input()
res = ''
for i in r:
if i == '0':
res += '0'
elif i == '1':
res += '1'
elif i == 'B':
res = res[:-1]
print(res)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,490 |
s206114313 | p04030 | u039623862 | 1471733056 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 147 | s =input()
ary = []
for c in s:
if c == 'B':
if len(ary) > 0:
ary.pop()
else:
ary.append(c)
print(''.join(ary)) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,491 |
s510441586 | p04030 | u337931720 | 1471689225 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 113 | s = raw_input()
q = []
for c in s:
if c != 'B':
q.append(c)
elif len(q) > 0:
q.pop()
print ''.join(q) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,492 |
s516520304 | p04030 | u024612773 | 1471663475 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 176 | s=list(reversed(input()))
ans=""
cnt=0
for c in s:
if c == 'B':
cnt += 1
elif cnt > 0:
cnt -= 1
else:
ans += c
print(''.join(reversed(ans))) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,493 |
s845255533 | p04030 | u149580849 | 1471579734 | Python | Python (3.4.3) | py | Accepted | 46 | 3064 | 138 | s = input()
ans = ""
for i in range(0,len(s)):
if s[i] == 'B':
ans = ans[:-1]
else:
ans = ans + s[i]
print(ans)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,494 |
s751246718 | p04030 | u732844340 | 1471578175 | Python | Python (3.4.3) | py | Accepted | 45 | 3064 | 192 | s = input()
ans = ""
for i in range(0,len(s)):
if s[i] == 'B':
if(len(ans) < 0):
pass
else:
ans = ans[:-1]
else:
ans += s[i]
print(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,495 |
s682700221 | p04030 | u682128453 | 1471577914 | Python | Python (2.7.6) | py | Accepted | 42 | 2568 | 176 | N = raw_input()
con=""
for i in range(len(N)):
if N[i]=="0" or N[i]=="1":
con += N[i]
elif N[i]=="B" and len(con) >= 1:
con = con[:len(con)-1]
print con | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,496 |
s665352890 | p04030 | u696805736 | 1471493902 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 132 | s=input()
ans=""
for c in s:
if c=='B':
if len(ans)>0:
ans=ans[:-1]
else:
ans += c
print(ans)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,497 |
s453798836 | p04030 | u417874416 | 1471469046 | Python | Python (3.4.3) | py | Accepted | 42 | 3064 | 222 | ret = ""
s = input().strip()
s = list(str(s))
#print(s)
for c in s:
if c == "0":
ret = ret + "0"
elif c == "1":
ret = ret + "1"
else:
if ret != "":
ret = ret[:-1]
print(ret)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,498 |
s677727318 | p04030 | u236253673 | 1471404422 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 136 | S = input()
A = ""
for c in S:
if c == '0' or c == '1':
A += c
elif c == 'B' and A != "":
A = A[0:-1]
print(A)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,499 |
s692451496 | p04030 | u338686846 | 1471389972 | Python | Python (2.7.6) | py | Accepted | 30 | 2820 | 225 | import re
def f(s):
global a
r = p.subn('',s)
if r[1]!=0:
return f(r[0])[0]
else:
a = r[0]
return '0'
N = raw_input()
p = re.compile('\dB')
q = re.compile('^B*')
f(N)
print q.sub('',a)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,500 |
s959863825 | p04030 | u233602244 | 1471367883 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 149 | s = input()
stk = []
for c in s:
if c == 'B':
if len(stk) > 0:
stk.pop()
else:
stk.append(c)
print(''.join(stk))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,501 |
s175148798 | p04030 | u713368238 | 1471354601 | Python | Python (3.4.3) | py | Accepted | 41 | 3064 | 162 | s = list(input())
t = []
for i in s:
if i == '0' or i == '1':
t.append(i)
elif i == 'B' and len(t) != 0:
del t[len(t)-1]
print(''.join(t)) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,502 |
s747348917 | p04030 | u857605629 | 1471322563 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 126 | s = raw_input()
mystr = ""
for x in s:
if (x=='B'):
mystr = mystr[0:len(mystr)-1]
else: mystr += x
print mystr | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,503 |
s187238688 | p04030 | u226155577 | 1471320236 | Python | Python (2.7.6) | py | Accepted | 29 | 2568 | 151 | s = list(raw_input())
t = []
for e in s:
if e is "B":
if t:
t.pop()
else:
t.append(e)
print "".join(t) if t else "" | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,504 |
s004051129 | p04030 | u518732500 | 1471288661 | Python | Python (3.4.3) | py | Accepted | 54 | 3064 | 155 | s = input()
ans = []
for str in s:
if str == 'B':
if len(ans) > 0:
ans.pop()
else:
ans.append(str)
print(''.join(ans))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,505 |
s687411685 | p04030 | u591287669 | 1471275034 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 172 | s=list(input())
ans_list=[]
for c in s:
if c=='B':
if len(ans_list)>0:
ans_list.pop()
else:
ans_list.append(c)
print(''.join(ans_list))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,506 |
s898004830 | p04030 | u830390742 | 1471269407 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 136 | s = []
for a in raw_input():
if a == 'B':
if len(s) > 0:
s.pop()
else:
s.append(a)
print ''.join(s)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,507 |
s073380377 | p04030 | u159043787 | 1471252604 | Python | Python (2.7.6) | py | Accepted | 26 | 2568 | 190 | IN = list(raw_input())
OUT = []
while len(IN)>0 :
if IN[0] == 'B':
if len(OUT) > 0:
OUT.pop()
else:
OUT.append(IN[0])
IN.pop(0)
print ''.join(OUT)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,508 |
s138261751 | p04030 | u726905855 | 1471240649 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 167 | stack = []
string = input().strip()
for s in string:
if s == 'B':
if stack:
stack.pop()
else:
stack.append(s)
print(''.join(stack)) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,509 |
s599047614 | p04030 | u941268675 | 1471229527 | Python | Python (2.7.6) | py | Accepted | 28 | 2572 | 196 | S = raw_input()
ans = ''
for t in S:
if t == '0':
ans += '0'
elif t == '1':
ans += '1'
elif t == 'B':
if ans:
ans = ans[:-1]
print ans | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,510 |
s782304281 | p04030 | u187430339 | 1471221339 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 304 | import sys
#sys.stdin = open('b_2.txt', 'r')
in_str = list(raw_input())
out_str = ['X' for _ in range(10)]
cur_pos = 0
for x in in_str:
if x != 'B':
out_str[cur_pos] = x
cur_pos = cur_pos + 1
else:
if cur_pos > 0:
cur_pos = cur_pos - 1
else:
pass
print str(''.join(out_str[:cur_pos]))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,511 |
s432837259 | p04030 | u751047721 | 1471218921 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 133 | I = input()
A =''
for n in I:
if n == '0':
A += '0'
elif n == '1':
A += '1'
else:
if len(A) > 0:
A = A[:-1]
print(A)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,512 |
s480323770 | p04030 | u521667517 | 1471209871 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 249 | # coding: utf-8
import sys
list_n = raw_input()
output = ''
for n in list_n:
if n == '0':
output += '0'
elif n == '1':
output += '1'
else:
if len(output) > 0:
output = output[:-1]
print output | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,513 |
s299587009 | p04030 | u886545507 | 1471176837 | Python | Python (2.7.6) | py | Accepted | 28 | 2568 | 183 | #coding: utf-8
#ABC043B
l=list(raw_input())
res=""
for i in xrange(len(l)):
if l[i]=='0':
res=res+'0'
elif l[i]=='1':
res=res+'1'
elif l[i]=='B':
res=res[:-1]
print res
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,514 |
s486568796 | p04030 | u982123883 | 1471149107 | Python | Python (3.4.3) | py | Accepted | 40 | 3064 | 109 | s = input()
ans = ''
for x in s :
if x == 'B' :
ans = ans[:-1]
else : ans += x
print(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,515 |
s746769017 | p04030 | u620084012 | 1471147037 | Python | Python (3.4.3) | py | Accepted | 36 | 3064 | 188 | S = str(input())
ans = ""
for k in S:
if k == "0":
ans += "0"
elif k == "1":
ans += "1"
elif k == "B" and ans != "":
ans = ans[:len(ans)-1]
print(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,516 |
s912285095 | p04030 | u965266315 | 1471143595 | Python | Python (3.4.3) | py | Accepted | 42 | 3064 | 151 | a = input()
ans = ""
for i in a:
if i == "0" or i == "1":
ans += i
elif len(ans) > 0 :
ans = ans[:len(ans)-1]
print(ans)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,517 |
s740652536 | p04030 | u277373937 | 1471141019 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 167 | s = raw_input()
words = []
for c in list(s):
if c == 'B':
if len(words) > 0:
words.pop()
else:
words.append(c)
print ''.join(words) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,518 |
s751645704 | p04030 | u300538442 | 1471140874 | Python | Python (3.4.3) | py | Accepted | 37 | 3064 | 238 | s=list(input())
out=[]
for i in s:
if(i=='1'):
out.append(1)
elif(i=='0'):
out.append(0)
elif(i=='B'):
if(len(out)==0):
continue
del out[-1]
for x in out:
print(x,end="")
print() | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,519 |
s005682881 | p04030 | u352021237 | 1471140494 | Python | Python (2.7.6) | py | Accepted | 25 | 2568 | 183 | y=raw_input()
a=[]
for i in y:
if i=='1' or i=='0':
a.append(i)
else:
if a==[]:
continue
else:
del a[len(a)-1]
print ''.join(a) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,520 |
s852633882 | p04030 | u869328641 | 1471140440 | Python | Python (3.4.3) | py | Accepted | 45 | 3316 | 245 | import re
S = input()
if 'B' in S:
A = re.split("01BB|10BB|11BB|00BB|0B|1B",S)
A = "".join(A)
if 'B' in A:
C = re.split("01BB|10BB|11BB|00BB|0B|1B",A)
C = "".join(C)
C = C.split("B")
print("".join(C))
else:
print(A)
else:
print(S) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,521 |
s984894858 | p04030 | u952939556 | 1471139959 | Python | Python (3.4.3) | py | Accepted | 40 | 3064 | 303 | string = input()
result = []
j=0
for i in range(len(string)):
if string[i]=='0':
result.append('0')
elif string[i]=='1':
result.append('1')
elif string[i]=='B' and len(result)>=1 and result[-1] in ['0','1']:
del result[-1]
str_result="".join(result)
print(str_result) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,522 |
s443942433 | p04030 | u124139453 | 1471139145 | Python | Python (2.7.6) | py | Accepted | 26 | 2568 | 198 | s = list(raw_input())
ans = []
for i in s:
if i == "B":
if len(ans) == 0:
continue
else:
ans = ans[:-1]
else:
ans.append(i)
print "".join(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,523 |
s056749211 | p04030 | u077080573 | 1471138593 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 257 | array = []
s = list(input())
for char in s:
if char == "0":
array.append("0")
elif char == "1":
array.append("1")
else:
if len(array) != 0:
del array[-1]
else:
pass
print("".join(array))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,524 |
s900957214 | p04030 | u048744861 | 1471138456 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 365 |
def main():
s = []
l = list(raw_input())
for c in l:
if c == '0':
s.append(c)
elif c == '1':
s.append(c)
elif c == 'B':
if 0 < len(s):
s.pop()
else:
pass
print "".join(map(str,s)... | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,525 |
s574002254 | p04030 | u687470137 | 1471138056 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 208 | s = input()
ans = ""
for c in s:
if c == '0':
ans = ans + '0'
elif c == '1':
ans = ans + '1'
elif c == 'B':
if len(ans) != 0:
ans = ans[0:len(ans)-1]
print(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,526 |
s733776738 | p04030 | u562283476 | 1471138049 | Python | Python (3.4.3) | py | Accepted | 41 | 3064 | 148 | S = input()
out = []
for i in S:
if i == '0' or i == '1':
out.append(i)
elif len(out) != 0:
out.pop()
print("".join(out))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,527 |
s422144207 | p04030 | u330623252 | 1471137823 | Python | Python (3.4.3) | py | Accepted | 38 | 3064 | 138 | s = input()
ans = []
for c in s:
if c == '0' or c == '1':
ans.append(c)
else:
if len(ans) > 0:
del ans[-1]
print("".join(ans))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,528 |
s588099413 | p04030 | u307757209 | 1471137813 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 249 |
command=raw_input()
final=[-1]*10
i=0
for var in command:
if var=="0":
final[i]="0"
i+=1
elif var=="1":
final[i]="1"
i+=1
elif var=="B":
if i!=0:
i-=1
print "".join(final[0:i]) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,529 |
s959474116 | p04030 | u472492255 | 1471137783 | Python | Python (3.4.3) | py | Accepted | 37 | 3064 | 259 | # coding: utf-8
keys = input().rstrip()
result = ""
for c in keys:
if c == "0":
result += "0"
elif c == "1":
result += "1"
elif c == "B":
l = len(result)
if l > 0:
result = result[:l-1]
print(result)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,530 |
s246279363 | p04030 | u964185015 | 1471137654 | Python | Python (3.4.3) | py | Accepted | 51 | 3444 | 350 | # coding: utf-8
from collections import deque
s = input().strip()
answer = deque()
for c in s:
if c == '0':
answer.append('0')
elif c == '1':
answer.append('1')
elif c == 'B':
try:
answer.pop()
except IndexError:
answer = deque()
for c in answer:
... | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,531 |
s346631393 | p04030 | u341469181 | 1471137357 | Python | Python (3.4.3) | py | Accepted | 37 | 3064 | 178 | def solve(S):
result = ""
for c in S:
if c == 'B': result = ('' if len(result) == 0 else result[:-1])
else: result = result + c
return result
print(solve(input())) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,532 |
s171452787 | p04030 | u982653403 | 1471137289 | Python | Python (3.4.3) | py | Accepted | 41 | 3064 | 132 | s=input()
res=""
for c in s:
if c=='B':
if len(res)>0:
res = res[0:-1]
else:
res += c
print(res) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,533 |
s231822402 | p04030 | u010110540 | 1471137283 | Python | Python (3.4.3) | py | Accepted | 45 | 3064 | 206 | li = list(input())
str = []
for i in range(len(li)):
if li[i] == '0':
str.append('0')
elif li[i] == '1':
str.append('1')
else:
if len(str) != 0:
str.pop()
else:
continue
print(''.join(str)) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,534 |
s729649301 | p04030 | u886790158 | 1471137261 | Python | Python (3.4.3) | py | Accepted | 44 | 3316 | 186 | from re import search, sub
def update(s):
if (search(r'[01]B', s)):
return update(sub(r'[01]B', '', s))
else:
return s.replace('B', '')
print(update(input()))
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,535 |
s965463289 | p04030 | u391812144 | 1471137192 | Python | Python (3.4.3) | py | Accepted | 37 | 3064 | 234 | key = []
for i in list(input()):
key.append(i)
result = ""
for j in key:
if j == "0":
result = result + "0"
elif j == "1":
result = result + "1"
elif j == "B":
result = result[:-1]
print(result) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,536 |
s973455423 | p04030 | u492932526 | 1471137153 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 289 | n = raw_input()
result =""
for var in n:
if var == "0":
result = result + var
elif var == "1":
result = result +var
elif var == "B":
tmp = ""
for s in range(0,len(result)-1):
tmp = tmp + result[s]
result = tmp
print result
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,537 |
s542266357 | p04030 | u948287304 | 1471137109 | Python | Python (2.7.6) | py | Accepted | 25 | 2568 | 142 | a = []
for c in list(raw_input()):
if 'B' == c:
if len(a) > 0:
a.pop()
else:
a.append(c)
print ''.join(a) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,538 |
s413929006 | p04030 | u821262411 | 1471136880 | Python | Python (3.4.3) | py | Accepted | 44 | 3064 | 177 | s=list(str(input()))
ans=''
for i in s:
if i=='1':
ans += i
elif i=='0':
ans += i
elif i=='B' and ans!='':
ans = ans[:len(ans)-1]
print(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,539 |
s896684297 | p04030 | u966695411 | 1471136793 | Python | Python (3.4.3) | py | Accepted | 39 | 3064 | 129 | #! /usr/bin/env python3
s = []
for i in input():
if i == 'B':
s = s[:-1]
else:
s += [i]
print("".join(s)) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,540 |
s629872508 | p04030 | u123756661 | 1471136790 | Python | Python (2.7.6) | py | Accepted | 24 | 2568 | 143 | s=raw_input()
ans=[]
for i in s:
if i=='B':
if len(ans):
ans.pop(-1)
else:
ans.append(i)
print ''.join(ans) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,541 |
s679095667 | p04030 | u107077660 | 1471136775 | Python | Python (3.4.3) | py | Accepted | 36 | 3064 | 152 | s = input()
a = ""
for i in range(len(s)):
if s[i] == "0":
a += "0"
elif s[i] == "1":
a += "1"
else:
if a != "":
a = a[:len(a)-1]
print(a)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,542 |
s425527094 | p04030 | u786082266 | 1471136764 | Python | Python (2.7.6) | py | Accepted | 27 | 2568 | 107 | a = raw_input()
s = ""
for i in a:
if i == "0" or i == "1":
s += i
else:
s = s[:len(s) - 1]
print s | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,543 |
s702383205 | p04030 | u758661720 | 1471136727 | Python | Python (2.7.6) | py | Accepted | 28 | 2572 | 190 | s = raw_input()
str = []
for c in s:
if c is '0':
str.append('0')
elif c is '1':
str.append('1')
elif len(str)!=0:
del str[-1]
print ''.join(str) | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,544 |
s841111253 | p04030 | u776189585 | 1471136617 | Python | Python (2.7.6) | py | Accepted | 26 | 2572 | 143 | s = raw_input()
txt = ""
for x in s:
if x == 'B':
if len(txt) > 0:
txt = txt[:-1]
else:
txt += x
print txt | p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,545 |
s615621382 | p04030 | u327854949 | 1471136617 | Python | Python (2.7.6) | py | Accepted | 25 | 2568 | 162 | s = raw_input()
res = ""
for c in s:
if c=='0':
res += '0'
if c=='1':
res += '1'
if c=='B' and res:
res = res[:-1]
print res
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,546 |
s219890629 | p04030 | u010733367 | 1471136529 | Python | Python (3.4.3) | py | Accepted | 37 | 3064 | 189 | S = input()
ans = ""
for s in S:
if s == "0":
ans += "0"
elif s == "1":
ans += "1"
else:
if len(ans) != 0:
ans = ans[:len(ans)-1]
print(ans)
| p04030 | <span class="lang-en">
<p>Score : <var>200</var> points</p>
<div class="part">
<section>
<h3>Problem Statement</h3><p>Sig has built his own keyboard. Designed for ultimate simplicity, this keyboard only has <var>3</var> keys on it: the <code>0</code> key, the <code>1</code> key and the backspace key.</p>
<p>To begin wi... | 01B0
| 00
| 1,206,547 |
s414975232 | p04031 | u347397127 | 1601511883 | Python | Python (3.8.2) | py | Accepted | 32 | 9164 | 144 | n=int(input())
A=list(map(int,input().split()))
ans = [0]*201
for a in A:
for i in range(-100,101):
ans[i+100] += (a-i)**2
print(min(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,206,548 |
s421675357 | p04031 | u208713671 | 1601510749 | Python | PyPy3 (7.3.0) | py | Accepted | 66 | 61932 | 131 | N = int(input())
A = list(map(int,input().split()))
X,out = round(sum(A)/N),0
for i in range(N):
out += (A[i]-X)**2
print(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,206,549 |
s593782395 | p04031 | u425758699 | 1601442856 | Python | Python (3.8.2) | py | Accepted | 34 | 9120 | 170 | n=int(input())
a=list(map(int,input().split()))
ans=100000000
for i in range(-100,101):
now=0
for k in a:
now+=(i-k)*(i-k)
ans=min(ans,now)
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,206,550 |
s065396852 | p04031 | u015084832 | 1601179365 | Python | Python (3.8.2) | py | Accepted | 32 | 9160 | 475 | def main():
n = int(input())
al = list(map(int, input().split()))
maxval = max(abs(max(al)), abs(min(al)))
cost = []
if len(list(set(al))) == 1 :
print("0")
else :
k = -1
for i in range(-100,100) :
k += 1
cost.append(0)
for j 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,206,551 |
s411993958 | p04031 | u734876600 | 1601082628 | Python | Python (3.8.2) | py | Accepted | 25 | 9112 | 328 | N = int(input())
A = list(map(int, input().split()))
ans = 0
if sum(A)%N == 0:
x = sum(A)//N
for i in range(N):
ans += (x-A[i])**2
print(ans)
else:
x = sum(A)//N
b = sum(A)//N+1
if sum(A)/N - x > b - sum(A)/N:
x = b
for i in range(N):
ans += (x-A[i])**2
prin... | 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,206,552 |
s848294911 | p04031 | u161778051 | 1600966116 | Python | Python (3.8.2) | py | Accepted | 30 | 9140 | 146 | n = int(input())
a = list(map(int, input().split()))
avg_a = round(sum(a)/n)
result = 0
for num in a:
result += (num-avg_a)**2
print(result) | 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,206,553 |
s458952643 | p04031 | u708211626 | 1600943803 | Python | Python (3.8.2) | py | Accepted | 31 | 9164 | 126 | s=input();a=list(map(int,input().split()));ans=0
mean=round(sum(a)/len(a))
for i in a:
p=(i-mean)**2
ans+=p
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,206,554 |
s547983398 | p04031 | u507456172 | 1600885012 | Python | Python (3.8.2) | py | Accepted | 35 | 9032 | 257 | N = int(input())
A = list(map(int,input().split()))
costs = []
for i in range(101):
cost = 0
for j in range(N):
cost += (A[j]-i)**2
costs.append(cost)
cost = 0
for j in range(N):
cost += (A[j]+i)**2
costs.append(cost)
print(min(costs)) | 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,206,555 |
s048854278 | p04031 | u103208639 | 1600883548 | Python | Python (3.8.2) | py | Accepted | 33 | 9124 | 188 | n=int(input())
a=list(map(int, input().split()))
a.sort()
ans=10**10
for x in range(a[0],a[-1]+1):
tmp=0
for i in range(n):
tmp+=(a[i]-x)**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,206,556 |
s738202536 | p04031 | u045505231 | 1600756287 | Python | Python (3.8.2) | py | Accepted | 27 | 9412 | 317 | import math
from datetime import date
def f(x, a):
ans = 0
for y in a:
ans += (x - y) ** 2
return ans
def main():
n = int(input())
a = [int(x) for x in input().split()]
s = 0
for x in a:
s += x
s = s // n
ans = 10**17
for x in range(s - 2, s + 3):
ans = min(ans, f(x, a))
print(ans)
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,206,557 |
s709196942 | p04031 | u492910842 | 1600753182 | Python | PyPy3 (7.3.0) | py | Accepted | 65 | 64556 | 165 | n=int(input())
a=list(map(int,input().split()))
ans=10**10
for i in range(201):
cnt=0
for j in range(n):
cnt+=(a[j]-(i-100))**2
ans=min(ans,cnt)
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,206,558 |
s816878306 | p04031 | u365156087 | 1600734216 | Python | Python (3.8.2) | py | Accepted | 37 | 8888 | 166 | n = int(input())
A = list(map(int,input().split()))
ans = 10**9
for i in range(-100,101):
tmp = 0
for a in A:
tmp += (a-i)**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,206,559 |
s826299258 | p04031 | u825685913 | 1600654112 | Python | Python (3.8.2) | py | Accepted | 36 | 9160 | 182 | N = int(input())
l = list(map(int, input().split()))
cal = []
for i in range(-100,101):
a = 0
for j in l:
a += (i - j)**2
cal.append(a)
ans = min(cal)
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,206,560 |
s089080330 | p04031 | u367397360 | 1600635989 | Python | Python (3.8.2) | py | Accepted | 33 | 9172 | 329 | # Nの入力受付
N = int(input())
# aの入力受付
aN = list(map(int, input().split()))
# 平均の値を計算
S = 0
A = 0
for i in aN:
S += i
A = S / N
if A - int(A) < 0.5:
A = int(A)
else:
A = int(A) + 1
# Aにすべて書き換えるときのコストを計算
R = 0
for i in aN:
R += (i - A)**2
print(R)
| 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,206,561 |
s138579343 | p04031 | u699296734 | 1600635834 | Python | Python (3.8.2) | py | Accepted | 27 | 9160 | 217 | n = int(input())
a = list(map(int, input().split()))
m1 = sum(a) // n
m2 = (sum(a) + n - 1) // n
res1 = 0
res2 = 0
for i in range(n):
res1 += (a[i] - m1) ** 2
res2 += (a[i] - m2) ** 2
print(min(res1, res2))
| 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,206,562 |
s117921770 | p04031 | u806976856 | 1600491119 | Python | PyPy3 (7.3.0) | py | Accepted | 63 | 65404 | 178 | n=int(input())
a=list(map(int,input().split()))
mi=min(a)
ma=max(a)
i=mi
ans=10**10
while i<=ma:
x=sum((a[j]-i)**2 for j in range(n))
ans=min(ans,x)
i+=1
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,206,563 |
s190962298 | p04031 | u705418271 | 1600367655 | Python | Python (3.8.2) | py | Accepted | 31 | 9176 | 158 | ans=10**10
n=int(input())
a=list(map(int,input().split()))
for i in range(-100,101):
x=0
for j in range(n):
x+=(i-a[j])**2
ans=min(x,ans)
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,206,564 |
s340516051 | p04031 | u672316981 | 1600360195 | Python | Python (3.8.2) | py | Accepted | 35 | 9196 | 419 | def main():
n = int(input())
a_lst = list(map(int, input().split()))
minimum = min(a_lst)
maximum = max(a_lst)
cost = 10 ** 9
for i in range(maximum - minimum + 1):
tmp_cost = 0
std = minimum + i
for j in range(n):
a = a_lst[j]
tmp_cost += (a - st... | 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,206,565 |
s423354585 | p04031 | u698868214 | 1600273856 | Python | Python (3.8.2) | py | Accepted | 41 | 9128 | 218 | N = int(input())
A = list(map(int,input().split()))
min_a = min(A)
max_a = max(A)
ans = float("inf")
for i in range(min_a, max_a+1):
tmp = 0
for j in A:
tmp += (i - j) ** 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,206,566 |
s424781376 | p04031 | u113255362 | 1600229030 | Python | Python (3.8.2) | py | Accepted | 33 | 9132 | 268 | N=int(input())
List = list(map(int, input().split()))
sumS = 0
for i in range(N):
sumS +=List[i]
trial = sumS // N
mid = 0
res = 10000000
for i in range(N):
trial += i
mid = 0
for j in range(N):
mid += (trial - List[j])**2
res = min(res, mid)
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,206,567 |
s805587829 | p04031 | u794521826 | 1600223129 | Python | Python (3.8.2) | py | Accepted | 40 | 10740 | 249 | import math
from statistics import mean
n = int(input())
a = list(map(int, input().split()))
m = mean(a)
if m - math.floor(m) < 0.5:
m = math.floor(m)
else:
m = math.floor(m) + 1
diff = 0
for v in a:
diff += (m - v) ** 2
print(diff)
| 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,206,568 |
s848820409 | p04031 | u647999897 | 1600219698 | Python | PyPy3 (7.3.0) | py | Accepted | 62 | 64180 | 284 | def solve():
N = int(input())
A = list(map(int,input().split()))
ans = float('inf')
for i in range(-100, 100+1):
cnt = 0
for a in A:
cnt += (i-a) ** 2
ans = min(ans, cnt)
print(ans)
if __name__ == '__main__':
solve() | 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,206,569 |
s758090505 | p04031 | u612975321 | 1600215273 | Python | Python (3.8.2) | py | Accepted | 35 | 9108 | 182 | n = int(input())
a = list(map(int, input().split()))
ans = 10**9
for i in range(-100, 101):
cost = 0
for j in a:
cost += (j-i)**2
ans = min(ans, cost)
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,206,570 |
s064976781 | p04031 | u623814058 | 1600134393 | Python | Python (3.8.2) | py | Accepted | 31 | 9120 | 132 | N=input()
*A,=map(int,input().split())
a=float('inf')
for i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A]))
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,206,571 |
s911055242 | p04031 | u623814058 | 1600134272 | Python | Python (3.8.2) | py | Accepted | 37 | 9152 | 163 | N=int(input())
*A,=map(int,input().split())
mx=max(A)
mn=min(A)
ans=float('inf')
for i in range(mn,mx+1):
ans=min(ans, sum([(k-i)**2 for k in A]))
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,206,572 |
s952299381 | p04031 | u623814058 | 1600134171 | Python | Python (3.8.2) | py | Accepted | 35 | 9184 | 217 | N=int(input())
*A,=map(int,input().split())
mx=max(A)
mn=min(A)
if len(set(A))==1:
print(0)
else:
ans=float('inf')
for i in range(mn,mx):
ans=min(ans, sum([(k-i)**2 for k in A]))
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,206,573 |
s890368734 | p04031 | u381585104 | 1600068795 | Python | Python (3.8.2) | py | Accepted | 33 | 9136 | 770 |
class Combination:
def __init__(self, n, mod):
self.n = n
self.mod = mod
self.fac = [1 for i in range(self.n + 1)]
self.finv = [1 for i in range(self.n + 1)]
for i in range(2, self.n+1):
self.fac[i] = (self.fac[i - 1] * i) % self.mod
self.finv[i] = (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,206,574 |
s200797413 | p04031 | u477320129 | 1599957324 | Python | Python (3.8.2) | py | Accepted | 33 | 9128 | 679 | #!/usr/bin/env python3
import sys
def solve(N: int, a: "List[int]"):
ans = float("inf")
for m in range(-100, 101):
ans = min(ans,
sum((aa-m)**2 for aa in a))
return ans
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
def iterate_tokens():
... | 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,206,575 |
s929576690 | p04031 | u634079249 | 1599878732 | Python | Python (3.8.2) | py | Accepted | 36 | 9848 | 1,163 | import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque
sys.setrecursionlimit(10000000)
ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = ... | 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,206,576 |
s248990920 | p04031 | u006880673 | 1599864680 | Python | PyPy3 (7.3.0) | py | Accepted | 65 | 65544 | 181 | N=int(input())
a=list(map(int, input().split()))
ans = float("inf")
for num in range(-100, 101):
tmp = sum([(a[i]-num)**2 for i in range(N)])
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,206,577 |
s182015680 | p04031 | u630211216 | 1599830220 | Python | Python (3.8.2) | py | Accepted | 27 | 9108 | 149 | N=int(input())
a=list(map(int,input().split()))
A=sum(a)//N
B=(sum(a)-1)//N+1
print(min(sum((x-A)*(x-A) for x in a),sum((x-B)*(x-B) 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,206,578 |
s177991675 | p04031 | u250734103 | 1599807036 | Python | Python (3.8.2) | py | Accepted | 26 | 9036 | 191 | N = int(input())
a = list(map(int, input().split()))
my_round_int = lambda x: int((x * 2 + 1) // 2)
m = my_round_int(sum(a)/len(a))
cost = 0
for i in a:
cost += (i - m)**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,206,579 |
s660528027 | p04031 | u759109971 | 1599752737 | Python | Python (3.8.2) | py | Accepted | 26 | 9088 | 201 | N = int(input())
a = list(map(int, input().split()))
s = sum(a)
x = int(s / len(a))
if (x + 1) - (s / len(a)) < (s / len(a)) - x:
x += 1
cost = 0
for y in a:
cost += pow(y - x, 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,206,580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.