text:
Directory calculation
For this challenge, you will be given an absolute path, and a "new" path (which can be absolute or relative), and you need to return the final path.
For example, if your current directory was /var/tmp/test:
my_dir or my_dir/  should return /var/tmp/test/my_dir
../../my_dir should return /var/my_dir
/my_dir/./ should return /my_dir
../../../../../ should return /
To be more pedantic:

A directory is a non-empty string consisting of alphanumeric characters and the symbols -,_, or .
A path is a list of 0 or more directories, separated using /.  An absolute path starts with a /, a relative path does not.  Paths can include an ending /.

You need to "resolve" the second path, given the first path.
The process of resolving is:

Test if the second path is relative.  If so, then insert the absolute path's directories to the beginning of the second path.
If any of the directories is .., then remove it and the preceding directory.  If it is the first directory, then simply remove it.
If any of the directories is ., then remove it.
Output the final absolute path.  You should not output an ending /.

You do not need to handle incorrect input.  The commands should work, whether or not the directories passed actually exist on your machine.  You can assume that everything is a directory, even if it has an extension.
Test cases
Absolute      New          Output
"/a/b/c"      "d"       -> "/a/b/c/d"
"/a/b/c/"     "d"       -> "/a/b/c/d"
"/a/b/c/"     "d/"      -> "/a/b/c/d"
"/a/b/c"      "/d"      -> "/d"
"/a/b/c"      "/d/"     -> "/d"
"/../a/b/c/"  "d"       -> "/a/b/c/d"
"/a/../b/c/"  "d"       -> "/b/c/d"
"/a/b/../c"   "d"       -> "/a/c/d"
"/a/b/c/.."   "d"       -> "/a/b/d"
"/a/b/c/"     ".."      -> "/a/b"
"/a/b/c"      "../d"    -> "/a/b/d"
"/a/b/c"      "/../d"   -> "/d"
"/a/b/c"      ""        -> "/a/b/c"
"/a/b/c"      "."       -> "/a/b/c"
"/a/b/c"      "./d"     -> "/a/b/c/d"
"/a/b/c"      "/./d"    -> "/d"
"/a/b/c"      "d.txt"   -> "/a/b/c/d.txt"
"/a/b/c"      "d."      -> "/a/b/c/d."
"/a/b/c"      ".txt"    -> "/a/b/c/.txt"
"/a/b/c"      ".txt/d"  -> "/a/b/c/.txt/d"
"/a/b/."      "./././." -> "/a/b"
"/direc"      "tory"    -> "/direc/tory"
"/a-_.b/"     "__._-."  -> "/a-_.b/__._-."
"/a/b"        "../.."   -> "/"
"/a/b"        "../../.."-> "/"
"/a"          "../../.."-> "/"
"/"           ""        -> "/"
"/"           "a"       -> "/a"
"/.."         "a"       -> "/a"
"/."          ""        -> "/"

This is a code-golf, so make your submissions as short as possible in your favorite language!

Some answers appear to assume that files (or symlinks) with the same name as any part of the directory tree) do not exist on the machine. Is that allowed?

Can we take the two inputs in any order we wish?

Stupid question... can I have side effects? Specifically, side effects like, um, mkdir $patha; cd $patha; mkdir $pathb; cd $pathb; echo \abspath`` (or something)?

@dennis. The output of the programs should be independent of the file system

@downgoat that's fine

@cat side effects are fine.

Retina, 44 bytes
+`.+ /| |/\.?/
/
+1`/?[^/]*/\.\.|/\.?$

^$
/

Input is expected to be the two paths separated by a single space.
Try it online! (The first line enables a linefeed-separated test suite.)

Batch, 282 281 279 276 bytes
@echo off
set a=\
set r=%~2
if "%r%"=="" set r=%~1
if not %r:~,1%==/ set r=%~1/%~2
for %%a in (%r:/= %)do call:x %%a
if not %a%==\ set a=%a:~,-1%
echo %a:\=/%
exit/b
:x
if %1==. exit/b
if not %1==.. set a=%a%%1\&exit/b
if not %a%==\ for %%a in (%a:~,-1%)do set a=%%~pa

Annoyingly Batch expressions don't generally like empty variables. Edit: Saved 1 byte thanks to @CᴏɴᴏʀO'Bʀɪᴇɴ and 2 bytes thanks to @EʀɪᴋᴛʜᴇGᴏʟғᴇʀ (and a bunch of bytes on other answers too, although alas uncredited).

I think you can remove a space between call and :x`, no?

@CᴏɴᴏʀO'Bʀɪᴇɴ Huh, so you can. I've got a bunch of answers that need updating in that case...

Python, 53 bytes
from os.path import*;p=lambda a,n:normpath(join(a,n))

Python 2, 265 260 254 bytes
y=lambda:[x for x in raw_input().split("/")if x!=""and x!="."]
a=y();n=y();m=len(a)-1
while m>0:
 if a[m]==".."and m>0:del a[m];del a[m-1];m-=1
 elif a[m]=="..":del a[m]
 m-=1
for i in n:
 if i==".."and len(a)>0:del a[-1]
 else:a+=i,
print"/"+"/".join(a)

Javascript, 210 bytes
function p(a,b){d='.';e=d+d;s='/';t='split';u='splice';r=(b[0]===s?[]:a[t](s)).concat(b[t](s));for(i=0;i<r.length;r[i]===e&&r[u](i?i-1:i,i?2:1)?(i&&i--):i++)(!r[i]||r[i]===d)&&r[u](i,1)&&i--;return s+r.join(s)}

Here is test suite
With linebreaks instead of semicolons:
function p(a,b) {
    d='.'
    e=d+d
    s='/'
    t='split'
    u='splice'

    r=(b[0]===s?[]:a[t](s)).concat(b[t](s))

    for(i=0;i<r.length;r[i]===e&&r[u](i?i-1:i,i?2:1)?(i&&i--):i++)
        (!r[i]||r[i]===d)&&r[u](i,1)&&i--

    return s+r.join(s)
}

C#, 43 bytes
(x,y)=>Path.GetFullPath(Path.Combine(x,y));

Saved 1 byte thanks to @aloisdg
Path.Combine puts the arguments together, and Path.GetFullPath resolves the ..\s

Hello, and welcome to PPCG! This is not a valid program -- either include main and a class, or change it to a lanbda: a,b->...

I was going to post it :) Nice first submission! you can remove the space after the ,: (x, y) => (x,y)

Also the C# Tips for golfing thread may interest you.

Bash, 41 bytes
This bash script has the side effect of creating directories if they don't exist, but it should meet the requirements.  Thanks Karl and Neil for your improvements.
mkdir -p $1;cd $1;mkdir -p $2;cd "$2";pwd

Usage: bash getpath.sh "absolute" "new"
If you don't like the stderr when second argument is an empty string, you can test for it as follows (48 bytes):
mkdir -p $1;cd $1;[ $2 ]&&mkdir -p $2&&cd $2;pwd

Previous 30 byte attempt (requires directories to exist):
cd $1;[ $2 ]&&cd $2;echo pwd

The question says The commands should work, whether or not the directories passed actually exist on your machine.

Ah, I see. Too bad.

Hello, and welcome to PPCG! Normally, if your answer doesn't work, you delete it. You can click the delete link above this comment.

You could mkdir -p to make sure they exist.

Thanks, I'm trying a version with mkdir.  I'll delete this answer and add a new one if I figure it out.

Thanks Karl, it works now if run with the necessary permissions.

Why not use pwd instead of echo \pwd``?

As stderr is ignored by default, you can use mkdir -p $2;cd "$2". (cd $2 wouldn't work of course.)

Thanks Neil, those are some good improvements.  I'll update my answer.

@Bryn I don't think you're supposed to add a new answer as a replacement of this one. This one must be replaced if it doesn't work. (FYI I know it's edited now)

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Sorry, should I make a new answer now?  I thought it would be useful to have the comment history so I edited my old answer.  By the way, are there posting guidelines/FAQ somewhere that I am missing?

@Bryn Editing and undeleting the existing answer is the preferred way. (I think that's what Erik meant, but I'm not sure.) Posts are never hard-deleted, so they clutter the thread forever. The help center has some guidelines.

@Dennis Thanks for the clarification.  Undeleting makes sense.

@Bryn That's what I said. Sorry for bad wording, I meant (I don't think you're supposed to add a new answer for the same language as this one, if this one is deleted. Instead, edit this one.)

Python, 142 137 bytes
def p(a,n,r=[],S="/"):
 for s in[s for s in((n[:1]!=S)*a+S+n).split(S)if"."!=s and s]:e=s!="..";r=[s]*e+r[1-e:]
 return S+S.join(r[::-1])

Node REPL, 8 12 bytes
path.resolve

Luckily you don't have to require() standard modules in the REPL.
Test Suite
https://repl.it/Cclo/1
(If the output at the end is true, it matched)

GNU sed, 81 59 + 1 = 60 bytes
+1 byte for -r flag. Expects input on STDIN separates by a single space.
s:.+ /::
s:/? :/:
:
s:/$|[^/]+/+\.\.|\.(/|$):\1:
t
s:^/*:/:

Try it online!
Explanation
s:.+ /::  # If the second argument starts with a slash, drop the first argument
s:/? :/:  # Join the first and second arguments with a slash, dropping duplicate slashes
:
  s:/$|[^/]+/+\.\.|\.(/|$):\1:  # Drop trailing slashes, resolve double and single dots
  t                             # If the above substitution was made, branch to :
s:^/*:/:  # Ensure output begins with a single slash

Ruby, 16 bytes
Since apparently using a method from the standard library is allowed:
File.expand_path

See the test suite on repl.it.

Input via variables isn't allowed, but function submission, are, which means that you should shorten it to File.expand_path :)

I'd also recommend actually testing it against the test suite to make sure that it works correctly on all of the test cases.

@NathanMerrill I did, but I'll go ahead and stick something up on repl.it.

Edited to include test suite link.

Java 7, 83 bytes
String p(String a,String b){return Paths.get(a).resolve(b).normalize().toString();}

normalize is needed to deal with relative references. add is used to handle the second path starting with /, which Paths.get(a, b) won't handle as specified.

Hello, and welcome to PPCG! This is a good first post!

Bash, 38 bytes
[[ $2 = /* ]]||p=$1
realpath -sm $p/$2

Doesn't require root privileges and makes no assumptions about existing or non-existing files, directories or symbolic links.
Test it on Ideone.
How it works
[[ $2 = /* ]] tests if the second command-line argument begins with /.
If it doesn't, the path is relative and p=$1 sets variable p to the first command-line argument.
This way $p/$2 is /$2 if $2 is an absolute path and $1/$2 if it is a realtive one.
Finally, realpath -sm $p/$2 prints the canonical absolute path of $p/$2. The -s switch makes realpath ignore symbolic links, and the -m switch missing components.

Zsh, 15 bytes
a=$1/$2
<<<$a:a

The :a modifier does exactly this.
Try it online!


text:
I programming puzzles, il code golf
Background
The Italian definite article (corresponding to English the) has seven different forms: l', il, lo, gli, i, la, le. Which one to use depends on three variables:

Gender: masculine / feminine.
Number: singular / plural.
Initial letter of the subsequent word: vowel / consonant type A / consonant type B.

Vowel is any of these: aeiou.
Consonant type B is any of these cases: s- followed by another consonant, z-, gn-, pn-, ps-, x-, i- followed by vowel (this i acts as a semivowel).
Consonant type A is a consonant that is not type B.

The table shows the article form to be used in each of the twelve combinations of the three above variables. Note that the l' form is attached to the following word with a single quote and without a space.

The challenge
Input a word and one or two strings, numbers or Booleans indicating gender and number. (The initial letters will have to be obtained from the input word).
The input word will be a sequence of lowercase ASCII letters. Accented vowels will be replaced by their non-accented versions (for example, realtà will be input as realta).
The gender and number inputs can be separate numbers, Booleans or strings, or a combined number of string (for example, 1 for masculine singular, 2 for feminine singular, etc).
Any reasonable format and separator can be used, as long as it is specified in the answer.
Output the word preceded by the appropriate form of the article, with space or single quote as needed. The output should also be lowercase. Trailing or leading blank space is allowed.
Code golf, shortest wins.
Test cases
In the following I use the input letters m, f to specify gender, and s, p for number (this is just one possible input format).
Input               Output              Comment

macchina f s        la macchina         Initial letter is cons. A
zio m s             lo zio              Initial letter is cons. B
libri m p           i libri             Initial letter is cons. A
ieri m s            lo ieri             Initial letter is cons. B
aquile f p          le aquile           Initial letter is vowel
spagnoli m p        gli spagnoli        Initial letter is cons. B
golf m s            il golf             Initial letter is cons. A
ombra f s           l'ombra             Initial letter is vowel
impossibili m p     gli impossibili     Initial letter is vowel

You may want to also make a challenge on the coniugation of regular verbs.

@user6245072 Well, there's already this... the difference would probably be too small

A minor technical niggle: /j/ is normally called a semivowel in English, not a semiconsonant. I wonder what the solutions would be if they were to factor in edge cases like ⟨ch⟩ representing [ʃ] rather than [k] (lo chef, lo chardonnay), the variation with French names (l’Havet but lo Hugo), fossilised forms (gli dei, per lo meno), women referred to by their last name (l’Antonia but la Antonini), etc. That would be quite the formidable thing to golf-code.

@JanusBahsJacquet Oh, I thought it was called semiconsonant also in English (as in Spanish) when it appears in the beginning of a syllable. I've corrected it. I had no idea about gli dei or per lo meno. Thanks for the information!

As Italian I ask you to take off ieri test case because is an adverb and not a noun! (BTW it was formally correct) Please!

@GiacomoGarabello I know it's an adverb, but it's also used as a noun, isn't it?, as it is in English and in Spanish. Anyway, if you think it's too streched, can you suggest a noun that starts with semiconsonant "i-"?

In 21 years of life in Italy I never seen Ieri used as a noun, but i know it's formally correct! In only sounds awful in my head... And then, It's a Code-Golf! If we don't need a clean code, we also don't need a clean language, if it works!

@GiacomoGarabello So can't you say something like "Non pensare allo ieri, pensa allo domani" (non-native here)

We usally say: "Non pensare a ieri, Pensa a Domani"

@GiacomoGarabello Anyway, isn't ieri and domani nouns there? :-)

@GiacomoGarabello Thanks for the idea anyway. I think I'll leave "ieri" because quite a few answers are using it as a test case

Good Check! But in special cases like this one we don't use the Articles! We use the preposition. Before I've mispelled... I never seen Ieri used as a noun had to be I never seen Ieri used as a noun with a defined Article (My awful English didn't help me explaining italian grammar :-P ) I cant think about a phrase with lo Ieri in the Italian common language :-D

@GiacomoGarabello Got it. Thanks for the tip! E spero che possiamo parlare (scrivere) in italiano alcuna volta se visiterai lo chat :-)

Of course you can keep it, It's Correct! My only word about that it's  uncommon and we don't use it that much (and it's sound is awful)! P.S.:  Se vuoi Imparare l'italiano spero di poterti essere di aiuto!

Retina, 138 133 129 113 bytes
^.(s[^aeiou]|z|gn|pn|ps|x|i[aeiou])
B$&
^.[aeiou]
V$&
^\d.
A$&
V[02]
l'
A0
il
B0
lo
A1
i
.1
gli
.2
la
.3
le

Test suite.
(prepended %(G`\n to run all test-cases at once)
Input format: macchina f s becomes 2macchina instead.
0: Masculine Singular
1: Masculine Plural
2: Feminine Singular
3: Feminine Plural

