URI Online Judge Solution | 1048 Salary Increase

My failed code:
http://ideone.com/4o96LX

My succeeded accepted code: