text:
Code-Golf Assembly Line
Note: This challenge has nothing to do with actual assembly language.

As the head of Code-Golf Factory Inc., you must create an assembly line to generate a specific piece of code. Today, the foreman has asked you to produce quines.
Specification:
In this challenge, the goal is to write a quine such that a proper subsection of it is also a quine.
This is code-golf, so the fewest bytes (of the main program) win. Standard loopholes are forbidden, and both the main program and the subsection must be true quines.
The subsection must be at least 2 characters shorter than the main program, meaning that the minimum score is 3 bytes.
You only need 1 subsection of your choice to work.

Does this need to work for all possible subsections of the code?

@JulianLachniet I think the part that needs clarifying is "a subsection of your preference".

I must say, whenever I see a Quine question, my head immediately short circuits.

JavaScript (ES6), 14 bytes
f=_=>"f="+f+""

Try it online!
This subsection is also a quine:
f=_=>"f="+f

Try it online!

Jelly, 5 bytes
”ṘṘ10

Try it online!
The subsection ”ṘṘ is also a quine. Try it online!

The main program is not a true quine.

@LeakyNun Well, ”ṘṘ is a true quine and the definition of a true quine is that a part of your code identifies another part, in this case the ”Ṙ identifies the other Ṙ. I don't think the added 10 makes the ”Ṙ not identify the other Ṙ anymore.

CJam, 10 bytes
11"`_~"`_~

Try it online!
This is also a quine:
"`_~"`_~

Try it online!

V, 13 bytes
ñÉÑ~"qpx:2i2i

Try it online!
The subsection 2i2i is also a quine.

Alice, 13 bytes
"!&d<@o&dh.##

Try it online!
This is also a quine:
"!&d<@o&dh.

Try it online!
This modifies the standard quine by clearing the stack before the relevant string is pushed, and using the stack height to determine how many bytes to output.  This allows any no-op to be added at the end.

Python 2, 60 bytes
This is a really simple answer, so there's probably a shorter one. This is just the standard Python quine twice. The trailing newline is required.
_='_=%r;print _%%_';print _%_
_='_=%r;print _%%_';print _%_

Try it online

Fission, 35 bytes
O abcdefghijklmnopqrstuvwxyz '#_OR"

Try it online!
An atom starts at R travelling right. The " toggles print mode, so it wraps around and prints everything until it encounters " again. This stops printing and sets the mass of the atom to the number of characters printed (34). It wraps around again, and O destroys the atom and prints the ASCII character represented by its mass, which is ".
This contains the simple Fission quine,
'#_OR"

Try it online!
Here, '# sets the mass of the atom to the ASCII value of # (35), and _ decrements it so that the O prints a quotation mark.
Fission, 8 bytes
'#_O  R"

Since the simple quine above starts at R and ends at O, any length quine can trivially be created by adding characters between the two.


text:
Who will win Ghost?
The game of Ghost is played between two players who alternate saying a letter on each turn.  At each point, the letters so far must start some valid English word.  The loser is the player to complete a full word first.  So, for example, if the letters so far are E-A-G-L, then the only valid next letter to say is "E" and so the next player will lose.  (Even though there are longer words such as "eaglet".)
The challenge
You are to write a program or function to determine, given the letters so far, who will win assuming two perfect players.  The input is a string representing the current state of the game, and a list of strings representing the dictionary of valid words.  The output should distinguish whether the next player to go will win or lose.
Details

The code must handle the case where the current state is empty.  However, you may assume no word in the dictionary is empty.
You may assume that each input string consists only of lowercase ASCII letters, i.e. a-z.
You may assume the current state and all words in the dictionary have at most 80 characters each.
The dictionary is guaranteed to be nonempty (to avoid the case where there is no valid first move).
You may assume the "current state" will be valid: there will necessarily be some word starting with the current state; also, the current state will not be a full word, nor will any prefix of the current state be a full word.
The dictionary will be prefiltered according to the rules of which "English words" are considered to be valid for the game - so for example, for a variant in which words of three or fewer letters don't end the game yet, the dictionary will be prefiltered to include only the words of four or more letters.
You may assume the dictionary will be presorted.

Examples
Suppose the dictionary is:
abbot
eager
eagle
eaglet
earful
earring

Then for the following current states, the output should be as follows:
Current state   Result
=============   ======
                loss
a               win
eag             win
eagl            loss
ear             win
earf            win
earr            loss

Likewise, for the word list at https://raw.githubusercontent.com/dschepler/ghost-word-list/master/wordlist.txt (produced on a Debian system using pcregrep '^[a-z]{4,80}$' /usr/share/dict/american-english) here is a possible session:
Current state   Result
=============   ======
                win
h               loss
ho              win
hoa             loss
hoar            win
hoars           loss

(And then the next move completes "hoarse".)
Scoring
This is code-golf: Shortest program in bytes for each programming language wins.

From review queue, I don't think this challenge is unclear. If you do, please post why.

I didn't vote to close, but I think the question could use a description of output. Must output be a boolean? One of two values? One of many values partitioned in two?

I'm fine with anything from which deriving a win/loss result is trivial.  Either a truthy/falsey dichotomy (in either order), or one of two values, or something like positive vs. negative integer result, etc.

@mbomb007 I have voted as unclear.  I can't really say what is unclear specifically because I don't understand the question.  I've read it five times now and I still do not understand the task at all.

@WheatWizard Each player must choose the next letter such that the partial word is still a prefix of a word in the dictionary. When there are no longer any such choices, then the game ends with the last player to go as the loser.

@WheatWizard A possible game (and thought processes of more naive players): Alice: (I'll try to force "abacus") "A". Bob: (I'll try to force "arise".) "R". Alice: (I'll try to force "aria") "I". Bob: (Playing right into my hands) "S". Alice: (Shoot, I can only think of "arise", "arisen", "arises" now.) "E, you win."

Test cases that allow more branching choices would be good.

you have a case where "ear" should win, but how? it matches two words in that dictionary: "earful","earring". And then the quickest way to a word is "earful". But no mater how it is played, with these perfect players, the opposition will. The game would play out as the following: p1: ear, p2: earf, p1: earfu, p2: earful.

@Dennis.Verweij With ear as given prefix, I would chose R, leaving only earring as possible match. Opposite must pick I, I pick N, opposite must pick G and loses.

JavaScript, 54 bytes
l=>g=w=>!(w+0)||l.some(t=>t==w||!g(t.match(`^${w}.`)))

call it like this: f(wordlist_as_array)(current_word_as_string), it return true for win, false for lose.
quite bad performance T_T , only work with the small test case.

f=
l=>g=w=>!(w+0)||l.some(t=>t==w||!g(t.match(`^${w}.`)))

Word List:
<textarea id="wl"></textarea>

Current:<input type="text" id="c" />

<button onclick="out.textContent = f(wl.value.split('\n'))(c.value)">Check</button>

Result: <output id="out"></output>

Wow, that's an ingenious null-check!

Python 3, 135 129 84 bytes
-4 bytes thanks to Mr. Xcoder!
-42 bytes thanks to Daniel Schepler!
g=lambda s,l:(s in l)or-min(g(w,l)for w in{w[:len(s)+1]for w in l if w[:len(s)]==s})

Try it online!
A 1 indicates the current player will win, whereas a -1 indicates they will lose.

133 bytes

Not sure, but 131 bytes?

On the full 61135-word dictionary I posted at github and empty state I haven't been able to run it to completion (it's been running several minutes already).  I don't know the custom here for whether you need to be able to run all the test cases I posted in a reasonable time.  (On the sandbox post, I did initially have a requirement that the code not be "horribly inefficient" but commenters suggested either dropping that or specifying an asymptotic running time - and I was afraid saying "linear in the size of the input" would be too restrictive.)

Here is an experiment with using an intermediate set to eliminate the duplicate recursive calls.  With this, it's at least able to process the full dictionary in a few minutes.  (I was also experimenting with another simplification, so the net result is a decrease to 87 bytes.)

@DanielSchepler Nice! I was working on a similar way to reduce recursive calls, but your method is a lot more concise! It also allows me to reduce this to a lambda.

PHP, 192 154 100 98 bytes
function t($w,$d){foreach(preg_grep("#^$w#",$d)as$p)if($p==$w||!t($w.$p[strlen($w)],$d))return 1;}

function returns 1 for win, NULL for loss.
Call with t(string $word,array $dictionary)
or try it online.
breakdown
function t($w,$d)
{
    // loop through matching words
    foreach(preg_grep("#^$w#",$d)as$p)if(
        $p==$w                      // if word is in dictionary (previous player lost)
        ||                          // or
        !t($w.$p[strlen($w)],$d)    // backtracking is falsy (next player loses)
    )
        return 1;                   // then win
    // implicit return NULL
}

C++, 243 bytes (noncompetitive)
FYI, here's the golfed version of my reference implementation (marked as noncompetitive since it's my own challenge).  It expects the word list in the w parameter to be a null-terminated array (of null-terminated strings).  It returns 1 if the next player will lose, or 0 if the next player will win.
#define r return
int g(char*s,char**w){struct N{int d=0;N*c[128]{};int l(){if(d)r 0;for(N*p:c)if(p&&p->l())r 0;r 1;}void a(char*s){*s?(c[*s]?:c[*s]=new N)->a(s+1),0:d=1;}N*f(char*s){r*s?c[*s]->f(s+1):this;}}d;for(;*w;d.a(*w++));r d.f(s)->l();}