Conversion table thanks to Kevin Lau.

Python 3.5, 238 235 192 181 178 bytes:
(-13 bytes thanks to tips from Leaky Nun!)
import re;R=re.match;lambda a,b:(R('s[^aeiou]|(z|gn|pn|ps|x|i)[aeiou]',a)and['lo ','gli ','la '][b]or R('[aeiou]',a)and["l'",'gli '][b%2]or['il ','i ','la '][b]if b<3else'le ')+a

An anonymous lambda function that takes arguments in the form of (<String>, <Integer Gender-Plurality mapping>), where the mapping is as follows:
0 -> Masculine Singular
1 -> Masculine Plural
2 -> Feminine Singular
3 -> Feminine Plural

To call it, simply give the function any valid name, and then call it like a normal function wrapped inside a print statement. Therefore, if the question were to be named U, simply call it like print(U(<String>, <Integer Gender-Plurality mapping>)).
Try It Online! (Ideone)

zzz and yyy or xxx is two bytes shorter than [xxx,yyy][bool(zzz)]

@LeakyNun I can do that? Wow, I did not even know. Thanks! :)

It works as long as yyy is truthy.

@LeakyNun Yeah, of course.

["l'",'gli '][b%2] is 3 bytes shorter than ["l'",'gli ',"l'"][b]

@LeakyNun Wow, genius! I did not think of that! Thanks again! :)

I believe you can use and or to replace if else.

@LeakyNun Yeah, that is just what I was about to do.

@LeakyNun Actually, that is 2 bytes longer since I have use more parenthesis in that case.

Java, 227 208 195 bytes
-13 bytes thanks to Leaky Nun
String f(String a,int o){boolean v=a.matches("^([aeou]|i[^aeiou]).*"),b=a.matches("^([ixz]|gn|pn|ps|s[^aeiou]).*");return(o>1?o>2?"le ":v?"l'":"la ":o>0?v||b?"gli ":"i ":v?"l'":b?"lo ":"il ")+a;}

Takes your string and an int based on the following mapping:
0: Masculine Singular
1: Masculine Plural
2: Feminine Singular
3: Feminine Plural

Returns a string with the result.
Ungolfed with test cases and with no ternary operators (for real now):
class Test {

    public static String f(String a, int o) {
        boolean v = a.matches("^([aeou]|i[^aeiou]).*");
        boolean b = a.matches("^([ixz]|gn|pn|ps|s[^aeiou]).*");
        String r;
        if(o > 1)
            if(o > 2)
                r = "le ";
            else
                if(v)
                    r = "l'";
                else
                    r = "la ";
        else
            if(o > 0)
                if(v || b)
                    r = "gli ";
                else
                    r = "i ";
            else
                if(v)
                    r = "l'";
                else if(b)
                    r = "lo ";
                else
                    r = "il ";
        return r + a;
    }

    public static void main(String[] args) {
        System.out.println(f("macchina", 2));
        System.out.println(f("zio", 0));
        System.out.println(f("libri", 1));
        System.out.println(f("ieri", 0));
        System.out.println(f("aquile", 3));
        System.out.println(f("spagnoli", 1));
        System.out.println(f("golf", 0));
        System.out.println(f("ombra", 2));
        System.out.println(f("impossibili", 1));
    }
}

Uses a little bit of regex magic and acts depending on the two booleans specified. To my surprise, no imports are needed, which helps out with the code size!

Mine is...longer than JAVA?! I must golf mine down a bit more asap! Good job though! +1

If I had to take my arguments from the command line or stdin, believe me, it would have been a lot longer :P

Yes, Booleans accepted too. I've edited that in

I think you can use 0/1 instead of false/true which should save you some bytes.

Not using String e = "[^aeiou]).*"; actually saves you 5 bytes.

Your ungolfed code still has 3 ternary operators.

Ruby, 147 146 bytes
Try it online?
It might be possible to use a better method to determine which article to use, but I'm not aware of any.
As per the spec, the identifier is a number, as follows:
0: Masculine Singular
1: Masculine Plural
2: Feminine Singular
3: Feminine Plural

