def g={x,y->[(y-x).intdiv(14)*7+7,0].max()} def cases = [[100,123],[47,23],[40,80],[62,62],[1134,2145]] cases.each{println g(it[0],it[1])}
Standard input is empty
14 0 21 7 511
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!