Try it online.
Expanded and commented version:
int g(char* s, char** w) {
    /// Node of the prefix tree
    struct N {
        int d = 0;  ///< 1 if the node represents a word in the dictionary
        N* c[128] {};  ///< child nodes, indexed by integer value of character

        // Optional, if you want to eliminate the memory leak from the
        // golfed version.  (Though actually in practice, I would make
        // "c" into std::array<std::unique_ptr<N>, 128> so the default
        // destructor would be sufficient.)
        // ~N() { for (N* p : c) delete p; }

        /// \retval 1 if the next player going from this node will lose
        /// \retval 0 if they will win
        int l() {
            if (d)
                return 0;  // last player lost, so the player who would
                           // have gone next wins
            for (N* p : c)
                if (p && p->l())
                    return 0;  // found a letter to play which forces the
                               // other player to lose, so we win
            return 1;  // didn't find any such letter, we lose
        }

        /// Add word \p s under this node
        void a(char* s) {
            *s ?
                (c[*s] ?: c[*s] = new N) // use existing child node or create new one
                ->a(s+1), 0  // the ,0 just makes the branches of
                             // the ternary compatible
            :
                d = 1;
        }

        /// Find node corresponding to \p s
        N* f(char* s) {
            return *s ?
                c[*s]->f(s+1)
            :
                this;
        }
    } d;  // d is root node of the prefix tree

    // Construct prefix tree
    for (; *w; d.a(*w++))
        ;

    // Find node for input, then run the "loser" method
    return d.f(s)->l();
}

source: Stack Exchange

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

sort: votes


text:
Oreo? No... Lollipop, maybe?
Since 2009, Android's version code names have been confectionery-themed. Android 1.5 is Cupcake, Android 1.6 is Donut, Android 2.0 is Eclair, etc.. In fact, the version names are alphabetical!
C -> Cupcake
D -> Donut
E -> Eclair
F -> Froyo
G -> Gingerbread
H -> Honeycomb
I -> Ice Cream Sandwich
J -> Jellybean
K -> Kitkat
L -> Lollipop
M -> Marshmallow
N -> Nougat
O -> Oreo

In order:
Cupcake, Donut, Eclair, Froyo, Gingerbread, Honeycomb, Ice Cream Sandwich, Jellybean, Kitkat, Lollipop, Marshmallow, Nougat, Oreo

Challenge
Write a program/function that takes a letter from C to O and outputs its respective Android version code name.
Specifications

Standard I/O rules apply.
Standard loopholes are forbidden.
You can choose to either support lowercase input or uppercase input or even both.
The output may be in title case (Cupcake) or completely lower case (eclair). Ice cream sandwich may be capitalized however you like. (I didn't expect it to cause so much confusion...)
This challenge is not about finding the shortest approach in all languages, rather, it is about finding the shortest approach in each language.
Your code will be scored in bytes, usually in the encoding UTF-8, unless specified otherwise.
Built-in functions (Mathematica might have one :P) that compute this sequence are allowed but including a solution that doesn't rely on a built-in is encouraged.
Explanations, even for "practical" languages, are encouraged.

Test cases
These are uppercase and title case.
Input   Output

F       Froyo
I       Ice Cream Sandwich
J       Jellybean
N       Nougat
G       Gingerbread
L       Lollipop

In a few better formats:
F, I, J, N, G, L
f, i, j, n, g, l

F I J N G L
f i j n g l

@WheatWizard That's much harder though

@Mr.Xcoder Are you saying its not a dupe because its easier?  This is a dupe precisely because it is an easier version of an existing question.  We've already done this type of question to death and this one provides absolutely nothing new or interesting to the genre.

@WheatWizard I think the former is a better dupe, since the latter is restricted source.

It might be a dupe of some other challenge. But Help me recognize my monster is asking for string to symbol conversion (which leads to hash-based solutions). This one is asking for symbol to string.

FYI, It should be Jelly Bean, with a space. https://en.wikipedia.org/wiki/Android_Jelly_Bean

Darn, I lost the chance of incrementing everybody's byte count by 1.

If you want to be correct on the versions, you should probably just update it and tell people to change their answers.

No, that's a little too annoying, don't you think?

@totallyhuman you can do what I did on the nun challenge and update each one individually :P

Should it be Ice Cream Sandwich or Ice cream sandwich? The initial code block suggests the former but the test cases suggest the latter. The current winning answer requires Ice cream sandwich, but The output may be in title case (Cupcake) or completely lower case (eclair)..... Ice cream sandwich is not in title case.

Ice Cream Sandwich is title case. And, again, all of those are fine.

In Ice cream sandwich the c and s are not capitalized.

Ah, I see my mistake. Updated. :)

coughs

@MagicOctopusUrn Yeah, I saw that, too. Unfortunately, it doesn't include MARSHMALLOW and later.

Closely related

Note: Cupcake wasn't the first confectionary themed codename: Android 1.1 had the internal codename "Petit four" which is a small bite-sized confectionery, pastry or biscuit.

Charcoal, 73 bytes
θ§⪪”%↖↙1¬¢/vy⁵⸿ψＪPP±≔Ｓ×5Jρνξ–Ｇu ◧；Yx³F▶ψ;εB↥:P¹N﹪J$α✂χ✳⦄⟲*±¶Sp:ς↘Ｖ◧◧”x℅θ

Try it online! I/O is in lower case. Based on this verbose version. Explanation:
                Implicitly print:
θ               Input character
                Implicitly print:
   ”...”        Long compressed string "oneycombx...xingerbread"
  ⪪            Split on
        x       The string "x"
 §              Circularly indexed by
          ℅     Character code of
           θ    Input character

I... What? How.

@MagicOctopusUrn Sorry I was too busy to add an explanation at the time. Hope this one suffices.

Oh wow, I didn't know it did compressed strings!

How Charcoal beats SOGL here is just unbelievable.

Jelly's still beating it :joy: https://codegolf.stackexchange.com/a/140092/73675

@Neil you can just remove the comma in the verbose version :P

Bash + Core Utils 131 128 122 117 bytes.
The script is encoded as Base64 because it contains special (weird) characters.
Accepts the Android codename letter only in lowercase as its first positional parameter. Returns the full codename also in lowercase.
CiPBUeICicG5tJ8W5a0Pc/hYuw7hkNMSIYkAPjARkdgFrdbh3NJgTmB4gRPiiQDJAaOyBH4ki14C
QDeKRNQJ8IJYER411DAnx0SO4CAKYmFzZTMyICQwfHRyICdBLVo0NwonICdhLXoKICd8Z3JlcCBe
JDEK

Explanation:
#�Q��������s�X����!�>0�������`N`x������~$�^@7�D�    ��X5�0'�D��
base32 $0|tr 'A-Z47
' 'a-z
 '|grep ^$1

The first two lines are the binary blob with the data (see a the end of the answer for more information). The first line is empty, to avoid problems with Bash, as otherwise it may think that is being fed with a binary file.
base32 $0 encodes the script contents with Base32, with the default line wrapping of 76 characters.
tr 'A-Z47\n' 'a-z\n ' (note that the \n is written as a literal newline) will lowercase the input and replace 4, 7 and \n by \n, space and space respectively.
grep ^$1 will output the lines matching the string provided as first argument to the script.

Binary data
This octet stream was forged so it doesn't contain newlines and when it's decoded with Base32 as per RFC 4648, the resulting string is the list of Android codenames (using 4 as item delimiter and 7 to replace the space character). Among its peculiarities, it begins with a newline character and a hash (#) so it behaves as a comment and, therefore, isn't executed by the interpreter.
Also, the default line wrapping to 76 characters of this Base32 implementation helped me a byte, as I reordered the items to use the line break as one of the Ice cream sandwich spaces.

Also, and going a bit off-topic, I think that Google shouldn't indirectly advertise commercial products in the Android codenames.

Nice, this is a really cool answer! Welcome to the site :)

Another Bash answer: https://codegolf.stackexchange.com/a/140147/41835

This version is buggy, at least on my system (bash 4.4.12, coreutils 8.27). For f, it outputs two lines: one with froyo and another with mysterious fgeyltmuzteibno.

@MarSoft: Thanks! Fixed. The pity is that now I need a byte more.

@MarSoft: Solved! Now with the same bytes!

Jelly, 57 bytes
Oị“¡ȥọ⁴ḷæĿɱ}#n#i®ÞSỊ3ƙɼıjṁ)-⁵g7ḥjC?4ƘẠʂ+ḋ¤⁺jṣð£?v»Ḳ¤F⁾! y

Try it online!
-5 thanks to Jonathan Allan.

Save four bytes by using a placeholder for the spaces in "ice cream sandwich" and using spaces for splitting, for example: Oị“¡ḟ¤Y7bh%XO€ḥıṣẎṄṢ°ḊḞİỌĿż0Y⁷ẠỵƈƭV>tÐNY_LɠðṅẒọX?v»Ḳ¤F⁾! y

...actually make that five bytes (I had used "lair" when "clair" is in the dictionary): Oị“¡ȥọ⁴ḷæĿɱ}#n#i®ÞSỊ3ƙɼıjṁ)-⁵g7ḥjC?4ƘẠʂ+ḋ¤⁺jṣð£?v»Ḳ¤F⁾! y

@JonathanAllan thanks...wait why would I need the F? oh it's because I get input as a string not char

Bash + Core Utils (Grep): 132 130 Bytes
Simple as could be
grep ^$1<<<'Cupcake
Donut
Eclair
Froyo
Gingerbread
Honeycomb
Ice Cream Sandwich
Jellybean
Kitkat
Lollipop
Marshmallow
Nougat
Oreo'

Input via dd is clever, but could you save as a script and use $1 instead?

Python 3, 139 bytes
lambda x:x+'upcake,onut,clair,royo,ingerbread,oneycomb,ce cream sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo'.split(",")[ord(x)-67]

Try it online!

C++, 206 201 198 bytes
Thanks to @sergiol for helping to save 3 bytes!
#import<cstdio>
void f(int l){char*w[]={"upcake","onut","clair","royo","ingerbread","oneycomb","ce Cream Sandwich","ellybean","itkat","ollipop","arshmallow","ougat","reo"};printf("%c%s",l,w[l-67]);}

Try it online!
C, 173 bytes
f(l){char*w[]={"upcake","onut","clair","royo","ingerbread","oneycomb","ce Cream Sandwich","ellybean","itkat","ollipop","arshmallow","ougat","reo"};printf("%c%s",l,w[l-67]);}

Well, it started as C++, but now it's also valid C, and some bytes can be saved by compiling it as C.
Try it online!

