Approach to detect run time error

abroads
dsu
graph
nzec
test-cases

#1

While solving a bigger problems some time it just sucks to detect a run time error, is there any general approach to detect runtime error(NZEC).