According to one embodiment, an apparatus for processing data includes a data input unit, a lossy processing unit, a buffer, a region indication unit, a lossless processing unit, and a data output unit. The data input unit is configured to input time series data. The lossy processing unit is configured to obtain first compressed data by applying lossy processing to the time series data. The buffer is configured to store the first compressed data. The region indication unit is configured to indicate at least one part of the first compressed data. The lossless processing unit is configured to obtain second compressed data by applying lossless processing to the at least one part of the first compressed data. The data output unit is configured to output the second compressed data.