text:
Make a search engine
You need to make a program, that when giving a list and a string, searches on the list for items that contains the string.
Examples:
Input: th [thing, awesome, potato, example]
Output: thing (Because it starts with "th")

Input: ing [thing, potato]
Output: thing (Because it ends with "ing")

Input: tat [thing, potato]
Output: potato (Because it contains "tat")

Input: tat [tato, potato]
Output: tato, potato (If there are 2 or more results matching, print all of them)

Remember, this is code golf, so the shortest code wins.
Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

/* Configuration */

var QUESTION_ID = 72079; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 48934; // This should be the user ID of the challenge author.

/* App */

var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;

function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var SCORE_REG = /<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;

var OVERRIDE_REG = /^Override\s*header:\s*/i;

function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {
  var valid = [];

  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '
' + c.body.replace(OVERRIDE_REG, '') + '
';
    });

    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });

  });

  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });

  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;

    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);

    var lang = a.language;
    if (/ b.lang) return 1;
    if (a.lang < b.lang) return -1;
    return 0;
  });

  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }

}
body { text-align: left !important}

#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}

#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}

table thead {
  font-weight: bold;
}

table td {
  padding: 5px;
}

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

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

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

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

The spec shouldn't be explained in the answers

Did you mean "contains" the other substring?

Yup, that's right.

TeaScript, 4 bytes
F@Iσ

Output is cast to string.
Try it online
Explanation
F@  // Filter input 1
 Iσ // Includes input 2

Downvote and no comments?

Downgoats and no comments.

JavaScript ES6, 32 bytes
(s,a)=>a.filter(e=>~e.search(s))

33 bytes if the string might contain regexp metacharacters:
(s,a)=>a.filter(e=>~e.indexOf(s))

The spec is blurry enough, so I 'm not concerned about this ... but if the string can be any string and not just letters, you sholud use indexoOf instead of search

@edc65 Yes, I wasn't sure whether to mention that.

Python 2, 42 36 bytes
lambda i,a:filter(lambda v:i in v,a)

Thanks to muddyfish for saving 6 bytes
Test:
a=lambda i,a:filter(lambda v:i in v,a)
a('th', ['thing', 'awesome', 'potato', 'example']) # ['thing']
a('ing', ['thing', 'potato'])                      # ['thing']
a('tat', ['thing', 'potato'])                      # ['potato']
a('tat', ['tato', 'potato'])                       # ['tato', 'potato']

Sometimes the right answer is boring. lambda i,a:[v for v in a if i in v] (35)

Regex please...

Pyth - 5 bytes
f}zTQ

Try it online here.
Filters the input list by if the input string is in it.

Could you explain it?

@Alex82 sure, adding!

vim, 13
dd:v/\V<C-r>"<BS>/d<cr>

Expects input as
th
thing
awesome
potato
example

Outputs on separate lines.
dd      delete first line into " (default) register
:v/     apply to every line that doesn't match the following regexp...
\V        "very nomagic" - strips chars of their special regex meaning
<C-r>"    paste contents of " register into the command
<BS>      remove the trailing newline from the first line
/d      ... delete the lines

Doesn't this remove all matches (can't test right now)

@Seeq Sorry, my explanation is wrong. :v operates on all lines that do not match.

That would make more sense. Anyways, another feature of vim that I did not know about (+1)

Racket, 49 bytes
(λ(l s)(filter-map(curryr string-contains? s)l))

W, 5 bytes
b@t!W

Explanation
ba      % Implicit inputs
  b     % Access the second operand
   @    % Show two operands (yields [b,b,a])
      W % Select everything in a that fullfills this condition:
    t   % Trim everything in the current item
        % that appears in the input
        % Yields ([b,b.trim(a)])
     !  % Negate this result, determining whether
        % the input is a subset of the current item

        % Keeping all of the items that fullfill
        % this condition yields a list by default
```

sh, 5 bytes
Accepts a list of words on stdin, one per line, and a search string as command line argument.
fgrep

This submisson should be valid by the rules on scoring builtin functions.

, 4 chars / 5 bytes
í⒡ăî

Try it here (Firefox only).
Simple.
Explanation
Filter input array by string input.

R, 38 28 bytes
function(x,y)grep(y,x,,,T,T)

simply a wrapper for grep, with value = TRUE to return the value [not a logical flag], and fixed (to allow regex-like strings to be searched and not processed as regex.
edit - 10 bytes by passing empty arguments to allow positional matching

Mathematica, 29 bytes
Select[#2,StringContainsQ@#]&

Very simple.

Python 2, 47 bytes
a=input()
print[x for x in input()if x in a]

Bash, 27 bytes
tr \  \\n<<<${@:2}|fgrep $1

Sample run:
llama@llama:...code/shell/ppcg72079search$ ./search.sh th thing awesome potato example
thing

With multiple outputs, they will be on separate lines.
tr \  \\n   replace spaces with newlines (equivalent to tr ' ' '\n')
<<<${@:2}   ... with STDIN as all but first argument
|fgrep $1   fgrep for first argument (fgrep is grep w/ "fixed" string, not regex)

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


text:
Implement the divisibility-by-7 rule
To check whether a decimal number is divisible by 7:

Erase the last digit. Multiply it by 2 and subtract from what is left. If the result is divisible by 7, the original number is divisible by 7.

(also described e.g. here)
This rule is good for manual divisibility check. For example:

Is 2016 divisible by 7?
Subtract 6*2 from 201; we get 189. Is this divisible by 7? To check it, let's apply the rule again.
Subtract 9*2 from 18; we get 0. Therefore, 2016 is divisible by 7.

In this challenge, you should apply this rule until the divisibility status is obvious, that is, the number is not greater than 70 (however, see below for details). Make a function or a full program.
Input: a positive integer; your code should support inputs up to 32767 (supporting arbitrary-precision integers is a bonus; see below).
Output: an integer (possibly negative), not greater than 70, that is a result of applying the divisibility-by-7 rule zero or more times.
Test cases:
Input                   Output      Alternative output

1                       1
10                      10          1
100                     10          1
13                      13          -5
42                      42          0
2016                    0
9                       9
99                      -9
9999                    -3
12345                   3
32767                   28          -14

---------- Values below are only relevant for the bonus

700168844221            70          7
36893488147419103232    32          -1
231584178474632390847141970017375815706539969331281128078915168015826259279872    8

Where two possible outputs are specified, either result is correct: the second one corresponds to applying the rule one more time. It's forbidden to apply the rule on a single-digit number: if you erase the digit, nothing (not 0) is left.

Bonus: If your algorithm

Supports arbitrary-precision integers
Performs only one pass on the input
Has space complexity o(n) (i.e. less than O(n)); and
Has time complexity O(n),

where n is the number of decimal digits:
Subtract 50% from your code's byte count.
Real bonus:
In addition, if your algorithm reads the input in normal direction, starting from the most significant digit, subtract 50% once again - your score is 25% of your byte count (it seems possible, but I'm not absolutely sure).

Can you please clarify how we have to handle 9 < input < 70? Should we apply the rule at least one time? Or can we just print it out, since its lower than 70 and the divisibility status is obvius?

@DenkerAffe Returning the input as-is is acceptable. I updated the test-case of input=10 to reflect this; that was the idea from the beginning.

I wouldn't want to use that rule on 1000000000000000000001.

But what if your language has long longs or some equivalent type built in?

@SuperJedi224 long long in C has fixed width - not enough. Arbirary-width integers are called bigint or something like that. Using a built-in bigint type is OK.

What I was saying was that, in some implementations, it's a 128-bit integer, which is more than big enough for that last test case.

-1. Not all languages support arbitrary precision.

@MarchHo All turing complete languages support arbitrary precision.

@MarchHo - most languages support long enough strings to implement the algorithm without needing to convert the input to an integer type.

@Labo pretty sure Turing completeness isn't required for a language to be considered valid here. And in any case, the whole point is that a vast majority of languages do not support arbitrary precision, which the question required. I guess the string implementation kind of alleviates this though.

This would be more interesting if someone found a closed form expression.

@rr- It looks funny though. (using alternate output : http://imgur.com/yeNSUhr)

What's the point of the arbitrary precision requirement? It disadvantages languages in which that's difficult to do while providing a boost to most golfing languages which don't need one, and doesn't add anything to the core challenge.

@RobertFraser I need it so I can properly formalize the "bonus" requirement

Then why is support for arbitrary precision not a part of the bonus requirement?

@Dennis No reason... I'll move it there!

I see you've added a bonus.  What counts as "reading the input in normal direction", and "Performs only one pass on the input"?  Does my dc answer qualify for the bonus?  Or does it need to be a digit-by-digit answer?

@TobySpeight If it divides a number by 10 repeatedly, it does several passes on the input.

I think I understand the requirement now - it needs to be digit-at-a-time processing, which won't really work with dc or bc.  I've submitted an answer in C that reads input as a string and processes digits in order, which I believe claims the 75% discount.

Golfscript, 27 22 bytes
{.9>{.10/\10%2*-f}*}:f

You can use it this way:
1000f

Explanation
{.9>{.10/\10%2*-f}*}:f
{                  }:f    # Define block 'f' (similar to a function)
 .                        # Duplicate the first value of the stack
  9>{            }*       # If the value on top of the stack is greater than 9 then the block is executed
     .10/\10%2*-          # Same as nb/10 - (nb%10 * 2) with some stack manipulations '.' to duplicate the top of the stack and '\' to swap the the first and second element of the stack
                f         # Execute block 'f'

5 bytes saved thanks to Dennis !

Welcome to Programming Puzzles and Code Golf. This is a good answer, however you could improve it by adding a code breakdown and explanation, like the questions above. To reply to this comment, type @wizzwizz4 (@ then my username) at the beginning of (or anywhere in) a comment.

@wizzwizz4 Better ? I'm not sure that I understand what you mean by 'code breakdown' (not native speaker sorry)

I believe by "code breakdown" he meant an explanation, which you've added. This is a very nice first answer indeed. Welcome to the site!

You can rewrite the {...}{}if part as {...}*, which will just apply the code block zero of one times, depending on the value pushed by >. Also, we're allowed to perform one more iteration (so replacing 70 with 9 saves a byte), and I don't think you need to pop the block with ;.

@Dica, this is a first answer good enough to get 12+ upvotes on a question with only 624 views, and to get praise from two moderators. If you keep this up, you'll soon overtake Dennis!

@Dennis Thanks, nice improvement ! The problem without ; is that the block is printed with the answer so the output is no longer valid

I don't think that matters, and I've done it in many of my CJam/GolfScript answers. This is a function that pops an integer from the stack and pushes one in return. You could just as easily call it with ~ for the first time, which would consume the block. -- By the way, this is an excellent first answer.

Haskell, 35 bytes
until(<71)(\n->div n 10-2*mod n 10)

Usage example: until(<71)(\n->div n 10-2*mod n 10) 36893488147419103232 -> 32.
Nothing much to explain, it's a direct implementation of the algorithm.

Jelly, 11 bytes
d⁵Uḅ-2µ>9$¿

Try it online!
How it works
d⁵Uḅ-2µ>9$¿  Main link. Input: n

d⁵           Divmod; return [n : 10, n % 10].
  U          Upend; yield [n % 10, n : 10].
   ḅ-2       Convert from base -2 to integer, i.e., yield -2 × (n % 10) + (n : 10).

      µ      Push the previous chain as a link and begin a new, monadic chain.
          ¿  Apply the previous chain while...
       >9$     its return value is greater than 9.

And as always, Jelly wins. Dennis, how much bytes would it take to implement a jelly interpreter in Jelly?

Python 2, 38 bytes
f=lambda x:f(x/10-x%10*2)if x>70else x

Try it here!
Simple recursive approach. Prints x if its < 70 otherwise applies the divisibility rule and calls itself with the result.

you don't need the space after the )

@Maltysen True. Copy pasted the wrong one, thanks for the hint!

The if is too verbose. f=lambda x:x*(x<70)or f(x/10-x%10*2)

@Seeq Nice trick, thanks! This should work in theory, but it reaches the maximum recursion depth with 2016 as input while my version does not. Any idea why?

Ah, right, didn't consider that. This trick considers x*(x<70) != 0 to be the end condition. If x gets to 0 - like it does with 2016 - the end condition never happens.

@Seeq Ah, I get it. Thanks for the trick anyway, might use it in the future :)

Pyth, 13 bytes
.W>H9-/ZTyeZQ

Try it online: Demonstration or Test Suite
This will print all the alternative answers.
Explanation:
.W>H9-/ZTyeZQ
            Q   read a number from input
.W              while
  >H9              the number is greater than 9
                do the following with the number:
      /ZT          divide it by 10
     -             and subtract
         yeZ       2*(number%10)

Julia, 27 26 bytes
f(x)=x>9?f(x÷10-x%10*2):x

This is a recursive function that accepts an integer and returns a BigInt. If the input is a large number like in the last example, Julia parses it as a BigInt, so no manual conversion is necessary.
The approach is just a straightforward implementation of the algorithm. It will produce the alternate outputs. Taking the modulus when dividing by 10 yields the last digit and the quotient from integer division by 10 yields everything but the last digit.
Saved a byte thanks to Dennis!

We're allowed to perform one more iteration, so replacing 70 with 9 saves a byte.

@Dennis Good call, thanks!

CJam - 19 bytes
Do-while version:
r~A*{`)]:~~Y*-_9>}g

