  This paper deals with left non-degenerate set-theoretic solutions to the
Yang-Baxter equation (=LND solutions), a vast class of algebraic structures
encompassing groups, racks, and cycle sets. To each such solution is associated
a shelf (i.e., a self-distributive structure) which captures its major
properties. We consider two (co)homology theories for LND solutions, one of
which was previously known, in a reduced form, for biracks only. An explicit
isomorphism between these theories is described. For groups and racks we
recover their classical (co)homology, whereas for cycle sets we get new
constructions. For a certain type of LND solutions, including quandles and
non-degenerate cycle sets, the (co)homologies split into the degenerate and the
normalized parts. We express 2-cocycles of our theories in terms of group
cohomology, and, in the case of cycle sets, establish connexions with
extensions. This leads to a construction of cycle sets with interesting
properties.
