text:
Check if string is a valid URL
Your task is to write a program or function that checks if a string is a valid URL.
Given a string as input, you will output a truthy value if the input is a valid URL. If it is not, output a falsey value. An input string is considered a valid URL if all of the following criteria are met:

Begins with http:// or https://
At least one and up to 128 labels (parts of URL delimited by a period)

Labels delimited by a period
Contain only letters, digits, and hyphens
Do not start nor end with a hyphen
Third and fourth characters cannot be a hyphen, unless the first two characters are 'xn'
A label may contain zero to 63 characters

The length of the string does not exceed 253 characters

This is a code-golf, with standard rules.

https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax

Welcome to PPCG, nice first question. When posting next question use sandbox https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges?cb=1

A full URL may have many more components than just the scheme and the host: scheme://user:password@host:port/path?query#fragment, to say nothing of schemes other than http/https with their own different URL syntax, or http/https URLs for a literal IPv6 address rather than a hostname. Since you seem to be primarily interested in validating the hostname part, I’d recommend letting the challenge be “check if a string is a valid hostname” and removing the scheme:// entirely.

Also, if you read the standard (RFC 952, RFC 1034, RFC 1123, RFC 3696, RFC 5891) rather than Wikipedia: a label cannot be empty; the restriction on the total length is not 253 but rather 255 minus the number of labels; the top-level (last) label may not be all-numeric; and the restriction about the third and fourth characters not being a hyphen refers to the decoded Unicode string represented by an IDN label, not its encoded ASCII representation (and there are many other Unicode-related restrictions that you probably don’t want to think about).

@AndersKaseorg The question doesn't necessarily have to use real URLs. The question could just as well be called "Check if the string is a valid [some made-up word]" where [some made-up word] is defined with the above criteria.

Please add some test cases.

JavaScript, 114 bytes
x=>RegExp(`^(?!.*([./](-|(?!xn)[^/]{2}--)|-[./]|-$))https?://${a='[a-zA-Z0-9-]{0,63}'}(?:\\.${a}){0,127}`).test(x)

Hopes it works.
For real URLs, you should use:
x=>eval(`try{new URL(x)}catch(e){}`)

Thanks to ThePirateBay, construct regex from string save 3 bytes.

authors: Евгений Новиков


text:
Travel Back in Quine
The challenge here is simple, and not at all about byte-count. Your job is to output the first 50 characters of the previous quine's source code, concatenated with the first 50 characters of yours starting with the 50 characters I've placed below:
abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY

So, lets take an example here, if you were to answer in 05AB1E, a solution to simply output the first 50 bytes would be:
ži50£

Which would mean you'd need to output:
abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYži50£

If your program is shorter, simply use the first x < 50 characters. If your program is longer only concatenate the first 50 characters, ending on the 50th character. The next person will then have to output the first 50 characters of your quine concatenated with their own code.
Your code can be any size, but you should only output the first 50 characters of your code concatenated to the end of the first 50-bytes of the previous answer's code.

Restrictions:
This uses the definition of a proper quine, and, in addition to this, the following things:

Comments are disallowed, entirely.
PAY ATTENTION TO THIS SECTION, IT MAY EVOLVE IF ABUSIVE LOOPHOLES ARISE

How to Post a Chained-Answer:

Post a placeholder:

Mention your answer number and the language you'll use.

Sort-by-date, if you notice someone else posted a placeholder 1 millisecond before you:

Delete yours, wait for the next opportunity, sorry.

If you've secured the next spot, PLEASE ANSWER WITHIN 6 HOURS:

If you can't answer, remove your reserved space.

IF the space has been hogged for more than 6 hours.

Vote to delete reserved space, I'll handle it.

Your Post Format:
#[Answer #]:[Character Count] Characters, [Language Used]

{TIO MARKDOWN}

{LINE_SEPARATOR="---"}

{ADDITIONAL EXPLANATION OR INFORMATION}

Some specific notes (Important for Ease-of-Competition):

If the person before you has included newlines or non-ASCII characters in their source, you may STRIP them. This means that x="a\nb" becomes ab, where x[0]=a;x[1]=b;.

You must state the mutation you've applied to the previous source.

All characters are counted as a single character, despite code-pages or language encoding. Please do not use byte-count, use character-count.

The accepted answer will be the 50th answer, just because; I mean, it's SE afterall.

Why are comments banned? Also, instead of redefining bytes to characters, why not just use characters?

@CalculatorFeline I think you could do some pretty lame and uninteresting loopholes using comments, but that's just me. Reserve the first spot and prove me wrong with a comment and I'll lift the  ban.

Is Python "useless string lol check out my YT ComputerCat";actual("code") contain a comment?

@CalculatorFeline example violates the definition of a proper quine due to code that is immediately defunct without being accessed.

@CalculatorFeline unless I'm missing something, that first string would never be used.

The linked meta post defining proper quines contains no mention of not having defunct code.

Also, the 05AB1E code doesn't give the correct string.

@ØrjanJohansen I'm not sure if it's intended to give the correct string...mainly because otherwise it would be an easy copy-paste. ;)

How are you defining comment?  Comment is not a very well defined term.

You also seem to interchange the terms character and byte, which is a bit confusing.  I'm not really sure if its the first 50 characters or bytes.

@WheatWizard Ouch, I didn't notice it was this messy. I have been assuming "Please do not use byte-count, use character-count." rules, as did the one answer so far where it really matters.

Can the program additionally print a trailing newline?

Are you allowed to chain off yourself?

@ppperry at this point-- go for it lmao.

Good, because otherwise the winning criterion would be broken because no-one would ever post an answer 49. Instead we now will end up with users racing eachother to post long self-chains to hit 50 as soon as we get past around answer 40.

@ppperry I want to remove that winning criterion. I wrote this question before I stopped selecting winning answers for my questions. I didn't realize selecting a winning answer was optional at the time of writing this.

Um, how would that not be making the post off-topic?

@ppperry winning criterion and selecting a winning answer are two very different things. For all intents and purposes this question is basically dead. If you chain yourself 28 times to win, what is the point of "winning" anyways lol.

Then what is the winning criterion?

@ppperry what is the winning criterion for https://codegolf.stackexchange.com/questions/133754/one-oeis-after-another I believe [tag:answer-chaining] to be slightly subjective, and one of the few hard-to-judge popularity-style questions on this sub that are allowed if done well. In my personal opinion, this question is absolutely awful and should be allowed to die, which is why it already has-- because it technically IS a popularity contest with a fake winning criterion attached.

1: 96 Characters, Haskell
abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY:z=['`'..'z']++'A':['C'..'Y']
main=putStr$z++z

Try it online!

I was feeling silly, and saw nothing forbidding the first entry starting with the exact same 50 characters as the initial string.

['`'..'z']++'A':['C'..'Y'] is an expression evaluating to the string of those characters, with a ` prepended.
The result is pattern matched on,
making the variable abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY equal to '`', and z equal to the 50 characters.
main=putStr$z+z then does the actual output.

I love how this challenge started with the a-zA-Z and now it's basically not the alphabet anymore. Good call on the 1st program.

5:76 characters, Emojicode
as=:'"alert(eval(c="''abcdefghijklmnopqrstuvwxyzACDaa❌a 0 45

Try it online!

Explanation:
		 start
   a ...	 define variable a as that string
      	 print:
    		 combine those strings:
      a		 a, and:
      a❌	 string literal. the ❌ works like \"
      a 0 45	 between indexes 0 and 45 of a

		 end

The alphabet is slowly disappearing :O.

Formatting hint: Use
 and
, then you can use 	 for tabs, which align as intended even with variable-width characters like emoji. BTW, I was thinking on how to make a quine in Emojicode and then I scrolled down...

@NieDzejkob good idea, thanks.

@betseg it's slightly off in a few places for me, but more readable anyway. Glad you liked it

@NieDzejkob a few? with my font only the string literal's command is off because it's long, where else on your end?

@betseg after . Different emoji fonts have different widths. Take a look at my answer below. For me, every comment is lined up. How does it look for you?

@NieDzejkob first line is short and removing part is long for me.

@betseg See? There's no way you will get everything aligned everywhere, but tabs give better results than spaces anyway.

2:119 Characters, Javascript
alert(eval(c="'abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY'+`alert(eval(c=${JSON.stringify(c).substr(0,37)}`"))

Try It Online(uses console.log instead of alert to output)
Based on this JS quine.
Old version(reads source code):
f=_=>`abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXYf=${(f+"").substr(0,48)}`;alert(f())

Based on this JS quine

This is not a proper quine as the function references itself.

@Shaggy I added a valid one

@Shaggy Self-referential functions are valid by our definition.

