fixed the inouts with assumption that x<n && y