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())
a is your list.
or clubbing both the statements,
a = map(int,raw_input().split())
Edited code : link1
thanks a lot for this help