Revision 3728ff73-9dec-493f-9081-718f608961d3 - Code Golf Stack Exchange

# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), <s>122</s> 103 bytes

 [S S T T N
 _Push_-1][S S S N
 _Push_0][S N
 S _Dupe_0][T N
 T T _Read_STDIN_as_integer][T T T _Retrieve_input][S N
 S _Dupe_input][N
 T S T N
 _If_0_Jump_to_Label_ZERO][N
 S S N
 _Create_Label_LOOP][S N
 T _Swap_top_two][S S S T N
 _Push_1][T S S S _Add][S N
 T _Swap_top_two][S N
 S _Dupe_input][S N
 S _Dupe_input][T S S N
 _Multiply][S T S S T S N
 _Copy_0-based_2nd_n][S N
 S _Dupe_n][T S S N
 _Multiply][S S S T S N
 _Push_2][T S S N
 _Multiply][S N
 T _Swap_top_two][T S S T _Subtract][N
 T T N
 _If_neg_Jump_to_Label_LOOP][S N
 T _Swap_top_two][N
 S S T N
 _Create_Label_ZERO][T N
 S T _Print_as_integer]

Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only. 
`[..._some_action]` added as explanation only.

[Try it online](https://tio.run/##LYvRCYBADEO/kykywjmSyIH3Jyg4fm1aUygvJHnP9cz72o8ZIQGUxDwQlhlpqCY5kDuO3PsfemVXBj1ADWBkYXYitlH6AA) (with raw spaces, tabs and new-lines only).

Output is rounded up.

Inspired by the following mentioned in [*@Deadcode*'s Regex answer](https://codegolf.stackexchange.com/a/198428/52210):

> For input \$N\,ドル we want to calculate \$M=\left\lfloor\frac{N}{\sqrt2}\right\rfloor\$. So we want the largest \$M\$ such that \2ドルM^2<N^2\$.

EDIT: My program now implements \2ドルM^2\leq N^2\$ instead to save 19 bytes (\$\lt\$ vs \$\leq\$ is irrelevant, otherwise \$\sqrt{2}\$ would be rational). Although I see *@Deadcode* edited his Regex answer and he's actually using \$\leq\$ as well.

**Explanation in pseudo-code:**

 Integer n = -1
 Integer input = STDIN as integer
 Start LOOP:
 n = n + 1
 If(n*n*2 - input*input < 0):
 Go to next iteration of LOOP
 Print n
 (exit program with error since no exit is defined)

**Example program flow ([input `4`](https://tio.run/##LYvRCcBADEK/dQqH6EKlHFz/Dq7Q8dOYNEJ4or7zfsZe5zUiJICSmALhMyMN1SQHcseRe/9Dr@zKoAeoAYwszE7E8QE)):**

 Command Explanation Stack Heap STDIN STDOUT STDERR

 SSTTN Push -1 [-1]
 SSSN Push 0 [-1,0]
 SNS Duplicate 0 [-1,0,0]
 TNTT Read STDIN as integer [-1,0] [{0:4}] 4
 TTT Retrieve from heap #0 [-1,4] [{0:4}]
 SNS Duplicate 4 [-1,4,4] [{0:4}]
 NTSTN If 0: Jump to Label ZERO [-1,4,4] [{0:4}]
 (^ workaround for input=0, since it would otherwise output -1)
 NSSSN Create Label LOOP [-1,4] [{0:4}]
 SNT Swap top two [4,-1] [{0:4}]
 SSSTN Push 1 [4,-1,1] [{0:4}]
 TSSS Add top two: -1+1 [4,0] [{0:4}]
 SNT Swap top two [0,4] [{0:4}]
 SNS Duplicate 4 [0,4,4] [{0:4}]
 SNS Duplicate 4 [0,4,4,4] [{0:4}]
 TSSN Multiply top two: 4*4 [0,4,16] [{0:4}]
 STSSTSN Copy 0-based 2nd [0,4,16,0] [{0:4}]
 SNS Duplicate 0 [0,4,16,0,0] [{0:4}]
 TSSN Multiply top two: 0*0 [0,4,16,0] [{0:4}]
 SSSTSN Push 2 [0,4,16,0,2] [{0:4}]
 TSSN Multiply top two: 0*2 [0,4,16,0] [{0:4}]
 SNT Swap top two [0,4,0,16] [{0:4}]
 TSST Subtract top two: 0-16 [0,4,-16] [{0:4}]
 NTTN If neg: Jump to label LOOP [0,4] [{0:4}]

 SNT Swap top two [4,0] [{0:4}]
 SSSTN Push 1 [4,0,1] [{0:4}]
 TSSS Add top two: 0+1 [4,1] [{0:4}]
 SNT Swap top two [1,4] [{0:4}]
 SNS Duplicate 4 [1,4,4] [{0:4}]
 SNS Duplicate 4 [1,4,4,4] [{0:4}]
 TSSN Multiply top two: 4*4 [1,4,16] [{0:4}]
 STSSTSN Copy 0-based 2nd [1,4,16,1] [{0:4}]
 SNS Duplicate 1 [1,4,16,1,1] [{0:4}]
 TSSN Multiply top two: 1*1 [1,4,16,1] [{0:4}]
 SSSTSN Push 2 [1,4,16,1,2] [{0:4}]
 TSSN Multiply top two: 1*2 [1,4,16,2] [{0:4}]
 SNT Swap top two [1,4,2,16] [{0:4}]
 TSST Subtract top two: 2-16 [1,4,-14] [{0:4}]
 NTTN If neg: Jump to label LOOP [1,4] [{0:4}]

 SNT Swap top two [4,1] [{0:4}]
 SSSTN Push 1 [4,1,1] [{0:4}]
 TSSS Add top two: 1+1 [4,2] [{0:4}]
 SNT Swap top two [2,4] [{0:4}]
 SNS Duplicate 4 [2,4,4] [{0:4}]
 SNS Duplicate 4 [2,4,4,4] [{0:4}]
 TSSN Multiply top two: 4*4 [2,4,16] [{0:4}]
 STSSTSN Copy 0-based 2nd [2,4,16,2] [{0:4}]
 SNS Duplicate 2 [2,4,16,2,2] [{0:4}]
 TSSN Multiply top two: 2*2 [2,4,16,4] [{0:4}]
 SSSTSN Push 2 [2,4,16,4,2] [{0:4}]
 TSSN Multiply top two: 4*2 [2,4,16,8] [{0:4}]
 SNT Swap top two [2,4,8,16] [{0:4}]
 TSST Subtract top two: 8-16 [2,4,-8] [{0:4}]
 NTTN If neg: Jump to label LOOP [2,4] [{0:4}]

 SNT Swap top two [4,2] [{0:4}]
 SSSTN Push 1 [4,2,1] [{0:4}]
 TSSS Add top two: 2+1 [4,3] [{0:4}]
 SNT Swap top two [3,4] [{0:4}]
 SNS Duplicate 4 [3,4,4] [{0:4}]
 SNS Duplicate 4 [3,4,4,4] [{0:4}]
 TSSN Multiply top two: 4*4 [3,4,16] [{0:4}]
 STSSTSN Copy 0-based 2nd [3,4,16,3] [{0:4}]
 SNS Duplicate 3 [3,4,16,3,3] [{0:4}]
 TSSN Multiply top two: 3*3 [3,4,16,9] [{0:4}]
 SSSTSN Push 2 [3,4,16,9,2] [{0:4}]
 TSSN Multiply top two: 9*2 [3,4,16,18] [{0:4}]
 SNT Swap top two [3,4,18,16] [{0:4}]
 TSST Subtract top two: 18-16 [3,4,2] [{0:4}]
 NTTN If neg: Jump to label LOOP [3,4] [{0:4}]

 SNT Swap top two [4,3] [{0:4}]
 NSSTN Create Label ZERO [4,3] [{0:4}]
 TNST Print as integer to STDOUT [4] [{0:4}] 3
 error

Program stops with an error because no exit is defined.

AltStyle によって変換されたページ (->オリジナル) /