My failed attempt to turn it shorter by removing the first letter of each entry: https://tio.run/##TZCxboMwEIZ3nsJyFAEJ6dgqAbLkATp0pAzGGLBy@CxjCyHEs1Obqbd81n@/T/8d1/rWc77vJ6k4uFaQYrKtxI/hGTFnkXSJVJZAuvKBmctc1eVKnebsLWhGUTnrwYFJ42lwQQ@pemEaI1h7WMTCcWyCTZCXV0fyw1Q7Sz54TQAsjWAqfLNvFqYhgNSo/YuZaRgZAM5Bdv3RNgLploc0RFf3e51P2viIXaIzeubniWaQzRXcPr/qNDfCOqPIRefbvw0lTjYEeUZRWG5kUiVptEbEV4eGJMd0KONXnBMoyvjb83qF9HCE8jd6PDg6S4rCnwjSQPqraB5t@x8

@sergiol Thanks! I was able to save three bytes with that after a bit of golfing.

#import in c++? what am I missing here?

@AbhinavGauniyal: IIRC I think some compiling warning advised me also  to add #import <cstdio> because the lack of #include <stdio.h>; or may be I am wrong

@AbhinavGauniyal It's not standard C++, but at least GCC and MSVC have it.

JavaScript (ES6), 137 136 bytes
Saved 1 byte thanks to Neil
c=>'CupcakeDonutEclairFroyoGingerbreadHoneycombIce Cream SandwichJellybeanKitkatLollipopMarshmallowNougatOreo'.match(c+'([a-z]| .)+')[0]

Demo

let f =

c=>'CupcakeDonutEclairFroyoGingerbreadHoneycombIce Cream SandwichJellybeanKitkatLollipopMarshmallowNougatOreo'.match(c+'([a-z]| .)+')[0]

;[...'CDEFGHIJKLMNO'].map(c => console.log(c, '->', f(c)))

can't you include the space in the character range, probably with \s? haven't used much JS Regex

@michi7x7 Hes need the match to stop at an uppercase letter except in the case of Ice Cream Sandwich, although ([a-z]| .)+ (saving 1 byte) would work even with Ice Cream Sandwich in the middle of the string (it would start failing when code names reached S though).

@Neil well, [a-z\s]+ doesn't match uppercase letters. I just don't know if you can do that in JS

@michi7x7 So how would it work with Ice Cream Sandwich?

Use Ice cream sandwich, like in the test case (although this is not Title Case)

@michi7x7 Ah, yes. I didn't notice it was allowed. Thanks!

@michi7x7 Ah, I see proper case is allowed too so yes [ a-z]+ would work in that case.

Japt, 81 79 bytes
Contains a few characters that won't display here.
U+`Æ+tfÆ÷¯kef©fclairfê $ßdfey¬mbf ×Äm ÑØrfÁKÞ fkfo¥ipopfÂâÚaow`qf gUc

Test it

2 bytes saved thanks to Oliver.

Explanation
Implicit input of uppercase character string U.
A compressed string (everything between the backticks) of the names, separated with an f and without their first letter is split (q) into an array on f.
Within that array we get the element at the index (g) of Us character code. (Yay, index wrapping!)
We append that to U and implicitly output the resulting string.

Nice. You can save a couple bytes if you split on f instead if newlines: https://ethproductions.github.io/japt/?v=1.4.5&code=VStgxit0ZpzG969rZWaNqWZjbGFpcmae6gGgJN+EZGaNZXmsbWJmrSDXxG0g0YDYcmbBS94gZoprhWZvpWlwb3BmwuLaYW93YHFmIGdVYw==&input=Ikoi

@Oliver: Oh, nice, thanks :) On my phone, walking down the street so definitely wouldn't have gotten that for a while (if at all).

Excel VBA, 137 134 132  Bytes
Anonymous VBE immediate window function that takes input as expected type Variant\String and length 1 holding a capital letter from cell [A1] and outputs to the VBE immediate window function
?[A1]Split("upcake onut clair royo ingerbread oneycomb ce cream sandwich ellybean itkat ollipop arshmallow ougat reo")(Asc([A1])-67)

-5 Bytes for changing the spaces in ce cream sandwich from   (char 32) to  (char 160)  `` (char 127) and removing comma delimiter in the Split function

SOGL V0.12, 81 bytes
]&ŗ√‰fō¶č▓'▼$»3↕█γb└a}⅟∑─b¹¦Æ:↕┘∞½Σ#gī±⅔≡≥\3Qy-7todΥ7ā‼D←εPρρ:¬c‰ƨ}fæ²‘θ╔@ŗz,WHHw

Try it Here!
Explanation:
...‘            push "cupcake donut eclair froyo gingerbread honeycomb ice_cream_sandwich jellybean kitkat lollipop marshmallow nougat oreo"
    θ           split on spaces
     ╔@ŗ        replace underscores with spaces
        z,W     find the inputs index in the lowercase alphabet
           HH   decrease by 2
             w  get that item from the array

