Maybe the problem in on the line print str(lis[j]),
, which add a space after the third digit and the site don’t consider this valid, the problem say “with a blank space between each number.” and maybe this is considered invalid.
Another possible solution is to split the list with the X numbers in lists of Y elements and print them with something like print " ".join(lis[Xs:Xf])