Name | Language | Tokens Sum | Tokens Part 1 | Tokens Part 2 | Last change | |
---|---|---|---|---|---|---|
1 | Dan Houghton | Python | 184 | 44 | 140 | 11 months ago |
2 | Visible-Bag4062 | Python | 10046 | 46 | - | 11 months ago |
3 | 1Codealot | Python | 10055 | 55 | - | 11 months ago |
4 | TollyH | C# | 10064 | 64 | - | 11 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
)
)
)