Now there is a shorter 80 byte version, but I added the +2/-2 built-ins because of this challenge :p
The compressed string is split like "cup","cake"," donut eclair fro","yo gingerbread honeycomb ice","_","cream","_","sandwich jelly","bean kit","kat loll","i","pop marsh","mallow"," nougat oreo" for maximum usage of english words (many weren't in SOGLs dictionary), right now I can't find any improvements.

Cubically, 1047 852 830 bytes
Functions sure help golf large programs...
⇒+552
⇒+551
⇒+553
⇒+55
⇒/1+52
⇒/1+53
~@7+4f5=?{:5+53@:4/1f1@:5+51@:5+2/1f4@:5+3/1f2@:2/1f2@}
+5f5=?{:3/1f1@:2/1f1@:5+53@:5+3/1f1@}
+51f5=?{:5+51@+1@:5+2/1f4@:5+1/1+551@+1@}
+52f5=?{:5+1/1f1@:3/1f1@:4/1f3@:3/1f1@}
+53f5=?{:5+1/1f2@:2/1f1@:4/1f2@:2/1f2@:5+1/1f1@:5+3/1f4@:5+1/1f1@:2/1f2@:5+2/1f4@:1/1f2@}
+53=?{:3/1f1@:2/1f1@-1@:4/1f3@:5+51@:3/1f1@:1/1f1@:5+3/1f4@}
+1f6=?{:5+51@:2/1f2@:5/1+3@:4/1+52@:5+1/1f1@:2/1f2@:5+2/1+55@:1/1f1@:5/1+3@:2/1+54@:5+2/1f4@6:2/1f1@6:1/1f2@6:2/1f3@6:5+1/1f2@6:5+51@6:5/1f2@6}
+2f6=?{:2/1f2@:5+52@@:4/1f3@:5+3/1f4@:2/1f2@:5+2/1f4@:2/1f1@}
+3f6=?{:5+1/1f2@:5+3/1f1@-1@:5+2/1f4@:5+3/1f1@}
+4f6=?{:3/1f1@:5+52@@:5+1/1f2@:4/1f1@:3/1f1@:4/1f1@}
+5f6=?{:5+2/1f4@:5+1/1f1@:5+2/1f1@:5/1f2@:1/1f1@:5+2/1f4@:5+52@@:3/1f1@:2/1f3}
+51f6=?{:3/1f1@:5+53@:4/1f2@:5+2/1f4@:5+3/1f1@}
+52f6=?{:5+1/1f1@:2/1f2@:3/1f1@}

Try it online! This is 830 bytes in Cubically's SBCS.

~ reads input, @ prints it. (This breaks when the input is invalid.)
Each of the +.../...+...=7?6{...} compares the input to each ASCII value (C, D, E, F, etc) and executes the code within {...} if they are equal.
Each code block ({...}) prints the rest of the name (the first character is already printed).

Thanks to TehPers' ASCII to Cubically translator which was very helpful.

That's 1060 bytes

><>, 181 bytes
!vi:od5*-0$6a*@p!
v<
 v"upcake"
 v"onut"
 v"clair"
 v"royo"
 v"ingerbread"
 v"oneycomb"
 v"ce Cream Sandwich"
 v"ellybean"
 v"itkat"
 v"ollipop"
 v"arshmallow"
 v"ougat"
 v"reo"
o<>

Try it online!
This works by self-modifying the program to place a < in front of the correct name to print, the position of which is determined by the value of the inputted letter.

Dyalog APL, 158 143 131 bytes
1 byte saved thanks to @Zacharý
12 bytes saved thanks to @Gil
{⍵,(⎕A⍳⍵)⊃','(1↓¨=⊂⊢)',,,upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo'}

Try it online!
How?
',,,upcake...' - list of words
','(1↓¨=⊂⊢) - split by ','
(⎕A⍳⍵)⊃ - take from the place of the argument in the alphabet
⍵, - and append to the letter

Why did you describe ↑ as flatten?

Also, {⍵,∊⍬⍬'upcake' 'onut' 'clair' 'royo' 'ingerbread' 'oneycomb' 'ce cream sandwich' 'ellybean' 'itkat' 'ollipop' 'arshmallow' 'ougat' 'reo'[⎕A⍳⍵]} works for 1 less byte!

@Zacharý because it is... "mix". nice one! why ∊ and not ↑?

Because ∊ is flatten as well, but actually flatten and not "mix". ↑(1 2)(3 4) is NOT flat, while ∊(1 2)(3 4) is.

@Zacharý OP changed that... AGAIN.

Use a single string for all and partition it to save another 12 bytes: {⍵,(⎕A⍳⍵)⊃','(1↓¨=⊂⊢)',,,upcake,onut,....

Do as Gil said, that is amazing.

@Gil nice one! I tried with regex before but it was too long.

Too tired to think clearly now, but another option is to skip separators and only use an initial capital letter for each version and partition it that way (you might find a way to shorten the expression further): 'ABCupcakeDonutEclair..'∘{⍺/⍨(+\⍺∊⎕A)∊⎕A⍳⍵}'D'

@Gil I think I have an even shorter solution, but I'm afk til tomorrow, so I'll test it when I get to the ws

Yeah, going off of Gil's comment, {⍵/⍨(+\⍵∊⎕A)∊⎕A⍳⍞}'...' should save 1 more byte than Gil's suggestion.

Outgolfed

Outgolf Zacharý with Gil's suggestion: (⎕A⍳⍞)⊃'ABCup…Oreo'(∊⊂⊣)⎕A

I could steal that solution, but considering I was inspired by "I think I have an even shorter solution," so I won't do the whole percent mess again (Answers going between me and Cowsquack, which ended up with like 4 APL answers).

C (gcc), 195 192 190 bytes
-2 bytes thanks to @Quentin
*V[]={"upcake","onut","clair","royo","ingerbread","oneycomb","ce Cream Sandwich","ellybean","itkat","ollipop","arshmallow","ougat","reo"};main(c,v)char**v;{printf("%c%s",c,V[(c=*v[1])-67]);}

Try it online!

Tcl, 158 bytes
proc A s {puts $s[lindex {upcake onut clair royo ingerbread oneycomb "ce Cream Sandwich" ellybean itkat ollipop arshmallow ougat reo} [expr [scan $s %c]-67]]}

Try it online!

Tcl! You don't see too many Tcl solutions on here. It's a shame.

EXCEL, 154 bytes
=A1&CHOOSE(CODE(A1)-66,"upcake","onut","clair","royo","ingerbread","oneycomb","ce Cream Sandwich","ellybean","itkat","ollipop","arshmallow","ougat","reo")

I've never thought of using excel in this way. Perfect. Now do it with WORD

@tisaconundrum - we do not speak of that accursed thing; Even VBA could not save it

Pyth, 117 116 bytes
Port of my Python answer.
+Q@c"upcake,onut,clair,royo,ingerbread,oneycomb,ce cream sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"\,a67C

Try it here! or Check out the Test Suite
Pyth, 99 bytes (70 characters)
-15 bytes thanks to @insert_name_here!
+Q@c." y|çEC#nZÙ¦Y;åê½9{ü/ãÑª#¤
ØìjX\"¦Hó¤Ê#§T£®úåâ«B'3£zÞz~Ð£ë"\,a67C

Try it here!

You could save 15 bytes by using compressed strings (though the answer would have to contain unprintable characters then).

@insert_name_here Thanks.

Gaia, 110 bytes
:c“reo“upcake“onut“clair“royo“ingerbread“oneycomb“ce Cream Sandwich“ellybean“itkat“ollipop“arshmallow“ougat”=+

Try it online!
Explanation
:          Push two copies of the input
 c         Get the codepoint of the top one
  “...”    Push the list of version names without their first letters
       =   Modularly index the code point into the list
        +  Append to the input

Haskell, 145 bytes
f c=takeWhile(/=succ c)$dropWhile(/=c)"CupcakeDonutEclairFroyoGingerbreadHoneycombIce Cream SandwichJellybeanKitkatLollipopMarshmallowNougatOreo"

takeWhile can be fst.span and dropWhile accordingly snd.span.

Java (OpenJDK 8), 128 bytes
c->c+"upcake#onut#clair#royo#ingerbread#oneycomb#ce Cream Sandwich#ellybean#itkat#ollipop#arshmallow#ougat#reo".split("#")[c-67]

Try it online!

Using regexes, 149 bytes
s->"CupcakeDonutEclairFroyoGingerbreadHoneycombIce cream sandwichJellybeanKitkatLollipopMarshmallowNougatOreo".replaceAll(".*?("+s+"[a-z ]+).*","$1")

Try it online!

4 bytes saved on the regex solution thanks to Kevin Cruijssen!

Was about to post the same .split answer (only with different delimiter) when I read the challenge and couldn't find a Java answer (until I went to the second page of answers), so +1. As for the regex answer, ([a-z]| .)+ can be [a-z ]+, since you are allowed to output "Ice cream sandwich" ("The output may be in title case (Cupcake) or completely lower case (eclair). Ice cream sandwich may be capitalized however you like. (I didn't expect it to cause so much confusion...)")

Ruby, 127 bytes
->c{c+%w[upcake onut clair royo ingerbread oneycomb ce\ Cream\ Sandwich ellybean itkat ollipop arshmallow ougat reo][c.ord-67]}

Takes uppercase input. Try it online!

V, 125 bytes
Ccupcake
donut
eclair
froyo
gingerbread
honeycomb
ice cream sandwich
jellybean
kitkat
lollipop
marshmallow
nougat
oreoÇ^"/d

Try it online!

Recursiva, 130 119 118 bytes
+aYQ'upcake!onut!clair!royo!ingerbread!oneycomb!ce cream sandwich!ellybean!itkat!ollipop!arshmallow!ougat!reo''!'-Oa99

Try it online!

saved 11 bytes thanks to @Mr.Xcoder's idea

Pyke, 117 bytes
Port of my Python answer.
"upcake,onut,clair,royo,ingerbread,oneycomb,ce cream sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"\,cQ.o67-@+

Try it here!
Encoded as hex codes, the new technique of golfing in Pyke, it would be 116 bytes:
22 75 70 63 61 6B 65 2C 6F 6E 75 74 2C 63 6C 61 69 72 2C 72 6F 79 6F 2C 69 6E 67 65 72 62 72 65 61 64 2C 6F 6E 65 79 63 6F 6D 62 2C 63 65 20 63 72 65 61 6D 20 73 61 6E 64 77 69 63 68 2C 65 6C 6C 79 62 65 61 6E 2C 69 74 6B 61 74 2C 6F 6C 6C 69 70 6F 70 2C 61 72 73 68 6D 61 6C 6C 6F 77 2C 6F 75 67 61 74 2C 72 65 6F 22 5C 2C 63 51 EF 36 37 2D 40 2B

(Paste in and check Use hex encoding?).

Pyke needs an "Android releases" builtin right?

@EriktheOutgolfer It has Pokemons, so why not?

R, 131, 126, 123, 112, 178 bytes
grep(paste0('^',scan(,'')),c("Cupcake","Donut","Eclair","Froyo","Gingerbread","Honeycomb","Ice Cream Sandwich","Jellybean","Kitkat","Lollipop","Marshmallow","Nougat","Oreo"),v=T)

Thanks for @Mark for saving 5 + 8 + 3 bytes

C#, 147 136 129 bytes

Data

Input Char c The first letter of the version name
Output String The full name of the version

Golfed
// Requires the input to be uppercase.
// This is the one counting for the challange
c=>c+"upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo".Split(',')[c-67];

// Optional. Requires the input to be lowercase.
c=>c+"upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo".Split(',')[c-99];

// Optional. Works with both uppercase and lowercase with the additional cost of 10 bytes.
c=>c+"upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo".Split(',')[c-(c<99?67:99)];

Ungolfed
c =>
    c + "upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"
        .Split( ',' )[ c - 67 ];

Ungolfed readable
// Takes a char
c =>
    // Appends the input letter to...
    c +

    // ... the name in the resulting index of the subtraction of the char with 67 ('C'), or with 99 ('c') for the lowercase version
    "upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"
        .Split( ',' )[ c - 67 ];

// Takes a char
c =>
    // Appends the input letter to...
    c +

    // ... the name in the resulting index of the subtraction of the char with 67 ('C') if the char is uppercase ( 'C' == 67, 'O' == 79 )
    //    or with 99 ('c') if the char is lowercase ( 'c' == 99, 'o' == 111 )
    "upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"
        .Split( ',' )[ c - ( c < 99 ? 67 : 99 ) ];

Full code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestBench {
    public static class Program {
        private static Func<Char, String> f = c =>
            c + "upcake,onut,clair,royo,ingerbread,oneycomb,ce Cream Sandwich,ellybean,itkat,ollipop,arshmallow,ougat,reo"
                .Split( ',' )[ c - 67 ];

        static void Main( string[] args ) {
            List<Char>
                testCases = new List<Char>() {
                    'C',
                    'D',
                    'E',
                    'F',
                    'G',
                    'H',
                    'I',
                    'J',
                    'K',
                    'L',
                    'M',
                    'N',
                    'O',
                };

            foreach(Char testCase in testCases) {
                Console.WriteLine($" Input: {testCase}\nOutput: {f(testCase)}\n");
            }

            Console.ReadLine();
        }
    }
}

Releases

v1.0 - 147 bytes - Initial solution.
v1.1 - -11 bytes - Borrowed Olivier Grégoire's idea.
v1.2 - - 7 bytes - Changed the function input from explicit to implicit.

Notes

None

Could you save anything by removing the first letter from each name and appending the string you retrieve from the array to the input character?

(char c) can just be c

R, 169 155 bytes
sub(paste0(".*(",scan(,""),"[^A-Z]+).*"),"\\1","CupcakeDonutEclairFroyoGingerbreadHoneycombIce cream sandwichJellybeanKitkatLollipopMarshmallowNougatOreo")

Dyalog APL, 125 bytes
{⍵/⍨⍞=⎕A[+\⍵∊⎕A]}'ABCupcakeDonutEclairFroyoGingerbreadHonecombIce cream sandwichJellybeanKitkatLollipopMarshmallowNougatOreo'

Try it online!
How?

⍵∊⎕A ⍵ (the long string) with 1 for capital letters, 0 for lowercase/spaces.
+\ Group (returning numbers) ⍵ by capital letters.
⎕A[...] The capital letter signified by a number
⍵/⍨⍞=  The group signified by that number
{...}'...' Set ⍵ to the long string

Clever approach.

PowerShell, 136 134 bytes
param($c)$c+('upcake0onut0clair0royo0ingerbread0oneycomb0ce cream sandwich0ellybean0itkat0ollipop0arshmallow0ougat0reo'-split0)[$c-99]

Try it online!
Takes a [char] input character, in lowercase, and outputs in lowercase.
-2 thanks to AdmBorkBork's suggestion to -split0 instead of -split','.

You could use 0 as a separator and then -split0 to save the quotes.

@AdmBorkBork good suggestion, thanks!

C (gcc), 168 bytes
main(){puts(memchr("Cupcake\0Donut\0Eclair\0Froyo\0Gingerbread\0Honeycomb\0Ice cream sandwich\0Jellybean\0Kitkat\0Lollipop\0Marshmallow\0Nougat\0Oreo",getchar(),117));}

Try it online!

VBA for Word, 163 bytes
a=left(ActiveDocument.Range.Text,1):?a+Split("upcake onut clair royo ingerbread oneycomb ce cream sandwich ellybean itkat ollipop arshmallow ougat reo")(asc(a)-67)

@tisaconundrum asked for Word.  The closest I can get is a port of VBA for Excel solution by @TaylorScott.

C#, 271 characters
var i="Cupcake|Donut|Eclair|Froyo|Gingerbread|Honeycomb|Ice cream sandwich|Jellybean|Kitkat|Lollipop|Marshmallow|Nougat|Oreo";var s=i.Split('|');int b;var c=new char[12];for(b=0;b<12;b++){c[b]=s[b][0];}for(b=0;b<12;b++){if(Console.Read().ToString()[0]==c[b])return s[b];}

Accepts one character from the console input stream, then returns the correct version number. Please tell me if I've done anything wrong or omitted something that should be here, this is my first time golfing.

This is a good first submission, but it looks to be halfway between a function and a full program. Try using arrow notation (x=>...) to define a function and using x instead of Console.Read().

PHP, 133+1 bytes
<?=$argn,[upcake,onut,clair,royo,ingerbread,oneycomb,"ce Cream Sandwich",ellybean,itkat,ollipop,arshmallow,ougat,reo][ord($argn)-67];

no TiO this time. Run as pipe with -nR.

SQL, 2017, 206 bytes
Assuming a function/procedure would have to be created otherwise you can't take input.
CREATE PROCEDURE X(@x VARCHAR)AS SELECT*FROM STRING_SPLIT('Cupcake,Donut,Eclair,Froyo,Gingerbread,Honeycomb,Ice cream sandwich,Jellybean,Kitkat,Lollipop,Marshmallow,Nougat,Oreo',',') WHERE value like @x+'%'

Cannot find a place to show this version online so there's a "slightly" more version-friendly submission
SQL, 244 bytes
CREATE PROCEDURE Y(@y VARCHAR,@x VARCHAR(999)='CupcakeDonutEclairFroyoGingerbreadHoneycombIce cream sandwichJellybeanKitkatLollipopMarshmallowNougatOreoP')AS SELECT STUFF(STUFF(@x,CHARINDEX(CHAR(ASCII(@y)+1),@x),999,''),1,CHARINDEX(@y,@x)-1,'')

Things to note, this is on a case-sensitive database therefore the delimiter could be the capital letter.
Explanation
Database is case-sensitive
Inner STUFF - removes everything from the the next capital letter in alphabet
Outer STUFF - removes everything before the input capital letter

SQL Fiddle worked example, not able to show a case sensitive database online so changed to a comma delimited list that works the same.

SimpleTemplate, 183 bytes
This just simply checks if the first letter of the word is the same or not.
Nothing super fancy.
{@setl"Cupcake","Donut","Eclair","Froyo","Gingerbread","Honeycomb","Ice Cream Sandwich","Jellybean","Kitkat","Lollipop","Marshmallow","Nougat","Oreo"}{@eachl}{@ifargv.0 is_.0}{@echo_}

Ungolded:
{@// array with all the names}
{@set list "Cupcake", "Donut", "Eclair", "Froyo", "Gingerbread", "Honeycomb", "Ice Cream Sandwich", "Jellybean", "Kitkat", "Lollipop", "Marshmallow", "Nougat", "Oreo"}
{@each list as name}
    {@if argv.0 is name.0} {@// name.0 -> first character}
        {@echo name}
    {@/}
{@/}

Try it on http://sandbox.onlinephpfunctions.com/code/002cfd9c5a84546dac3a656f6011b998ccfe33af

Cinnamon Gum, 118 bytes
Hexdump:
0000000: 6c0d cac9 1183 300c 05d0 5638 fd26 74cc  l.....0...V8.&t.
0000010: bed7 2084 020e b2c5 0818 c6dd 87eb 9b77  .. ............w
0000020: 80ac 93f0 a874 44e7 655d e804 15e3 1474  .....tD.e].....t
0000030: c637 bc3a 5dd0 a7d2 6bb4 a1dc d115 8317  .7.:]...k.......
0000040: ade2 b9a5 1b92 6823 bbe7 66e6 d26d 4906  ......h#..f..mI.
0000050: bae3 a766 b555 2ef4 c098 9691 177a c2dc  ...f.U.......z..
0000060: 2c4d 3ed1 0b99 631e 329b f946 6f14 5ffb  ,M>...c.2..Fo._.
0000070: 7d7c e0a1 fe07                           }|....