->w,i{(%w"lo gli la le l' gli l' le il i la le"[(0..2).find{|r|[/^(i[aeiou]|s[^aeiou]|z|x|[gp]n|ps)/,/^[aeiou]/,//][r]=~w}*4+i]+' '+w).sub"' ",?'}

Batch, 446 390 385 380 bytes
@echo off
set w=%2
call:l %1 l' gli_ l' le_ il_ i_ la_ le_ lo_ gli_ le_ le_
exit/b
:l
for /l %%a in (0,1,%1)do shift
set o=%5
for %%a in (gn pn ps)do if %%a==%w:~,2% set o=%9
for %%a in (s z x)do if %%a==%w:~,1% set o=%9
for %%a in (a e i o u)do if %%a==%w:~,1% set o=%1
for %%a in (a e i o u)do if i%%a==%w:~,2% (set o=%9)else if s%%a==%w:~,2% set o=%1
echo %o:_= %%w%

New version uses the same 0-3 encoding for the gender and number as several other answers. Works by creating a 1-dimensional array %2 .. %13 of forms, then shifting out the first 1+%1 elements so that the forms of interest become %1, %5 and %9 (which is fortunate as Batch won't go above %9 without shifting). It then laboriously checks the lists of prefixes to find out which form needs to be used. _ is used as a placeholder to represent a space until the word is output.

Might as well have them encoded into a single digit (or letter if needed, since the spec allows it) to save bytes. Everything is for the sake of the bytes!

@KevinLau-notKenny Switching to digit encoding allowed me to save a whopping 56 bytes by rewriting the gender and number handling!

Python 3, 235 bytes
I was interested to see how short I could get this in Python without regexes. It turns out that this is not the best option...
lambda s,c,v='aeiou':[["l'",'il','lo'],['gli','i','gli'],["l'",'la','la'],['le']*3][c][[[1,2][s[0]=='s'and s[1]not in v or s[0]in'zx'or s[:2]in['gn','pn','ps']or s[0]=='i'and s[1]in v],0][s[0]in v and not(s[0]=='i'and s[1]in v)]]+' '+s

An anonymous function that takes input via argument of the word s and the gender-number code c as an integer, using the following mapping:
0 - Masculine Singular
1 - Masculine Plural
2 - Feminine Singular
3 - Feminine Plural

and returns the word with the correct article.
How it works
A list containing the possibilities for each c as separate lists is created. The list is then indexed into using the value of c, yielding a 3-element list with the relevant options. A list index is now chosen by indexing into another nested list with the results of Boolean expressions. If the first character of s is a vowel and is not i followed by a vowel, the option for vowel is yielded via the returning of the index 0. Else, a Boolean expression returning True for cons. B and False for cons. A is evaluated, yielding the indices 2 and 1 respectively. Finally, the index is used to yield the article, which is concatenated with a space and the original string before being returned.
Try it on Ideone

JavaScript 210 bytes
(s,p)=>{var c=i=>!("aeiou".indexOf(s[i])+1),r=["z","gn","pn","ps","x"].some(t=>!s.indexOf(t))||(c(1)?s[0]=="s":s[0]=="i")?2:c(0)?1:0;return (p&1?(p&2?"le ":r&1?"i ":"gli "):!r?"l'":p&2?"la ":r&1?"il ":"lo ")+s}

An anonymous function taking two parameters s and p where
s  is the input string
p  is plurality (bit 0, set=plural) and gender (bit 1, set=f) combined as
    0 = masculine singular
    1 = masculine plural
    2 = feminine singular
    3 = feminine plural

After assigning the function to a variable and some unpacking), it can be tested as
var f=(s,p)=>{
    var c = i=>!("aeiou".indexOf(s[i])+1),
        r = ["z","gn","pn","ps","x"].some(t=>!s.indexOf(t))
             || ( c(1)? s[0]=="s":s[0]=="i" )
             ?   2 : c(0) ? 1 : 0;

     return (p&1?(p&2?"le ":r&1?"i ":"gli "):!r?"l'":p&2?"la ":r&1?"il ":"lo ")+s;
}

console.log("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
 f("macchina",2),
 f("zio",0),
 f("libri",1),
 f("ieri", 0),
 f("aquile",3),
 f("spagnoli",1),
 f("golf",0),
 f("ombra",2),
 f("impossibili",1))

where

c is a function to test s for a consonant at position i.
r evaluates to 0 for starting with a vowel, 1 for starting with a type A consonant and 2 for starting with a type B consonant (tested in reverse order).
Bit bashing in the return statement puts it together.

source: Stack Exchange

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

sort: votes


text:
Remove duplicated & switched case
Goal
The goal of this challenge is: given a string as input, remove duplicate pairs of letters, if the second item in the pair is of opposite capitalization. (i.e. uppercase becomes lowercase and vice-versa).
Pairs should be replaced from left to right. For example, aAa should become aa and not aA.

Inputs & outputs:
Input:         Output:
bBaAdD         bad
NniIcCeE       Nice
Tt eE Ss tT    T e S t
sS Ee tT       s E t
1!1!1sStT!     1!1!1st!
nN00bB         n00b
(eE.gG.)       (e.g.)
Hh3lL|@!       H3l|@!
Aaa            Aa
aaaaa          aaaaa
aaAaa          aaaa

The input consists of printable ASCII symbols.
You shouldn't remove duplicated digits or other non-letter characters.
Acknowledgement
This challenge is the opposite of @nicael 's "Duplicate & switch case". Can you reverse it?
Thank you for all contributors from the sandbox!
Catalogue
The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Haha, that's NniIcCeE :)

@nicael I am glad you approve :)

what's the output for: abB? abB or ab?

@Downgoat abB should output ab

I don't understand why aaaAAA becomes aaaAA and not aaA.

@raznagul why would it? Split it up: aa;aA;AA, only the middle pair matches the pattern and becomes a, so aa;a;AA

Jelly, 8 bytes
ṛŒsḟḟȧµ\

Try it online! or verify all test cases.
How it works
ṛŒsḟḟȧµ\  Main link. Argument: s (string)

      µ   Convert all links to the left into a chain (unknown arity) and begin a
          new chain.
       \  Do a cumulative reduce by the chain to the left.
          Left argument:   r (previous result or first character)
          Right argument:  c (next character)
ṛ           Set the return value to c.
 Œs         Swap c's case.
    ḟ       Remove c from r (if present).
            This yields an empty string if c and r are identical (repeated letter
            with the same case or non-letter) and r otherwise.
            Note that r will be empty if the previous character has been removed.
   ḟ        Remove the resulting characters (if any) from c with swapped case.
            This yields c with swapped case if the result to the right does not
            contain c; otherwise, it yields the empty string.
     ȧ      Flat logical AND with c.
            Replace swapped case c with c; do not modify an empty string.

Shorter than the Regex damn!

Beat Retina on a [tag:string] challenge ._.

Retina, 18 bytes
(.)(?!\1)(?i)\1
$1

Try it online!
Explanation
This a single (and fairly simple) substitution which matches the relevant pairs and replaces them with only the first character. The pairs are matched by activating case-insensitivity halfway through the pattern:
(.)     # Match a character and capture it into group 1.
(?!\1)  # Use a negative lookahead to ensure that the next character *isn't* the same
        # as the character we just captured. This doesn't advance the position of the
        # regex engine's "cursor".
(?i)    # Now activate case-insensitivity for the remainder of the pattern.
\1      # Match the second character with a backreference to the first. With the i
        # modifier activated, this will match if the two characters only differ
        # by case.

The substitution simply writes back the character we already captured in group 1 anyway.

Nice answer! Debuggex works great with this one!

C#, 87 75 bytes
s=>System.Text.RegularExpressions.Regex.Replace(s,@"(.)(?!\1)(?i)\1","$1");

With the mighty regex from Martin Ender. C# lambda where the input and the output are string.
12 bytes saved by Martin Ender and TùxCräftîñg.

C#, 141 134 bytes
s=>{var r="";for(int i=0,l=s.Length;i<l;i++){var c=s[i];r+=c;if(char.IsLetter(c)&i+1<l&&(c|32)==(s[i+1]|32)&c!=s[i+1])i++;}return r;};

C# lambda where the input and the output are string. The algorithm is naive. This is the one I use as reference.
Code:
s=>{
    var r = "";
    for(int i = 0; i < s.Length; i++)
    {
        r+=s[i];
        if (char.IsLetter(s[i]) & i+1 < s.Length)
            if (char.ToLower(s[i])==char.ToLower(s[i+1])
              & char.IsLower(s[i])!=char.IsLower(s[i+1]))
                i += 1;
    }
    return r;
};

7 bytes thanks to Martin Ender!

Try them online!

@TùxCräftîñg Indeed but it is easy to read like this. Check my golfed version for a less verbose answer :)

Brachylog, 44 bytes
.v|.l1|hA,?bhB(@uA;A@uB),?bb&~b.hA|?b&~b.h~h?

Brachylog has no regular expressions.
Explanation
    .v          Input = Output = ""
|               OR
    .l1         Input = Output = string of one character
|               OR
    hA,         A is the first char or the Input
    ?bhB        B is the second char of the Input
    (
        @uA         B uppercased is A
        ;           OR
        A@uB        A uppercased is B
    ),
    ?bb&        Call recursively on Input minus the first two elements
    ~b.hA       Output is the result of that call with A appended before it
|               OR
    b&          Call recursively on Input minus the first element
    ~b.h~h?     Output is the result of that call with the first element of Input appended
                  before it

Perl, 40 24+1=25 bytes
Use the same regex as Martin.
Use the -p flag
s/(.)(?!\1)(?i)\1/\1/g

Test it on ideone

If you use the -p flag, you can remove almost all your code except the s/// for a good saving!

Python 3, 64 59 58 bytes
r=input()
for c in r:r=c[c.swapcase()==r!=c:];print(end=r)

Test it on Ideone.

C, 66 bytes
l;main(c){for(;~(c=getchar());)l=l^c^32|!isalpha(c)?putchar(c):0;}

Suggest read(0,&c,1) instead of ~(c=getchar())

Pyth, 24 20 bytes
4 bytes thanks to @Jakube.
This still uses regex, but just for tokenizing.
shM:zj\|+s_BVGrG1\.1

Test suite.
shM:zj\|+s_BVGrG1\.1   input as z
         s_BVGrG1      generate ['aA', 'Aa', 'bB', 'Bb', ..., 'zZ', 'Zz']
        +        \.    add "." to the back of the array
     j\|               insert "|" between every element of the array,
                       forming a new long string, which will be our
                       tokenizer: "aA|Aa|bB|Bb|cC|Cc|...|yY|Yy|zZ|Zz|."
                       the "." at the end is to capture the remaining characters
  :z               1   return all matches of z against that regex
                       this is effectively a tokenizer
 hM                    take the first character of each token
s                      join all the transformed tokens together, and then
                       implicitly print to STDOUT.

24-byte version here.

MATL, 21 bytes
"Kk@k=K@XK=>?4XKx}K&h

Try it online!. Or verify all test cases.
Explanation
This processes each character in a loop. Each iteration compares the current character with the previous character. The latter is stored in clipboard K, which is initiallized to 4 by default.
The current character is compared with the previous one twice: first case-insensitively and then case sensitively. The current character should be deleted if and only if the first comparison was true and the second was false. Note that, since clipboard K initially contains 4, the first character will always be kept.
If the current character is deleted clipboard K should be reset (so the next character will be kept); otherwise it should be updated with the current character.
"            % Take input string implicitly. For each char from this string:
  K          %   Push previous char, initiallized to number 4
  k          %   Convert to lower case. For numbers it rounds down
  @          %   Push current char
  k          %   Convert to lower case.
  =          %   True if current and previous chars are (case-insensitively) equal
  K          %   Push previous char
  @          %   Push current char
  XK         %   Update clipboard K with current char. This doesn't affect the stack
  =          %   True if current and previous chars are (case-sensitively) equal
  >?         %   If first comparison was true and second was false
    4XKx     %     Reset clipboard K to 4
  }          %   Else
    K        %     Push previous char
    &h       %     Concatenate horizontally to gradually build the output string

C, 129 127 125 107 106 105 93 92 90 88 85 78 73 bytes
c;d;f(char*s){for(;c=*s;s+=isalpha(putchar(c))*d*!((d^=c)&95)&&d)d=*++s;}

A C port of my C# answer. My C may be a bit bad. I don't use the language a lot anymore. Any help is welcome!

1 byte saved thanks to Lowjacker's trick: a!=b = a^b
1 byte saved thanks to Walpen's trick: a&&b = a*b
12 bytes saved by Lynn's trick and inspired here by TùxCräftîñg
1 byte saved thanks to Joey Adams's trick and inspired here by orlp: Moving variable to global
2 bytes saved by SEJPM by resolving my (c|32)==(d|32) bitwise problem
5 bytes saved by Pietu1998
5 bytes saved by ceilingcat

Code:
c;d;f(char*s) {
    for(;putchar(c=*s);)
        s+=isalpha(c)*(d=*++s)&&(!((c^d)&95)&&c^d);
}

Try it online!

I think you can increment the pointer to save some bytes. I have found this (untested): f(char*s){while(*s) {char c=*s,d=s+1;putchar(c);s+=isalpha(c)&&d&&((c|32)==(d|32)&&c!=d);}}

@TùxCräftîñg I forgot about this one. I corrected your proposition based on Lynn answer. Thank you for the help!

I think you can change s+++1 to ++s.

@Pietu1998 Indeed I can!

c and d will always be printable ASCII, so 95 should work in place of ~32. Also, I think c;d;f(char*s){for(;*s;){putchar(c=*s);s+=isalpha(c)*(d=*(++s))&&(!((c^d)&95)&&c^d);}} would work (but untested).

@Pietu1998 Neat!

@ceilingcat beautiful!

JavaScript (ES6), 71 68 bytes
s=>s.replace(/./g,c=>l=c!=l&&c>'0'&&parseInt(c+l,36)%37<1?'':c,l='')

Explanation:
s=>s.replace(/./g,c=>   Loop over each character in the string
 l=                     Save result for next loop
  c!=l&&                Check whether characters differ
  c>'@'&&               Check minimum character code
  parseInt(c+l,36)%37<1 Check if characters have same value
  ?'':c,                If so then delete this character
 l='')                  Initial empty previous character

Given c>'@', the only way for parseInt(c+l,36) to be a multiple of 37 is for both c and l to have the same value (they can't have zero value because we excluded space and zero, and if they have no value then the expression will evaluate to NaN<1 which is false) is for them to be the same letter. However, we know that they're not the same letter case-sensitively, so they must be the same case-insensitively.
Note that this algorithm only works if I check every character; if I try to simplify it by matching on letters it will then fail on things like "a+A".
Edit: Saved 3 bytes thanks to @edc65.

Use replace instead of map. 68. But I'm too lazy to figure out how to put '`' inside a comment (nice trick mod 37)

@edc65 I don't need any \``s if I use replace`. (I only had them before to try to be consistent, but then I golfed my answer while editing it for submission and became inconsistent again. Sigh...)

Java 7, 66 bytes
String c(String i){return i.replaceAll("(.)(?!\\1)(?i)\\1","$1");}

Used Martin Ender's regex from his Retina answer.
Ungolfed & test code:
Try it here.
class Main{
  static String c(String i){
    return i.replaceAll("(.)(?!\\1)(?i)\\1", "$1");
  }

  public static void main(String[] a){
    System.out.println(c("bBaAdD"));
    System.out.println(c("NniIcCeE"));
    System.out.println(c("Tt eE Ss tT"));
    System.out.println(c("sS Ee tT"));
    System.out.println(c("1!1!1sStT!"));
    System.out.println(c("nN00bB"));
    System.out.println(c("(eE.gG.)"));
    System.out.println(c("Hh3lL|@!"));
    System.out.println(c("Aaa"));
    System.out.println(c("aaaaa"));
    System.out.println(c("aaAaa"));
  }
}

Output:
bad
Nice
T e S t
s E t
1!1!1st!
n00b
(e.g.)
H3l|@!
Aa
aaaaa
aaaa

JavaScript (ES6), 61 bytes, 57 Bytes
s=>s.replace(/./g,c=>l=c!=l&/(.)\1/i.test(l+c)?'':c,l='')
Thanks to Neil for saving 5 bytes.

Bad news: you miscounted, and that's actually 62 bytes. Good news: I can save you five bytes! s=>s.replace(/./g,c=>l=c!=l&/(.)\1/i.test(l+c)?'':c,l='')

Oh, sorry, I counted using "code".length, didn't realise there was an escape sequence in there. Thanks

Try using (code).toString().length.

Yeah, or (code+"").length

JavaScript (ES6) 70
(s,p,q)=>s.replace(/./g,c=>p!=c&q===(d=parseInt(c,36))?q='':(q=d,p=c))

f=(s,p,q)=>s.replace(/./g,c=>p!=c&q===(d=parseInt(c,36))?q='':(q=d,p=c))

;
[['bBaAdD','bad']
,['NniIcCeE','Nice']
,['Tt eE Ss tT','T e S t']
,['sS Ee tT','s E t']
,['1!1!1sStT!','1!1!1st!']
,['nN00bB','n00b']
,['(eE.gG.)','(e.g.)']
,['Hh3lL|@!','H3l|@!']
,['Aaa','Aa']
,['aaaaa','aaaaa']
,['aaAaa','aaaa']]
.forEach(
  x=>
  {
    var i=x[0],k=x[1],r=f(i)
    console.log(k==r?'OK':'KO',i,r)
  }
)

OK, I'll bite. Why the ===?

0=="" but not 0==="" @Neil

Convex, 18 bytes
V±V.+'.+'|*\ô{0=}%

Try it online!
Similar approach as @Leaky Nun's Pyth answer. It constructs the array ["aA" "bB" ... "zZ" "Aa" "Bb" ... "Zz" '.], joins by the '| character, and tests the input based on that regex. Then it takes the first character of each match.

Haskell, 70 Bytes
import Data.Char
f (a:b:c)|g a/=g b=a:f c|0>1=a:b:f c
f a=a
g=isUpper

all_licenses: 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/


text:
Coercing a string to an integer in GolfScript
GolfScript automatically coerces values, according to the following ‘priority’ sequence:

integer → array → string → block

(listed from lowest to highest.)
This means that "1"7+ leaves the string "17" on the stack (and not 8), because strings have a higher priority than integers.
[To those GolfScript veterans – apologies for insulting your respective intelligences.]
How would it be possible to do this the other way? That is, to coerce a string into an integer?

name:~ args:1 functions:bitwise not, dump, eval

This gives 8.

@LeakyNun; Nice! Do you want to want to put this in an answer? I'd certainly accept it.

@closevoter Questions asking tips about golfing code are on-topic.

@downvoter; could you please leave a comment explaining why you have downvoted?

There's an operator ~ in golfscript, which does the following: bitwise not, dump, eval.
Therefore, "1" will give the string "1" while "1"~ will evaluate that string (into the integer 1).
Then, all you need to do is "1"~7+.
Try it online!

It's worth mentioning that this is an eval of golfscript code, meaning e.g. "1.0"~ does something unexpected.


text:
Write a program to display directory treehouse
Given a directory (such as C:/), given from stdin or read from a file, produce a directory tree, with each file/folder indented based on its depth.
Example
If I have a C:/ drive which only contains two folders foo and bar, and bar is empty while foo contains baz.txt, then running with input C:/ produces:
C:/
    bar/
    foo/
        baz.txt

while running with input C:/foo/ should produce
foo/
    baz.txt

As this is codegolf, lowest byte count wins. The file extensions (such as baz.txt) are optional.
Extra notes: hidden files can be ignored, directories must actually exist, it can be assumed that files do not contain unprintable characters or new lines but all other printable ASCII characters are fine (file names with spaces must be supported). Output can be written to file or stdout. The indentations can be made up of either a tab character or 4 spaces.

Extra note: this question is poorly formatted, so a reformatting would be appreciated.

Are languages that do not have access to files automatically disqualified?

What filenames have to be supported? Files with spaces in their names? With newlines? With unprintable characters? What about hidden files (beginning with .)?

@DrGreenEggsandIronMan I believe the answer to your question is yes.

Edits have been made.

Related.

@LeakyNun I'm aware of that question, but this is entirely different.

@Mathime What is the difference?

@LeakyNun Output of reference question is an array of arrays. This question requires a representation of the directory tree to be printed to stdout.

What characters specifically may the files contain? Only letters, numbers, and spaces? Or can there be a file called {{}{#)((*[']238..23[]]4.2]3["'''"?

directory entries sorted, unsorted or no preference?

@Doorknob any printable ascii characters

@Titus if you mean alphabetically sorted, no preference.

Must directories have trailing \? It is obvious that they are dirs because of the indentation.

@Adám they are preferred but not mandatory.

Must the first output line of C:/foo/ be foo/ or is C:/foo/ acceptable?

Can the input be a string parameter to a function?

bash, 61 58 54 bytes
find "$1" -exec ls -Fd {} \;|perl -pe's|.*?/(?!$)|  |g'

Takes input as a command line argument, outputs on STDOUT.
Note that the spaces near the end before the |g are actually a tab character (SE converts them to spaces when displaying posts).
find              crawl directory tree recursively
"$1"              starting at the input directory
-exec             and for each file found, execute...
ls -Fd {} \;      append a trailing slash if it's a directory (using -F of ls)
|perl -pe         pipe each line to perl
'
s|                replace...
.*?/              each parent directory in the file's path...
(?!$)             that doesn't occur at the end of the string...
|    |            with a tab character...
g                 globally
'

Thanks to @Dennis for 4 bytes!

Dyalog APL, 48 bytes
(⊂∘⊃,1↓'[^\\]+\\'⎕R'    ')r[⍋↑r←⎕SH'dir/s/b ',⍞]

⍞ prompt for character input
'dir/s/b ', prepend text
⎕SH execute in shell
r← store in r
↑ make list of strings into character matrix
⍋ indices for ascending sorting
r[...] reorder r [sorted]
(...) on the standard out of the shell command, do:
'[^\\]+\\'⎕R'    ' regex replace backslash-terminated runs of non-backslashes by four spaces
1↓ drop the first line
⊂∘⊃, prepend the enclosed first [line]
Result of inputting "\tmp" to the prompt begins as follows on my computer:
C:\tmp\12u64
            keyboards64.msi
            netfx64.exe
            setup.exe
            setup_64_unicode.msi
            setup_dotnet_64.msi
        AdamsReg.reg
        AdamsReg.zip
        qa.dws
        ride-experimental
            win32
                d3dcompiler_47.dll
                icudtl.dat
                libEGL.dll

⋮

Aren't the directories supposed to have trailing \ characters?

@Neil they are preferred but not mandatory

SML, 176 bytes
open OS.FileSys;val! =chDir;fun&n w=(print("\n"^w^n);!n;print"/";c(openDir(getDir()))(w^"\t");!"..")and c$w=case readDir$of SOME i=>(&i w handle _=>();c$w)|x=>()fun%p=(&p"";!p)

Declares (amongst others) a function % which takes a string as argument. Call with % "C:/Some/Path"; or % (getDir()); for the current directory.
I'm using the normally rather functionally used language StandardML whose FileSys-Library I discovered after reading this challenge.
The special characters !, &, $ and % have no special meaning in the language itself and are simply used as identifiers; however they can't be mixed with the standard alphanumeric identifiers which allows to get rid of quite some otherwise needed spaces.
open OS.FileSys;
val ! = chDir;                       define ! as short cut for chDir

fun & n w = (                        & is the function name
                                     n is the current file or directory name
                                     w is a string containing the tabs
    print ("\n"^w^n);                ^ concatenates strings
    ! n;                             change in the directory, this throws an
                                     exception if n is a file name
    print "/";                       if we are here, n is a directory so print a /
    c (openDir(getDir())) (w^"\t");  call c with new directory and add a tab to w
                                     to print the contents of the directory n
    ! ".."                           we're finished with n so go up again
)
and c $ w =                          'and' instead of 'fun' must be used
                                     because '&' and 'c' are mutual recursive
                                     $ is a stream of the directory content
    case readDir $ of                case distinction whether any files are left
        SOME i => (                  yes, i is the file or directory name
            & i w handle _ => ();    call & to print i an check whether it's a
                                     directory or not, handle the thrown exception
            c $ w )                  recursively call c to check for more files in $
        | x    => ()                 no more files, we are finished

fun % p = (                          % is the function name,
                                     p is a string containing the path
    & p "";                          call & to print the directory specified by p
                                     and recursively it's sub-directories
    ! p                              change back to path p due to the ! ".." in &
)

Can be compiled like this with SML/NJ or with Moscow ML* by prefixing with load"OS";.
*See mosml.org, can't post more than 2 links.

C# (.NET Core), 222 bytes
namespace System.IO{class P{static int n;static void Main(String[]a){Console.WriteLine(new string('\t',n++)+Path.GetFileName(a[0]));try{foreach(var f in Directory.GetFileSystemEntries(a[0])){a[0]=f;Main(a);}}catch{}n--;}}}

Try it online!

The ungolf:
using System.IO;
using System;

class P
{
    static int n=0;
    static void Main(String[] a)
    {
        for (int i=0;i<n;i++) Console.Write("\t");
        Console.WriteLine(Path.GetFileName(a[0]));
        n++;

        if(Directory.Exists(a[0]))
            foreach (String f in Directory.GetFileSystemEntries(a[0]))
                Main(new String[]{f});
        n--;
    }
}

First time I ever recursed a Main function!
I believe a person that has fresher knowledge of C# can golf it more, as I didn't program on C# for some time!

Batch, 237 bytes
@echo off
echo %~1\
for /f %%d in ('dir/s/b %1')do call:f %1 %%~ad "%%d"
exit/b
:f
set f=%~3
call set f=%%f:~1=%%
set i=
:l
set i=\t%i%
set f=%f:*\=%
if not %f%==%f:*\=% goto l
set a=%2
if %a:~0,1%==d set f=%f%\
echo %i%%f%

Where \t represents the literal tab character. This version includes trailing \s on directories but 41 bytes can be saved if they are not needed.

the trailing \\ s aren't needed

PHP, 180 bytes

first argument: path must have a trailing slash (or backslash)
second argument: level defaults to NULL and will be interpreted as 0 by str_repeat; will throw a warning if not provided

function d($p,$e){$s=opendir($p);echo$b=str_repeat("\t",$e++),$e?basename($p)."/":$p,"
";while($f=readdir($s))echo preg_match("#^\.#",$f)?"":is_dir($p.$f)?d("$p$f/",$e):"$b\t$f
";}

displays hidden files and directories, but does not recurse hidden directories
add parentheses around is_dir(...)?d(...):"..." to remove hidden entries from output (+2)
replace "#^\.#" with #^\.+$# to display/recurse hidden entries but skip dot entries (+2)
may throw errors when directories are nested too deep. Insert closedir($s); before the final } to fix (+13)
will fail if a directory contains an entry with no name, prepend false!== to the while condition to fix (+8)

with glob, 182 bytes (probably 163 in future php)
function g($p,$e){echo$b=str_repeat("\t",$e),$e++?basename($p)."/":$p,"
";foreach(glob(preg_replace("#[*?[]#","[$1]",$p)."*",2)as$f)echo is_dir($f)?g($f,$e):"$b\t".basename($f)."
";}

does not display or recurse hidden files/directories
2 stands for GLOB_MARK, will append a slash to all directory names, as does ls -F
the preg_replace escapes glob special characters
I could have abused preg_quote for this (-19); but that would fail on Windows systems, as the backslash is the directory separator there.
php may soon include a function glob_quote, which will allow the same golfing as preg_quote and work on all systems.

with iterators, 183 bytes
(well, not purely iterators: I used implicit SplFileInfo::__toString() to golf $f->getBaseName() and $f->isDir() to the old PHP 4 functions.)
function i($p){echo"$p
";foreach($i=new RecursiveIteratorIterator(new RecursiveDirectoryIterator($p),1)as$f)echo str_repeat("\t",1+$i->getDepth()),basename($f),is_dir($f)?"/":"","
";}

no trailing slash required
displays and recurses hidden entries (ls -a)
insert ,4096 or ,FilesystemIterator::SKIP_DOTS before ),1 to skip dot entries (+5) (ls -A)
flag 1 stands for RecursiveIteratorIterator::SELF_FIRST

PowerShell, 147 bytes
param($a)function z{param($n,$d)ls $n.fullname|%{$f=$_.mode[0]-ne"d";Write-Host(" "*$d*4)"$($_.name)$(("\")[$f])";If(!$f){z $_($d+1)}}}$a;z(gi $a)1

Man, I feel like PS should be able to do something like the bash answer, but I'm not coming up with anything shorter than what I've got here.
Explanation:
param($a)                     # assign first passed parameter to $a
function z{param($n,$d) ... } # declare function z with $n and $d as parameters
ls $n.fullname                # list out contents of directory
|%{ ... }                     # foreach
$f=$_.namde[0]-ne"d"          # if current item is a file, $f=true
Write-Host                    # writes output to the console
(" "*$d*4)                    # multiplies a space by the depth ($d) and 4
"$($_.name)$(("\")[$f])"      # item name + the trailing slash if it is a directory
;if(!$f){z $_($d+1)}          # if it is a directory, recursively call z
$a                            # write first directory to console
z(gi $a)1                     # call z with $a as a directoryinfo object and 1 as the starting depth

Python 2, 138 bytes
Modified from this SO answer. Those are tabs for indentation, not spaces. Input will be taken like "C:/".
import os
p=input()
for r,d,f in os.walk(p):
    t=r.replace(p,'').count('/');print' '*t+os.path.basename(r)
    for i in f:print'   '*-~t+i

Try it online - It's pretty interesting that I'm allowed to browse the directory on Ideone...
Same length:
from os import*
p=input()
for r,d,f in walk(p):
    t=r.replace(p,'').count(sep);print' '*t+path.basename(r)
    for i in f:print'   '*-~t+i

Perl, 89 bytes
It's useful when there's a find module in the core distribution. Perl's File::Find module does not traverse the tree in alphabetic order, but the spec didn't ask for that.
/usr/bin/perl -MFile::Find -nE 'chop;find{postprocess,sub{--$d},wanted,sub{say" "x$d.$_,-d$_&&++$d&&"/"}},$_'

The script proper is 76 bytes, I counted 13 bytes for the command-line options.

Tcl, 116 bytes
proc L f {puts [string repe \t [expr [incr ::n]-1]][file ta $f];lmap c [glob -n -d $f *] {L $c};incr ::n -1}
L $argv

Try it online!

Java 8, 205 bytes
import java.io.*;public interface M{static void p(File f,String p){System.out.println(p+f.getName());if(!f.isFile())for(File c:f.listFiles())p(c,p+"\t");}static void main(String[]a){p(new File(a[0]),"");}}

This is a full program submission which takes input from its first command-line argument (not explicitly permitted, but done by many others) and prints output to standard out.
Try It Online (note different interface name)
Ungolfed
import java.io.*;

public interface M {
    static void p(File f, String p) {
        System.out.println(p + f.getName());
        if (!f.isFile())
            for (File c : f.listFiles())
                p(c, p + "\t");
    }

    static void main(String[] a) {
        p(new File(a[0]), "");
    }
}


text:
Recognize mod-folds
Task
Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the left-associative modulo operator.)
Given a list of n integers y0, …, yn−1,  determine if there exists a mod-fold f so that each yi = f(i).
You may choose and fix any two outputs Y and N for your function/program. If there exists such an f, you must always return/print exactly Y; if not, you must always return/print exactly N. (These could be true/false, or 1/0, or false/true, etc.) Mention these in your answer.
The shortest submission in bytes wins.
Example
Define f(x) = x % 7 % 3. Its values start:
|   x  | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ...
| f(x) | 0 | 1 | 2 | 0 | 1 | 2 | 0 | 0 | 1 | 2 | ...

Thus, given 0 1 2 0 1 2 0 0 1 2 as input to our solution, we would print Y, as this f generates that sequence. However, given 0 1 0 1 2 as input, we would print N, as no f generates that sequence.
Test cases
The formulas given when the output is Y are just for reference; you must at no point print them.
0 1 2 3 4 5              Y    (x)
1                        N
0 0 0                    Y    (x%1)
0 1 2 0 1 2 0 0 1 2      Y    (x%7%3)
0 0 1                    N
0 1 2 3 4 5 6 0 0 1 2    Y    (x%8%7)
0 1 2 0 1 2 0 1 2 3      N
0 2 1 0 2 1 0 2 1        N
0 1 0 0 0 1 0 0 0 0 1    Y    (x%9%4%3%2)

Are there any time or memory limits?

Can I output truthy values and falsey values instead?

@Leaky I'd rather you not. I'm not a big fan of truthy-falsey; I'm explicitly trying this as a more objective alternative that still gives you freedom.

@Lynn is it just me or you still haven't fixed it?

Regarding memory/time constraints: I don't think I'll add any to the challenge itself, but I might run a bounty for the shortest answer in bytes that can answer each one of my test cases in some reasonable time length.

@LeakyNun FYI, I changed the sequence instead of correcting the answer

Pyth, 14 bytes
}Qm%M+RdUQy_Sl

Returns True/False. Try it online: Demonstration or Test Suite
Explanation:
}Qm%M+RdUQy_SlQ   implicit Q (=input) at the end
             lQ   length of input list
            S     create the list [1, 2, ..., len]
           _      reverse => [len, ..., 2, 1]
          y       generate all subsets (these are all possible mod-folds)
  m               map each subset d to:
        UQ           take the range [0, 1, ..., len-1]
     +Rd             transform each number into a list by prepending it to d
                     e.g. if mod-fold = [7,3], than it creates:
                        [[0,7,3], [1,7,3], [2,7,3], [3,7,3], ...]
   %M                fold each list by the modulo operator
                  this gives all possible truthy sequences of length len
}Q                so checking if Q appears in the list returns True or False

Pyth, 11 bytes
q%M.e+k_tx0

Based on @ferrsum's idea. I actually thought about using the zero-indices for the subset generation, but didn't realize, that all zero-indices has to be the solution already.

Python 3, 239 218 bytes
from itertools import*
lambda z:z in[[eval(''.join([str(l)]+['%'+str(i[::-1][k])for k in range(len(i))]))for l in range(len(z))]for i in(i for j in(combinations(range(1,len(z)+1),i+1)for i in range(len(z)))for i in j)]

An anonymous function that takes input of a list z and returns True or False for Y and N.
This uses a method similar to @Jakube 's answer, and although it is essentially a brute force, runs very quickly.
from itertools import*               Import everything from the Python module for
                                     iterable generation
lambda z                             Anonymous function with input list z
combinations(range(1,len(z)+1),i+1)  Yield all sorted i+1 length subsets of the range
                                     [1,len(z)]...
...for i in range(len(z))            ...for all possible subset lengths
(i for j in(...)for i in j)          Flatten, yielding an iterator containing all possible
                                     mod-fold values as separate lists
...for i in...                       For all possible mod-fold values...
...for k in range(len(i))            ...for all mod-fold values indices k...
...for l in range(len(z))            ...for all function domain values in [0,len(z)-1]...
[str(l)]+['%'+str(i[::-1][k])...]    ...create a list containing each character of the
                                     expression representing the function defined by the
                                     mod-fold values (reversed such that the divisors
                                     decrease in magnitude) applied to the domain value...
 eval(''.join(...))                  ...concatenate to string and evaluate...
 [...]                               ...and pack all the values for that particular
                                     function as a list
 [...]                               Pack all lists representing all functions into a list
 ...:z in...                         If z is in this list, it must be a valid mod-fold, so
                                     return True. Else, return False

Try it on Ideone

Python 2, 69 bytes
f=lambda a,i=0:i/len(a)or a[i]in[a[i-1]+1,i,0][i<=max(a)::2]*f(a,i+1)

Uses True/False.
The answer to what characterizes a mod-foldable series turns out to be less interesting than it seems at first. It is a series of the form 0, 1, ..., M - 1, 0, 1, ... x1, 0, 1, ..., x2, ... such that for all i, 0 <= xi < M. Such a sequence can be produced by the mod chain of all the (0-based) indices of the zeroes in the array, excluding the first.

Jelly, 19 15 14 bytes
LṗLUZ’1¦%/sLe@

Returns 1 for truthy, 0 for falsy. Try it online!
The algorithm is O(nn), where n is the length of the list, making it too slow and memory-intensive for most of the test cases.
A modified version – which replaces the second L with a 5 – can be used to verify all test cases. Note that this modified version won't work for arbitrarily long lists.
How it works
LṗLUZ’1¦%/sLe@  Main link. Argument: A (array of integers)

L L             Yield the length l of A.
 ṗ              Take the l-th Cartesian power of [1, ..., l], i.e., construct
                all arrays of length l that consist of elements of [1, ..., l].
   U            Upend/reverse each array. This way, the first l arrays start
                with [1, ..., l], as do the next l arrays, etc.
    Z           Zip/transpose the array of arrays.
     ’1¦        Decrement the first array to map [1, ..., l] to [0, ..., l - 1].
        %/      Reduce the array's columns by modulus/residue.
          sL    Split the result into chunks of length l.
            e@  Verify if A belongs to the resulting array.

Can you add an explanation?  As someone who hasn't used Jelly (yet), I have no idea how it works.

I'll add one as soon as I'm done golfing. There still are a few things I want to try first.

I've (given up and) added an explanation.

JavaScript (ES6), 98 bytes
a=>a.every((n,i)=>n?n<(l+=p==i)&&n==p++:p=1,l=p=1)

Saved 48 bytes by switching to @Feersum's discovery. Any given value n in the array is either zero, in which case the next prediction p is 1, or it equals the next prediction, in which case p is incremented. We also measure the length l of the initial sequence by comparing p to i, as n must always be less than l at all times.

Python 2, 103 99 bytes
f=lambda l,r:r==x or l and f(l-1,[t%l for t in r])|f(l-1,r)
x=input();l=len(x);print+f(l,range(l))

Prints 1 for truthy and 0 for falsy. Test it on Ideone.


text:
The fastest square root calculator
Write a program which outputs the square root of a given number in the shortest time possible.
Rules
It may not use any builtins or powering with non-integers.

Input format

as a function argument
as a command line argument
as a direct input on stdin or a window

Your entry hasn't to be a complete program, it may be a function or a snippet.
It doesn't need to be exact; a one percent margin of error is allowed.
The test cases will only be positive integers, but your program should output/return floats.
It may return the square root as function return value, print it to stdout or write in a consistent file, which is readable by the user..Each program should specify the compiler/interpreter it should be run on and compiler flags. If they aren't specified, I'll use the following implementations: (just talking about mainstream langs):

C/C++: gcc/g++ on Linux, no flags
Java: OpenJDK on Linux, no flags
Python: CPython
Ruby: MRI
Assembler: x86 Linux
JS: Node.js

Examples
Input    Output
4        2 (or something between 1.98 and 2.02)
64       8 (between 7.92 and 8.08)
10000    100 (between 99 and 101)
2        bewteen 1.40001 and 1.428

Scoring
Your programs on the same computer with same conditions (Terminal and Iceweasel with this tab open).
This question has the tag "Fastest code", so the program, which calculates the square root of a (not yet given) random integer between 1 and 10^10 as fast as possible will win!

powering between 0 and 1 should probably be changed to non-integer powers only. Otherwise you'll get 'pow(x,1.5)/x' style answers

The bottleneck is going to be I/O, so for practical purposes this question doesn't have a winning criterion.

@PeterTaylor: It's enough if the sqrt algorithm is a function which has a return value. Only the time of the function will be counted then.

You need to run it multiple times with multiple random integers otherwise the scoring is totally arbitrary. You should also have challengers specify a compiler. And for languages like C or C++ you need to specify which optimization flag to enable.

@AgentCrazyPython Yeah, I'm doing this, are 10000 different random numbers between 0 and 10^10 enough? And, about compiler flags, the answerers should decide themselves, I'm no C programmer (sorry if that sounded rude)

@MegaMan enough. Put it in the question and ask for compiler. The compiler will make a large difference.

can you put up a leaderboard, by the way?

Not today, don't have time

I don't think you've thought this out fully - 10**10 is a 34-bit integer, and the ARMv7 processor that the Raspberry Pi 2B uses only supports 32-bit integers natively.

I would vote to reopen if I could. We aren't used to [tag:fastest-code], but we have to take risks.

I'm modifying the question to make it less subjective. I added "Each program should specify the compiler/interpreter it should be run on and compiler flags." I hope you agree with my changes.

@MegaMan my edit was rejected. I think you could manually edit it in yourself; the compiler is quite ambiguous.

And in order to be able to compare (>0ns) you should make it accept multiple inputs just so we can compare two programs.

@Mego: Huh, dind't think about it, I cqan try on another computer or just use smaller numbers

Can't you just use pow(X,0.5)?

@MatthewRoh It may not use any builtins or powering with numbers between 0 and 1.

What's stopping people from just using a big lookup table?

I don't know much about this: I have a solution in Taxi that runs on TIO with a C++ interpreter. Is that a valid submission? How do I specify it?

which calculates the square root of a (not yet given) random integer between 1 and 10^10 as fast as possible will win Maybe just run all numbers, the timing seem acceptable

@EngineerToast Sorry for answering so late, just put the interpreter including link in the title. I was not here for quite a time

C
Since input is limited to positive integers between 1 and 1010, I can use a well-known fast inverse square root algorithm to find the inverse square root of the reciprocal of the input.
I'm not sure what you mean by "only Xfce and the program and a terminal running" but since you stated that functions are acceptable, I provide a function in C that will take an integer argument (that will be casted to float automatically) and outputs a float as the result.
float f(float n) {
    n = 1.0f / n;
    long i;
    float x, y;

    x = n * 0.5f;
    y = n;
    i = *(long *)&y;
    i = 0x5f3759df - (i >> 1);
    y = *(float *)&i;
    y = y * (1.5f - (x * y * y));

    return y;
}

The following is a program that makes uses of the function above to calculate the square roots of the given test cases and compares them to the values given by the sqrtf function in math.h.
Ideone

See this blog and/or this paper for an explanation of where this magic number comes from

'only Xfce and the program and a terminal running' means there are no other processes started by me.

Knew this algorithm and hoped that someone will post it! ;)

You need to specify the compiler.

Using Linux, I'll be using gcc every time.

Using a union for type-punning would be safe.  Pointer-casting this way violates strict-aliasing.

Ran across this algorithm myself not too long ago. I needed a way to square-root (and cube-root) excessively large numbers. Didn't need to do it every frame, but I didn't want any delay to be noticeable when it was recalculated. Ended up not using this formula as I was going to be rounding and truncating the hell out of it anyway, so log10 was easy ("how many characters does the number have when converted to a base-10 string?" which had already been written) and taking 1/2 or 1/3rd of that value was also easy and the result was good enough.

Compared to sqrt() it is ~100x slower in my test.

@lahjaton_j Are you compiling with optimization flags and accessing the sqrt intrinsic, since that would definitely be faster

Python 3
Why am I using Python? Never mind.
def sqrt(n):
    # 3 iterations of newton's method, hard-coded
    # normalize

    # find highest bit
    highest = 1
    sqrt_highest = 1
    while highest < n:
        highest <<= 2
        sqrt_highest <<= 1

    n /= highest+0.0

    result = (n/4) + 1
    result = (result/2) + (n/(result*2))
    result = (result/2) + (n/(result*2))

    return result*sqrt_highest

Ideone it!

did you just use python for a fastest-code challenge? are you out of your mind?

@AgentCrazyPython I've used Java, so, he's good.

C
Uses unsigned integers when possible for speed.
root.c:
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define ns(t) (1000000000 * t.tv_sec + t.tv_nsec)

struct timespec then, now;

int output(uint64_t result)
{
    clock_gettime(CLOCK_REALTIME, &now);
  printf("sqrt(x) = %10lu.%2d    real time:%9ld ns\n", result / 100, ((int) (result % 100)), ns(now) - ns(then));
  return 0;
}

//real time:    60597 ns

int main(int argc, char *argv[]) {
    clock_gettime(CLOCK_REALTIME, &then);
    uint64_t num = atol(argv[1]), root = 100, old_root = 0;
    num *= 10000; //multiply by 10k because int is faster
    //and you only need 2 d.p. precision max. (for small numbers)
    while (old_root != root) {
        old_root = root;
        root = (root + num / root) / 2;
    }
    return output(root);
}

timein:
#!/bin/bash

gcc -Wall $1 -lm -o $2 $2.c

./$2 $4

r=$(seq 1 $3)

for i in $r; do ./$2 $4; done > times

awk -v it=$3 '{ sum += $7 } END { print "\n" sum / (it) " ns" }' times

rm times

Usage: ./timein '-march=native -O3' root <iterations> <number>
Inspired by this answer, uses this algorithm.

Running on a Raspi, -march=native -03 doesn't work. Is this needed?

@MegaMan I think you typed 'zero three' instead of 'oh three'.

@AgentCrazyPython Yep, I did.

@MegaMan did that fix the problem or what?

@AgentCrazyPython Yep, works fine now

Can't use awk, even at really big numbers real time = 0 ns

@MegaMan Really? On my laptop it works fine. Can you give an example number where the real time is 0ns?

Don't remember, but something around 10^9

C (gcc)
demonstrates one Newton step after a linear approximation on mantissa
speed of C is fast but not really relevant unless you have to apply it several million times
then it is sensitive to overall context of SIMD vectorisation, memory access patterns & other branching causing pipeline stalls etc
float f(float x){int i=*(int*)&x;i=0x1fb90000+(i>>1);float y=*(float*)&i;return(y+x/y)/2;}
void main() {float y[4]={4,64,10000,2};
for(int j=0;j<4;j++)printf("f(%f)\t=\t%f\n",y[j],f(y[j]));}

TIO

Adaptation of my own answer on Fast inverse square root

Tcl, 114 bytes
rename binary B
proc R n {B s [B f f $n] i i
B s [B f i [expr 0x5f3759df-($i>>1)]] f y
expr 1/($y*1.5-$n/2*$y**3)}

Try it online!

You don't need bytecount since this isn't code-golf


text:
Fibonacci reversed!
Introduction
We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: Reversed fibonacci! So given F_n your job is to find n.
Specification
Input
Your input will be a non-negative integer, which is guaranteed to be part of the fibonacci sequence.
Output
The output must be a non-negative integer as well.
What to do?
The introduction already said: Given a fibonacci number, output its index. Fiboancci number hereby is defined as F(0)=0, F(1)=1, F(n)=F(n-1)+F(n-2) and you're given F(n) and must return n.
Potential Corner Cases
0 is a valid in- and output.
If given "1" as input you may either output "1" or "2", as you prefer.
You may always assume that your input actually is a fibonacci number.
You may assume that the input is representable as a 32-bit signed integer.
Who wins?
This is code-golf so the shortest answer in bytes wins!
Standard rules apply of course.
Test-cases
0 -> 0
2 -> 3
3 -> 4
5 -> 5
8 -> 6
13 -> 7
1836311903 -> 46

Slight nit-pick: shouldn't this be considered inverse fibonacci https://en.m.wikipedia.org/wiki/Inverse_function

So, iccanobiF?!

@Michael this is not inverse Fibonacci, because there's no inverse to Fibonacci function because it is not injective (because the "1" appears twice). The reverse originally came from the idea of "reverse table look-ups" which is what I expected people to do here (e.g. I expected them to do it to solve the problem).

The function here could be considered a right inverse of the "Fibonacci function" from the non-negative integers to the set of Fibonacci numbers. The existence of a right inverse does not imply injectivity.

@MatthewRoh Already Taken. I already did that. :P

@SEJPM: I kinda did expect a task like "write a program that spells out the fibonacci sequence backwards", though.

@SEJPM: It is if you limit its domain so that 1 appears only once. Sort of like how arcsin(x) is considered to be the inverse of sin(x), even though sin(x) is not injective (or even surjective) in and of itself. It's all about that context!

Actually, 1 byte
f

Yes, there's a builtin for this, since November 16, 2015.
Try it online

For fun, without the builtin, it's 9 bytes:
╗1`F╜=`╓i

Try it online!
Explanation:
╗1`F╜=`╓i
╗          push input to register 0
 1`F╜=`╓   push list containing first value x (starting with x = 0) where:
   F         fib(x)
    ╜=       is equal to the input
        i  flatten the list

I have one thought and one thought only when I see this: ಠ_ಠ

I don't really understand why you would "waste" a symbol for such a ridiculously specific purpose

@Fatalize The Fibonacci and inverse Fibonacci functions were among the first that I added. Even now, there are 39 completely unused single-byte commands (and who knows how many overloads that could be utilized). The 256 symbols, combined with the fact that there are 5 types in Actually (Integer, Real, String, Iterable, Function), means there are up to 1280 possible unary functions, and 6400 possible binary functions. There's a lot of room for seemingly-useless commands.

@Mego Are you just trying to compete with Mathematica for the most builtins?

Actually, it's just a byte... lol, love this language name.

Now we have to invent a language where an empty file means inverse Fibonacci to triumph this.

Mathematica, 25 bytes
InverseFunction@Fibonacci

Function. Pretty self-explanatory if you ask me.

Python, 36 34 32 bytes
lambda n:len(str(66*n**6))//1.24

Previous versions:
f=lambda n:len(str(66*n**6))//1.24
f=lambda n:(n*n*7).bit_length()//1.4

Explanation
The core idea is to invert the formula
fibonacci(n) ~ ( (1 + sqrt(5)) / 2)**n / sqrt(5)

which tells us that
log fibonacci(n) ~ n log((1 + sqrt(5)) / 2) - log(sqrt(5))

to get
f(n) ~ (log(n) + log(sqrt(5))) / log((1 + sqrt(5))/2)

The golfing optimizations are:

Use len(str(n)) to compute log base 10 without importing log (old version used .bit_length() to compute log base 2)
Raise n to a power, so that the approximation of the logarithm can distinguish between successive Fibonacci numbers
Multiplying by a constant scales up the values to get them in the correct range

Then the divisor was truncated to as little precision as I could manage and the multiplier chosen to give the correct results for all 32-bit fibonacci numbers.

it should be 32 bytes, because f= is not counted.

As the comment above already said, anonymous functions/unnamed lambdas are allowed by default. Also, if you restrict your answer to Python 2 and require a long argument, lambda n:~-len(`66*n**6`)//1.24 should work.

05AB1E, 3 bytes
Code:
ÅFg

Explanation:
ÅF   # Generate all Fibonacci numbers <= input.
  g  # Get the length of this list.

Uses the CP-1252 encoding. Try it online!.

Julia, 27 26 18 bytes
!n=log(3n+.7)÷.48

This uses the inverse of Binet's formula, with just enough precision for  32-bit integers; it actually works up to F(153) = 42,230,279,526,998,466,217,810,220,532,898 > 2105.
Try it online!
How it works
Binet's formula states the following.

Restricting F to the set of Fibonacci, the map n → Fn has a right inverse F → nF.
We have that

and all that is left to do is dealing with the edge case 0.
Since the input is restricted to 32-bit integers, we can use short decimal literals instead of the constants in the formula.

log φ = 0.481211825059603447… ≈ 0.48
Unfortunately, 0.5 isn't precise enough.
√5 = 2.2360679774997896964… ≈ 3
That might seem like an awful approximation at first glance, but we're taking logarithms and since log 3 - log √5 = 0.29389333245105…, the result before rounding will be off by a small constant factor.
0.5 ≈ 0.7
Because of the excess from the previous approximation, we could actually omit this term altogether and still get correct results for F > 0. However, if F = 0, the logarithm will be undefined. 0.7 turned out to be the shortest value that extends our formula to F = 0.

Jelly, 14 11 bytes
5½×lØp+.Ḟ»0

Try it online!
This is my first ever Jelly answer! This uses the algorithm from the MATL answer. Thanks to Dennis for shaving off 3 bytes!
Explanation:
   lØp      # Log Base phi
5½          # Of the square root of 5
  ×         # Times the input
      +     # Plus
       .    # 0.5
        Ḟ   # Floored

This gets the right answer, now we just need to handle the special case of '0'. With '0' as an arg, we get -infinity, so we return
»      # The maximum of
 0     # Zero
       # And the previous calculated value.

+1 because the comments on the explanation are the end of a limerick.

JavaScript, 54 50 69 50 42 bytes
b=>(j=>{for(i=c=0;b-i;c++)i=j+(j=i)})(1)|c

Surely it isn't going to win, just for fun :)
Ok, checking for zero consumes 19 bytes. WTF? Stupid-me.

Demo! To see the last test case, you have to scroll the console a bit.

a=b=>(j=>{for(i=c=0;b-i;c++)i=j+(j=i)})(1)|c;
console.log('0: '+a(0));
console.log('2: '+a(2));
console.log('3: '+a(3));
console.log('5: '+a(5));
console.log('8: '+a(8));
console.log('13: '+a(13));
console.log('1836311903: '+a(1836311903));

Thanks @edc for shortening by 8 bytes.

simple b=>{for(j=1,i=c=0;b-i;c++)i=j+(j=i);return c} 45, golfed b=>(j=>{for(i=c=0;b-i;c++)i=j+(j=i)})(1)|c 42.

@edc Wow, that's clever, thanks <3

Perl 6  33 30  27 bytes
{first *==$_,:k,(0,1,*+*...*>$_)}
{first *==$_,:k,(0,1,*+*...*)}
{first $_,:k,(0,1,*+*...*)}
Try it
Explanation:
# lambda with implicit ｢$_｣ parameter
{
  first           # find the first element
    $_,           # where something is equal to the block's argument
    :k,           # return the key rather than the value

    # of the Fibonacci sequence
    ( 0, 1, * + * ... * )
    # ^--^ first two values
    #       ^---^ lambda used to generate the next in the series
    #             ^-^ generate until
    #                 ^ Whatever
}

Test:
#! /usr/bin/env perl6
use v6.c;
use Test;

# using the safer version that stops generating
# values bigger than the input
my &fib-index = {first $_,:k,(0,1,*+*...*>$_)}

my @tests = (
  0 => 0,
  2 => 3,
  3 => 4,
  5 => 5,
  8 => 6,
  13 => 7,
  1836311903 => 46,
  1836311904 => Nil, # this is why the safe version is used here
  12200160415121876738 => 93,
  19740274219868223167 => 94,
  354224848179261915075 => 100,
);

plan +@tests + 1;

for @tests -> $_ ( :key($input), :value($expected) ) {
  cmp-ok fib-index($input), &[eqv], $expected, .gist
}

cmp-ok fib-index((0,1,*+*...*)[1000]), &[eqv], 1000, 'works up to 1000th element of Fibonacci sequence'

1..13
ok 1 - 0 => 0
ok 2 - 2 => 3
ok 3 - 3 => 4
ok 4 - 5 => 5
ok 5 - 8 => 6
ok 6 - 13 => 7
ok 7 - 1836311903 => 46
ok 8 - 1836311904 => Nil
ok 9 - 12200160415121876738 => 93
ok 10 - 19740274219868223167 => 94
ok 11 - 354224848179261915075 => 100
ok 12 - works up to 1000th element of Fibonacci sequence

You can replace first *==$_ with just first $_, because a number is a valid smart-matcher.

24 bytes by using the ... operator instead of first

Jelly, 8 bytes
1+Ð¡0
¢i

Try it online! Note that this approach is too inefficient for the last test case.
How it works
¢i     Main link. Argument: n

¢      Call the helper link niladically (i.e., without arguments).
       This yields the sequence of the first n positive Fibonacci numbers, i.e.,
       [1, 1, 2, 3, 5, ...].
 i     Find the first index of n (1-based, 0 if not found).

1+Ð¡0  Helper link. No arguments.

1      Set the left argument to 1.
    0  Yield 0.
 +Ð¡   Add both arguments, replacing the left argument with the sum and the right
       argument with the previous value of the left argument.
       Yield the array of all intermediate values of the left argument.

Pyke, 5 bytes
.f.bq

Try it here!
.f    - first number where
  .b  -  fib(n)
    q - ^ == input

Python, 29 bytes
g=lambda n:n>.7and-~g(n/1.61)

Recursively divides the input by the golden-ratio approximation 1.61 until it's below 0.7, and outputs the number of divisions.
For 0, the code outputs False, which equals 0 in Python. This can be avoided for 2 bytes
g=lambda n:n//.7and 1+g(n/1.61)

JavaScript, 22 bytes
n=>Math.log(n)/.48+2|0

I didn't think this would work when I saw it, but apparently -Infinity|0 is 0 in JavaScript. Go figure.

@Dennis: In JS, bitwise operators take only last 32 bits and -Infinity = FFF00000 00000000. I was glad to find out, it spares 3 bytes for not having to prepend an explicit zero test like n&&. Apart from that, the main purpose of |0 is a substitute for Math.trunc() (like ÷ in Julia).

MATL, 14 bytes
t?5X^*17L&YlYo

Try it online!
This uses an inverse of Binet's formula, and so it's very fast.
Let F denote the n-th Fibonacci number, and φ the golden ratio. Then

The code uses this formula with two modifications:

Instead of adding 1/2 and then rounding down, the code simply rounds towards the nearest integer, which takes up fewer bytes.
Input F=0 needs to be treated as a special case.

How it's done
t         % Take input F implicitly. Make a copy
?         % If (copy of) F is positive
  5X^     %   Push sqrt(5)
  *       %   Multiply by F
  17L     %   Push phi (predefined literal)
  &Yl     %   Two-input logarithm: first input is argument, second is base
  Yo      %   Round towards nearest integer
          % Else the input, which is 0, is left on the stack
          % End if implicitly
          % Display implicitly

Alternate approach: O1G:"yy+]vGmfq

11 bytes: t?17L&YlXkQ

@jimmy23013 Nice approach! You should definiely post that as a separate answer

I don't think it is worth another answer, as it is just a way to remove the 5X^*. (I have done this before.) And I don't know MATL enough to possibly keep improving it.

Sage, 49 bytes
lambda x,s=sqrt(5):x and int(log(x*s,(1+s)/2)+.5)

Thanks to TuukkaX for the suggestion about saving sqrt(5) as s to shave off a few bytes.
Try it online.
This approach using an inverse of Binet's formula offers several improvements over the previous approach: it's faster (constant-time versus quadratic time), it actually works for larger inputs, and it's shorter!
Python users may wonder why I'm using sqrt(5) instead of the shorter 5**.5 - it's because 5**.5 is computed with C's pow function, and loses precision due to floating point issues. Many mathematical functions (including sqrt and log) are overloaded in Sage to return an exact, symbolic value, which don't lose precision.

I don't know Sage at all but could you save bytes by holding the sqrt(5) in a variable and use it twice, instead of typing sqrt(5) twice?

JavaScript (ES6), 39 33 bytes
f=(n,j=0,k=1)=>n>j?f(n,k,j+k)+1:0

Even with ES7, the inverse Binet formula takes 47 bytes:
x=>Math.log(x*5**.5)/Math.log(.5+1.25**.5)+.5|0
x=>Math.log(x*5**.5)/Math.log((1+5**.5)/2)+.5|0
x=>Math.log(x*(p=5**.5))/Math.log((1+p)/2)+.5|0

Just distribute the log and precompute all constants...

IMHO, if you call recursively the lambda by name, f(n,k,j+k), you should include the assignment f= and count it as +2 bytes. The rule for unnamed lambdas should not apply here.

@charlie Sorry, I always forgot about that. Fixed.

Regex (.NET), 23 19 bytes
(\2?(\1)|x$|^x|\b)*

Try it online!
Takes its input in unary, as a string of x characters whose length represents the number. Returns its output as the capture count of group \1.
This is based on Martin Ender's .NET regex for matching Fibonacci numbers. The .NET feature of balanced groups is used to count the number of iterations taken by the loop.

That regex is first initially translated to use x as its unary numeral, yielding ^$|^(^x|(?>\2?)(\1))*x$.
Then the x$ at the end is moved inside as the extra alternative |x$, incrementing the loop count by \$1\$ for all \$n>0\$. This also allows us to remove the ^$| at the beginning, because ^(^x|(?>\2?)(\1)|x$)*$ will now match \$n=0\$ on its own. (It will also now match numbers that are \$0\$ or \$1\$ less than a Fibonacci number, but we don't care because as specified by the challenge, all inputs will be Fibonacci numbers.)
Then the extra alternative |\b is added to increment the loop count again for all \$n>0\$; \b cannot match on an input of \$n=0\$ because there is no word character ([0-9A-Za-z_]) to form a boundary with the absense of a word character, but it will always match at the end of a string of one or more xs. The match is zero-width, so the loop will then be terminated.
Then we remove the ^ and $ anchors sandwiching the regex, because we don't need to return a non-match for non-Fibonacci numbers.
Then an optimization for speed, moving the ^x alternative as far to the end as possible, because it only has to match once, and would add a failed match to every subsequent iteration if ordered as the first alternative.
The \2? can lose the (?>...) atomic group around it, because we don't need to determine if a number is Fibonacci or not. Due to the lack of any assertions following the loop, it will simply keep the first match it finds at each iteration, not having any reason to backtrack.

27 byte version that matches iff the input is a Fibonacci number:
^((?>\2?)(\1)\B|x$|^x|\b)*$

Try it online!
The \B prevents numbers \$1\$ less than a Fibonacci number from being matched; in unary, \B matches at every place except the beginning and end in a non-zero number (and matches "everywhere" in an input of zero).
Regex  (PCRE1 / PCRE2 v10.34 or earlier), 20 bytes
^(\2?(\1)|x$|^x)+|^x

Try it online! - PCRE1
Try it online! - PCRE2 v10.33
Takes its input in unary, as the length of a string of xs. Returns its output as the number of ways the regex can match. (The rabbit emoji indicates this output method. It can yield outputs bigger than the input, and is really good at multiplying.)
This is a straight port of the .NET version to the  output format. It needs to be anchored, so that the only variation in how a match can happen is how many iterations the loop takes, not where in the string it starts. The * is changed to + because with the former, looping for 0 iterations would still be a match, and would result in a 1-indexed return value.
Moving the |\b alternative to the end as |^x is a minor speed optimization, at a zero-byte cost. As an added bonus, we can change this to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$.
For PCRE1, and PCRE2 before v10.35, the atomic group is not needed even with -output, because those versions automatically atomicize groups that contain a nested backreference (in this case, \1).
Regex  (Perl / PCRE), 23 bytes
^(\2?+(\1)|^x)+|^x|^xxx

Try it online! - Perl v5.28.2 / Attempt This Online! - Perl v5.36+
Try it online! - PCRE1
Try it online! - PCRE2 v10.33 / Attempt This Online! - PCRE2 v10.40+
Try it online! - PCRE2 - every Fibonacci number up to \$F_{46}\$ in under 20 seconds
Instead of atomicizing the whole loop, as ^((?>\2?(\1)|x$|^x|\b))+, we move all choices out of the loop, so there's only one thing it can do at any iteration. This saves 1 byte.
As in the PCRE1 version, we can change |^x to |^xx to return \$1\$ (instead of \$2\$) for an input of \$1\$.
An alternative 23 byte option would be ^(\2?+(\1)|x$|^x)+|^xxx, but that'd be ever-so-slightly slower due to having an extra choice inside the loop.
Regex (.NET), 33 29 bytes
(?=(^(x)|\3?(\1)|)*)(?<-1>x)*

Try it online!
Returns its output as the sum of the lengths of the match (group \0) and group \2. It is done as a sum because for inputs \$n=1,2,3\$ the Fibonacci index is \$n+1\$ and would not fit in a single capture group.
Group \2, which is (x) in this regex, is captured as \$1\$ iff the loop takes at least one iteration, which happens for all \$n>0\$. The loop count itself is also given an extra increment, as in the 23 byte version above, by the addition of an empty alternative | inside the loop. This will result in a zero-width match being taken at the end, regardless of input; it even happens for \$n=0\$, but that doesn't matter, because the (?<-1>x)* will not have room to pop its capture, and the return match will be \$0\$ anyway.
Note that this regex would actually not be made shorter by returning its output as the sum of the lengths of \0, \3, and \3, as the shortest way I can think of to do that takes 34 bytes:
(?=((?>\2?)(\1)|^x)*(x))?(?<-1>x)*

Try it online!
38 byte version that matches iff the input is a Fibonacci number:
^(?=(^(x)|(?>\3?)(\1)|)*x$|$)(?<-1>x)*

Try it online!
Regex (Perl / PCRE), 31 bytes
((?=(\2?x))(^x|\4?+(\3)))*(x|^)

Try it online! - Perl
Try it online! - PCRE
Returns its output as the sum of the lengths of groups \2, \5, and \5. The regex saves 3 bytes just by using a possessive quantifier, replacing (?>\4?) with \4?+.
The Fibonacci index minus \$2\$ is built up in \2 using the expression (?=(\2?x)). The first time this is hit, the \2? will evaluate to zero because \2 isn't set yet, and \2 will be given a value of \$1\$. On every subsequent iteration, it will be incremented. This is done in a lookahead to avoid influencing the running total Fibonacci match, and is safe because at every step, the index will be less than the amount added to the full match.
The (x|^) at the end serves to let \5\$=1\$ in all cases except \$n=0\$.
This regex does not work under Java; group \2 just captures \$1\$ and stays there. This may be due to a bug in Java's regex engine.
33 byte version that matches iff the input is a Fibonacci number:
^((?=(\2?x))(^x|\4?+(\3)))*(x|^)$

Try it online! - Perl
Try it online! - PCRE
If the output specification must be simplified to sum only two groups, this would be the shortest way I can think of doing it (39 bytes, output is the sum of the lengths of groups \0 and \5):
(?=((?=(\2?x))(^x|\4?+(\3)))*(x))?\2?x?

Try it online! - Perl
Try it online! - PCRE
42 byte version that matches iff the input is a Fibonacci number:
^(?=((?=(\2?x))(^x|\4?+(\3)))*(x|^)$)\2?x?

Try it online! - Perl
Try it online! - PCRE

Prolog (SWI), 90 bytes
Written in conversation with flawr in chat.
F-N-A-B:-F=A;N>0,M is N-1,C is A+B,F-M-B-C.
F/N/I:-N=I,F-N-0-1;J is I+1,F/N/J.
F/N:-F/N/0.

Try it online!
Ungolfed
Here's a less-golfed version:
fib(F,0,F,_).
fib(F,N,A,B) :- N>0, M is N-1, C is A+B, fib(F,M,B,C).
fibindex(F,N,N) :- fib(F,N,0,1).
fibindex(F,N,I) :- J is I+1, fibindex(F,N,J).
fibindex(F,N) :- fibindex(F,N,0).

The fib/4 predicate (F-N-A-B in the golfed version) takes a number N and two accumulators A and B (which should start at 0 and 1) and unifies F with the Nth Fibonacci number. If N is 0, F is simply the current value of A, the smaller accumulator value. Otherwise, count N down by one and recurse with new accumulator values B and A+B.
fibindex/3 (F/N/I in the golfed version) takes a Fibonacci number F and an index I (which should start at 0) and unifies N with the Fibonacci index of F. Either F is the Ith Fibonacci number, in which case N=I and we're done, or we count I up by one and recurse. Note that this approach leads to infinite recursion if given a non-Fibonacci number, but we don't have to handle that case for this challenge.
Finally, fibindex/2 (F/N) just calls fibindex/3 with an initial I value of 0.

C, 62 58 bytes
g(c,a,b){return c-a?g(c,b,a+b)+1:0;}f(c){return g(c,0,1);}

Detailed
int g(int c, int a, int b)
{
    if (c == a)
    {
        return 0;
    }
    else
    {
        return g(c, b, a+b) + 1;
    }
}

int f(c)
{
    return g(c, 0, 1);
}

57 bytes

Python, 38 bytes
f=lambda n,a=0,b=1:n^a and-~f(n,b,a+b)

Test it on Ideone.

Java 7, 70 bytes
int c(int n){int a=0,b=1,c=0,t;while(a<n){c++;t=b;b+=a;a=t;}return c;}

https://ideone.com/I4rUC5

Welcome to PPCG, nice first answer!

int c(int n){int a=0,b=1,c=0,t;for(;a<n;t=b,b+=a,a=t)c++;return c;} (not tested)

int c(int n){int a=0,b=1,c=0;while(a<n){c++;b+=a;a=b-a;}return c;} (not tested)

int c(int n){int a=0,b=1,c=0;for(;a<n;b+=a,a=b-a)c++;return c;} (not tested)

Haskell, 45 bytes
f x=round$log(sqrt 5*x+0.9)/log((sqrt 5+1)/2)

TSQL, 143 bytes
Input goes in @n as in DECLARE @n INT = 1836311903;
DECLARE @O BIGINT=0;WITH F(R,P,N)AS(SELECT @O,@O,@O+1 UNION ALL SELECT R+1,N,P+N FROM F WHERE N<=@n)SELECT MAX(R)FROM F OPTION(MAXRECURSION 0);

Sesos, 28 bytes
Hexdump:
0000000: 16f8be 766ef7 ae6d80 f90bde b563f0 7ded18 3ceffa  ...vn..m.....c.}..<..
0000015: b1c1bb af9f3f ff                                  .....?.

Try it online!
(Exponential time because in Sesos copying a number needs exponential time.)
Assembly used to generate the binary file:
set numin
set numout
get
jmp
sub 1
fwd 1
add 1
fwd 1
add 1
rwd 2
jnz    ;input input
fwd 4
add 1  ;input input 0 1
fwd 2
add 1  ;input input 0 1 0 1
rwd 4
jmp
jmp    ;input input-curr curr next iterations
sub 1
jnz    ;input 0 curr next iterations
fwd 3
add 1
jmp
sub 1
fwd 2
add 1
rwd 2
jnz    ;input 0 curr next 0 0 iterations+1
rwd 1
jmp
sub 1
fwd 1
add 1
fwd 1
add 1
rwd 2
jnz    ;input 0 curr 0 next next iterations+1
rwd 1
jmp
sub 1
fwd 1
sub 1
fwd 2
add 1
rwd 3
jnz    ;input 0 0 -curr next curr+next iterations+1
rwd 2
jmp
sub 1
fwd 2
add 1
fwd 1
add 1
rwd 3
jnz    ;0 0 input input-curr next curr+next iterations+1
fwd 3
jnz
fwd 3
put

Java 8 61 bytes
Same as @dainichi answer only made shorter by using Java 8 lambdas. The answer is a valid rvalue expression.
n->{int a=0,b=1,c=0,t;while(a<n){c++;t=b;b+=a;a=t;}return c;}

Ungolfed:
interface F
{
    int c(int n);
}

public class Main
{

    public static void main(String[] args)
    {
        F f = n->{int a=0,b=1,c=0,t;while(a<n){c++;t=b;b+=a;a=t;}return c;};
    }
}

Brachylog, 14 bytes
≜∧0;1⟨t≡+⟩ⁱ↖?h

Try it online!
Takes input through the output variable and outputs through the input variable.
≜                 Label the input variable, trying 0, 1, -1, 2...,
  0               then starting with 0
 ∧                (which is not necessarily the input variable)
   ;1             paired with 1,
     ⟨t≡ ⟩        replace the first element of the pair with the last element
     ⟨ ≡+⟩        and the last element of the pair with the sum of the elements
          ⁱ↖?     a number of times equal to the input variable,
             h    such that the first element of the pair is the output variable.

I'm not entirely sure why ≜ is necessary.

APL (Dyalog Extended), 14 bytes
(+.!∘⌽⍨∘⍳¨…)⍳⊢

Explanation soon (TM)
Try it online!

I think four months is longer than "soon"

Vyxal, 6 4 bytes
ÞFḟ›

Try it Online!
-2 thanks to Deadcode
1 byte longer than it should be just because Vyxal's "Fibonacci sequence" builtin does not start with 0.

Why didn't you just do ÞFḟ› for 4 bytes?

You forgot to change the code in the code block.

C89 (clang), 54 bytes
a,b,r;g(f){for(a=r=0,b=1;a<f;++r)b+=a,a=b-a;return r;}

Try it online!

Japt, 8 bytes
ô!gM è<U

Try it
Original, 9 bytes
Can handle larger inputs than the version above.
nMgV°)©Òß

Try it

J, 32 27 17 bytes
i.~0,+/@(!|.)\@i.

Computes the first n Fibonacci numbers and then finds the index of n in that list.
Usage
Extra commands are used for formatting multiple input/output. The last test case is omitted since it will require much more time to compute.
   f =: i.~0,+/@(!|.)\@i.
   (,.f"0) 0 1 2 3 5 8 13
 0 0
 1 1
 2 3
 3 4
 5 5
 8 6
13 7

Explanation
i.~0,+/@(!|.)\@i.  Input: n
               i.  Get the range [0, 1, ..., n-1]
             \@    For each prefix of that range
          |.         Reverse the prefix
         !           Find the binomial coefficient between each value in the original
                     prefix and the reversed prefix
     +/@             Sum those binomial coefficients
                   This will create the Fibonacci numbers from 1 to n
   0,              Prepend a 0 to the list of Fibonacci numbers
i.~                Find the index of n in that list and return

Pyth, 13 bytes
J1tf>=Z+~JZZQ

Test suite.
Approximation in Python 2:
Z=0;J=1;T=1;Q=input()
while not J+Z>Q:
    temp=J
    J=Z
    Z=temp+J
    T += 1
print(T-1)

alternative approach, 18 bytes
L?<b2bsyMtBtbs.IyG

Test suite.
This uses .I for inverse.

Java 7, 89 bytes
int c(int n){int i=-1;while(f(++i)<n);return i;}int f(int n){return n<2?n:f(n-1)+f(n-2);}

Inspired by the explanation of @Adnan's 05AB1E answer.
Ungolfed & test cases:
Try it here. (Time limit exceeded for last test case, but it works in about 30-45 seconds on my PC.)
class Main{
  static int c(int n){
    int i = -1;
    while(f(++i) < n);
    return i;
  }

  static int f(int n){
    return n < 2
             ? n
             : f(n - 1) + f(n - 2);
  }

  public static void main(String[] a){
    System.out.println(c(0));
    System.out.println(c(2));
    System.out.println(c(3));
    System.out.println(c(5));
    System.out.println(c(8));
    System.out.println(c(1836311903));
  }
}

Output:
0
3
4
5
6
46

Perl 5.10, 48 bytes
Basically looking for the right n so that F(n) = input.
-a switch adds one byte.
$b++;while($_>$a){$c=$a;$a+=$b;$b=$c;$n++}say$n

Try it here!

Jelly, 9 bytes
‘RḶUc$S€i

Finds the first n+1 Fibonacci numbers and locates the index of n in that list.
Note: This is very inefficient and large test cases should not be run on the online interpreter.
Try it here.
Explanation
‘RḶUc$S€i  Input: n
‘          Increment n
 R         Generate the range [1, 2, ..., n+1]
           For each value x in that range
  Ḷ          Create the range [0, 1, ..., x-1]
   U         Create a reversed copy
    c        Compute the binomial coefficient between each pair of values
     $       Combine the last two links (Uc) as a monad
      S€   Sum each list of binomial coefficients
           This will result in a list of the first n+1 Fibonacci numbers
        i  Find the index of n in that list and return

Mathematica, 30 bytes
Round@Log[5^.5/2+.5,.8+5^.5#]&

Pure function; returns 2 if the input is 1.
Doesn't beat the other Mathematica entry, but showcases an unusual method: It's a (very cool) fact that the Nth Fibonacci number is the closest integer to [1/sqrt(5) times the Nth power of the golden ratio] ("Binet's formula").
Therefore the inverse function will be the base-[golden ratio] logarithm of [sqrt(5) times the Fibonacci number in question]. The .8+ is a hack to make sure we don't take the logarithm of 0, without screwing up the other values.

Groovy, 38 bytes
{a=c=0;b=1;for(;a<it;b+=(a=b-a))c++;c}

Japt, 10 bytes
Lo æ@U¥MgX

Try it online!
Explanation
Lo æ@U¥MgX
Lo           // Creates a range from 0 to 99
   æ@        // Iterates through the range. Returns the first item X where:
     U¥      //   Input ==
       MgX   //   Xth Fibonacci number

Jelly, 5 bytes
‘ÆḞ€i

Try it online!
Nothing special here, just an updated version of Jelly
How it works
‘ÆḞ€i - Main link. Takes n on the left
‘     - Yield n+1
   €  - For each k = 1, 2, ..., n+1:
 ÆḞ   -   Yield the k'th Fibonacci number
    i - Return the index of n in this list

x86-64 machine code, System V calling convention, 16 bytes
31 c0 99 6a 01 59 0f c1 d1 ff c0 39 fa 75 f7 c3

In assembly:
fib:
    # initialize registers: rax=0, rdx=0, rcx=1
    xor eax,eax
    cdq
    push 1
    pop rcx
fib_loop:
    # add registers and swap over and over
    # until the result equals the input
    xadd ecx,edx
    inc eax
    cmp edx,edi
    jne fib_loop
    ret

Try it online!
Explicitly computes the nth Fibonacci number in ecx and edx, while keeping track of the count in eax. Takes input in rdi and returns in rax, as usual for 64-bit x86.

Javascript (using external library) (84 bytes)
n=>_.Until((i,a)=>{l=a.length;if(a[l-1]!=n){return i<=1?i:a[l-1]+a[l-2]}}).Count()-1

Link to lib: https://github.com/mvegh1/Enumerable
Code explanation: Library has static method that creates a sequence until the predicate has an undefined return value. The predicate has a signature of ("i"ndex, current internal "a"rray generated). At each iteration, we check if the last element of the internal array is equal to the input, n. If not, return the next value in the fib sequence. Otherwise, the predicate has an undefined result which terminates the generation of the sequence. Then, we return the length of the sequence (and subtract 1 in order to comply with the 0 based-ness as seen in the OP

53 Bytes by using code from here n=>{a=c=t=0,b=1;while(a<n){c++;t=b;b+=a;a=t}return c} Try it online!

C#, 130 Bytes
Golfed:
int F(int n){var a=new int[4];a[1]=1;int i=0;while(a[3]<n){a[3]=a.ToList().GetRange(1,2).Sum();a[1]=a[2];a[2]=a[3];i++;}return i;}

Ungolfed:
public int F(int n)
{
  var a = new int[4];

  a[1] = 1;

  int i = 0;

  while (a[3] < n)
  {
    a[3] = a.ToList().GetRange(1, 2).Sum();

    a[1] = a[2];
    a[2] = a[3];

    i++;
  }

  return i;
}

Test:
var fibonacciReversed = new FibonacciReversed();

var fr = fibonacciReversed.F(0);
Console.WriteLine(fr);
0

fr = fibonacciReversed.F(2);
Console.WriteLine(fr);
3

fr = fibonacciReversed.F(3);
Console.WriteLine(fr);
4

fr = fibonacciReversed.F(5);
Console.WriteLine(fr);
5

fr = fibonacciReversed.F(8);
Console.WriteLine(fr);
6

fr = fibonacciReversed.F(13);
Console.WriteLine(fr);
7

fr = fibonacciReversed.F(1836311903);
Console.WriteLine(fr);
46

AWK, 58 bytes
{for(n[++j]++;n[j]<$1;n[++j]=n[j]+n[j-1]){}j=$0?j:0;$0=j}1

Try it online!

Factor + project-euler.002, 23 22 bytes
[ dup fib-upto index ]

Try it online!

Thunno 2, 4 bytes
ĖÆFȮ

Try it online!
Explanation
ĖÆFȮ  # Implicit input
Ė     # Push [0..input] to the stack
 ÆF   # nth Fibonacci number for each
   Ȯ  # Index of input in this list
      # Implicit output