repo.or.cz
/
aoc_eblake.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
day 25 optimize and improve heuristics
[aoc_eblake.git]
/
2020
/
day6.c
blob
d74fedbd259a7972534453b13b34b25b9c00b906
1
/*#define C __builtin_popcount*/
2
r
,
p
,
P
,
c
,
s
,
S
,
i
;
3
C
(
x
){
for
(
i
=
0
;
x
;
i
++)
x
&=
x
-
1
;
return
i
;}
4
main
(){
while
(
read
(
0
,&
c
,
1
))
c
-
10
?
r
|=
1
<<(
c
-
97
):
r
?
p
|=
r
,
P
|=~
r
,
r
=
0
:(
s
+=
C
(
p
),
S
+=
C
(~
P
),
p
=
P
=
0
);
printf
(
"%d %d"
,
s
+
C
(
p
),
S
+
C
(~
P
));}