Try it online or While version #1:
r~{_9>}{`)]:~~Y*-}w

Try it online or While version #2:
r~{_9>}{_A/\A%Y*-}w

Try it online.
r~                     | Read and convert input
  A*                   | Multiply by 10 to get around "if" rule
     `                 | Stringify
      )                | Split last character off
       ]               | Convert stack to array
        :~             | Foreach in array convert to value
          ~            | Dump array
           Y*          | Multiply by 2
             -         | Subtract
              _        | Duplicate
               9>      | Greater than 9?
    {            }g    | do-while

Pyth, 17 bytes
L?<b70by-/bT*%bT2

Try it here!
Same recursive approach as in my python answer. Defines a lambda y which is called like this: y12345.
The byte counter in the online interpreter shows 19 bytes because I added the lambda call to it, so you can just try it by hitting the run-button.
Explanation
L?<b70by-/bT*%bT2

L                  # Defines the lambda y with the parameter b
 ?<b70             # if b < 70:
      b            # return b, else:
       -/bT*%bT2   # calculate b/10 - b%10*2 and return it

You have a typo in your explanation, 17 should be 70 :P

GNU dc, 20 15 bytes
[10~2*-d70<F]sF

This defines my first (ever) dc function, F.  It takes input on the top of stack, and leaves its output at top of stack.  Example usage:
36893488147419103232
lFxp
32

Oracle SQL 11.2, 116 bytes
WITH v(i)AS(SELECT:1 FROM DUAL UNION ALL SELECT TRUNC(i/10)-(i-TRUNC(i,-1))*2 FROM v WHERE i>70)SELECT MIN(i)FROM v;

Un-golfed
WITH v(i) AS
(
  SELECT :1 FROM DUAL
  UNION ALL
  SELECT TRUNC(i/10)-(i-TRUNC(i,-1))*2 FROM v WHERE i>70
)
SELECT MIN(i) FROM v;

Haskell, 157 192 184 167 159 147 138+5 bytes - 50% = 71.5 bytes
O(1) space, O(n) time, single-pass!
h d=d%mod d 10
d%r=(quot(r-d)10,r)
p![d]=d-p*10
p![d,e]=d#(e-p)
p!(d:e:f)|(b,a)<-quotRem(2*d)10,(q,r)<-h$e-a-p=(b+q)!(r:f)
m#0=m
m#n=n-2*m
(0!)

Use as 0![6,1,0,2] to apply the rule to 2016, i.e. pass it a number in stream form with least significant figure first. In this way, it will pass over the number digit by digit, applying the rule with O(1) space complexity.
The ungolfed code is here:
import Data.Char

{- sub a b = sub2 0 a b
  where
    sub2 borrow (a:as) (b:bs) = res : sub2 borrow2 as bs
      where
        (borrow2, res) = subDig borrow a b
    sub2 borrow (a:as) [] = sub2 borrow (a:as) (0:[])
    sub2 _ [] _ = [] -}

--subDig :: Int -> Int -> Int -> (Int, Int)
subDig borrow a b = subDig2 (a - b - borrow)
  where
    subDig2 d = subDig3 d (d `mod` 10)
    subDig3 d r = ((r-d) `quot` 10, r)

seven ds = seven2 0 ds
seven2 borrow (d:e:f:gs) = seven2 (b + borrow2) (res:f:gs)
  where
    (a, b) = double d
    (borrow2, res) = subDig borrow e a
seven2 borrow (d:e:[]) = finalApp d (e-borrow)
seven2 borrow (d:[]) = d - borrow*10

double d = ((2*d) `mod` 10, (2*d) `quot` 10)

finalApp m 0 = m
finalApp m n = n - 2*m

num2stream :: Int -> [Int]
num2stream = reverse . map digitToInt . show
sev = seven . num2stream

The gist of how this works is that it implements a digit-by-digit subtraction algorithm, but takes advantage of the fact that each number to be subtracted is at most 2-digits, and so we can subtract an arbitrary amount of these 1-or-2 digit numbers from the main one (as well as eating the least significant digits).
The subtraction algorithm is O(1) and only stores the current 'borrow' value. I altered this to add in the extra digit (either 0 or 1), and we note that this borrow value is bounded (within the range [-2,2] so we need only 3 bits to store this).
The other values stored in memory are temporary variables representing the current 2-digit number to add, a single look-ahead in the stream, and to apply one step of the subtraction algorithm (i.e. it takes two digits and a borrow value, and returns one digit and a new borrow value).
Finally at the end it processes the last two digits in the stream at once to return a single-digit number rather than a list of digits.
N.B. The sev function in the ungolfed version will work on an Integer, converting it into the reversed stream form.

I intended the bonus to be for the normal order of digits. But I never said it, so it's fair to get the bonus for the reversed order, even though it's less fun. Anyway, even the reversed order is harder than I thought, so it's fun enough!

@anatolyg: Thanks! I'm not sure if it's possible to do a single pass O(1) implementation of the normal order... the rule depends on the least significant figures, so in theory direct application of the rule is impossible except in reversed order. The only other thing I can think of is by finding a mathematically equivalent form - for example Mod[18 - Quotient[n, 10] - 2*n, 21] - 18 + Quotient[n, 10] works empirically for n between 10 and 99, but gets more complicated the more digits n has...

