Can you tell the mistake in this code?
@vageesha
a) check input format of the code , first u need to read p and then n.
b) u r always reading in a[n] , it should be a[i];
c) use long long everywhere to avoid any overflow issue
d) ur upper bound i,e e should be p*(p+1)*max(A[i]) or some very big number