Iahub Sorin good competitive programmer town however can not qualify important contest the selection help single problem Blatnatalag friend Iahub manage hold problem contest because want sure Iahub qualified tell Iahub follow taskyoure give 1based array n element Lets define function fij 1ijn ij2gij2 Function g calculate follow pseudocodeint gint int j int sum 0 int k mini j 1 k maxi j k k 1 sum sum ak return sumfind value minijfijprobably Iahub figure solution problem can