Try it online!

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:
Unfurling-Safe Quine
Write a proper quine containing at least one newline/linefeed whose every unfurling is either itself a proper quine or outputs the original quine. Your answer can mix and match outputting itself and outputting the original quine.
Unfurlings
Unfurlings consist of:

Appending spaces to make the input a rectangle.
Taking all lines above the bottom one and rotating them a quarter-turn clockwise about the lower-right corner so that the right edge is on the same level as the bottom edge.
Repeat step (2) until the string is a single line to find all unfurlings.

For example, the first unfurling of
GFE
HID
ABC

is
   HG
   IF
ABCDE

and the rest are
   HG
   IF
ABCDE

     IH
ABCDEFG

       I
ABCDEFGH

ABCDEFGHI

This process is automated with this program adapted from Emigna's answer here,where each step of unfurling in the output is delimited by a dashed line.
Example
For example, if you have a program
K
AB

(no trailing spaces)
then it must be a proper quine and print itself('K\nAB', where \n represents a linefeed/newline).
According to the output of the unfurling program, we see that the next step in unfurling is
  K
AB

(note trailing space)
This must either print itself('  K\nAB ') or the original program ('K\nAB').
The next step in the unfurling is
AB K

This must either print itself ('AB K'), or the original program('K\nAB').
The byte-count of this program is 4 (K, \n, A, B).
Score
This is code-golf, so the shortest answer in bytes wins. Standard loopholes apply, as usual.

Related.

I think you could prevent easy answers by instead unfurling onto a new line instead of the last line of the program. However, I'm not sure the challenge is even possible at that point, but it may be.

If our answer has several unfurling steps, do they all have to print the original/themselves, or can some print themselves and some the original?

@MartinEnder The answer can mix and match printing the original and printing themselves.

Python 3, 48 bytes

_='\n_=%r;print(_%%_,end="")';print(_%_,end="")

Try it online!
I mean, it works :p

ಠ_____________ಠ

Can't you golf this down to just one line, _='_=%r;print(_%%_)';print(_%_) ? It contains "at least one newline/linefeed" (at the end)

@L3viathan then the unfurlings go crazy :/

@dzaima I see...

Python 3, 42 bytes

_='\n_=%r;print(end=_%%_)';print(end=_%_)

Try it online!

Is this really distinct enough from dzaima's answer to warrant a new one? To me, this seems simply to be golfed a little.

@fireflame241 I think it deserves its own answer, plus I've written it on my own (not golfed his)

Ruby, 32 bytes

_="\n_=%p;print _%%_";print _%_

Try it online!

CJam, 11 bytes
OK, let's go with the obvious trivial solution.  At least it's shorter than the Python and Ruby solutions that use the same trick.

{N\"_~"}_~

This code begins with a newline, which is ignored by the CJam interpreter.  All the actual code is on the last line, which is not changed by the unfurling process.  The extra spaces and newlines introduced by unfurling the empty first line are also ignored by the interpreter.
Otherwise this is just a trivial tweak of a (or perhaps the) standard CJam quine.  {N\"_~"} defines a code block, _~ makes a copy of it and executes it.  Inside the code block, N\ pushes a newline before the copy of the block on the stack and "_~" pushes the string _~ after it.  When the program ends, the CJam interpreter automatically prints everything on the stack, i.e. the newline, the code block and the _~.
Try it online!


text:
Count forth and back then double up
Let's count...
Count up to 2 and back to 1
Count up to 4 and back to 1
Count up to 6 and back to 1
... ok you got it...
put all these together and you'll get the following sequence
 {1,2,1,2,3,4,3,2,1,2,3,4,5,6,5,4,3,2,1,2,3,4,5,6,7,8,7,6,5,4,3,2,1,2,3...}

Challenge
Given an integer n>0for 1-indexed (or n>=0 for 0-indexed), output the nth term of this sequence
Test cases
Input->Output

1->1
68->6
668->20
6667->63
10000->84

Rules
your program must be able to compute solutions up to n=10000 in under a minute
This is code-golf, so the shortest code in bytes wins!

If I 0-index I have to support n = 0, right? That should probably be clarified.

@Jakob yes you are right! I'll edit

Who decides what takes a minute? A time-optimal Turing machine built from lego would take a really long time, while the same Turing machine simulated in, say, C, would presumably take seconds, or minutes, depending on what processor it runs on. Thus, if I submit said Turing machine description, is it valid?

@Arthur I think that you can understand why I made this restriction...I didn't want an algorithm to take "forever" to find n=10000 by producing a huge list.Most of the people here gave brilliant answers that find millions in seconds.

@BillSteihn I think the restriction is unnecessary.

@EriktheOutgolfer gode golf answers can be tricky...without the restriction an answer that produces 10.000 tuples [1,2...2n..2,1] would be valid.The restriction is only for answers like this.I don't see where the problem is.I just want your answer to find all test cases in a reasonable amount of time.

@BillSteihn And where is the problem with creating something like [1..2..1..4..1..(...)..1..2n..1]?

@EriktheOutgolfer If you want the 10.000th term and you compute 10.000 tuples you will get a list of 50.000.001 elements.You need RAM + time..

@StraklSeth General consensus here is that it should work in theory, not necessarily in practice.

@EriktheOutgolfer ok.. I think that we made clear why I used this restriction.Now,this is my challenge and it doesn't belong to the "General consensus group".sorry