8: 70 characters, Stax
"v->{String t=`"⛽as=:'\`"alert(eval(c=\`"''abcdefghijk"c'".`"R34|S50(+

Run and debug online
Explanation
"..."c'".`"R34|S50(+
"..."                   The string from last output
     c'".`"R            Escape all double quotes
            34|S        Surround with double quotes
                50(     Take the first 50 characters
                   +    Append to the string from last output
                        Implicit output

3:56 Characters, SOGL
"alert(eval(c="'abcdefghijklmnopqrstuvwxyzACDEFGHIJ”1#Οj

Try it Here!
Explanation:
"...”      push the first 50 bytes of the previous answer
     1#Ο   wrap a quote around with that
        j  take the last letter off, as my answer has one more byte for the starting quote.

The Javascript answer had a quote in it, so I had to add a starting quote, but as this isn't code-golf, it doesn't matter.

4:81 characters, J
s=:'"alert(eval(c="''abcdefghijklmnopqrstuvwxyzACDEFGHI'
echo s,50{.'s=:',quote s

Try it online!

7: 137 characters, Java 8
v->{String t="⛽as=:'\"alert(eval(c=\"''abcdefghijklmnopqrstuvwxyzA";return t+("v->{String t=\""+t.replace("\"","\\\"")).substring(0,50);}

Try it online.
Explanation:
v->{        // Method with empty unused parameter and String return-type
  String t="⛽as=:'\"alert(eval(c=\"''abcdefghijklmnopqrstuvwxyzA";
            //  String containing the first 50 characters of the previous answer
  return t  //  Return those first 50 characters
   +"v->{String t=\""+t.replace("\"","\\\"")).substring(0,50);}
            //  Concatted with the first 50 characters of my answer
            //  with correct escape-slashes

Aha! I figured Emoji killed this challenge for good. Nice one.

@MagicOctopusUrn I only now notice your rule about "If the person before you has included newlines or non-ASCII characters in their source, you may STRIP them.", so an answer could get rid of the Emojis if they want. For my answer it doesn't matter either way, since we are counting in characters instead of bytes anyway.

That and it's not about the amount of characters honestly, and yes I forgot about that rule (moreoverly forgot about the challenge in general).

Honestly, come to think of it, this really isn't a quine challenge at all is it?

@MagicOctopusUrn It kinda is. You basically get the first 50 characters of your quine. In Java quines are usually formed by putting the unformatted source code in a String, and then correctly format/escape the double-quotes and slashes. Just the basic quine lambda-function in Java 8 is already 88 bytes however (Try it online), so in Java this challenge is much shorter without using a full quine. I can imagine quine is the best approach in most languages, though.

6: 70 characters, Emoji
⛽as=:'"alert(eval(c="''abcdefghijklmnopqrstuvwxyzAC⛽0-1✂➡

Try it online!
It seems that it is impossible to make it not output the trailing newline. If that's not OK then I'll remove the answer.
Explanation:
⛽ ... 	String literal
		Duplicate
⛽		Push ⛽ as a string
		Swap the top two strings. Stack: [long literal] "⛽" [long literal]
		Concatenate.
0-1✂	Remove the last character
		Concatenate.
➡		Print.

Shouldn't it be ⛽as=:'"alert(eval(c="''abcdefghijklmnopqrstuvwx⛽0-1✂➡ instead? betseg's Emojicode answer doesn't start with as=:'"alert(eval(c="''abcdefghijklmnopqrstuvwxyzAC but with as=:'"alert(eval(c="''abcdefghijklmnopqrstuvwx instead.

@KevinCruijssen If the person before you has included newlines or non-ASCII characters in their source, you may STRIP them.

Ah, I missed that rule.. In that case I'll update my answer.

Out of curiosity, why did you strip them? To make it easier for future answers? Because your code runs perfectly without stripping the Emojis of the previous answer: Try it here.

@KevinCruijssen It was half a year ago. I don't remember.

12: 202 characters, Ruby
puts "21ipdgmtwkkke7ynvzpcnlzt7kl".to_i(36).to_s(7).gsub('0','>').gsub('1','+').gsub('2','-').gsub('3','<').gsub('4','[').gsub('5','.').gsub('6',']')+'puts "21ipdgmtwkkke7ynvzpcnlzt7kl".to_i(36).to_s(7'

Try it online!

Encodes the first fifty characters of the previous answer in base seven

0: >
1: +
2: -
3: <
4: [
5: .
6: ]

Then converts it to base 36 to get "21ipdgmtwkkke7ynvzpcnlzt7kl"

9: 55 characters, Jelly
“"v->{String t=`"as=:'\`"alert(eval(c=\`"''abcdefg”;”“;

Try it online!

I removed the non-ASCII character ⛽ from the the output since that is allowed and Jelly was ignoring it.
Explanation
This begins with the string literal of the first 50 characters (minus ⛽) of the previous answer then appends the character “ to it with ;”“ then appends the original string literal to the end again with the final ;. Since a character was removed the first 50 characters of my source code are the 49 from the previous answer with a “ in front which allows this program to be so short. (Yes I realize this is not code-golf but why not golf it if you can?)

10:116 Characters, Python 3
print('''“"v->{String t=`"as=:'\`"alert(eval(c=\`"''abcdefgprint(\'\'\'“"v->{String t=`"as=:'\`"alert(eval(c=\`"''')

Simply prints a string consisting of the first 50 characters of answer 9, followed by the first 50 characters of its own source. No quine-like cleverness is needed, becuase the escaped quotes (\'\'\') appear after the 50th character and hence don't need to be reproduced in the output.
This method will work in virtually any language - you'd just have to escape any quote characters that appear in the previous answer. Accordingly, I don't think there is much challenge in this challenge.

11: 723 Characters, Brainf***
+[------->++<]>++.++.---------.+++++.++++++.+[--->+<]>+.-...-----.[----->++<]>++.--[++>---<]>-.---[-->+++<]>-.[->++<]>-.[--->++<]>+.[--->+<]>+++.--.---------.+++++.-------.-[--->+<]>--.---[->++++<]>.[-->+<]>+++.+++[-->+++<]>.[->+++<]>++.+[--->+<]>.--[--->+<]>--.+[-->+<]>+++.---.-[--->++<]>+.+[------>+<]>.++++.[->+++<]>++.+[--->+<]>.+++++++++++.-------.+++++++++++++.++.+[--->+<]>+.+[--->+<]>++.[--->+<]>-.[->+++<]>-.+++++++++++.[--->+<]>++++.+[--->+<]>.[--->++<]>-----.+[-->+++<]>-.++++.[->+++<]>++.[[-]<]++[------>+<]>.++[->++<]>+.-[-->+<]>.......---[-->+++<]>-.+[--->++<]>+..+[----->+<]>.++[-->+++<]>.[--->++<]>.+[--->++<]>+..+++.---..+++.-.........+.---.....+++.---......+++.---.++[->++<]>+.-[-->+<]>...---[-->+++<]>-.

Stripped unprintable “ character. Almost completely generated by Brainfuck Text Generator. Might as well be lazy, right?
TIO
Print [print('''"v->{String t=`"as=:'\`"alert(eval(c=\`"] +[------->++<]>++.++.---------.+++++.++++++.+[--->+<]>+.-...-----------.++++++.[----->++<]>++.--[++>---<]>-.---[-->+++<]>-.[->++<]>-.[--->++<]>+.[--->+<]>+++.--.---------.+++++.-------.-[--->+<]>--.---[->++++<]>.[-->+<]>+++.+++[-->+++<]>.[->+++<]>++.+[--->+<]>.--[--->+<]>--.+[-->+<]>+++.---.-[--->++<]>+.+[------>+<]>.++++.[->+++<]>++.+[--->+<]>.+++++++++++.-------.+++++++++++++.++.+[--->+<]>+.+[--->+<]>++.[--->+<]>-.[->+++<]>-.+++++++++++.[--->+<]>++++.+[--->+<]>.[--->++<]>-----.+[-->+++<]>-.++++.[->+++<]>++.
Clear all cells to left until first empty cell [[-]<]
Print [+[------->++<]>++.++.---------.+++++.++++++.+[--->] ++[------>+<]>.++[->++<]>+.-[-->+<]>.......---[-->+++<]>-.+[--->++<]>+..+[----->+<]>.++[-->+++<]>.[--->++<]>.+[--->++<]>+..+++.---..+++.-.........+.---.....+++.---......+++.---.++[->++<]>+.-[-->+<]>...---[-->+++<]>-.

You seem to print the 2nd through 51st characters of your Brainfuck answer instead of first 50 (it's missing the first >): Try it online. Also, you might want to drop the “ character, since your Brainfuck answer is currently outputting it as unprintable ``.

The > at the beginning seems to have been an accidental addition, and I dropped the “ character. Based on other answers, I think that means I only need to print first 49 characters.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
I Love Sardines
I love sardines, I can't get enough of them, and so does my computer, the Omnilang 5000, which is language agnostic.
To give my computer the joy of experiencing sardines, I've decided to feed him a number of programs that are capable of displaying on the screen tins of sardines in various orientations, and showing up to ten sardines.
In this challenge, you'll be responsible for creating the programs based on these parameters:
The input
A number (between 0 and 10) and a letter from one of the following "LR" (representing Left or Right respectively)
For example: 3L or 5R; how this is input into the program is up to you.
Output
An open tin of sardines with the sardines facing the indicated direction, with the key (represented by the "%" character) and peeled lid (rolled up tin at the end represented by the "@" character) located at the top of the tin.

All sardines must face the direction indicated by the input.
All sardines will have bodies five characters long between the gill (either ")" or "(" ) and the tail "><"
The key and peeled lid roll will always be facing the opposite direction to the sardines.
The tin must have a 3-D look to it as shown below in the examples.
The minimum height of the tin is 3 sardines in height. So if a number is less than 3, a tin of 3 sardines in height must be shown, with the inputted number of sardines in it. Otherwise, the tin must be the number of sardines high indicated in the input. So input of 0R or 0L will show an empty sardine tin.
Any other input that can't be validated will not show anything.

For example, for "3L"
 __________
(__________@%
|<*)_____><||
|<*)_____><||
|<*)_____><||
'==========''

For "7R"
   __________
 %@__________)
 ||><_____(*>|
 ||><_____(*>|
 ||><_____(*>|
 ||><_____(*>|
 ||><_____(*>|
 ||><_____(*>|
 ||><_____(*>|
 ''=========='

For "2L"
 __________
(__________@%
|<*)_____><||
|<*)_____><||
|          ||
'==========''

For "0R"
   __________
 %@__________)
 ||          |
 ||          |
 ||          |
 ''=========='

"0L"
 __________
(__________@%
|          ||
|          ||
|          ||
'==========''

Invalid input will not return anything...

This is code golf, so the smallest number of characters will win this challenge.
No Loopholes as per usual.

><>, 250 235 + 3 = 238 bytes
</~?{"  __________"a:="L"i&
o/?=1l
:/}rv?{~$?{"()__________@%":
l< o/?=1
:&oa/&~$?(3$@0-3:
/!?:</"||><_____(*>|"av?@:$-1
 /=?/v"|<*)_____><||"a/
 \2lo/
\~&
\>:?!\1+$::{a"|"{?:"          ||"{?~
<\?=2 lo
"'":~/~?{"''==========":?{
;!?lo<

Try it online, or watch it at the fish playground! Reads the "L" or "R" from STDIN and assumes the number of sardines is already on the stack (needs a -v flag for +3 bytes).
Because of course I had to write this in ><>.

Writing this solution in Fish is inspired...

How does the fish playground work? I can't get it to run. Where do I place the input?

@JarkoDubbeldam, after copying the code into the window and submitting it, you need to put the number of sardines where it says "initial stack" (simulating the -v flag), and the direction ("L" or "R") under "give input to the program" then click "give". (I've edited the answer to hopefully make that clearer.)

Awesome :D Must be nice during debugging too

Emojicode, 456 448 bytes
da0da __________❌n(__________@%  __________❌n%@__________)i⏩0a|<*)_____><||||><_____(*>|▶4i⏩0➖3a|          ||||          |a'==========''''=========='

Takes 2 arguments: first one is lines, second one is direction (0 or 1).
Try it online!
"Readable" ungolfed version and pseudocode version:

     d
     a   0 d

     a
        __________❌n(__________@%

         __________❌n%@__________)

     i ⏩ 0
       a
         |<*)_____><||

         ||><_____(*>|

     ▶ 4
       i ⏩ 0  ➖ 3
         a
           |          ||

           ||          |

     a
       '==========''

       ''=========='

extendclass int { // this makes the first argument be an int without declaring it
  func (int d) {
    const a = 0 == d // a bool

    if a {
      print " __________\n(__________@%"
    }
    else {
      print "  __________\n%@__________)"
    }

    for i in range(1, arg) {
      if a {
        print "|<*)_____><||"
      }
      else {
        print "||><_____(*>|"
      }
    }

    if 4 > arg {
      for i in range(0, arg - 3) {
        if a {
          print "|          ||"
        }
        else {
          print "||          |"
        {
      }
    }

    if a {
      print "'==========''"
    }
    else {
      print "''=========='"
    {
  }
}

Never come across Emojicode before but that is a mind f**k and a half... Crazy! Love it!

... why does this language even exist? I mean, I like it, but why? and how long did it take you to learn it?

@TaylorScott 1) dunno, i didn't create it. 2) a few hours really

Python 2, 155 bytes
lambda x,y,t='_'*10:'\n'.join(x[::1-2*y]for x in[' %s  '%t,'()'[y]+t+'@%']+['|'+('<>**)(%s><<>'%t)[y::2]+'||']*x+['|'+' '*10+'||']*(3-x)+["'"+'='*10+"''"])

Try it online!
Input consists of a length 2 tuple. The first element indicates the number of sardines. The second element indicates the direction; 0 for left, 1 for right.
-84 bytes using lambda magic thanks to notjagan and officialaimm

Great stuff, love the result and the testing site...

174 bytes (sorta got ninja'd by @officialaimm there).

Got it down further to 161 bytes!

@notjagan Lambda for 155

@officialaimm intrestingly enough, if supplied with a negative value, it extends the size of the tin, but doesn't put sardines in.

@Phoenix Yes. It doesn't matter though, since OP has specified the range 0 to 10 . P.S. -10 would print empty tin, becuase it signifies  that there were 10 sardines, but you already ate them. :D

@officialaimm Post the Lambda for 155?

@notjagan Thanks for the golfs :)

Fishing, 1311 bytes
v+CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC?CCCDCC[CCCCCCCCCCCCCCCCCCCCC?CCCCCCCCCCCCCCCCCCCC[CCC[CCCCC?CCCC?DDDDD[CCCCCCCCCCCCCCCCCCC?CCCCCCCCCCCCCCCCC[?CCCCCCCCCCCCCCCC_
  `3`n{n{In{I{`L`{`  __________ `}}!{{rD}}D{{NE`%@__________)`}}!{{E`(__________@%`}}D{{NDE}}}}={d}}!  d  D{{{{{`><_____(*>`}}!{{E`<*)_____><`}}D!{{{E`|`P}PE`||`ND
                                   [DDDDDD|                     [DDDDDDDDDDDDDDDDDDDD|   D     [C?CDDDDDDDDCCCCCCCCCCCCCCCCCCC[DDDDDDDDDDDDDDDDD|[CCCCCCCCCCCCCCCC_
                                                                                D      }=d [^+Cv-|{{{{{`          `}}                    {{{E`||`P}PE`|`ND
                                                                                D       [CCCCCCCCCCCCCCCCCCC?DDDDDDDDD+CCCC                              D
                                                                                D        E`''=========='`{{{= }}}r{{{ [CCCC                              D
                                                                                D                           [^CCCCCCCv|}}}N                              D
                                                                                |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD]

Takes input from stdin in the form:
5
R

Fishing isn't on Try It Online, but there's an interpreter for it in Ruby on the linked esolangs page.
This is the first program I've made in Fishing -- in fact, it's the first program I've made in any 2D language -- so it can probably be a lot shorter. Golfing tips are welcome (though I wouldn't be surprised if no one gave any, considering that even I don't know what the heck I just wrote).
Here's a GIF of the path the program takes for input 1R (sorry for low quality):

(This was created using an interpreter that I made; there are no publicly available programs that "visualize" Fishing, as far as I know)

The C and D syntax looks like it's contributing to the bloat... Is there any shorthand available to reduce that?

Actually scratch that, looks like they're integral to the code... Interesting choice of language! :)

Charcoal, 49 bytes
Ａ⌈⟦Ｉθ³⟧ζＢχ²_←↓(↓ζ'×=χ''↖Ｐ↑ζ←↑ζ@%ＦＮ“#∨‹ＶＢ“«ji”ＦＮ‖Ｔ

Try it online! Link is to verbose version of code. First argument is number of sardines, second is direction (0 = left, 1 = right).

Great work, Neil. Thanks for supplying a compiler link!

Don't thank me, thank @Dennis for creating TIO which generates all of the boilerplate for you.

SOGL V0.12, 51 48 bytes
!gX⁴‘gj⁰%!⁵‘b⌡"κN╥█*≤⌡║)‘3b-"÷AZ⁴‘∙_"Χccσ«‘⁰e?±↔

Try it Here!
Expects input as the 1st one being the count and the 2nd one - left or right represented by 1 or 0.
Explanation:
..‘..‘                          push 2 compressed strings - the 1st two lines of the box - "  __________ " and "%@__________)"
      b⌡                        input times do
        "..‘                      push a line with a sardine - "||><_____(*>|"
            3b-                 push 3-input
               "..‘∙            get an array of that many "||          |"
                    _           put all the arrays contents on the stack
                     "..‘       push "''=========='" - the last line
                         ⁰      wrap all of that in an array
                          e?    if the 2nd input [is not 0]
                            ±↔    reverse the array horizontally

R, 334 bytes 311 bytes
s=function(n,d){
a="__________"
b="'=========='"
if(d == "L"){cat(paste(c(" ",a,"\n(",a,"@%\n",rep("|<*)_____><||\n",n),rep("|          ||\n",max(c(3-n,0))),b,"'\n"),collapse=""))} else {cat(paste(c("  ",a,"\n%@",a,")\n",rep("||><_____(*>|\n",n),rep("||          |\n",max(c(3-n,0))),"'",b,"\n"),collapse=""))}}

Function takes a numeric value for n and a string for the direction.
This is my first time posting, so I'll admit I'm not sure how to count bytes of code.

You can paste your code into TIO, where people can also test your code :) it also displays your byte count, which is 310 in this case.

C++, 307 296 292 bytes
#include<string>
auto z(int n,char c){std::string r=c-82?" __________\n(__________@%\n":"  __________\n%@__________)\n";int l=0;for(;l<n;++l)r+=c-82?"|<*)_____><||\n":"||><_____(*>|\n";for(;l<3;++l)r+=c-82?"|          ||\n":"||          |\n";r+=c-82?"'==========''":"''=========='";return r;}

Usage :
z(<number of sardines>,<'L' or 'R'>);

-11 bytes saved thanks to user ThePirateBay
-4 bytes thanks to Zacharý

Can you remove the parentheses in #define directive? I didn't test it but it seems that there's no need for them.

Can c!=82 be c-82 in every case where you use it?

Perl 5, 167 + 1 (-n) = 168 bytes
($n,$d)=/(\d+)([LR])/ or die;say('R'eq$d?(reverse$_)=~y/()></)(<>/r:$_)for" __________  ","(__________@%",("|<*)_____><||")x$n,("|          ||")x(3-$n),"'==========''"

Try it online!

JavaScript (ES6), 283 273 269 251 bytes
Saved 10 bytes thanks to @WallyWest
Saved 4 bytes removing extra parens
Saved 18 bytes thanks to @ThePirateBay
Suffers from lack of string reversal in the standard library. Defines a function that takes inputs n for number of fish and d for direction. Throws if d is not "L" or "R".
(n,d,_=c=>c.repeat(10),x=_(`_`),z=a=>a.reverse``.join``)=>
([p,q,g,r,s]=d>`L`?d>`R`?[]:[`)`,`(`,`>`,z,y=>z(y.split``)]:
[`(`,`)`,`<`,a=>a.join``,y=>y],` ${x}
`+r([p,x,s(`@%`)])+`
`+(r([`|`,g,`*`,q,`_____`,`><`,`||`])+`
`).repeat(n)+r([`'`,_(`=`),`''`]))

Try it online

Welcome to PPCG! We hope you like it here... Let's see what we can do to golf your score down... Great commencing effort!

@WallyWest thanks! Shaved off another 17 bytes by pulling out a function and changing the if...else if to nested ternaries with a destructuring assignment. I'm out of ideas though...

If you're using ES6, change all your instances of  ('') to  ``

@WallyWest I use the _ function twice, once for the 10 underscores (which gets used twice), once for the 10 equal signs, so having it in a function saves me a byte. And unless I'm using template strings wrong, using them instead of concatenation is 3 bytes more.

I noticed that after I posted, and subsequently delayed that previous comment...

And the back ticks, for example: using split`` instead of split('')

@WallyWest thanks for the tip, that and removing some unneeded parens saved 14 bytes.

Strings are technically arrays of one character strings. Would changing s("@%") to r("%@") and eliminating the s() declaration help?

You can save 18 bytes by rearranging your identifiers. See the result here.

@WallyWest unfortunately strings and arrays are not sufficiently interchangeable in this case in JavaScript as they don't have the same method. If strings had a built-in reverse method I could probably do that but defining one on String.prototype is longer than the function I wrote by a lot.

Are these possible? _('_') => _\`, s(`@%`)=>s`@%`, and (`=`)=>_`=``? (Talk about overkill on the backticks, wow)

@Zacharý no if you do it with custom functions like f=s=>s.repeat(10) and call it f\_`` then for some reason it wraps the parameter in an array so I'd have to add an array access or convert it to a string.

Well, can you change _('_') to _(\_`)`? (that's really bugging me, one pair of strings in single quotes)

@Zacharý done. If I didn't enjoy making strangers on the internet happy, I wouldn't be on SE in the first place.

Python 2, 287 bytes
n,d=input()
t,a,b,c,e,k=' __________   ','(__________@% ','|<*)_____><|| ','|          || ',"'=========='' ",'\n'
print[t+k+a+k+k.join([b]*n)+k+k.join([c]*(3-n))+k*(n<3)+e,t[::-1]+k+a[::-1].replace(*'()')+k+k.join([b[::-1].replace(*')(')]*n)+k+k.join([c[::-1]]*(3-n))+k*(n<3)+e[::-1]][d]

Try it online!
Input is a comma separated tuple of numbers of this format: 2, 1. The first number is the amount of fish and the second is is 0 for left and 1 for right.
This started out as an attempt to out-golf the other answer (I totally thought I could), but it sucks. :P If anybody can make head and tail of it and help golf it (I blame it on it being 12 am right now), I'd be glad.

Great attempt nonetheless!

C# (.NET Core), 289 bytes
(h,d)=>{var l=d=='L';string r=(l?" ":"  ")+"__________\n"+(l?"(":"%@")+"__________"+(l?"@%":")")+"\n";for(int i=0;i<(h>3?h:3);i++){r+=(l?"|":"||")+(i<h?(d=='L'?"<*)_____><":(d=='R'?"><_____(*>":"")):"          ")+(l?"||":"|")+'\n';}var b=(l?"'":"''")+"=========="+(l?"''":"'");return r+b;}

Try it online!
Takes an integer and a char (L, R) as parameters and outputs the resulting string.
Ugh. Had to deal with some annoying string constants, sadly you cant just do string * length in C#. And the method with new string(char, length) wouldn't have been worth the byte cost.

The algorithm works as follows:

At the start we determine if the sardines face right or left, since we will then format our strings accordingly. We create a string for the top, with some conditional operators to switch between the L and R perspective.
Then we create a loop that runs 3 times at minimum and the left input times at maximum. That way we can create empty spaces if we have less than 3 sardines in our box.
Inside this loop we format a string, depending on the perspective and also, if h > i, we put a sardine inside of it. If i >= h, there will be an empty space where a sardine would normally be.
At the end we create the bottom of the box, again formatted according to perspective.

Vyxal j, 91 bytes
ð\_₀*+ðd+⅛\(\_₀*`@%`++⅛⁰3WG(\|n⁰≥[ð₀*|`<*)_____><`]\|d++⅛)\'\=₀*\'d++⅛¾¹\R=[ƛṘ`<>()``><)(`Ŀ

Try it Online!
=== Top row ===
ð\_₀*+ðd+⅛
ð          # A space
 \_₀*      # Ten underscores
     +     # Concatenated
      ðd+  # Two more spaces
         ⅛ # Push to global array
=== Next row ===
\(\_₀*`@%`++⅛
\(            # The parenthesis
  \_₀*        # Ten underscores
      `@%`    # Literal
          ++⅛ # Concatenated and pushed to global array
=== The fishes ===
⁰3WG(\|n⁰≥[ð₀*|`<*)_____><`]\|d++⅛)
⁰3WG                                # Max(3,fish)
    (                             ) # times....
     \|                             # Push pipe
          [                ]        # If...
       n⁰≥                          # Iteration number is greater than or equal to input (missing fish)
           ð₀*                      # Ten spaces
              |                     # Else...
               `<*)_____><`         # A fish
                            \|d     # `||`
                               ++⅛  # Concatenate and push to global array
=== The final row ===
\'\=₀*\'d++⅛
\'           # Literal
  \=₀*       # Ten equalses
      \'d    # Two more apostrophes
             # Concatenated and pushed to global array
=== Flipping + Formatting ===
¾¹\R=[ƛṘ`<>()``><)(`Ŀ
¾                     # Push global array
     [                # If...
 ¹\R=                 # Input is R
      ƛ               # Foreach...
       Ṙ              # Reverse...
        `<>()``><)(`Ŀ # Flip brackets

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Get the indices of an array after sorting
Your challenge today is to write a program or function which takes a list l and gives the positions in l at which each successive element of l sorted appears.
In other words, output the index of the smallest value, followed by the index of the second smallest value, etc.
You can assume that the input array will contain only positive integers, and will contain at least one element.
Test cases:
Input                  | Output (1-indexed)
[7, 4, 5]              | [2, 3, 1]
[1, 2, 3]              | [1, 2, 3]
[2, 6, 1, 9, 1, 2, 3]  | [3, 5, 1, 6, 7, 2, 4]
[4]                    | [1]

When two or more elements with the same value appear, their indices should appear next to each other from smallest to largest.
This is code-golf, fewest bytes wins!

-1 for a trivial challenge that can be solved with built-ins in common golfing languages, and for accepting an answer in less than 24 hours. This was neither a fair challenge, nor an interesting one.

Well, I get why he accepted an answer within 24 hours, it's impossible to beat.

@CodyGray I thought downvoting when I saw the 1-2 bytes answer, but actually, I don't think it's a bad challenge for more standard programming languages. Of course, it's not a hard challenge, but still, there is definitely some golfing possibilities. Of course, it's unpleasant to see 1-byte built-ins, but I don't think that it's fair to blame the challenge for that.

I'll just leave this here. Lots of good suggestions in there; this one is especially relevant.

Using a 1 character builtin is hardly practice. Easy doesn't necessarily mean solvable using only builtins.

I mean, let's just suppose for the sake of argument that a 1-character answer using a built-in is a good, competitive answer and should be accepted. It is still not true that the answer is "unbeatable". It could certainly be tied, and then what would you do? Oh, look—and it already has been tied with an APL answer. Which goes back to it's just generally unsporting to accept an answer to a code-golf question the same day that you post the question.

The best solution in such cases is to forget about te accept feature, which isn't really relevant anyway here.

The test cases only have 1 digit numbers; my solution only works well on 1 digit numbers. Is there any problem?

I don't understand the test cases. [7, 4, 5] gets sorted to [4, 5, 7], so 7 is in the third position, 3 in the first, and 5 in the second. Shouldn't this result in [3, 1, 2]? Similarly for [2, 6, 1, 9, 1, 2, 3] gets sorted to [1, 1, 2, 2, 3, 6, 9] and the result should be [3, 6, 1, 7, 2, 4, 5]? Can someone please help me understand where I am going wrong? I'd love to submit an answer but can't understand the question.

Jelly, 1 byte
Ụ

Try it online!

Heh that was too obvious...

APL deserved this one, +1 though for your speed.

@Zacharý I'm sure Jelly picked this one up from J, which in turn inherited it from APL.

Dyalog APL, 1 byte
⍋

Dyalog APL has a built in operator function (thank you Zacharý for clearing this up) to do this.
Example
⍋11 2 4 15
    2 3 1 4
{⍵[⍋⍵]}11 4 2 15
    2 4 11 15

Here I'm indexing into the list by the sorted indices to return the list in ascending order.

Oh, just to alert you to some confusing terminology, in APL, builtins like ⍋ are considered functions, while things like ¨⍨⍣.∘/\⌿⍀⌸⍤ are operators.

polyglot with BQN.

Haskell, 43 42 bytes
1-indexed:
import Data.List
map snd.sort.(`zip`[1..])

Try it online!
-1 byte thanks to @ØrjanJohansen!

Pointfree version saves one byte: map snd.sort.(`zip`[1..]).

Javascript (ES6), 39 bytes
-2 bytes thanks to @powelles
This only works in browsers where Array.prototype.sort is stable.
a=>[...a.keys()].sort((b,c)=>a[b]-a[c])

1-indexed version (47 bytes):
a=>a.map((_,i)=>i+1).sort((b,c)=>a[b-1]-a[c-1])

Example code snippet:

f=
a=>[...a.keys()].sort((b,c)=>a[b]-a[c])
console.log("7,4,5 => "+f([7,4,5]))
console.log("1,2,3 => "+f([1,2,3]))
console.log("2,6,1,9,1,2,3 => "+f([2,6,1,9,1,2,3]))
console.log("4 -> "+f([4]))

[...a.keys()] instead of a.map((_,i)=>i) will save you a couple of bytes.

Python 2, 56 bytes
This solution is 0-indexed. This abuses the fact that sorted() creates a copy of the original list.
l=input()
for k in sorted(l):a=l.index(k);print a;l[a]=0

Try it online!

Why did you ungolf this?

@EriktheOutgolfer Fixed, Rollback.

Python 2, 48 bytes
lambda x:sorted(range(len(x)),key=x.__getitem__)

Try it online!

Nice, I got outgolfed >_<. I switched my answer to Python 3 such that I don't feel that bad

@Mr.Xcoder Well, that's his job...

@Mr.Xcoder Come on, you shouldn't feel bad for that! You made a full program, I made a function, and my approach is a bit different.

I don't feel bad, I knew this will appear (I personally hate the __<blahblah>__ syntax). I will do some Jelly, I don't want to lose my training :)

@Mr.Xcoder Codegolf doesn't mean pretty syntax and formatting. ;)

@EriktheOutgolfer Those aren't news for me :) (I've been around for a while, I learnt that long ago)

Perl 6,  27  21 bytes
*.pairs.sort(*.value)».key

Test it
->\x{sort {x[$_]},^x}

Test it
Inspired by a Python answer
Expanded:
->    # pointy block lambda
  \x  # declare sigilless parameter
{
  sort
    { x[$_] },  # sort by the value in ｢x｣ at the given position
    ^x          # Range up-to the number of elements in ｢x｣
}

Bash + coreutils, 20
nl|sort -nk2|cut -f1

Try it online.

R, 5 bytes
There is a builtin function for this.
order

Standard rules is to provide a program of function. order is already a function, so you don't have to handle input using scan(). This would be 5 bytes.

rank() would save a byte

I am sure there was a rank answer by @JarkoDubbeldam, but I do not see it anymore.

Correct, it does not follow the spec so I deleted it.

Swift 4, 82 bytes
func f(l:[Int]){var l=l;for k in l.sorted(){let a=l.index(of:k)!;print(a);l[a]=0}}

Test Suite.
Explanation
In Swift, l.sorted() creates a sorted copy of the original Array. We loop through the sorted elements in the list and after printing each item's index in the original Array with let a=l.index(of:k)!;print(a), and then, in order to keep the correct indexes in the Array, we assign l[a] to 0, because it does not affect our normal output.

Take note that this is 0-indexed, since it is a port of my Python solution. If you want it to be 1-indexed, replace print(a) with print(a+1) or Try it online!.

Octave, 17 bytes
@(i)[~,y]=sort(i)

Try it online!
Octave is like MATLAB but with inline assignment, making things possible that gives the folks at Mathworks HQ headaches. It doesn't matter what you call y, but you can't do without that dummy variable, as far as I know.

J, 2 bytes
/:

Try it online!
Zero-based indexing.

Was going to post this...

Ruby, 40 bytes
->a{a.zip([*1..a.size]).sort.map &:last}

Try it online!

Julia, 8 bytes
sortperm

Attempt This Online!

MATL, 2 bytes
&S

Try it online!
Input and output are implicit.

MY, 3 bytes
MY also has a builtin for this!
⎕⍋↵

Try it online!
How?
Evaluated input, grade up, then output with a newline.
Indexed however you set the index, with ⌶/0x48. (Can even be some weird integer like -1 or 2, the default is 1).

Java 8, 128 + 19 = 147 bytes
Based on Mr. Xcoder's solution. 0-based. Lambda takes input as an Integer[] and returns Integer[]. Byte count includes lambda expression and required import.
import java.util.*;

l->{Integer o[]=l.clone(),s[]=l.clone(),i=0;for(Arrays.sort(s);i<l.length;)l[o[i]=Arrays.asList(l).indexOf(s[i++])]=0;return o;}

Try It Online
Ungolfed lambda
l -> {
    Integer
        o[] = l.clone(),
        s[] = l.clone(),
        i = 0
    ;
    for (Arrays.sort(s); i < l.length; )
        l[o[i] = Arrays.asList(l).indexOf(s[i++])] = 0;
    return o;
}

Notes
I use Integer[] instead of int[] to allow use of Arrays.asList, which has no primitive versions. Integer is preferred to Long because values are used as array indices and would require casting.
This ended up being shorter than my best procedural-style List solution because of the cost of class and method names.
This also beat a solution I tried that streamed the inputs, mapped to (value, index) pairs, sorted on values, and mapped to indices, mostly because of the baggage needed to collect the stream.
Acknowledgments

-5 bytes thanks to Nevay

You don't need j: l->{Integer o[]=l.clone(),s[]=l.clone(),i=0;for(Arrays.sort(s);i<l.length;l[o[i]=Arrays.asList(l).indexOf(s[i++])]=0);return o;} (19+128 bytes).

Factor, 8 bytes
arg-sort

Try it online!
0-indexed

Common Lisp, 82 bytes
(lambda(l)(loop as i in(sort(copy-seq l)'<)do(setf(elt l(print(position i l)))0)))

Try it online!

MATLAB / Octave, 29 bytes
[~,y]=sort(input(''));disp(y)

Try it online!

While your answer is perfect MATLAB, you can actually do inline assignment in anonymous functions in Octave.

Good one! I knew about in-line assignment, but I didn't know you could output directly like that

To be honest, me neither. I started with something like @(X)([~,y]=sort(X)), and while I was looking of a way to get y from this, I realized y was actually the return value from the assignment, and closer inspection revealed that brackets weren't even needed. MATLAB likes everything explicit; Octave is happy when it's unambiguous.

Clojure, 39 bytes
#(map key(sort-by val(zipmap(range)%)))

Translated to Perl 6 {map *.key,(sort *.value,(0..* Z=> @_))}

CJam, 12 bytes
{ee{1=}$0f=}

Try it online!

JavaScript (ES6), 69 bytes
0-indexed. Works for lists containing up to 65,536 elements.
a=>[...a=a.map((n,i)=>n<<16|i)].sort((a,b)=>a-b).map(n=>a.indexOf(n))

Test cases

let f =

a=>[...a=a.map((n,i)=>n<<16|i)].sort((a,b)=>a-b).map(n=>a.indexOf(n))

console.log(JSON.stringify(f([7, 4, 5])))
console.log(JSON.stringify(f([1, 2, 3])))
console.log(JSON.stringify(f([2, 6, 1, 9, 1, 2, 3])))
console.log(JSON.stringify(f([4])))

Can you change n=>a.indexOf(n) to just a.indexOf?

@Zacharý Unfortunately not. A method of an instanced object cannot be used as a callback.

@Zacharý Even worse is that Array#map passes 3 arguments to the callback function, and Array#indexOf expects 2, so it will give undesirable results.

Python 3 with Numpy, 38 26 bytes
12 bytes saved thanks to Jo King (no need to give the function a name)
import numpy
numpy.argsort

Output is 0-based.
Try it online!

The function could just be numpy.argsort without the lambda part

@JoKing Thanks for the suggestion. I wrote it that way because with just numpy.argsort;import numpy I get an error (numpy has not been imported yet), and with import numpy;numpy.argsort I need to move f= to the code part. Do you know that the standard procedure is in these cases? Move the f= and not count it?

Yeah, I guess. Maybe just redefine f=numpy.argsort in the footer

@JoKing Good idea. Done. Thanks!

Python 3, 52 bytes
0-indexed. Based on Bruce Forte's Haskell answer here and G B's Ruby answer here.
lambda l:list(zip(*sorted(zip(l,range(len(l))))))[1]

Try it online!

Husk, 10 7 bytes
This is a direct port of my Haskell answer, also 1-indexed:
m→O`z,N

Try it online!
Ungolfed/Explained
Code        Description               Example
         -- implicit input            [2,6,1]
      N  -- natural numbers           [1,2,3,..]
   `z,   -- zip, but keep input left  [(2,1),(6,2),(1,3)]
  O      -- sort                      [(1,3),(2,1),(6,2)]
m→       -- keep only indices         [3,1,2]

Java (OpenJDK 8), 72 bytes
l->l.stream().sorted().map(i->{int j=l.indexOf(i);l.set(j,0);return j;})

Try it online!
Takes a List<Integer>, returns a Stream<Integer> containing the results.
We get a Stream based off the initial list, sort it, then map each number to it's index in the list. In order to accommodate duplicate elements, we set the original element in the list to 0.

SmileBASIC, 67 bytes
DEF I(A)DIM B[0]FOR I=1TO LEN(A)PUSH B,I
NEXT
SORT A,B
RETURN B
END

Very simple, all it does is generate a list of numbers from 1 to (length of array) and sort this by the same order as the input.

Vyxal, 1 byte
⇧

Try It Online!
0-indexed

Thunno 2, 1 byte
ƙ

Try it online!
Same as the other golflangs - built-in for "grade up".

Desmos, 27 bytes
Yields a 1-indexed result.
f(l)=sort([1...l.length],l)

Try it on Desmos!

05AB1E, 4 bytes
ā<Σè

Try it online!

PHP, 54 bytes
<?php function i($a){asort($a);return array_keys($a);}

Try it online!
This is zero-indexed. Simply sorts the array and returns the keys.

The <?php tag is unnecessary for a function. 48 bytes.

Tcl, 21 bytes
(0-indexed)
puts [lsort -indi $L]

Try it online!

The test cases only have 1 digit numbers; my solution only works well on 1 digit numbers.

Ruby, 34 bytes
->a{(0...a.size).sort_by{|i|a[i]}}

0-indexed, 1-indexing requires one more net byte:
->a{(1..a.size).sort_by{|i|a[i-1]}}

Also, a slightly golfed version of G B's answer is 37 bytes:
->a{a.each_with_index.sort.map &:pop}

Pari/GP, 16 bytes
a->vecsort(a,,1)

Try it online!

Kotlin,  44  34 bytes
not today, crossed out 44
{l->(1..l.size).sortedBy{l[it-1]}}

Try it online!
1-indexed because that's what the examples give. A 0-indexed version looks like this for 30 bytes:
{l->l.indices.sortedBy{l[it]}}

Japt, 6 5 bytes
0-indexed
ð ñ@v

Try it

Alternative, 6 bytes
í ñÎmÌ

Try it


text:
Count up diagonally!
We have lots of horizontal axis for numbers, but I honestly think they're kind of boring. Your task today is to build me a portion of a diagonal axis between two distinct non-negative integers given as input.
How to build a diagonal axis?

Let's take an example, with the input 0, 5. Our axis should look like this:

0
 1
  2
   3
    4
     5

However, our axis should look nice for numbers that have more digits too! If the input is, for instance 0, 14, the new axis should be:

0
 1
  2
   3
    4
     5
      6
       7
        8
         9
          10
            11
              12
                13
                  14

The idea is that the first digit of next number on the axis must always be placed exactly after the last digit of the previous number. To understand the idea even better, here is another example with 997, 1004:

997
   998
      999
         1000
             1001
                 1002
                     1003
                         1004

Rules

You may assume that input is in ascending or descending order (you may choose between 5,3 and 3,5).
You may also assume that the difference between the two integers is lower than 100.
You may have a leading newline or a consistent leading space (on each line). Trailing spaces / newlines are fine as well.
Default Loopholes are forbidden.
You can take input and provide output by any standard mean.
This is code-golf, so the shortest code in bytes in every language wins!

Other Test Cases

1, 10:

1
 2
  3
   4
    5
     6
      7
       8
        9
         10

95, 103:

95
  96
    97
      98
        99
          100
             101
                102
                   103

999999, 1000009:

999999
      1000000
             1000001
                    1000002
                           1000003
                                  1000004
                                         1000005
                                                1000006
                                                       1000007
                                                              1000008
                                                                     1000009

Are leading spaces allowed, or does the first number have to be exactly on the left side of the screen?

@NathanShiraini Leading newlines are allowed

Related

@StepHen This one's a bit harder though, thanks for the reference.

Are leading spaces allowed?

@Adnan You may have a leading newline or a consistent leading space on each line.

Are trailing newlines/spaces allowed?

@Titus Yup, that is allowed.

05AB1E, 8 7 6 bytes
Thanks to Magic Octopus Urn for saving a byte!
It somehow works, but honestly I have no idea why.
Code
Ÿvy.O=

Uses the 05AB1E encoding. Try it online!
Explanation
Ÿ          # Create the range [a, .., b] from the input array
 vy        # For each element
   .O      #   Push the connected overlapped version of that string using the
                 previous version of that string. The previous version initially
                 is the input repeated again. Somehow, when the input array is
                 repeated again, this command sees it as 1 character, which gives
                 the leading space before each line outputted. After the first
                 iteration, it reuses on what is left on the stack from the
                 previous iteration and basically attaches (or overlaps) itself
                 onto the previous string, whereas the previous string is replaced
                 by spaces and merged into the initial string. The previous string
                 is then discarded. We do not have to worry about numbers overlapping
                 other numbers, since the incremented version of a number never
                 overlaps entirely on the previous number. An example of 123 and 456:

                 123
                    456

                 Which leaves us "   456" on the stack.
     =     #   Print with a newline without popping

.O   = pop a,b    push connected_overlap(b) (deprecated) - Oh, I guess?

@MagicOctopusUrn Yeah, .O is extremely buggy and deprecated for over a year so I have no idea what works and what doesn't. I could swear that I needed Î, but that suddenly doesn't seem to be the case anymore (?). Thanks! :)

Btw, the Î was needed to reduce the maximum number of leading spaces to 1.

I... Wait... What, how...?

I don't really understand how this works such that it is so short. Can you add an explanation (in case you understand your own answer)?

@Mr.Xcoder added

Python 2, 43 bytes
lambda a,b:'\v'.join(map(str,range(a,b+1)))

Makes use of vertical tab to make the ladder effect. The way thet \v is rendered is console dependent, so it may not work everywhere (like TIO).

Can you use a literal \x0b in your code to save a byte?

@DomHastings maybe, I don't know how though

I've just tested it and it appears to work. For getting the character into the file to test, I used Sublime Text and did a find and replace in regex mode for \\v and replaced with \x0B which shows up a VT character in its place for scoring you can either post a reversible hexdump (xxd or something) or just state that: "\v is a literal vertical tab", I think that would be fair. Hope that helps!

Charcoal, 9 8 bytes
Ｆ…·ＮＮ⁺¶ι

Try it online!
Link is to the verbose version of the code. Input in ascending order.

1 byte saved thanks to ASCII-only!

Nice, Charcoal wins this again!

8 bytes

EDIT: Charcoal got outgolfed... Wow

@Mr.Xcoder at least I know how my answer works. :-D

R, 70 69 61 bytes
function(a,b)for(i in a:b){cat(rep('',F),i,'
');F=F+nchar(i)}

Function that takes the start and end variable as arguments. Loops over the sequence, and prints each element, prepended with enough spaces. F starts as FALSE=0, and during each iteration, the amount of characters for that value is added to it. F decides the amount of spaces printed.
Try it online!
-8 bytes thanks to @Giuseppe

I see 70 bytes there. Using scan() twice it can be reduced to 67 bytes for(i in scan():scan()){cat(rep(' ',F),i,'\n',sep='');F=F+nchar(i)}.

Unfortunately you have to reset F, otherwise the function can be used only once in a new sessions. F=0;for(i in scan():scan()){cat(rep(' ',F),i,'\n',sep='');F=F+nchar(i)} (71 byte)

@djhurio Inside a function, that is not necessary, since F is only modified in its own namespace. Also, I count 69 bytes, using nchar.

Yet manually counting I do get 70. This is weird...

You are right about the function. nchar('\n') == 1 ;)

... that makes sense. sorta...

But replacing \n for an actual newline works too, and that doesn't cost two bytes apparently.

61 bytes with the spec "consistent leading space"

Nice, I thought of abusing the automatic spacing of cat, but I couldn't think straight and figure it out for some reason.

@Giuseppe One more byte

Python 2, 58 54 bytes
def f(a,b,s=''):print s;b<a or f(a+1,b,' '*len(s)+`a`)

Try it online!

Wow, surprising recursive solution and out-golfs most python answers, +1.

Very good job Ruud, your solution is also OS and console-independent by not using the vertical tab character like Rod did.

C#, 90 89 85 bytes
s=>e=>{var r="";for(int g=0;e>s;g+=(s+++"").Length)r+="".PadLeft(g)+s+"\n";return r;}

Saved 1 byte thanks to @LiefdeWen.
Saved 4 bytes thanks to @auhmaan.
Try it online!
Full/Formatted version:
namespace System
{
    class P
    {
        static void Main()
        {
            Func<int, Func<int, string>> f = s => e =>
            {
                var r = "";
                for (int g = 0; e > s; g += (s++ + "").Length)
                    r += "".PadLeft(g) + s + "\n";

                return r;
            };

            Console.WriteLine(f(0)(5));
            Console.WriteLine(f(0)(14));
            Console.WriteLine(f(997)(1004));
            Console.WriteLine(f(1)(10));
            Console.WriteLine(f(95)(103));
            Console.WriteLine(f(999999)(1000009));

            Console.ReadLine();
        }
    }
}

+1, now you don't have 5k precisely ;D

1 byte at i<=e to e>i

@LiefdeWen Thanks :)

I believe you can save more 4 bytes by removing the i and reusing the s instead

@auhmaan Thanks don't know why I never think of using the input variable.

Mathematica, 59, bytes
Grid[(DiagonalMatrix@Range[1+##]/. 0->""+1)-1,Spacings->0]&

input

[10,15]

-3 bytes @JungHwanMin
problem with 0 fixed (see comments for details)
thanx to @ngenisis

Wow, an answer that actually contains the word Diagonal

You need to add Spacings -> 0 if you want this to be character-exact.

The input is only non-negative, not guaranteed to be positive.

Grid[(DiagonalMatrix@Range[1+##]/. 0->""+1)-1,Spacings->0]& is the shortest way I could find to fix those problems

C, 166 134 95 82 Bytes
New Answer
Just as a function not as a whole program.
f(a,b){int s=0,i;while(a<=b){i=s;while(i--)printf(" ");s+=printf("%i\n",a++)-1;}}

Thanks to Falken for helping knock off 13 Bytes (and fix a glitch)!
Thanks to Steph Hen for helping knock off 12 Bytes!
Thanks to  Zacharý for help knock off 1 Byte!
Old Answers
Got rid of the int before main and changed const char*v[] to char**v and got rid of return 0;
main(int c,char**v){int s=0;for(int a=atoi(v[1]);a<=atoi(v[2]);a++){for(int i=0;i<s;i++)printf(" ");printf("%i\n",a);s+=log10(a)+1;}}

int main(int c,const char*v[]){int s=0;for(int a=atoi(v[1]);a<=atoi(v[2]);a++){for(int i=0;i<s;i++)printf(" ");printf("%i\n",a);s+=log10(a)+1;}return 0;}

This is my first time golfing and I wanted to try something in C. Not sure if I formatted this correctly, but I had fun making it!
int main(int c, const char * v[]) {
    int s = 0;
    for(int a=atoi(v[1]); a<=atoi(v[2]); a++) {
        for(int i=0; i<s; i++) printf(" ");
        printf("%i\n",a);
        s += log10(a)+1;
    }
    return 0;
}

Explanation
int s = 0; // Number of spaces for each line

for(int a=atoi(argv[1]); a<=atoi(argv[2]); a++) { // Loop thru numbers

for(int i=0; i<s; i++) printf(" "); // Add leading spaces

printf("%i\n",a); // Print number

s += log10(a)+1; // Update leading spaces

Usage

Welcome to PPCG! I believe you can rename argc and argv to one letter variables.

I think you can move the int s=0 to the for loop, as in for(int s=0;a<=b;a++).

Ahh your right thanks, I updated the post!

Using int i=s;while(i--) instead of for(int i=0;i<s;i++) for the inner loop will save two bytes.

Also, it looks like this fails if the starting number is zero.  Fortunately that can be fixed and the code can be made even shorter by using the return value of printf, like so: s+=printf("%i\n",a)-1;

Last one: both s and i can be combined into a single int declaration, saving two more bytes.  Here's the final code: f(a,b){int s=0,i;while(a<=b){i=s;while(i--)printf(" ");s+=printf("%i\n",a++)-1;}}

Ahhh your right forgot about log10 on 0 and negatives, I've updated the solution thanks!

55 bytes

Jelly, 9 bytes
rD⁶ṁ$;¥\Y

Try it online!

Mathematica, 48 bytes
Rotate[""<>Table[ToString@i<>" ",{i,##}],-Pi/4]&

since there are so many answers, I thought this one should be included
input

[0,10]

output

This isn't valid, is it? But +1 just for taking the title literally.

Retina, 81 78 bytes
.+
$*
+`\b(1+)¶11\1
$1¶1$&
1+
$.& $.&
 (.+)
$.1$*
+1`( *)(.+?)( +)¶
$1$2¶$1$3

Try it online! Takes input as a newline-separated list of two integers. Edit: Saved 3 bytes by stealing the range-expansion code from my answer to Do we share the prime cluster? Explanation:
.+
$*

Convert both inputs to unary.
+`\b(1+)¶11\1
$1¶1$&

While the last two elements (a, b) of the list differ by more than 1, replace them with (a, a+1, b). This expands the list from a tuple into a range.
1+
$.& $.&

Convert back to decimal in duplicate.
 (.+)
$.1$*

Convert the duplicate copy to spaces.
+1`( *)(.+?)( +)¶
$1$2¶$1$3

Cumulatively sum the spaces from each line to the next.

APL (Dyalog), 25 24 bytes
-1 thanks to Zacharý.
Assumes ⎕IO←0 for zero based counting. Takes the lower bound as left argument and the upper bound as right argument.
{↑⍵↑⍨¨-+\≢¨⍵}(⍕¨⊣+∘⍳1--)

Try it online!
(…) apply the following tacit function between the arguments:
 - subtract the upper lower from the upper bound
 1- subtract that from one (i.e. 1 + ∆)
 ⊣+∘⍳ left lower bound plus the integers 0 through that
 ⍕¨ format (stringify) each
{…} apply the following anonymous on that (represented by ⍵):
 ≢¨ length of each (number)
 +\ cumulative sum
 - negate
 ⍵↑⍨¨ for each stringified number, take that many characters from the end (pads with spaces)
 ↑ mix list of strings into character matrix

Could +-⍨ be --?

@Zacharý Yes, of course. Thanks.

C++, 167 165 bytes
-2 bytes thanks to Zacharý
#include<string>
#define S std::string
S d(int l,int h){S r;for(int m=0,i=l,j;i<=h;){for(j=0;j<m;++j)r+=32;S t=std::to_string(i++);r+=t;r+=10;m+=t.size();}return r;}

Could you move the int m=0,i=l,j to the first for loop to save a byte? 2. Can you change r+=t;r+=10 to r+=t+10? 3. I beat someone, yay.

@Zacharý I can do r+=t+=10 but not r+=t+10, it gave me an error

But r+=t+=10 does work? Wouldn't that affect t.size()?

@Zacharý Yes, it works, with only +, it says it can't find an overload with int as parameter, but with += it uses the overload with the char

Oh, could you move the ++i to the std::to_string(i) as std::to_string(i++) to save one more byte?

Python 2, 65 63 62 61 bytes
-2 bytes Thanks to @Mr. Xcoder: exec doesn't need braces
-1 bye thanks to @Zacharý: print s*' ' as print' '*s
def f(m,n,s=0):exec(n-m+1)*"print' '*s+`m`;s+=len(`m`);m+=1;"

Try it online!

You do not need the braces for exec. m,n=input();s=0;exec(n-m+1)*"print s*' '+`m`;s+=len(`m`);m+=1;" suffices.

I think you can change print s*' ' to print' '*s to save one byte.

Pyth, 14 13 bytes
V}FQ
=k+*dlkN

Try it online!

LOGO, 53 bytes
[for[i ? ?2][repeat ycor[type "\ ]pr :i fd count :i]]

There is no "Try it online!" link because all online LOGO interpreter does not support template-list.
That is a template-list (equivalent of lambda function in other languages).
Usage:
apply [for[i ? ?2][repeat ycor[type "\ ]pr :i fd count :i]] [997 1004]

(apply calls the function)
will print
997
   998
      999
         1000
             1001
                 1002
                     1003
                         1004

Note:
This uses turtle's ycor (Y-coordinate) to store the number of spaces needed to type, therefore:

The turtle need to be set to home in its default position and heading (upwards) before each invocation.
window should be executed if ycor gets too large that the turtle moves off the screen. Description of window command: if the turtle is asked to move past the boundary of the graphics window, it will move off screen., unlike the default setting wrap, which if the turtle is asked to move past the boundary of the FMSLogo screen window, it will "wrap around" and reappear at the opposite edge of the window.

Explanation:
for[i ? ?2]        Loop variable i in range [?, ?2], which is 2 input values
repeat ycor        That number of times
type "\            space character need to be escaped to be typed out.
pr :i              print the value of :i with a newline
fd count :i        increase turtle's y-coordinate by the length of the word :i. (Numbers in LOGO are stored as words)

Japt, 12 bytes
òV
£¯Y ¬ç +X

Takes input in either order and always returns the numbers in ascending order, as an array of lines.
Try it online! with the -R flag to join the array with newlines.
Explanation
Implicit input of U and V.
òV
£

Create inclusive range [U, V] and map each value to...
¯Y ¬ç

The values before the current (¯Y), joined to a string (¬) and filled with spaces (ç).
+X

Plus the current number. Resulting array is implicitly output.

JavaScript (ES8), 69 67 62 bytes
Takes input as integers, in ascending order, using currying syntax. Returns an array of strings.
x=>y=>[...Array(++y-x)].map(_=>s="".padEnd(s.length)+x++,s="")

Try it

o.innerText=(f=

x=>y=>[...Array(++y-x)].map(_=>s="".padEnd(s.length)+x++,s="")

)(i.value=93)(j.value=105).join`\n`
oninput=_=>o.innerText=f(Math.min(i.value,j.value))(Math.max(i.value,j.value)).join`\n`
label,input{font-family:sans-serif}input{margin:0 5px 0 0;width:100px;}
<label for=i>x: </label><input id=i type=number><label for=j>y: </label><input id=j type=number><pre id=o>

05AB1E, 8 bytes
Ÿʒ¾ú=þv¼

Try it online!
-2 thanks to Adnan.

Ahh, that is very clever. You can replace vy by ʒ and gF by v to save 2 bytes.

@Adnan I didn't expect the good old ʒ trick to still be used...

Java 8, 79 bytes
(a,b)->{for(String s="";a<=b;System.out.printf("%"+s.length()+"d\n",a++))s+=a;}

Try it online!

You can save a byte by changing (a,b)-> to b->a->. (And you could save three more bytes by going to Java 10 and changing String to var.) Try it online.

Haskell, 39 bytes
a%b=scanl((.show).(++).(' '<$))""[a..b]

Try it online!

C (gcc), 41 38 bytes
-3 bytes Thanks to ASCII-only
t(x,v){while(x<=v)printf("%d\v",x++);}

Works on RedHat6, accessed via PuTTY

Try it online!

This doesn't produce correct output.

it's tricky, output to a file and then use more on that file

@GiacomoGarabello You must provide the full code in order for us to be able to run your program. If you do not provide a working test ground / do not provide instructions on how to run your program such that it produces correct output, please delete this answer.

Linefeed may return to begin of line, it depends. This does work when it does not.

@Mr.Xcoder Edited

@user202729 char11 is vertical Tab

Ok, I don't remember ASCII. printf("%d\xB",x++) should work and save some bytes.

38 bytes

printf("%d\v",x++) should also save one more byte

@ASCII-only thanks!

Can you use a literal \x0b in your code to save another byte?

Python 2, 78 77 79 bytes
def f(a,b):
 for i in range(a,b+1):print sum(len(`j`)for j in range(i))*' '+`i`

Try it online!
f(A, B) will print the portion of the axis between A and B inclusive.
First time I answer a challenge!
Uses and abuses Python 2's backticks to count the number of spaces it has to add before the number.
-1 byte thanks to Mr.Xcoder
+2 because I forgot a +1

Welcome to PPCG! nice first answer. sum(len(`j`)) for can become sum(len(`j`)for, -1 bytes

To make this answer valid, you must replace range(a,b) with range(a,b+1), because Python has semi inclusive ranges.

Indeed, I missed that. What's more surprising is that I did add that +1 when I made my tests! No wonder I had 2 bytes missing when I typed it into TiO...

JavaScript, 57 bytes
f=(x,y,s='')=>y>=x?s+`
`+f(x+1,y,s.replace(/./g,' ')+x):s

55 bytes: y=>g=(x,s='')=>y<x?s:s+'\n'+g(x+1,s.replace(/./g,' ')+x) Call with currying with the integers reversed: f(103)(95).

54 bytes: x=>y=>g=(s='')=>y<x?s:s+'\n'+g(s.replace(/./g,' ')+x++) Call as f(x)(y)().

Python 2, 60 59 bytes
-1 byte thanks to Mr.Xcoder for defining my s=0 as an optional variable in my function.
def f(l,u,s=0):
 while l<=u:print' '*s+`l`;s+=len(`l`);l+=1

Try it online!
I think it is possible to transfer this into a lambda version, but I do not know how. I also think that there is some sort of mapping between the spaces and the length of the current number, but this I also did not figure out yet. So I think there still is room for improvement.
What i did was creating a range from the lowerbound lto the upper bound u printing each line with a space multiplied with a number s. I am increasing the multiplier with the length of the current number.

59 bytes

Alternative 59 bytes

I'll figure out you did with that "exec"-version later this day. Maybe it will help me in future codings. Thanks

Lambda version, 62 bytes

MATL, 11 bytes
vii&:"t~@Vh

Try it online!
Explanation
This works by generating a string for each number and concatenating it with a logically-negated copy of the previous string. Thus char 0 is prepended 0 as many times as the length of the previous string. Char 0 is displayed as a space, and each string is displayed on a different line
v       % Concatenate stack (which is empty): pushes []
ii      % Input two numbers
&:      % Range between the two numbers
"       % For each
  t     %   Duplicate
  ~     %   Logical negation. This gives a vector of zeros
  @     %   Push current number
  V     %   Convert to string
  h     %   Concatenate with the vector of zeros, which gets automatically
        %   converted into chars.
        % End (implicit). Display stack (implicit), each string on a diferent
        % line, char 0 shown as space

D, 133 127 126 125 121 119 bytes
import std.conv,std.stdio;void f(T)(T a,T b,T s=0){for(T j;j++<s;)' '.write;a.writeln;if(a-b)f(a+1,b,s+a.text.length);}

Jelly and APL were taken.
Try it online!
If you're fine with console-dependent results (goes off the same principle as Giacomos's C answer) here's one for 72 71 bytes:
import std.stdio;void f(T)(T a,T b){while(a<=b){a++.write;'\v'.write;}}

How? (Only D specific tricks)

f(T)(T a,T b,T s=0) D's template system can infer types
for(T j;j++<s;) Integers default to 0.
' '.write;a.writeln D lets you call fun(arg) like arg.fun (one of the few golfy things D has)
a.text.length Same as above, and D also allows you to call a method with no parameters as if it was a property (text is conversion to string)
One thing that might be relevant (I didn't use this though) newlines can be in strings!

V, 16 bytes
ÀñÙywÒ $pça/jd

Try it online!
This would be way easier if I could take start end - start but I think that's changing the challenge a bit too much.
This takes the start number as input in the buffer and the end number as an argument.  It actually creates the ladder from start to start + end and then deletes everything after the end number.

Perl, 19 bytes
Note: \x0b is counted as one byte.
Along with others, I thought using cursor movements would be the shortest route, this does mean it doesn't work on TIO:
print"$_\x0b"for<>..<>

Usage
perl -e 'print"$_\x0b"for<>..<>' <<< '5
10'
5
 6
  7
   8
    9
     10

Nice, haven't seen Perl at all in a while. Could you add a testing link? Additionally, I was wondering what the 1.. does there, since you are given two integers.

@Mr.Xcoder Yeah, 1.. was me not fully reading the spec, that's fixed now! As for testing it online, because the output contains the vertical tab, it doesn't render as expected. Trying to see if I can find a renderer that does support control chars... If not, that might be my new project!

Swift 4, 115 bytes
I think nobody would have posted a Swift solution anyway...
func f(l:Int,b:Int){for i in l...b{print(String(repeating:" ",count:(l..<i).map{String($0).count}.reduce(0,+)),i)}}

Try it online!

Japt, 10 9 bytes
òV åÈç +Y

Test it online! Returns an array of lines; -R flag included to join on newlines for easier viewing.
Explanation
 òV åÈ   ç +Y
UòV åXY{Xç +Y}   Ungolfed
                 Implicit: U, V = inputs, P = empty string
UòV              Create the range [U, U+1, ..., V-1, V].
    åXY{     }   Cumulative reduce: Map each previous result X and current item Y to:
        Xç         Fill X with spaces.
           +Y      Append Y.
                 Implicit: output result of last expression

Old version, 10 bytes:
òV £P=ç +X

Test it online!
 òV £  P= ç +X
UòV mX{P=Pç +X}  Ungolfed
                 Implicit: U, V = inputs, P = empty string
UòV              Create the range [U, U+1, ..., V-1, V].
    mX{       }  Map each item X to:
         Pç        Fill P with spaces.
            +X     Append X.
       P=          Re-set P to the result.
                   Implicitly return the same.
                 Implicit: output result of last expression

Dang, I had just come up with the same solution as an improvement to my own answer.

NotQuiteThere, 5 bytes
yr-11

Try it online!
Uses the vertical tab trick in Rod's python answer, so doesn't really work on TIO. Input is taken in descending order (11, 7)

WendyScript, 50 bytes
<<f=>(x,y){<<s=""#i:x->y+1{s+i#i!=0{s+=" "i\=10}}}

f(95, 103)

Try it online!
Only issue is once you get past 100000, numbers are outputted in scientific notation (which I should probably change to always display in full form). The online syntax highlighter also dislikes "" but it is parsed correctly.

QBIC, 25 bytes
[:,:|A=space$(_lA|)+!a$?A

Explanation:
[:     FOR a = <input 1 from cmd line>
,:|    TO <input 2 from cmd line>
A=         SET A$ to
 space$      a number of spaces equal to
 (_lA|)      the current length of A$ (starts as "" = 0)
+!a$         and add a cast-to string of the current loop iterator
?A     PRINT A$
           Loop auto-closed by QBIC

Ruby, 18 bytes
->a,b{[*a..b]*?\v}

Just for reference, but does not work on TIO:
Try it online!

PowerShell, 49 bytes
$a,$b=$args;$a..$b|%{$l=($z=" "*$l+$_).length;$z}

Try it online!
Takes input as two command-line arguments, $a and $b, forms a range .. out of them, then loops |%{} over that range. Each iteration, we construct a string $z of a certain number of spaces " "*$l concatenated with our current number $_. We then pull out the .length of that, re-store it into $l for next time, and leave $z on the pipeline. Output is implicit.

Bash + coreutils, 10
seq -s^K $@

Here ^K is a literal vertical tab and control character. The xxd dump of this script is as follows - use xxd -r to regenerate the actual script:
00000000: 7365 7120 2d73 0b20 2440                 seq -s. $@

Input range is given as two integers at the command-line.
Not sure if much of an explanation is needed here - seq simply does the counting (from a to b, passed in the $@ parameter), with -s specifying the separator as a vertical tab.  This causes the next number to be printed after the previous one, down one line, as required.

Haskell, 46 bytes
a%b=[([a..x-1]>>=show>>" ")++show x|x<-[a..b]]

Try it online! Usage: 0%20. Returns a list of lines. Use putStr . unlines $ 0%20 for pretty-printing.

dc, 51 bytes
sj0skp[32Plkll1+dsl<S]sS[0sldZlk+sklSx1+pdlj>M]dsMx

Try it online!
This pretty much has to be suboptimal, my brain is clearly still in Monday mode.
Pretty much just macro S printing spaces, and macro M doing the rest of the work. Register l restarts at zero spaces before running S, and compares against register k, which we always increment by the number of digits of top-of-stack.

Perl 5, 43 42 31 + 1 (-a) 0 = 43 31 bytes
map{say$l=$l=~y// /cr.$_}<>..<>

Try it online!

Tcl, 80 bytes
proc P a\ b {while \$a<=$b {puts [format %[incr i [string len $a]]d $a];incr a}}

Try it online!

SmileBASIC, 43 bytes
INPUT A,B
FOR I=A TO B?" "*C;I;
C=CSRX?NEXT

Explanation
?" "*C;I;    'Print C (initially 0) spaces followed by I, with no newline.
C=CSRX       'Set C to the horizontal cursor position.
?            'Print a newline.

This is only 43 bytes.

Huh, you're right. Not sure how I miscounted there.

PHP 7.1, 66 bytes
for([,$i,$z]=$argv;$i<=$z;)printf("%".($e+=strlen($i))."d
",$i++);

Run with -nr or try them online.

SNOBOL4 (CSNOBOL4), 85 bytes
	M =INPUT
	N =INPUT
O	OUTPUT =S M
	S =S DUPL(' ',SIZE(M))
	M =LT(M,N) M + 1 :S(O)
END

Try it online!

Python 3, 85 bytes
f=lambda a,b,n,z:'\n'+' '*(a+n-z)+str(a)+f(a+1,b,n+len(str(a))-1,z) if a!=b+1 else ''

Try it online!

K3, 29 bytes
{`0:{(1_0+\#:'$:'x)$'x}x+!y-x}

example:
  {`0:{(1_0+\#:'$:'x)$'x}x+!y-x}[1;15]
1
 2
  3
   4
    5
     6
      7
       8
        9
         10
           11
             12
               13
                 14

JavaScript (ES6) + CSS, 72 + 12 = 84 bytes
a=>b=>{for(i=0;a<=b;)document.write(`<x>${"<br>".repeat(i++)+a++}</x>`)}

x{float:left

Takes input in currying syntax with the smaller number first. Outputs the result to the page in HTML.
Test Snippet

let f=

a=>b=>{for(i=0;a<=b;)document.write(`<x>${"<br>".repeat(i++)+a++}</x>`)}

f(0)(8)
f(5)(14)
f(998)(1003)
x{float:left

><>, 56+3 = 59 bytes
1</+1$,a\.0e:/o" "\
:1>$:a)?/~}r+\1-:?/~r:n&:&:&=?;&1+ao

Try It Online
+3 bytes for -v. Not sure whether I actually need to add this for a function, but better to err on the side of caution
How It Works
1<................\     Initialises the stack with the space counter on top of the inputted numbers
................../~...

...................                  Print the first number
....................r:n&:&:&=?;&1+ao If the first number is equal to the end, exit program. Otherwise increment the first number and print a newline

../+1$,a\... Count the number of digits in the number
:1>$:a)?/... By incrementing a counter and dividing the number by 10 until it's below 10

........\.0e:/... Add the amount of digits to the counter
.......?/~}r+\...

............./o" "\     Print the counter amount of spaces and loop around again
.............\1-:?/~...

Excel VBA, 41 Bytes
Anonymous VBE immediate window function that takes input from range A1:B1 and outputs to the VBE immediate window
For i=[A1]To[B1]:?spc(j)i:j=j+len(i):Next

Sinclair ZX81/Timex TS1000/1500 BASIC ~73 tokenized BASIC bytes
 1 LET X=SGN PI
 2 LET Y=CODE "="
 3 LET A=NOT PI
 4 FOR I=X TO Y
 5 PRINT TAB A;I
 6 LET A=A+LEN STR$ I
 7 NEXT I

This newer solution has fewer bytes but slightly slower. SGN PI is 1, CODE "=" is 20 and NOT PI is 0; the PRINT TAB command does what you might expect, except a TAB in ZX81 land is 1 space; A is increased by the length of the I variable once converted to a string.
Old answer (~98 tokenized bytes)
 1 LET X=1
 2 LET Y=20
 3 LET A$=""
 4 FOR I=X TO Y
 5 PRINT A$;I
 6 FOR T=1 TO LEN STR$ I
 7 LET A$=A$+" "
 8 NEXT T
 9 NEXT I

I'm using the most expensive methods here in terms of bytes (i.e., SGN PI is 1, and counts as two bytes in ZX81 land, whereas 1 counts as four bytes), so I could cut the byte count by increasing the typing and making the listing less readable, and slower.
The 'spacing' works by converting the I number to a string and taking the string literal length, using that in a FOR/NEXT loop as the destination [line 6]. X is the start number, and Y is the end number.
There are a few limitations to consider, such as only having a 32 columns display by default, and only allowing 22 rows without some POKEing. Also, the screen doesn't scroll when it is full unless you tell it to, with the command SCROLL.

Python 3.8 (pre-release), 61 bytes
def f(a,b,n=-1):
 for a in range(a,b+1):print(" "*(n:=n+1),a)

Try it online!


text:
Count the word from matrix
BackStory
Given a square matrix of alphabets which contain English letters in arbitrary manner. While searching a word in it, you can go left to right horizontally, vertically downwards or diagonally towards left (both upwards and downwards).
You have to find the number of matches of a given word in the matrix.
For example, In the given square matrix {A#A#K,A#S#K,A#K#K},
The word "ASK"  is matched four times in the input matrix. So the output will be 4.
Input Format
You will be given two-dimensional string array and a string(Word to be searched) as arguments.
Output Format
You need to return the Number of occurrences of the word in the matrix {an integer}.
Sample Test Case1
Sample Input
2
2
A S
S T

AS

Sample Output
2
Sample Test Case 2
Sample Input
5
5
E D E E E
D I S K E
E S E E E
E C E E E
E E E E E

DISK

Sample Output
1
Explanation:
In this example, "DISK"  is matched only one time in the input matrix. So the output will be 1.
Winning
Shortest code in bytes wins.

Closely related, but not quite a duplicate.

You will be given a function which contains -> what does that mean? Would getting input in a different format be acceptable?

Yep... @Arnauld

The input format is specified clearly.@StepHen

If KSID is in the matrix, does it count as an occurrence of DISK?

No .@EriktheOutgolfer...........

This appears to be copied from elsewhere, without attribution. I'll put this on hold until you add one.