Hmm I thought about it and it seemed there might be a way by keeping the front 2 digits and applying each subsequent digit, but multiplying by (-2)^n to take account of it 'filtering through'... as far as I can tell though there's no way to make this work without keeping all the digits in memory and sacrificing the O(1)'ness or even o(n)'ness... I think the normal order is definitely impossible :(

I'm afraid you have to count the bytes of the initial 0 when calling !, too, e.g. as a section (0!) (+ a newline), i.e. +5 bytes. On the other side you can shorten the first to pattern matches of ! to p![d]= and p![d,e]=. Also, use  pattern guards instead of the let: p!(d:e:f)|(b,a)<-quotRem(2*d)10,(q,r)<-h$e-a-p=(b+q)!(r:f).

@nimi: thanks! I'm a bit confused about "(0!)\n" though (I'm new to Haskell and CodeGolf!) -- can't I just use "0!" for the invocation instead of using a section?

@nitrous: Oh I ment (0!) on a line of it's own. (0!) is the function you give as your answer. The 0 is required, but has nothing to do with the input, so you cannot outsource it to the caller. Of course you could also use f x=0!x, but this is longer.

@nimi: Ah I see, thanks!

Mathematica, 47 44 bytes
If[#>70,#0[{1,-2}.{⌊#/10⌋,#~Mod~10}],#]&

Simple recursive approach. Could probably be golfed further.

#0[{1,-2}.QuotientRemainder[#,10]] saves a byte.

R, 43 bytes
x=scan();while(x>70)x=floor(x/10)-x%%10*2;x

Explanation:
x=scan()                                      # Takes input as a double
        ;                                     # Next line
         while(x>70)                          # While-loop that runs as long x > 70
                      floor(x/10)             # Divide x by 10 and round that down
                                 -x%%10*2     # Substract twice the last integer
                    x=                        # Update x
                                         ;    # Next line once x <= 70
                                          x   # Print x

Sample runs:
> x=scan();while(x>70)x=floor(x/10)-x%%10*2;x
1: 9999
2:
Read 1 item
[1] -3

> x=scan();while(x>70)x=floor(x/10)-x%%10*2;x
1: 32767
2:
Read 1 item
[1] 28

C, 56 bytes - 75% = 14
Although this doesn't give the exact same numbers as the test cases, it satisfies the spirit of the question (and arguably more).  It correctly identifies exact multiples of 7, and gives the exact remainder for other numbers (since it doesn't ever use negative numbers).
n;f(char*c){for(n=0;*c;)n-=n>6?7:'0'-n-n-*c++;return n;}

There is no multiplication or division in the algorithm, only addition and subtraction, and digits are processed in a single pass from left to right.  It works as follows, starting with 0 in the accumulator:

Subtract 7 if necessary, and again if still necessary
Multiply the running total by three, and add the next digit

The "multiply by three" step is written as n-=-n-n to save a byte and to avoid the multiply operator.
When we hit the end, we don't subtract sevens, so the result will be in the range 0-24; if you want a strict modulus (0-7), substitute *c with *c||n>6 in the for loop condition.
It qualifies for the enhanced bonus, because it

supports arbitrary-precision integers
performs only one pass on the input, in left-to-right order
has space complexity O(1)
has time complexity O(n).

Test program and results
#include <stdio.h>
int main(int argc, char **argv) {
    while (*++argv)
        printf("%s -> %d\n", *argv, f(*argv));
    return 0;
}

540 -> 15
541 -> 16
542 -> 17
543 -> 18
544 -> 19
545 -> 20
546 -> 21
547 -> 22
548 -> 23
549 -> 24
550 -> 18
99 -> 15
999 -> 12
12345 -> 11
32767 -> 7
700168844221 -> 7
36893488147419103232 -> 11
231584178474632390847141970017375815706539969331281128078915168015826259279872 -> 11

Alternative version
Here's one that recurses (you'll want to enable compiler optimizations to do tail-call transformation or you may overflow your stack; I used gcc -std=c89 -O3):
f(c,n)char*c;{return n>6?f(c,n-7):*c?f(c+1,n+n+n+*c-'0'):n;}

Call it with '0' as the second argument.
Both versions calculate the remainder-modulo-seven of a 60,000 digit number in under 50 milliseconds on my machine.

Thanks for the bonus - it makes a real change for C to end up so competitive!  Currently beaten only by Jelly (11) and Pyth (13).  :-)

Mathematica, 33 bytes
#//.a_/;a>70:>⌊a/10⌋-2a~Mod~10&

Test case
%[9999]
(* -3 *)

JavaScript ES6, 140 142 bytes
f=s=>s>9?eval("t=s.replace(/.$/,'-$&*2');for(i=-1;0>(n=eval(u=t[c='slice'](i-4)))&&u!=t;i--);n<0?n:f(t[c](0,i-4)+('0'.repeat(-i)+n)[c](i))"):s

This is true arbitrary-precision math, even works on the largest test-case.
This function recursively removes the last digit from the string, then subtracts 2 * the last digit from the remaining numerical string by iteratively incrementing the amount of digits to apply to the minuend until the difference is positive. Then it appends that difference to the end of the string with appropriately padded 0s and calls itself recursively until its numerical value is less than or equal to 9.

Golfed 7 bytes thanks to @Neil (yes I know I gained 2 bytes but I fixed a few bugs that caused the function to freeze or return wrong output for some cases).

f=s=>s>9?eval("t=s.replace(/.$/,'-$&*2');for(i=-1;0>(n=eval(u=t[c='slice'](i-4)))&&u!=t;i--);n<0?n:f(t[c](0,i-4)+('0'.repeat(-i)+n)[c](i))"):s;[['1',1],['10',1],['100',1],['13',-5],['42',0],['2016',0],['9',9],['99',-9],['9999',-3],['12345',3],['700168844221',7],['36893488147419103232',-1],['231584178474632390847141970017375815706539969331281128078915168015826259279872',8]].map(a=>document.write(`<pre>${f(a[0])==a[1]?'PASS':'FAIL'} ${a[0]}=>${a[1]}</pre>`))

Nice, but it might not work on 1000000000000000000001.

Try s.replace(/.$/,'-$&*2'). I don't have any obvious ideas for the rest though sorry.

Perl 5, 47 46 bytes
Had to use bigintfor the last test case. (It returns 20 without)
use bigint;$_=<>;while($_>9){$_-=2*chop;}print

