def get_negative_nonnegative_lists(L):
'''(list of list of int) -> tuple of (list of int, list of int)
Return a tuple where the first item is a list of the negative ints in the
inner lists of L and the second item is a list of the non-negative ints
in those inner lists.
Precondition: the number of rows in L is the same as the number of
columns.
>>> get_negative_nonnegative_lists([[-1, 3, 5], [2, -4, 5], [4, 0, 8]])
([-1, -4], [3, 5, 2, 5, 4, 0, 8])
'''
nonneg = []
neg = []
for row in range(len(L)):
for col in range(len(L)):
if L[row][col] < 0:
neg.append(L[row][col])
elif L[row][col] >= 0:
nonneg.append(L[row][col])
ZGVmIGdldF9uZWdhdGl2ZV9ub25uZWdhdGl2ZV9saXN0cyhMKToKICAgICcnJyhsaXN0IG9mIGxpc3Qgb2YgaW50KSAtPiB0dXBsZSBvZiAobGlzdCBvZiBpbnQsIGxpc3Qgb2YgaW50KQogCiAgICBSZXR1cm4gYSB0dXBsZSB3aGVyZSB0aGUgZmlyc3QgaXRlbSBpcyBhIGxpc3Qgb2YgdGhlIG5lZ2F0aXZlIGludHMgaW4gdGhlCiAgICBpbm5lciBsaXN0cyBvZiBMIGFuZCB0aGUgc2Vjb25kIGl0ZW0gaXMgYSBsaXN0IG9mIHRoZSBub24tbmVnYXRpdmUgaW50cwogICAgaW4gdGhvc2UgaW5uZXIgbGlzdHMuCiAKICAgIFByZWNvbmRpdGlvbjogdGhlIG51bWJlciBvZiByb3dzIGluIEwgaXMgdGhlIHNhbWUgYXMgdGhlIG51bWJlciBvZgogICAgY29sdW1ucy4KIAogICAgPj4+IGdldF9uZWdhdGl2ZV9ub25uZWdhdGl2ZV9saXN0cyhbWy0xLCAgMywgIDVdLCBbMiwgIC00LCAgNV0sIFs0LCAgMCwgIDhdXSkKICAgIChbLTEsIC00XSwgWzMsIDUsIDIsIDUsIDQsIDAsIDhdKQogICAgJycnCiAKICAgIG5vbm5lZyA9IFtdCiAgICBuZWcgPSBbXQogICAgZm9yIHJvdyBpbiByYW5nZShsZW4oTCkpOgogICAgICAgIGZvciBjb2wgaW4gcmFuZ2UobGVuKEwpKToKICAgICAgICAgICAgaWYgTFtyb3ddW2NvbF0gPCAwOgogICAgICAgICAgICAgICAgbmVnLmFwcGVuZChMW3Jvd11bY29sXSkKICAgICAgICAgICAgZWxpZiBMW3Jvd11bY29sXSA+PSAwOgogICAgICAgICAgICAgICAgbm9ubmVnLmFwcGVuZChMW3Jvd11bY29sXSkKIA==