1. A method comprising: in a memory device configured to write data to storage elements by performing at least one of a first operation on one or more first storage elements that are in a first state and a second operation on one or more second storage elements that are in a second state, wherein the first operation changes the first state to the second state and wherein the second operation changes 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 in the storage elements, wherein the mapping is configured to reduce average write time by mapping at least one incoming data value into a mapped value such that the second operation is not required for storing the mapped value into the storage elements.