MAX query-1 code is showing some error

the code works fine for the given test case but shows error on ide