A generalization of a Hamiltonian system of linear coupled oscillators with the parity-time (PT) symmetry is suggested. It is found that an increase of the gain-loss parameter can stabilize the system. A family of Hamiltonian functions for two coupled nonlinear oscillators with PT-symmetry is obtained.