Have you been taught how to solve simultaneous linear equations?

Then, write atom balances. Say, in 2nd example for Cu, H, N, O.

4 linear eq. in 6 unknowns. Solve.

Matrix based solving might speed up the process.

It isn't the way Chem. classes typically teach but I find it neater. If you're lucky maybe your Scientific Calculator will have a linear eq. solving function too.