crafting problem in C
C version works
C version works
made python version less ugly/more efficient