Solution

Example:   1  0  0  1
           1  0  1  0
           1  1  0  0
           1  1  1  1


Xpress-Mosel Model
model 'evens'

! Description  : Evens puzzle
! Source       : Boris Kordemsky - The Moscow Puzzles (P8)
! Date written : MAGIC 26/11/92, Xpress-MP 22/6/98, Mosel 16/4/03
! Written by   : M J Chlond 

  uses 'mmxprs'

  parameters
    square = 4
    coin = 10
  end-parameters
  
  declarations
    S = 1..square
    x: array(S,S) of mpvar
    n: array(S) of mpvar
    m: array(S) of mpvar
  end-declarations

  any:= x(1,1)
  
  total:= sum(i in S,j in S) x(i,j) = coin

  forall(i in S)
    rcon(i):= sum(j in S) x(i,j) = 2*n(i)

  forall(j in S)
    ccon(j):= sum(i in S) x(i,j) = 2*m(j)
    
  forall(i in S, j in S)
    x(i,j) is_binary
  forall(i in S)
    n(i) is_integer
  forall(i in S)
    m(i) is_integer

  maximise(any)

  forall(i in S) do
    forall(j in S)
      write(getsol(x(i,j)),' ')
    writeln
  end-do
  
end-model