Name | Language | Tokens Sum | Tokens Part 1 | Tokens Part 2 | Last change | |
---|---|---|---|---|---|---|
1 | Python | 184 | 44 | 140 | 8 months ago | |
2 | ![]() |
Python | 10046 | 46 | - | 8 months ago |
3 | Python | 10055 | 55 | - | 8 months ago | |
4 | C# | 10064 | 64 | - | 8 months ago |
boxes
=
[
{
}
for
_
in
range
(
256
)
]
for
string
in
input
(
)
.
split
(
"
,
"
)
:
insert
=
string
.
strip
(
"
-
"
)
.
split
(
"
=
"
)
name
=
insert
.
pop
(
0
)
hash
=
0
for
s
in
name
:
hash
+=
ord
(
s
)
hash
*=
17
hash
%=
256
if
insert
:
boxes
[
hash
]
[
name
]
=
int
(
insert
[
0
]
)
else
:
boxes
[
hash
]
.
pop
(
name
,
0
)
print
(
sum
(
box
*
slot
*
focal
for
box
,
lenses
in
enumerate
(
boxes
,
1
)
for
slot
,
focal
in
enumerate
(
lenses
.
values
(
)
,
1
)
)
)