@EriktheOutgolfer Putting reasonable restrictions on output time is a common practice to prevent ridiculous brute-force approaches. It's been done like that dozens, if not hundreds of times here. Individual challenge authors can decide if they want to include a restriction like that or not.

@AdmBorkBork Still "under a minute" isn't well-defined then.

JavaScript (ES7),  59 ... 44  43 bytes
Saved 1 byte thanks to Titus
Expected input: 1-indexed.
n=>(n-=(r=(~-n/2)**.5|0)*r*2)<++r*2?n:r*4-n

Initially inspired by a formula for A004738, which is a similar sequence. But I ended up rewriting it entirely.
Test cases

let f=

n=>(n-=(r=(~-n/2)**.5|0)*r*2)<++r*2?n:r*4-n

console.log(f(1))     // -> 1
console.log(f(68))    // -> 6
console.log(f(668))   // -> 20
console.log(f(6667))  // -> 63
console.log(f(10000)) // -> 84

How?
The sequence can be arranged as a triangle, with the left part in ascending order and the right part in descending order.
Below are the first 4 rows, containing the first 32 terms:
            1 | 2
        1 2 3 | 4 3 2
    1 2 3 4 5 | 6 5 4 3 2
1 2 3 4 5 6 7 | 8 7 6 5 4 3 2

Now, let's introduce some variables:
 row  | range   | ascending part              | descending part
 r    | x to y  | 1, 2, ..., i                | 4(r+1)-(i+1), 4(r+1)-(i+2), ...
------+---------+-----------------------------+-----------------------------------------
  0   |  1 -  2 |                           1 | 4-2
  1   |  3 -  8 |                   1   2   3 | 8-4  8-5  8-6
  2   |  9 - 18 |           1   2   3   4   5 | 12-6 12-7 12-8  12-9  12-10
  3   | 19 - 32 |   1   2   3   4   5   6   7 | 16-8 16-9 16-10 16-11 16-12 16-13 16-14

We start with 2 elements at the top and add 4 elements on each new row. Therefore, the number of elements on the 0-indexed row r can be expressed as:
a(r) = 4r + 2

The 1-indexed starting position x of the row r is given by the sum of all preceding terms in this arithmetic series plus one, which leads to:
x(r) = r * (2 + a(r - 1)) / 2 + 1
     = r * (2 + 4(r - 1) + 2) / 2 + 1
     = 2r² + 1

Reciprocally, given a 1-indexed position n in the sequence, the corresponding row can be found with:
r(n) = floor(sqrt((n - 1) / 2))

or as JS code:
r = (~-n / 2) ** 0.5 | 0

Once we know r(n), we subtract the starting position x(r) minus one from n:
n -= r * r * 2

We compare n with a(r) / 2 + 1 = 2r + 2 to figure out whether we are in the ascending part or in the descending part:
n < ++r * 2 ?

If this expression is true, we return n. Otherwise, we return 4(r + 1) - n. But since r was already incremented in the last statement, this is simplified as:
n : r * 4 - n

Ok, I think I understood. The length of each up-down part is 2,6,10,14... so the sum grows with the square of the rowcount, hence the sqrt. Very nice!

Haskell, 37 bytes
(!!)$do k<-[1,3..];[1..k]++[k+1,k..2]

Try it online!
Zero-indexed. Generates the list and indexes into it. Thanks to Ørjan Johansen for saving 2 bytes!

Haskell, 38 bytes
(!!)[min(k-r)r|k<-[0,4..],r<-[1..k-2]]

Try it online!
Zero-indexed. Generates the list and indexes into it.

Haskell, 39 bytes
n%k|n<k=1+min(k-n)n|j<-k+4=(n-k)%j
(%2)

Try it online!
Zero-indexed. A recursive method.

Python, 46 bytes
f=lambda n,k=2:-~min(n,k-n)*(n<k)or f(n-k,k+4)

Try it online!
Zero indexed.

Husk, 8 bytes
!…ṁoe1DN

