node_ids
sequencelengths 4
1.4k
| edge_index
sequencelengths 1
2.22k
| text
sequencelengths 4
1.4k
| source
stringlengths 14
427k
|
---|---|---|---|
[
7,
15,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
13,
4,
18,
13,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
4,
18,
17,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
13,
12
],
[
17,
16
],
[
20,
19
],
[
12,
24
],
[
12,
28
],
[
19,
29
],
[
16,
35
],
[
16,
39
],
[
12,
42
],
[
19,
43
],
[
46,
45
],
[
16,
50
],
[
45,
53
],
[
16,
53
],
[
62,
59
]
] | [
"import sys\n\ndef I(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef main():\n s = input()\n ans = []\n for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ans = \"\".join(ans)\n print(ans)\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"def I(): return int(sys.stdin.readline())",
"I",
"def MI(): return map(int, sys.stdin.readline().split())",
"MI",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"def main():\n s = input()\n ans = []\n for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ans = \"\".join(ans)\n print(ans)",
"main",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ",
"s[i] == 'B'",
"s[i]",
"s",
"i",
"'B'",
"if ans:\n ans.pop()\n ",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"ans.append(s[i])",
"ans.append",
"ans",
"append",
"s[i]",
"s",
"i",
"ans = \"\".join(ans)",
"ans",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"print(ans)",
"print",
"ans",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n s = input()\n ans = []\n for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ans = \"\".join(ans)\n print(ans)",
"def main():\n s = input()\n ans = []\n for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\n ans = \"\".join(ans)\n print(ans)",
"main",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"def LI(): return list(map(int, sys.stdin.readline().split()))",
"LI",
"def I(): return int(sys.stdin.readline())",
"def I(): return int(sys.stdin.readline())",
"I",
"def MI(): return map(int, sys.stdin.readline().split())",
"def MI(): return map(int, sys.stdin.readline().split())",
"MI"
] | import sys
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
s = input()
ans = []
for i in range(len(s)):
if s[i] == 'B':
if ans:
ans.pop()
else:
ans.append(s[i])
ans = "".join(ans)
print(ans)
if __name__ == '__main__':
main() |
[
7,
0,
13,
4,
13,
4,
13,
15,
13,
0,
13,
4,
18,
13,
13,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
40,
4,
13,
13,
17,
0,
13,
4,
18,
13,
13,
4,
18,
13,
13,
18,
13,
13,
0,
13,
4,
13,
42,
13,
0,
13,
4,
18,
13,
13,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13
] | [
[
75,
2
],
[
78,
10
],
[
17,
16
],
[
76,
22
],
[
76,
26
],
[
16,
27
],
[
79,
33
],
[
84,
36
],
[
79,
39
],
[
79,
43
],
[
76,
46
],
[
16,
47
],
[
69,
49
],
[
72,
55
],
[
79,
58
],
[
81,
61
],
[
70,
63
],
[
82,
63
],
[
73,
64
],
[
82,
67
],
[
70,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
],
[
84,
85
]
] | [
"S = str(input())\nimport collections\n\nQ = collections.deque()\n\nfor i in range (0, len(S)):\n\tif S[i] == 'B':\n\t\tif len(Q) >= 1:\n\t\t\tD = Q.pop()\n\telse:\n\t\tQ.append(S[i])\n\nT = str()\nwhile Q:\n\tV = Q.popleft()\n\tT=T+V\n \nprint(T)",
"S = str(input())",
"S",
"str(input())",
"str",
"input()",
"input",
"import collections",
"collections",
"Q = collections.deque()",
"Q",
"collections.deque()",
"collections.deque",
"collections",
"deque",
"for i in range (0, len(S)):\n\tif S[i] == 'B':\n\t\tif len(Q) >= 1:\n\t\t\tD = Q.pop()\n\telse:\n\t\tQ.append(S[i])",
"i",
"range (0, len(S))",
"range",
"0",
"len(S)",
"len",
"S",
"if S[i] == 'B':\n\t\tif len(Q) >= 1:\n\t\t\tD = Q.pop()\n\telse:\n\t\tQ.append(S[i])",
"S[i] == 'B'",
"S[i]",
"S",
"i",
"'B'",
"if len(Q) >= 1:\n\t\t\tD = Q.pop()\n\t",
"len(Q) >= 1",
"len(Q)",
"len",
"Q",
"1",
"D = Q.pop()",
"D",
"Q.pop()",
"Q.pop",
"Q",
"pop",
"Q.append(S[i])",
"Q.append",
"Q",
"append",
"S[i]",
"S",
"i",
"T = str()",
"T",
"str()",
"str",
"while Q:\n\tV = Q.popleft()\n\tT=T+V\n ",
"Q",
"V = Q.popleft()",
"V",
"Q.popleft()",
"Q.popleft",
"Q",
"popleft",
"T=T+V",
"T",
"T+V",
"T",
"V",
"print(T)",
"print",
"T",
"T = str()",
"str()",
"T",
"V = Q.popleft()",
"Q.popleft()",
"V",
"S = str(input())",
"str(input())",
"S",
"Q = collections.deque()",
"collections.deque()",
"Q",
"T=T+V",
"T+V",
"T",
"D = Q.pop()",
"Q.pop()",
"D"
] | S = str(input())
import collections
Q = collections.deque()
for i in range (0, len(S)):
if S[i] == 'B':
if len(Q) >= 1:
D = Q.pop()
else:
Q.append(S[i])
T = str()
while Q:
V = Q.popleft()
T=T+V
print(T) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
40,
13,
17,
0,
13,
2,
13,
13,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
2,
13,
10,
17,
13
] | [
[
30,
2
],
[
39,
6
],
[
10,
9
],
[
31,
9
],
[
9,
13
],
[
36,
16
],
[
40,
18
],
[
34,
18
],
[
37,
18
],
[
9,
19
],
[
33,
21
],
[
40,
23
],
[
34,
23
],
[
37,
23
],
[
34,
28
],
[
37,
28
],
[
40,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
]
] | [
"s = input()\n\nres = \"\"\nfor c in s:\n if c != \"B\":\n res = res + c\n else:\n res = res[:-1]\nprint(res)",
"s = input()",
"s",
"input()",
"input",
"res = \"\"",
"res",
"\"\"",
"for c in s:\n if c != \"B\":\n res = res + c\n else:\n res = res[:-1]",
"c",
"s",
"if c != \"B\":\n res = res + c\n else:\n res = res[:-1]",
"c != \"B\"",
"c",
"\"B\"",
"res = res + c",
"res",
"res + c",
"res",
"c",
"res = res[:-1]",
"res",
"res[:-1]",
"res",
":-1",
"-1",
"print(res)",
"print",
"res",
"s = input()",
"input()",
"s",
"res = res[:-1]",
"res[:-1]",
"res",
"res = res + c",
"res + c",
"res",
"res = \"\"",
"\"\"",
"res"
] | s = input()
res = ""
for c in s:
if c != "B":
res = res + c
else:
res = res[:-1]
print(res)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
24,
18,
13,
17,
14,
2,
4,
13,
13,
17,
0,
13,
39,
28,
13,
13,
0,
13,
13,
4,
13,
13,
10,
39,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
80,
2
],
[
74,
8
],
[
71,
11
],
[
15,
14
],
[
81,
19
],
[
81,
23
],
[
14,
24
],
[
72,
28
],
[
84,
28
],
[
81,
34
],
[
14,
35
],
[
72,
39
],
[
84,
39
],
[
72,
46
],
[
84,
46
],
[
72,
50
],
[
84,
50
],
[
72,
56
],
[
84,
56
],
[
83,
59
],
[
63,
62
],
[
84,
62
],
[
72,
62
],
[
77,
65
],
[
62,
66
],
[
78,
69
],
[
75,
69
],
[
71,
72
],
[
74,
75
],
[
62,
77
],
[
77,
78
],
[
80,
81
],
[
83,
84
]
] | [
"s = str(input())\nresult = \"\"\nres = []\n\nfor i in range(len(s)):\n if s[i] == \"0\":\n res.append(\"0\")\n elif s[i] == \"1\":\n res.append(\"1\")\n else:\n if len(res) > 1:\n del res[-1]\n elif len(res) == 1:\n res = []\n\nfor i in res:\n result += i\n\nprint(result)",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"result = \"\"",
"result",
"\"\"",
"res = []",
"res",
"[]",
"for i in range(len(s)):\n if s[i] == \"0\":\n res.append(\"0\")\n elif s[i] == \"1\":\n res.append(\"1\")\n else:\n if len(res) > 1:\n del res[-1]\n elif len(res) == 1:\n res = []",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == \"0\":\n res.append(\"0\")\n elif s[i] == \"1\":\n res.append(\"1\")\n else:\n if len(res) > 1:\n del res[-1]\n elif len(res) == 1:\n res = []",
"s[i] == \"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"res.append(\"0\")",
"res.append",
"res",
"append",
"\"0\"",
"elif s[i] == \"1\":\n res.append(\"1\")\n ",
"s[i] == \"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"res.append(\"1\")",
"res.append",
"res",
"append",
"\"1\"",
"if len(res) > 1:\n del res[-1]\n elif len(res) == 1:\n res = []",
"len(res) > 1",
"len(res)",
"len",
"res",
"1",
"del res[-1]",
"res[-1]",
"res",
"-1",
"elif len(res) == 1:\n res = []",
"len(res) == 1",
"len(res)",
"len",
"res",
"1",
"res = []",
"res",
"[]",
"for i in res:\n result += i",
"i",
"res",
"result += i",
"result",
"i",
"print(result)",
"print",
"result",
"res = []",
"[]",
"res",
"result = \"\"",
"\"\"",
"result",
"result += i",
"i",
"result",
"s = str(input())",
"str(input())",
"s",
"res = []",
"[]",
"res"
] | s = str(input())
result = ""
res = []
for i in range(len(s)):
if s[i] == "0":
res.append("0")
elif s[i] == "1":
res.append("1")
else:
if len(res) > 1:
del res[-1]
elif len(res) == 1:
res = []
for i in res:
result += i
print(result)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
14,
13,
0,
13,
18,
13,
39,
17,
9,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
18,
13
] | [
[
39,
2
],
[
42,
6
],
[
10,
9
],
[
40,
9
],
[
9,
14
],
[
9,
17
],
[
45,
20
],
[
9,
21
],
[
9,
24
],
[
48,
29
],
[
43,
31
],
[
49,
31
],
[
46,
31
],
[
49,
37
],
[
46,
37
],
[
43,
37
],
[
39,
40
],
[
42,
43
],
[
9,
45
],
[
45,
46
],
[
48,
49
]
] | [
"s = input()\nstr = ''\nfor char in s:\n if char == '0' or char == '1':\n str += char\n elif char == 'B':\n if str:\n str = str[:-1]\n else:\n continue\n\nprint(str)",
"s = input()",
"s",
"input()",
"input",
"str = ''",
"str",
"''",
"for char in s:\n if char == '0' or char == '1':\n str += char\n elif char == 'B':\n if str:\n str = str[:-1]\n else:\n continue",
"char",
"s",
"if char == '0' or char == '1':\n str += char\n elif char == 'B':\n if str:\n str = str[:-1]\n else:\n continue",
"char == '0' or char == '1'",
"char == '0'",
"char",
"'0'",
"char == '1'",
"char",
"'1'",
"str += char",
"str",
"char",
"elif char == 'B':\n if str:\n str = str[:-1]\n else:\n continue",
"char == 'B'",
"char",
"'B'",
"if str:\n str = str[:-1]\n else:\n continue",
"str",
"str = str[:-1]",
"str",
"str[:-1]",
"str",
":-1",
"-1",
"continue",
"print(str)",
"print",
"str",
"s = input()",
"input()",
"s",
"str = ''",
"''",
"str",
"str += char",
"char",
"str",
"str = str[:-1]",
"str[:-1]",
"str"
] | s = input()
str = ''
for char in s:
if char == '0' or char == '1':
str += char
elif char == 'B':
if str:
str = str[:-1]
else:
continue
print(str) |
[
7,
0,
13,
4,
13,
4,
13,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
40,
13,
17,
4,
18,
13,
13,
13,
14,
2,
4,
13,
13,
17,
4,
18,
13,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
47,
2
],
[
44,
11
],
[
15,
14
],
[
48,
14
],
[
14,
18
],
[
45,
22
],
[
14,
24
],
[
45,
29
],
[
45,
33
],
[
45,
42
],
[
44,
45
],
[
47,
48
]
] | [
"s = list(map(str, input()))\nt = []\nfor i in s:\n if i != 'B':\n t.append(i)\n else:\n if len(t) > 0:\n t.pop(-1)\nprint(''.join(t))",
"s = list(map(str, input()))",
"s",
"list(map(str, input()))",
"list",
"map(str, input())",
"map",
"str",
"input()",
"input",
"t = []",
"t",
"[]",
"for i in s:\n if i != 'B':\n t.append(i)\n else:\n if len(t) > 0:\n t.pop(-1)",
"i",
"s",
"if i != 'B':\n t.append(i)\n else:\n if len(t) > 0:\n t.pop(-1)",
"i != 'B'",
"i",
"'B'",
"t.append(i)",
"t.append",
"t",
"append",
"i",
"if len(t) > 0:\n t.pop(-1)",
"len(t) > 0",
"len(t)",
"len",
"t",
"0",
"t.pop(-1)",
"t.pop",
"t",
"pop",
"-1",
"print(''.join(t))",
"print",
"''.join(t)",
"''.join",
"''",
"join",
"t",
"t = []",
"[]",
"t",
"s = list(map(str, input()))",
"list(map(str, input()))",
"s"
] | s = list(map(str, input()))
t = []
for i in s:
if i != 'B':
t.append(i)
else:
if len(t) > 0:
t.pop(-1)
print(''.join(t))
|
[
7,
17,
15,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
38,
5,
4,
18,
13,
13,
0,
13,
17,
28,
13,
13,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] | [
[
57,
4
],
[
60,
8
],
[
13,
12
],
[
61,
12
],
[
12,
16
],
[
58,
20
],
[
12,
25
],
[
58,
29
],
[
12,
34
],
[
58,
40
],
[
66,
43
],
[
47,
46
],
[
58,
46
],
[
63,
49
],
[
67,
51
],
[
64,
51
],
[
46,
52
],
[
64,
55
],
[
67,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
]
] | [
"# https://atcoder.jp/contests/abc043/tasks/abc043_b\n\n\"\"\"\n双方向キューをつかって実装する\n\nこのどれかの操作ができる\n* 0 をキューに入れる\n* 1 をキューに入れる\n* キューの最後のものを出す\n\n注意: キューが空の場合にバックスペースをしても何も起きないようにする\n\"\"\"\n\nfrom collections import deque\n\nq = deque()\n\ns = input()\nfor operation in s:\n if operation == \"0\":\n # 右端に0を追加\n q.append(\"0\")\n\n elif operation == \"1\":\n # 右端に1を追加\n q.append(\"1\")\n\n elif operation == \"B\":\n # バックスペース\n # 右端を一つ削除\n # q の中身が空でもエラーにならないように例外処理\n try:\n q.pop()\n except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換\nanswer = \"\"\nfor i in q:\n answer = answer + i\n\nprint(answer)",
"\"\"\"\n双方向キューをつかって実装する\n\nこのどれかの操作ができる\n* 0 をキューに入れる\n* 1 をキューに入れる\n* キューの最後のものを出す\n\n注意: キューが空の場合にバックスペースをしても何も起きないようにする\n\"\"\"",
"from collections import deque",
"q = deque()",
"q",
"deque()",
"deque",
"s = input()",
"s",
"input()",
"input",
"for operation in s:\n if operation == \"0\":\n # 右端に0を追加\n q.append(\"0\")\n\n elif operation == \"1\":\n # 右端に1を追加\n q.append(\"1\")\n\n elif operation == \"B\":\n # バックスペース\n # 右端を一つ削除\n # q の中身が空でもエラーにならないように例外処理\n try:\n q.pop()\n except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換",
"operation",
"s",
"if operation == \"0\":\n # 右端に0を追加\n q.append(\"0\")\n\n elif operation == \"1\":\n # 右端に1を追加\n q.append(\"1\")\n\n elif operation == \"B\":\n # バックスペース\n # 右端を一つ削除\n # q の中身が空でもエラーにならないように例外処理\n try:\n q.pop()\n except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換",
"operation == \"0\"",
"operation",
"\"0\"",
"q.append(\"0\")",
"q.append",
"q",
"append",
"\"0\"",
"elif operation == \"1\":\n # 右端に1を追加\n q.append(\"1\")\n\n ",
"operation == \"1\"",
"operation",
"\"1\"",
"q.append(\"1\")",
"q.append",
"q",
"append",
"\"1\"",
"elif operation == \"B\":\n # バックスペース\n # 右端を一つ削除\n # q の中身が空でもエラーにならないように例外処理\n try:\n q.pop()\n except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換",
"operation == \"B\"",
"operation",
"\"B\"",
"try:\n q.pop()\n except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換",
"except IndexError:\n pass # 何もしない\n\n# キューの中身を順番に取り出して文字列に変換",
"q.pop()",
"q.pop",
"q",
"pop",
"answer = \"\"",
"answer",
"\"\"",
"for i in q:\n answer = answer + i",
"i",
"q",
"answer = answer + i",
"answer",
"answer + i",
"answer",
"i",
"print(answer)",
"print",
"answer",
"q = deque()",
"deque()",
"q",
"s = input()",
"input()",
"s",
"answer = answer + i",
"answer + i",
"answer",
"answer = \"\"",
"\"\"",
"answer"
] | # https://atcoder.jp/contests/abc043/tasks/abc043_b
"""
双方向キューをつかって実装する
このどれかの操作ができる
* 0 をキューに入れる
* 1 をキューに入れる
* キューの最後のものを出す
注意: キューが空の場合にバックスペースをしても何も起きないようにする
"""
from collections import deque
q = deque()
s = input()
for operation in s:
if operation == "0":
# 右端に0を追加
q.append("0")
elif operation == "1":
# 右端に1を追加
q.append("1")
elif operation == "B":
# バックスペース
# 右端を一つ削除
# q の中身が空でもエラーにならないように例外処理
try:
q.pop()
except IndexError:
pass # 何もしない
# キューの中身を順番に取り出して文字列に変換
answer = ""
for i in q:
answer = answer + i
print(answer)
|
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
14,
13,
4,
18,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
34,
2
],
[
37,
6
],
[
10,
9
],
[
35,
9
],
[
9,
13
],
[
38,
19
],
[
38,
23
],
[
9,
25
],
[
38,
32
],
[
34,
35
],
[
37,
38
]
] | [
"s = input()\ntemp = []\nfor c in s:\n if c == \"B\":\n if temp:\n temp.pop()\n else:\n temp.append(c)\nprint(\"\".join(temp))",
"s = input()",
"s",
"input()",
"input",
"temp = []",
"temp",
"[]",
"for c in s:\n if c == \"B\":\n if temp:\n temp.pop()\n else:\n temp.append(c)",
"c",
"s",
"if c == \"B\":\n if temp:\n temp.pop()\n else:\n temp.append(c)",
"c == \"B\"",
"c",
"\"B\"",
"if temp:\n temp.pop()\n ",
"temp",
"temp.pop()",
"temp.pop",
"temp",
"pop",
"temp.append(c)",
"temp.append",
"temp",
"append",
"c",
"print(\"\".join(temp))",
"print",
"\"\".join(temp)",
"\"\".join",
"\"\"",
"join",
"temp",
"s = input()",
"input()",
"s",
"temp = []",
"[]",
"temp"
] | s = input()
temp = []
for c in s:
if c == "B":
if temp:
temp.pop()
else:
temp.append(c)
print("".join(temp)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
13,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
45,
2
],
[
48,
8
],
[
12,
11
],
[
46,
11
],
[
11,
15
],
[
49,
19
],
[
11,
24
],
[
49,
28
],
[
49,
35
],
[
49,
43
],
[
45,
46
],
[
48,
49
]
] | [
"S = list(input())\nAns = []\nfor s in S:\n if s == \"0\":\n Ans.append(\"0\")\n elif s == \"1\":\n Ans.append(\"1\")\n else:\n if Ans:\n Ans.pop()\nprint(\"\".join(Ans))",
"S = list(input())",
"S",
"list(input())",
"list",
"input()",
"input",
"Ans = []",
"Ans",
"[]",
"for s in S:\n if s == \"0\":\n Ans.append(\"0\")\n elif s == \"1\":\n Ans.append(\"1\")\n else:\n if Ans:\n Ans.pop()",
"s",
"S",
"if s == \"0\":\n Ans.append(\"0\")\n elif s == \"1\":\n Ans.append(\"1\")\n else:\n if Ans:\n Ans.pop()",
"s == \"0\"",
"s",
"\"0\"",
"Ans.append(\"0\")",
"Ans.append",
"Ans",
"append",
"\"0\"",
"elif s == \"1\":\n Ans.append(\"1\")\n ",
"s == \"1\"",
"s",
"\"1\"",
"Ans.append(\"1\")",
"Ans.append",
"Ans",
"append",
"\"1\"",
"if Ans:\n Ans.pop()",
"Ans",
"Ans.pop()",
"Ans.pop",
"Ans",
"pop",
"print(\"\".join(Ans))",
"print",
"\"\".join(Ans)",
"\"\".join",
"\"\"",
"join",
"Ans",
"S = list(input())",
"list(input())",
"S",
"Ans = []",
"[]",
"Ans"
] | S = list(input())
Ans = []
for s in S:
if s == "0":
Ans.append("0")
elif s == "1":
Ans.append("1")
else:
if Ans:
Ans.pop()
print("".join(Ans)) |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
14,
40,
18,
13,
13,
17,
0,
13,
18,
13,
13,
14,
40,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
18,
13
] | [
[
45,
2
],
[
48,
6
],
[
46,
9
],
[
51,
11
],
[
15,
14
],
[
49,
17
],
[
46,
21
],
[
14,
22
],
[
54,
25
],
[
46,
27
],
[
14,
28
],
[
52,
33
],
[
58,
33
],
[
55,
33
],
[
57,
36
],
[
52,
38
],
[
58,
38
],
[
55,
38
],
[
58,
43
],
[
55,
43
],
[
52,
43
],
[
45,
46
],
[
48,
49
],
[
51,
52
],
[
54,
55
],
[
57,
58
]
] | [
"s = input()\nnum = len(s)\nans = \"\"\n\nfor i in range(num):\n if s[i] != 'B':\n ans += s[i]\n elif len(ans) != 0:\n ans = ans[:-1]\n\n \nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"num = len(s)",
"num",
"len(s)",
"len",
"s",
"ans = \"\"",
"ans",
"\"\"",
"for i in range(num):\n if s[i] != 'B':\n ans += s[i]\n elif len(ans) != 0:\n ans = ans[:-1]\n\n ",
"i",
"range(num)",
"range",
"num",
"if s[i] != 'B':\n ans += s[i]\n elif len(ans) != 0:\n ans = ans[:-1]\n\n ",
"s[i] != 'B'",
"s[i]",
"s",
"i",
"'B'",
"ans += s[i]",
"ans",
"s[i]",
"s",
"i",
"elif len(ans) != 0:\n ans = ans[:-1]\n\n ",
"len(ans) != 0",
"len(ans)",
"len",
"ans",
"0",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"num = len(s)",
"len(s)",
"num",
"ans = \"\"",
"\"\"",
"ans",
"ans += s[i]",
"s[i]",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans"
] | s = input()
num = len(s)
ans = ""
for i in range(num):
if s[i] != 'B':
ans += s[i]
elif len(ans) != 0:
ans = ans[:-1]
print(ans) |
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
9,
0,
13,
18,
13,
39,
17,
17,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
9,
8
],
[
12,
11
],
[
4,
16
],
[
4,
20
],
[
11,
21
],
[
25,
24
],
[
4,
29
],
[
11,
30
],
[
34,
33
],
[
4,
38
],
[
11,
39
],
[
8,
45
],
[
49,
45
],
[
33,
45
],
[
24,
45
],
[
50,
49
],
[
8,
51
],
[
49,
51
],
[
33,
51
],
[
24,
51
],
[
49,
57
],
[
33,
57
],
[
24,
57
],
[
8,
57
],
[
62,
59
]
] | [
"def hi():\n a = input()\n key = \"\"\n for i in range(len(a)):\n if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n print(key)\n\nhi()",
"def hi():\n a = input()\n key = \"\"\n for i in range(len(a)):\n if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n print(key)",
"hi",
"a = input()",
"a",
"input()",
"input",
"key = \"\"",
"key",
"\"\"",
"for i in range(len(a)):\n if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n ",
"i",
"range(len(a))",
"range",
"len(a)",
"len",
"a",
"if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n ",
"a[i]=='0'",
"a[i]",
"a",
"i",
"'0'",
"key += '0'",
"key",
"'0'",
"elif a[i]=='1':\n key += '1'\n ",
"a[i]=='1'",
"a[i]",
"a",
"i",
"'1'",
"key += '1'",
"key",
"'1'",
"elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n ",
"a[i]=='B'",
"a[i]",
"a",
"i",
"'B'",
"if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n ",
"len(key) == 0",
"len(key)",
"len",
"key",
"0",
"continue",
"key = key[0:-1]",
"key",
"key[0:-1]",
"key",
"0:-1",
"0",
"-1",
"print(key)",
"print",
"key",
"hi()",
"hi",
"def hi():\n a = input()\n key = \"\"\n for i in range(len(a)):\n if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n print(key)",
"def hi():\n a = input()\n key = \"\"\n for i in range(len(a)):\n if a[i]=='0':\n key += '0'\n elif a[i]=='1':\n key += '1'\n elif a[i]=='B':\n if len(key) == 0:\n continue\n else:\n key = key[0:-1]\n print(key)",
"hi"
] | def hi():
a = input()
key = ""
for i in range(len(a)):
if a[i]=='0':
key += '0'
elif a[i]=='1':
key += '1'
elif a[i]=='B':
if len(key) == 0:
continue
else:
key = key[0:-1]
print(key)
hi() |
[
7,
15,
13,
15,
15,
13,
15,
15,
13,
15,
15,
13,
15,
13,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
14,
2,
17,
4,
13,
13,
4,
18,
13,
13,
28,
13,
4,
13,
4,
13,
13,
4,
13,
18,
13,
13,
0,
13,
17,
10,
39,
13,
10,
4,
13
] | [
[
76,
15
],
[
73,
19
],
[
23,
22
],
[
77,
27
],
[
77,
32
],
[
22,
33
],
[
77,
37
],
[
22,
38
],
[
74,
42
],
[
77,
45
],
[
22,
46
],
[
74,
52
],
[
74,
55
],
[
59,
58
],
[
74,
63
],
[
74,
67
],
[
58,
68
],
[
71,
70
],
[
73,
74
],
[
76,
77
]
] | [
"# -*- coding: utf-8 -*-\n \n## Library\n \nimport sys\nfrom fractions import gcd\nimport math\nfrom math import ceil,floor\nimport collections\nfrom collections import Counter\nimport itertools\nimport copy\n \n## input\n \n# N=int(input())\n# A,B,C,D=map(int, input().split())\n# S = input()\n# yoko = list(map(int, input().split()))\n# tate = [int(input()) for _ in range(N)]\n# N, M = map(int,input().split()) \n# P = [list(map(int,input().split())) for i in range(M)]\n# S = []\n# for _ in range(N):\n# S.append(list(input()))\n \nS = input()\n\nans = []\n\nfor i in range(len(S)):\n if S[i] == \"0\" or S[i] == \"1\":\n ans.append(S[i])\n elif 0 < len(ans):\n ans.pop()\n\nfor i in range(len(ans)):\n print(ans[i], end='')",
"import sys",
"sys",
"from fractions import gcd",
"import math",
"math",
"from math import ceil,floor",
"import collections",
"collections",
"from collections import Counter",
"import itertools",
"itertools",
"import copy",
"copy",
"S = input()",
"S",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(S)):\n if S[i] == \"0\" or S[i] == \"1\":\n ans.append(S[i])\n elif 0 < len(ans):\n ans.pop()",
"i",
"range(len(S))",
"range",
"len(S)",
"len",
"S",
"if S[i] == \"0\" or S[i] == \"1\":\n ans.append(S[i])\n elif 0 < len(ans):\n ans.pop()",
"S[i] == \"0\" or S[i] == \"1\"",
"S[i] == \"0\"",
"S[i]",
"S",
"i",
"\"0\"",
"S[i] == \"1\"",
"S[i]",
"S",
"i",
"\"1\"",
"ans.append(S[i])",
"ans.append",
"ans",
"append",
"S[i]",
"S",
"i",
"elif 0 < len(ans):\n ans.pop()",
"0 < len(ans)",
"0",
"len(ans)",
"len",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"for i in range(len(ans)):\n print(ans[i], end='')",
"i",
"range(len(ans))",
"range",
"len(ans)",
"len",
"ans",
"print(ans[i], end='')",
"print",
"ans[i]",
"ans",
"i",
"end=''",
"end",
"''",
"ans = []",
"[]",
"ans",
"S = input()",
"input()",
"S"
] | # -*- coding: utf-8 -*-
## Library
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
## input
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split())
# P = [list(map(int,input().split())) for i in range(M)]
# S = []
# for _ in range(N):
# S.append(list(input()))
S = input()
ans = []
for i in range(len(S)):
if S[i] == "0" or S[i] == "1":
ans.append(S[i])
elif 0 < len(ans):
ans.pop()
for i in range(len(ans)):
print(ans[i], end='') |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
40,
13,
17,
0,
13,
2,
13,
13,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] | [
[
36,
2
],
[
33,
6
],
[
10,
9
],
[
37,
9
],
[
9,
13
],
[
39,
16
],
[
34,
18
],
[
31,
18
],
[
40,
18
],
[
9,
19
],
[
30,
21
],
[
34,
23
],
[
31,
23
],
[
40,
23
],
[
31,
28
],
[
40,
28
],
[
34,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
]
] | [
"s = input()\nans = ''\nfor i in s:\n if i != 'B':\n ans = ans + i\n else:\n ans = ans[:-1]\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = ''",
"ans",
"''",
"for i in s:\n if i != 'B':\n ans = ans + i\n else:\n ans = ans[:-1]",
"i",
"s",
"if i != 'B':\n ans = ans + i\n else:\n ans = ans[:-1]",
"i != 'B'",
"i",
"'B'",
"ans = ans + i",
"ans",
"ans + i",
"ans",
"i",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans",
"ans = ''",
"''",
"ans",
"s = input()",
"input()",
"s",
"ans = ans + i",
"ans + i",
"ans"
] | s = input()
ans = ''
for i in s:
if i != 'B':
ans = ans + i
else:
ans = ans[:-1]
print(ans) |
[
7,
15,
15,
13,
15,
13,
0,
13,
12,
4,
13,
4,
13,
0,
13,
12,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
12,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
17,
0,
13,
18,
13,
13,
4,
13,
13,
10,
17,
13,
10,
12,
13,
10,
18,
13,
10,
12,
13,
10,
12,
13,
10,
18,
13,
10,
4,
13
] | [
[
91,
7
],
[
82,
14
],
[
88,
25
],
[
97,
38
],
[
79,
42
],
[
46,
45
],
[
98,
50
],
[
98,
54
],
[
45,
55
],
[
80,
61
],
[
86,
61
],
[
95,
61
],
[
94,
64
],
[
80,
66
],
[
86,
66
],
[
95,
66
],
[
85,
71
],
[
98,
73
],
[
45,
74
],
[
86,
77
],
[
95,
77
],
[
80,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
],
[
97,
98
]
] | [
"from sys import exit\nimport math\nimport collections\nii = lambda : int(input())\nmi = lambda : map(int,input().split())\nli = lambda : list(map(int,input().split()))\n\ns = input()\n\nans = ''\nfor i in range(len(s)):\n if s[i] == 'B':\n if len(ans) == 0: continue\n ans = ans[0:-1]\n else:\n ans += s[i]\nprint(ans)",
"from sys import exit",
"import math",
"math",
"import collections",
"collections",
"ii = lambda : int(input())",
"ii",
"lambda : int(input())",
"int(input())",
"int",
"input()",
"input",
"mi = lambda : map(int,input().split())",
"mi",
"lambda : map(int,input().split())",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"li = lambda : list(map(int,input().split()))",
"li",
"lambda : list(map(int,input().split()))",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"s = input()",
"s",
"input()",
"input",
"ans = ''",
"ans",
"''",
"for i in range(len(s)):\n if s[i] == 'B':\n if len(ans) == 0: continue\n ans = ans[0:-1]\n else:\n ans += s[i]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == 'B':\n if len(ans) == 0: continue\n ans = ans[0:-1]\n else:\n ans += s[i]",
"s[i] == 'B'",
"s[i]",
"s",
"i",
"'B'",
"if len(ans) == 0: continue\n ",
"len(ans) == 0",
"len(ans)",
"len",
"ans",
"0",
"ans = ans[0:-1]",
"ans",
"ans[0:-1]",
"ans",
"0:-1",
"0",
"-1",
"ans += s[i]",
"ans",
"s[i]",
"s",
"i",
"print(ans)",
"print",
"ans",
"ans = ''",
"''",
"ans",
"mi = lambda : map(int,input().split())",
"lambda : map(int,input().split())",
"mi",
"ans += s[i]",
"s[i]",
"ans",
"li = lambda : list(map(int,input().split()))",
"lambda : list(map(int,input().split()))",
"li",
"ii = lambda : int(input())",
"lambda : int(input())",
"ii",
"ans = ans[0:-1]",
"ans[0:-1]",
"ans",
"s = input()",
"input()",
"s"
] | from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))
s = input()
ans = ''
for i in range(len(s)):
if s[i] == 'B':
if len(ans) == 0: continue
ans = ans[0:-1]
else:
ans += s[i]
print(ans) |
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
40,
4,
13,
13,
17,
4,
18,
13,
13,
0,
13,
4,
18,
17,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
63,
3
],
[
60,
7
],
[
12,
11
],
[
64,
16
],
[
64,
20
],
[
11,
21
],
[
61,
25
],
[
64,
31
],
[
11,
32
],
[
61,
36
],
[
61,
43
],
[
61,
47
],
[
66,
50
],
[
61,
55
],
[
67,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
]
] | [
"from collections import deque\ns=input()\n\nd=deque()\nfor i in range(len(s)):\n if s[i]==\"1\":\n d.append(\"1\")\n elif s[i]==\"0\":\n d.append(\"0\")\n else:\n if len(d)!=0:\n d.pop()\n\nL=\"\".join(d)\nprint(L)",
"from collections import deque",
"s=input()",
"s",
"input()",
"input",
"d=deque()",
"d",
"deque()",
"deque",
"for i in range(len(s)):\n if s[i]==\"1\":\n d.append(\"1\")\n elif s[i]==\"0\":\n d.append(\"0\")\n else:\n if len(d)!=0:\n d.pop()",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]==\"1\":\n d.append(\"1\")\n elif s[i]==\"0\":\n d.append(\"0\")\n else:\n if len(d)!=0:\n d.pop()",
"s[i]==\"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"d.append(\"1\")",
"d.append",
"d",
"append",
"\"1\"",
"elif s[i]==\"0\":\n d.append(\"0\")\n ",
"s[i]==\"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"d.append(\"0\")",
"d.append",
"d",
"append",
"\"0\"",
"if len(d)!=0:\n d.pop()",
"len(d)!=0",
"len(d)",
"len",
"d",
"0",
"d.pop()",
"d.pop",
"d",
"pop",
"L=\"\".join(d)",
"L",
"\"\".join(d)",
"\"\".join",
"\"\"",
"join",
"d",
"print(L)",
"print",
"L",
"d=deque()",
"deque()",
"d",
"s=input()",
"input()",
"s",
"L=\"\".join(d)",
"\"\".join(d)",
"L"
] | from collections import deque
s=input()
d=deque()
for i in range(len(s)):
if s[i]=="1":
d.append("1")
elif s[i]=="0":
d.append("0")
else:
if len(d)!=0:
d.pop()
L="".join(d)
print(L) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
39,
17,
0,
13,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
18,
13
] | [
[
28,
2
],
[
34,
6
],
[
10,
9
],
[
29,
9
],
[
9,
13
],
[
37,
16
],
[
35,
18
],
[
32,
18
],
[
38,
18
],
[
31,
22
],
[
9,
23
],
[
32,
26
],
[
38,
26
],
[
35,
26
],
[
28,
29
],
[
9,
31
],
[
31,
32
],
[
34,
35
],
[
37,
38
]
] | [
"s=input()\na=''\n\nfor i in s:\n if i=='B':\n a=a[:-1]\n \n else:\n a+=i\nprint(a)",
"s=input()",
"s",
"input()",
"input",
"a=''",
"a",
"''",
"for i in s:\n if i=='B':\n a=a[:-1]\n \n else:\n a+=i",
"i",
"s",
"if i=='B':\n a=a[:-1]\n \n else:\n a+=i",
"i=='B'",
"i",
"'B'",
"a=a[:-1]",
"a",
"a[:-1]",
"a",
":-1",
"-1",
"a+=i",
"a",
"i",
"print(a)",
"print",
"a",
"s=input()",
"input()",
"s",
"a+=i",
"i",
"a",
"a=''",
"''",
"a",
"a=a[:-1]",
"a[:-1]",
"a"
] | s=input()
a=''
for i in s:
if i=='B':
a=a[:-1]
else:
a+=i
print(a)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
40,
18,
13,
13,
17,
0,
13,
18,
13,
13,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] | [
[
36,
2
],
[
45,
6
],
[
10,
9
],
[
37,
14
],
[
37,
18
],
[
9,
19
],
[
39,
22
],
[
37,
24
],
[
9,
25
],
[
42,
27
],
[
46,
29
],
[
43,
29
],
[
40,
29
],
[
43,
34
],
[
40,
34
],
[
46,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
]
] | [
"s=input()\nres=\"\"\nfor i in range(len(s)):\n if s[i]!=\"B\":\n res+=s[i]\n else:\n res=res[:-1]\nprint(res)",
"s=input()",
"s",
"input()",
"input",
"res=\"\"",
"res",
"\"\"",
"for i in range(len(s)):\n if s[i]!=\"B\":\n res+=s[i]\n else:\n res=res[:-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]!=\"B\":\n res+=s[i]\n else:\n res=res[:-1]",
"s[i]!=\"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"res+=s[i]",
"res",
"s[i]",
"s",
"i",
"res=res[:-1]",
"res",
"res[:-1]",
"res",
":-1",
"-1",
"print(res)",
"print",
"res",
"s=input()",
"input()",
"s",
"res+=s[i]",
"s[i]",
"res",
"res=res[:-1]",
"res[:-1]",
"res",
"res=\"\"",
"\"\"",
"res"
] | s=input()
res=""
for i in range(len(s)):
if s[i]!="B":
res+=s[i]
else:
res=res[:-1]
print(res) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
39,
17,
0,
13,
2,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13
] | [
[
30,
2
],
[
33,
6
],
[
10,
9
],
[
31,
9
],
[
9,
13
],
[
36,
16
],
[
34,
18
],
[
40,
18
],
[
37,
18
],
[
39,
22
],
[
34,
24
],
[
40,
24
],
[
37,
24
],
[
9,
25
],
[
40,
28
],
[
37,
28
],
[
34,
28
],
[
30,
31
],
[
33,
34
],
[
36,
37
],
[
39,
40
]
] | [
"s = input()\n\nans = \"\"\nfor c in s:\n if c=='B':\n ans = ans[:-1]\n else:\n ans = ans + c\n\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = \"\"",
"ans",
"\"\"",
"for c in s:\n if c=='B':\n ans = ans[:-1]\n else:\n ans = ans + c",
"c",
"s",
"if c=='B':\n ans = ans[:-1]\n else:\n ans = ans + c",
"c=='B'",
"c",
"'B'",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"ans = ans + c",
"ans",
"ans + c",
"ans",
"c",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"ans = \"\"",
"\"\"",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans",
"ans = ans + c",
"ans + c",
"ans"
] | s = input()
ans = ""
for c in s:
if c=='B':
ans = ans[:-1]
else:
ans = ans + c
print(ans) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
4,
13,
13,
14,
2,
2,
13,
17,
40,
4,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
2,
13,
17,
2,
13,
17,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
50,
2
],
[
53,
6
],
[
51,
13
],
[
54,
22
],
[
54,
26
],
[
54,
39
],
[
54,
48
],
[
50,
51
],
[
53,
54
]
] | [
"#!/usr/bin/env python\n# coding: utf-8\n\n# In[5]:\n\n\ns = input()\n\n\n# In[6]:\n\n\nans = []\nfor i,w in enumerate(s):\n if w == \"B\" and len(ans) != 0:\n ans.pop(-1)\n elif w == \"0\" or w == \"1\":\n ans.append(w)\nprint(\"\".join(ans))\n\n\n# In[ ]:\n\n\n\n",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i,w in enumerate(s):\n if w == \"B\" and len(ans) != 0:\n ans.pop(-1)\n elif w == \"0\" or w == \"1\":\n ans.append(w)",
"i",
"w",
"enumerate(s)",
"enumerate",
"s",
"if w == \"B\" and len(ans) != 0:\n ans.pop(-1)\n elif w == \"0\" or w == \"1\":\n ans.append(w)",
"w == \"B\" and len(ans) != 0",
"w == \"B\"",
"w",
"\"B\"",
"len(ans) != 0",
"len(ans)",
"len",
"ans",
"0",
"ans.pop(-1)",
"ans.pop",
"ans",
"pop",
"-1",
"elif w == \"0\" or w == \"1\":\n ans.append(w)",
"w == \"0\" or w == \"1\"",
"w == \"0\"",
"w",
"\"0\"",
"w == \"1\"",
"w",
"\"1\"",
"ans.append(w)",
"ans.append",
"ans",
"append",
"w",
"print(\"\".join(ans))",
"print",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"s = input()",
"input()",
"s",
"ans = []",
"[]",
"ans"
] | #!/usr/bin/env python
# coding: utf-8
# In[5]:
s = input()
# In[6]:
ans = []
for i,w in enumerate(s):
if w == "B" and len(ans) != 0:
ans.pop(-1)
elif w == "0" or w == "1":
ans.append(w)
print("".join(ans))
# In[ ]:
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
0,
13,
18,
13,
39,
17,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13
] | [
[
36,
2
],
[
39,
6
],
[
10,
9
],
[
37,
9
],
[
9,
13
],
[
42,
16
],
[
9,
20
],
[
48,
23
],
[
45,
26
],
[
40,
28
],
[
46,
28
],
[
49,
28
],
[
43,
28
],
[
46,
34
],
[
49,
34
],
[
43,
34
],
[
40,
34
],
[
36,
37
],
[
39,
40
],
[
42,
43
],
[
45,
46
],
[
48,
49
]
] | [
"s = input()\n\nans=''\nfor i in s:\n if i == '0':\n ans += '0'\n elif i =='1':\n ans += '1'\n else:\n ans = ans[0:-1]\n\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans=''",
"ans",
"''",
"for i in s:\n if i == '0':\n ans += '0'\n elif i =='1':\n ans += '1'\n else:\n ans = ans[0:-1]",
"i",
"s",
"if i == '0':\n ans += '0'\n elif i =='1':\n ans += '1'\n else:\n ans = ans[0:-1]",
"i == '0'",
"i",
"'0'",
"ans += '0'",
"ans",
"'0'",
"elif i =='1':\n ans += '1'\n ",
"i =='1'",
"i",
"'1'",
"ans += '1'",
"ans",
"'1'",
"ans = ans[0:-1]",
"ans",
"ans[0:-1]",
"ans",
"0:-1",
"0",
"-1",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"ans=''",
"''",
"ans",
"ans += '0'",
"'0'",
"ans",
"ans = ans[0:-1]",
"ans[0:-1]",
"ans",
"ans += '1'",
"'1'",
"ans"
] | s = input()
ans=''
for i in s:
if i == '0':
ans += '0'
elif i =='1':
ans += '1'
else:
ans = ans[0:-1]
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
42,
2,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
13,
17,
24,
18,
13,
17,
0,
13,
17,
24,
18,
13,
39,
2,
13,
17,
2,
13,
17,
0,
13,
17,
0,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13
] | [
[
66,
2
],
[
69,
8
],
[
70,
12
],
[
61,
12
],
[
58,
12
],
[
64,
12
],
[
67,
15
],
[
67,
19
],
[
70,
20
],
[
61,
20
],
[
58,
20
],
[
64,
20
],
[
70,
24
],
[
61,
24
],
[
58,
24
],
[
64,
24
],
[
67,
28
],
[
63,
31
],
[
67,
35
],
[
70,
38
],
[
61,
38
],
[
58,
38
],
[
64,
38
],
[
70,
41
],
[
61,
41
],
[
58,
41
],
[
64,
41
],
[
57,
44
],
[
60,
47
],
[
67,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
]
] | [
"s = list(input())\n\ni = 0\nwhile i < len(s):\n if s[i] == \"B\":\n if i == 0:\n del s[0]\n i -= 1\n else:\n del s[i-1:i+1]\n i -= 2\n\n i += 1\n\nprint(\"\".join(s))",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"i = 0",
"i",
"0",
"while i < len(s):\n if s[i] == \"B\":\n if i == 0:\n del s[0]\n i -= 1\n else:\n del s[i-1:i+1]\n i -= 2\n\n i += 1",
"i < len(s)",
"i",
"len(s)",
"len",
"s",
"if s[i] == \"B\":\n if i == 0:\n del s[0]\n i -= 1\n else:\n del s[i-1:i+1]\n i -= 2\n\n ",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"if i == 0:\n del s[0]\n i -= 1\n else:\n del s[i-1:i+1]\n i -= 2\n\n ",
"i == 0",
"i",
"0",
"del s[0]",
"s[0]",
"s",
"0",
"i -= 1",
"i",
"1",
"del s[i-1:i+1]",
"s[i-1:i+1]",
"s",
"i-1:i+1",
"i-1",
"i",
"1",
"i+1",
"i",
"1",
"i -= 2",
"i",
"2",
"i += 1",
"i",
"1",
"print(\"\".join(s))",
"print",
"\"\".join(s)",
"\"\".join",
"\"\"",
"join",
"s",
"i -= 2",
"2",
"i",
"i += 1",
"1",
"i",
"i -= 1",
"1",
"i",
"s = list(input())",
"list(input())",
"s",
"i = 0",
"0",
"i"
] | s = list(input())
i = 0
while i < len(s):
if s[i] == "B":
if i == 0:
del s[0]
i -= 1
else:
del s[i-1:i+1]
i -= 2
i += 1
print("".join(s)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
14,
2,
13,
39,
24,
18,
13,
17,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
38,
2
],
[
41,
8
],
[
12,
11
],
[
39,
11
],
[
11,
15
],
[
42,
19
],
[
42,
23
],
[
42,
27
],
[
11,
29
],
[
42,
36
],
[
38,
39
],
[
41,
42
]
] | [
"s = list(input())\nans = []\nfor i in s:\n if i == \"B\":\n if ans == []:\n pass\n else:\n del ans[-1]\n else:\n ans.append(i)\nprint(\"\".join(ans))",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in s:\n if i == \"B\":\n if ans == []:\n pass\n else:\n del ans[-1]\n else:\n ans.append(i)",
"i",
"s",
"if i == \"B\":\n if ans == []:\n pass\n else:\n del ans[-1]\n else:\n ans.append(i)",
"i == \"B\"",
"i",
"\"B\"",
"if ans == []:\n pass\n else:\n del ans[-1]\n ",
"ans == []",
"ans",
"[]",
"del ans[-1]",
"ans[-1]",
"ans",
"-1",
"ans.append(i)",
"ans.append",
"ans",
"append",
"i",
"print(\"\".join(ans))",
"print",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"s = list(input())",
"list(input())",
"s",
"ans = []",
"[]",
"ans"
] | s = list(input())
ans = []
for i in s:
if i == "B":
if ans == []:
pass
else:
del ans[-1]
else:
ans.append(i)
print("".join(ans)) |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
38,
5,
0,
13,
17,
4,
18,
13,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
17,
13,
10,
39,
13,
10,
4,
13,
10,
4,
13
] | [
[
63,
2
],
[
66,
6
],
[
64,
9
],
[
60,
11
],
[
15,
14
],
[
64,
19
],
[
67,
24
],
[
14,
25
],
[
67,
29
],
[
14,
30
],
[
61,
34
],
[
67,
37
],
[
14,
38
],
[
57,
42
],
[
61,
46
],
[
61,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
]
] | [
"\ns = input()\nc = list(s)\nans_list = []\n\nfor i in range(len(s)):\n if(c[i]==\"0\" or c[i]==\"1\"):\n ans_list.append(c[i])\n else:\n try:\n ans_list.pop(-1)\n except:\n a = 0\n\nprint(\"\".join(ans_list))",
"s = input()",
"s",
"input()",
"input",
"c = list(s)",
"c",
"list(s)",
"list",
"s",
"ans_list = []",
"ans_list",
"[]",
"for i in range(len(s)):\n if(c[i]==\"0\" or c[i]==\"1\"):\n ans_list.append(c[i])\n else:\n try:\n ans_list.pop(-1)\n except:\n a = 0",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if(c[i]==\"0\" or c[i]==\"1\"):\n ans_list.append(c[i])\n else:\n try:\n ans_list.pop(-1)\n except:\n a = 0",
"c[i]==\"0\" or c[i]==\"1\"",
"c[i]==\"0\"",
"c[i]",
"c",
"i",
"\"0\"",
"c[i]==\"1\"",
"c[i]",
"c",
"i",
"\"1\"",
"ans_list.append(c[i])",
"ans_list.append",
"ans_list",
"append",
"c[i]",
"c",
"i",
"try:\n ans_list.pop(-1)\n except:\n a = 0",
"except:\n a = 0",
"a = 0",
"a",
"0",
"ans_list.pop(-1)",
"ans_list.pop",
"ans_list",
"pop",
"-1",
"print(\"\".join(ans_list))",
"print",
"\"\".join(ans_list)",
"\"\".join",
"\"\"",
"join",
"ans_list",
"a = 0",
"0",
"a",
"ans_list = []",
"[]",
"ans_list",
"s = input()",
"input()",
"s",
"c = list(s)",
"list(s)",
"c"
] |
s = input()
c = list(s)
ans_list = []
for i in range(len(s)):
if(c[i]=="0" or c[i]=="1"):
ans_list.append(c[i])
else:
try:
ans_list.pop(-1)
except:
a = 0
print("".join(ans_list))
|
[
7,
15,
13,
12,
13,
29,
4,
18,
4,
18,
18,
13,
13,
13,
13,
12,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
13,
14,
2,
13,
17,
0,
13,
18,
13,
39,
17,
17,
29,
13,
23,
13,
12,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
19,
18
],
[
22,
21
],
[
51,
21
],
[
21,
25
],
[
29,
28
],
[
21,
29
],
[
21,
32
],
[
36,
35
],
[
21,
36
],
[
21,
39
],
[
43,
42
],
[
18,
44
],
[
42,
44
],
[
35,
44
],
[
28,
44
],
[
42,
49
],
[
35,
49
],
[
28,
49
],
[
18,
49
],
[
51,
51
],
[
56,
55
],
[
71,
57
],
[
77,
61
],
[
55,
62
],
[
74,
68
]
] | [
"#!/usr/bin/python\n# -*- coding: UTF-8 -*-\n\nimport sys\n\n\ndef std_in():\n return sys.stdin.readline().strip()\n\n\ndef editor(s):\n d = \"\"\n for c in s:\n if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n return d\n\n\ndef _main():\n s = std_in()\n print(editor(s))\n\n\nif __name__ == \"__main__\":\n _main()",
"import sys",
"sys",
"def std_in():\n return sys.stdin.readline().strip()",
"std_in",
"return sys.stdin.readline().strip()",
"sys.stdin.readline().strip()",
"sys.stdin.readline().strip",
"sys.stdin.readline()",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"strip",
"def editor(s):\n d = \"\"\n for c in s:\n if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n return d",
"editor",
"d = \"\"",
"d",
"\"\"",
"for c in s:\n if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n ",
"c",
"s",
"if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n ",
"c == \"0\"",
"c",
"\"0\"",
"d += c",
"d",
"c",
"elif c == \"1\":\n d += c\n ",
"c == \"1\"",
"c",
"\"1\"",
"d += c",
"d",
"c",
"elif c == \"B\":\n d = d[0:-1]\n ",
"c == \"B\"",
"c",
"\"B\"",
"d = d[0:-1]",
"d",
"d[0:-1]",
"d",
"0:-1",
"0",
"-1",
"return d",
"d",
"s",
"s",
"def _main():\n s = std_in()\n print(editor(s))",
"_main",
"s = std_in()",
"s",
"std_in()",
"std_in",
"print(editor(s))",
"print",
"editor(s)",
"editor",
"s",
"if __name__ == \"__main__\":\n _main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"_main()",
"_main",
"def std_in():\n return sys.stdin.readline().strip()",
"def std_in():\n return sys.stdin.readline().strip()",
"std_in",
"def _main():\n s = std_in()\n print(editor(s))",
"def _main():\n s = std_in()\n print(editor(s))",
"_main",
"def editor(s):\n d = \"\"\n for c in s:\n if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n return d",
"def editor(s):\n d = \"\"\n for c in s:\n if c == \"0\":\n d += c\n elif c == \"1\":\n d += c\n elif c == \"B\":\n d = d[0:-1]\n return d",
"editor"
] | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
def std_in():
return sys.stdin.readline().strip()
def editor(s):
d = ""
for c in s:
if c == "0":
d += c
elif c == "1":
d += c
elif c == "B":
d = d[0:-1]
return d
def _main():
s = std_in()
print(editor(s))
if __name__ == "__main__":
_main()
|
[
7,
0,
13,
39,
28,
13,
4,
13,
14,
2,
13,
17,
14,
13,
4,
18,
13,
13,
13,
4,
13,
31,
13,
0,
13,
17,
10,
39,
13
] | [
[
27,
2
],
[
6,
5
],
[
5,
10
],
[
28,
16
],
[
5,
18
],
[
28,
22
],
[
25,
24
],
[
27,
28
]
] | [
"n=[]\nfor i in input():\n if i=='B':\n if n: n.pop()\n else:\n n.append(i)\nprint(*n,sep='')",
"n=[]",
"n",
"[]",
"for i in input():\n if i=='B':\n if n: n.pop()\n else:\n n.append(i)",
"i",
"input()",
"input",
"if i=='B':\n if n: n.pop()\n else:\n n.append(i)",
"i=='B'",
"i",
"'B'",
"if n: n.pop()\n ",
"n",
"n.append(i)",
"n.append",
"n",
"append",
"i",
"print(*n,sep='')",
"print",
"*n",
"n",
"sep=''",
"sep",
"''",
"n=[]",
"[]",
"n"
] | n=[]
for i in input():
if i=='B':
if n: n.pop()
else:
n.append(i)
print(*n,sep='') |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
40,
13,
17,
0,
13,
13,
14,
40,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] | [
[
35,
2
],
[
38,
6
],
[
10,
9
],
[
36,
9
],
[
9,
13
],
[
32,
16
],
[
9,
17
],
[
9,
20
],
[
41,
23
],
[
39,
25
],
[
42,
25
],
[
33,
25
],
[
42,
30
],
[
33,
30
],
[
39,
30
],
[
9,
32
],
[
32,
33
],
[
35,
36
],
[
38,
39
],
[
41,
42
]
] | [
"s=input()\n \nans=''\nfor x in s:\n if x!='B':\n ans+=x\n else:\n if x!='':\n ans=ans[:-1]\nprint(ans)",
"s=input()",
"s",
"input()",
"input",
"ans=''",
"ans",
"''",
"for x in s:\n if x!='B':\n ans+=x\n else:\n if x!='':\n ans=ans[:-1]",
"x",
"s",
"if x!='B':\n ans+=x\n else:\n if x!='':\n ans=ans[:-1]",
"x!='B'",
"x",
"'B'",
"ans+=x",
"ans",
"x",
"if x!='':\n ans=ans[:-1]",
"x!=''",
"x",
"''",
"ans=ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"ans+=x",
"x",
"ans",
"s=input()",
"input()",
"s",
"ans=''",
"''",
"ans",
"ans=ans[:-1]",
"ans[:-1]",
"ans"
] | s=input()
ans=''
for x in s:
if x!='B':
ans+=x
else:
if x!='':
ans=ans[:-1]
print(ans) |
[
7,
15,
13,
15,
15,
15,
15,
15,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
29,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
39,
4,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
4,
13,
8,
13,
18,
13,
17,
18,
13,
17,
23,
13,
23,
13,
39,
17,
17,
12,
13,
28,
13,
13,
4,
13,
13,
0,
13,
13,
23,
13,
23,
13,
17,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
39,
2,
4,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
12,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
2,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13
] | [
[
179,
16
],
[
173,
21
],
[
170,
24
],
[
85,
77
],
[
87,
79
],
[
87,
82
],
[
85,
85
],
[
88,
87
],
[
95,
94
],
[
103,
94
],
[
94,
98
],
[
101,
100
],
[
105,
101
],
[
103,
103
],
[
106,
105
],
[
161,
108
],
[
167,
112
],
[
116,
115
],
[
162,
120
],
[
162,
124
],
[
115,
125
],
[
168,
131
],
[
165,
131
],
[
164,
134
],
[
168,
136
],
[
165,
136
],
[
168,
141
],
[
165,
141
],
[
168,
145
],
[
165,
145
],
[
162,
148
],
[
115,
149
],
[
165,
156
],
[
168,
156
],
[
161,
162
],
[
164,
165
],
[
167,
168
],
[
170,
171
],
[
173,
174
],
[
179,
180
]
] | [
"import sys\nfrom sys import exit\nfrom collections import deque\nfrom bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)\nfrom heapq import heapify, heappop, heappush\nfrom math import *\n\nsys.setrecursionlimit(10**6)\nINF = 10**20\neps = 1.0e-20\nMOD = 10**9+7\n\ndef mint():\n return map(int,input().split())\ndef lint():\n return list(map(int,input().split()))\ndef ilint():\n return int(input()), list(map(int,input().split()))\ndef judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])\ndef lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)\n\ns = input()\nt = []\nfor i in range(len(s)):\n if s[i]=='B':\n if len(t)>0:\n t = t[:len(t)-1]\n else:\n t.append(s[i])\nprint(''.join(t))",
"import sys",
"sys",
"from sys import exit",
"from collections import deque",
"from bisect import bisect_left, bisect_right, insort_left, insort_right",
"from heapq import heapify, heappop, heappush",
"from math import *",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"INF = 10**20",
"INF",
"10**20",
"10",
"20",
"eps = 1.0e-20",
"eps",
"1.0e-20",
"MOD = 10**9+7",
"MOD",
"10**9+7",
"10**9",
"10",
"9",
"7",
"def mint():\n return map(int,input().split())",
"mint",
"return map(int,input().split())",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def lint():\n return list(map(int,input().split()))",
"lint",
"return list(map(int,input().split()))",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"ilint",
"return int(input()), list(map(int,input().split()))",
"return int(input()), list(map(int,input().split()))",
"int(input())",
"int",
"input()",
"input",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"judge",
"print(l[0] if x else l[1])",
"print",
"l[0] if x else l[1]",
"x",
"l[0]",
"l",
"0",
"l[1]",
"l",
"1",
"x",
"x",
"l=['Yes', 'No']",
"l",
"['Yes', 'No']",
"'Yes'",
"'No'",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"lprint",
"for x in l:\n print(x, end=sep)",
"x",
"l",
"print(x, end=sep)",
"print",
"x",
"end=sep",
"end",
"sep",
"l",
"l",
"sep='\\n'",
"sep",
"'\\n'",
"s = input()",
"s",
"input()",
"input",
"t = []",
"t",
"[]",
"for i in range(len(s)):\n if s[i]=='B':\n if len(t)>0:\n t = t[:len(t)-1]\n else:\n t.append(s[i])",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]=='B':\n if len(t)>0:\n t = t[:len(t)-1]\n else:\n t.append(s[i])",
"s[i]=='B'",
"s[i]",
"s",
"i",
"'B'",
"if len(t)>0:\n t = t[:len(t)-1]\n ",
"len(t)>0",
"len(t)",
"len",
"t",
"0",
"t = t[:len(t)-1]",
"t",
"t[:len(t)-1]",
"t",
":len(t)-1",
"len(t)-1",
"len(t)",
"len",
"t",
"1",
"t.append(s[i])",
"t.append",
"t",
"append",
"s[i]",
"s",
"i",
"print(''.join(t))",
"print",
"''.join(t)",
"''.join",
"''",
"join",
"t",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"def judge(x, l=['Yes', 'No']):\n print(l[0] if x else l[1])",
"judge",
"s = input()",
"input()",
"s",
"t = t[:len(t)-1]",
"t[:len(t)-1]",
"t",
"t = []",
"[]",
"t",
"MOD = 10**9+7",
"10**9+7",
"MOD",
"eps = 1.0e-20",
"1.0e-20",
"eps",
"def mint():\n return map(int,input().split())",
"def mint():\n return map(int,input().split())",
"mint",
"INF = 10**20",
"10**20",
"INF",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"def ilint():\n return int(input()), list(map(int,input().split()))",
"ilint",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"def lprint(l, sep='\\n'):\n for x in l:\n print(x, end=sep)",
"lprint",
"def lint():\n return list(map(int,input().split()))",
"def lint():\n return list(map(int,input().split()))",
"lint"
] | import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from math import *
sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7
def mint():
return map(int,input().split())
def lint():
return list(map(int,input().split()))
def ilint():
return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
print(l[0] if x else l[1])
def lprint(l, sep='\n'):
for x in l:
print(x, end=sep)
s = input()
t = []
for i in range(len(s)):
if s[i]=='B':
if len(t)>0:
t = t[:len(t)-1]
else:
t.append(s[i])
print(''.join(t)) |
[
7,
12,
13,
0,
13,
39,
28,
13,
4,
13,
14,
2,
13,
17,
14,
2,
4,
13,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
8,
7
],
[
7,
12
],
[
4,
18
],
[
4,
22
],
[
4,
26
],
[
7,
28
],
[
4,
35
],
[
44,
41
]
] | [
"def main():\n a=[]\n for s in input():\n if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n print(\"\".join(a))\n pass\n\nif __name__ == \"__main__\":\n main()",
"def main():\n a=[]\n for s in input():\n if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n print(\"\".join(a))\n pass",
"main",
"a=[]",
"a",
"[]",
"for s in input():\n if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n ",
"s",
"input()",
"input",
"if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n ",
"s == \"B\"",
"s",
"\"B\"",
"if len(a) > 0:\n a.pop()\n ",
"len(a) > 0",
"len(a)",
"len",
"a",
"0",
"a.pop()",
"a.pop",
"a",
"pop",
"a.append(s)",
"a.append",
"a",
"append",
"s",
"print(\"\".join(a))",
"print",
"\"\".join(a)",
"\"\".join",
"\"\"",
"join",
"a",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n a=[]\n for s in input():\n if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n print(\"\".join(a))\n pass",
"def main():\n a=[]\n for s in input():\n if s == \"B\":\n if len(a) > 0:\n a.pop()\n else:\n a.append(s)\n print(\"\".join(a))\n pass",
"main"
] | def main():
a=[]
for s in input():
if s == "B":
if len(a) > 0:
a.pop()
else:
a.append(s)
print("".join(a))
pass
if __name__ == "__main__":
main() |
[
7,
0,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
18,
13,
39,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] | [
[
62,
2
],
[
74,
9
],
[
65,
12
],
[
16,
15
],
[
63,
20
],
[
63,
24
],
[
15,
25
],
[
68,
28
],
[
80,
31
],
[
63,
36
],
[
15,
37
],
[
83,
40
],
[
71,
43
],
[
66,
47
],
[
87,
47
],
[
72,
47
],
[
81,
47
],
[
77,
50
],
[
75,
52
],
[
78,
52
],
[
84,
52
],
[
69,
52
],
[
86,
56
],
[
78,
60
],
[
84,
60
],
[
69,
60
],
[
75,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"s = input().strip()\nx = \"\"\ncur = 0\nfor i in range(len(s)):\n if s[i]==\"0\":\n x += \"0\"\n cur += 1\n elif s[i]==\"1\":\n x += \"1\"\n cur += 1\n else:\n if cur>0:\n x = x[:-1]\n cur -= 1\nprint(x)",
"s = input().strip()",
"s",
"input().strip()",
"().strip",
"()",
"input",
"strip",
"x = \"\"",
"x",
"\"\"",
"cur = 0",
"cur",
"0",
"for i in range(len(s)):\n if s[i]==\"0\":\n x += \"0\"\n cur += 1\n elif s[i]==\"1\":\n x += \"1\"\n cur += 1\n else:\n if cur>0:\n x = x[:-1]\n cur -= 1",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]==\"0\":\n x += \"0\"\n cur += 1\n elif s[i]==\"1\":\n x += \"1\"\n cur += 1\n else:\n if cur>0:\n x = x[:-1]\n cur -= 1",
"s[i]==\"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"x += \"0\"",
"x",
"\"0\"",
"cur += 1",
"cur",
"1",
"elif s[i]==\"1\":\n x += \"1\"\n cur += 1\n ",
"s[i]==\"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"x += \"1\"",
"x",
"\"1\"",
"cur += 1",
"cur",
"1",
"if cur>0:\n x = x[:-1]\n cur -= 1",
"cur>0",
"cur",
"0",
"x = x[:-1]",
"x",
"x[:-1]",
"x",
":-1",
"-1",
"cur -= 1",
"cur",
"1",
"print(x)",
"print",
"x",
"s = input().strip()",
"input().strip()",
"s",
"cur = 0",
"0",
"cur",
"x += \"0\"",
"\"0\"",
"x",
"cur += 1",
"1",
"cur",
"x = \"\"",
"\"\"",
"x",
"x = x[:-1]",
"x[:-1]",
"x",
"cur += 1",
"1",
"cur",
"x += \"1\"",
"\"1\"",
"x",
"cur -= 1",
"1",
"cur"
] | s = input().strip()
x = ""
cur = 0
for i in range(len(s)):
if s[i]=="0":
x += "0"
cur += 1
elif s[i]=="1":
x += "1"
cur += 1
else:
if cur>0:
x = x[:-1]
cur -= 1
print(x) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
40,
13,
39,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
58,
2
],
[
55,
6
],
[
10,
9
],
[
59,
14
],
[
59,
18
],
[
9,
19
],
[
56,
23
],
[
59,
29
],
[
9,
30
],
[
56,
34
],
[
56,
39
],
[
56,
43
],
[
55,
56
],
[
58,
59
]
] | [
"s = input()\nans = []\nfor i in range(len(s)):\n if s[i] == '0':\n ans.append(0)\n elif s[i] == '1':\n ans.append(1)\n else:\n if ans != []:\n ans.pop()\nprint(''.join(str(n) for n in ans))",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)):\n if s[i] == '0':\n ans.append(0)\n elif s[i] == '1':\n ans.append(1)\n else:\n if ans != []:\n ans.pop()",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == '0':\n ans.append(0)\n elif s[i] == '1':\n ans.append(1)\n else:\n if ans != []:\n ans.pop()",
"s[i] == '0'",
"s[i]",
"s",
"i",
"'0'",
"ans.append(0)",
"ans.append",
"ans",
"append",
"0",
"elif s[i] == '1':\n ans.append(1)\n ",
"s[i] == '1'",
"s[i]",
"s",
"i",
"'1'",
"ans.append(1)",
"ans.append",
"ans",
"append",
"1",
"if ans != []:\n ans.pop()",
"ans != []",
"ans",
"[]",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(str(n) for n in ans))",
"print",
"''.join(str(n) for n in ans)",
"''.join",
"''",
"join",
"str(n)",
"str",
"n",
"ans = []",
"[]",
"ans",
"s = input()",
"input()",
"s"
] | s = input()
ans = []
for i in range(len(s)):
if s[i] == '0':
ans.append(0)
elif s[i] == '1':
ans.append(1)
else:
if ans != []:
ans.pop()
print(''.join(str(n) for n in ans)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
14,
2,
13,
39,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
54,
2
],
[
51,
8
],
[
12,
11
],
[
55,
11
],
[
11,
15
],
[
52,
19
],
[
11,
24
],
[
52,
28
],
[
11,
33
],
[
52,
37
],
[
52,
41
],
[
52,
49
],
[
51,
52
],
[
54,
55
]
] | [
"zla=list(input())\ns=[]\nfor i in zla:\n if i=='0':\n s.append('0')\n elif i=='1':\n s.append('1')\n elif i=='B':\n if s==[]:\n pass\n else:\n s.pop()\n\nprint(''.join(s))",
"zla=list(input())",
"zla",
"list(input())",
"list",
"input()",
"input",
"s=[]",
"s",
"[]",
"for i in zla:\n if i=='0':\n s.append('0')\n elif i=='1':\n s.append('1')\n elif i=='B':\n if s==[]:\n pass\n else:\n s.pop()",
"i",
"zla",
"if i=='0':\n s.append('0')\n elif i=='1':\n s.append('1')\n elif i=='B':\n if s==[]:\n pass\n else:\n s.pop()",
"i=='0'",
"i",
"'0'",
"s.append('0')",
"s.append",
"s",
"append",
"'0'",
"elif i=='1':\n s.append('1')\n ",
"i=='1'",
"i",
"'1'",
"s.append('1')",
"s.append",
"s",
"append",
"'1'",
"elif i=='B':\n if s==[]:\n pass\n else:\n s.pop()",
"i=='B'",
"i",
"'B'",
"if s==[]:\n pass\n else:\n s.pop()",
"s==[]",
"s",
"[]",
"s.pop()",
"s.pop",
"s",
"pop",
"print(''.join(s))",
"print",
"''.join(s)",
"''.join",
"''",
"join",
"s",
"s=[]",
"[]",
"s",
"zla=list(input())",
"list(input())",
"zla"
] | zla=list(input())
s=[]
for i in zla:
if i=='0':
s.append('0')
elif i=='1':
s.append('1')
elif i=='B':
if s==[]:
pass
else:
s.pop()
print(''.join(s))
|
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
39,
17,
17,
4,
18,
13,
13,
13,
14,
40,
4,
13,
13,
17,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
40,
2
],
[
43,
6
],
[
10,
9
],
[
41,
9
],
[
9,
13
],
[
44,
19
],
[
9,
21
],
[
44,
26
],
[
44,
30
],
[
44,
38
],
[
40,
41
],
[
43,
44
]
] | [
"s = input()\na = []\nfor c in s:\n if c in ['0', '1']:\n a.append(c)\n else:\n if len(a) != 0:\n a.pop()\nprint(''.join(a))",
"s = input()",
"s",
"input()",
"input",
"a = []",
"a",
"[]",
"for c in s:\n if c in ['0', '1']:\n a.append(c)\n else:\n if len(a) != 0:\n a.pop()",
"c",
"s",
"if c in ['0', '1']:\n a.append(c)\n else:\n if len(a) != 0:\n a.pop()",
"c in ['0', '1']",
"c",
"['0', '1']",
"'0'",
"'1'",
"a.append(c)",
"a.append",
"a",
"append",
"c",
"if len(a) != 0:\n a.pop()",
"len(a) != 0",
"len(a)",
"len",
"a",
"0",
"a.pop()",
"a.pop",
"a",
"pop",
"print(''.join(a))",
"print",
"''.join(a)",
"''.join",
"''",
"join",
"a",
"s = input()",
"input()",
"s",
"a = []",
"[]",
"a"
] | s = input()
a = []
for c in s:
if c in ['0', '1']:
a.append(c)
else:
if len(a) != 0:
a.pop()
print(''.join(a)) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
18,
13,
39,
17,
2,
4,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] | [
[
52,
2
],
[
64,
6
],
[
10,
9
],
[
53,
14
],
[
53,
18
],
[
9,
19
],
[
58,
22
],
[
53,
27
],
[
9,
28
],
[
61,
31
],
[
65,
35
],
[
56,
35
],
[
62,
35
],
[
59,
35
],
[
55,
38
],
[
65,
40
],
[
56,
40
],
[
62,
40
],
[
59,
40
],
[
65,
46
],
[
56,
46
],
[
62,
46
],
[
59,
46
],
[
56,
50
],
[
62,
50
],
[
59,
50
],
[
65,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
]
] | [
"s=input()\nans=\"\"\nfor i in range(len(s)):\n if s[i]==\"0\":\n ans+=\"0\"\n elif s[i]==\"1\":\n ans+=\"1\"\n else:\n if ans==\"\":\n pass\n else:\n ans=ans[0:len(ans)-1]\nprint(ans)",
"s=input()",
"s",
"input()",
"input",
"ans=\"\"",
"ans",
"\"\"",
"for i in range(len(s)):\n if s[i]==\"0\":\n ans+=\"0\"\n elif s[i]==\"1\":\n ans+=\"1\"\n else:\n if ans==\"\":\n pass\n else:\n ans=ans[0:len(ans)-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]==\"0\":\n ans+=\"0\"\n elif s[i]==\"1\":\n ans+=\"1\"\n else:\n if ans==\"\":\n pass\n else:\n ans=ans[0:len(ans)-1]",
"s[i]==\"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"ans+=\"0\"",
"ans",
"\"0\"",
"elif s[i]==\"1\":\n ans+=\"1\"\n ",
"s[i]==\"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"ans+=\"1\"",
"ans",
"\"1\"",
"if ans==\"\":\n pass\n else:\n ans=ans[0:len(ans)-1]",
"ans==\"\"",
"ans",
"\"\"",
"ans=ans[0:len(ans)-1]",
"ans",
"ans[0:len(ans)-1]",
"ans",
"0:len(ans)-1",
"0",
"len(ans)-1",
"len(ans)",
"len",
"ans",
"1",
"print(ans)",
"print",
"ans",
"s=input()",
"input()",
"s",
"ans=ans[0:len(ans)-1]",
"ans[0:len(ans)-1]",
"ans",
"ans+=\"0\"",
"\"0\"",
"ans",
"ans+=\"1\"",
"\"1\"",
"ans",
"ans=\"\"",
"\"\"",
"ans"
] | s=input()
ans=""
for i in range(len(s)):
if s[i]=="0":
ans+="0"
elif s[i]=="1":
ans+="1"
else:
if ans=="":
pass
else:
ans=ans[0:len(ans)-1]
print(ans) |
[
7,
15,
15,
15,
15,
15,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
14,
40,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13
] | [
[
28,
7
],
[
31,
11
],
[
15,
14
],
[
29,
14
],
[
14,
18
],
[
32,
22
],
[
32,
26
],
[
28,
29
],
[
31,
32
]
] | [
"# Begin Header {{{\nfrom math import gcd\nfrom collections import Counter, deque, defaultdict\nfrom heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge\nfrom bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort\nfrom itertools import accumulate, product, permutations, combinations, combinations_with_replacement\n# }}} End Header\n# _________コーディングはここから!!___________\n# ... 最小側の制約も確認した?\n# ... オーバーフローしない?\ns = input()\nans = \"\"\nfor x in s:\n if x=='B':\n if ans!=\"\": ans = ans[:-1]\n else: ans+=x\nprint(ans)",
"from math import gcd",
"from collections import Counter, deque, defaultdict",
"from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge",
"from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort",
"from itertools import accumulate, product, permutations, combinations, combinations_with_replacement",
"s = input()",
"s",
"input()",
"input",
"ans = \"\"",
"ans",
"\"\"",
"for x in s:\n if x=='B':\n if ans!=\"\": ans = ans[:-1]\n else: ans+=x",
"x",
"s",
"if x=='B':\n if ans!=\"\": ans = ans[:-1]\n else: ans+=x",
"x=='B'",
"x",
"'B'",
"if ans!=\"\": ans = ans[:-1]\n ",
"ans!=\"\"",
"ans",
"\"\"",
"print(ans)",
"print",
"ans",
"s = input()",
"input()",
"s",
"ans = \"\"",
"\"\"",
"ans"
] | # Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから!!___________
# ... 最小側の制約も確認した?
# ... オーバーフローしない?
s = input()
ans = ""
for x in s:
if x=='B':
if ans!="": ans = ans[:-1]
else: ans+=x
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
14,
2,
4,
13,
13,
17,
9,
24,
18,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
54,
2
],
[
57,
8
],
[
12,
11
],
[
55,
11
],
[
11,
15
],
[
58,
19
],
[
11,
24
],
[
58,
28
],
[
11,
33
],
[
58,
39
],
[
58,
44
],
[
58,
52
],
[
54,
55
],
[
57,
58
]
] | [
"s = str(input())\na = []\n\nfor i in s:\n if i == '0':\n a.append('0') \n elif i == '1':\n a.append('1')\n elif i == 'B':\n if len(a) ==0:\n continue\n else:\n del a[-1]\n \n\nprint(''.join(a))",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"a = []",
"a",
"[]",
"for i in s:\n if i == '0':\n a.append('0') \n elif i == '1':\n a.append('1')\n elif i == 'B':\n if len(a) ==0:\n continue\n else:\n del a[-1]\n ",
"i",
"s",
"if i == '0':\n a.append('0') \n elif i == '1':\n a.append('1')\n elif i == 'B':\n if len(a) ==0:\n continue\n else:\n del a[-1]\n ",
"i == '0'",
"i",
"'0'",
"a.append('0')",
"a.append",
"a",
"append",
"'0'",
"elif i == '1':\n a.append('1')\n ",
"i == '1'",
"i",
"'1'",
"a.append('1')",
"a.append",
"a",
"append",
"'1'",
"elif i == 'B':\n if len(a) ==0:\n continue\n else:\n del a[-1]\n ",
"i == 'B'",
"i",
"'B'",
"if len(a) ==0:\n continue\n else:\n del a[-1]\n ",
"len(a) ==0",
"len(a)",
"len",
"a",
"0",
"continue",
"del a[-1]",
"a[-1]",
"a",
"-1",
"print(''.join(a))",
"print",
"''.join(a)",
"''.join",
"''",
"join",
"a",
"s = str(input())",
"str(input())",
"s",
"a = []",
"[]",
"a"
] | s = str(input())
a = []
for i in s:
if i == '0':
a.append('0')
elif i == '1':
a.append('1')
elif i == 'B':
if len(a) ==0:
continue
else:
del a[-1]
print(''.join(a)) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
2,
13,
17,
13,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
50,
2
],
[
47,
6
],
[
10,
9
],
[
51,
9
],
[
9,
13
],
[
48,
17
],
[
9,
22
],
[
48,
26
],
[
9,
32
],
[
48,
34
],
[
48,
37
],
[
48,
45
],
[
47,
48
],
[
50,
51
]
] | [
"s = input()\nans = []\n\nfor i in s:\n if i=='0':\n ans.append('0')\n elif i=='1':\n ans.append('1')\n elif i=='B' and ans:\n ans.pop()\nprint(''.join(ans))",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in s:\n if i=='0':\n ans.append('0')\n elif i=='1':\n ans.append('1')\n elif i=='B' and ans:\n ans.pop()",
"i",
"s",
"if i=='0':\n ans.append('0')\n elif i=='1':\n ans.append('1')\n elif i=='B' and ans:\n ans.pop()",
"i=='0'",
"i",
"'0'",
"ans.append('0')",
"ans.append",
"ans",
"append",
"'0'",
"elif i=='1':\n ans.append('1')\n ",
"i=='1'",
"i",
"'1'",
"ans.append('1')",
"ans.append",
"ans",
"append",
"'1'",
"elif i=='B' and ans:\n ans.pop()",
"i=='B' and ans",
"i=='B'",
"i",
"'B'",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"s = input()",
"input()",
"s"
] | s = input()
ans = []
for i in s:
if i=='0':
ans.append('0')
elif i=='1':
ans.append('1')
elif i=='B' and ans:
ans.pop()
print(''.join(ans)) |
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
39,
28,
13,
13,
14,
2,
13,
17,
14,
13,
4,
18,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
37,
3
],
[
40,
7
],
[
13,
12
],
[
38,
12
],
[
12,
16
],
[
41,
22
],
[
41,
26
],
[
12,
28
],
[
41,
35
],
[
37,
38
],
[
40,
41
]
] | [
"from collections import deque\n\nS = input()\n\nans = deque([])\n\nfor s in S:\n if s==\"B\":\n if ans:\n ans.pop()\n else:\n ans.append(s)\n \nprint(\"\".join(ans))",
"from collections import deque",
"S = input()",
"S",
"input()",
"input",
"ans = deque([])",
"ans",
"deque([])",
"deque",
"[]",
"for s in S:\n if s==\"B\":\n if ans:\n ans.pop()\n else:\n ans.append(s)\n ",
"s",
"S",
"if s==\"B\":\n if ans:\n ans.pop()\n else:\n ans.append(s)\n ",
"s==\"B\"",
"s",
"\"B\"",
"if ans:\n ans.pop()\n ",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"ans.append(s)",
"ans.append",
"ans",
"append",
"s",
"print(\"\".join(ans))",
"print",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"S = input()",
"input()",
"S",
"ans = deque([])",
"deque([])",
"ans"
] | from collections import deque
S = input()
ans = deque([])
for s in S:
if s=="B":
if ans:
ans.pop()
else:
ans.append(s)
print("".join(ans)) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
13,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
43,
2
],
[
46,
6
],
[
10,
9
],
[
44,
9
],
[
9,
13
],
[
47,
17
],
[
9,
22
],
[
47,
26
],
[
47,
33
],
[
47,
41
],
[
43,
44
],
[
46,
47
]
] | [
"s = input()\n\nans = []\nfor l in s:\n if l == '0':\n ans.append('0')\n elif l == '1':\n ans.append('1')\n else:\n if ans:\n ans.pop()\n\nprint(''.join(ans))",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for l in s:\n if l == '0':\n ans.append('0')\n elif l == '1':\n ans.append('1')\n else:\n if ans:\n ans.pop()",
"l",
"s",
"if l == '0':\n ans.append('0')\n elif l == '1':\n ans.append('1')\n else:\n if ans:\n ans.pop()",
"l == '0'",
"l",
"'0'",
"ans.append('0')",
"ans.append",
"ans",
"append",
"'0'",
"elif l == '1':\n ans.append('1')\n ",
"l == '1'",
"l",
"'1'",
"ans.append('1')",
"ans.append",
"ans",
"append",
"'1'",
"if ans:\n ans.pop()",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"s = input()",
"input()",
"s",
"ans = []",
"[]",
"ans"
] | s = input()
ans = []
for l in s:
if l == '0':
ans.append('0')
elif l == '1':
ans.append('1')
else:
if ans:
ans.pop()
print(''.join(ans)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
2,
13,
17,
40,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
18,
13,
10,
39,
13
] | [
[
55,
2
],
[
61,
8
],
[
12,
11
],
[
56,
11
],
[
11,
15
],
[
62,
19
],
[
59,
19
],
[
11,
24
],
[
62,
28
],
[
59,
28
],
[
11,
34
],
[
62,
39
],
[
59,
39
],
[
58,
42
],
[
62,
44
],
[
59,
44
],
[
59,
53
],
[
62,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
]
] | [
"s = list(input())\ntexit = []\nfor i in s:\n if i == \"0\":\n texit.append(\"0\")\n elif i == \"1\":\n texit.append(\"1\")\n elif i == \"B\" and len(texit) != 0:\n texit = texit[:-1]\nprint(\"\".join(texit))",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"texit = []",
"texit",
"[]",
"for i in s:\n if i == \"0\":\n texit.append(\"0\")\n elif i == \"1\":\n texit.append(\"1\")\n elif i == \"B\" and len(texit) != 0:\n texit = texit[:-1]",
"i",
"s",
"if i == \"0\":\n texit.append(\"0\")\n elif i == \"1\":\n texit.append(\"1\")\n elif i == \"B\" and len(texit) != 0:\n texit = texit[:-1]",
"i == \"0\"",
"i",
"\"0\"",
"texit.append(\"0\")",
"texit.append",
"texit",
"append",
"\"0\"",
"elif i == \"1\":\n texit.append(\"1\")\n ",
"i == \"1\"",
"i",
"\"1\"",
"texit.append(\"1\")",
"texit.append",
"texit",
"append",
"\"1\"",
"elif i == \"B\" and len(texit) != 0:\n texit = texit[:-1]",
"i == \"B\" and len(texit) != 0",
"i == \"B\"",
"i",
"\"B\"",
"len(texit) != 0",
"len(texit)",
"len",
"texit",
"0",
"texit = texit[:-1]",
"texit",
"texit[:-1]",
"texit",
":-1",
"-1",
"print(\"\".join(texit))",
"print",
"\"\".join(texit)",
"\"\".join",
"\"\"",
"join",
"texit",
"s = list(input())",
"list(input())",
"s",
"texit = texit[:-1]",
"texit[:-1]",
"texit",
"texit = []",
"[]",
"texit"
] | s = list(input())
texit = []
for i in s:
if i == "0":
texit.append("0")
elif i == "1":
texit.append("1")
elif i == "B" and len(texit) != 0:
texit = texit[:-1]
print("".join(texit)) |
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
39,
28,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
13,
0,
13,
4,
18,
13,
13,
0,
13,
4,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
73,
3
],
[
67,
7
],
[
74,
10
],
[
70,
12
],
[
18,
17
],
[
68,
20
],
[
74,
24
],
[
17,
25
],
[
71,
29
],
[
74,
35
],
[
17,
36
],
[
71,
40
],
[
76,
46
],
[
71,
49
],
[
64,
52
],
[
71,
55
],
[
65,
62
],
[
71,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
]
] | [
"from collections import deque\ns=input()\nn=len(s)\nstack=deque([])\nfor i in range(n):\n if s[i]==\"0\":\n stack.append(\"0\")\n elif s[i]==\"1\":\n stack.append(\"1\")\n else:\n if stack:\n x=stack.pop()\nstack=list(stack)\nprint(\"\".join(stack))",
"from collections import deque",
"s=input()",
"s",
"input()",
"input",
"n=len(s)",
"n",
"len(s)",
"len",
"s",
"stack=deque([])",
"stack",
"deque([])",
"deque",
"[]",
"for i in range(n):\n if s[i]==\"0\":\n stack.append(\"0\")\n elif s[i]==\"1\":\n stack.append(\"1\")\n else:\n if stack:\n x=stack.pop()",
"i",
"range(n)",
"range",
"n",
"if s[i]==\"0\":\n stack.append(\"0\")\n elif s[i]==\"1\":\n stack.append(\"1\")\n else:\n if stack:\n x=stack.pop()",
"s[i]==\"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"stack.append(\"0\")",
"stack.append",
"stack",
"append",
"\"0\"",
"elif s[i]==\"1\":\n stack.append(\"1\")\n ",
"s[i]==\"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"stack.append(\"1\")",
"stack.append",
"stack",
"append",
"\"1\"",
"if stack:\n x=stack.pop()",
"stack",
"x=stack.pop()",
"x",
"stack.pop()",
"stack.pop",
"stack",
"pop",
"stack=list(stack)",
"stack",
"list(stack)",
"list",
"stack",
"print(\"\".join(stack))",
"print",
"\"\".join(stack)",
"\"\".join",
"\"\"",
"join",
"stack",
"stack=list(stack)",
"list(stack)",
"stack",
"n=len(s)",
"len(s)",
"n",
"stack=deque([])",
"deque([])",
"stack",
"s=input()",
"input()",
"s",
"x=stack.pop()",
"stack.pop()",
"x"
] | from collections import deque
s=input()
n=len(s)
stack=deque([])
for i in range(n):
if s[i]=="0":
stack.append("0")
elif s[i]=="1":
stack.append("1")
else:
if stack:
x=stack.pop()
stack=list(stack)
print("".join(stack)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
40,
4,
13,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
37,
2
],
[
40,
8
],
[
12,
11
],
[
38,
16
],
[
38,
20
],
[
11,
21
],
[
41,
27
],
[
41,
35
],
[
37,
38
],
[
40,
41
]
] | [
"s = str(input())\nans = []\nfor i in range(len(s)):\n if s[i] == \"B\":\n if len(ans) != 0: ans.pop()\n else : ans.append(s[i])\nprint(''.join(ans))",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)):\n if s[i] == \"B\":\n if len(ans) != 0: ans.pop()\n else : ans.append(s[i])",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == \"B\":\n if len(ans) != 0: ans.pop()\n else : ans.append(s[i])",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"if len(ans) != 0: ans.pop()\n ",
"len(ans) != 0",
"len(ans)",
"len",
"ans",
"0",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"s = str(input())",
"str(input())",
"s",
"ans = []",
"[]",
"ans"
] | s = str(input())
ans = []
for i in range(len(s)):
if s[i] == "B":
if len(ans) != 0: ans.pop()
else : ans.append(s[i])
print(''.join(ans)) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
40,
13,
39,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
48,
2
],
[
45,
6
],
[
10,
9
],
[
49,
9
],
[
9,
13
],
[
46,
17
],
[
9,
22
],
[
46,
26
],
[
46,
31
],
[
46,
35
],
[
46,
43
],
[
45,
46
],
[
48,
49
]
] | [
"s=input()\nl=[]\nfor i in s:\n if(i=='1'):\n l.append('1')\n elif(i=='0'):\n l.append('0')\n else:\n if(l!=[]):\n l.pop()\nprint(''.join(l))",
"s=input()",
"s",
"input()",
"input",
"l=[]",
"l",
"[]",
"for i in s:\n if(i=='1'):\n l.append('1')\n elif(i=='0'):\n l.append('0')\n else:\n if(l!=[]):\n l.pop()",
"i",
"s",
"if(i=='1'):\n l.append('1')\n elif(i=='0'):\n l.append('0')\n else:\n if(l!=[]):\n l.pop()",
"i=='1'",
"i",
"'1'",
"l.append('1')",
"l.append",
"l",
"append",
"'1'",
"elif(i=='0'):\n l.append('0')\n ",
"i=='0'",
"i",
"'0'",
"l.append('0')",
"l.append",
"l",
"append",
"'0'",
"if(l!=[]):\n l.pop()",
"l!=[]",
"l",
"[]",
"l.pop()",
"l.pop",
"l",
"pop",
"print(''.join(l))",
"print",
"''.join(l)",
"''.join",
"''",
"join",
"l",
"l=[]",
"[]",
"l",
"s=input()",
"input()",
"s"
] | s=input()
l=[]
for i in s:
if(i=='1'):
l.append('1')
elif(i=='0'):
l.append('0')
else:
if(l!=[]):
l.pop()
print(''.join(l))
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13
] | [
[
58,
2
],
[
49,
6
],
[
10,
9
],
[
59,
14
],
[
59,
18
],
[
9,
19
],
[
52,
22
],
[
59,
27
],
[
9,
28
],
[
55,
31
],
[
59,
36
],
[
9,
37
],
[
61,
40
],
[
56,
42
],
[
53,
42
],
[
50,
42
],
[
62,
42
],
[
62,
47
],
[
56,
47
],
[
53,
47
],
[
50,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
],
[
58,
59
],
[
61,
62
]
] | [
"s = input()\nop = \"\"\nfor i in range(len(s)):\n if s[i] == \"0\":\n op += \"0\"\n if s[i] == \"1\":\n op += \"1\"\n if s[i] == \"B\":\n op = op[:-1]\nprint(op)",
"s = input()",
"s",
"input()",
"input",
"op = \"\"",
"op",
"\"\"",
"for i in range(len(s)):\n if s[i] == \"0\":\n op += \"0\"\n if s[i] == \"1\":\n op += \"1\"\n if s[i] == \"B\":\n op = op[:-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == \"0\":\n op += \"0\"\n ",
"s[i] == \"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"op += \"0\"",
"op",
"\"0\"",
"if s[i] == \"1\":\n op += \"1\"\n ",
"s[i] == \"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"op += \"1\"",
"op",
"\"1\"",
"if s[i] == \"B\":\n op = op[:-1]",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"op = op[:-1]",
"op",
"op[:-1]",
"op",
":-1",
"-1",
"print(op)",
"print",
"op",
"op = \"\"",
"\"\"",
"op",
"op += \"0\"",
"\"0\"",
"op",
"op += \"1\"",
"\"1\"",
"op",
"s = input()",
"input()",
"s",
"op = op[:-1]",
"op[:-1]",
"op"
] | s = input()
op = ""
for i in range(len(s)):
if s[i] == "0":
op += "0"
if s[i] == "1":
op += "1"
if s[i] == "B":
op = op[:-1]
print(op)
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
0,
13,
18,
13,
13,
14,
40,
13,
17,
0,
13,
18,
13,
39,
17,
17,
4,
13,
13,
10,
4,
13,
10,
18,
13,
10,
18,
13,
10,
17,
13
] | [
[
47,
2
],
[
56,
6
],
[
10,
9
],
[
48,
14
],
[
48,
19
],
[
9,
20
],
[
48,
24
],
[
9,
25
],
[
50,
28
],
[
48,
30
],
[
9,
31
],
[
57,
34
],
[
54,
34
],
[
51,
34
],
[
53,
37
],
[
57,
39
],
[
54,
39
],
[
51,
39
],
[
54,
45
],
[
51,
45
],
[
57,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
],
[
56,
57
]
] | [
"line = input()\nans = \"\"\nfor i in range(len(line)):\n if line[i] == \"0\" or line[i] == \"1\":\n ans += line[i]\n else:\n if ans != \"\":\n ans = ans[0:-1]\nprint(ans)",
"line = input()",
"line",
"input()",
"input",
"ans = \"\"",
"ans",
"\"\"",
"for i in range(len(line)):\n if line[i] == \"0\" or line[i] == \"1\":\n ans += line[i]\n else:\n if ans != \"\":\n ans = ans[0:-1]",
"i",
"range(len(line))",
"range",
"len(line)",
"len",
"line",
"if line[i] == \"0\" or line[i] == \"1\":\n ans += line[i]\n else:\n if ans != \"\":\n ans = ans[0:-1]",
"line[i] == \"0\" or line[i] == \"1\"",
"line[i] == \"0\"",
"line[i]",
"line",
"i",
"\"0\"",
"line[i] == \"1\"",
"line[i]",
"line",
"i",
"\"1\"",
"ans += line[i]",
"ans",
"line[i]",
"line",
"i",
"if ans != \"\":\n ans = ans[0:-1]",
"ans != \"\"",
"ans",
"\"\"",
"ans = ans[0:-1]",
"ans",
"ans[0:-1]",
"ans",
"0:-1",
"0",
"-1",
"print(ans)",
"print",
"ans",
"line = input()",
"input()",
"line",
"ans += line[i]",
"line[i]",
"ans",
"ans = ans[0:-1]",
"ans[0:-1]",
"ans",
"ans = \"\"",
"\"\"",
"ans"
] | line = input()
ans = ""
for i in range(len(line)):
if line[i] == "0" or line[i] == "1":
ans += line[i]
else:
if ans != "":
ans = ans[0:-1]
print(ans) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
17,
17,
0,
13,
17,
0,
13,
18,
13,
39,
17,
14,
2,
18,
13,
17,
17,
0,
13,
17,
0,
13,
18,
13,
39,
17,
0,
13,
18,
13,
39,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
18,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13
] | [
[
67,
2
],
[
73,
6
],
[
10,
9
],
[
68,
14
],
[
68,
18
],
[
65,
18
],
[
83,
18
],
[
62,
18
],
[
79,
22
],
[
61,
25
],
[
68,
27
],
[
65,
27
],
[
83,
27
],
[
62,
27
],
[
68,
33
],
[
65,
33
],
[
83,
33
],
[
62,
33
],
[
70,
37
],
[
82,
40
],
[
68,
42
],
[
65,
42
],
[
83,
42
],
[
62,
42
],
[
64,
46
],
[
68,
48
],
[
65,
48
],
[
83,
48
],
[
62,
48
],
[
76,
52
],
[
74,
54
],
[
77,
54
],
[
71,
54
],
[
80,
54
],
[
77,
59
],
[
71,
59
],
[
80,
59
],
[
74,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
]
] | [
"s = input()\nans = \"\"\nfor _ in range(len(s)):\n if s[0] == \"0\":\n ans += \"0\"\n s = s[1:]\n elif s[0] == \"1\":\n ans += \"1\"\n s = s[1:]\n else:\n s = s[1:]\n ans = ans[:-1]\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = \"\"",
"ans",
"\"\"",
"for _ in range(len(s)):\n if s[0] == \"0\":\n ans += \"0\"\n s = s[1:]\n elif s[0] == \"1\":\n ans += \"1\"\n s = s[1:]\n else:\n s = s[1:]\n ans = ans[:-1]",
"_",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[0] == \"0\":\n ans += \"0\"\n s = s[1:]\n elif s[0] == \"1\":\n ans += \"1\"\n s = s[1:]\n else:\n s = s[1:]\n ans = ans[:-1]",
"s[0] == \"0\"",
"s[0]",
"s",
"0",
"\"0\"",
"ans += \"0\"",
"ans",
"\"0\"",
"s = s[1:]",
"s",
"s[1:]",
"s",
"1:",
"1",
"elif s[0] == \"1\":\n ans += \"1\"\n s = s[1:]\n ",
"s[0] == \"1\"",
"s[0]",
"s",
"0",
"\"1\"",
"ans += \"1\"",
"ans",
"\"1\"",
"s = s[1:]",
"s",
"s[1:]",
"s",
"1:",
"1",
"s = s[1:]",
"s",
"s[1:]",
"s",
"1:",
"1",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"s = s[1:]",
"s[1:]",
"s",
"s = s[1:]",
"s[1:]",
"s",
"s = input()",
"input()",
"s",
"ans += \"1\"",
"\"1\"",
"ans",
"ans = \"\"",
"\"\"",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans",
"ans += \"0\"",
"\"0\"",
"ans",
"s = s[1:]",
"s[1:]",
"s"
] | s = input()
ans = ""
for _ in range(len(s)):
if s[0] == "0":
ans += "0"
s = s[1:]
elif s[0] == "1":
ans += "1"
s = s[1:]
else:
s = s[1:]
ans = ans[:-1]
print(ans) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
14,
2,
13,
39,
9,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
54,
2
],
[
51,
6
],
[
10,
9
],
[
55,
14
],
[
55,
19
],
[
9,
20
],
[
55,
24
],
[
9,
25
],
[
52,
29
],
[
55,
32
],
[
9,
33
],
[
52,
36
],
[
52,
41
],
[
52,
49
],
[
51,
52
],
[
54,
55
]
] | [
"s =input()\nans = []\nfor i in range(len(s)):\n if (s[i] == '0') or (s[i] == '1'):\n ans.append(s[i])\n elif ans ==[]:\n continue\n else:\n ans.pop()\n\nprint(''.join(ans))",
"s =input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)):\n if (s[i] == '0') or (s[i] == '1'):\n ans.append(s[i])\n elif ans ==[]:\n continue\n else:\n ans.pop()",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if (s[i] == '0') or (s[i] == '1'):\n ans.append(s[i])\n elif ans ==[]:\n continue\n else:\n ans.pop()",
"(s[i] == '0') or (s[i] == '1')",
"s[i] == '0'",
"s[i]",
"s",
"i",
"'0'",
"s[i] == '1'",
"s[i]",
"s",
"i",
"'1'",
"ans.append(s[i])",
"ans.append",
"ans",
"append",
"s[i]",
"s",
"i",
"elif ans ==[]:\n continue\n ",
"ans ==[]",
"ans",
"[]",
"continue",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"s =input()",
"input()",
"s"
] | s =input()
ans = []
for i in range(len(s)):
if (s[i] == '0') or (s[i] == '1'):
ans.append(s[i])
elif ans ==[]:
continue
else:
ans.pop()
print(''.join(ans)) |
[
7,
15,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
14,
2,
4,
13,
13,
17,
4,
18,
13,
13,
4,
13,
31,
4,
13,
13,
0,
13,
17,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
6,
5
],
[
12,
11
],
[
17,
16
],
[
5,
16
],
[
16,
20
],
[
11,
24
],
[
16,
26
],
[
16,
29
],
[
11,
33
],
[
16,
35
],
[
11,
40
],
[
11,
44
],
[
11,
51
],
[
54,
53
],
[
63,
60
]
] | [
"from collections import deque\n\n\ndef main():\n ss = list(input())\n ans = deque([])\n for s in ss:\n if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n print(*list(ans), sep='')\n\n\nif __name__ == \"__main__\":\n main()",
"from collections import deque",
"def main():\n ss = list(input())\n ans = deque([])\n for s in ss:\n if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n print(*list(ans), sep='')",
"main",
"ss = list(input())",
"ss",
"list(input())",
"list",
"input()",
"input",
"ans = deque([])",
"ans",
"deque([])",
"deque",
"[]",
"for s in ss:\n if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n ",
"s",
"ss",
"if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n ",
"s == '0'",
"s",
"'0'",
"ans.append(s)",
"ans.append",
"ans",
"append",
"s",
"elif s == '1':\n ans.append(s)\n ",
"s == '1'",
"s",
"'1'",
"ans.append(s)",
"ans.append",
"ans",
"append",
"s",
"if len(ans) == 0:\n pass\n else:\n ans.pop()\n ",
"len(ans) == 0",
"len(ans)",
"len",
"ans",
"0",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(*list(ans), sep='')",
"print",
"*list(ans)",
"list(ans)",
"list",
"ans",
"sep=''",
"sep",
"''",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n ss = list(input())\n ans = deque([])\n for s in ss:\n if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n print(*list(ans), sep='')",
"def main():\n ss = list(input())\n ans = deque([])\n for s in ss:\n if s == '0':\n ans.append(s)\n elif s == '1':\n ans.append(s)\n else:\n if len(ans) == 0:\n pass\n else:\n ans.pop()\n print(*list(ans), sep='')",
"main"
] | from collections import deque
def main():
ss = list(input())
ans = deque([])
for s in ss:
if s == '0':
ans.append(s)
elif s == '1':
ans.append(s)
else:
if len(ans) == 0:
pass
else:
ans.pop()
print(*list(ans), sep='')
if __name__ == "__main__":
main()
|
[
7,
0,
13,
39,
28,
13,
4,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
17,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13
] | [
[
45,
2
],
[
6,
5
],
[
5,
10
],
[
46,
14
],
[
5,
19
],
[
46,
23
],
[
46,
30
],
[
46,
35
],
[
46,
43
],
[
45,
46
]
] | [
"ans = []\nfor i in input():\n if i == \"0\":\n ans.append(\"0\")\n elif i == \"1\":\n ans.append(\"1\")\n else:\n if len(ans) == 0:\n None\n else:\n ans.pop()\nprint(\"\".join(ans))",
"ans = []",
"ans",
"[]",
"for i in input():\n if i == \"0\":\n ans.append(\"0\")\n elif i == \"1\":\n ans.append(\"1\")\n else:\n if len(ans) == 0:\n None\n else:\n ans.pop()",
"i",
"input()",
"input",
"if i == \"0\":\n ans.append(\"0\")\n elif i == \"1\":\n ans.append(\"1\")\n else:\n if len(ans) == 0:\n None\n else:\n ans.pop()",
"i == \"0\"",
"i",
"\"0\"",
"ans.append(\"0\")",
"ans.append",
"ans",
"append",
"\"0\"",
"elif i == \"1\":\n ans.append(\"1\")\n ",
"i == \"1\"",
"i",
"\"1\"",
"ans.append(\"1\")",
"ans.append",
"ans",
"append",
"\"1\"",
"if len(ans) == 0:\n None\n else:\n ans.pop()",
"len(ans) == 0",
"len(ans)",
"len",
"ans",
"0",
"None",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(\"\".join(ans))",
"print",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"ans = []",
"[]",
"ans"
] | ans = []
for i in input():
if i == "0":
ans.append("0")
elif i == "1":
ans.append("1")
else:
if len(ans) == 0:
None
else:
ans.pop()
print("".join(ans)) |
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
17,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
14,
2,
4,
13,
13,
17,
9,
0,
13,
18,
13,
39,
17,
17,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
9,
8
],
[
12,
11
],
[
4,
17
],
[
4,
21
],
[
11,
22
],
[
26,
25
],
[
4,
30
],
[
11,
31
],
[
35,
34
],
[
4,
39
],
[
11,
40
],
[
8,
46
],
[
50,
46
],
[
34,
46
],
[
25,
46
],
[
51,
50
],
[
8,
52
],
[
50,
52
],
[
34,
52
],
[
25,
52
],
[
50,
58
],
[
34,
58
],
[
25,
58
],
[
8,
58
],
[
63,
60
]
] | [
"def key():\n a=input()\n b=''\n for i in range(0,len(a)):\n if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n print(b)\n\nkey()",
"def key():\n a=input()\n b=''\n for i in range(0,len(a)):\n if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n print(b)",
"key",
"a=input()",
"a",
"input()",
"input",
"b=''",
"b",
"''",
"for i in range(0,len(a)):\n if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n ",
"i",
"range(0,len(a))",
"range",
"0",
"len(a)",
"len",
"a",
"if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n ",
"a[i]=='0'",
"a[i]",
"a",
"i",
"'0'",
"b+='0'",
"b",
"'0'",
"elif a[i]=='1':\n b+='1'\n ",
"a[i]=='1'",
"a[i]",
"a",
"i",
"'1'",
"b+='1'",
"b",
"'1'",
"elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n ",
"a[i]=='B'",
"a[i]",
"a",
"i",
"'B'",
"if len(b)==0:\n continue\n else:\n b=b[0:-1]\n ",
"len(b)==0",
"len(b)",
"len",
"b",
"0",
"continue",
"b=b[0:-1]",
"b",
"b[0:-1]",
"b",
"0:-1",
"0",
"-1",
"print(b)",
"print",
"b",
"key()",
"key",
"def key():\n a=input()\n b=''\n for i in range(0,len(a)):\n if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n print(b)",
"def key():\n a=input()\n b=''\n for i in range(0,len(a)):\n if a[i]=='0':\n b+='0'\n elif a[i]=='1':\n b+='1'\n elif a[i]=='B':\n if len(b)==0:\n continue\n else:\n b=b[0:-1]\n print(b)",
"key"
] | def key():
a=input()
b=''
for i in range(0,len(a)):
if a[i]=='0':
b+='0'
elif a[i]=='1':
b+='1'
elif a[i]=='B':
if len(b)==0:
continue
else:
b=b[0:-1]
print(b)
key()
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
14,
2,
13,
39,
9,
4,
18,
13,
13,
4,
18,
13,
13,
13,
0,
13,
17,
28,
13,
13,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13
] | [
[
53,
2
],
[
47,
8
],
[
12,
11
],
[
54,
11
],
[
11,
15
],
[
48,
19
],
[
48,
24
],
[
48,
28
],
[
11,
30
],
[
44,
32
],
[
36,
35
],
[
48,
35
],
[
50,
38
],
[
35,
39
],
[
51,
42
],
[
45,
42
],
[
44,
45
],
[
47,
48
],
[
35,
50
],
[
50,
51
],
[
53,
54
]
] | [
"s=list(input())\nout=[]\nfor i in s:\n if i==\"B\":\n if out==[]:\n continue\n out.pop()\n else:\n out.append(i)\nou=\"\"\nfor i in out:\n ou+=i\nprint(ou)",
"s=list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"out=[]",
"out",
"[]",
"for i in s:\n if i==\"B\":\n if out==[]:\n continue\n out.pop()\n else:\n out.append(i)",
"i",
"s",
"if i==\"B\":\n if out==[]:\n continue\n out.pop()\n else:\n out.append(i)",
"i==\"B\"",
"i",
"\"B\"",
"if out==[]:\n continue\n ",
"out==[]",
"out",
"[]",
"continue",
"out.pop()",
"out.pop",
"out",
"pop",
"out.append(i)",
"out.append",
"out",
"append",
"i",
"ou=\"\"",
"ou",
"\"\"",
"for i in out:\n ou+=i",
"i",
"out",
"ou+=i",
"ou",
"i",
"print(ou)",
"print",
"ou",
"ou=\"\"",
"\"\"",
"ou",
"out=[]",
"[]",
"out",
"ou+=i",
"i",
"ou",
"s=list(input())",
"list(input())",
"s"
] | s=list(input())
out=[]
for i in s:
if i=="B":
if out==[]:
continue
out.pop()
else:
out.append(i)
ou=""
for i in out:
ou+=i
print(ou) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
40,
13,
17,
4,
18,
13,
13,
13,
14,
40,
13,
39,
4,
18,
13,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
40,
2
],
[
37,
6
],
[
10,
9
],
[
41,
9
],
[
9,
13
],
[
38,
17
],
[
9,
19
],
[
38,
22
],
[
38,
26
],
[
38,
35
],
[
37,
38
],
[
40,
41
]
] | [
"s = input()\n\nl = []\nfor i in s:\n if i != \"B\":\n l.append(i)\n else:\n if l != []:\n l.pop(-1)\n\nprint(''.join(l))",
"s = input()",
"s",
"input()",
"input",
"l = []",
"l",
"[]",
"for i in s:\n if i != \"B\":\n l.append(i)\n else:\n if l != []:\n l.pop(-1)",
"i",
"s",
"if i != \"B\":\n l.append(i)\n else:\n if l != []:\n l.pop(-1)",
"i != \"B\"",
"i",
"\"B\"",
"l.append(i)",
"l.append",
"l",
"append",
"i",
"if l != []:\n l.pop(-1)",
"l != []",
"l",
"[]",
"l.pop(-1)",
"l.pop",
"l",
"pop",
"-1",
"print(''.join(l))",
"print",
"''.join(l)",
"''.join",
"''",
"join",
"l",
"l = []",
"[]",
"l",
"s = input()",
"input()",
"s"
] | s = input()
l = []
for i in s:
if i != "B":
l.append(i)
else:
if l != []:
l.pop(-1)
print(''.join(l))
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
14,
2,
2,
13,
17,
13,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] | [
[
47,
2
],
[
50,
6
],
[
10,
9
],
[
48,
9
],
[
9,
13
],
[
44,
16
],
[
9,
20
],
[
41,
23
],
[
9,
28
],
[
51,
30
],
[
54,
30
],
[
42,
30
],
[
45,
30
],
[
53,
32
],
[
51,
34
],
[
54,
34
],
[
42,
34
],
[
45,
34
],
[
54,
39
],
[
42,
39
],
[
45,
39
],
[
51,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
]
] | [
"s = input()\nans = ''\nfor c in s:\n if c == '0':\n ans += '0'\n elif c == '1':\n ans += '1'\n elif c == 'B' and ans:\n ans = ans[:-1]\nprint(ans)",
"s = input()",
"s",
"input()",
"input",
"ans = ''",
"ans",
"''",
"for c in s:\n if c == '0':\n ans += '0'\n elif c == '1':\n ans += '1'\n elif c == 'B' and ans:\n ans = ans[:-1]",
"c",
"s",
"if c == '0':\n ans += '0'\n elif c == '1':\n ans += '1'\n elif c == 'B' and ans:\n ans = ans[:-1]",
"c == '0'",
"c",
"'0'",
"ans += '0'",
"ans",
"'0'",
"elif c == '1':\n ans += '1'\n ",
"c == '1'",
"c",
"'1'",
"ans += '1'",
"ans",
"'1'",
"elif c == 'B' and ans:\n ans = ans[:-1]",
"c == 'B' and ans",
"c == 'B'",
"c",
"'B'",
"ans",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"ans += '1'",
"'1'",
"ans",
"ans += '0'",
"'0'",
"ans",
"s = input()",
"input()",
"s",
"ans = ''",
"''",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans"
] | s = input()
ans = ''
for c in s:
if c == '0':
ans += '0'
elif c == '1':
ans += '1'
elif c == 'B' and ans:
ans = ans[:-1]
print(ans) |
[
7,
0,
13,
39,
28,
13,
4,
13,
14,
2,
13,
17,
14,
13,
4,
18,
13,
13,
13,
13,
4,
18,
17,
13,
13,
10,
39,
13
] | [
[
26,
2
],
[
6,
5
],
[
5,
10
],
[
27,
16
],
[
5,
18
],
[
27,
24
],
[
26,
27
]
] | [
"s = []\nfor l in raw_input():\n\tif l == 'B':\n\t\tif s:s.pop()\n\telse:\n\t\ts.append(l)\nprint ''.join(s)",
"s = []",
"s",
"[]",
"for l in raw_input():\n\tif l == 'B':\n\t\tif s:s.pop()\n\telse:\n\t\ts.append(l)",
"l",
"raw_input()",
"raw_input",
"if l == 'B':\n\t\tif s:s.pop()\n\telse:\n\t\ts.append(l)",
"l == 'B'",
"l",
"'B'",
"if s:s.pop()\n\t",
"s",
"s.append(l)",
"s.append",
"s",
"append",
"l",
"print",
"''.join(s)",
"''.join",
"''",
"join",
"s",
"s = []",
"[]",
"s"
] | s = []
for l in raw_input():
if l == 'B':
if s:s.pop()
else:
s.append(l)
print ''.join(s) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
13,
4,
18,
13,
13,
4,
18,
13,
13,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
45,
2
],
[
42,
6
],
[
10,
9
],
[
46,
14
],
[
46,
18
],
[
9,
19
],
[
43,
25
],
[
43,
29
],
[
46,
32
],
[
9,
33
],
[
43,
40
],
[
42,
43
],
[
45,
46
]
] | [
"s = input()\nans = []\nfor i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])\nprint(''.join(ans))\n",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)):\n if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == 'B':\n if ans:\n ans.pop()\n else:\n ans.append(s[i])",
"s[i] == 'B'",
"s[i]",
"s",
"i",
"'B'",
"if ans:\n ans.pop()\n ",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"ans.append(s[i])",
"ans.append",
"ans",
"append",
"s[i]",
"s",
"i",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"s = input()",
"input()",
"s"
] | s = input()
ans = []
for i in range(len(s)):
if s[i] == 'B':
if ans:
ans.pop()
else:
ans.append(s[i])
print(''.join(ans))
|
[
7,
15,
15,
15,
15,
13,
15,
13,
15,
13,
4,
18,
13,
13,
17,
0,
13,
2,
2,
17,
17,
17,
12,
13,
29,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
12,
13,
29,
4,
13,
4,
13,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
12,
13,
10,
2,
13,
10,
17,
13,
10,
12,
13,
10,
17,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13
] | [
[
87,
16
],
[
99,
43
],
[
102,
47
],
[
51,
50
],
[
100,
55
],
[
100,
59
],
[
50,
60
],
[
90,
63
],
[
100,
68
],
[
50,
69
],
[
96,
72
],
[
105,
75
],
[
103,
77
],
[
106,
77
],
[
97,
77
],
[
91,
77
],
[
106,
82
],
[
97,
82
],
[
91,
82
],
[
103,
82
],
[
87,
88
],
[
90,
91
],
[
96,
97
],
[
99,
100
],
[
102,
103
],
[
105,
106
]
] | [
"#from statistics import median\n#import collections\n#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]\nfrom fractions import gcd\nfrom itertools import combinations,permutations,accumulate # (string,3) 3回\n#from collections import deque\nfrom collections import deque,defaultdict,Counter\nimport decimal\nimport re\n#import bisect\n#\n# d = m - k[i] - k[j]\n# if kk[bisect.bisect_right(kk,d) - 1] == d:\n#\n#\n#\n# pythonで無理なときは、pypyでやると正解するかも!!\n#\n#\n# my_round_int = lambda x:np.round((x*2 + 1)//2)\n# 四捨五入\nimport sys\nsys.setrecursionlimit(10000000)\nmod = 10**9 + 7\n#mod = 9982443453\ndef readInts():\n return list(map(int,input().split()))\ndef I():\n return int(input())\ns = input()\nans = \"\"\nfor i in range(len(s)):\n if s[i] == '0':\n ans += '0'\n elif s[i] == '1':\n ans += '1'\n else:\n ans = ans[:-1]\nprint(ans)",
"from fractions import gcd",
"from itertools import combinations,permutations,accumulate",
"from collections import deque,defaultdict,Counter",
"import decimal",
"decimal",
"import re",
"re",
"import sys",
"sys",
"sys.setrecursionlimit(10000000)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10000000",
"mod = 10**9 + 7",
"mod",
"10**9 + 7",
"10**9",
"10",
"9",
"7",
"def readInts():\n return list(map(int,input().split()))",
"readInts",
"return list(map(int,input().split()))",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"def I():\n return int(input())",
"I",
"return int(input())",
"int(input())",
"int",
"input()",
"input",
"s = input()",
"s",
"input()",
"input",
"ans = \"\"",
"ans",
"\"\"",
"for i in range(len(s)):\n if s[i] == '0':\n ans += '0'\n elif s[i] == '1':\n ans += '1'\n else:\n ans = ans[:-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == '0':\n ans += '0'\n elif s[i] == '1':\n ans += '1'\n else:\n ans = ans[:-1]",
"s[i] == '0'",
"s[i]",
"s",
"i",
"'0'",
"ans += '0'",
"ans",
"'0'",
"elif s[i] == '1':\n ans += '1'\n ",
"s[i] == '1'",
"s[i]",
"s",
"i",
"'1'",
"ans += '1'",
"ans",
"'1'",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"def I():\n return int(input())",
"def I():\n return int(input())",
"I",
"mod = 10**9 + 7",
"10**9 + 7",
"mod",
"ans += '0'",
"'0'",
"ans",
"def readInts():\n return list(map(int,input().split()))",
"def readInts():\n return list(map(int,input().split()))",
"readInts",
"ans += '1'",
"'1'",
"ans",
"s = input()",
"input()",
"s",
"ans = \"\"",
"\"\"",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans"
] | #from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
# d = m - k[i] - k[j]
# if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも!!
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
return list(map(int,input().split()))
def I():
return int(input())
s = input()
ans = ""
for i in range(len(s)):
if s[i] == '0':
ans += '0'
elif s[i] == '1':
ans += '1'
else:
ans = ans[:-1]
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
17,
13,
0,
13,
17,
14,
2,
17,
13,
0,
13,
17,
14,
40,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13
] | [
[
49,
2
],
[
52,
8
],
[
12,
11
],
[
50,
11
],
[
11,
16
],
[
55,
18
],
[
11,
23
],
[
43,
25
],
[
53,
31
],
[
47,
31
],
[
44,
31
],
[
56,
31
],
[
46,
34
],
[
53,
36
],
[
47,
36
],
[
44,
36
],
[
56,
36
],
[
47,
41
],
[
44,
41
],
[
56,
41
],
[
53,
41
],
[
43,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
]
] | [
"s = str(input())\nans = ''\nfor key in s:\n if '0' == key:\n ans += '0'\n elif '1' == key:\n ans += '1'\n else:\n if len(ans) != 0:\n ans = ans[:-1]\nprint(ans)",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"ans = ''",
"ans",
"''",
"for key in s:\n if '0' == key:\n ans += '0'\n elif '1' == key:\n ans += '1'\n else:\n if len(ans) != 0:\n ans = ans[:-1]",
"key",
"s",
"if '0' == key:\n ans += '0'\n elif '1' == key:\n ans += '1'\n else:\n if len(ans) != 0:\n ans = ans[:-1]",
"'0' == key",
"'0'",
"key",
"ans += '0'",
"ans",
"'0'",
"elif '1' == key:\n ans += '1'\n ",
"'1' == key",
"'1'",
"key",
"ans += '1'",
"ans",
"'1'",
"if len(ans) != 0:\n ans = ans[:-1]",
"len(ans) != 0",
"len(ans)",
"len",
"ans",
"0",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"print(ans)",
"print",
"ans",
"ans += '1'",
"'1'",
"ans",
"ans = ans[:-1]",
"ans[:-1]",
"ans",
"s = str(input())",
"str(input())",
"s",
"ans = ''",
"''",
"ans",
"ans += '0'",
"'0'",
"ans"
] | s = str(input())
ans = ''
for key in s:
if '0' == key:
ans += '0'
elif '1' == key:
ans += '1'
else:
if len(ans) != 0:
ans = ans[:-1]
print(ans)
|
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
39,
28,
13,
13,
14,
2,
2,
13,
17,
2,
4,
13,
13,
17,
4,
18,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
48,
3
],
[
45,
7
],
[
13,
12
],
[
49,
12
],
[
12,
17
],
[
46,
22
],
[
46,
26
],
[
12,
30
],
[
46,
34
],
[
12,
36
],
[
46,
43
],
[
45,
46
],
[
48,
49
]
] | [
"from collections import deque\nS = input()\nT = deque([])\nfor s in S:\n if s==\"B\" and len(T)>0:\n T.pop()\n elif s==\"B\":\n pass\n else:\n T.append(s)\nprint(\"\".join(T))",
"from collections import deque",
"S = input()",
"S",
"input()",
"input",
"T = deque([])",
"T",
"deque([])",
"deque",
"[]",
"for s in S:\n if s==\"B\" and len(T)>0:\n T.pop()\n elif s==\"B\":\n pass\n else:\n T.append(s)",
"s",
"S",
"if s==\"B\" and len(T)>0:\n T.pop()\n elif s==\"B\":\n pass\n else:\n T.append(s)",
"s==\"B\" and len(T)>0",
"s==\"B\"",
"s",
"\"B\"",
"len(T)>0",
"len(T)",
"len",
"T",
"0",
"T.pop()",
"T.pop",
"T",
"pop",
"elif s==\"B\":\n pass\n ",
"s==\"B\"",
"s",
"\"B\"",
"T.append(s)",
"T.append",
"T",
"append",
"s",
"print(\"\".join(T))",
"print",
"\"\".join(T)",
"\"\".join",
"\"\"",
"join",
"T",
"T = deque([])",
"deque([])",
"T",
"S = input()",
"input()",
"S"
] | from collections import deque
S = input()
T = deque([])
for s in S:
if s=="B" and len(T)>0:
T.pop()
elif s=="B":
pass
else:
T.append(s)
print("".join(T)) |
[
7,
0,
13,
17,
28,
13,
4,
13,
14,
2,
13,
39,
17,
17,
0,
13,
2,
13,
13,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
2,
13,
10,
17,
13,
10,
18,
13
] | [
[
38,
2
],
[
6,
5
],
[
5,
10
],
[
35,
15
],
[
39,
17
],
[
42,
17
],
[
36,
17
],
[
5,
18
],
[
39,
23
],
[
42,
23
],
[
36,
23
],
[
41,
26
],
[
39,
28
],
[
42,
28
],
[
36,
28
],
[
42,
33
],
[
36,
33
],
[
39,
33
],
[
35,
36
],
[
38,
39
],
[
41,
42
]
] | [
"s = \"\"\nfor i in (input()):\n if i in [\"0\", \"1\"]:\n s = s + i\n else:\n if len(s) >0:\n \ts = s[:-1]\n\nprint(s)",
"s = \"\"",
"s",
"\"\"",
"for i in (input()):\n if i in [\"0\", \"1\"]:\n s = s + i\n else:\n if len(s) >0:\n \ts = s[:-1]",
"i",
"input()",
"input",
"if i in [\"0\", \"1\"]:\n s = s + i\n else:\n if len(s) >0:\n \ts = s[:-1]",
"i in [\"0\", \"1\"]",
"i",
"[\"0\", \"1\"]",
"\"0\"",
"\"1\"",
"s = s + i",
"s",
"s + i",
"s",
"i",
"if len(s) >0:\n \ts = s[:-1]",
"len(s) >0",
"len(s)",
"len",
"s",
"0",
"s = s[:-1]",
"s",
"s[:-1]",
"s",
":-1",
"-1",
"print(s)",
"print",
"s",
"s = s + i",
"s + i",
"s",
"s = \"\"",
"\"\"",
"s",
"s = s[:-1]",
"s[:-1]",
"s"
] | s = ""
for i in (input()):
if i in ["0", "1"]:
s = s + i
else:
if len(s) >0:
s = s[:-1]
print(s) |
[
7,
12,
13,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
40,
18,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
14,
40,
4,
13,
13,
17,
4,
18,
13,
13,
28,
13,
13,
4,
13,
13,
0,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
9,
8
],
[
12,
11
],
[
4,
16
],
[
4,
20
],
[
11,
21
],
[
8,
25
],
[
4,
28
],
[
11,
29
],
[
8,
34
],
[
8,
38
],
[
42,
41
],
[
8,
41
],
[
41,
45
],
[
48,
47
],
[
53,
50
]
] | [
"def main():\n s=input()\n li=[]\n for i in range(len(s)):\n if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n for i in li:\n print(i,end='')\n\nmain()",
"def main():\n s=input()\n li=[]\n for i in range(len(s)):\n if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n for i in li:\n print(i,end='')",
"main",
"s=input()",
"s",
"input()",
"input",
"li=[]",
"li",
"[]",
"for i in range(len(s)):\n if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n ",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n ",
"s[i]!='B'",
"s[i]",
"s",
"i",
"'B'",
"li.append(s[i])",
"li.append",
"li",
"append",
"s[i]",
"s",
"i",
"if(len(li)!=0):\n li.pop()\n ",
"len(li)!=0",
"len(li)",
"len",
"li",
"0",
"li.pop()",
"li.pop",
"li",
"pop",
"for i in li:\n print(i,end='')",
"i",
"li",
"print(i,end='')",
"print",
"i",
"end=''",
"end",
"''",
"main()",
"main",
"def main():\n s=input()\n li=[]\n for i in range(len(s)):\n if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n for i in li:\n print(i,end='')",
"def main():\n s=input()\n li=[]\n for i in range(len(s)):\n if(s[i]!='B'):\n li.append(s[i])\n else:\n if(len(li)!=0):\n li.pop()\n for i in li:\n print(i,end='')",
"main"
] | def main():
s=input()
li=[]
for i in range(len(s)):
if(s[i]!='B'):
li.append(s[i])
else:
if(len(li)!=0):
li.pop()
for i in li:
print(i,end='')
main()
|
[
7,
15,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
0,
13,
18,
18,
13,
13,
13,
4,
18,
13,
13,
2,
17,
17,
0,
13,
2,
17,
17,
0,
13,
17,
12,
13,
0,
13,
4,
18,
4,
13,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
39,
17,
17,
4,
18,
13,
13,
13,
14,
13,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
29,
14,
2,
13,
17,
4,
13,
10,
2,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
12,
13,
10,
18,
13
] | [
[
89,
4
],
[
95,
11
],
[
101,
18
],
[
86,
32
],
[
92,
37
],
[
43,
42
],
[
96,
46
],
[
50,
49
],
[
53,
52
],
[
42,
52
],
[
52,
56
],
[
49,
62
],
[
52,
64
],
[
49,
69
],
[
49,
77
],
[
99,
84
],
[
86,
87
],
[
89,
90
],
[
92,
93
],
[
95,
96
],
[
101,
102
]
] | [
"import sys\n\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\nsys.setrecursionlimit(10 ** 9)\nINF = 1 << 60\nMOD = 1000000007\n\n\ndef main():\n s = readline().strip()\n\n ans = []\n for c in s:\n if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n print(''.join(ans))\n return\n\n\nif __name__ == '__main__':\n main()",
"import sys",
"sys",
"read = sys.stdin.read",
"read",
"sys.stdin.read",
"sys.stdin",
"sys",
"stdin",
"read",
"readline = sys.stdin.readline",
"readline",
"sys.stdin.readline",
"sys.stdin",
"sys",
"stdin",
"readline",
"readlines = sys.stdin.readlines",
"readlines",
"sys.stdin.readlines",
"sys.stdin",
"sys",
"stdin",
"readlines",
"sys.setrecursionlimit(10 ** 9)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10 ** 9",
"10",
"9",
"INF = 1 << 60",
"INF",
"1 << 60",
"1",
"60",
"MOD = 1000000007",
"MOD",
"1000000007",
"def main():\n s = readline().strip()\n\n ans = []\n for c in s:\n if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n print(''.join(ans))\n return",
"main",
"s = readline().strip()",
"s",
"readline().strip()",
"().strip",
"()",
"readline",
"strip",
"ans = []",
"ans",
"[]",
"for c in s:\n if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n ",
"c",
"s",
"if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n ",
"c in ('0', '1')",
"c",
"('0', '1')",
"'0'",
"'1'",
"ans.append(c)",
"ans.append",
"ans",
"append",
"c",
"elif ans:\n ans.pop()\n\n ",
"ans",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"return",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"INF = 1 << 60",
"1 << 60",
"INF",
"read = sys.stdin.read",
"sys.stdin.read",
"read",
"MOD = 1000000007",
"1000000007",
"MOD",
"readline = sys.stdin.readline",
"sys.stdin.readline",
"readline",
"def main():\n s = readline().strip()\n\n ans = []\n for c in s:\n if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n print(''.join(ans))\n return",
"def main():\n s = readline().strip()\n\n ans = []\n for c in s:\n if c in ('0', '1'):\n ans.append(c)\n elif ans:\n ans.pop()\n\n print(''.join(ans))\n return",
"main",
"readlines = sys.stdin.readlines",
"sys.stdin.readlines",
"readlines"
] | import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007
def main():
s = readline().strip()
ans = []
for c in s:
if c in ('0', '1'):
ans.append(c)
elif ans:
ans.pop()
print(''.join(ans))
return
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
2,
13,
17,
2,
13,
17,
0,
13,
13,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13
] | [
[
42,
2
],
[
48,
6
],
[
10,
9
],
[
43,
9
],
[
9,
14
],
[
9,
17
],
[
45,
20
],
[
9,
21
],
[
49,
26
],
[
40,
26
],
[
46,
26
],
[
39,
29
],
[
49,
31
],
[
40,
31
],
[
46,
31
],
[
40,
37
],
[
46,
37
],
[
49,
37
],
[
39,
40
],
[
42,
43
],
[
9,
45
],
[
45,
46
],
[
48,
49
]
] | [
"n = input()\ns = ''\nfor i in n:\n if i== '1' or i == '0':\n s+=i\n else:\n if len(s)>0:\n s =s[0:-1]\nprint(s)",
"n = input()",
"n",
"input()",
"input",
"s = ''",
"s",
"''",
"for i in n:\n if i== '1' or i == '0':\n s+=i\n else:\n if len(s)>0:\n s =s[0:-1]",
"i",
"n",
"if i== '1' or i == '0':\n s+=i\n else:\n if len(s)>0:\n s =s[0:-1]",
"i== '1' or i == '0'",
"i== '1'",
"i",
"'1'",
"i == '0'",
"i",
"'0'",
"s+=i",
"s",
"i",
"if len(s)>0:\n s =s[0:-1]",
"len(s)>0",
"len(s)",
"len",
"s",
"0",
"s =s[0:-1]",
"s",
"s[0:-1]",
"s",
"0:-1",
"0",
"-1",
"print(s)",
"print",
"s",
"s =s[0:-1]",
"s[0:-1]",
"s",
"n = input()",
"input()",
"n",
"s+=i",
"i",
"s",
"s = ''",
"''",
"s"
] | n = input()
s = ''
for i in n:
if i== '1' or i == '0':
s+=i
else:
if len(s)>0:
s =s[0:-1]
print(s)
|
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
40,
13,
17,
0,
13,
13,
14,
2,
4,
13,
13,
17,
24,
18,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
13,
13,
10,
4,
13
] | [
[
42,
2
],
[
36,
6
],
[
10,
9
],
[
43,
9
],
[
9,
13
],
[
39,
16
],
[
9,
17
],
[
37,
22
],
[
40,
22
],
[
37,
26
],
[
40,
26
],
[
40,
34
],
[
37,
34
],
[
36,
37
],
[
9,
39
],
[
39,
40
],
[
42,
43
]
] | [
"s = input()\n\nans = []\n\nfor c in s:\n if c != 'B':\n ans += c\n else:\n if len(ans) > 0:\n del ans[-1]\n \nprint(''.join(ans))",
"s = input()",
"s",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for c in s:\n if c != 'B':\n ans += c\n else:\n if len(ans) > 0:\n del ans[-1]\n ",
"c",
"s",
"if c != 'B':\n ans += c\n else:\n if len(ans) > 0:\n del ans[-1]\n ",
"c != 'B'",
"c",
"'B'",
"ans += c",
"ans",
"c",
"if len(ans) > 0:\n del ans[-1]\n ",
"len(ans) > 0",
"len(ans)",
"len",
"ans",
"0",
"del ans[-1]",
"ans[-1]",
"ans",
"-1",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"ans += c",
"c",
"ans",
"s = input()",
"input()",
"s"
] | s = input()
ans = []
for c in s:
if c != 'B':
ans += c
else:
if len(ans) > 0:
del ans[-1]
print(''.join(ans)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
14,
40,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
18,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13
] | [
[
46,
2
],
[
49,
8
],
[
12,
11
],
[
47,
11
],
[
11,
15
],
[
52,
18
],
[
11,
22
],
[
55,
25
],
[
50,
31
],
[
44,
31
],
[
56,
31
],
[
53,
31
],
[
43,
34
],
[
50,
36
],
[
44,
36
],
[
56,
36
],
[
53,
36
],
[
44,
41
],
[
56,
41
],
[
53,
41
],
[
50,
41
],
[
43,
44
],
[
46,
47
],
[
49,
50
],
[
52,
53
],
[
55,
56
]
] | [
"s = str(input())\na = ''\nfor i in s:\n if i == '0':\n a += '0'\n elif i == '1':\n a += '1'\n else:\n if len(a) != 0:\n a = a[:-1]\nprint(a)",
"s = str(input())",
"s",
"str(input())",
"str",
"input()",
"input",
"a = ''",
"a",
"''",
"for i in s:\n if i == '0':\n a += '0'\n elif i == '1':\n a += '1'\n else:\n if len(a) != 0:\n a = a[:-1]",
"i",
"s",
"if i == '0':\n a += '0'\n elif i == '1':\n a += '1'\n else:\n if len(a) != 0:\n a = a[:-1]",
"i == '0'",
"i",
"'0'",
"a += '0'",
"a",
"'0'",
"elif i == '1':\n a += '1'\n ",
"i == '1'",
"i",
"'1'",
"a += '1'",
"a",
"'1'",
"if len(a) != 0:\n a = a[:-1]",
"len(a) != 0",
"len(a)",
"len",
"a",
"0",
"a = a[:-1]",
"a",
"a[:-1]",
"a",
":-1",
"-1",
"print(a)",
"print",
"a",
"a = a[:-1]",
"a[:-1]",
"a",
"s = str(input())",
"str(input())",
"s",
"a = ''",
"''",
"a",
"a += '0'",
"'0'",
"a",
"a += '1'",
"'1'",
"a"
] | s = str(input())
a = ''
for i in s:
if i == '0':
a += '0'
elif i == '1':
a += '1'
else:
if len(a) != 0:
a = a[:-1]
print(a) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
39,
2,
13,
39,
4,
18,
13,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
54,
2
],
[
51,
8
],
[
12,
11
],
[
55,
11
],
[
11,
15
],
[
52,
19
],
[
11,
24
],
[
52,
28
],
[
52,
33
],
[
52,
36
],
[
52,
40
],
[
52,
49
],
[
51,
52
],
[
54,
55
]
] | [
"input_line = list(input())\nt = []\nfor i in input_line:\n\tif i == \"0\":\n\t\tt.append(\"0\")\n\telif i == \"1\":\n\t\tt.append(\"1\")\n\telse:\n\t\tif t == []:\n\t\t\tt == []\n\t\telse:\n\t\t\tt.pop(-1)\nprint(\"\".join(t))",
"input_line = list(input())",
"input_line",
"list(input())",
"list",
"input()",
"input",
"t = []",
"t",
"[]",
"for i in input_line:\n\tif i == \"0\":\n\t\tt.append(\"0\")\n\telif i == \"1\":\n\t\tt.append(\"1\")\n\telse:\n\t\tif t == []:\n\t\t\tt == []\n\t\telse:\n\t\t\tt.pop(-1)",
"i",
"input_line",
"if i == \"0\":\n\t\tt.append(\"0\")\n\telif i == \"1\":\n\t\tt.append(\"1\")\n\telse:\n\t\tif t == []:\n\t\t\tt == []\n\t\telse:\n\t\t\tt.pop(-1)",
"i == \"0\"",
"i",
"\"0\"",
"t.append(\"0\")",
"t.append",
"t",
"append",
"\"0\"",
"elif i == \"1\":\n\t\tt.append(\"1\")\n\t",
"i == \"1\"",
"i",
"\"1\"",
"t.append(\"1\")",
"t.append",
"t",
"append",
"\"1\"",
"if t == []:\n\t\t\tt == []\n\t\telse:\n\t\t\tt.pop(-1)",
"t == []",
"t",
"[]",
"t == []",
"t",
"[]",
"t.pop(-1)",
"t.pop",
"t",
"pop",
"-1",
"print(\"\".join(t))",
"print",
"\"\".join(t)",
"\"\".join",
"\"\"",
"join",
"t",
"t = []",
"[]",
"t",
"input_line = list(input())",
"list(input())",
"input_line"
] | input_line = list(input())
t = []
for i in input_line:
if i == "0":
t.append("0")
elif i == "1":
t.append("1")
else:
if t == []:
t == []
else:
t.pop(-1)
print("".join(t)) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
2,
13,
17,
14,
2,
18,
13,
13,
17,
14,
2,
13,
17,
9,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
2,
13,
10,
2,
13
] | [
[
58,
2
],
[
61,
6
],
[
10,
9
],
[
59,
14
],
[
59,
18
],
[
9,
19
],
[
67,
22
],
[
62,
24
],
[
65,
24
],
[
71,
24
],
[
68,
24
],
[
59,
29
],
[
9,
30
],
[
70,
33
],
[
62,
35
],
[
65,
35
],
[
71,
35
],
[
68,
35
],
[
59,
40
],
[
9,
41
],
[
62,
45
],
[
65,
45
],
[
71,
45
],
[
68,
45
],
[
64,
49
],
[
62,
51
],
[
65,
51
],
[
71,
51
],
[
68,
51
],
[
65,
56
],
[
71,
56
],
[
68,
56
],
[
62,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
]
] | [
"s=input()\nout=\"\"\nfor i in range(len(s)):\n if s[i]==\"0\":\n out=out+\"0\"\n elif s[i]==\"1\":\n out=out+\"1\"\n elif s[i]==\"B\":\n if out==\"\":\n continue\n else:\n out=out[:-1]\nprint(out)",
"s=input()",
"s",
"input()",
"input",
"out=\"\"",
"out",
"\"\"",
"for i in range(len(s)):\n if s[i]==\"0\":\n out=out+\"0\"\n elif s[i]==\"1\":\n out=out+\"1\"\n elif s[i]==\"B\":\n if out==\"\":\n continue\n else:\n out=out[:-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i]==\"0\":\n out=out+\"0\"\n elif s[i]==\"1\":\n out=out+\"1\"\n elif s[i]==\"B\":\n if out==\"\":\n continue\n else:\n out=out[:-1]",
"s[i]==\"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"out=out+\"0\"",
"out",
"out+\"0\"",
"out",
"\"0\"",
"elif s[i]==\"1\":\n out=out+\"1\"\n ",
"s[i]==\"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"out=out+\"1\"",
"out",
"out+\"1\"",
"out",
"\"1\"",
"elif s[i]==\"B\":\n if out==\"\":\n continue\n else:\n out=out[:-1]",
"s[i]==\"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"if out==\"\":\n continue\n else:\n out=out[:-1]",
"out==\"\"",
"out",
"\"\"",
"continue",
"out=out[:-1]",
"out",
"out[:-1]",
"out",
":-1",
"-1",
"print(out)",
"print",
"out",
"s=input()",
"input()",
"s",
"out=\"\"",
"\"\"",
"out",
"out=out[:-1]",
"out[:-1]",
"out",
"out=out+\"0\"",
"out+\"0\"",
"out",
"out=out+\"1\"",
"out+\"1\"",
"out"
] | s=input()
out=""
for i in range(len(s)):
if s[i]=="0":
out=out+"0"
elif s[i]=="1":
out=out+"1"
elif s[i]=="B":
if out=="":
continue
else:
out=out[:-1]
print(out) |
[
7,
15,
0,
13,
4,
13,
0,
13,
4,
13,
28,
13,
13,
14,
2,
13,
17,
14,
2,
4,
13,
13,
17,
4,
18,
13,
13,
4,
18,
13,
13,
13,
4,
13,
4,
18,
17,
13,
4,
13,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
46,
3
],
[
43,
7
],
[
12,
11
],
[
47,
11
],
[
11,
15
],
[
44,
21
],
[
44,
25
],
[
44,
29
],
[
11,
31
],
[
44,
41
],
[
43,
44
],
[
46,
47
]
] | [
"from collections import deque\n\nS = input()\nd = deque()\n\nfor s in S:\n if s == 'B':\n if len(d) > 0:\n d.pop()\n else:\n d.append(s)\nprint(\"\".join(map(str, d)))",
"from collections import deque",
"S = input()",
"S",
"input()",
"input",
"d = deque()",
"d",
"deque()",
"deque",
"for s in S:\n if s == 'B':\n if len(d) > 0:\n d.pop()\n else:\n d.append(s)",
"s",
"S",
"if s == 'B':\n if len(d) > 0:\n d.pop()\n else:\n d.append(s)",
"s == 'B'",
"s",
"'B'",
"if len(d) > 0:\n d.pop()\n ",
"len(d) > 0",
"len(d)",
"len",
"d",
"0",
"d.pop()",
"d.pop",
"d",
"pop",
"d.append(s)",
"d.append",
"d",
"append",
"s",
"print(\"\".join(map(str, d)))",
"print",
"\"\".join(map(str, d))",
"\"\".join",
"\"\"",
"join",
"map(str, d)",
"map",
"str",
"d",
"d = deque()",
"deque()",
"d",
"S = input()",
"input()",
"S"
] | from collections import deque
S = input()
d = deque()
for s in S:
if s == 'B':
if len(d) > 0:
d.pop()
else:
d.append(s)
print("".join(map(str, d)))
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
40,
13,
17,
0,
13,
13,
14,
40,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
18,
13,
10,
17,
13
] | [
[
35,
2
],
[
41,
6
],
[
10,
9
],
[
36,
9
],
[
9,
13
],
[
32,
16
],
[
9,
17
],
[
42,
20
],
[
39,
20
],
[
33,
20
],
[
38,
23
],
[
42,
25
],
[
39,
25
],
[
33,
25
],
[
39,
30
],
[
33,
30
],
[
42,
30
],
[
9,
32
],
[
32,
33
],
[
35,
36
],
[
38,
39
],
[
41,
42
]
] | [
"s=input()\nt=''\nfor i in s:\n if i!='B':\n t+=i\n else:\n if t!='':\n t=t[:-1]\nprint(t)",
"s=input()",
"s",
"input()",
"input",
"t=''",
"t",
"''",
"for i in s:\n if i!='B':\n t+=i\n else:\n if t!='':\n t=t[:-1]",
"i",
"s",
"if i!='B':\n t+=i\n else:\n if t!='':\n t=t[:-1]",
"i!='B'",
"i",
"'B'",
"t+=i",
"t",
"i",
"if t!='':\n t=t[:-1]",
"t!=''",
"t",
"''",
"t=t[:-1]",
"t",
"t[:-1]",
"t",
":-1",
"-1",
"print(t)",
"print",
"t",
"t+=i",
"i",
"t",
"s=input()",
"input()",
"s",
"t=t[:-1]",
"t[:-1]",
"t",
"t=''",
"''",
"t"
] | s=input()
t=''
for i in s:
if i!='B':
t+=i
else:
if t!='':
t=t[:-1]
print(t) |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
13,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
13,
17,
4,
18,
13,
13,
17,
14,
2,
2,
13,
17,
40,
4,
13,
13,
17,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
54,
2
],
[
51,
6
],
[
10,
9
],
[
55,
9
],
[
9,
13
],
[
52,
17
],
[
9,
22
],
[
52,
26
],
[
9,
32
],
[
52,
37
],
[
52,
41
],
[
52,
49
],
[
51,
52
],
[
54,
55
]
] | [
"ss = input()\nans = []\n\nfor s in ss:\n if s == '0':\n ans.append('0')\n elif s == '1':\n ans.append('1')\n elif s == 'B' and len(ans) != 0:\n ans.pop()\n\nprint(''.join(ans))",
"ss = input()",
"ss",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for s in ss:\n if s == '0':\n ans.append('0')\n elif s == '1':\n ans.append('1')\n elif s == 'B' and len(ans) != 0:\n ans.pop()",
"s",
"ss",
"if s == '0':\n ans.append('0')\n elif s == '1':\n ans.append('1')\n elif s == 'B' and len(ans) != 0:\n ans.pop()",
"s == '0'",
"s",
"'0'",
"ans.append('0')",
"ans.append",
"ans",
"append",
"'0'",
"elif s == '1':\n ans.append('1')\n ",
"s == '1'",
"s",
"'1'",
"ans.append('1')",
"ans.append",
"ans",
"append",
"'1'",
"elif s == 'B' and len(ans) != 0:\n ans.pop()",
"s == 'B' and len(ans) != 0",
"s == 'B'",
"s",
"'B'",
"len(ans) != 0",
"len(ans)",
"len",
"ans",
"0",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"ss = input()",
"input()",
"ss"
] | ss = input()
ans = []
for s in ss:
if s == '0':
ans.append('0')
elif s == '1':
ans.append('1')
elif s == 'B' and len(ans) != 0:
ans.pop()
print(''.join(ans))
|
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
40,
13,
17,
0,
13,
18,
13,
39,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
14,
2,
18,
13,
13,
17,
0,
13,
17,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
18,
13,
10,
17,
13,
10,
17,
13
] | [
[
53,
2
],
[
56,
6
],
[
10,
9
],
[
54,
14
],
[
54,
19
],
[
9,
20
],
[
57,
23
],
[
63,
23
],
[
66,
23
],
[
60,
23
],
[
59,
26
],
[
57,
28
],
[
63,
28
],
[
66,
28
],
[
60,
28
],
[
54,
34
],
[
9,
35
],
[
65,
38
],
[
54,
43
],
[
9,
44
],
[
62,
47
],
[
63,
51
],
[
66,
51
],
[
60,
51
],
[
57,
51
],
[
53,
54
],
[
56,
57
],
[
59,
60
],
[
62,
63
],
[
65,
66
]
] | [
"S = input()\n\nres = \"\"\nfor i in range(len(S)):\n if(S[i] == \"B\" and res != ''):\n res = res[:-1]\n elif(S[i] == \"0\"):\n res += \"0\"\n elif(S[i] == \"1\"):\n res += \"1\"\nprint(res)",
"S = input()",
"S",
"input()",
"input",
"res = \"\"",
"res",
"\"\"",
"for i in range(len(S)):\n if(S[i] == \"B\" and res != ''):\n res = res[:-1]\n elif(S[i] == \"0\"):\n res += \"0\"\n elif(S[i] == \"1\"):\n res += \"1\"",
"i",
"range(len(S))",
"range",
"len(S)",
"len",
"S",
"if(S[i] == \"B\" and res != ''):\n res = res[:-1]\n elif(S[i] == \"0\"):\n res += \"0\"\n elif(S[i] == \"1\"):\n res += \"1\"",
"S[i] == \"B\" and res != ''",
"S[i] == \"B\"",
"S[i]",
"S",
"i",
"\"B\"",
"res != ''",
"res",
"''",
"res = res[:-1]",
"res",
"res[:-1]",
"res",
":-1",
"-1",
"elif(S[i] == \"0\"):\n res += \"0\"\n ",
"S[i] == \"0\"",
"S[i]",
"S",
"i",
"\"0\"",
"res += \"0\"",
"res",
"\"0\"",
"elif(S[i] == \"1\"):\n res += \"1\"",
"S[i] == \"1\"",
"S[i]",
"S",
"i",
"\"1\"",
"res += \"1\"",
"res",
"\"1\"",
"print(res)",
"print",
"res",
"S = input()",
"input()",
"S",
"res = \"\"",
"\"\"",
"res",
"res = res[:-1]",
"res[:-1]",
"res",
"res += \"1\"",
"\"1\"",
"res",
"res += \"0\"",
"\"0\"",
"res"
] | S = input()
res = ""
for i in range(len(S)):
if(S[i] == "B" and res != ''):
res = res[:-1]
elif(S[i] == "0"):
res += "0"
elif(S[i] == "1"):
res += "1"
print(res)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
18,
13,
13,
17,
4,
18,
13,
13,
17,
14,
2,
2,
18,
13,
13,
17,
2,
4,
13,
13,
17,
24,
18,
13,
17,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
63,
2
],
[
66,
8
],
[
12,
11
],
[
64,
16
],
[
64,
20
],
[
11,
21
],
[
67,
25
],
[
64,
31
],
[
11,
32
],
[
67,
36
],
[
64,
43
],
[
11,
44
],
[
67,
49
],
[
67,
53
],
[
67,
61
],
[
63,
64
],
[
66,
67
]
] | [
"s = list(input())\nans = []\nfor i in range(len(s)) :\n if s[i] == \"0\" :\n ans.append(\"0\")\n elif s[i] == \"1\" :\n ans.append(\"1\")\n elif s[i] == \"B\" and len(ans) > 0 :\n del ans[-1]\nprint(\"\".join(ans))",
"s = list(input())",
"s",
"list(input())",
"list",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(s)) :\n if s[i] == \"0\" :\n ans.append(\"0\")\n elif s[i] == \"1\" :\n ans.append(\"1\")\n elif s[i] == \"B\" and len(ans) > 0 :\n del ans[-1]",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == \"0\" :\n ans.append(\"0\")\n elif s[i] == \"1\" :\n ans.append(\"1\")\n elif s[i] == \"B\" and len(ans) > 0 :\n del ans[-1]",
"s[i] == \"0\"",
"s[i]",
"s",
"i",
"\"0\"",
"ans.append(\"0\")",
"ans.append",
"ans",
"append",
"\"0\"",
"elif s[i] == \"1\" :\n ans.append(\"1\")\n ",
"s[i] == \"1\"",
"s[i]",
"s",
"i",
"\"1\"",
"ans.append(\"1\")",
"ans.append",
"ans",
"append",
"\"1\"",
"elif s[i] == \"B\" and len(ans) > 0 :\n del ans[-1]",
"s[i] == \"B\" and len(ans) > 0",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"len(ans) > 0",
"len(ans)",
"len",
"ans",
"0",
"del ans[-1]",
"ans[-1]",
"ans",
"-1",
"print(\"\".join(ans))",
"print",
"\"\".join(ans)",
"\"\".join",
"\"\"",
"join",
"ans",
"s = list(input())",
"list(input())",
"s",
"ans = []",
"[]",
"ans"
] | s = list(input())
ans = []
for i in range(len(s)) :
if s[i] == "0" :
ans.append("0")
elif s[i] == "1" :
ans.append("1")
elif s[i] == "B" and len(ans) > 0 :
del ans[-1]
print("".join(ans))
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
2,
18,
13,
13,
17,
2,
18,
13,
13,
17,
4,
18,
13,
13,
18,
13,
13,
14,
2,
4,
13,
13,
17,
4,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
39,
13,
10,
4,
13
] | [
[
57,
2
],
[
54,
8
],
[
12,
11
],
[
58,
16
],
[
58,
21
],
[
11,
22
],
[
58,
26
],
[
11,
27
],
[
55,
31
],
[
58,
34
],
[
11,
35
],
[
55,
40
],
[
55,
44
],
[
55,
52
],
[
54,
55
],
[
57,
58
]
] | [
"li = list(input())\nans = []\nfor i in range(len(li)):\n if (li[i] == '0') or (li[i] == '1'):\n ans.append(li[i])\n elif len(ans) > 0:\n ans.pop()\n else:\n pass\n\nprint(''.join(ans))",
"li = list(input())",
"li",
"list(input())",
"list",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(li)):\n if (li[i] == '0') or (li[i] == '1'):\n ans.append(li[i])\n elif len(ans) > 0:\n ans.pop()\n else:\n pass",
"i",
"range(len(li))",
"range",
"len(li)",
"len",
"li",
"if (li[i] == '0') or (li[i] == '1'):\n ans.append(li[i])\n elif len(ans) > 0:\n ans.pop()\n else:\n pass",
"(li[i] == '0') or (li[i] == '1')",
"li[i] == '0'",
"li[i]",
"li",
"i",
"'0'",
"li[i] == '1'",
"li[i]",
"li",
"i",
"'1'",
"ans.append(li[i])",
"ans.append",
"ans",
"append",
"li[i]",
"li",
"i",
"elif len(ans) > 0:\n ans.pop()\n ",
"len(ans) > 0",
"len(ans)",
"len",
"ans",
"0",
"ans.pop()",
"ans.pop",
"ans",
"pop",
"print(''.join(ans))",
"print",
"''.join(ans)",
"''.join",
"''",
"join",
"ans",
"ans = []",
"[]",
"ans",
"li = list(input())",
"list(input())",
"li"
] | li = list(input())
ans = []
for i in range(len(li)):
if (li[i] == '0') or (li[i] == '1'):
ans.append(li[i])
elif len(ans) > 0:
ans.pop()
else:
pass
print(''.join(ans)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
2,
13,
39,
9,
0,
13,
18,
13,
39,
17,
4,
18,
13,
13,
18,
13,
13,
28,
13,
4,
13,
4,
13,
13,
4,
13,
18,
13,
13,
0,
13,
17,
10,
18,
13,
10,
4,
13,
10,
39,
13
] | [
[
60,
2
],
[
63,
8
],
[
12,
11
],
[
61,
16
],
[
61,
20
],
[
11,
21
],
[
64,
25
],
[
58,
25
],
[
57,
29
],
[
64,
31
],
[
58,
31
],
[
64,
36
],
[
58,
36
],
[
61,
39
],
[
11,
40
],
[
43,
42
],
[
58,
47
],
[
64,
47
],
[
58,
51
],
[
64,
51
],
[
42,
52
],
[
55,
54
],
[
57,
58
],
[
60,
61
],
[
63,
64
]
] | [
"S = str(input())\n\nans = []\nfor i in range(len(S)):\n if S[i] == \"B\":\n if ans == []:\n continue\n else:\n ans = ans[:-1]\n else:\n ans.append(S[i])\n #print(ans)\n#print(ans) \n\nfor i in range(len(ans)):\n print(ans[i], end = \"\")",
"S = str(input())",
"S",
"str(input())",
"str",
"input()",
"input",
"ans = []",
"ans",
"[]",
"for i in range(len(S)):\n if S[i] == \"B\":\n if ans == []:\n continue\n else:\n ans = ans[:-1]\n else:\n ans.append(S[i])\n #print(ans)\n#print(ans) ",
"i",
"range(len(S))",
"range",
"len(S)",
"len",
"S",
"if S[i] == \"B\":\n if ans == []:\n continue\n else:\n ans = ans[:-1]\n else:\n ans.append(S[i])\n #print(ans)\n#print(ans) ",
"S[i] == \"B\"",
"S[i]",
"S",
"i",
"\"B\"",
"if ans == []:\n continue\n else:\n ans = ans[:-1]\n ",
"ans == []",
"ans",
"[]",
"continue",
"ans = ans[:-1]",
"ans",
"ans[:-1]",
"ans",
":-1",
"-1",
"ans.append(S[i])",
"ans.append",
"ans",
"append",
"S[i]",
"S",
"i",
"for i in range(len(ans)):\n print(ans[i], end = \"\")",
"i",
"range(len(ans))",
"range",
"len(ans)",
"len",
"ans",
"print(ans[i], end = \"\")",
"print",
"ans[i]",
"ans",
"i",
"end = \"\"",
"end",
"\"\"",
"ans = ans[:-1]",
"ans[:-1]",
"ans",
"S = str(input())",
"str(input())",
"S",
"ans = []",
"[]",
"ans"
] | S = str(input())
ans = []
for i in range(len(S)):
if S[i] == "B":
if ans == []:
continue
else:
ans = ans[:-1]
else:
ans.append(S[i])
#print(ans)
#print(ans)
for i in range(len(ans)):
print(ans[i], end = "") |
[
7,
0,
13,
4,
13,
0,
13,
39,
28,
13,
4,
13,
4,
13,
13,
14,
2,
18,
13,
13,
17,
14,
40,
13,
9,
4,
18,
13,
13,
4,
18,
13,
13,
18,
13,
13,
4,
13,
4,
18,
17,
13,
13,
10,
4,
13,
10,
39,
13
] | [
[
44,
2
],
[
47,
6
],
[
10,
9
],
[
45,
14
],
[
45,
18
],
[
9,
19
],
[
48,
23
],
[
48,
27
],
[
48,
31
],
[
45,
34
],
[
9,
35
],
[
48,
42
],
[
44,
45
],
[
47,
48
]
] | [
"s = input()\nstack = []\nfor i in range(len(s)):\n if s[i] == \"B\":\n if not stack:\n continue\n stack.pop()\n else:\n stack.append(s[i])\n\nprint(\"\".join(stack))",
"s = input()",
"s",
"input()",
"input",
"stack = []",
"stack",
"[]",
"for i in range(len(s)):\n if s[i] == \"B\":\n if not stack:\n continue\n stack.pop()\n else:\n stack.append(s[i])",
"i",
"range(len(s))",
"range",
"len(s)",
"len",
"s",
"if s[i] == \"B\":\n if not stack:\n continue\n stack.pop()\n else:\n stack.append(s[i])",
"s[i] == \"B\"",
"s[i]",
"s",
"i",
"\"B\"",
"if not stack:\n continue\n ",
"not stack",
"stack",
"continue",
"stack.pop()",
"stack.pop",
"stack",
"pop",
"stack.append(s[i])",
"stack.append",
"stack",
"append",
"s[i]",
"s",
"i",
"print(\"\".join(stack))",
"print",
"\"\".join(stack)",
"\"\".join",
"\"\"",
"join",
"stack",
"s = input()",
"input()",
"s",
"stack = []",
"[]",
"stack"
] | s = input()
stack = []
for i in range(len(s)):
if s[i] == "B":
if not stack:
continue
stack.pop()
else:
stack.append(s[i])
print("".join(stack)) |
[
7,
0,
13,
4,
13,
0,
13,
17,
28,
13,
13,
14,
2,
13,
17,
0,
13,
17,
14,
2,
13,
17,
0,
13,
17,
14,
2,
4,
13,
13,
17,
0,
13,
18,
13,
39,
17,
4,
13,
13,
10,
17,
13,
10,
17,
13,
10,
17,
13,
10,
4,
13,
10,
18,
13
] | [
[
50,
2
],
[
47,
6
],
[
10,
9
],
[
51,
9
],
[
9,
13
],
[
41,
16
],
[
9,
20
],
[
44,
23
],
[
48,
29
],
[
54,
29
],
[
45,
29
],
[
42,
29
],
[
53,
32
],
[
48,
34
],
[
54,
34
],
[
45,
34
],
[
42,
34
],
[
54,
39
],
[
45,
39
],
[
42,
39
],
[
48,
39
],
[
41,
42
],
[
44,
45
],
[
47,
48
],
[
50,
51
],
[
53,
54
]
] | [
"s=input()\nfin=\"\"\nfor c in s:\n if c=='1':\n fin+=\"1\"\n elif c=='0':\n fin+=\"0\"\n else:\n if len(fin)>0:\n fin=fin[:-1]\nprint(fin)",
"s=input()",
"s",
"input()",
"input",
"fin=\"\"",
"fin",
"\"\"",
"for c in s:\n if c=='1':\n fin+=\"1\"\n elif c=='0':\n fin+=\"0\"\n else:\n if len(fin)>0:\n fin=fin[:-1]",
"c",
"s",
"if c=='1':\n fin+=\"1\"\n elif c=='0':\n fin+=\"0\"\n else:\n if len(fin)>0:\n fin=fin[:-1]",
"c=='1'",
"c",
"'1'",
"fin+=\"1\"",
"fin",
"\"1\"",
"elif c=='0':\n fin+=\"0\"\n ",
"c=='0'",
"c",
"'0'",
"fin+=\"0\"",
"fin",
"\"0\"",
"if len(fin)>0:\n fin=fin[:-1]",
"len(fin)>0",
"len(fin)",
"len",
"fin",
"0",
"fin=fin[:-1]",
"fin",
"fin[:-1]",
"fin",
":-1",
"-1",
"print(fin)",
"print",
"fin",
"fin+=\"1\"",
"\"1\"",
"fin",
"fin+=\"0\"",
"\"0\"",
"fin",
"fin=\"\"",
"\"\"",
"fin",
"s=input()",
"input()",
"s",
"fin=fin[:-1]",
"fin[:-1]",
"fin"
] | s=input()
fin=""
for c in s:
if c=='1':
fin+="1"
elif c=='0':
fin+="0"
else:
if len(fin)>0:
fin=fin[:-1]
print(fin)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13
] | [
[
51,
2
],
[
66,
8
],
[
57,
20
],
[
24,
23
],
[
54,
29
],
[
33,
32
],
[
67,
32
],
[
60,
35
],
[
23,
38
],
[
32,
39
],
[
63,
42
],
[
58,
45
],
[
64,
45
],
[
61,
46
],
[
55,
46
],
[
64,
49
],
[
58,
49
],
[
51,
52
],
[
54,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
]
] | [
"n=int(input())\n\nt = list(map(int,input().split()))\n\nans = 10000000000\n\nfor i in range(-100, 101):\n memo = 0\n for j in t:\n memo += (i-j)**2\n ans = min(ans, memo)\nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"t = list(map(int,input().split()))",
"t",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = 10000000000",
"ans",
"10000000000",
"for i in range(-100, 101):\n memo = 0\n for j in t:\n memo += (i-j)**2\n ans = min(ans, memo)",
"i",
"range(-100, 101)",
"range",
"-100",
"101",
"memo = 0",
"memo",
"0",
"for j in t:\n memo += (i-j)**2\n ",
"j",
"t",
"memo += (i-j)**2",
"memo",
"(i-j)**2",
"i-j",
"i",
"j",
"2",
"ans = min(ans, memo)",
"ans",
"min(ans, memo)",
"min",
"ans",
"memo",
"print(ans)",
"print",
"ans",
"n=int(input())",
"int(input())",
"n",
"memo = 0",
"0",
"memo",
"ans = 10000000000",
"10000000000",
"ans",
"memo += (i-j)**2",
"(i-j)**2",
"memo",
"ans = min(ans, memo)",
"min(ans, memo)",
"ans",
"t = list(map(int,input().split()))",
"list(map(int,input().split()))",
"t"
] | n=int(input())
t = list(map(int,input().split()))
ans = 10000000000
for i in range(-100, 101):
memo = 0
for j in t:
memo += (i-j)**2
ans = min(ans, memo)
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
0,
13,
2,
4,
13,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
2,
2,
2,
18,
13,
13,
13,
17,
17,
4,
13,
4,
13,
13,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
2,
13
] | [
[
77,
2
],
[
83,
8
],
[
84,
21
],
[
74,
24
],
[
84,
28
],
[
78,
29
],
[
71,
31
],
[
80,
34
],
[
38,
37
],
[
78,
40
],
[
68,
42
],
[
84,
46
],
[
37,
47
],
[
75,
48
],
[
86,
51
],
[
84,
56
],
[
37,
57
],
[
75,
58
],
[
69,
65
],
[
72,
65
],
[
87,
66
],
[
81,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"n = int(input())\na = list(map(int,input().split()))\na.sort()\nmean = sum(a)//n\nansl = 0\nanss = 0\nfor i in range(n):\n ansl += (a[i]-mean)**2\n anss += (a[i]-mean-1)**2\n\nprint(min(ansl,anss))\n",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a = list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a.sort()",
"a.sort",
"a",
"sort",
"mean = sum(a)//n",
"mean",
"sum(a)//n",
"sum(a)",
"sum",
"a",
"n",
"ansl = 0",
"ansl",
"0",
"anss = 0",
"anss",
"0",
"for i in range(n):\n ansl += (a[i]-mean)**2\n anss += (a[i]-mean-1)**2",
"i",
"range(n)",
"range",
"n",
"ansl += (a[i]-mean)**2",
"ansl",
"(a[i]-mean)**2",
"a[i]-mean",
"a[i]",
"a",
"i",
"mean",
"2",
"anss += (a[i]-mean-1)**2",
"anss",
"(a[i]-mean-1)**2",
"a[i]-mean-1",
"a[i]-mean",
"a[i]",
"a",
"i",
"mean",
"1",
"2",
"print(min(ansl,anss))",
"print",
"min(ansl,anss)",
"min",
"ansl",
"anss",
"ansl += (a[i]-mean)**2",
"(a[i]-mean)**2",
"ansl",
"ansl = 0",
"0",
"ansl",
"mean = sum(a)//n",
"sum(a)//n",
"mean",
"n = int(input())",
"int(input())",
"n",
"anss = 0",
"0",
"anss",
"a = list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"anss += (a[i]-mean-1)**2",
"(a[i]-mean-1)**2",
"anss"
] | n = int(input())
a = list(map(int,input().split()))
a.sort()
mean = sum(a)//n
ansl = 0
anss = 0
for i in range(n):
ansl += (a[i]-mean)**2
anss += (a[i]-mean-1)**2
print(min(ansl,anss))
|
[
7,
12,
13,
15,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
4,
13,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
7,
6
],
[
13,
12
],
[
25,
24
],
[
30,
29
],
[
12,
34
],
[
12,
38
],
[
42,
41
],
[
45,
44
],
[
12,
44
],
[
48,
47
],
[
44,
50
],
[
29,
51
],
[
47,
55
],
[
41,
55
],
[
24,
56
],
[
58,
56
],
[
59,
58
],
[
47,
59
],
[
41,
59
],
[
58,
62
],
[
24,
62
],
[
71,
68
]
] | [
"# C - いっしょ\ndef main():\n import math\n _ = int(input())\n a = list(map(int, input().split()))\n t = float('inf')\n\n for i in range(min(a), max(a)+1):\n cnt = 0\n for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n else:\n print(t)\n\n \nif __name__ == \"__main__\":\n main()",
"def main():\n import math\n _ = int(input())\n a = list(map(int, input().split()))\n t = float('inf')\n\n for i in range(min(a), max(a)+1):\n cnt = 0\n for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n else:\n print(t)\n\n ",
"main",
"import math",
"math",
"_ = int(input())",
"_",
"int(input())",
"int",
"input()",
"input",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"t = float('inf')",
"t",
"float('inf')",
"float",
"'inf'",
"for i in range(min(a), max(a)+1):\n cnt = 0\n for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n else:\n print(t)\n\n ",
"i",
"range(min(a), max(a)+1)",
"range",
"min(a)",
"min",
"a",
"max(a)+1",
"max(a)",
"max",
"a",
"1",
"cnt = 0",
"cnt",
"0",
"for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n ",
"j",
"a",
"cnt += (j-i)**2",
"cnt",
"(j-i)**2",
"j-i",
"j",
"i",
"2",
"if cnt < t:\n t = cnt\n ",
"cnt < t",
"cnt",
"t",
"t = cnt",
"t",
"cnt",
"print(t)",
"print",
"t",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n import math\n _ = int(input())\n a = list(map(int, input().split()))\n t = float('inf')\n\n for i in range(min(a), max(a)+1):\n cnt = 0\n for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n else:\n print(t)\n\n ",
"def main():\n import math\n _ = int(input())\n a = list(map(int, input().split()))\n t = float('inf')\n\n for i in range(min(a), max(a)+1):\n cnt = 0\n for j in a:\n cnt += (j-i)**2\n else:\n if cnt < t:\n t = cnt\n else:\n print(t)\n\n ",
"main"
] | # C - いっしょ
def main():
import math
_ = int(input())
a = list(map(int, input().split()))
t = float('inf')
for i in range(min(a), max(a)+1):
cnt = 0
for j in a:
cnt += (j-i)**2
else:
if cnt < t:
t = cnt
else:
print(t)
if __name__ == "__main__":
main() |
[
7,
0,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
28,
13,
4,
13,
4,
13,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
4,
18,
13,
13,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13
] | [
[
60,
2
],
[
63,
6
],
[
57,
18
],
[
23,
22
],
[
64,
27
],
[
64,
31
],
[
66,
34
],
[
38,
37
],
[
64,
37
],
[
69,
40
],
[
37,
43
],
[
22,
44
],
[
58,
48
],
[
70,
50
],
[
67,
50
],
[
58,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
]
] | [
"n = input()\na = list(map(int, input().split()))\nans = list()\nfor i in range(min(a), max(a)+1):\n cost = 0\n for num in a:\n cost += (num - i)**2\n ans.append(cost)\nprint(min(ans))",
"n = input()",
"n",
"input()",
"input",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = list()",
"ans",
"list()",
"list",
"for i in range(min(a), max(a)+1):\n cost = 0\n for num in a:\n cost += (num - i)**2\n ans.append(cost)",
"i",
"range(min(a), max(a)+1)",
"range",
"min(a)",
"min",
"a",
"max(a)+1",
"max(a)",
"max",
"a",
"1",
"cost = 0",
"cost",
"0",
"for num in a:\n cost += (num - i)**2\n ",
"num",
"a",
"cost += (num - i)**2",
"cost",
"(num - i)**2",
"num - i",
"num",
"i",
"2",
"ans.append(cost)",
"ans.append",
"ans",
"append",
"cost",
"print(min(ans))",
"print",
"min(ans)",
"min",
"ans",
"ans = list()",
"list()",
"ans",
"n = input()",
"input()",
"n",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"cost = 0",
"0",
"cost",
"cost += (num - i)**2",
"(num - i)**2",
"cost"
] | n = input()
a = list(map(int, input().split()))
ans = list()
for i in range(min(a), max(a)+1):
cost = 0
for num in a:
cost += (num - i)**2
ans.append(cost)
print(min(ans)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
13,
18,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13
] | [
[
57,
2
],
[
60,
8
],
[
66,
20
],
[
26,
25
],
[
63,
31
],
[
35,
34
],
[
58,
37
],
[
69,
39
],
[
25,
42
],
[
61,
44
],
[
34,
45
],
[
72,
48
],
[
67,
51
],
[
73,
51
],
[
70,
52
],
[
64,
52
],
[
73,
55
],
[
67,
55
],
[
57,
58
],
[
60,
61
],
[
63,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
]
] | [
"n=int(input())\na=list(map(int,input().split()))\nans=10**18\nfor num in range(-100,101):\n cnt=0\n for i in range(n):\n cnt+=(num-a[i])**2\n ans=min(ans,cnt)\nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans=10**18",
"ans",
"10**18",
"10",
"18",
"for num in range(-100,101):\n cnt=0\n for i in range(n):\n cnt+=(num-a[i])**2\n ans=min(ans,cnt)",
"num",
"range(-100,101)",
"range",
"-100",
"101",
"cnt=0",
"cnt",
"0",
"for i in range(n):\n cnt+=(num-a[i])**2\n ",
"i",
"range(n)",
"range",
"n",
"cnt+=(num-a[i])**2",
"cnt",
"(num-a[i])**2",
"num-a[i]",
"num",
"a[i]",
"a",
"i",
"2",
"ans=min(ans,cnt)",
"ans",
"min(ans,cnt)",
"min",
"ans",
"cnt",
"print(ans)",
"print",
"ans",
"n=int(input())",
"int(input())",
"n",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"cnt=0",
"0",
"cnt",
"ans=10**18",
"10**18",
"ans",
"cnt+=(num-a[i])**2",
"(num-a[i])**2",
"cnt",
"ans=min(ans,cnt)",
"min(ans,cnt)",
"ans"
] | n=int(input())
a=list(map(int,input().split()))
ans=10**18
for num in range(-100,101):
cnt=0
for i in range(n):
cnt+=(num-a[i])**2
ans=min(ans,cnt)
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
4,
13,
13,
2,
4,
13,
13,
17,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
64,
2
],
[
70,
8
],
[
61,
20
],
[
26,
25
],
[
71,
30
],
[
71,
34
],
[
39,
38
],
[
71,
38
],
[
38,
43
],
[
25,
44
],
[
73,
47
],
[
67,
52
],
[
62,
55
],
[
68,
55
],
[
74,
56
],
[
68,
59
],
[
62,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] | [
"n=int(input())\nl=list(map(int,input().split()))\nans=float('inf')\nfor v in range(min(l),max(l)+1):\n c=sum([(a-v)**2 for a in l])\n ans=min(ans,c)\nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"l=list(map(int,input().split()))",
"l",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans=float('inf')",
"ans",
"float('inf')",
"float",
"'inf'",
"for v in range(min(l),max(l)+1):\n c=sum([(a-v)**2 for a in l])\n ans=min(ans,c)",
"v",
"range(min(l),max(l)+1)",
"range",
"min(l)",
"min",
"l",
"max(l)+1",
"max(l)",
"max",
"l",
"1",
"(a-v)**2 for a in l",
"for a in l",
"a",
"l",
"for a in l",
"(a-v)**2",
"a-v",
"a",
"v",
"2",
"c=sum([(a-v)**2 for a in l])",
"c",
"sum([(a-v)**2 for a in l])",
"sum",
"[(a-v)**2 for a in l]",
"ans=min(ans,c)",
"ans",
"min(ans,c)",
"min",
"ans",
"c",
"print(ans)",
"print",
"ans",
"ans=float('inf')",
"float('inf')",
"ans",
"n=int(input())",
"int(input())",
"n",
"ans=min(ans,c)",
"min(ans,c)",
"ans",
"l=list(map(int,input().split()))",
"list(map(int,input().split()))",
"l",
"c=sum([(a-v)**2 for a in l])",
"sum([(a-v)**2 for a in l])",
"c"
] | n=int(input())
l=list(map(int,input().split()))
ans=float('inf')
for v in range(min(l),max(l)+1):
c=sum([(a-v)**2 for a in l])
ans=min(ans,c)
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
41,
28,
13,
4,
18,
4,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
4,
13,
2,
4,
13,
13,
13,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
4,
13,
4,
13,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] | [
[
47,
2
],
[
10,
9
],
[
9,
18
],
[
50,
20
],
[
53,
23
],
[
51,
29
],
[
48,
30
],
[
34,
33
],
[
51,
33
],
[
33,
38
],
[
54,
39
],
[
47,
48
],
[
50,
51
],
[
53,
54
]
] | [
"n=int(input())\na=[int(i)for i in input().split()]\nb=round(sum(a)/n)\nprint(sum([(i-b)**2 for i in a]))",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"int(i)for i in input().split()",
"for i in input().split()",
"i",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in input().split()",
"int(i)",
"int",
"i",
"a=[int(i)for i in input().split()]",
"a",
"[int(i)for i in input().split()]",
"b=round(sum(a)/n)",
"b",
"round(sum(a)/n)",
"round",
"sum(a)/n",
"sum(a)",
"sum",
"a",
"n",
"(i-b)**2 for i in a",
"for i in a",
"i",
"a",
"for i in a",
"(i-b)**2",
"i-b",
"i",
"b",
"2",
"print(sum([(i-b)**2 for i in a]))",
"print",
"sum([(i-b)**2 for i in a])",
"sum",
"[(i-b)**2 for i in a]",
"n=int(input())",
"int(input())",
"n",
"a=[int(i)for i in input().split()]",
"[int(i)for i in input().split()]",
"a",
"b=round(sum(a)/n)",
"round(sum(a)/n)",
"b"
] | n=int(input())
a=[int(i)for i in input().split()]
b=round(sum(a)/n)
print(sum([(i-b)**2 for i in a])) |
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
11,
10
],
[
23,
22
],
[
28,
27
],
[
34,
33
],
[
37,
36
],
[
10,
36
],
[
40,
39
],
[
36,
42
],
[
27,
43
],
[
47,
46
],
[
22,
49
],
[
46,
49
],
[
39,
50
],
[
33,
50
],
[
46,
53
],
[
22,
53
],
[
58,
55
]
] | [
"def resolve():\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\tans = float('inf')\n\tfor i in range(-100, 101):\n\t\ttmp = 0\n\t\tfor j in a:\n\t\t\ttmp += (j - i)**2\n\t\tans = min(ans, tmp)\n\tprint(ans)\nresolve()",
"def resolve():\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\tans = float('inf')\n\tfor i in range(-100, 101):\n\t\ttmp = 0\n\t\tfor j in a:\n\t\t\ttmp += (j - i)**2\n\t\tans = min(ans, tmp)\n\tprint(ans)",
"resolve",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = float('inf')",
"ans",
"float('inf')",
"float",
"'inf'",
"for i in range(-100, 101):\n\t\ttmp = 0\n\t\tfor j in a:\n\t\t\ttmp += (j - i)**2\n\t\tans = min(ans, tmp)\n\t",
"i",
"range(-100, 101)",
"range",
"-100",
"101",
"tmp = 0",
"tmp",
"0",
"for j in a:\n\t\t\ttmp += (j - i)**2\n\t\t",
"j",
"a",
"tmp += (j - i)**2",
"tmp",
"(j - i)**2",
"j - i",
"j",
"i",
"2",
"ans = min(ans, tmp)",
"ans",
"min(ans, tmp)",
"min",
"ans",
"tmp",
"print(ans)",
"print",
"ans",
"resolve()",
"resolve",
"def resolve():\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\tans = float('inf')\n\tfor i in range(-100, 101):\n\t\ttmp = 0\n\t\tfor j in a:\n\t\t\ttmp += (j - i)**2\n\t\tans = min(ans, tmp)\n\tprint(ans)",
"def resolve():\n\tn = int(input())\n\ta = list(map(int, input().split()))\n\tans = float('inf')\n\tfor i in range(-100, 101):\n\t\ttmp = 0\n\t\tfor j in a:\n\t\t\ttmp += (j - i)**2\n\t\tans = min(ans, tmp)\n\tprint(ans)",
"resolve"
] | def resolve():
n = int(input())
a = list(map(int, input().split()))
ans = float('inf')
for i in range(-100, 101):
tmp = 0
for j in a:
tmp += (j - i)**2
ans = min(ans, tmp)
print(ans)
resolve() |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
4,
13,
13,
0,
18,
13,
13,
4,
13,
18,
13,
13,
4,
18,
13,
13,
12,
13,
29,
2,
2,
13,
13,
17,
23,
13,
23,
13,
0,
13,
39,
28,
13,
4,
13,
18,
13,
17,
18,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
13,
4,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
14,
40,
13,
39,
4,
13,
18,
13,
17,
4,
13,
17,
10,
17,
13,
10,
4,
13,
10,
39,
13,
10,
12,
13,
10,
2,
13,
10,
4,
13
] | [
[
110,
2
],
[
98,
8
],
[
16,
15
],
[
99,
20
],
[
25,
22
],
[
99,
23
],
[
15,
24
],
[
22,
27
],
[
99,
28
],
[
15,
29
],
[
99,
32
],
[
43,
39
],
[
45,
40
],
[
43,
43
],
[
45,
45
],
[
101,
47
],
[
51,
50
],
[
99,
54
],
[
99,
57
],
[
95,
60
],
[
64,
63
],
[
99,
63
],
[
107,
66
],
[
96,
68
],
[
108,
68
],
[
105,
70
],
[
63,
71
],
[
50,
72
],
[
102,
75
],
[
108,
77
],
[
96,
77
],
[
102,
80
],
[
102,
84
],
[
102,
89
],
[
95,
96
],
[
98,
99
],
[
101,
102
],
[
107,
108
],
[
110,
111
]
] | [
"#入力\nN = int(input())\nlst = input().split()\n\n#整数値化\nfor i in range(len(lst)):\n lst[i] = int(lst[i])\n\n#ソート\nlst.sort()\n\n#コスト計算関数\ndef get_cost(x, y):\n return (x - y) ** 2\n\ncosts = []\n\n#コスト計算\nfor i in range(lst[0], lst[-1]): #入力値の最小値から最大値まで\n cost = 0\n for j in lst:\n cost = cost + get_cost(j, i)\n costs.append(cost)\n\n#ソート\ncosts.sort()\n\n#最小コストを出力\n#入力値が全て同じとき最小も最大も同じなのでfor文の中のやつは1回も実行されない\n#つまりcostsリストが空なのでcosts[0]が存在しない\nif costs != []:\n print(costs[0])\nelse:\n print(0)",
"N = int(input())",
"N",
"int(input())",
"int",
"input()",
"input",
"lst = input().split()",
"lst",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in range(len(lst)):\n lst[i] = int(lst[i])\n\n#ソート",
"i",
"range(len(lst))",
"range",
"len(lst)",
"len",
"lst",
"lst[i] = int(lst[i])",
"lst[i]",
"lst",
"i",
"int(lst[i])",
"int",
"lst[i]",
"lst",
"i",
"lst.sort()",
"lst.sort",
"lst",
"sort",
"def get_cost(x, y):\n return (x - y) ** 2",
"get_cost",
"return (x - y) ** 2",
"(x - y) ** 2",
"x - y",
"x",
"y",
"2",
"x",
"x",
"y",
"y",
"costs = []",
"costs",
"[]",
"for i in range(lst[0], lst[-1]): #入力値の最小値から最大値まで\n cost = 0\n for j in lst:\n cost = cost + get_cost(j, i)\n costs.append(cost)\n\n#ソート",
"i",
"range(lst[0], lst[-1])",
"range",
"lst[0]",
"lst",
"0",
"lst[-1]",
"lst",
"-1",
"cost = 0",
"cost",
"0",
"for j in lst:\n cost = cost + get_cost(j, i)\n ",
"j",
"lst",
"cost = cost + get_cost(j, i)",
"cost",
"cost + get_cost(j, i)",
"cost",
"get_cost(j, i)",
"get_cost",
"j",
"i",
"costs.append(cost)",
"costs.append",
"costs",
"append",
"cost",
"costs.sort()",
"costs.sort",
"costs",
"sort",
"if costs != []:\n print(costs[0])\nelse:\n print(0)",
"costs != []",
"costs",
"[]",
"print(costs[0])",
"print",
"costs[0]",
"costs",
"0",
"print(0)",
"print",
"0",
"cost = 0",
"0",
"cost",
"lst = input().split()",
"input().split()",
"lst",
"costs = []",
"[]",
"costs",
"def get_cost(x, y):\n return (x - y) ** 2",
"def get_cost(x, y):\n return (x - y) ** 2",
"get_cost",
"cost = cost + get_cost(j, i)",
"cost + get_cost(j, i)",
"cost",
"N = int(input())",
"int(input())",
"N"
] | #入力
N = int(input())
lst = input().split()
#整数値化
for i in range(len(lst)):
lst[i] = int(lst[i])
#ソート
lst.sort()
#コスト計算関数
def get_cost(x, y):
return (x - y) ** 2
costs = []
#コスト計算
for i in range(lst[0], lst[-1]): #入力値の最小値から最大値まで
cost = 0
for j in lst:
cost = cost + get_cost(j, i)
costs.append(cost)
#ソート
costs.sort()
#最小コストを出力
#入力値が全て同じとき最小も最大も同じなのでfor文の中のやつは1回も実行されない
#つまりcostsリストが空なのでcosts[0]が存在しない
if costs != []:
print(costs[0])
else:
print(0) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
0,
13,
18,
13,
17,
0,
13,
18,
13,
17,
0,
13,
4,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
18,
13,
10,
17,
13,
10,
18,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
85,
2
],
[
82,
8
],
[
83,
21
],
[
79,
24
],
[
83,
26
],
[
73,
29
],
[
83,
31
],
[
88,
34
],
[
40,
39
],
[
80,
42
],
[
74,
44
],
[
76,
47
],
[
51,
50
],
[
86,
53
],
[
94,
55
],
[
83,
59
],
[
50,
60
],
[
39,
61
],
[
91,
64
],
[
89,
67
],
[
92,
67
],
[
95,
68
],
[
77,
68
],
[
92,
71
],
[
89,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
]
] | [
"n=int(input())\na=list(map(int,input().split()))\na.sort()\n\nl=a[0]\nr=a[-1]\n\nans=float('inf')\nfor pin in range(l,r+1):\n cnt=0\n for i in range(n):\n cnt+=(a[i]-pin)**2\n \n ans=min(ans,cnt)\n \nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a.sort()",
"a.sort",
"a",
"sort",
"l=a[0]",
"l",
"a[0]",
"a",
"0",
"r=a[-1]",
"r",
"a[-1]",
"a",
"-1",
"ans=float('inf')",
"ans",
"float('inf')",
"float",
"'inf'",
"for pin in range(l,r+1):\n cnt=0\n for i in range(n):\n cnt+=(a[i]-pin)**2\n \n ans=min(ans,cnt)\n ",
"pin",
"range(l,r+1)",
"range",
"l",
"r+1",
"r",
"1",
"cnt=0",
"cnt",
"0",
"for i in range(n):\n cnt+=(a[i]-pin)**2\n \n ",
"i",
"range(n)",
"range",
"n",
"cnt+=(a[i]-pin)**2",
"cnt",
"(a[i]-pin)**2",
"a[i]-pin",
"a[i]",
"a",
"i",
"pin",
"2",
"ans=min(ans,cnt)",
"ans",
"min(ans,cnt)",
"min",
"ans",
"cnt",
"print(ans)",
"print",
"ans",
"r=a[-1]",
"a[-1]",
"r",
"cnt=0",
"0",
"cnt",
"l=a[0]",
"a[0]",
"l",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"n=int(input())",
"int(input())",
"n",
"ans=float('inf')",
"float('inf')",
"ans",
"ans=min(ans,cnt)",
"min(ans,cnt)",
"ans",
"cnt+=(a[i]-pin)**2",
"(a[i]-pin)**2",
"cnt"
] | n=int(input())
a=list(map(int,input().split()))
a.sort()
l=a[0]
r=a[-1]
ans=float('inf')
for pin in range(l,r+1):
cnt=0
for i in range(n):
cnt+=(a[i]-pin)**2
ans=min(ans,cnt)
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
17,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
13,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13
] | [
[
68,
2
],
[
74,
8
],
[
71,
20
],
[
26,
25
],
[
65,
32
],
[
36,
35
],
[
69,
38
],
[
62,
40
],
[
75,
44
],
[
35,
45
],
[
25,
46
],
[
63,
50
],
[
66,
50
],
[
72,
51
],
[
60,
51
],
[
59,
53
],
[
63,
54
],
[
66,
54
],
[
60,
57
],
[
72,
57
],
[
63,
59
],
[
66,
59
],
[
59,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
]
] | [
"n=int(input())\na=list(map(int,input().split()))\ncost=float(\"inf\")\nfor j in range(-100,101,1):\n total=0\n for i in range(n):\n total+=(a[i]-j)**2\n if total<cost:\n cost=total\nprint(cost)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"cost=float(\"inf\")",
"cost",
"float(\"inf\")",
"float",
"\"inf\"",
"for j in range(-100,101,1):\n total=0\n for i in range(n):\n total+=(a[i]-j)**2\n if total<cost:\n cost=total",
"j",
"range(-100,101,1)",
"range",
"-100",
"101",
"1",
"total=0",
"total",
"0",
"for i in range(n):\n total+=(a[i]-j)**2\n ",
"i",
"range(n)",
"range",
"n",
"total+=(a[i]-j)**2",
"total",
"(a[i]-j)**2",
"a[i]-j",
"a[i]",
"a",
"i",
"j",
"2",
"if total<cost:\n cost=total",
"total<cost",
"total",
"cost",
"cost=total",
"cost",
"total",
"print(cost)",
"print",
"cost",
"cost=total",
"total",
"cost",
"total+=(a[i]-j)**2",
"(a[i]-j)**2",
"total",
"total=0",
"0",
"total",
"n=int(input())",
"int(input())",
"n",
"cost=float(\"inf\")",
"float(\"inf\")",
"cost",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a"
] | n=int(input())
a=list(map(int,input().split()))
cost=float("inf")
for j in range(-100,101,1):
total=0
for i in range(n):
total+=(a[i]-j)**2
if total<cost:
cost=total
print(cost) |
[
7,
0,
13,
2,
17,
17,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
28,
13,
4,
13,
17,
17,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
13,
13
] | [
[
67,
2
],
[
70,
7
],
[
61,
13
],
[
26,
25
],
[
33,
32
],
[
62,
32
],
[
25,
37
],
[
32,
38
],
[
73,
41
],
[
64,
44
],
[
74,
47
],
[
58,
49
],
[
68,
52
],
[
59,
52
],
[
65,
53
],
[
59,
56
],
[
68,
56
],
[
58,
59
],
[
61,
62
],
[
64,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
]
] | [
"maxa=(10)**11\nN=int(input())\nL=list(map(int,input().split()))\nfor i in range(-100,101):\n R=[(i-y)**2 for y in L]\n a=sum(R)\n maxa=min(maxa,a)\nprint(maxa)",
"maxa=(10)**11",
"maxa",
"(10)**11",
"10",
"11",
"N=int(input())",
"N",
"int(input())",
"int",
"input()",
"input",
"L=list(map(int,input().split()))",
"L",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"for i in range(-100,101):\n R=[(i-y)**2 for y in L]\n a=sum(R)\n maxa=min(maxa,a)",
"i",
"range(-100,101)",
"range",
"-100",
"101",
"(i-y)**2 for y in L",
"for y in L",
"y",
"L",
"for y in L",
"(i-y)**2",
"i-y",
"i",
"y",
"2",
"R=[(i-y)**2 for y in L]",
"R",
"[(i-y)**2 for y in L]",
"a=sum(R)",
"a",
"sum(R)",
"sum",
"R",
"maxa=min(maxa,a)",
"maxa",
"min(maxa,a)",
"min",
"maxa",
"a",
"print(maxa)",
"print",
"maxa",
"maxa=min(maxa,a)",
"min(maxa,a)",
"maxa",
"L=list(map(int,input().split()))",
"list(map(int,input().split()))",
"L",
"a=sum(R)",
"sum(R)",
"a",
"maxa=(10)**11",
"(10)**11",
"maxa",
"N=int(input())",
"int(input())",
"N",
"R=[(i-y)**2 for y in L]",
"[(i-y)**2 for y in L]",
"R"
] | maxa=(10)**11
N=int(input())
L=list(map(int,input().split()))
for i in range(-100,101):
R=[(i-y)**2 for y in L]
a=sum(R)
maxa=min(maxa,a)
print(maxa) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
4,
18,
13,
13,
0,
13,
2,
17,
17,
28,
13,
4,
13,
18,
13,
17,
2,
18,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13
] | [
[
67,
2
],
[
79,
8
],
[
80,
21
],
[
76,
24
],
[
30,
29
],
[
80,
33
],
[
80,
37
],
[
82,
41
],
[
45,
44
],
[
68,
47
],
[
73,
49
],
[
80,
53
],
[
44,
54
],
[
29,
55
],
[
70,
58
],
[
77,
61
],
[
71,
61
],
[
74,
62
],
[
83,
62
],
[
71,
65
],
[
77,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
]
] | [
"n=int(input())\na=list(map(int, input().split()))\na.sort()\nans=10**10\nfor x in range(a[0],a[-1]+1):\n tmp=0\n for i in range(n):\n tmp+=(a[i]-x)**2\n ans=min(ans,tmp)\nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a=list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a.sort()",
"a.sort",
"a",
"sort",
"ans=10**10",
"ans",
"10**10",
"10",
"10",
"for x in range(a[0],a[-1]+1):\n tmp=0\n for i in range(n):\n tmp+=(a[i]-x)**2\n ans=min(ans,tmp)",
"x",
"range(a[0],a[-1]+1)",
"range",
"a[0]",
"a",
"0",
"a[-1]+1",
"a[-1]",
"a",
"-1",
"1",
"tmp=0",
"tmp",
"0",
"for i in range(n):\n tmp+=(a[i]-x)**2\n ",
"i",
"range(n)",
"range",
"n",
"tmp+=(a[i]-x)**2",
"tmp",
"(a[i]-x)**2",
"a[i]-x",
"a[i]",
"a",
"i",
"x",
"2",
"ans=min(ans,tmp)",
"ans",
"min(ans,tmp)",
"min",
"ans",
"tmp",
"print(ans)",
"print",
"ans",
"n=int(input())",
"int(input())",
"n",
"ans=min(ans,tmp)",
"min(ans,tmp)",
"ans",
"tmp+=(a[i]-x)**2",
"(a[i]-x)**2",
"tmp",
"ans=10**10",
"10**10",
"ans",
"a=list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"tmp=0",
"0",
"tmp"
] | 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) |
[
7,
15,
13,
15,
13,
12,
13,
0,
13,
17,
0,
13,
4,
13,
17,
4,
18,
13,
13,
2,
17,
17,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
12,
13,
0,
13,
4,
13,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
13,
0,
13,
8,
40,
2,
4,
18,
13,
13,
13,
13,
2,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
4,
18,
13,
13,
13,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
4,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
9,
8
],
[
12,
11
],
[
38,
37
],
[
25,
39
],
[
42,
41
],
[
31,
43
],
[
46,
45
],
[
41,
49
],
[
37,
50
],
[
53,
52
],
[
45,
60
],
[
45,
61
],
[
45,
63
],
[
45,
68
],
[
45,
73
],
[
45,
78
],
[
82,
81
],
[
41,
81
],
[
81,
86
],
[
52,
87
],
[
45,
87
],
[
102,
99
]
] | [
"#!/usr/bin/env python3\n\nimport sys\nimport math\n# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits\n# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from operator import itemgetter # itemgetter(1), itemgetter('key')\n# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()\n# from collections import defaultdict # subclass of dict. defaultdict(facroty)\n# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)\n# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).\n# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).\n# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])\n# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]\n# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]\n# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])\n# from itertools import combinations, combinations_with_replacement\n# from itertools import accumulate # accumulate(iter[, f])\n# from functools import reduce # reduce(f, iter[, init])\n# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)\n# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).\n# from copy import deepcopy # to copy multi-dimentional matrix without reference\n# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)\n\n\ndef main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n n = ii()\n L = lmi()\n avg = sum(L) / n\n avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)\n print(sum([(elm - avg) ** 2 for elm in L]))\n\n\nif __name__ == \"__main__\":\n main()",
"import sys",
"sys",
"import math",
"math",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n n = ii()\n L = lmi()\n avg = sum(L) / n\n avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)\n print(sum([(elm - avg) ** 2 for elm in L]))",
"main",
"mod = 1000000007",
"mod",
"1000000007",
"inf = float('inf')",
"inf",
"float('inf')",
"float",
"'inf'",
"sys.setrecursionlimit(10**6)",
"sys.setrecursionlimit",
"sys",
"setrecursionlimit",
"10**6",
"10",
"6",
"def input(): return sys.stdin.readline().rstrip()\n ",
"input",
"def ii(): return int(input())\n ",
"ii",
"def mi(): return map(int, input().split())\n ",
"mi",
"def mi_0(): return map(lambda x: int(x)-1, input().split())\n ",
"mi_0",
"def lmi(): return list(map(int, input().split()))\n ",
"lmi",
"def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n ",
"lmi_0",
"def li(): return list(input())\n \n \n ",
"li",
"n = ii()",
"n",
"ii()",
"ii",
"L = lmi()",
"L",
"lmi()",
"lmi",
"avg = sum(L) / n",
"avg",
"sum(L) / n",
"sum(L)",
"sum",
"L",
"n",
"avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)",
"avg",
"math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)",
"math.ceil(avg) - avg <= avg - math.floor(avg)",
"math.ceil(avg) - avg",
"math.ceil(avg)",
"math.ceil",
"math",
"ceil",
"avg",
"avg",
"avg - math.floor(avg)",
"avg",
"math.floor(avg)",
"math.floor",
"math",
"floor",
"avg",
"math.ceil(avg)",
"math.ceil",
"math",
"ceil",
"avg",
"math.floor(avg)",
"math.floor",
"math",
"floor",
"avg",
"(elm - avg) ** 2 for elm in L",
"for elm in L",
"elm",
"L",
"for elm in L",
"(elm - avg) ** 2",
"elm - avg",
"elm",
"avg",
"2",
"print(sum([(elm - avg) ** 2 for elm in L]))",
"print",
"sum([(elm - avg) ** 2 for elm in L])",
"sum",
"[(elm - avg) ** 2 for elm in L]",
"if __name__ == \"__main__\":\n main()",
"__name__ == \"__main__\"",
"__name__",
"\"__main__\"",
"main()",
"main",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n n = ii()\n L = lmi()\n avg = sum(L) / n\n avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)\n print(sum([(elm - avg) ** 2 for elm in L]))",
"def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n n = ii()\n L = lmi()\n avg = sum(L) / n\n avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)\n print(sum([(elm - avg) ** 2 for elm in L]))",
"main"
] | #!/usr/bin/env python3
import sys
import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter # itemgetter(1), itemgetter('key')
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict # subclass of dict. defaultdict(facroty)
# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate # accumulate(iter[, f])
# from functools import reduce # reduce(f, iter[, init])
# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy # to copy multi-dimentional matrix without reference
# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)
def main():
mod = 1000000007 # 10^9+7
inf = float('inf') # sys.float_info.max = 1.79...e+308
# inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19
sys.setrecursionlimit(10**6) # 1000 -> 1000000
def input(): return sys.stdin.readline().rstrip()
def ii(): return int(input())
def mi(): return map(int, input().split())
def mi_0(): return map(lambda x: int(x)-1, input().split())
def lmi(): return list(map(int, input().split()))
def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
def li(): return list(input())
n = ii()
L = lmi()
avg = sum(L) / n
avg = math.ceil(avg) if math.ceil(avg) - avg <= avg - math.floor(avg) else math.floor(avg)
print(sum([(elm - avg) ** 2 for elm in L]))
if __name__ == "__main__":
main()
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
41,
28,
13,
13,
4,
2,
13,
17,
0,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
2,
13,
13,
2,
13,
2,
13,
13,
4,
13,
2,
2,
2,
2,
13,
17,
2,
13,
17,
13,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
4,
13
] | [
[
66,
2
],
[
69,
8
],
[
22,
21
],
[
70,
21
],
[
21,
25
],
[
78,
28
],
[
81,
31
],
[
70,
34
],
[
72,
36
],
[
79,
39
],
[
75,
41
],
[
82,
45
],
[
67,
46
],
[
67,
48
],
[
82,
50
],
[
67,
51
],
[
76,
58
],
[
82,
61
],
[
67,
63
],
[
73,
64
],
[
66,
67
],
[
69,
70
],
[
72,
73
],
[
75,
76
],
[
78,
79
],
[
81,
82
]
] | [
"n=int(input())\nintegers=list(map(int,input().split()))\n \nsql=[x**2 for x in integers]\ns=sum(integers)\nt=sum(sql)\nm=min(s%n, n-s%n)\n \nprint((m**2-s**2)//n+t)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"integers=list(map(int,input().split()))",
"integers",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x**2 for x in integers",
"for x in integers",
"x",
"integers",
"for x in integers",
"x**2",
"x",
"2",
"sql=[x**2 for x in integers]",
"sql",
"[x**2 for x in integers]",
"s=sum(integers)",
"s",
"sum(integers)",
"sum",
"integers",
"t=sum(sql)",
"t",
"sum(sql)",
"sum",
"sql",
"m=min(s%n, n-s%n)",
"m",
"min(s%n, n-s%n)",
"min",
"s%n",
"s",
"n",
"n-s%n",
"n",
"s%n",
"s",
"n",
"print((m**2-s**2)//n+t)",
"print",
"(m**2-s**2)//n+t",
"(m**2-s**2)//n",
"m**2-s**2",
"m**2",
"m",
"2",
"s**2",
"s",
"2",
"n",
"t",
"n=int(input())",
"int(input())",
"n",
"integers=list(map(int,input().split()))",
"list(map(int,input().split()))",
"integers",
"t=sum(sql)",
"sum(sql)",
"t",
"m=min(s%n, n-s%n)",
"min(s%n, n-s%n)",
"m",
"sql=[x**2 for x in integers]",
"[x**2 for x in integers]",
"sql",
"s=sum(integers)",
"sum(integers)",
"s"
] | n=int(input())
integers=list(map(int,input().split()))
sql=[x**2 for x in integers]
s=sum(integers)
t=sum(sql)
m=min(s%n, n-s%n)
print((m**2-s**2)//n+t) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
18,
4,
13,
13,
17,
41,
28,
13,
13,
4,
4,
13,
13,
0,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
18,
13,
13,
14,
2,
2,
13,
13,
17,
0,
13,
13,
14,
40,
2,
13,
13,
2,
13,
17,
0,
13,
13,
0,
13,
40,
2,
40,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
18,
13,
13,
13,
0,
13,
2,
13,
13,
4,
13,
13,
10,
40,
13,
10,
17,
13,
10,
18,
13,
10,
13,
13,
10,
13,
13,
10,
2,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13
] | [
[
117,
2
],
[
114,
8
],
[
18,
17
],
[
115,
17
],
[
17,
22
],
[
102,
24
],
[
108,
27
],
[
31,
30
],
[
118,
33
],
[
96,
35
],
[
103,
37
],
[
30,
38
],
[
97,
42
],
[
109,
42
],
[
118,
43
],
[
99,
46
],
[
118,
47
],
[
97,
51
],
[
109,
51
],
[
118,
52
],
[
118,
54
],
[
120,
57
],
[
118,
58
],
[
90,
60
],
[
97,
64
],
[
109,
64
],
[
118,
65
],
[
93,
67
],
[
71,
70
],
[
118,
73
],
[
111,
75
],
[
103,
78
],
[
70,
79
],
[
91,
80
],
[
121,
80
],
[
100,
80
],
[
97,
80
],
[
109,
80
],
[
105,
82
],
[
112,
84
],
[
112,
85
],
[
106,
88
],
[
94,
88
],
[
90,
91
],
[
93,
94
],
[
96,
97
],
[
118,
99
],
[
99,
100
],
[
102,
103
],
[
105,
106
],
[
108,
109
],
[
111,
112
],
[
114,
115
],
[
117,
118
],
[
118,
120
],
[
120,
121
]
] | [
"num = int(input())\nstr_line = input().split(\" \")\nnum_line = [int(n) for n in str_line]\n\nave = 0\nfor i in range(num):\n ave += num_line[i]\n\nif ave%num == 0:\n ave //= num\n\nelse:\n if ave%num <= num/2:\n ave //= num\n else:\n ave = -(-ave//num)\n\nwa = 0\nfor i in range(num):\n temp = num_line[i] - ave\n wa += temp*temp\n \nprint(wa)",
"num = int(input())",
"num",
"int(input())",
"int",
"input()",
"input",
"str_line = input().split(\" \")",
"str_line",
"input().split(\" \")",
"().split",
"()",
"input",
"split",
"\" \"",
"int(n) for n in str_line",
"for n in str_line",
"n",
"str_line",
"for n in str_line",
"int(n)",
"int",
"n",
"num_line = [int(n) for n in str_line]",
"num_line",
"[int(n) for n in str_line]",
"ave = 0",
"ave",
"0",
"for i in range(num):\n ave += num_line[i]",
"i",
"range(num)",
"range",
"num",
"ave += num_line[i]",
"ave",
"num_line[i]",
"num_line",
"i",
"if ave%num == 0:\n ave //= num\n\nelse:\n if ave%num <= num/2:\n ave //= num\n else:\n ave = -(-ave//num)",
"ave%num == 0",
"ave%num",
"ave",
"num",
"0",
"ave //= num",
"ave",
"num",
"if ave%num <= num/2:\n ave //= num\n else:\n ave = -(-ave//num)",
"ave%num <= num/2",
"ave%num",
"ave",
"num",
"num/2",
"num",
"2",
"ave //= num",
"ave",
"num",
"ave = -(-ave//num)",
"ave",
"-(-ave//num)",
"-ave//num",
"-ave",
"ave",
"num",
"wa = 0",
"wa",
"0",
"for i in range(num):\n temp = num_line[i] - ave\n wa += temp*temp\n ",
"i",
"range(num)",
"range",
"num",
"temp = num_line[i] - ave",
"temp",
"num_line[i] - ave",
"num_line[i]",
"num_line",
"i",
"ave",
"wa += temp*temp",
"wa",
"temp*temp",
"temp",
"temp",
"print(wa)",
"print",
"wa",
"ave = -(-ave//num)",
"-(-ave//num)",
"ave",
"wa = 0",
"0",
"wa",
"ave += num_line[i]",
"num_line[i]",
"ave",
"ave //= num",
"num",
"ave",
"num_line = [int(n) for n in str_line]",
"[int(n) for n in str_line]",
"num_line",
"wa += temp*temp",
"temp*temp",
"wa",
"ave = 0",
"0",
"ave",
"temp = num_line[i] - ave",
"num_line[i] - ave",
"temp",
"str_line = input().split(\" \")",
"input().split(\" \")",
"str_line",
"num = int(input())",
"int(input())",
"num",
"ave //= num",
"num",
"ave"
] | num = int(input())
str_line = input().split(" ")
num_line = [int(n) for n in str_line]
ave = 0
for i in range(num):
ave += num_line[i]
if ave%num == 0:
ave //= num
else:
if ave%num <= num/2:
ave //= num
else:
ave = -(-ave//num)
wa = 0
for i in range(num):
temp = num_line[i] - ave
wa += temp*temp
print(wa) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
2,
13,
13,
0,
13,
13,
4,
13,
13,
10,
17,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
13,
13,
10,
17,
13,
10,
2,
13
] | [
[
77,
2
],
[
71,
8
],
[
74,
20
],
[
83,
23
],
[
27,
26
],
[
72,
26
],
[
86,
29
],
[
26,
32
],
[
75,
33
],
[
37,
36
],
[
65,
42
],
[
46,
45
],
[
72,
45
],
[
68,
48
],
[
45,
51
],
[
36,
52
],
[
69,
56
],
[
66,
56
],
[
87,
57
],
[
84,
57
],
[
81,
57
],
[
80,
59
],
[
69,
60
],
[
66,
60
],
[
81,
63
],
[
87,
63
],
[
84,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
],
[
77,
78
],
[
69,
80
],
[
66,
80
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"N = int(input())\na = list(map(int, input().split()))\nx = 100\ncount1 = 0\nfor i in a:\n count1 += (i - x)**2\n\nfor X in range(-100, 100):\n count = 0\n for i in a:\n count += (i - X)**2\n if count < count1:\n count1 = count\n\nprint(count1)",
"N = int(input())",
"N",
"int(input())",
"int",
"input()",
"input",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"x = 100",
"x",
"100",
"count1 = 0",
"count1",
"0",
"for i in a:\n count1 += (i - x)**2",
"i",
"a",
"count1 += (i - x)**2",
"count1",
"(i - x)**2",
"i - x",
"i",
"x",
"2",
"for X in range(-100, 100):\n count = 0\n for i in a:\n count += (i - X)**2\n if count < count1:\n count1 = count",
"X",
"range(-100, 100)",
"range",
"-100",
"100",
"count = 0",
"count",
"0",
"for i in a:\n count += (i - X)**2\n ",
"i",
"a",
"count += (i - X)**2",
"count",
"(i - X)**2",
"i - X",
"i",
"X",
"2",
"if count < count1:\n count1 = count",
"count < count1",
"count",
"count1",
"count1 = count",
"count1",
"count",
"print(count1)",
"print",
"count1",
"count = 0",
"0",
"count",
"count += (i - X)**2",
"(i - X)**2",
"count",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"x = 100",
"100",
"x",
"N = int(input())",
"int(input())",
"N",
"count1 = count",
"count",
"count1",
"count1 = 0",
"0",
"count1",
"count1 += (i - x)**2",
"(i - x)**2",
"count1"
] | N = int(input())
a = list(map(int, input().split()))
x = 100
count1 = 0
for i in a:
count1 += (i - x)**2
for X in range(-100, 100):
count = 0
for i in a:
count += (i - X)**2
if count < count1:
count1 = count
print(count1)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
4,
13,
13,
13,
0,
13,
2,
13,
17,
0,
13,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
2,
2,
18,
13,
13,
13,
17,
4,
13,
4,
13,
13,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
17,
13,
10,
2,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13
] | [
[
70,
2
],
[
85,
8
],
[
88,
20
],
[
86,
24
],
[
71,
25
],
[
67,
27
],
[
89,
29
],
[
73,
32
],
[
76,
35
],
[
39,
38
],
[
71,
41
],
[
82,
43
],
[
86,
47
],
[
38,
48
],
[
89,
49
],
[
79,
52
],
[
86,
56
],
[
38,
57
],
[
68,
58
],
[
83,
64
],
[
74,
64
],
[
80,
65
],
[
77,
65
],
[
67,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
]
] | [
"n = int(input())\na = list(map(int, input().split()))\nave = sum(a)//n\nave1 = ave + 1\nans = 0\nans1 = 0\nfor i in range(n):\n ans += (a[i] - ave)**2\n ans1 += (a[i] - ave1)**2\nprint(min(ans, ans1))",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a = list(map(int, input().split()))",
"a",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ave = sum(a)//n",
"ave",
"sum(a)//n",
"sum(a)",
"sum",
"a",
"n",
"ave1 = ave + 1",
"ave1",
"ave + 1",
"ave",
"1",
"ans = 0",
"ans",
"0",
"ans1 = 0",
"ans1",
"0",
"for i in range(n):\n ans += (a[i] - ave)**2\n ans1 += (a[i] - ave1)**2",
"i",
"range(n)",
"range",
"n",
"ans += (a[i] - ave)**2",
"ans",
"(a[i] - ave)**2",
"a[i] - ave",
"a[i]",
"a",
"i",
"ave",
"2",
"ans1 += (a[i] - ave1)**2",
"ans1",
"(a[i] - ave1)**2",
"a[i] - ave1",
"a[i]",
"a",
"i",
"ave1",
"2",
"print(min(ans, ans1))",
"print",
"min(ans, ans1)",
"min",
"ans",
"ans1",
"ave1 = ave + 1",
"ave + 1",
"ave1",
"n = int(input())",
"int(input())",
"n",
"ans = 0",
"0",
"ans",
"ans1 = 0",
"0",
"ans1",
"ans1 += (a[i] - ave1)**2",
"(a[i] - ave1)**2",
"ans1",
"ans += (a[i] - ave)**2",
"(a[i] - ave)**2",
"ans",
"a = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a",
"ave = sum(a)//n",
"sum(a)//n",
"ave"
] | n = int(input())
a = list(map(int, input().split()))
ave = sum(a)//n
ave1 = ave + 1
ans = 0
ans1 = 0
for i in range(n):
ans += (a[i] - ave)**2
ans1 += (a[i] - ave1)**2
print(min(ans, ans1)) |
[
7,
0,
13,
4,
13,
0,
31,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
28,
13,
4,
13,
4,
13,
13,
2,
4,
13,
13,
17,
4,
13,
13,
10,
4,
13,
10,
4,
13
] | [
[
47,
2
],
[
8,
6
],
[
50,
17
],
[
24,
23
],
[
23,
28
],
[
33,
32
],
[
51,
45
],
[
47,
48
],
[
50,
51
]
] | [
"N=input()\n*A,=map(int,input().split())\n\na=float('inf')\nfor i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A]))\nprint(a)",
"N=input()",
"N",
"input()",
"input",
"*A,=map(int,input().split())",
"*A",
"A",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"a=float('inf')",
"a",
"float('inf')",
"float",
"'inf'",
"(k-i)**2 for k in A",
"for k in A",
"k",
"A",
"for k in A",
"(k-i)**2",
"k-i",
"k",
"i",
"2",
"for i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A]))",
"i",
"range(min(A),max(A)+1)",
"range",
"min(A)",
"min",
"A",
"max(A)+1",
"max(A)",
"max",
"A",
"1",
"print(a)",
"print",
"a",
"N=input()",
"input()",
"N",
"a=float('inf')",
"float('inf')",
"a"
] | 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) |
[
7,
12,
13,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
13,
4,
13,
13,
0,
13,
39,
14,
2,
4,
13,
4,
13,
4,
13,
13,
17,
4,
13,
17,
0,
13,
17,
28,
13,
4,
13,
17,
17,
0,
13,
17,
4,
18,
13,
13,
17,
28,
13,
4,
13,
13,
0,
18,
13,
13,
2,
18,
13,
13,
2,
2,
18,
13,
13,
13,
17,
4,
13,
4,
13,
13,
14,
2,
13,
17,
4,
13,
10,
12,
13
] | [
[
5,
4
],
[
11,
10
],
[
23,
22
],
[
10,
29
],
[
10,
34
],
[
37,
36
],
[
10,
46
],
[
53,
52
],
[
56,
55
],
[
62,
61
],
[
36,
65
],
[
70,
69
],
[
4,
72
],
[
77,
74
],
[
36,
75
],
[
61,
76
],
[
52,
76
],
[
74,
78
],
[
36,
79
],
[
61,
80
],
[
52,
80
],
[
10,
84
],
[
69,
85
],
[
55,
86
],
[
36,
92
],
[
101,
98
]
] | [
"def main():\n n = int(input())\n al = list(map(int, input().split()))\n maxval = max(abs(max(al)), abs(min(al)))\n cost = []\n if len(list(set(al))) == 1 :\n print(\"0\")\n else :\n k = -1\n for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n print(min(cost))\n\n\n\nif __name__ == '__main__':\n main()",
"def main():\n n = int(input())\n al = list(map(int, input().split()))\n maxval = max(abs(max(al)), abs(min(al)))\n cost = []\n if len(list(set(al))) == 1 :\n print(\"0\")\n else :\n k = -1\n for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n print(min(cost))",
"main",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"al = list(map(int, input().split()))",
"al",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"maxval = max(abs(max(al)), abs(min(al)))",
"maxval",
"max(abs(max(al)), abs(min(al)))",
"max",
"abs(max(al))",
"abs",
"max(al)",
"max",
"al",
"abs(min(al))",
"abs",
"min(al)",
"min",
"al",
"cost = []",
"cost",
"[]",
"if len(list(set(al))) == 1 :\n print(\"0\")\n else :\n k = -1\n for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n print(min(cost))",
"len(list(set(al))) == 1",
"len(list(set(al)))",
"len",
"list(set(al))",
"list",
"set(al)",
"set",
"al",
"1",
"print(\"0\")",
"print",
"\"0\"",
"k = -1",
"k",
"-1",
"for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n ",
"i",
"range(-100,100)",
"range",
"-100",
"100",
"k += 1",
"k",
"1",
"cost.append(0)",
"cost.append",
"cost",
"append",
"0",
"for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n ",
"j",
"range(n)",
"range",
"n",
"cost[k] = cost[k] + (al[j] - i) ** 2",
"cost[k]",
"cost",
"k",
"cost[k] + (al[j] - i) ** 2",
"cost[k]",
"cost",
"k",
"(al[j] - i) ** 2",
"al[j] - i",
"al[j]",
"al",
"j",
"i",
"2",
"print(min(cost))",
"print",
"min(cost)",
"min",
"cost",
"if __name__ == '__main__':\n main()",
"__name__ == '__main__'",
"__name__",
"'__main__'",
"main()",
"main",
"def main():\n n = int(input())\n al = list(map(int, input().split()))\n maxval = max(abs(max(al)), abs(min(al)))\n cost = []\n if len(list(set(al))) == 1 :\n print(\"0\")\n else :\n k = -1\n for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n print(min(cost))",
"def main():\n n = int(input())\n al = list(map(int, input().split()))\n maxval = max(abs(max(al)), abs(min(al)))\n cost = []\n if len(list(set(al))) == 1 :\n print(\"0\")\n else :\n k = -1\n for i in range(-100,100) :\n k += 1\n cost.append(0)\n for j in range(n) :\n cost[k] = cost[k] + (al[j] - i) ** 2\n #print(cost[i])\n print(min(cost))",
"main"
] | 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) :
cost[k] = cost[k] + (al[j] - i) ** 2
#print(cost[i])
print(min(cost))
if __name__ == '__main__':
main()
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
39,
28,
13,
4,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
4,
18,
13,
13,
13,
4,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
39,
13,
10,
4,
13,
10,
17,
13
] | [
[
65,
2
],
[
56,
8
],
[
62,
20
],
[
24,
23
],
[
68,
29
],
[
33,
32
],
[
66,
35
],
[
59,
37
],
[
57,
41
],
[
32,
42
],
[
23,
43
],
[
63,
47
],
[
60,
49
],
[
69,
49
],
[
63,
54
],
[
56,
57
],
[
59,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
]
] | [
"N=int(input())\nS=list(map(int,input().split()))\nD=[]\nfor i in range(-101,102):\n goukei=0\n for j in range(N):\n goukei+=(S[j]-i)**2\n D.append(goukei)\n\nprint(min(D))",
"N=int(input())",
"N",
"int(input())",
"int",
"input()",
"input",
"S=list(map(int,input().split()))",
"S",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"D=[]",
"D",
"[]",
"for i in range(-101,102):\n goukei=0\n for j in range(N):\n goukei+=(S[j]-i)**2\n D.append(goukei)",
"i",
"range(-101,102)",
"range",
"-101",
"102",
"goukei=0",
"goukei",
"0",
"for j in range(N):\n goukei+=(S[j]-i)**2\n ",
"j",
"range(N)",
"range",
"N",
"goukei+=(S[j]-i)**2",
"goukei",
"(S[j]-i)**2",
"S[j]-i",
"S[j]",
"S",
"j",
"i",
"2",
"D.append(goukei)",
"D.append",
"D",
"append",
"goukei",
"print(min(D))",
"print",
"min(D)",
"min",
"D",
"S=list(map(int,input().split()))",
"list(map(int,input().split()))",
"S",
"goukei+=(S[j]-i)**2",
"(S[j]-i)**2",
"goukei",
"D=[]",
"[]",
"D",
"N=int(input())",
"int(input())",
"N",
"goukei=0",
"0",
"goukei"
] | N=int(input())
S=list(map(int,input().split()))
D=[]
for i in range(-101,102):
goukei=0
for j in range(N):
goukei+=(S[j]-i)**2
D.append(goukei)
print(min(D)) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
17,
17,
28,
13,
4,
13,
18,
13,
17,
2,
18,
13,
17,
17,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
13,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
2,
13
] | [
[
68,
2
],
[
77,
8
],
[
83,
22
],
[
28,
27
],
[
78,
31
],
[
78,
35
],
[
71,
39
],
[
43,
42
],
[
69,
45
],
[
86,
47
],
[
78,
51
],
[
42,
52
],
[
27,
53
],
[
74,
56
],
[
87,
57
],
[
80,
59
],
[
84,
62
],
[
81,
62
],
[
75,
63
],
[
72,
63
],
[
81,
66
],
[
84,
66
],
[
68,
69
],
[
71,
72
],
[
87,
74
],
[
74,
75
],
[
77,
78
],
[
80,
81
],
[
83,
84
],
[
86,
87
]
] | [
"N=int(input())\na=sorted(list(map(int,input().split())))\n\nans=10**9\nfor i in range(a[0],a[-1]+1):\n s=0\n for j in range(N):\n x=(a[j]-i)**2\n s+=x\n ans=min(ans,s)\n\nprint(ans)",
"N=int(input())",
"N",
"int(input())",
"int",
"input()",
"input",
"a=sorted(list(map(int,input().split())))",
"a",
"sorted(list(map(int,input().split())))",
"sorted",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans=10**9",
"ans",
"10**9",
"10",
"9",
"for i in range(a[0],a[-1]+1):\n s=0\n for j in range(N):\n x=(a[j]-i)**2\n s+=x\n ans=min(ans,s)",
"i",
"range(a[0],a[-1]+1)",
"range",
"a[0]",
"a",
"0",
"a[-1]+1",
"a[-1]",
"a",
"-1",
"1",
"s=0",
"s",
"0",
"for j in range(N):\n x=(a[j]-i)**2\n s+=x\n ",
"j",
"range(N)",
"range",
"N",
"x=(a[j]-i)**2",
"x",
"(a[j]-i)**2",
"a[j]-i",
"a[j]",
"a",
"j",
"i",
"2",
"s+=x",
"s",
"x",
"ans=min(ans,s)",
"ans",
"min(ans,s)",
"min",
"ans",
"s",
"print(ans)",
"print",
"ans",
"N=int(input())",
"int(input())",
"N",
"s=0",
"0",
"s",
"s+=x",
"x",
"s",
"a=sorted(list(map(int,input().split())))",
"sorted(list(map(int,input().split())))",
"a",
"ans=min(ans,s)",
"min(ans,s)",
"ans",
"ans=10**9",
"10**9",
"ans",
"x=(a[j]-i)**2",
"(a[j]-i)**2",
"x"
] | N=int(input())
a=sorted(list(map(int,input().split())))
ans=10**9
for i in range(a[0],a[-1]+1):
s=0
for j in range(N):
x=(a[j]-i)**2
s+=x
ans=min(ans,s)
print(ans)
|
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
4,
13,
13,
0,
13,
17,
28,
13,
4,
13,
13,
2,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
14,
40,
13,
17,
0,
13,
4,
13,
13,
13,
0,
13,
13,
4,
13,
13,
10,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13
] | [
[
79,
2
],
[
85,
8
],
[
88,
20
],
[
86,
23
],
[
73,
25
],
[
86,
28
],
[
91,
30
],
[
34,
33
],
[
74,
36
],
[
89,
38
],
[
82,
41
],
[
45,
44
],
[
86,
44
],
[
76,
47
],
[
44,
50
],
[
33,
51
],
[
92,
55
],
[
71,
55
],
[
95,
55
],
[
94,
58
],
[
92,
61
],
[
71,
61
],
[
95,
61
],
[
77,
62
],
[
83,
62
],
[
70,
64
],
[
77,
65
],
[
83,
65
],
[
71,
68
],
[
95,
68
],
[
92,
68
],
[
77,
70
],
[
83,
70
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
],
[
94,
95
]
] | [
"n = int(input())\na_lst = list(map(int, input().split()))\nmax_ = max(a_lst)\nmin_ = min(a_lst)\nres = 0\nfor num in range(min_, max_+1):\n cost = 0\n for a in a_lst:\n cost += (a - num) ** 2\n if res != 0:\n res = min(res, cost)\n else:\n res = cost\nprint(res)",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a_lst = list(map(int, input().split()))",
"a_lst",
"list(map(int, input().split()))",
"list",
"map(int, input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"max_ = max(a_lst)",
"max_",
"max(a_lst)",
"max",
"a_lst",
"min_ = min(a_lst)",
"min_",
"min(a_lst)",
"min",
"a_lst",
"res = 0",
"res",
"0",
"for num in range(min_, max_+1):\n cost = 0\n for a in a_lst:\n cost += (a - num) ** 2\n if res != 0:\n res = min(res, cost)\n else:\n res = cost",
"num",
"range(min_, max_+1)",
"range",
"min_",
"max_+1",
"max_",
"1",
"cost = 0",
"cost",
"0",
"for a in a_lst:\n cost += (a - num) ** 2\n ",
"a",
"a_lst",
"cost += (a - num) ** 2",
"cost",
"(a - num) ** 2",
"a - num",
"a",
"num",
"2",
"if res != 0:\n res = min(res, cost)\n else:\n res = cost",
"res != 0",
"res",
"0",
"res = min(res, cost)",
"res",
"min(res, cost)",
"min",
"res",
"cost",
"res = cost",
"res",
"cost",
"print(res)",
"print",
"res",
"res = cost",
"cost",
"res",
"min_ = min(a_lst)",
"min(a_lst)",
"min_",
"cost += (a - num) ** 2",
"(a - num) ** 2",
"cost",
"n = int(input())",
"int(input())",
"n",
"cost = 0",
"0",
"cost",
"a_lst = list(map(int, input().split()))",
"list(map(int, input().split()))",
"a_lst",
"max_ = max(a_lst)",
"max(a_lst)",
"max_",
"res = 0",
"0",
"res",
"res = min(res, cost)",
"min(res, cost)",
"res"
] | n = int(input())
a_lst = list(map(int, input().split()))
max_ = max(a_lst)
min_ = min(a_lst)
res = 0
for num in range(min_, max_+1):
cost = 0
for a in a_lst:
cost += (a - num) ** 2
if res != 0:
res = min(res, cost)
else:
res = cost
print(res) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
4,
13,
13,
2,
4,
13,
13,
17,
0,
13,
17,
28,
13,
13,
0,
13,
2,
2,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13
] | [
[
68,
2
],
[
71,
8
],
[
59,
20
],
[
26,
25
],
[
72,
30
],
[
72,
34
],
[
62,
37
],
[
41,
40
],
[
72,
40
],
[
74,
43
],
[
40,
46
],
[
25,
47
],
[
65,
50
],
[
60,
53
],
[
66,
53
],
[
75,
54
],
[
63,
54
],
[
66,
57
],
[
60,
57
],
[
59,
60
],
[
62,
63
],
[
65,
66
],
[
68,
69
],
[
71,
72
],
[
74,
75
]
] | [
"n = int(input())\nA = list(map(int,input().split()))\nans = float(\"inf\")\n\nfor i in range(min(A),max(A)+1):\n cost = 0\n \n for j in A:\n cost += (j-i)**2\n \n ans = min(ans,cost)\n \nprint(ans)",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"A = list(map(int,input().split()))",
"A",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"ans = float(\"inf\")",
"ans",
"float(\"inf\")",
"float",
"\"inf\"",
"for i in range(min(A),max(A)+1):\n cost = 0\n \n for j in A:\n cost += (j-i)**2\n \n ans = min(ans,cost)\n ",
"i",
"range(min(A),max(A)+1)",
"range",
"min(A)",
"min",
"A",
"max(A)+1",
"max(A)",
"max",
"A",
"1",
"cost = 0",
"cost",
"0",
"for j in A:\n cost += (j-i)**2\n \n ",
"j",
"A",
"cost += (j-i)**2",
"cost",
"(j-i)**2",
"j-i",
"j",
"i",
"2",
"ans = min(ans,cost)",
"ans",
"min(ans,cost)",
"min",
"ans",
"cost",
"print(ans)",
"print",
"ans",
"ans = float(\"inf\")",
"float(\"inf\")",
"ans",
"cost = 0",
"0",
"cost",
"ans = min(ans,cost)",
"min(ans,cost)",
"ans",
"n = int(input())",
"int(input())",
"n",
"A = list(map(int,input().split()))",
"list(map(int,input().split()))",
"A",
"cost += (j-i)**2",
"(j-i)**2",
"cost"
] | n = int(input())
A = list(map(int,input().split()))
ans = float("inf")
for i in range(min(A),max(A)+1):
cost = 0
for j in A:
cost += (j-i)**2
ans = min(ans,cost)
print(ans) |
[
7,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
4,
13,
13,
4,
18,
4,
13,
13,
0,
13,
2,
4,
13,
13,
13,
0,
13,
4,
13,
17,
28,
13,
4,
13,
17,
0,
13,
2,
2,
13,
17,
13,
0,
13,
17,
28,
13,
4,
13,
13,
0,
13,
2,
2,
18,
13,
13,
13,
17,
0,
13,
4,
13,
13,
13,
4,
13,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
2,
13,
10,
4,
13,
10,
4,
13,
10,
2,
13,
10,
17,
13
] | [
[
85,
2
],
[
76,
8
],
[
79,
20
],
[
77,
24
],
[
86,
25
],
[
82,
27
],
[
33,
32
],
[
88,
37
],
[
80,
40
],
[
32,
42
],
[
91,
44
],
[
48,
47
],
[
86,
50
],
[
73,
52
],
[
77,
56
],
[
47,
57
],
[
89,
58
],
[
70,
61
],
[
83,
64
],
[
71,
64
],
[
74,
65
],
[
92,
65
],
[
71,
68
],
[
83,
68
],
[
70,
71
],
[
73,
74
],
[
76,
77
],
[
79,
80
],
[
82,
83
],
[
85,
86
],
[
88,
89
],
[
91,
92
]
] | [
"n=int(input())\na=list(map(int,input().split()))\nmean=sum(a)//n\nans=float('inf')\nfor i in range(5):\n t=(mean-2)+i\n tmp=0\n for j in range(n):\n tmp+=(a[j]-t)**2\n ans=min(ans,tmp)\nprint(ans)",
"n=int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"a=list(map(int,input().split()))",
"a",
"list(map(int,input().split()))",
"list",
"map(int,input().split())",
"map",
"int",
"input().split()",
"().split",
"()",
"input",
"split",
"mean=sum(a)//n",
"mean",
"sum(a)//n",
"sum(a)",
"sum",
"a",
"n",
"ans=float('inf')",
"ans",
"float('inf')",
"float",
"'inf'",
"for i in range(5):\n t=(mean-2)+i\n tmp=0\n for j in range(n):\n tmp+=(a[j]-t)**2\n ans=min(ans,tmp)",
"i",
"range(5)",
"range",
"5",
"t=(mean-2)+i",
"t",
"(mean-2)+i",
"mean-2",
"mean",
"2",
"i",
"tmp=0",
"tmp",
"0",
"for j in range(n):\n tmp+=(a[j]-t)**2\n ",
"j",
"range(n)",
"range",
"n",
"tmp+=(a[j]-t)**2",
"tmp",
"(a[j]-t)**2",
"a[j]-t",
"a[j]",
"a",
"j",
"t",
"2",
"ans=min(ans,tmp)",
"ans",
"min(ans,tmp)",
"min",
"ans",
"tmp",
"print(ans)",
"print",
"ans",
"ans=min(ans,tmp)",
"min(ans,tmp)",
"ans",
"tmp+=(a[j]-t)**2",
"(a[j]-t)**2",
"tmp",
"a=list(map(int,input().split()))",
"list(map(int,input().split()))",
"a",
"mean=sum(a)//n",
"sum(a)//n",
"mean",
"ans=float('inf')",
"float('inf')",
"ans",
"n=int(input())",
"int(input())",
"n",
"t=(mean-2)+i",
"(mean-2)+i",
"t",
"tmp=0",
"0",
"tmp"
] | n=int(input())
a=list(map(int,input().split()))
mean=sum(a)//n
ans=float('inf')
for i in range(5):
t=(mean-2)+i
tmp=0
for j in range(n):
tmp+=(a[j]-t)**2
ans=min(ans,tmp)
print(ans) |
[
7,
17,
15,
13,
15,
13,
12,
13,
12,
13,
12,
13,
23,
12,
13,
23,
12,
13,
23,
0,
13,
4,
13,
2,
17,
17,
0,
13,
17,
0,
13,
17,
14,
40,
13,
0,
18,
13,
13,
4,
13,
17,
17,
0,
18,
13,
13,
4,
13,
17,
17,
0,
18,
13,
13,
4,
13,
17,
17,
0,
13,
4,
13,
4,
13,
0,
13,
4,
13,
0,
13,
2,
4,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
0,
13,
4,
18,
13,
13,
13,
14,
2,
13,
13,
0,
13,
13,
14,
2,
2,
13,
13,
2,
13,
13,
0,
13,
13,
0,
13,
13,
41,
28,
13,
13,
4,
2,
2,
13,
13,
17,
4,
13,
4,
13,
13,
17,
10,
4,
13,
10,
13,
13,
10,
4,
13,
10,
4,
13,
10,
13,
13,
10,
13,
13,
10,
12,
13,
10,
12,
13,
10,
2,
13,
10,
17,
13,
10,
4,
13,
10,
4,
13,
10,
12,
13,
10,
12,
13,
10,
12,
13,
10,
17,
13
] | [
[
128,
20
],
[
155,
27
],
[
173,
30
],
[
174,
34
],
[
39,
36
],
[
47,
44
],
[
55,
52
],
[
137,
60
],
[
158,
66
],
[
165,
68
],
[
152,
70
],
[
159,
74
],
[
138,
75
],
[
161,
77
],
[
153,
82
],
[
134,
84
],
[
153,
89
],
[
162,
92
],
[
135,
93
],
[
131,
95
],
[
162,
96
],
[
153,
100
],
[
162,
101
],
[
135,
103
],
[
153,
104
],
[
143,
106
],
[
162,
107
],
[
140,
109
],
[
135,
110
],
[
114,
113
],
[
159,
113
],
[
141,
118
],
[
144,
118
],
[
132,
118
],
[
153,
118
],
[
113,
119
],
[
128,
129
],
[
162,
131
],
[
131,
132
],
[
134,
135
],
[
137,
138
],
[
135,
140
],
[
140,
141
],
[
162,
143
],
[
143,
144
],
[
152,
153
],
[
155,
156
],
[
158,
159
],
[
161,
162
],
[
173,
174
]
] | [
"''' ## ## ####### # # ######\n ## ## ## ## ### ##\n ## ## ## # # # ##\n ######### ####### # # ## '''\n\nimport sys\nimport math\n# sys.setrecursionlimit(10**6)\n\ndef get_ints(): return map(int, input().strip().split())\ndef get_list(): return list(get_ints())\n\ndef printspx(*args): return print(*args, end=\"\")\ndef printsp(*args): return print(*args, end=\" \")\ndef printchk(*args): return print(*args, end=\" \\ \")\n\nMODPRIME = int(1e9+7); BABYMODPR = 998244353;\n\nONLINE_JUDGE = 1\nif not ONLINE_JUDGE:\n sys.stdin = open(\"input.txt\",\"r\")\n sys.stdout = open(\"output.txt\",\"w\")\n sys.stderr = open(\"output.txt\",\"w\")\n\n# for _testcases_ in range(int(input())):\nn = int(input())\nli = get_list()\ns = sum(li)/n\nl = math.floor(s)\nr = math.ceil(s)\nif l == r:\n s = l\nelse:\n if s - l < r - s:\n s = l\n else:\n s = r\nprint(sum([(s-x)**2 for x in li]))\n\n'''\n>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!\nTHE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )\nSOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::\n(I Own the code if no link is provided here or I may have missed mentioning it)\nDO NOT PLAGIARISE.\nTESTCASES:\n>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!\n'''",
"''' ## ## ####### # # ######\n ## ## ## ## ### ##\n ## ## ## # # # ##\n ######### ####### # # ## '''",
"import sys",
"sys",
"import math",
"math",
"def get_ints(): return map(int, input().strip().split())",
"get_ints",
"def get_list(): return list(get_ints())",
"get_list",
"def printspx(*args): return print(*args, end=\"\")",
"printspx",
"*args",
"def printsp(*args): return print(*args, end=\" \")",
"printsp",
"*args",
"def printchk(*args): return print(*args, end=\" \\ \")",
"printchk",
"*args",
"MODPRIME = int(1e9+7)",
"MODPRIME",
"int(1e9+7)",
"int",
"1e9+7",
"1e9",
"7",
"BABYMODPR = 998244353",
"BABYMODPR",
"998244353",
"ONLINE_JUDGE = 1",
"ONLINE_JUDGE",
"1",
"if not ONLINE_JUDGE:\n sys.stdin = open(\"input.txt\",\"r\")\n sys.stdout = open(\"output.txt\",\"w\")\n sys.stderr = open(\"output.txt\",\"w\")\n\n# for _testcases_ in range(int(input())):",
"not ONLINE_JUDGE",
"ONLINE_JUDGE",
"sys.stdin = open(\"input.txt\",\"r\")",
"sys.stdin",
"sys",
"stdin",
"open(\"input.txt\",\"r\")",
"open",
"\"input.txt\"",
"\"r\"",
"sys.stdout = open(\"output.txt\",\"w\")",
"sys.stdout",
"sys",
"stdout",
"open(\"output.txt\",\"w\")",
"open",
"\"output.txt\"",
"\"w\"",
"sys.stderr = open(\"output.txt\",\"w\")",
"sys.stderr",
"sys",
"stderr",
"open(\"output.txt\",\"w\")",
"open",
"\"output.txt\"",
"\"w\"",
"n = int(input())",
"n",
"int(input())",
"int",
"input()",
"input",
"li = get_list()",
"li",
"get_list()",
"get_list",
"s = sum(li)/n",
"s",
"sum(li)/n",
"sum(li)",
"sum",
"li",
"n",
"l = math.floor(s)",
"l",
"math.floor(s)",
"math.floor",
"math",
"floor",
"s",
"r = math.ceil(s)",
"r",
"math.ceil(s)",
"math.ceil",
"math",
"ceil",
"s",
"if l == r:\n s = l\nelse:\n if s - l < r - s:\n s = l\n else:\n s = r",
"l == r",
"l",
"r",
"s = l",
"s",
"l",
"if s - l < r - s:\n s = l\n else:\n s = r",
"s - l < r - s",
"s - l",
"s",
"l",
"r - s",
"r",
"s",
"s = l",
"s",
"l",
"s = r",
"s",
"r",
"(s-x)**2 for x in li",
"for x in li",
"x",
"li",
"for x in li",
"(s-x)**2",
"s-x",
"s",
"x",
"2",
"print(sum([(s-x)**2 for x in li]))",
"print",
"sum([(s-x)**2 for x in li])",
"sum",
"[(s-x)**2 for x in li]",
"'''\n>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!\nTHE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )\nSOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::\n(I Own the code if no link is provided here or I may have missed mentioning it)\nDO NOT PLAGIARISE.\nTESTCASES:\n>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!\n'''",
"MODPRIME = int(1e9+7)",
"int(1e9+7)",
"MODPRIME",
"s = l",
"l",
"s",
"r = math.ceil(s)",
"math.ceil(s)",
"r",
"n = int(input())",
"int(input())",
"n",
"s = r",
"r",
"s",
"s = l",
"l",
"s",
"def printchk(*args): return print(*args, end=\" \\ \")",
"def printchk(*args): return print(*args, end=\" \\ \")",
"printchk",
"def get_ints(): return map(int, input().strip().split())",
"def get_ints(): return map(int, input().strip().split())",
"get_ints",
"s = sum(li)/n",
"sum(li)/n",
"s",
"BABYMODPR = 998244353",
"998244353",
"BABYMODPR",
"li = get_list()",
"get_list()",
"li",
"l = math.floor(s)",
"math.floor(s)",
"l",
"def get_list(): return list(get_ints())",
"def get_list(): return list(get_ints())",
"get_list",
"def printspx(*args): return print(*args, end=\"\")",
"def printspx(*args): return print(*args, end=\"\")",
"printspx",
"def printsp(*args): return print(*args, end=\" \")",
"def printsp(*args): return print(*args, end=\" \")",
"printsp",
"ONLINE_JUDGE = 1",
"1",
"ONLINE_JUDGE"
] | ''' ## ## ####### # # ######
## ## ## ## ### ##
## ## ## # # # ##
######### ####### # # ## '''
import sys
import math
# sys.setrecursionlimit(10**6)
def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")
MODPRIME = int(1e9+7); BABYMODPR = 998244353;
ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
sys.stdin = open("input.txt","r")
sys.stdout = open("output.txt","w")
sys.stderr = open("output.txt","w")
# for _testcases_ in range(int(input())):
n = int(input())
li = get_list()
s = sum(li)/n
l = math.floor(s)
r = math.ceil(s)
if l == r:
s = l
else:
if s - l < r - s:
s = l
else:
s = r
print(sum([(s-x)**2 for x in li]))
'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
''' |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.