#Whitespace, 145 137137 134 bytes
[S S S N _Push_0][S N S _Duplicate][T N T T _Read_STDIN_as_integer_in_heap_0][T T T _Retrieve][S S S T S N _Push_2][T S S T _Subtract][N T T T T N _Jump_to_Label_FALSE_if_negative][S S S T N _Push_1][S N S _Duplicate_1][S N S _Duplicate_1][N S S N _Create_Label_LOOP][S N N _Discard_top_stack][S S S T N _Push_1][T S S S _Add][S N S _Duplicate][S N S _Duplicate][S S S N _Push_0][T T T _Retrieve_heap_at_0][T S S T _subtract][N T S T N _Jump_to_Label_TRUE_if_0][S S S N _Push_0][T T T _Retrieve_heap_0][S N T _Swap_top_two][T S T T _Modulo][S N S _Duplicate][N T S T T N _Jump_to_Label_FALSE_if_0][N S N N _Jump_to_Label_LOOP][N S S T N _Create_Label_TRUE][S S S T N _Push_1][T N S T _Output_1][N N N _Exit][N S S T T N _Create_Label_FALSE][S S S N _Push_0][T N S T _Output_0] Command Explanation Stack Heap STDIN STDOUT SSSN Push 0 [0] {} SNS Duplicate (0) [0,0] {} TNTT Read STDIN as number [0] {0:5} 5 TTT Retrieve heap at 0 [5] {0:5} SSSTSN Push 2 [5,2] {0:5} TSST Subtract (5-2) [3] {0:5} NTTTTN Jump to Label_FALSE if neg. [] {0:5} SSSTN Push 1 [1] {0:5} SNS Duplicate (1) [1,1] {0:5} SNS Duplicate (1) [1,1,1] {0:5} NSSN Create Label_LOOP [1,1,1] {0:5} SNN Discard top [1,1][1] {0:5} SSSTN Push 1 [1,1,1] {0:5} TSSS Add (1+1) [1,2][2] {0:5} SNS Duplicate (2) [1,2[2,2] {0:5} SNS Duplicate (2) [1,2[2,2,2] {0:5} SSSN Push 0 [1,2[2,2,2,0] {0:5} TTT Retrieve heap at 0 [1,2[2,2,2,5] {0:5} TSST Subtract (2-5) [1,2[2,2,-3] {0:5} NTSTN Jump to LABEL_TRUE if 0 [1,2[2,2] {0:5} SSSN Push 0 [1,2[2,2,0] {0:5} TTT Retrieve heap at 0 [1,2[2,2,5] {0:5} SNT Swap top two (2,5] -> 5,2]) [1,2[2,5,2] {0:5} TSTT Modulo (5%2) [1,2[2,1] {0:5} SNS Duplicate (1) [1,2[2,1,1] {0:5} NTSTTN Jump to Label_FALSE if 0 [1,2[2,1] {0:5} NSNN Jump to Label_LOOP [1,2[2,1] {0:5} SNN Discard top [1,2][2] {0:5} SSSTN Push 1 [1,2[2,1] {0:5} TSSS Add (2+1) [1,3][3] {0:5} SNS Duplicate (3) [1,3[3,3] {0:5} SNS Duplicate (3) [1,3[3,3,3] {0:5} SSSN Push 0 [1,3[3,3,3,0] {0:5} TTT Retrieve heap at 0 [1,3[3,3,3,5] {0:5} TSST Subtract (3-5) [1,3[3,3,-2] {0:5} NTSTN Jump to LABEL_TRUE if 0 [1,3[3,3] {0:5} SSSN Push 0 [1,3[3,3,0] {0:5} TTT Retrieve heap at 0 [1,3[3,3,5] {0:5} SNT Swap top two (3,5] -> 5,3]) [1,3[3,5,3] {0:5} TSTT Modulo (5%3) [1,3[3,2] {0:5} SNS Duplicate (2) [1,3[3,2,2] {0:5} NTSTTN Jump to Label_FALSE if 0 [1,3[3,2] {0:5} NSNN Jump to Label_LOOP [1,3[3,2] {0:5} SNN Discard top [1,3][3] {0:5} SSSTN Push 1 [1,3[3,1] {0:5} TSSS Add (3+1) [1,4][4] {0:5} SNS Duplicate (4) [1,4[4,4] {0:5} SNS Duplicate (4) [1,4[4,4,4] {0:5} SSSN Push 0 [1,4[4,4,4,0] {0:5} TTT Retrieve heap at 0 [1,4[4,4,4,5] {0:5} TSST Subtract (4-5) [1,4[4,4,-1] {0:5} NTSTN Jump to LABEL_TRUE if 0 [1,4[4,4] {0:5} SSSN Push 0 [1,4[4,4,0] {0:5} TTT Retrieve heap at 0 [1,4[4,4,5] {0:5} SNT Swap top two (4,5] -> 5,4]) [1,4[4,5,4] {0:5} TSTT Modulo (5%4) [1,4[4,1] {0:5} SNS Duplicate (1) [1,4[4,1,1] {0:5} NTSTTN Jump to Label_FALSE if 0 [1,4[4,1] {0:5} NSNN Jump to Label_LOOP [1,4[4,1] {0:5} SNN Discard top [1,4][4] {0:5} SSSTN Push 1 [1,4[4,1] {0:5} TSSS Add (4+1) [1,5][5] {0:5} SNS Duplicate (5) [1,5[5,5] {0:5} SNS Duplicate (5) [1,5[5,5,5] {0:5} SSSN Push 0 [1,5[5,5,5,0] {0:5} TTT Retrieve heap at 0 [1,5[5,5,5,5] {0:5} TSST Subtract (5-5) [1,5[5,5,0] {0:5} NTSTN Jump to LABEL_TRUE if 0 [1,5[5,5] {0:5} NSSTN Create Label_TRUE [1,5[5,5] {0:5} SSSTN Push 1 [1,5[5,5,1] {0:5} TNST Output top as number [1,5[5,5] {0:5} 1 NNN Stop program [1,5[5,5] {0:5}