1-indexed.
Try it online!
Explanation
!…ṁoe1DN  Implicit input (an integer).
       N  Positive integers: [1,2,3,4,...
  ṁo      Map and concatenate
      D   double: [2,4,6,8,...
    e1    then pair with 1: [1,2,1,4,1,6,1,8,...
 …        Fill gaps with ranges: [1,2,1,2,3,4,3,2,1,2,3,4,5,6,...
!         Index with input.

Perl 6, 29 bytes
{({|(1...$+=2...2)}...*)[$_]}

Try it online
0-based
Expanded:
{  # bare block lambda with implicit parameter ｢$_｣

  (
    # generate an outer sequence

    {           # bare block lambda

      |(        # flatten into outer sequence

        # generate an inner sequence

        1       # start at 1

        ...     # go (upward) towards:

        $       # an anonymous state variable (new one for each outer sequence)
          += 2  # increment by 2

        ...     # go (downward) towards:

        2       # stop at 2 (1 will come from the next inner sequence)

      )
    }

    ...         # keep generating the outer sequence until:
    *           # never stop

  )[ $_ ]       # index into outer sequence
}

The inner sequence 1...$+=2...2 produces
(1, 2).Seq
(1, 2, 3, 4, 3, 2).Seq
(1, 2, 3, 4, 5, 6, 5, 4, 3, 2).Seq
(1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2).Seq
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 2).Seq
...

To get it to be 1-based, add 0, before the second {, or add -1 after $_

R, 64 bytes
function(n)unlist(sapply(seq(2,n,2),function(x)c(2:x-1,x:2)))[n]

Function that takes an argument n. It creates a vector 2:n with increments of 2. For each of these, the vector 1:(x-1) and x:2 is created. This in total will be longer than n. We unlist it, to get a vector and take the n-th entry.

Could you do 1:n*2 instead of seq(2,n,2)? It'll be bigger than you need but that should be fine! Also I don't think this worked with seq(2,n,2) for n=1 anyway!

Jelly, 10, 9 bytes
ḤŒḄṖµ€Fị@

Try it online!
Also 1 indexed, and finishes pretty fast.
One byte saved thanks to @ErikTheOutgolfer!
Explanation:
Hypothetically, let's say the input (a) is 3.
    µ€      # (Implicit) On each number in range(a):
            #
Ḥ           # Double
            #   [2, 4, 6]
            #
 ŒḄ         # Convert to a range, and Bounce
            #   [[1, 2, 1], [1, 2, 3, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]]
            #
   Ṗ        # Pop
            #   [[1, 2], [1, 2, 3, 4, 3, 2], [1, 2, 3, 4, 5, 6, 5, 4, 3, 2]]
            #
     F      # Flatten
            #   [1, 2, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2]
            #
      ị@    # Grab the item[a]
            #   1
            #

Your code is equivalent to Ḥ€ŒḄ€Ṗ€Fị@, so you can use µ€ for -1 (three or more monads with € at the start): ḤŒḄṖµ€Fị@

This should really be ḤŒḄṖ  ½ĊÇ€Fị@ for 12 to comply with the 10,000 requirement (running the 9 byte code locally takes about 2:20 on my i7 and uses 7GB)

Python 2, 56 bytes
def f(x):n=int((x/2)**.5);print 2*n-abs(2*n*n+2*n+1-x)+2

Try it online!
This is 0-indexed.
-1 byte thanks to @JustinMariner
How this Works
We note that the 1-indexed n-th group (1, 2, ... 2n ..., 2, 1) occurs from elements numbered 0-indexed 2(n-1)^2 to 2n^2.
To find the element at index x, we can find the group number n that x is in. From that, we calculate the distance from the center of the group that x is. (This distance is abs(2*n**2+2*n+2-x)).
However, since the elements decrease further away from the center of a group, we subtract the distance from the maximum value of the group.

I have golfed this part: print 2*n-abs(2*n*n+2*n+1-x)+2 - 2*n*n+2*n can be 2*n*-~n and +2+2*n can be turned into -~n*2, which allows us to move it to the beginning which saves bytes (53 bytes)

05AB1E, 8 bytes
Code:
ÅÈ€1Ÿ¦¹è

Uses the 05AB1E encoding. Try it online!
Explanation:
ÅÈ           # Get all even numbers until input (0, 2, ..., input)
  €1         # Insert 1 after each element
    Ÿ        # Inclusive range (e.g. [1, 4, 1] -> [1, 2, 3, 4, 3, 2, 1])
     ¦       # Remove the first element
      ¹è     # Retrieve the element at the input index

Doesn't work correctly unless you remove ¦, which also saves a byte ofc :)

€1 is weird...

JavaScript, 39 bytes
f=(n,t=2)=>n>t?f(n-t,t+4):n>t/2?t-n+2:n

MATL, 15 bytes
li:"@EZv4L)]vG)

1-based.
Try it online!
This times out for the largest test cases in TIO, but finishes in time on my desktop computer (compiler running on MATLAB R2017a). To display elapsed time, add Z` at the end of the code.
>> matl 'li:"@EZv4L)]vG)Z`'
> 10000
84
15.8235379852476

Explanation
The code generates many more terms than necessary. Specifically, it computes n "pieces" of the sequence, where each piece is a count up and back to 1.
l       % Push 1
i       % Push input, n
:       % Range [1 2 ...n]
"       % For each k in that range
  @E    %   Push 2*k
  Zv    %   Symmetric range: [1 2 ... 2*k-1 2*k 2*k-1 ... 2 1]
  4L)   %   Remove last entry: [1 2 ... 2*k-1 2*k 2*k-1 ... 2]
]       % End
v       % Concatenate all stack contents into a column vector
G)      % Get n-th entry. Implicitly display

nice! TIO is slow sometimes...

Well, the main cause of slowness here is the algorithm (which generates much more terms than necessary). Also, the MATL compiler is not particularly fast

Husk, 12 10 bytes
!ṁ§¤+hḣṫİ0

Try it online!
1-indexed, works quite fast
Explanation
!ṁ§¤+hḣṫİ0
 ṁ      İ0    Map the following function over the even numbers and concatenate the results together
  §   ḣṫ      Get the ranges 1-n and n-1, then...
   ¤+h         remove the last element from both of them and concatenate them together
!             Return the element of the resulting list at the given index

8 bytes using …

@Zgarb that's a great idea and you should probably post it as your answer :)

Done.

Mathematica, 90 bytes
Flatten[{1}~Join~Table[Join[Rest[p=Range@i],Reverse@Most@p],{i,2,Round[2Sqrt@#],2}]][[#]]&

Try it online!

Ruby, 78 75 bytes
Saved 1 byte thanks to Step Hen
Saved 1 byte thanks to Mr. Xcoder
->n{a=0;b=2;c=1;n.times{if a==b then c=0;b+=2;end;c=1if a<2;a+=c<1?-1:1};a}

Try it online!
Hopefully I can get some tips for pulling the bytecount down more. I tried to take a simple approach.

Welcome to PPCG! c=1 if can be golfed to c=1if

76 bytes: ->n{a=0;b=2;c=1;n.times{if a==b then c=0;b+=2;end;c=1if a==1;a+=c<1?-1:1};a}

Retina, 62 bytes
.+
$*
^((^.|\2..)*)\1.
6$*1$2$2;1
(?=.+;(.+))\1(.+).*;\2.*
$.2

Try it online! Link includes test cases. Input is 1-indexed. The first stage is just decimal to unary conversion. The second stage finds the highest square number s strictly less than half of n; $1 is s², while $2 is 2s-1. It calculates two values, first the number of numbers in the current up/down run, which is 4(s+1) = 4s+4 = 2$2+6, and secondly the position within that run, which is n-2s² = n-(2$1+1)+1 = n-$&+1, which just requires a 1 to make up for the 1 used to enforce the strict inequality. The final stage then counts from that position to both the start and end of the run and takes the lower result and converts it to decimal.

Mathematica, 67 bytes
(t=z=1;While[(x=3-4t+2t^2)<#,t++;z=x];If[#-z>2t-2,4t-5+z-#,#-z+1])&

Try it online!

Perl 5, 43 + 1 (-p) = 44 bytes
$_=($n=2*int sqrt$_/2)+2-abs$n/2*$n+$n+1-$_

Try it online!
I was working on a formula to calculate the n-th element directly.
 Then I saw that @fireflame241 had done that work, and I golfed it into Perl.
# Perl 5, 50 + 1 (-n) = 51 bytes
push@r,1..++$",reverse 2..++$"while@r<$_;say$r[$_]

Try it online!
Results are 0 indexed.

Haskell, 115 81 bytes
y%x=snd(span(<x)$scanl(+)y[y+1,y+3..])!!0
g 1=1
g x|1%x>2%x=1+g(x-1)|1>0=g(x-1)-1

Try it online!
There is some magic going on here.  Could probably be shorter if I used a normal approach though.
Explanation
First we define %.  % is a function that takes two variables x, and y.  It constructs a list scanl(+)y[y+1,y+3..] and finds the first element of that list greater than x.  scanl(+) just performs iterative sums, to get the triangular numbers we would do scanl(+)0[1..], to get the square numbers we would do scanl(+)0[1,3..].  The two lists in particular we will be constructing are scanl(+)2[3,5..] and scanl(+)1[2,4..] these are the inflection points of the pattern.
Now we define the main function g which takes an x.  If x is one  we return 1 because that's the first value.  Otherwise we check the next two inflection points, if the down inflection is larger 1%x>2x we return the successor of g$x-1 otherwise we return the predecessor of g$x-1.
Ok but why does that work?
First of all "Whats with the way we find vertices?".  Its important to note the distance between consecutive vertices of the same type.  You will notice that the differences are growing by 2 each time.  This makes sense because the triangles bases become wider by 2 each time.  We can make a list constant difference using a list literal like so [2,4..] and we use scanl(+) to to turn these lists into our vertex lists, based on the location of the first vertex and the first difference.
So now that we have a way of finding upward and downward vertices we can use that information to get the values.  We say that the first value is 1 otherwise we have to take either the successor or the predecessor. If the next vertex is a upward one we want to take the predecessor, otherwise we take the successor.
Haskell, 56 51 46 bytes
Here's my better solution with less math and fewer bytes.
d x|e<-[1..x-1]=e++map(x+1-)e
(([1..]>>=d)!!0)

Try it online!

Pyke, 14 bytes
SF}SDtO_+)sQt@

Try it here!
S              -    range(1, input)
 F}SDtO_+)     -   for i in ^:
  }            -      ^ * 2
   S           -     range(1, ^)
        +      -    ^ + v
     tO_       -     ^[1:-1:-1]
          s    -  sum(^)
           Qt@ - ^[input-1]

C# (.NET Core), 120 bytes
Explanation:
    pretty simple, the first nested loop climbs up to our max, the second climbs back down to 2. The repeat for each multiple of 2.

x=>{var a=0;for(int i=2,j=0;j<x;i+=2){for(var b=1;b<=i&j<x;b++,j++){a=b;}for(var c=i-1;c>1&j<x;c--,j++){a=c;}}return a;}

Try it online!

Java (OpenJDK 8), 53 bytes
n->{int i=2;for(;n>i;i+=4)n-=i;return n>i/2?i-n+2:n;}

Try it online!
-2 bytes thanks to Nevay.
1-indexed.
TL;DR We split the sequence into convenient chunks, find the chunk n is in, then find the nth position in the chunk.
Here, we can split the sequence like [[1,2],[1,2,3,4,3,2],[1,2,3,4,5,6,5,4,3,2],...], which gives us chunk sizes of 4i-2. Starting with i=2, we subtract i from n, essentially moving upwards a chunk at a time. Once we satisfy n<=i, we know n is now the position of the correct value in the current chunk.
We then get the value by comparing n to i, the size of the chunk. The midpoint of each chunk is equal to i/2+1; if n is less than this, we simply return n. If n is greater, we return i-n+2.
Example
n = 16, i = 2

Is n > i? Yes, n = n - 2 = 14, i = i + 4 = 6
Is n > i? Yes, n = n - 6 = 8, i = i + 4 = 10
Is n > i? No, stop looping.
10 / 2 + 1 = 6
Is n > 6? Yes, return i - n + 2 = 8 - 6 + 2 = 4

You don't need the +1, return n>i/2?i-n+2:n is sufficient.

Huh. Thanks, integer division.

Python 2, 5! bytes (120 bytes :P)
r=range
a=[]
for i in r(2,998,2):
	for j in r(1,i+1): a.append(j)
	for j in r(i-1,1,-1): a.append(j)
print a[input()-1]

Try it online!
Straightforward, makes the list and then takes input'th element

Thank you whoever up voted! Now I have 50 rep so I can comment! dabs intensely

Python 3, 184 156 bytes
l,n,r=list,next,range
h=lambda x:l(r(1,x))+l(r(x-2,1,-1))
def g():
	x=3
	while True:yield from h(x);x+=2
def f(i):
	x=g()
	for _ in r(i-1):n(x)
	return n(x)

Try it online!
golfed with Python generator for "lazy" evaluation

QBIC, 47 bytes
g=q{p=p+1~p=:|_Xg\g=g+q~g=1or g>=r|r=r+1┘q=q*-1

Explanation
g=q         var g is the current value of the sequence; set to 1 at the start
{           DO infinitely
p=p+1       raise the step counter (var p)
~p=:|_Xg    IF p equals the input term a (read from cmd line) THEN QUIT, printing g
\           ELSE
g=g+q       raise (or decrement) g by q (q is 1 at the start of QBIC)
~g=1        IF g is at the lower bound of a subsequence
    or g>=r OR g is at the upper bound (r start as 2 in QBIC)
|r=r+1      THEN increment r (this happens once on lower bound, and once on upper,
            total of 2 raise per subsequence)
┘q=q*-1     and switch q from 1 to -1

Pyth,  19  18 bytes
-yhKs@/Q2 2a*yKhKt

Try it here!

Röda, 54 bytes
f n{seq 1,n|{|i|seq 1,2*i;seq 2*i-1,2}_|head n+2|tail}

Try it online!
Call with: try f(n)
This function returns quickly the answer, but after that does some unnecessary calculations and eventually runs out of memory.
As the function does return the actual answer shortly after it is called (clearly under a minute), I think this answer is valid.
(In Röda functions can return values before they exit due to parallelism.)

C# (.NET Core),99 95 86 bytes
n=>{int i=1,t=2,d=0;for(;n>1;){i+=1-2*d;if(i==t){d++;t+=2;}if(i==1)d--;n--;}return i;}

Try it online!
Lambda function that takes and returns an integer. Single loop that handles counting up and down.

PHP, 65+1 bytes
for($x=$d=$z=1;--$argn;)$d=($x+=$d)>1?$x>$z?-1:$d:!!$z+=2;echo$x;

Run as pipe with -R or try it online (or uncomment one of the other versions).
A port of tsh´s recursive JavaScript takes 66 bytes:
function f($n,$t=2){return$t<2*$n?$t<$n?f($n-$t,$t+4):$t-$n+2:$n;}

A port of Arnauld´s solution takes 62+1:
$n=$argn;echo($n-=($r=(~-$n/2)**.5|0)*$r*2)<++$r*2?$n:$r*4-$n;

A golfed port of Xanderhall´s Java has the shortest code so far (55+1 bytes):
for($n=$argn;$n+2>$i+=4;)$n-=$i-2;echo$n*2>$i?$i-$n:$n;


text:
Sequence Without Sevens
This challenge is based on a drinking game. I advise against alcohol consumption while programming.
In this game, the players count up in turns: the first player says 1, the second says 2 and so on. Here's the twist however: each number that is divisible by 7 or has a 7 in its digits (in base 10) is replaced by another counter. This means 7 is replaced by 1, 14 is replaced by 2, 17 is replaced by 3 and so on. For this "sub-sequence", the same rules apply! 35 would be replaced by 7, which in turn is replaced by 1. This process repeats until the number is "valid".
Here's a visualization of the first 100 numbers in the sequence:
n = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
gets replaced by:
                1                  2        3           4                 5  6                    7     8              9             10    11                   12 13                14          15       16 17 18 19 20 21 22 23 24 25             26       27          28                29 30
gets replaced by:
                                                                                1                                                                                2                       3           4                                   5           6

final sequence:
    1 2 3 4 5 6 1 8 9 10 11 12 13  2 15 16  3 18 19 20  4 22 23 24 25 26  5  6 29 30 31 32 33 34  1 36  8 38 39 40 41  9 43 44 45 46 10 48 11 50 51 52 53 54 55 12 13 58 59 60 61 62  2 64 65 66 15 68 69 16  3 18 19 20  4 22 23 24 25 80 81 82 83 26 85 86  5 88 89 90  6 92 93 94 95 96 29 30 99 100

In the final sequence, no number has a seven in its digits or is divisible by seven.
Input description

An integer n (1 <= n <= 7777 or 0 <= n <= 7776)

You may choose whether you use a 0-indexed or 1-indexed input.
Output description

The nth number in the sequence

Examples
The examples are 1-indexed. For 0-indexed, subtract one from n.
n   ->   f(n)
1        1
5        5
7        1
35       1
77       23
119      1
278      86
2254     822
2255     2255
7777     3403

Scoring
This is code-golf, so shortest answer in bytes wins!

Hmm, is test case 278 correct? I get the correct result for each of them, but 278 becomes 86 instead of 5. :S

@KevinCruijssen You're right, 278 is supposed to be 86. 279 becomes 5. Fixed!

Related but quite different.

I would swear this is a dupe but can't seem to find any.

@EriktheOutgolfer Actually, I'm sure I've seen this before as well -- not just the one I already mentioned -- but couldn't find it either ...

@Arnauld Maybe it was deleted or something then. I remember it having something like 1, 2, 3, 4, 5, 6, *1*, 8, 9, ..., 34, ***1***, 36, ... (where stars are what it looked like in markdown)

@EriktheOutgolfer Ah! this one, I think (using Google rather than the internal search).

@Arnauld Yep that's an exact dupe...or not? That one asks you to print indefinitely, this one asks you for a specific item...it's somewhat like the "count up forever" question vs. my "count up folks!" question. Very different approaches.

I think it's similar enough to be a duplicate. We don't need both a "print at least n terms" and a "print the nth term" of every sequence challenge.

Java, 122 121 98 97 bytes
int c(int n){int a=0,b=0,c=n;for(;n-->0;c+=a=((--b+"").indexOf(55)&b%7)>>31);return a<0?-b:c(c);}

-23 bytes thanks to @Nevay.
-1 byte thanks to @Neil.
Explanation:
Try it here.
int c(int n){                            // Method with integer as parameter and return-type
  int a=0,                               //  Flag integer
      b=0,                               //  Regular counter
      c=n;                               //  7-counter
  for(;n-->0;                            //  Loop over the input
    c+=                                  //   Append `c` with:
       a=                                //    Set `a` to:
         ((--b+"").indexOf(55)&b&7)      //     If `b` is divisible by or contains 7:
                                         //     (and decrease `b` by 1 in the process)
                                   >>31  //      Bitwise right shift so `a` is either `-1` or `0`
  );                                     //  End of loop
  return a<0?                            //  If `a` is now -1:
    -b                                   //   Return the regular counter `b` (as positive)
   :                                     //  Else:
    c(c);                                //   Recursive call with 7-counter `c` as input
}                                        // End of method

102, I think: int c(int n){int q=0,r=1,a=1,b=0;for(;--n>0;b+=q=(++a+"").contains("7")|a%7<1?1:0);return q>0?c(b):a;}

101 bytes:
int c(int n){int r=1,a=1,b=1;for(;n-->0;r=(a+"").contains("7")|a++%7<1?b++:a-1);return--a==r?r:c(r);}

98 bytes: int c(int n){int r=1,a=0,b=1;for(;n-->0;r=((--a+"").indexOf(55)&a%7)<0?a:b++);return a<r?c(r):-r;}

Actually my answer is only 98 bytes, once you remove the unused r=1,...

97 bytes: int c(int n){int q=0,a=0,b=n;while(n-->0)b+=q=((--a+"").indexOf(55)&a%7)>>31;return q<0?-a:c(b);}

Python 3, 77 bytes
g=lambda a:a%7<1or'7'in str(a)
f=lambda a:g(a)and f(sum(map(g,range(a))))or a

Try it online!

Does this not work in Python 2? Then you could do '7'in\a`instead of'7'in str(a)`

@Ruud Leaky doesn't like Python 2.

Shouldn't this be 23 bytes?!

@Shaggy Huh? Why?

@EriktheOutgolfer (took me 2 hours to figure it out) because f(77) = 23

JavaScript (ES6), 72 69 bytes

f=
n=>[...a=Array(n)].reduce(_=>a[++i]=i%7>7*/7/.test(i)?i:a[++j],i=j=0)
<input type=number min=1 oninput=o.textContent=f(+this.value)><pre id=o>

Edit: Saved 3 bytes thanks to @Shaggy.

69 bytes: n=>[...a=Array(n)].reduce(_=>a[++i]=i%7>7*/7/.test(i)?i:a[++j],i=j=0)

@Shaggy I can't believe I forgot to use reduce... hangs head in shame

JavaScript, 79 75 bytes
2 bytes saved thanks to Shaggy
f=a=>(z=a=>a%7<1|/7/.test(a))(a)?f([...Array(a)].reduce(a=>a+z(b++),b=0)):a

Try it online!

Just finished golfing mine down ... and then spotted you beat me to the identical solution. :\

75 bytes: f=a=>(z=a=>a%7<1|/7/.test(a))(a)?f([...Array(a)].reduce(a=>a+z(b++),b=0)):a

@Shaggy. I actually had tried using reduce, but before I rearranged variables, so it had turned out that it was longer. I forgot to recheck it again. Thanks.

Röda, 65 bytes
f a{f#[seq(1,a)|[1]if g _]if g a else[a]}g a{[a%7<1 or"7"in`$a`]}

Try it online!
A port of Leaky Nun's Python answer.

05AB1E, 26 23 bytes
LÐ7Ösε7å}~_*[¤0Ê#D_O£]¤

Try it online!
Explanation
L                         # push range [1 ... n]
 Ð                        # triplicate
  7Ö                      # check if number in one copy for equality to 0 after mod by 7
    sε7å}                 # check each number in one copy if they contain 7
         ~_               # OR these 2 lists and invert
           *              # multiply with the range,
                          # giving a list with 0s where the numbers need to be replaced
            [¤0Ê#    ]    # loop until the last number in the list is not 0
                 D        # duplicate the list
                  _       # invert it,
                          # giving a list with 1s for the numbers that need to be replaced
                   O      # sum
                    £     # take these many elements from the list
                      ¤   # RESULT: push the last element of the list

Previous 26 byte solutions
>GNN7ÖN7å~Dˆ[_#¯s£OÐ7Ös7å~
>G1UN[Ð7Ös7å~XiDˆ}_#¯s£O0U

C (gcc), 104 98 95 bytes
-6 bytes by getting rid of sprintf+index and looking manually for a 7 in an integer's digits
-3 bytes using the deprecated POSIX bzero instead of memset
A function writing the result in the global variable r. Usage: l(<int>)
Result is 1-indexed.
r,o[9];b(i,s){for(r=s=++o[i];s&&s%10^7;s/=10);r%7&&!s?:b(i+1);}l(f){for(bzero(o,36);f--;b(0));}

Try it online!
Explanation:
/*
  r = value of the nth element
  o = array of counters (o[0] == main counter)
 */
r,o[9];

// Recursive function, "i" is the counter index
// "s" is used to determine if an int contain a 7 digit
b(i,s){
  /*
    1. Increases the value of the counter
    2. Stores the result into r and s
    3. Divide s by 10 until it is equal to 0 or its remainder is 7
   */
  for(r=s=++o[i];s&&s%10^7;s/=10);

  /*
    if:
      r%7 (r modulo 7) AND it contains no 7 digit
    then:
      nothing
    else:
      calls b with the next counter index
   */
  r%7&&!s?:b(i+1);
}

// Main function: initializes counters and plays
// the sequence until the nth member is calculated
l(f){
  for(bzero(o,36);f--;b(0));
}

Finally, this is not the longest solution anymore. Sorry, Java.

Mathematica, 57 bytes
Last[i=1;If[DigitCount[#,10,7]>0||7∣#,i++,#]&~Array~#]&

Pyth, 36 bytes
L?!hbbhx.f|/`Z`7!%Z7b)b;WnyyQyQ=yQ;Q

Fixed completely, but is now an unholy mess of letters and can certainly be golfed quite a bit.
1-indexed

Fixed, I put the h in front of the Q instead of G /)_-

It should work now...

I missed copy-pasting the leading L to define the lambda

Nice work! Looks good now!

Thanks! Still needs some work though...

J, 52 bytes
i=:('7'&e.@":+.0=7&|)"0
f=:]`(#@}.@I.@:i@i.@>:)@.i^:_

Result is 1-indexed. Using it is pretty straightforward:
f 7777

Try it online!

Perl 5, 52 + 1 (-p) = 53 bytes
map{$s=0;do{$\=++$c[$s++]}until$\!~/7/&&$\%7}1..$_}{

Try it online!
How?
@c is an array of counters.  $c[0] holds the main counter that determines which element we're working on.  Each successive element holds another counter that is only accessed when the previous one contains a 7 or is divisible by 7.
map              # Loop to find the appropriate element
  $s=0;          # reset index of counters
  do{            # looping through the counters
    $\=++c[$s++] # increment the counter and the index; $\ is our output variable
  }until         # don't quit until
       $\!~/7/   # the result has no 7s
       &&$\%7    # and is indivisble by 7
}1..$_           # do this until the input is reached
}{  # close the implicit loop created by the -p flag and force output of $\

# Perl 5, 64 + 1 (-p) = 65 bytes
while($c[0]<$_){$s=0;do{$\=++$c[$s++]}while($\=~/7/||$\%7==0)}}{

Try it online!