please check my code CHEFA

chefa
ideone

#1

http://ideone.com/ztY9AS


#2

In python, you cannot take input for a list in that way. Change that part of code to

str = raw_input()
a = map(int,str.split())

now a is your list.

or clubbing both the statements,

a = map(int,raw_input().split())

Edited code : link1


#3

thanks a lot for this help