Split arrays and programs in half
Haskell, 102 bytes

Function 1 (102 bytes):

l=length
[]#i=[[]]
(r:s)#i=id=&lt;&lt;[(splitAt j r:)&lt;$&gt;s#j|j&lt;-[i-1..i+1],j&gt;=0,j&lt;l r]
f r=(r#)=&lt;&lt;[0..l$r!!0]


Function 2 (90 bytes):

g::[[([Int],[Int])]]-&gt;Int 
g a=minimum$map(\(x,y)-&gt;abs$sum(sum&lt;$&gt;x)-sum(sum&lt;$&gt;y))$unzip&lt;$&gt;a


Missing boilerplate for F1 to make it a full program, including the hardcoded integer array to check:

main = print $ f [[164,187,17,0,277],[108,96,121,263,211],[166,6,57,49,73],[90,186,26,82,138],[173,60,171,265,96]]


and for F2:

main = print . g . read =&lt;&lt; getContents


Now you can call runhaskell f1.hs | runhaskell f2.hs which outputs 8.

How it works: f takes a list of list of integers.

f r = (r#)=&lt;&lt;[0..l$r!!0]          -- for each index [0 .. length r] call # with
                                  -- the first parameter being r and
                                  -- collect the results in a single list

[]#i=[[]]                         -- base case. If the list of lists is empty, stop
(r:s)#i                           -- else let r be the first list, s all others
           j&lt;-[i-1..i+1],         -- foreach possible index j for the next line
                 j&gt;=0,j&lt;l r       --    (skipping out of range indices)
     (splitAt j r:)&lt;$&gt;            -- split the current line at j into a pair of
                                  -- lists and prepend it to every element of
                      s#j         -- a recursive call with s and j
id=&lt;&lt;                             -- flatten into a single list


Now we have a list of all possible splits, for example the first one and a random one from the middle 

[([],[164,187,17,0,277]),                  [([164,187],[17,0,277]),
 ([],[108,96,121,263,211]),                 ([108,96],[121,263,211]),
 ([],[166,6,57,49,73]),                     ([166],[6,57,49,73]),
 ([],[90,186,26,82,138]),                   ([90,186],[26,82,138]),
 ([],[173,60,171,265,96])]                  ([173,60,171],[265,96])]


Function g takes such a list and

                    unzip&lt;$&gt;a       -- turn every pair of lists into a list of pairs
  map(\(x,y)-&gt;                      -- foreach such pair     
      abs$sum(sum&lt;$&gt;x)-sum(sum&lt;$&gt;y) -- calculate the score
minimum                             -- and find the minimum


Note: the second function can be golfed a little bit more, but it doesn't change the score.