Not really sure it's a candidate for the bonus, so I didn't take it into account. (I think it does, but I'm not really accustomed to the concepts)
Try it here!

ES6, 108 bytes
f=(s,n=0)=>s>1e9?f(s.slice(0,-1),((1+s.slice(-1)-n%10)%10*21+n-s.slice(-1))/10):s>9?f(((s-=n)-s%10*21)/10):s

Works for 2²⁵⁷ and 1000000000000000000001, but could use further golfing.

@PatrickRoberts Oops, oversight when reformatting for the submission.

JavaScript ES6, 38 bytes
a=i=>i>70?a(Math.floor(i/10)-i%10*2):i

Fails with 36893488147419103232 and using ~~(1/10) will also fail for 700168844221
Test:

a=i=>i>70?a(Math.floor(i/10)-i%10*2):i
O.textContent = O.textContent.replace(/(-?\d+) +(-?\d+)/g, (_,i,o) =>
  _+": "+(a(+i)==o?"OK":"Fail")
);
<pre id=O>1                       1
10                      10
100                     10
13                      13
42                      42
2016                    0
9                       9
99                      -9
9999                    -3
12345                   3
700168844221            70
36893488147419103232    32</pre>

I get two Fails... 70 and 32

@CᴏɴᴏʀO'Bʀɪᴇɴ Yea me to, I'm still wondering why...

Because JavaScript's number type doesn't handle the last case, at least.

f=n=>n>70?f((n-n%10*21)/10):n is a shorter version but still only works for up to 2**56.

@Neil see my answer for arbitrary precision, and please feel free to golf, greatly appreciated.

Brain-Flak, 368 360 bytes
Try it Online!
([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>){{}(({}))(<((()()()()()){}<>)>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>([([([(({}<{}><>)<([{}]{})(<((()()()()()){}(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)>){}]{})]<(())>)(<>)]){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)}{}

Explanation
To start off all of the code is in a loop that runs until the top of the stack is less than zero:
([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)
{{}
 ...
 ([([({})]<(())>)](<>)){({}())<>}{}<>{}{}<>(({})){{}{}<>(<(())>)}{}({}<>)
}{}

Inside of the loop we run the divisible by seven algorithm:
Duplicate the top of the stack
(({}))

Take the mod 10 of the top of the stack (last digit)
(<((()()()()()){}<>)>)<>{({}[()])<>(({}()[({})])){{}(<({}({}))>)}{}<>}{}<>({}<{}><>)

This is a bit of a mess but it does the rest of the algorithm I might explain it later but I don't entirely remember how it works:
([(({})<([{}]{})(<((()()()()()){}(<>))>)<>{({}[()])<>(({}()[({}<({}())>)])){{}(<({}({}<({}[()])>))>)}{}<>}{}<>{}{}({}<>)>){}]{})

C#, 111 104 bytes
int d(int n){var s=""+n;return n<71?n:d(int.Parse(s.Remove(s.Length-1))-int.Parse(""+s[s.Length-1])*2);}

PHP, 50 bytes
for($n=$argv[1];$n>9;)$n=$n/10|0-2*($n%10);echo$n;

uses alternative output; works up to PHP_INT_MAX

string version, works for any (positive) number (64 bytes):
for($n=$argv[1];$n>9;)$n=substr($n,0,-1)-2*substr($n,-1);echo$n;

Java, 133 bytes
int d(int n){String s=""+n;return n<71?n:d(Integer.parseInt(s.replaceFirst(".$",""))-Integer.parseInt(""+s.charAt(s.length()-1))*2);}

I hate how verbose Integer.parseInt is. Ungolfed:
static int div(int n) {
    if (n <= 70) {
        return n;
    } else {
        String num = ("" + n);
        int last = Integer.parseInt("" + num.charAt(num.length() - 1));
        int k = Integer.parseInt(num.replaceFirst(".$", "")) - last * 2;
        return div(k);
    }
}

Husk, 13 bytes
Ω≤70§-ȯD→d÷10

Try it online!
Tied with Pyth, using a modified method.
Explanation
Ω≤70§-ȯD→d÷10
Ω≤70          until the number is ≤ 70,
    §-        subtract
        →d    the last digit
      ȯD      doubled
          ÷10 from the number floor divided by 10

source: Stack Exchange

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

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

sort: votes


text:
Grocery Store Micromanagement
You are an employee at the hip new grocery store Half Foods, and it's the day before Thanksgiving Christmas Easter. Since the store will be packed with customers rushing to get their foodstuffs, the store needs a traffic manager to send everyone to the appropriate lines. Being lazy, you'd like to automate this so that you can go hit the deli before everyone takes all the turkey ham whatever. However, all you have with you is your phone, and coding long programs on it is a real pain -- so you need to bust out your ninja code-golf skills.
Challenge
Let's visualize the grocery store on a two-dimensional grid. Here's a sample grid to dissect:
                             e
                             s
                             s
                             s
                               Y

#           #                #s           #
#s          #                #s           #
#s          #                #s           #
#s          #s               #s           #
#3          #1               #4           #
 x           x                x            x

The grid starts out with an e, which represents an "outlet" to the rest of the store. Every generation, all of the outlets in the grid spawn a shopper (s) directly below. The shoppers move downward each generation until they reach you (Y). When a shopper reaches the same row as you, you must teleport the shopper to the beginning of the line with the least amount of shoppers in it. A shopper immediately moves to the line when they would move into the row with the Y, there is no generation in between. The lines are represented by the #s -- the column after the #s is a line. The shoppers go down to the end of the line (represented by an exit x), and then turn into a random number between 1 and 5. Each generation, you must decrement numbered shoppers by 1 -- when a shopper would reach 0, they're done checking out and they leave the store.
Given an input of a grid like this, output the next generation of the grocery store (move all the shoppers down simultaneously, redirect shoppers, and have them leave if they are done).
Samples
Input:
                e

                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
 x           x                x            x

Output:
                e
                s
                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
 x           x                x            x

Input:
                e
                s
                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
 x           x                x            x

Output
                e
                s
                     Y

#s          #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
 x           x                x            x

Input:
                e

                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#s          #                #            #
#           #                #            #
 x           x                x            x

(Possible) Output:
                e
                s
                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#3          #                #            #
 x           x                x            x

Input:
                e
                s
                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#3          #                #            #
 x           x                x            x

Output:
                e
                s
                     Y

#           #s               #            #
#           #                #            #
#           #                #            #
#           #                #            #
#2          #                #            #
 x           x                x            x

Input:
                e

                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#1          #                #            #
 x           x                x            x

Output:
                e
                s
                     Y

#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
#           #                #            #
 x           x                x            x

This is code-golf, so shortest code wins.

I really don't get the input format.

@QPaysTaxes Input can be either a multi-line string or an array of single line strings as per our defaults for taking multiple lines of input.

No, I mean that I just don't get the challenge, really.

Rather than rely on the examples, it might be worth stating explicitly that the shopper can never be on the same row as Y, as moving down to the Y row and being teleported to the top of the relevant queue happen in a single step.

It would also help to have a description of how a queue moves, with a test case as an example. If there are 3 shoppers vertically adjacent in a queue, and the lowest can move down, do all 3 move down together in a single step or does the available space move up one row at a time as each shopper moves into it?

This sounds fun. Will the lines (#s) always be the same length as each other? Should shoppers always be sent to the queue with the least people? E.g. 5sss is likely slower than 1ssss, by 1 generation on average. Or is the point to simulate the uncertainty of this situation in real life? :)

@ChrisM Very belated but yes they'll be the same length. I didn't want to overcomplicate the line selection procedure even though there's a chance shorter lines could be slower.

Do we assume that there will always be 4 lines of #, and, if yes, do we assume that the array are always at the same position ? Also, do we assume that the input will the result of a previous generation ?

@HatsuPointerKun There can be an arbitrary number of lines. I can add examples with more lines if necessary.

Python 2, 477 463 453 449 423 402 397 396 393 bytes
t=input()
e=enumerate
q,r=" s"
for i,L in list(e(t))[:0:-1]:
 for j,c in e(L):
	a=t[i-1][j]
	if"0"<c<"6":L[j]="0 1234"[int(c)]
	if(r==a)*q==L[j]:t[i-1][j],L[j]=q+r
	if"e"==a:L[j]=r
	if r==L[j]and"x"==t[i+1][j]:L[j]="5"
 if"Y"in L:x=L.count(r);t[i]=[p.replace(r,q)for p in L]
for i,l in list(e(t))[::-1]:
 for j,c in e(l):
	if"#"==c and(q==l[j+1])*x:x-=1;l[j+1]=r
print"\n".join(map("".join,t))

Try it online!
Still working on golfing this but it solves the problem for now

You can remove excess indentation and line breaks (single line blocks can go on the same line as the start of the block)

@SolomonUcko Where are you talking about?

Are tabs 8 spaces to python? 2. I think you can remove the line breaks after the last 2 for loops.

Tabs are their own thing in Python. 2. You can't remove that line break.

Does python just count the first indentation level in a block as the indentation level for that block? 2. Do you know why not? I tested it and it doesn't work.

BTW, wow about the program.

I've updated to spec to clarify this, but the "when a shopper reaches 0 they leave" means that when a shopper would reach 0 they leave, not the generation after they hit 0. (That is if you have a shopper at 1 they will be gone next generation). The last example illustrates this.

Other than that this seems great. I originally hadn't considered multiple entrances but since your program supports it I'll update the spec to specify there can be multiple.

@quartata Cool I fixed the problem.  Unfortunately it didn't save any bytes to remove zero.  But on the bright side it didn't cost any either.

how did you get a bounty from the community?

@tfbninja There was a bounty that expired and I had the top voted new answer so I received half of it.

C++, 898 896 885 841 bytes
Very long to code... but it's there
-2 bytes thanks to Conor O'Brien
-45 byte thanks to Zacharý
#include<vector>
#include<string>
#include<algorithm>
#include<ctime>
#define B begin()
#define L length()
#define C(e)if(i[j].find(e)!=string::npos&&!
#define S's'
#define T size()
#define U i[x][a]
using namespace std;auto g=[](auto&i){int e=i[0].find('e'),n=0,y=0,h=0,o,j,c,x,t=0;for(auto&a:i)t=a.L>t?a.L:t;for_each(i.B,i.end(),[&i,t](string&s){s.resize(t);});srand(time(0));vector<int>s,l;for(j=0;j<i.T;++j){C(S)y)++n;C(89)0)y=j;C(35)h){h=j;for(int d=0;d<i[j].T;++d)if(i[j][d]==35)l.push_back(d+1);s.resize(l.T);}if(h)for(c=0;c<l.T;c++)if(i[j][l[c]]!=32)++s[c];C('x')0)x=j;}--x;for_each(l.B,l.end(),[&i,&x,h](int&a){if(U!=32)--U;if(U==10)U=32;for(int b=x;b>h;--b){if(i[b][a]==32&&i[b-1][a]==S){i[b][a]=S;i[b-1][a]=32;}}if(U==S)U=49+rand()%5;});if(i[y-1][e]==S)i[h][l[min_element(s.B,s.end())-s.B]]=S;for(j=1;j<n+2;++j)if(j<y)i[j][e]=S;};

So... some details :

You have to pass a std::vector<std::string> ( they will be resized at the same length the longest string is )
All lines of # starts at the same y ( vertical ) coordinates, are the same length, and end at the same y ( vertical ) coordinates
Assume that the grid have at least 1 # line or more, have one letter e ( one outlet ) at the top, one letter Y
Assume that the input is a valid output so the shoppers waiting to be redirected will always be one after another

Edit : Just saw in the comments of Wheat Wizard's answer that it should support multiple entrances, i will continue to work on that

Maybe you could make that C macro be #define C(e)i[j].find(e)!=string::npos?

My answer supports multiple entrances as a side effect, of it being golfy.  Quartata said it would be required, but I don't see it in the question, so as far as I'm concerned you are free to only support a single entrance.

@WheatWizard Well, if i read the question, it says : "The grid starts out with an e, which represents an outlet" and "all of the outlets", so that suggest it can have several entrances

You can change the definition of C(e) to be #define C(e)if(i[j].find(e)!=string::npos and change the calls accordingly.

And since length() is only applied on a, you can change L to be defined as a.length(), modifying calls accordingly. In addition, you can move the using namespace std; to the bottom, saving a byte by removing the newline

Three things, using namespace std; can be placed on the bottom line to save a byte, and you can remove the space between C(e) and its definition, and all that combined with a ton macro-shenanigans gives 841 bytes

840 bytes, using #define T.size() and replacing the references accordingly (which means changing every . before T to a space except for i[j].T which becomes i[j]T, saving the byte)

734 bytes

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


text:
1-up your average quine
A 1-up quine is a program which is very similar to a quine. The one major difference is that instead of printing itself once, when n copies of the program are concatenated, the result prints the original program n+1 times.
Example
If your program is Abc123:
Abc123  ->  Abc123Abc123
Abc123Abc123  ->  Abc123Abc123Abc123
Abc123Abc123Abc123  -> Abc123Abc123Abc123Abc123

Challenge
Your challenge is to create the shortest valid 1-up quine in any language. The usual quine rules apply, so you may not:

Submit the empty program.
Directly or indirectly read1 the source code.
Use quining built-ins.

This is code-golf, so shortest code in bytes wins.
1This does not include using a hard-coded string or code block as part of your program.

Is it ok if n is limited by some data type restriction (maximum integer size etc)?

@LuisMendo I think that's OK, as long as you can support a reasonable number of repeats (100, maybe).

Is reading the length of the source code using a builtin quining method okay?

@CᴏɴᴏʀO'Bʀɪᴇɴ That seems a little too similar to getting the source code itself to me, since you're still getting information about the source code. So no.

GolfScript, 12 bytes
{`'.~'+:n}.~

Try it online!
Explanation
This combines ideas from the standard GolfScript quine:
{'.~'}.~

And my recently discovered quine:
":n`":n`

The main idea is again to use n which is printed implicitly at the end of the program in order to get the additional copy of the quine. Since assigning the variable doesn't change anything when it's done again in subsequent copies, this will only add one copy. Here's a breakdown of the code:
{        # Standard quine framework. This pushes the block, duplicates it and runs the
         # second copy, such that it can process the first copy to create a quine.
  `      # Convert the block to its string representation.
  '.~'+  # Append the string '.~' to make a complete quine. This is simply left on the
         # stack to be printed at the end.
  :n     # Store the string in n such that one more copy is printed at the end.
}.~

GolfScript, 12 bytes
{: ".~"][}.~

Try it online!
How the source code works
{: ".~"][}.~

{        }    Define and push a code block.
          .~  Push a copy and execute it.
 :            Save the code block in the space character.
              Every subsequent space will now execute the code block.
   ".~"       Push that string.
       ]      Wrap everything up to the last [ in an array.
        [     Set a new array marker.

If the above source code is executed once, the stack will end up as
["" {: ".~"]} ".~"]

where the empty string at the beginning corresponds to the initial state of the stack (empty input).
Two copies of the source code would leave a final state of
["" {: ".~"]} ".~"] [{: ".~"]} ".~"]

three copies a final state of
["" {: ".~"]} ".~"] [{: ".~"]} ".~"] [{: ".~"]} ".~"]

and so on.
What happens next
After executing the source code, the interpreter does the following.

It wraps the entire stack in an array, and pushes that array on the stack.
For two copies of the source code, the stack now contains
["" {: ".~"][} ".~"] [{: ".~"][} ".~"] [["" {: ".~"][} ".~"] [{: ".~"][} ".~"]]

It executed puts with the intention of printing the wrapped stack, followed by a linefeed.
puts is defined as {print n print}, so it does the following.

print prints the wrapped up copy of the stack without inspecting it (i.e., without converting it to its string representation). This sends
{: ".~"][}.~{: ".~"][}.~

(the source code) to STDOUT and pops the stack copy from the top of the stack.
The stack now contains
["" {: ".~"][} ".~"] [{: ".~"][} ".~"]

 executes the code block we defined previously.
: begins by saving [{: ".~"][} ".~"] in the space character, then ".~" pushes itself, ] wraps the ".~" in an array, and [ sets a new array marker.
n pushes a string consisting of a single linefeed.
The stack now contains
["" {: ".~"][} ".~"] [{: ".~"][} ".~"] [".~"] "\n"

 is executed once more. However, it was redefined when we called it for the first time and now contains an array, not a code block.
In fact, it pushes [{: ".~"][} ".~"], leaving the stack as
["" {: ".~"][} ".~"] [{: ".~"][} ".~"] [".~"] "\n" [{: ".~"][} ".~"]

Finally, print prints the topmost stack item without inspecting it, sending
{: ".~"][}.~

to STDOUT, 1-upping the source code.

Javascript ES6 (REPL), 55 bytes
var a=-~a;$=_=>`var a=-~a;$=${$};$();`.repeat(a+1);$();

Saved 2 bytes thanks to @user81655!
Explanation
Here's the standard quine framework:
$=_=>`$=${$};$()`;$()

You should be able to see this framework inside the submission. More explanation below.

var a=-~a;

This is the counter, defaulted to 1. Basically, it tells us how much to repeat the quine and increments at the same time.
$=_=>`var a=-~a;$=${$};$();`.repeat(a+1);$();

This is the quine part. We essentially repeat the quine string by the counter+1. Subsequent function calls will override the output.

This might be just me, but this doesn't seem to print anything. (tested using JSFiddle, if it matters?)

Ah, you should use the Firefox console. (And reload after each run to reset a).

I don't think you need var

No, I do because a is initially undefined. Using var allows us to work with it.

CJam, 14 bytes
{"_~"]-2>_o}_~

Try it online!
How it works
{"_~"]-2>_o}_~

{          }    Define a code block and push it on the stack.
            _~  Push and execute a copy of it.
 "_~"           Push that string.
     ]          Wrap the entire stack in an array.
      -2>       Discard all but the last two elements (block and string).
         _o     Push and print a copy of that array.

After the last copy of the program has been executed, the array that contains the block and the string is still on the stack, so it is printed implicitly.

Ruby, 43 bytes
1;s="1;s=%p;$><<s%%s*n=2-0";$><<s%s*n=2-0

By itself, this prints itself 2-0 or 2 times. When concatenated to another copy of itself, the final print statement looks like $><<s%s*n=2-01, meaning it outputs itself just once (01 being octal 1). So only the final copy of the string prints twice, the others print once.
The inline assignment to n is just to get the order of operations working correctly; state isn't actually being passed from one copy to the next.

NodeJS, 63 61 60 55 bytes
this will also work in JavaScript (ES6) if you consider multiple console messages to be separated by newlines (no REPL required)
Saved 2 bytes thanks to @dev-null
(f=_=>(t=_=>console.log(`(f=${f})()`)||(_=>t))(t()))()

note that there is a newline at the end of the code.

This was an interesting one, definitely one of my favorites for this site so far.
I'm fairly confident this can't be golfed much more. (maybe SpiderMonkey's print function...)
Explanation
//FIRST ITERATION
            console.log(`(f=${f})()`)                   //logs to the console a quine of the source code using function f's toString()
                                     ||                 //causes the expression to evaluate to the second part, since console.log's return value is falsy
                                       (_=>t)           //a function that returns function t when called
       t=_=>                                            //defines function t to be the code above. When called, t will log a quine and then return a function that returns t.
      (                                      )(t())     //call t twice. (one call is done via the t() as an ignored parameter) This will print the quine twice.
 f=_=>                                                  //define f as the above code.
(                                                  )()  //call function f with no arguments. this results in a function returning t. (the result of calling t once)
                                                        //this newline is to compensate for console.log's behavior of adding a newline to its output
//SECOND ITERATION
(                                                  )    //call the function that returns t that was returned from the first iteration. This expression will result in whatever that function returns, which is t.
 f=_=>(t=_=>console.log(`(f=${f})()`)||(_=>t))(t())     //this part evaluates to a function, which is passed as a parameter to the function that returns t, that ignores its parameter.
                                                    ()  //call whatever the last expression returned, which is the function t, with no parameters. This will print the quine once.
                                                        //this call will result in a function returning t, just like from the first iteration, so we can add on more iterations at will.

I love how it also looks like it's putting on sunglasses first. (f=_= I may be a little too tired.

Groovy, 83 bytes
s="s=%c%s%c;f={printf(s,34,s,34,10)};f()%cf()//";f={printf(s,34,s,34,10)};f()
f()//

There is one embedded and no trailing newline. This prints:
s="s=%c%s%c;f={printf(s,34,s,34,10)};f()%cf()//";f={printf(s,34,s,34,10)};f()
f()//s="s=%c%s%c;f={printf(s,34,s,34,10)};f()%cf()//";f={printf(s,34,s,34,10)};f()
f()//

The function f() prints one copy of the quine. The initial program calls it twice. The first line of the appended code becomes a comment and only the second call to f() is executed.

Ruby, 55 bytes
n||=2;s="n||=2;s=%p;$><<(s%%s)*n;n=1;";$><<(s%s)*n;n=1;

Nothing very interesting here, it is just a normal ruby quine with a counter.

JavaScript (ES6), 164 bytes
console.log((`+String.fromCharCode(96)).repeat(window.a||(a=3,5)).slice(67,-14))
console.log((`+String.fromCharCode(96)).repeat(window.a||(a=3,5)).slice(67,-14))

Works in any JS testing page or console in Firefox, assuming that the space between two console messages counts as a newline.

Many props for doing this in a general-purpose language!

shorten window to this.

Perl 6, 58 53 bytes
Thanks to Jo King for -5 bytes.
<say "<$_>~~.EVAL for 0..!.++;">~~.EVAL for 0..!.++;

Based on Jo King's quine.
Try it online!

Python 3.8 (pre-release), 65 61 55 bytes
a=2
exec(s:='print(end="a=2\\nexec(s:=%r)#"%s*a);a=1')#

Try it online!

Python 2, 60 bytes
s='try:n\nexcept:n="s=%r;exec s"%s;print n\nprint n';exec s

Try it online!

Japt, 40 bytes
Oo("+Q ²pT°?1:2 é4;POo("+Q ²pT°?1:2 é4;P

Test it online! Explanation to come.

Y
Noncompeting, 6 bytes
UCn*px

Y is  a headcannon that I've had for a while, and this inspired me to write it. It is made for challenges in which sequencing is key, such as this. The code is divided into links by "node" characters. In this case, our code is put into two chains (originally), with the node being C.
U  C  n* px
1  N    2

U records a transcendental string, i.e., one that spans links. It records until it meets another U. If a U is not met by the end of the string, it wraps around. Also, U is included in the string by default. After recording the string, we proceed to the node C, which just moves us to the next link.
n pushes the number of chains. For our base case, this 2. For a sequence of K chains, there are K+2 chains, as there are K nodes. * is string repittion. p prints the entire stack (in this case, one string), and x terminates the program.
In a text:
UCn*px
U..... record that string
 C     next link
  n*   repeat that string twice.
    px print and terminate

UCn*pxUCn*pxUCn*px
U.....U            record string
 C                 next link
  n*               repeat that string four times (three Cs)
    px             print and terminate

Try it here!

So what would be the practical use of U besides quining? (Congrats on 7k, btw)

@ETHproductions U can be used to capture a string that spans links, also able to capture and spend a link dismantles to the program. And thanks! :D

Brachylog, 20 bytes
⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅

Try it online!
Modified from this quine.
⊥                       Fail,
 ∨                      or
                w       print
  "⊥∨~kgjw₃w₅"          "⊥∨~kgjw₃w₅"
                 ₃      formatted
              gj        with itself;
                 ₃w₅    print it again at the end of the program if this route succeeds.

When this is concatenated with itself, every route except the last fails and the program moves on to the next one, executing each w₃ and backtracking past every w₅ except the very last one.
⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅

Try it online!
⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅

Try it online!
⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅⊥∨"⊥∨~kgjw₃w₅"gjw₃w₅

Try it online!


text:
TinyBF to Brainf*** converter
We have a Brainf*** to TinyBF converter, but not the other way around, so here's one.
Rules:

Your interpreter must take a valid TinyBF program, on one line, and it must output the corresponding BrainF*** program, on one line, with optional trailing whitespace/newline. No leading whitespace is allowed
The input may or may not contain characters that are not any of the four TinyBF characters. If so, you must print all of these characters in the same spots.
An answer will be accepted on April 1st (not joking), based on some obscure criteria I will use (jk ;) I will accept the shortest program that does not cheat by the following rules)
No 0-byte or 1-byte solutions, because it ruins the fun if you make (or there is) a programming language just for this purpose)

Test Cases

Input 1: +++++>+++++=>=|>>+=>>+|=>|>+=>+| (Computes 5 (byte 1) + 5 (byte 2) = 10 (byte 3))
Output 1: +++++>+++++<[>>+<<-]>[>+<-]
Input 2: +++>++++Hi+++:P+=>=|>|>+>+=>>&&+|=>>|=>>=+!!>>=+|>>>+| (Computes 3 (byte 1) * 8 (byte 2) = 24 (byte 3))
Output 2: +++>++++Hi+++:P+<[>[>+>+<<&&-]>>[<<+!!>>-]<<<-]

Will there ever be I/O commands?

No, because TinyBF doesn't have IO commands.

That's incorrect; == is brainfuck's ..

Python 2, 106 bytes
a=0
r=''
for c in input():a=[a,~a][c=='='];r+={'+':'+-','>':'><','|':'[]'}.get(c,c)[a%-2]*(c!='=')
print r

Implements the TinyBF specification as found here. Try it online. Improvements were made using techniques from @Dica's answer. Requires quoted string input.

This works for all of my test cases! Good job.

You can save 5 bytes with r+=b.get(c,c+c)[a]*(c!='='). You can also make the for loop one line to save 3 more. You can inline the dict to save 4 more. Inlining input() is another 4.

Also, you need to either use raw_input or switch to Python 3 and take the byte penalty for print. Right now I get SyntaxError: invalid syntax.

@Mergo I based my answer on yours but I guess it's okay because the modifications are heavy, let me know if you want me to remove it

@MorganThrapp The input is quoted, so it works for 2. Taking quoted string input is allowed per a meta post that I can't find right now because I'm on mobile.

@Mego Oh, huh, did not know that. I would've assumed quoted input was disallowed.

@MorganThrapp Found it: http://meta.codegolf.stackexchange.com/questions/7633/string-input-with-or-without

Python 3, 97 bytes
This script is based on @Mego's answer
a=0
for c in input():a-=c=='=';print({'+':'+-','>':'><','|':'[]'}.get(c,c)[a%-2]*(c!='='),end='')

I think this is too similar to Mego's answer and should have been suggested as an optimization in a comment.

Although this is shorter, I accepted Mego's answer because your answer is too similar to Mego's an seems like an optimization rather than a distinct answer.


text:
Auto BATCH golfer
I love BATCH, despite its shocking lack of functional commands, despite even due to its lack of non-integer support. Why? Because this works:
SET var=SET
%var% i=0

This would evaluate to:
SET var=SET
SET i=0

Fantastic, isn't it? I've used this technique in a BATCH program before, because it saves bytes!
Your challenge, should you accept it, would be to "golf" BATCH programs in this way. You are to decrease the byte size of an input BATCH program by including SET statements that would evaluate to portions of the program, and in no other way modify the program. (This disallows, say, renaming a variable name to something shorter. Keep in mind that BATCH, asides from variables, is case insensitive.) Your score is calculated as thus:
score = # of characters in your program + 5*(net result bytes in test cases below)

I reserve the right to add more test cases, so as to discourage working to optimize the program for the test cases.
For the sake of this challenge, your SET statements cannot contain control characters (|, <, >, %) or linebreaks. You may not modify the code other than to move pieces of code inside a set statement. (That is, you may not remove unnecessary whitespace, replace EQU with ==, etc.) We will assume that the lines end with \n.
Test cases
Each test case is in a separate code block, and each test case is self-contained, meaning you should golf only assuming what's given within it. (I.e., if you SET d=SET in one program, that statement will not be automatically given to any other program). Each example result can be found after each test case. There is a line between test cases.
@ECHO OFF
SET increment=10
:loop
IF %increment% EQU 0 GOTO end
ECHO %increment%
SET /A %increment%-=1
GOTO loop
:end
EXIT

@ECHO OFF
SET /p INPUT=Enter input here:
SET R=%1
ECHO Last char of input here: %R:~-1%

@ECHO OFF
SET increment=10
:e
GOTO f
ECHO f
:f
GOTO g
ECHO g
:g
GOTO h
ECHO h
:h
GOTO i
ECHO i
:i
GOTO j
ECHO j
:j
IF 3==4 ( ECHO 4 ) ELSE ( ECHO 5 )
IF 5==3 ( GOTO l ) ELSE ( GOTO k )
:k
ECHO Done.
ECHO BATCH OUT!!
EXIT
:l
GOTO g

ECHO Hello, Hello, Hello, hello, hello, Hello, Hello!, hello, ello!, Lello.

Example outputs:
@ECHO OFF
SET increment=10
:loop
IF %increment% EQU 0 GOTO end
ECHO %increment%
SET /A %increment%-=1
GOTO loop
:end
EXIT (0 bytes saved)
@ECHO OFF
SET %i%= input here:
SET /p INPUT=Enter%i%
SET R=%1
ECHO Last char of %i%%R:~-1% (3 bytes gained)
@ECHO OFF
SET increment=10
SET g=GOTO
SET e=ECHO
:e
%g%f
%e%f
:f
%g%g
%e%g
:g
%g%h
%e%h
:h
%g%i
%e%i
:i
%g%j
%e%j
:j
IF 3==4 ( %e%4 ) ELSE ( %e%5 )
IF 5==3 ( %g%l ) ELSE ( %g%k )
:k
%e%Done.
%e%BATCH OUT!!
EXIT
:l
%g%g (10 chars saved)
SET %h%=ello,
ECHO H%h% H%h% H%h% h%h% h%h% H%h% Hello!, h%h% ello!, Lello.  (1 character saved)

Shortening batch for fun and profit!

You need some more specifications. Of course AAA %increment% → set a=increment¶AAA %%a%% is invalid, and AAA %1 BBB %2 → set a= BBB ¶AAA %1%a%%2 is valid. (iirc) So you need to formalize it. (¶ represents a newline)

Do we need to handle code that has delayed expansion enabled, percent-sign escapes, or multi-line for / if statements? As per the last test case (which produces additional output as echo is on and there's no @ before the SET) is extraneous output acceptable from the golfed program?

Tcl all over again

Can you make a scorer program?

despite even due to?

Java 8, Java 10, 3884 799/795 program + 484 output = 4368 1283/1279 total
There are two limitations of this code:

It assumes that variables from A to Z are free. (uppercase)
It assumes that there are no more than 27 substitutions.
Oh, and because Scanner doesn't quite cut it, empty input dumps out stacktrace.

But hey - there is a pro!

Outputs best code. Always.

The code manages to perform better than examples provided by challenge author.
This golfed version has been made by Kevin.
Java 8
c->{List<String>S=new Stack();HashMap<String,Integer>h=new HashMap(),s=new HashMap();int v=65,l=c.length(),b,e;do{for(b=0,l=c.length(),s.clear();b!=l;b++)for(e=b;++e<=l;)S.add(c.substring(b,e));S.removeIf(t->t.length()<5|t.matches(".*[\n|<%>].*"));S.forEach(t->h.merge(t,1,Integer::sum));S.clear();h.entrySet().removeIf(t->t.getValue()==1);String Y=c;int L=l;char V=(char)v;h.forEach((k,x)->{String i=Y,t;for(int j,I,q;i.contains(k);i=t+"%"+V+"%"+i.substring(j+k.length(),i.length())){for(I=-1,t=i.substring(q=0,j=i.indexOf(k));(I=t.indexOf("%",++I))>=0;q++);if(q%2>0)return;}i="SET "+V+"="+k+"\n"+i;if(i.length()<L)s.put(i,L-i.length());});h.clear();v++;c=s.isEmpty()?c:s.entrySet().stream().max((x,y)->x.getValue()>y.getValue()?1:-1).get().getKey();}while(l>c.length());return c;}

Try it online!
Java 10
c->{var S=new Stack<String>();HashMap<String,Integer>h=new HashMap(),s=new HashMap();int v=65,l=c.length(),b,e;do{for(b=0,l=c.length(),s.clear();b!=l;b++)for(e=b;++e<=l;)S.add(c.substring(b,e));S.removeIf(t->t.length()<5|t.matches(".*[\n|<%>].*"));S.forEach(t->h.merge(t,1,(x,y)->x+y));S.clear();h.entrySet().removeIf(t->t.getValue()==1);var Y=c;int L=l;var V=(char)v;h.forEach((k,x)->{String i=Y,t;for(int j,I,q;i.contains(k);i=t+"%"+V+"%"+i.substring(j+k.length(),i.length())){for(I=-1,t=i.substring(q=0,j=i.indexOf(k));(I=t.indexOf("%",++I))>=0;q++);if(q%2>0)return;}i="SET "+V+"="+k+"\n"+i;if(i.length()<L)s.put(i,L-i.length());});h.clear();v++;c=s.isEmpty()?c:s.entrySet().stream().max((x,y)->x.getValue()>y.getValue()?1:-1).get().getKey();}while(l>c.length());return c;}

Try it online!.
Original version
It's not golfed at all, I just wanted to have some fun, not to suffer. If you, dear reader, would like to golf this answer, please do it.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;

public class Main {
	List<String> substrings = new ArrayList<String>();
	HashMap<String, Integer> hm = new HashMap<String, Integer>();
	HashMap<String, Integer> scores = new HashMap<String, Integer>();

	private int v1 = 65;

	public static String rfos(String inputString, String stringToReplace,
	        String stringToReplaceWith) {

	    int length = stringToReplace.length();
	    int inputLength = inputString.length();

	    int startingIndexofTheStringToReplace = inputString.indexOf(stringToReplace);

	    if(count(inputString.substring(0, startingIndexofTheStringToReplace), "%") % 2 == 1)
	    	return null;

	    String finalString = inputString.substring(0, startingIndexofTheStringToReplace) + stringToReplaceWith
	            + inputString.substring(startingIndexofTheStringToReplace + length, inputLength);

	    return finalString;

	}

	public static int count(String text, String find) {
        int index = 0, count = 0, length = find.length();
        while( (index = text.indexOf(find, index)) != -1 ) {
                index += length; count++;
        }
        return count;
	}

	private String process(String program) {
		int begin = 0, end, il = program.length();

		scores.clear();

		while(begin != program.length()) {
			for(end = begin + 1; end < program.length() + 1; end++)
				substrings.add(program.substring(begin, end));
			begin++;
		}

		substrings.removeIf(new Predicate<String>() {
			@Override
			public boolean test(String arg0) {
				return arg0.length() <= 4 || arg0.contains("\n")
						|| arg0.contains("|")
						|| arg0.contains("<")
						|| arg0.contains("%")
						|| arg0.contains(">");
			}
		});

		substrings.forEach(new Consumer<String>() {

			@Override
			public void accept(String t) {
				if(hm.containsKey(t)) {
					hm.replace(t, hm.get(t) + 1);
				} else {
					hm.put(t, 1);
				}
			}

		});

		substrings.clear();

		hm.entrySet().removeIf(new Predicate<Map.Entry<String, Integer>>() {

			@Override
			public boolean test(Map.Entry<String, Integer> t) {
				return t.getValue() == 1;
			}

		});

		hm.forEach(new BiConsumer<String, Integer>() {

			@Override
			public void accept(String arg0, Integer arg1) {
				String iteration = program;
				boolean between = false;
				while(iteration.contains(arg0)) {
					iteration = rfos(iteration, arg0, "%" + Character.toString((char) v1) + "%");
					if(iteration == null)
						return;
				}
				iteration = "SET " + Character.toString((char) v1) + "=" + arg0 + "\n" + iteration;
				if(iteration.length() < program.length())
					scores.put(iteration, program.length() - iteration.length());
			}

		});

		hm.clear();
		v1++;

		if(scores.isEmpty())
			return program;
		else
			return scores.entrySet().stream().max((entry1, entry2) -> entry1.getValue() > entry2.getValue() ? 1 : -1).get().getKey();
	}

	public static void main(String[] args) {
		Main processor = new Main();
		int genid = 0, before = 0, after = 0;
		String currentCode = new Scanner(System.in).useDelimiter("\\Z").next();

		System.out.println("Calculating first generation...");

		do {
			String cc = processor.process(currentCode);
			before = currentCode.length();
			after = cc.length();

			currentCode = cc;

			if(before > after) {
				System.out.println("Generation " + genid++);
				System.out.println(before + " -> " + after);
				System.out.println("***\n" + cc + "\n***");
			} else {
				System.out.println("Generation FAIL " + genid++);
				System.out.println(before + " -> " + after);
				System.out.println("***\n" + cc + "\n***");
			}
		} while(before > after);

	}

}

Example output:
SET B=GOTO
SET A=ECHO
@%A%OFF
SET increment=10
:e
%B%f
%A%f
:f
%B%g
%A%g
:g
%B%h
%A%h
:h
%B%i
%A%i
:i
%B%j
%A%j
:j
IF 3==4 ( %A%4 ) ELSE ( %A%5 )
IF 5==3 ( %B%l ) ELSE ( %B%k )
:k
%A%Done.
%A%BATCH OUT!!
EXIT
:l
%B%g

Try it online!

I think all that "java.util." is repetitive. You may wany to simplify your code to import java.util.*.

I thought jdk imports do not count?

@A_ you may modify my answer as you wish (unless it's valid and keeps the spirit)

"If you, dear reader, would like to golf this answer, please do it." 799 bytes in Java 8 or 795 bytes in Java 10+. You're welcome. :) Can definitely be golfed some more, but this will do for now.

@KevinCruijssen Thanks for the contribution. I've added your version to the post. Feel free to edit it without asking me if you find something better.

Suggest e++<l instead of ++e<=l


text:
Output the smallest powers of 2 with two identical sub-strings of digits n long
For each integer n, 0 or higher, output the lowest power of 2 that has two identical sub-strings of n digits in decimal, and the two indices where the digit sub-strings start (0-based).

n      Output      Proof (don't output this)
     0  =>  0 [0 1]        (_1 & 1_)
     1  =>  16 [0 4]      (65536 & 65536)
     1  =>  16 [1 2]      (65536 & 65536)
     2  =>  24 [0 6]      (16777216 & 16777216)
     2  =>  24 [2 3]      (16777216 & 16777216)

The possible outputs for the first three inputs are given above. When there is more than one output for a given input, either is acceptable. Only the digit positions will be different. Just output the numbers, the brackets are for clarity only. You don't need to output n.
Output a list of as many as you can find in one minute, or your code runs out of resources, whichever comes first. Please include the output with your answer. If the list is huge, just restrict it to the first and last 5. Your code must be able to find up to n = 9 in under a minute. I've written a Perl program that finds n = 9 after about 20 seconds, so this should be easy to do.
Your code doesn't need to halt itself. It is acceptable if you manually break out if it after a minute.
This is code-golf, so lowest number of bytes wins!

I don't get it, should we output only the lowest power of 2, or as many as we can find in one minute?

@CJDennis Should we time it ourself (and halt it) or we can just let it run?

It's not clear if this challenge is a code-golf or [tag:fastest-code]. If you want to keep the primary winning criterion as code-golf, you might want to make a certain speed goal a validity criterion instead (e.g. must return an answer for n = 10 in less than one minute).

APL (Dyalog Extended), 68 bytes
'01'(0{x≢`∪x←⍺⍺,/⍺:⍺((⍺⍺+1)∇∇)⊃⎕←⍵,⊃a/⍨</¨⊢a←⍸∘.≡⍨x⋄(+⌂big⍨⍺)∇1+⍵})0

Try it online!
APL is not known for big integer arithmetic, infinite output, or interpreter speed (and using Extended incurs even more overhead), yet it outputs successfully up to n=9 barely under a minute.
How it works
The code is basically an infinitely running recursive operator. The left argument is the string representation of the power of 2, the right argument is the corresponding exponent (which was needed to meet the speed requirement), and the left operand is the current value of n.
{
  x←⍺⍺,/⍺          ⍝ Extract length-n segments of given number
  x≢`∪x:           ⍝ If it has duplicates...
  a←⍸∘.≡⍨x         ⍝   Construct the pairs of indices of equal slices
  ⊃a/⍨</¨⊢a        ⍝   Keep the ones (L,R) where L<R and take the first one
  ⊃⎕←⍵,...         ⍝   Concat with the exponent, print it, extract ⍵ back
  ⍺((⍺⍺+1)∇∇)...   ⍝   Continue running with n+1
  ⋄                ⍝ Otherwise...
  (+⌂big⍨⍺)∇1+⍵    ⍝   Recurse with next power of two, using same n implicitly
}
'01'(0{...})0  ⍝ Invoke the dop with starting values

Mathematica, 109 bytes
f@n_:={NestWhile[#+1&,0,Length[p=Position[#,#&@@Commonest@#,1,2]-1]&@Partition[IntegerDigits[2^#],n,1]<2&],p}

n    output
0    {0, {{0},{1}}}
1    {16, {{0},{4}}}
2    {24, {{0},{6}}}
3    {41, {{8},{9}}}
4    {73, {{10},{18}}}
5    {130, {{14},{17}}}
6    {371, {{8},{52}}}
7    {875, {{68},{101}}}
8    {2137, {{12},{240}}}
9    {2900, {{270},{355}}}
10   {7090, {{803},{1123}}}
11   {12840, {{1672},{3185}}}

I don't know Mathematica very well, so if you can save some bytes by removing some braces in the output, by all means do so.

@CJDennis Actually, that's the natural expression. I didn't add these braces intentionally.

@njpipeorgan isn't your program wrong at least for n=3? I think 2^41=2199023255552, which mean the part found by your program is actually 555 and it overlapse with itself.

@Katenkyo 2199023255552 overlaps with 2199023255552

@njpipeorgan nevermind, just saw overlapping matches are authorized... Which totally invalidate what i was working on.

Python2, 137  119 bytes
It's pretty straightforward:
i=m=0
while 1:
 n=`2**i`
 for k in range(len(n)-m+1):
    q=n.find(n[k:k+m],k+1)
    if-1<q:print i,k,q;m+=1;break
 else:i+=1

and the output:
n   output
0   0 0 1
1   16 0 4
2   24 0 6
3   41 8 9
4   73 10 18
5   130 14 17
6   371 8 52
7   875 68 101
8   2137 12 240
9   2900 270 355
10  7090 803 1123

18 bytes saved by btwlf

Welcome, I'm new here too. Trying to find a better solution with if substring in string I figured out some issues which could enhance your bytescore. Firstly str() may be replaced by backticks, see here. Secondly you missed, that p always equals k.

Perl - 99 bytes
use bigint;%_=$_+=$_//1;$%+=($s=$_{$1}//=pos)<pos&&print"$- $s $-[0]
"while/(?=(.{$%}))/g;$-++;do$0

Trading bytes for efficiency. n = 9 finishes in about 25s, around 15x slower than the version below.

Perl - 120 bytes
use bigint;for$i(0..2e4){$_==($s=$_{$_[$_]}//=$_)or($%+=print"$i $s $_
"),last for 0..(@_=/(?=(.{$%}))/g);%_=$_+=$_//=1}

The regex /(?=(.{$%}))/g returns all substrings of the current value of length $%. The list is iterated, and if a value is seen twice, it is reported.

Output
0 0 1
16 1 2
24 2 3
41 8 9
73 10 18
130 14 17
371 8 52
875 68 101
2137 12 240
2900 270 355
7090 803 1123
12840 1672 3185

Output for n = 10 at about 9s, for n = 11 at 30s.

If you use -E you can change to say"..." without the linebreak

and -Mbigint  is 2 bytes shorter than use bigint;

Cant you change for$i(0..2e4) to while(++$i) if you have no intentions on exiting anyway?

0..2e4 is necessary, or the output is off by one. for(;;$i++) misses the first zero.

PowerShell, 168 158 139 135 bytes
slow
param($l)for(--$p;!"$j"){if(!$d){$m=@{};$i=-1
$n='1'*!$l+[bigint]::Pow(2,++$p)}$d=''+$n[++$i..($i+$l-1)]
$j=$m.$d;$m.$d=$i}"$p [$j $i]"

Try it online!
Less golfed:
param($l)
for(--$p;!"$j"){
    if(!$d){
        $m=@{}
        $i=-1
        $n='1'*!$l+[bigint]::Pow(2,++$p) # if($l -eq 0){'11'}else{'[bigint]'}
    }
    $d=''+$n[++$i..($i+$l-1)]
    $j=$m.$d
    $m.$d=$i
}
"$p [$j $i]"

output from my notebook:
Elapsed          N     output
-------          ----- ------------------------------
00:00:00.0659394 0 =>  0 [0 1]
00:00:00.0227806 1 =>  16 [1 2]
00:00:00.1038194 2 =>  24 [2 3]
00:00:00.3169680 3 =>  41 [8 9]
00:00:01.0266805 4 =>  73 [10 18]
00:00:03.3426611 5 =>  130 [14 17]
00:00:34.3156609 6 =>  371 [8 52]
00:04:23.3928567 7 =>  875 [68 101]

PowerShell, 187 194 bytes
Add some bytes to remove redundant iterations.
Thanks @CJ Dennis
param($l)for($p=0;!($a=0..($l-1)-ge0|%{[bigint]::Pow(2,$p)-replace"^.{$_}",('-'*$_)}|sls('\d'*$l+'\b'*!$l)-a|% m*|group|? c* -ge 2|%{$i,$j=($_|% Gr*|% I*)[0,1]
,"$p [$i $j]"*($i-ne$j)})){++$p}$a

Try it online!
Less golfed and slightly faster code:
param($l)

$regexp = '\d'*$l+'\b'*!$l  # digits or boundary
$range = 0..($l-1) -ge 0
$power = 0

do{
    $n = [bigint]::Pow(2,$power)

    $s = $range|%{$n-replace"^.{$_}",('-'*$_)}
    $m = $s|Select-string $regexp -AllMatches|% Matches

    # $s contains strings in which a regexp captures all substrings of $l digits
    # $m contains the captured matches
    # example with $l=3 and $p=43:
    #
    # $s               matches after $regexp
    # =============    =====================
    # 2199023255552 -> 219 902 325 555
    # -199023255552 -> 199 023 255 552
    # --99023255552 -> 990 232 555

    $a = $m|Group|? Count -ge 2|%{
        $i,$j = $_|% Group|% Index|Select -First 2
        if($i -ne $j){
            "$power [$i $j]"
        }
    }

    ++$power
}
until($a)

write-output $a

Try it online!
The output on my notebook:
Elapsed          N     output
-------          ----- --------------------
00:00:00.1183433 0 =>  0 [0 1]
00:00:00.0135382 1 =>  16 [1 2]
00:00:00.0135382 1 =>  16 [0 4]
00:00:00.0224871 2 =>  24 [0 6]
00:00:00.0224871 2 =>  24 [2 3]
00:00:00.0353316 3 =>  41 [9 8]
00:00:00.0649162 4 =>  73 [10 18]
00:00:00.1572769 5 =>  130 [17 14]
00:00:00.7403980 6 =>  371 [8 52]
00:00:02.6019309 7 =>  875 [101 68]
00:00:15.8726659 8 =>  2137 [240 12]
00:00:30.0988879 9 =>  2900 [270 355]
00:03:20.7172180 10 => 7090 [803 1123]

It looks like your code doesn't get to n=9 in a minute.

yes, it is. it need to take out of the loop: the [bigint], the regexp. it need to calculate the output string if $i -ne $j only. But This is code-golf, so lowest number of bytes wins! :)

JavaScript (ES6), 111 bytes
n=>(C=i=>(I=S.indexOf(S.slice(i,i+n)))==i?S[i+n]?C(i+1):-1:i,P=p=>(z=C(0,S=(2n**p+'')))<0?P(++p):p,[P(0n),I,z])

It calculates the first 9 fairly quickly, but then reaches the maximum call stack size for n=10;
[0n, 0, 1]
[16n, 0, 4]
[24n, 0, 6]
[41n, 8, 9]
[73n, 10, 18]
[130n, 14, 17]
[371n, 8, 52]
[875n, 68, 101]
[2137n, 12, 240]
[2900n, 270, 355]

Here's how it works:
n=>(                                // take n as input
  C=i=>                             // C finds recurring match in string S
    (I=S.indexOf(S.slice(i,i+n)))   // calculate the first index of a substring
      ==i                           // the index of the substring being tested
    ?                               // if those are equal, no match
      S[i+n]                        // if we're not at end of string,
      ?C(i+1)                       // continue recursing
      :-1                           // otherwise, return -1 (no match)
    :i,                             // we have a match, return i
  P=p=>                             // loops over powers of 2 and check matches
    (z=C(0,S=(2n**p+'')))<0         // check 2^p for match
    ?P(++p),                        // if no match, continue recursing
    :p                              // if we find a match, return the power
  [P(0n),I,z]                       // return power, first and last index
)