1. A method comprising: in a memory device configured to write data to storage elements, the memory device configured to write a first value of the data to one or more first storage elements that are in a first state by causing a first state transition of the one or more first storage elements from the first state to a second state, the memory device further configured to write a second value of the data to one or more second storage elements that are in the second state by causing a second state transition of the one or more second storage elements from the second state to the first state, performing: receiving data to be stored into the storage elements; applying a mapping to the received data to generate mapped data; and writing the mapped data into the storage elements, wherein the mapping is configured to increase an average reliability of the memory device by reducing an average number of state changes of the storage elements per write operation, and wherein the mapping of the received data to the mapped data is independent of the states of the storage elements prior to the writing of the mapped data.