text:
Subset Sum Orderings
A set of n positive numbers has 2^n subsets. We'll call a set "nice" if none of those subsets have the same sum. {2, 4, 5, 8} is one such nice set. Since none of the subsets has the same sum, we can sort the subsets by sum:
[{}, {2}, {4}, {5}, {2, 4}, {2, 5}, {8}, {4, 5}, {2, 8}, {2, 4, 5}, {4, 8}, {5, 8}, {2, 4, 8}, {2, 5, 8}, {4, 5, 8}, {2, 4, 5, 8}]
If we label the numbers [2, 4, 5, 8] with the symbols [a, b, c, d] in increasing order, we get the following abstract ordering:
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {d}, {b, c}, {a, d}, {a, b, c}, {b, d}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}]
Another nice set of positive numbers can have the same abstract ordering, or a different one. For instance, [3, 4, 8, 10] is a nice set with a different abstract ordering:
[{}, {a}, {b}, {a, b}, {c}, {d}, {a, c}, {b, c}, {a, d}, {b, d}, {a, b, c}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}]
In this challenge, you must count the number of distinct abstract orderings of nice sets of n positive numbers. This sequence is OEIS A009997, and the known values, starting at n=1, are:
1, 1, 2, 14, 516, 124187, 214580603

For instance, for n=3, the following are the two possible abstract orderings:
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}]
[{}, {a}, {b}, {a, b}, {c}, {a, c}, {b, c}, {a, b, c}]

For n=4, the following are the 14 possible abstract orderings, plus an example nice set with that ordering:
[{}, {a}, {b}, {a, b}, {c}, {a, c}, {b, c}, {a, b, c}, {d}, {a, d}, {b, d}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 4, 2, 1]
[{}, {a}, {b}, {a, b}, {c}, {a, c}, {b, c}, {d}, {a, b, c}, {a, d}, {b, d}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 6, 3, 2]
[{}, {a}, {b}, {a, b}, {c}, {a, c}, {d}, {b, c}, {a, d}, {a, b, c}, {b, d}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 7, 4, 2]
[{}, {a}, {b}, {a, b}, {c}, {a, c}, {d}, {a, d}, {b, c}, {a, b, c}, {b, d}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 6, 4, 1]
[{}, {a}, {b}, {a, b}, {c}, {d}, {a, c}, {b, c}, {a, d}, {b, d}, {a, b, c}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 8, 4, 3]
[{}, {a}, {b}, {a, b}, {c}, {d}, {a, c}, {a, d}, {b, c}, {b, d}, {a, b, c}, {a, b, d}, {c, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 7, 4, 2]
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}, {d}, {a, d}, {b, d}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 4, 3, 2]
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {d}, {a, b, c}, {a, d}, {b, d}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 4, 3, 2]
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {d}, {b, c}, {a, d}, {a, b, c}, {b, d}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 5, 4, 2]
[{}, {a}, {b}, {c}, {a, b}, {a, c}, {d}, {a, d}, {b, c}, {a, b, c}, {b, d}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 7, 6, 2]
[{}, {a}, {b}, {c}, {a, b}, {d}, {a, c}, {b, c}, {a, d}, {b, d}, {a, b, c}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 6, 4, 3]
[{}, {a}, {b}, {c}, {a, b}, {d}, {a, c}, {a, d}, {b, c}, {b, d}, {a, b, c}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [10, 8, 6, 3]
[{}, {a}, {b}, {c}, {d}, {a, b}, {a, c}, {b, c}, {a, d}, {b, d}, {c, d}, {a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [8, 6, 5, 4]
[{}, {a}, {b}, {c}, {d}, {a, b}, {a, c}, {a, d}, {b, c}, {b, d}, {c, d}, {a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}], [7, 6, 5, 3]

The following is not a valid abstract ordering:
{}, {a}, {b}, {c}, {d}, {a,b}, {e}, {a,c}, {b,c}, {a,d}, {a,e}, {b,d}, {b,e}, {c,d}, {a,b,c}, {a,b,d}, {c,e}, {d,e}, {a,b,e}, {a,c,d}, {a,c,e}, {b,c,d}, {b,c,e}, {a,d,e}, {b,d,e}, {a,b,c,d}, {c,d,e}, {a,b,c,e}, {a,b,d,e}, {a,c,d,e}, {b,c,d,e}, {a,b,c,d,e}
This ordering implies that:
d < a + b
b + c < a + d
a + e < b + d
a + b + d < c + e

Summing these inequalities gives:
2a + 2b + c + 2d + e < 2a + 2b + c + 2d + e

which is a contradiction. Your code must not count this ordering. Such counterexamples first appear at n=5. Example from this paper, example 2.5 on page 3.
This ordering is invalid despite the fact that A < B implies that A U C < B U C, for any C disjoint from A and B.

Your code or program must be fast enough that you can run it to completion on n=4 before submitting it.
Submissions may be programs, functions, etc. as usual.
Standard Loopholes are forbidden, as always. This is code golf, so shortest answer in bytes wins. Feel free to ask clarifying questions in the comments.

Long time no see isaac!

When $P, Q$ are two subsets, is there any scenario where $P \leq Q$ can be deduced from any information other than $P \subseteq Q$ or $\forall p \in P, q\in Q (p \leq q)$, not counting the initial $a \leq b \leq c \leq \dots $?

Answer: yes.  $\forall p \in P, q\in Q (p \leq q)$ is not tight enough, example: ${a, c}, {b, c}$.

@orlp Good to be back! I think I'll be doing mostly questions for the foreseeable future

Could you also add the 14 possible orderings for n=4?

@PeterTaylor Added

Python 3 + SciPy, 396 390 385 351 336 355 bytes
from scipy.optimize import*
n=int(input())
r=range(n)
def f(u):
 s=linprog(r,u,[-n]*len(u),options={'tol':.1});c=s.success;y=sorted(range(c<<n),key=lambda a:s.x.round()@[a>>i&1for i in r])
 for a,b in zip(y,y[1:]):
  v=[(a>>i&1)-(b>>i&1)for i in r]
  if~-(v in u):c+=f(u+[[-z for z in v]]);u+=v,
 return+c
print(f([[(i==j-1)-(i==j)for i in r]for j in r]))

Try it online!
This now runs for n = 5 in about 5 seconds.  The if~-(v in u): can be removed for −18 bytes but a huge performance penalty.
If you want to print all the abstract orderings as they’re found instead of just counting them, add if c:print(s.x.round(),y) before the for loop.  (Subsets are represented by binary integers where each bit corresponds to the presence or absence of one element: {a, c, d} ↔ 1101₂ = 13.)
How it works
f recursively counts the abstract orderings satisfying a given list of constraints.  We start with the constraints n ≤ a, a + n ≤ b, b + n ≤ c, c + n ≤ d.  Using linear programming, we find a solution to the constraints (or return 0 if there isn’t one)—in this case we get a = 4, b = 8, c = 12, d = 16.  We round the solution to integers, then compute a reference ordering by sorting all its subsets by their sum:
{a}, {b}, {c}, {a, b}, {d}, {a, c}, {a, d}, {b, c}, {b, d}, {a, b, c}, {c, d}, {a, b, d}, {a, c, d}, {b, c, d}, {a, b, c, d}
The rounding can’t cause any constraints to be violated by more than n/2, which is why we added a margin of n.
Since Python’s sorted is stable, any ties between the subsets are broken in the same reverse-lexicographic order in which we generated them.  So we could imagine replacing {a, b, c, d} with {a·2^n + 2^0, b·2^n + 2^1, c·2^n + 2^2, d·2^n + 2^3} to get the same ordering without any ties.
The plan is to categorize all other abstract orderings by case analysis based on where they first disagree with the reference ordering:
Either {a} > {b},
or {a} < {b} > {c},
or {a} < {b} < {c} > {a, b},
or {a} < {b} < {c} < {a, b} > {d},
⋮
Within each case, we add these new constraints with a margin of n, and recursively call f with the new constraints added.
Notes
For a while I conjectured (but did not assume) that the linear program solutions with margin 1 on the constraints will always be integers.  This turns out to be false: a counterexample with n = 7 is {2.5, 30, 62.5, 73.5, 82, 87.5, 99.5}.
Python, 606 bytes (faster, no external libraries)
n=int(input())
r=range(n)
e=enumerate
def l(u,x):
 for i,v in e(u):
  for j,a in e(v):
   if a<0:break
  else:return[0]*len(x)
  if sum(b*x[k]for k,b in e(v))>0:
   x=l([[b*w[j]-a*w[k]for k,b in e(v)if k!=j]for w in u[:i]],x[:j]+x[j+1:]);x.insert(j,0)
   for k,b in e(v):
    if k!=j:x[j]+=b*x[k];x[k]*=-a
 return x
def f(u,x):
 x=l(u,x);c=any(x);y=sorted(range(c<<n),key=lambda a:sum(x[i]*(a>>i&1)for i in r))
 for a,b in zip(y,y[1:]):
  v=[(a>>i&1)-(b>>i&1)for i in r]+[1]
  if~-(v in u):c+=f(u+[[-z for z in v[:-1]]+[1]],x);u+=v,
 return+c
print(f([[(i==j-1)-(i==j)for i in r]+[1]for j in r],[1]*(n+1)))

Try it online!
This runs for n = 5 in a quarter of a second, and n = 6 in 230 seconds (75 seconds in PyPy).
It includes a hand-coded linear programming solver using integer math in homogeneous coordinates to avoid floating point rounding issues.

390 bytes.

@Mr.Xcoder Sure, thanks!

@Lynn Thanks! I compromised a bit because I don’t want to slow it down too much—it already takes almost 3 minutes for n = 5.

Can there be ties between more than two elements? Would that be a problem?

@ChristianSievers Multi-way ties will be dealt with sequentially starting with whichever two came out of sorted first. It doesn’t matter which order it happens in. What’s important is that there will be no ties left when the end is reached and the count is incremented.

Since you're only using linprog to see if there are any solutions, its first argument doesn't matter. So you can replace it with r for golfing reasons.

Possible 379 bytes.

@ChristianSievers Yep, thanks! (Note: I just changed the strategy for dealing with ties.)

@JonathanFrech Good idea, I adopted a variant of that for −15 bytes. Thanks!

How long does n=6 take?

@AlonAmit Looks like it took about 55 minutes for n = 6. SciPy isn’t the best at LP; I have a version using GLPK instead of SciPy that does n = 6 in 70 seconds. More concerningly, the SciPy version got the wrong answer (and GLPK the right one)…so uh, that’s…interesting… I wonder if this is SciPy #6690?

@AlonAmit #6690 isn’t it. But I added options={'tol':.1}, which seems to take care of the problem.

Ruby, 308 bytes, much faster
Runs the case 4 in ~150ms. No specialized library is used.
->n{t=2**(n-1)
n==0 ?[[0]]:P[n-1].map{|a|b=a.map{|i|i+t}
[*0..t].repeated_combination(t).select{|m|m[0]>=a.index(n-1)}.map{|m|c,d=a.dup,b.dup;m.reverse.map{|i|c.insert(i,d.pop)};c}}.flatten(1).select{|p|p.combination(2).all?{|(x,y)|x&~y==0||y&~x!=0&&n.times.all?{|i|x!=y<<i+1}&&p.index(x&~y)<p.index(y&~x)}}}

It recursively intersperse result of a minor case, for instance

[{}, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}]

with the corresponding subsets with an additional element added - they have to keep the same relative order. It also ensures that the new singleton is added after all the previous singletons.
The part that check for compliance is the same as before, but not the combinations to test are much much less.
Expanded and commented version:
->n{
    t=2**(n-1)
    if n==0
        [[0]]
    else
        # for each one of the previous nice orderings
        P[n-1].map { |a|
            # create the missing sets, keep order
            b = a.map{|i|i+t}
            # intersperse the two sets
            [*0..t].repeated_combination(t) # select t insertion points
                .select do |m|
                    # ensure the new singleton is after the old ones
                    m[0] >= a.index(n-1)
                end
                .map do |m|
                    # do the interspersion
                    c,d=a.dup,b.dup
                    m.reverse.map{|i|c.insert(i, d.pop)}
                    c
                end
        }.flatten(1).select{ |p|
            # check if the final ordering is still nice
            p.combination(2).all? { |(x,y)|
                (x&~y==0) ||
                (y&~x!=0) &&
                n.times.all?{|i|x!=y<<i+1} &&
                (p.index(x&~y)<p.index(y&~x))
            }
        }
    end
}

Ruby, 151 bytes, quite slow
(the case of three elements takes << 1s, the case of four is still running)
->n{[*1...2**n-1].permutation.select{|p|p.combination(2).all?{|(x,y)|x&~y==0||y&~x!=0&&n.times.all?{|i|x!=y<<i+1}&&p.index(x&~y)<p.index(y&~x)}}.count}

It works on bitfield representation of the subsets, so one might have to massage the output if needed to display the subsets themselves.
formatted:
-> n {
  [*1...2**n-1]. # prepare permutations of non-empty and non-full sets
    permutation.
    select { |p|
      p.combination(2). # check all ordered pairs
        all? { |(x, y)|
          # first is subset of second
          x &~ y == 0 ||
          # second is not subset of first
          y &~ x != 0 &&
          # first is not a right shift of second
          # (this normalizes the ordering on atoms)
          n.times.all? { |i| x != y << i+1 } &&
          # after taking out common elements, ordering agrees
          p.index(x &~ y) < p.index(y &~ x)
        }
    }.
    count
}

I can't test it above 3 on my machine but this (139 bytes) should be functionally identical to your solution. Changes: ...x-1 => ..x-2, .select{...}.count => .count{...}, |(x,y)| => |x,y|, x&~y==0||y&~x!=0 => x&~y<1||y&~x>0 since a&~b can't be negative if I'm not mistaken

Look at the n=5 counterexample I just added. If I'm not mistaken, your code would accept it.

TIO link showing it doesn't work correctly on the counterexample: Try it online!

Your newer version appears to be a recursive function called P, so it can't be anonymous. Also, I think it still fails due to the counterexample I posted.

indeed, will check the example. The case 5 is still >> 10 minutes

For the faster solution: 280 bytes Try it online!. Note that you must include the name of a recursive function (P=). Also, I think you have to return a number so you might have to incorporate .size in there somewhere.

Good spot about the c=*a instead of c=a.dup and moving b inside the check, but it still fails on counterexample


text:
Write a Program for winning sevens game

Build a function in python that can win a Sevens game provided that there are only 2 players

Here are the instructions from Wikipedia:

All cards are dealt to the players, even if as a result some players
  have one card more than others. The owner of the seven of hearts
  begins by playing it. Similarly, the other three sevens may later be
  played as the first cards of their respective suits. After that, cards
  may be added in sequence down to the ace and up to the king. A player
  who cannot place a card passes.
You cannot pass if you have a card to play.
The one who gets the seven of hearts is the first to play.

The cards will be randomly distributed to the user and the computer.
The function will have two parameter:

List of cards remaining to play for computer
List cards that have been played

The syntax of a card is like this:

[value, suit]

For example [king, "clubs"]

The list of suits are:

clubs
spades
diamonds
hearts

The list of values are:

1
2
3 ....
11(jack)
12(queen)
13(king)

The remaining cards for player 1 will be stored in list named card_1_rem and the remaining cards for player 2 will be stored in list named card_2_rem
The cards that have been played will be stored in a list called played_cards

The function will have to append the played card to the list called played_cards and subtract the item for the list called card_1_rem or card_2_rem
The return of one function will be the input of the competitor
The one who finishes his cards first, wins.
Winning Condition

Step 1: Users will submit their programs.
Step 2: I will test the programs against each other.
Step 3: The first program to remain in first place (as measured by lowest total running score) for 50 consecutive games will be the winner.  This will help smooth out the effects of luck.  However, a maximum of 10000 games will be played, and if no player meets the first criterion, then the player with the lowest total score after 10000 games wins.
Step 4: All the results will be uploaded to a github repo(which I will soon make).

The loser has to count his points as follows
Ace : 1
2 : 2
3 : 3
4 : 4
5 : 5
6 : 6
7 : 7
8 : 8
9 : 9
10 : 10
jack : 10
queen : 10
king : 10

For example if a king and an ace remain in the loser's hand, he gets
  11 point.
The objective is to minimize the points you have got.
Winner gets 0 points

IMP : Submissions are allowed only in the Python 3 language.
The controller code of this challenge is here(major update has been done): https://gist.github.com/Salil03/19a093554205b52d05dc7dc55992375a

will you play the programs against each other until a winner is clear to a statistically significant level?

@Agile_Eagle I couldn't say without knowing the variance of that game.  but if you graph the results over time you should be able to see the convergence.  eg, say there are 5 programs competing.  give each one a different color.  let the y-axis be a competitors place, and let x be the number of rounds.  at the beginning, the lines will jump up and down and intersect each other.  eventually, all the lines will be parallel and stay that way.  once that state is achieved, you'll know who the real winner is.

Let us continue this discussion in chat.

https://www.pagat.com/layout/sevens.html (For anyone else that doesn't know the game and needs more detailed explanation.)

The bots should ideally just return the card played; it should be the responsibility of the controller to check that the intended move is vaild and make the appropriate changes to the game state.

Tactical
This ended up different enough that I felt it deserved a separate entry. This one calculates slightly smarter scores, looking not just at the next step but future choices for each player as well, based on the cards they hold. Seems to do a lot better than the "synergistic" version, better enough to beat the mysterious player2 advantage.
def tactical(cards_in_hand, played_cards):
    def list2dict(lst):
        d = {}
        for val, suit in lst:
            if suit in d:
                d[suit].append(val)
            else:
                d[suit] = [val]
        return d
    def play_card(card):
        cards_in_hand.remove(card)
        played_cards.append(card)

    hand = list2dict(cards_in_hand)
    if not played_cards:
        if 7 in hand['hearts']:
            play_card([7, 'hearts'])
        return (cards_in_hand, played_cards)
    table = list2dict(played_cards)

    playable_cards = {}
    for suit in hand:

        if suit not in table:
            if 7 in hand[suit]:
                # Do I hold the majority of the cards of this suit?
                suit_advantage = (len(hand[suit]) - 6.5)
                playable_cards[(7, suit)] = suit_advantage * 20
                if 6 in hand[suit] and 8 in hand[suit]:
                    # opponent can't immediately make use of this
                    playable_cards[(7, suit)] += 20
            continue

        visible = set(table[suit] + hand[suit])
        opp_hand = set(range(1,14)) - visible

        highcard = max(table[suit]) + 1
        if highcard in hand[suit]:
            advantage = sum(c > highcard for c in hand[suit]) - sum(c > highcard for c in opp_hand)
            playable_cards[(highcard, suit)] = advantage * 10
            if highcard + 1 in opp_hand:
                playable_cards[(highcard, suit)] -= 20

        lowcard = min(table[suit]) - 1
        if lowcard in hand[suit]:
            advantage = sum(c < lowcard for c in hand[suit]) - sum(c < lowcard for c in opp_hand)
            playable_cards[(lowcard, suit)] = advantage * 10
            if lowcard - 1 in opp_hand:
                playable_cards[(lowcard, suit)] -= 20

    if not playable_cards:
        return (cards_in_hand, played_cards)

    best_card = max(playable_cards, key=playable_cards.get)
    #print(hand, "\n", table, "\n", best_card, ":", playable_cards[best_card])
    play_card(list(best_card))

    return (cards_in_hand, played_cards)

Thanks for the accept and the bounty, Agile_Eagle. Though, I still hope @heather or someone will post another competitive entry (and I'll happily transfer the bounty over if they win!).

I am ending this question now. keep the bounty for yourself

Synergistic
I'm not really a Python guy, but wanted to give this a go. This builds the set of playable cards at each turn, and assigns each of them a simple static score. The card with the highest score is played (assuming any playable card exists).
def synergistic(cards_in_hand, played_cards):
    def list2dict(lst):
        d = {}
        for val, suit in lst:
            if suit in d:
                d[suit].append(val)
            else:
                d[suit] = [val]
        return d
    def play_card(card):
        cards_in_hand.remove(card)
        played_cards.append(card)

    hand = list2dict(cards_in_hand)
    if not played_cards:
        if 7 in hand['hearts']:
            play_card([7, 'hearts'])
        return (cards_in_hand, played_cards)
    table = list2dict(played_cards)

    playable_cards = {}
    for suit in hand:
        if 7 in hand[suit]:
            playable_cards[(7, suit)] = -1

        if suit not in table:
            continue
        visible = set(table[suit] + hand[suit])
        opp_hand = set(range(1,14)) - visible
        highcard = max(table[suit]) + 1

        if highcard in hand[suit]:
            if highcard+1 in opp_hand:
                playable_cards[(highcard, suit)] = 1
            else:
                playable_cards[(highcard, suit)] = 2

        lowcard = min(table[suit]) - 1
        if lowcard in hand[suit]:
            if lowcard - 1 in opp_hand:
                playable_cards[(lowcard, suit)] = 0
            else:
                playable_cards[(lowcard, suit)] = 1

    if not playable_cards:
        return (cards_in_hand, played_cards)

    best_card = list(max(playable_cards, key=playable_cards.get))
    #print(hand, "\n", table, "\n", best_card)
    play_card(best_card)

    return (cards_in_hand, played_cards)

By the way, the controller seemed to have several issues, including in score calculation and comparison. I made some changes to the controller here, please take a look  and update your version if this seems right.
Two things I haven't fixed in the controller:

why is the loop condition (win2 <= 50) and (win1 <= 100) ? This should probably be symmetrical, it should exit the loop whenever either of the players has 100 consecutive wins.
trying some runs of the controller locally, with the same function for both players, Player 2 seems to win most of the time - it can't be inherent to the game since the initial 7H requirement would smooth that out (as @Veskah mentioned in the comments), so, yet undetected controller bugs? Or my player code somehow maintaining state and having a bias this way? Per-game, it's not like Player 2 dominates heavily (from the results output txt), but somehow the overall score per controller run ends up favouring player 2 much more than random (Player 1's total scores are often more than 2x that of Player 2).

Picking who is "first" or "second" player in a round should be inherently random based on who holds 7H so bot order shouldn't matter because you either play 7H or pass on Turn 1. If the 2nd Function consistently wins, seems like an RNG issue

I just discovered a bug regarding that (my code uses any 7 card it has, instead of passing if it doesn't have 7H), so the problem might go away if I fix that.

@sundar why are you returning (cards_in_hand, played_cards) ? You just have to append it to a list and subtract it from a list

@sundar I modified my controller take a look at it. Thanks!!

@Veskah The player 2 advantage still seems to remain, even after fixing the bug in my code. It doesn't seem to be about the initial card shuffle either - just changing the order of the player1, player2 calls in the while loop changes which one has the advantage - the player called second wins most of the time (given same code for both "players"). Any ideas what this could be? Gist

@Agile_Eagle The return value is just for my convenience (when debugging in the REPL), the code also does the necessary appends and removes on the lists.

@sundar cool. I am going to test your programs against each other soon.

SearchBot
import random

suits = ["clubs", "diamonds", "hearts", "spades"]
suit_mul = 14
hearts = suit_mul * suits.index("hearts")

def evaluate(hand):
    return sum(min(c % suit_mul, 10) for c in hand)

def rollout(hand0, hand1, runs):
    sign = -1
    counts = [[0.] * 8 for _ in range(2)]
    def counts_index(card):
        return 2 * (card // suit_mul) + ((card % suit_mul) > 7)
    for card in hand0:
        counts[0][counts_index(card)] += 1
    for card in hand1:
        counts[1][counts_index(card)] += 1
    while True:
        if not hand1:
            return sign * evaluate(hand0)
        can_play = []
        for i, run in enumerate(runs):
            if run[0] == 8 or run[1] == 6:
                if run[1] != 6:
                    run[0] = 7
                if run[0] != 8:
                    run[1] = 7
            suit = suit_mul * i
            rank = run[0] - 1
            next_low = suit + rank
            if next_low in hand0:
                if next_low - 1 in hand0:
                    runs[i][0] -= 1
                    hand0.remove(next_low)
                    counts[0][counts_index(next_low)] -= 1
                    can_play = []
                    break
                can_play.append((next_low, 0, -1))
            rank = run[1] + 1
            next_high = suit + rank
            if next_high in hand0:
                if next_high + 1 in hand0:
                    runs[i][1] += 1
                    hand0.remove(next_high)
                    counts[0][counts_index(next_high)] -= 1
                    can_play = []
                    break
                can_play.append((next_high, 1, 1))
        if can_play:
            weights = [(a - 1) / (a + b - 1) if a + b - 1 > 0 else 0 for a, b in zip(*counts)]
            weighted = [(0 if t[0] % suit_mul == 7 else weights[counts_index(t[0])], t) for t in can_play]
            weight = sum(t[0] for t in weighted)
            total = random.uniform(0, weight)
            for (w, (card, index, direction)) in weighted:
                total -= w
                if total <= 0:
                    break
            hand0.remove(card)
            counts[0][counts_index(card)] -= 1
            runs[card // suit_mul][index] += direction
        hand0, hand1 = hand1, hand0
        counts[0], counts[1] = counts[1], counts[0]
        sign *= -1

def select_move(hand0, hand1, runs, n=40):
    if hearts + 7 in hand0:
        return hearts + 7
    if hearts + 7 in hand1:
        return
    can_play = []
    for i, run in enumerate(runs):
        suit = suit_mul * i
        rank = run[0] - 1
        next_low = suit + rank
        if next_low in hand0:
            if next_low - 1 in hand0:
                return next_low
            can_play.append((next_low, 0, -1))
        rank = run[1] + 1
        next_high = suit + rank
        if next_high in hand0:
            if next_high + 1 in hand0:
                return next_high
            can_play.append((next_high, 1, 1))
    if not can_play:
        return
    if len(can_play) == 1:
        return can_play[0][0]
    scores = [0 for _ in can_play]
    for i, (card, index, sign) in enumerate(can_play):
        hand0_copy = set(hand0)
        runs_copy = [list(r) for r in runs]
        hand0_copy.remove(card)
        runs_copy[card // suit_mul][index] += sign
        for j in range(n):
            scores[i] -= rollout(set(hand1), set(hand0_copy), [list(r) for r in runs_copy])
    return can_play[scores.index(max(scores))][0]

def search(cards_in_hand, played_cards):

    def play_card(c):
        if c is None:
            return
        suit = suits[c // suit_mul]
        rank = c % suit_mul
        for i, card in enumerate(cards_in_hand):
            if card[0] == rank and card[1] == suit:
                del cards_in_hand[i]
                played_cards.append([rank, suit])
                return
        assert(False)

    hand = set(suit_mul * suits.index(s) + v for v, s in cards_in_hand)
    played = set(suit_mul * suits.index(s) + v for v, s in played_cards)
    opponent_hand = (suit_mul * s + v for v in range(1, 14) for s in range(4))
    opponent_hand = set(c for c in opponent_hand if c not in hand and c not in played)
    runs = [[8, 6] for _ in range(4)]
    for i, run in enumerate(runs):
        suit = suit_mul * i
        while suit + run[0] - 1 in played:
            run[0] -= 1
        while suit + run[1] + 1 in played:
            run[1] += 1
    card = select_move(hand, opponent_hand, runs)
    play_card(card)
    return cards_in_hand, played_cards

This is in python 3, but I'm pretty sure it'd work in python 2 as well. It effectively works linearly through the best (as per my limited understanding of the game) possible options at each step - highest scoring card that can match those already played, a new seven, and finally lower scoring cards, finishing by returning None if none of the previous options were possible.
def computer_play(computer_cards, dealt_cards):
    #look at dealt_cards and sort computer_cards by suit
    dealt_hearts = []
    dealt_spades = []
    dealt_clubs = []
    dealt_diamonds = []
    for i in dealt_cards:
        if i[1] == 'hearts':
            dealt_hearts.append(i[0])
        elif i[1] == 'spades':
            dealt_spades.append(i[0])
        elif i[1] == 'clubs':
            dealt_clubs.append(i[0])
        else:
            dealt_diamonds.append(i[0])
    #look at each suit and the highest card that can be played in each
    max_card_hearts = max(dealt_hearts, default=0) + 1
    max_card_spades = max(dealt_spades, default=0) + 1
    max_card_clubs = max(dealt_clubs, default=0) + 1
    max_card_diamonds = max(dealt_diamonds, default=0) + 1
    #play highest overall card
    if ['hearts', max_card_hearts] in computer_cards:
        return [max_card_hearts, 'hearts']
    elif ['spades', max_card_spades] in computer_cards:
        return [max_card_spades, 'spades']
    elif ['clubs', max_card_clubs] in computer_cards:
        return [max_card_clubs, 'clubs']
    elif ['diamonds', max_card_diamonds] in computer_cards:
        return [max_card_diamonds, 'diamonds']
    else:
        #if no cards that match suits out, check for sevens
        suits = {'hearts':max_card_hearts, 'clubs':max_card_clubs, 'spades':max_card_spades, 'diamonds':max_card_diamonds}
        for i in suits.keys():
            if [7, i] in computer_cards:
                return [7, i]
        #if no sevens, check for lowest card that can be played
        for i in suits:
            if [i, suits[i]-2] in computer_cards:
                return [i, suits[i]-2]
        #if nothing can be played, pass
        return None

I'll probably make more updates to it as I debug. The comments hopefully make it fairly clear what's going on.

Can you please explain what the two inputs of the function are ?

@Agile_Eagle the cards that have already been played and the cards the computer has.

Your chain of if-elif seem to be returning backwards cards unless I'm missing something about python lists. Should always be [Value, suit]

@Veskah ah, yes, you're right! I'll fix that. Thanks!

I cannot test this until someone else has submitted their program. Sorry !

@heather there is an error in your code.                                                                       In this line: max_card_spades = max(dealt_spades) + 1, the error is ValueError: max() arg is an empty sequence. This means that if a spade is not dealt, your code will fail. Same is the case for other suits.

@Veskah are you getting the same error as above ?

@Agile_Eagle didn't try it, just saw the error visually.

@heather are you going to fix the code

@Agile_Eagle yes, probably over the weekend - I have been very busy over the last couple days; I apologize

@Agile_Eagle it should hopefully be fixed now. Sorry about that!

@heather I already have a winner https://codegolf.stackexchange.com/a/168517/81559

@Agile_Eagle that doesn't mean I shouldn't fix my code =) Anyway, you implied in the comment below that answer you were going to rerun it if I fixed my answer. I don't mind if you don't, though.

@heather I am closing this competition. Sundar has won it

source: Stack Exchange

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

sort: votes


text:
Count Consecutive Characters
Given a string containing only letters, output the length of the longest run of consecutive alphabetical letters the word contains, where order does not matter. An example algorithm may sort the word, remove duplicates, and then output the length of the longest run.
Test Cases
watch -> 1
stars -> 3
antidisestablishmentarianism -> 3
backdoor -> 4
a -> 1
tutorials -> 4

For example, antidisestablishmentarianism contains the letters abdehilmnstr. The longest runs are lmn and rst, both of length 3.
Notes
You may take all lowercase, all uppercase, or mixed-case letters as input, but the case cannot encode information about the word (i.e. you cannot make the first n characters capitalized where n is the length of the longest run).
This is code-golf, so shortest answer in bytes wins.

@H.PWiz, I'm guessing that's a typo and it should be rst - uniquify, sort and get longest consecutive run. Can we take input as an array of characters?

@Shaggy yes, definitely, I didn't include it because I thought it was a default

Is 'a' adjacent to 'z' -- should 'zebra' score 2 or 3?

(...judging by your example algorithm I guess "no" and "2")

@JonathanAllan you are correct

Interestingly (or not), the only two words I've found that are scoring 7 are birds: goldfinches and paroquets. Another suggested test case: propinquities, which scores 8.

Also, feedback looks like the most straightforward way to get abcdef.

Jelly,  10 9 8 7  6 bytes
OṬṣ0ZL

Try it online!
9 was using Sok's method: ṢQẆẇƇØaṪL
How?
OṬṣ0ZL - Link: list of (single-case) characters  e.g.  codegolf
O      - ordinal (vectorises)           [99,111,100,101,103,111,108,102]
 Ṭ     - untruth (1s at those indices)  [0,0,0,...,1,1,1,1,1,0,0,0,0,1,0,0,1]
       -                                 ^         ^       ^         ^     ^
       -                   i.e. indices: 1        99     103       108   111
   0   - literal zero
  ṣ    - split at                       [[],[],[],...,[1,1,1,1,1],[],[],[],[1],[],[1]]
    Z  - transpose                      [[1,1,1],[1],[1],[1],[1]]
     L - length                         5

R, 44 43 bytes

Works on an array of lowercase characters.  Edit: changed it from testing True values to multiplying by the T/F for a byte.
function(x,r=rle(letters%in%x))max(r$l*r$v)

Try it online!
Does a run length encoding on letters that are in the supplied characters then return the max value for the trues.

Was working on a similar rle solution using utf8ToInt but taking an array of string is much smarter. +1

@JayCe Started out the same way, but then realised that a letters %in% check took care of the sort, unique and diff steps in one swoop

APL (Dyalog Classic), 10 9 bytes
-1 byte thanks to H.PWiz
≢⍉↑⊆⍨⎕a∊⍞

Try it online!
⍞ inputs a string
⎕a is the uppercase English alphabet
⎕a∊⍞ a boolean length-26 vector - which letters occur in the string?
⊆⍨ form vectors of consecutive 1s
≢⍉↑ mix into a matrix, transpose, and return its height - effectively, find the length of the longest vector of 1s

⌈/≢¨ -> ≢⍉↑

Perl 6, 41 bytes
{max values bag .ords.sort.squish Z-0..*}

Test it
Expanded:
{  # bare block lambda with implicit param $_

  max       # find the max
    values  # get the values from the following Bag (repeat counts)
      bag   # find the repeats

          .ords.sort.squish # get the unique ordinals (method call on $_)
        Z-                  # zip subtract with
          0 .. *            # Range starting with 0
}

Given 'stars', .ords.sort.squish Z-0..* would return (97,113,113,113)

Haskell, 35 bytes
f[]=0
f s=1+f[c|c<-s,elem(succ c)s]

Try it online!
Haskell, 50 bytes
f s=maximum$scanl(\x c->sum[x+1|elem c s])0['a'..]

Try it online!

JavaScript (Node.js), 51 bytes
The case of the input string doesn't matter.
s=>(g=_=>s&&1+g(s&=s*2))(Buffer(s).map(c=>s|=1<<c))

Try it online!
How?
We first convert the input string into a bitmask of encountered letters with:
Buffer(s).map(c => s |= 1 << c)

The bitwise shift is processed with an implicit modulo 32.
Example:
"feedback" --> 100001111110
               kjihgfedcba-

We then 'reduce' runs of consecutive 1's in the bitmask by repeatedly AND'ing it with a left-shifted copy of itself until all bits are cleared:
0100001111110 AND 1000011111100 --> 0000001111100
0000001111100 AND 0000011111000 --> 0000001111000
0000001111000 AND 0000011110000 --> 0000001110000
0000001110000 AND 0000011100000 --> 0000001100000
0000001100000 AND 0000011000000 --> 0000001000000
0000001000000 AND 0000010000000 --> 0000000000000

The number of consecutive letters in alphabetical order is the number of iterations of the above process. Hence the recursive function:
g = _ => s && 1 + g(s &= s * 2)

MATL, 10 bytes
2Y2imY'*X>

Input is in lowercase.
Try it online! Or verify all test cases.
This uses a mix of @Sundar's (old) and @ngn's approaches.
Explanation
Consider input 'tutorial' as an example.
2Y2   % Push predefind literal 'abcdefghijklmnopqrstuvwxyz'
      % STACK: 'abcdefghijklmnopqrstuvwxyz'
i     % Push input
      % STACK: 'abcdefghijklmnopqrstuvwxyz', 'tutorials'
m     % Ismember: true for letters present in the input
      % STACK: [1 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 0 0 0]
Y'    % Run-length encoding
      % STACK: [1 0 1 0 1 0 1 0 1 0], [1 7 1 2 1 2 1 2 4 5]
*     % Multiply, element-wise
      % STACK: [1 0 1 0 1 0 1 0 4 0]
X>    % Maximum. Implicitly display
      % STACK: 4

Python 3, 55 bytes
f=lambda s:s and-~f({*s}&{chr(ord(c)+1)for c in s})or 0

Try it online!

Python 2, 58 bytes
f=lambda s,c=99,r=0:c and max(r,f(s,c-1,-~r*(chr(c)in s)))

Try it online!

Python 2, 63 bytes
n=t=0
for c in input():n|=2**ord(c)
while n:n&=n/2;t+=1
print t

Try it online!

What about using python3 bytes as input: f=lambda s:s and-~f({*s}&{c+1for c in s})or 0?

05AB1E, 6 bytes
Saved 1 byte thanks to Adnan: taking the contiguous substrings, then sorting by length (Œ...é) \$\to\$ using the powerset built-in instead (æ).
êæAÃθg

Try it online!
Also 6 bytes
Saved 2 bytes, again thanks to Adnan: using ASå instead êÇ¥Θ, thus also removing the need to increment the maximum at the end. See the revision history to compare the beviours of the two methods.
ASåγOà

Try it online!
How those works
I like challenges like this one which lead to a variety of different approaches.
êæAÃθg | Full program.
ê      | Push a sorted and without duplicates version of the input.
 æ     | Powerser.
  AÃ   | Keep those that also occur in the lowercase alphabet.
    θg | Take the length of the last one. θ and ` can be used interchangeably.
-------+-------------------------------------------------------------------------------
ASåγOà | Full program.
A      | Push the lowercase alphabet.
 S     | Listify it (i.e. convert it to a sequence of characters).
  å    | Replace each char in the alphabet by 1 if its in the input, else by 0.
   γ   | Split into chunks of equal adjacent elements.
    O  | Sum each part.
     à | Extract the maximum of this list. Again, à and Z can be used interchangeably.

The first program can be golfed to êæAÃ\gand the second program can be golfed toASåγOZ`.

@Adnan Thanks, updated! I like the ASå trick.

Pyth, 9 bytes
le}#G.:S{

Input is assumed to be a lower case string. Try it out online here, or verify all the test cases at once here.
le}#G.:S{Q   Q=eval(input()), G=lowercase alphabet. Trailing Q inferred.

        {Q   Deduplicate input string
       S     Sort it
     .:      Take all substrings (these are generated in length order)
  }#G        Filter out those that aren't found in the alphabet
le           Find the length of the last remaining element

Great method using the fact that the substrings are ordered by length!

It'll be much less efficient, but you can use y in place of .:.

C (gcc), 58 56 bytes
Saved 2 bytes thanks to @gastropner
Uses the same approach as my Node.js answer. The case of the input string doesn't matter.
m,i;f(char*s){for(i=0;*s?m|=1<<*s++:(i++,m&=m*2););s=i;}

Try it online!
Commented
m,                   // m = bitmask of encountered letters
i;                   // i = counter of max. consecutive letters
f(char *s) {         // f = function taking the input string s
  for(               // main loop:
    i = 0;           //   start with i = 0 and assume m = 0 on first call
                     //   (it is forced back to 0 when the program terminates)
    *s ?             //   if we haven't reached the end of the string:
      m |= 1 << *s++ //     update m by setting the appropriate bit for this character
                     //     (with implicit modulo 32) and advance the string pointer
    : (              //   else:
        i++,         //     increment i
        m &= m * 2   //     'reduce' runs of consecutive 1's in m by AND'ing it with a
      );             //     left-shifted copy of itself (e.g. 11101 & 111010 -> 11000;
                     //     11000 & 110000 -> 10000); we stop when m = 0
  );                 // end of for()
  s = i; }           // return i

Is it implementation specific that 1<<*s wraps or is it standard behaviour?

@JonathanFrech I think that's officially undefined behavior. So it must be implementation specific.

Because interestingly enough it only appears to wrap when it is computed at runtime.  At compile time 1<<32 results in 0 and issues a data type size warning.

Actually, I doubt that the compiler would explicitly apply a 5-bit mask. Chances are that this is done at the CPU level.

@Arnauld it is (see the note: "[...] The count operand can be an immediate value or register CL. The count is masked to 5 bits, which limits the count range to 0 to 31.")

You can drop m= since m will be zero on first call, and reset to zero by the bit counting. Requires using s for implicit return. This shaves another 2 bytes off.

@gastropner Nice catch. Thanks!

TSQL (Microsoft SQL Server), 206 bytes
WITH C AS (SELECT 1p,SUBSTRING(@,1,1)c UNION ALL SELECT p+1,SUBSTRING(@,p+1,1)FROM C WHERE p<LEN(@)),R AS(SELECT c d,1r FROM C UNION ALL SELECT c,r+1FROM R JOIN c ON ASCII(d)+1=ASCII(c))SELECT MAX(r)FROM R

For input, use the following DECLARE statement before the code:
DECLARE @ varchar(200) = 'propinquities';

It is expected that input is all the same case (upper or lower doesn't matter, but mixed case would not work).
Ungolfed:
DECLARE @data varchar(200) = 'propinquities'

;WITH CTE AS (
    SELECT
        1 as CharacterPosition,
        SUBSTRING(@data,1,1) as Character
    UNION ALL
    SELECT
        CharacterPosition + 1,
        SUBSTRING(@data,CharacterPosition + 1,1)
    FROM
        CTE
    WHERE CharacterPosition < LEN(@data)
), Runs AS
(
    SELECT Character, 1 rc
    FROM CTE
    UNION ALL
    SELECT b.Character, rc + 1
    FROM Runs r
    JOIN CTE b ON ASCII(r.Character) + 1 = ASCII(b.Character)
)
SELECT max(rc)
from runs

Explanation:
Splits the string into a a row for each character (adapted from https://stackoverflow.com/a/27623321/1474939) in the CTE cte.
Then, finds runs of consecutive letters by converting to the ASCII code in the Runs cte.
Lastly, it picks the largest run and reports back in the select statement.

Good answer, very nice use of the CTE. Not sure if this would help or hurt your byte count, but the "approved" method to get input in T-SQL is via a pre-created table.

@BradC If I can take a table with each row as one character (sort of like a char array instead of a string), then it would help remove one CTE. If it still has to be one row, it's probably about the same as taking it as an input variable. Thanks for the idea though!

C (gcc), 100 bytes
c,o,u;n(t,e,r)char*r,*e,*t;{for(u=0,e=t;c=*t++;u=u<o?o:u)for(o=0,r=e;*r;*r++-c||(c++,r=e,++o));o=u;}

Try it online!
Explanation
c,o,u;n(t,e,r)    // setup, function declaration
char*r,*e,*t;{    // K&R style
 for(u=0,e=t;     // initialize global maximum u to 0, write string start to e
 c=*t++;          // look at every character in the string
 u=u  <o?o:  u)   // funny face
  for(o=0,r=e;*r; // initialize local maximum o to 0, look at entire string again
  *r++-c||(c++,   // equal character found, search for next one
   r=e,++o));     // reset local pointer, increment local maximum
o=u;}             // return maximum character streak

Try it online!

+1 for the "c,o,u;n(t,e,r)" :)

K (ngn/k), 17 15 bytes
#1_{x^x^x+1}\-:

Try it online!
- is there only to convert the chars to numbers (it doesn't matter if they are negative)
{ }\ applies a function until convergence, preserving intermediate results
x+1 add 1 to each number in x
^ "without" - the list on the left without elements that occur in the list on the right
x^x^x+1 means x intersected with x+1
1_ drop the first element
# count

#1_{x^x^x+1}\-?

@Adám yeah, one day I should make trains work...

conceptualizing this as the intersection with the increment until convergence is quite nice

trains work

MATL, 12 10 bytes
91:wX-dX>q

Try it online!
Explanation:
91: - Create the list of numbers from 1 to 91. 91 is character '[', which comes after 'Z'.
So this effectively creates the list of all characters from '\x1' to '['. (We mainly want
those in the range ['A'-1 : 'Z'+1], but having the rest doesn't hurt, and needs less bytecount.)
w   - Implicit input, bring input to top of stack (assume 'TUTORIALS')
X-  - Set difference. This leaves only the characters that were not found in the
input string, in their original order ('stable'). Stack: '    !"#$%&'()*+,-./0123456789:;<=>?@BCDEFGHJKMNPQVWXYZ['
d   - Difference between successive elements in that list. Stack: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 2 1 2 1 5 1 1 1 1 1]
X>  - Get the maximum of those differences i.e. the max number of consecutive alphabets missing from the set difference.
q   - Decrement to get actual character count

Older:
12 bytes
Sud1=Y'*X>sQ

Try it online!

So many approaches :-)

Retina 0.8.2, 54 bytes
O`.
D`.
.
$&$&¶
T`l`_l`¶.
(.)¶\1
$1
.(.+)
$.1
O#^`
1G`

Try it online! Link includes test cases. Explanation:
O`.

Sort the letters into order.
D`.

Deduplicate the letters.
.
$&$&¶

Duplicate each letter on separate lines.
T`l`_l`¶.

Decrement the first of each pair.
(.)¶\1
$1

If this now matches the previous character, join them back together.
.(.+)
$.1

Count the lengths of all the runs.
O#^`

Sort them in reverse numerical order.
1G`

Take the first (largest).

C (gcc), 98 92 bytes
Thanks to Jonathan Frech for the suggestions.
Uppercase-only.
f(char*s){int a[99]={0},i,j,k=j=i=0;for(;*s;a[*s++]++);for(;i<99;j=!!a[i++]*++j,k=j>k?j:k);}

Try it online!

You do not actually need the k; at the end. Implicit gcc returning is a side effect of variable assignment which appearently is executed as a last step in your for loop.

Possible 95 bytes.

@JonathanFrech I don't trust gcc's implicit returns. They don't always happen the way that I expect them to, and they often don't work at all for pointers and floating-point. Fortunately, outside of code golf I never use them! :-)

J, 16 bytes
-7 bytes thanks to FrownyFrog
[:>./a.#;._1@e.]

Try it online!
explanation
[: >./ a. #;._1@e. ]
       a. (    )e. ]    is the ascii alphabet an element of the input:
                        this will transform the alphabet into a 1-0 array,
                        the ones representing the letters in the input
          #;._1@        split that 1-0 list up into pieces, using 0
                        as the delimiter, and transforming each chunk
                        into its length. now we have a list of ints
[: >./                  take the max

I think that you can use ] instead of ~.@/:~ The alphabet is already sorted, so you don't need to sort the input and keep only the unique items.
TIO - 18 bytes

16

@FrownyFrog and Galen, Thank you both!  In retrospect it should have been obvious I didn't need that uniq/sort first.

Japt -h, 9 bytes
Case insenstive, takes input as a string or an array of characters.
;CôkU mÊn

Try it or run multiple tests (the second line serves as a replacement for the -h flag so the flag can be used to process multiple inputs instead)

Explanation
              :Implicit input of string/array U
;C            :The lowercase alphabet
  ô           :Partition at characters returning truthy
   kU         :  Remove all characters in U from the current letter
              :  This will return a non-empty string (truthy) if the current letter ISN'T in U
     m        :Map
      Ê       :  Length
       n      :Sort
              :Implicitly output the last element in the array

@Downvoter, could you provide a reason for your -1, please?

Perl 5, 68 bytes
$"=<>;map{$"=~/$_/i&&++$$_||last for$_..z;$.=$$_ if$$_>$.}a..z;say$.

Try it online.
Ungolfed:
use feature 'say';

my $s = <>;
my $r;
for ('a' .. 'z') {
    my $c = 0;
    for ($_ .. 'z') {
        last if $s !~ /$_/i;
        $c++;
    }
    $r = $c if $c > $r;
}
say($r);

Perl 5, 62 + 2 (-nF flag) = 64 bytes
$c[ord lc$_]=1for@F;$y[y///c]++for"@c "=~/((1 )+)/g}{say@y/2|0

Try it online.
Perl 5, 68 bytes
<>=~s/./$c[ord lc$&]=1/gre;$y[y///c]++for"@c "=~/((1 )+)/g;say@y/2|0

Try it online.

Nice approach! I'd not considered that method at all... You can save a few bytes using -pF and -MList::Util+(max) to get to 56: Try it online!

@DomHastings -MList::Util=max adds 16 bytes to the result score.

If I understand the new scoring correctly, command-line flags aren't counted as bytes, but as as a separately scored language, so rather than just Perl, it'd be Perl with -MList::Util+(max) -pF, or similar. https://codegolf.meta.stackexchange.com/a/14339/9365

C (gcc), 66 65 63 bytes
Assumes input only contains lowercase letters. First, it loops over the string and sets bits in an integer according to which letters are seen. Next, it counts the longest streak of 1 bits in the integer.
Edit: a is global, so will be initialised to 0 at first call. The second loop makes sure it is reset to 0 before returning. Therefore, we can avoid resetting it manually.
a,l;f(char*s){for(l=0;*s;)a|=1<<*s++-97;for(;a;l++)a&=a*2;s=l;}

Try it online!

SQLite 265
WITH w AS(SELECT'a'w),n AS(SELECT 1 n UNION ALL SELECT n+1 FROM n LIMIT(SELECT length(w)FROM w)),l AS(SELECT substr(w,n,1)l FROM n,w)SELECT max(v)FROM(SELECT min(n)v FROM(SELECT*FROM l,n EXCEPT SELECT l.l,unicode(l.l)-unicode(b.l)d FROM l,l b WHERE d>0)GROUP BY l);

Ungolfed:
WITH w AS (SELECT 'antidisestablishmentarianism' w)
   , n AS (SELECT 1 n
           UNION ALL
           SELECT n+1 FROM n
           LIMIT (SELECT length(w) FROM w) )
   , l AS (SELECT DISTINCT substr(w,n,1) l FROM n,w ORDER BY l)
   , d AS (
           SELECT l,n FROM l,n
           EXCEPT
           SELECT a.l l, unicode(a.l) - unicode(b.l) d
           FROM l a, l b
           WHERE d > 0
           )

SELECT max(v) FROM ( SELECT min(d.n) v FROM d GROUP BY d.l );

Brachylog, 14 13 12 bytes
{⊇pS∧ẠsSl}ᶠ⌉

Try it online!
{        }ᶠ    % Find all values that satisfy this predicate
           ⌉   % And get their maximum
               % The predicate being:
 ⊇pS           % There exists a permutation of a subset of the input
               %  Call it S
    ∧          % And,
      sS       % S is a substring of
     Ạ         %  the set of alphabets, Ạ,
        l      % Then, the length of that substring is the return value of the
               %  predicate

Slow enough that it doesn't finish for input "antidisestablishmentarianism" on TIO. Relatively much faster one for +1 byte:
13 bytes
{dosS∧ẠsSl}ᶠ⌉

Try it online!
Use dos instead of ⊇p: S is a deduplicated sorted substring of the input, instead of just some permutation of some subset.

Ruby, 63 59 bytes
Not very golfy.
-4 bytes thanks to manatwork
->s{s.bytes.uniq.sort.slice_when{_2!=_1+1}.map(&:size).max}

Attempt This Online!

If you use .bytes instead of .chars then you can save on replacing .succ with +1.

@manatwork Ah, of course. Thanks!

.slice_when is 1 character shorter than .chunk_while, just have to reverse the == into !=.

@manatwork Nice. Thanks!

I promise to not bother you more with this. Attempt This Online!

@manatwork You ought to post that as your own answer. It’s an entirely different technique. Very nice, too.

Vyxal, 7 bytes
CÞǔ0€∩L

Try it Online!
Port of Jelly.

Ruby, 43 characters
->s{(?a..?z).map{$.=s=~/#{_1}/?$.+1:0}.max}

Sample run:
bash-5.1$ ruby -e 'p ->s{(?a..?z).map{$.=s=~/#{_1}/?$.+1:0}.max}["backdoor"]'
4

Attempt This Online!

Haskell, 87 bytes
import Data.List
maximum.map length.filter(`isInfixOf`['a'..'z']).subsequences.nub.sort

Try it online!
Expects lowercase characters
Explanation:
maximum.map length.filter(`isInfixOf`['a'..'z']).subsequences.nub.sort
                                                                  sort {- sort the characters -}
                                                              nub      {- remove duplicates -}
                                                 subsequences          {- all subsequences -}
                   filter(`isInfixOf`['a'..'z'])                       {- all characters are adjacent -}
        map length                                                     {- length of filtered subsequences -}
maximum                                                                {- maxmimum length -}

Python 2, 95 bytes
lambda s:max(reduce(lambda(p,v),c:(c,v+[v[-1]*(c==p+1)+1]),map(ord,sorted(set(s))),(0,[0]))[1])

Try it online!

Pyth - 11 bytes
le@.:G).:S{

Input must be wrapped in quotes. If not allowed:
Pyth - 12 bytes
le@.:G).:S{z

Explanation:
l(
  e(
    @(
      .:(G),
      .:(
         S(
           {(Q)
         )
      )
    )
  )
)
length(
    last element(
        intersection(
            all positive length substrings(the alphabet as string),
            all positive length substrings(
                sorted(
                    uniquified(input)
                )
            )
        )
    )
)

Kotlin, 97 bytes
{w:String->{var s=0
var m=0
for(c in 'a'..'z')if(c in w)s++
else{if(s>m)m=s
s=0}
if(s>m)m=s
m}()}

Try it online!

><>, 63 bytes
Reads lowercase characters from stdin, outputs a number to stdout.
0l55*)?\
8/?(0:i<]r1~r[-*c
~/00
}</?)@:{:*+1/?(3l
  \~:03. ;n~/

Try it online!
0l55*)?\             Push 26 zeroes onto the stack

Record which characters are used
      i              Read a character from the input
 /?(0:               Check if it is -1, marking the end of the input
8             -*c    Subtract 96 from the character code,
                         giving 1 for 'a', 2 for 'b' etc.
            r[       Pop that many values on to a new stack and reverse
                         it, putting that character's value at the top of
                         the stack
          1~         Write 1 to that value
        ]r           Return the stack back to it's normal state

Count the longest run of ones in the stack
  00                 Push values for currentRun = 0, and bestRun = 0
}                    Move bestRun to the bottom of the stack
            /?(3l    Check if there are only 2 values left on the stack
          +1         Increment currentRun
         *           Multiply currentRun by the next value in the stack,
                         resetting it to 0 if the run is broken
  /?)@:{:            Check if currentRun > bestRun
  \~:                Overwrite bestRun if so
     03.             Jump back to the start of loop
         ;n~/        Once all values have been consumed,
                         print bestRun and exit

Java 8, 77 bytes
int i,j,m;
c->{for(i=j=0;(m=j<c.length?m|1<<c[j++]:m&m*2+0*++i)>0;);return i;}

Port of Arnauld's C answer. Try it online here.
Ungolfed:
int i, j, m; // instance variables of the surrounding class - initialised to 0
c -> { // lambda - c is of type char[]; return type is int
    for(i = j = 0; // i is the length of the longest run, j is used to step through c - both start at 0
        (m = j < c.length // work with the bitmask of all the letters present in c: if we have not reached the end of c ...
             ? m | 1 << c[j++] // ... set the bit corresponding to the current character, advance one character ...
             : m & m * 2 + 0 * ++i) > 0 ;) ; // ... else reduce runs of consecutively set bits in m by AND-combining it with a left-shifted copy of itself until m hits 0
    return i; // return the result - by now m is back to 0
}

Husk, 7 bytes
L►Lġ≈Ou

Try it online!
First time I've used simil(≈), and it works really well!
Explanation
L►Lġ≈Ou
     Ou order and deduplicate
   ġ≈   group by absolute difference ≤ 1
 ►L     max by length
L       take the length of that

Mathematica, 63 bytes
Length[Alphabet[]~LongestCommonSubsequence~Union@Characters@#]&

View it on Wolfram Cloud!
Mathematica's verbosity is a blessing and a curse, as usual. LongestCommonSubsequence is exactly the right tool for the job, but its an astounding 24 bytes! (Also, as usual, strings being atoms is frustrating.)

Thunno 2 G, 5 bytes
Ạ€Ƈġʂ

Try it online!
Port of Adnan's 05AB1E answer.
Explanation
Ạ€Ƈġʂ  # Implicit input
Ạ      # Push the lowercase alphabet
 €     # For each letter in this string:
  Ƈ    #  Is it in the input string?
   ġ   # Group consecutive items together
    ʂ  # Sum each inner group
       # Implicit output of maximum sum

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


text:
Tuples by sequentially stepping through entries in list of lists
Challenge:
Given a list of nonempty lists of integers, return a list of tuples of the following form: First list tuples starting with each element of the first list followed by the first element of every subsequent list, so the ith tuple should be [ith element of first list, first element of second list, ... , first element of last list]. For example:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] => [[1, 4, 7], [2, 4, 7], [3, 4, 7], ...

Then do tuples of the form [last element of first list, ith element of second list, first element of third list, ..., first element of last list], so in our example this would be:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] =>  ..., [3, 4, 7], [3, 5, 7], [3, 6, 7], ...

Continue on with each remaining list, until you get to [last element of first list, ..., last element of second to last list, ith element of last list]:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] => ..., [3, 6, 7], [3, 6, 8], [3, 6, 9]]

The full output is as follows:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]] =>
        [[1, 4, 7], [2, 4, 7], [3, 4, 7], [3, 5, 7], [3, 6, 7], [3, 6, 8], [3, 6, 9]]

Some boilerplate for good measure:

If you want the input to be lists of strings, or lists of positive integers, it's fine. The question is about manipulating lists, not about what is in the lists.
Input and output can be in any acceptable format.
Either a full program or function is permitted.
Standard loopholes are disallowed by default.
This question is code golf, so lowest byte-count wins.

Examples:
[] => [[]] (or an error, thanks to ngn for correcting the output in this case)

[[1]] => [[1]]

[[1, 2], [3, 4], [5]] => [[1, 3, 5], [2, 3, 5], [2, 4, 5]]

[[1], [2], [5, 6], [3], [4]] => [[1, 2, 5, 3, 4], [1, 2, 6, 3, 4]]

[[1, 2, 3], [4, 5]] => [[1, 4], [2, 4], [3, 4], [3, 5]]

[[1, 2, 3], []] => unspecified behavior (can be an error)

[[3, 13, 6], [9, 2, 4], [5, 10, 8], [12, 1, 11], [7, 14]] =>
     [[3, 9, 5, 12, 7], [13, 9, 5, 12, 7], [6, 9, 5, 12, 7], [6, 2, 5, 12, 7],
      [6, 4, 5, 12, 7], [6, 4, 10, 12, 7], [6, 4, 8, 12, 7], [6, 4, 8, 1, 7],
      [6, 4, 8, 11, 7], [6, 4, 8, 11, 14]]

[[16, 8, 4, 14, 6, 7, 10, 15], [11, 1, 12, 2, 19, 18, 9, 3], [13, 5, 17]] =>
    [[16, 11, 13], [8, 11, 13], [4, 11, 13], [14, 11, 13], [6, 11, 13],
     [7, 11, 13], [10, 11, 13], [15, 11, 13], [15, 1, 13], [15, 12, 13], [15, 2, 13],
     [15, 19, 13], [15, 18, 13], [15, 9, 13], [15, 3, 13], [15, 3, 5], [15, 3, 17]]

If anyone has a better title, let me know.

Yes, that's a mistake, edited.

@Arnauld Yeah, that's right. Thanks for proofreading my question for me.

Can we assume that the integers are greater than zero?

@Arnauld Seems fine to me. I don't really care what the input type is as long as it is infinite.

What should the final tuple in the output be for [[9, 6, 5, 4], [3, 2, 0, 8], [1, 7]] - [4,2,7] or [4,8,7]? By the way, I find the way you've used i is somewhat confusing (I think it is referring to an index in the current sublist being produced rather than what it reads like at first where you say "so the ith tuple should be...").

"The question is about manipulating lists, not about what is in the lists" - May we assume the content of the input to be always start with 1 and be ordered like your example? [[1,2,...,n],[n+1,n+2,...,n+m],[n+m+1,...],...]?

@JohnathanAllan - The final tuple in the output for that should be [4,8,7]. I don't think it's okay to to assume that the input starts with 1 and is ordered because then the input could just be a list of lengths.

@JonathanAllan I agree that the usage of i is a bit confusing, maybe I'll come up with a better way to phrase that.

Cool, thanks - maybe add an example or two with (a) longer lists and longer inner lists and (b) which have a different order.

@JonathanAllan Added examples as requested.

I have a feeling that [] => [] should really be [] => [[]] but can't find the words to explain why.

@ngn [] should really be an invalid input since it is not a "list of nonempty lists of integers" and if not both [] and [[]] should probably be valid outputs.

@JonathanAllan [] is an empty list of nonempty lists -- there are 0 sublists and each is nonempty. [[]] is a list of a single empty list, so isn't a list of nonempty lists.

@ngn You are right, it should be [[]] because there is a single empty tuple with one entry from each of the (zero) sublists. Probably it's too annoying to require programs to correctly output this, so I'll say that it's not necessary.

Yes [] is, strictly speaking, an empty list of non-empty lists but the output is ambiguous between [] and [[]]if it's an allowed input. ("First list tuples starting with each element of the first list..." - there is no first list, so we are done -> [])

@JonathanAllan I'm now convinced that the "correct" output for [] should be [[]]. For instance, the number of output tuples is sum(inner list lengths) - length of outer list  + 1 which in the empty case gives 1, which is the length of [[]] but not the length of []. This is a bit of a pedantic issue though...

Read my edit in parentheses above - your length argument is assuming something about the implementation rather than following the description you have written in the OP.

Can we assume all the entries are distinct? Or, more strongly, a permutation on 1..n like in your examples?

JavaScript (ES6), 59 bytes
Expects a list of lists of positive integers.
f=a=>[a.map(a=>a[0]),...a.some(a=>a[1]&&a.shift())?f(a):[]]

Try it online!
How?
At each iteration:

We output a new list consisting of the first element of each list.
We remove the first element of the first list containing at least 2 elements, and repeat the process. Or we stop the recursion if no such list exists.

That a.some trick is awesome!

@ETHproductions Now looking for a challenge where using awe.some would not be a waste of bytes... :)

K (ngn/k), 40 21 19 18 17 bytes
{x@'/:?|\+|!|#'x}

Try it online!
uses ideas from @H.PWiz's answer
{ } function with argument x
#' length of each
| reverse
! all index tuples for an array with those dimensions as columns in a matrix (list of lists)
| reverse
+ transpose
|\ running maxima
? unique
x@'/: use each tuple on the right as indices in the corresponding lists from x

Jelly, 15 bytes
ẈṚṪ×€PƊƤFQṚCịŒp

Try it online! (the footer displays the actual returned list rather than a Jelly representation)
How?
Indexes into the Cartesian product of the lists at the required points...
ẈṚṪ×€PƊƤFQṚCịŒp - Link: list of lists  e.g. [[6,8,4,9],[7,1,5],[3,2]]
Ẉ               - length of each            [4,3,2]
 Ṛ              - reverse                   [2,3,4]
       Ƥ        - for each prefix:             [2]      [2,3]      [2,3,4]
      Ɗ         -   last 3 links as a monad:
  Ṫ             -     tail (pop rightmost)     2        3          4
     P          -     product (of remaining)   1        2          6
    €           -     for €ach (range tail)    [1,2]    [1,2,3]    [1,2,3,4]
   ×            -       multiply               [1,2]    [2,4,6]    [6,12,18,24]
        F       - flatten                   [1,2,2,4,6,6,12,18,24]
         Q      - de-duplicate              [1,2,4,6,12,18,24]
          Ṛ     - reverse                   [24,18,12,6,4,2,1]
           C    - complement (1-x)          [-23,-17,-11,-5,-3,-1,0]
             Œp - Cartesian product (of the input)
                -         -> [[6,7,3],[6,7,2],[6,1,3],[6,1,2],[6,5,3],[6,5,2],[8,7,3],[8,7,2],[8,1,3],[8,1,2],[8,5,3],[8,5,2],[4,7,3],[4,7,2],[4,1,3],[4,1,2],[4,5,3],[4,5,2],[9,7,3],[9,7,2],[9,1,3],[9,1,2],[9,5,3],[9,5,2]]
            ị   - index into (1-based & modular)
                -   indexes:      -23,                                            -17,                                            -11,                                             -5,             -3,             -1,     0
                -    values: [[6,7,3],                                        [8,7,3],                                        [4,7,3],                                        [9,7,3],        [9,1,3],        [9,5,3],[9,5,2]]
                -         -> [[6,7,3],[8,7,3],[4,7,3],[9,7,3],[9,1,3],[9,5,3],[9,5,2]]

ẈṚ’ṣ1T$¦ƬUṚị"€ (14 bytes) fails for inputs with (non-trailing) length one lists; but maybe ṣ1T$ can be replaced with something else?

Python 2, 72 bytes
f=lambda a:zip(*a)[:1]+(any(len(u)>1and u.pop(0)for u in a)and f(a)or[])

Try it online!
This is a Python port of Arnauld's excellent Javascript algorithm.

Python 2, 62 bytes
lambda M:[zip(*M)[l.pop(0)*0]for l in M+[[1,1]]for _ in l[1:]]

Try it online!
Using Chas Brown's pop idea inspired by Arnauld's JS submission.

Python 2, 68 bytes
M=input()
for l in[[0,0]]+M:
 for x in l[1:]:l[0]=x;print zip(*M)[0]

Try it online!
Mutates the first elements of the lists to hold the desired values. The [[0,0]]+ is an ugly hack to print the initial first values.

APL (Dyalog), 15 bytes (SBCS)
Thanks ngn for pointing out an unnecessary byte
{∪⌈\,⍉⍳≢¨⍵}⊃¨¨⊂

Try it online!
{∪⌈\,⍉⍳≢¨⍵} generates lists to index into the input. e.g (1 2 3) (4 5 6) (7 8 9) -> (0 0 0) (1 0 0) (2 0 0) (2 1 0) (2 2 0) (2 2 1) (2 2 2)
≢¨⍵: the length of each list in the input
,⍉⍳ creates all combinations of numbers up to it's input. e.g. 2 3 -> (0 0) (1 0) (0 1) (1 1) (0 2) (1 2)
⌈\: scan with maximum. e.g. the above example would now be (0 0) (1 0) (1 1) (1 1) (1 2) (1 2)
∪: remove duplicates
⊃¨¨⊂ does the indexing, being mindful of the depth of either argument

Great answer! You beat me by almost half my bytes. ⊆ seems unnecessary.

corrected link

@ngn Nice, I can't remember what caused me to think it was. Thanks!

Haskell, 87 bytes
x?[]=[]
x?([c]:d)=(x++[c])?d
x?((c:d):e)=(x++c:map head e):x?(d:e)
f x=[]?x++[last<$>x]

Try it online

Charcoal, 33 bytes
ＩＥ⊕ΣＥθ⊖ＬιＥθ§λ⌈⟦⁰⌊⟦⊖Ｌλ⁻ι∧μΣＥ…θμ⊖Ｌν

Try it online! Link is to verbose version of code. Explanation:
Ｉ

Cast the integers to strings before implicitly printing using the default output format for lists, which is each item on its own line, and nested lists double-spaced.
Ｅ⊕ΣＥθ⊖Ｌι

Take the sum of the lengths of the lists and subtract the length of the list of lists. Then loop from 0 to this value inclusive.
Ｅθ§λ

Map over the list of lists and index into each list.
⌈⟦⁰⌊⟦⊖Ｌλ

Clamp the index to 0 and the last index in the list. (The closing brackets are implied.)
⁻ι∧μΣＥ…θμ⊖Ｌν

After the first list, subtract the decremented lengths of all the previous lists from the outermost index. (This doesn't work for the first list because the length of lists is empty and the sum isn't a number.)

APL (Dyalog Classic), 32 30 27 bytes
1↓¨∪⊃{(⍵,¨⊃⍺),⍺,¨⍨⊢/⍵}/⌽0,⎕

Try it online!
complete program, input is from the keyboard (⎕)
for input [] outputs [[]] (their APL equivalents are 0⍴⊂⍬ and ,⊂⍬)
assumes uniqueness of numbers in the input

Not that it makes a difference to the output, but I think the input for the second test should be ,⊂,1

@H.PWiz that's right, fixed, cheers

Python 2, 91 bytes
f=lambda a,p=():a and[p+(q,)+zip(*a)[0][1:]for q in a[0][p>():]]+f(a[1:],p+(a[0][-1],))or[]

Try it online!

JavaScript (ES6), 58 54 bytes
h=(x,s)=>[x.map(y=>s|y?y[0]:s=y.shift()),...s?h(x):[]]

After 14+ attempts at golfing my code down (removing all instances of while
loops, push, and concat), I arrived at an iteration
algorithmically similar to @Arnauld's answer, unsurprising given how succinct it is!
Accepts a list of lists of positive integers. Try it online!
58 bytes
For 1 more byte, replacing s = y.shift() with y.shift(s = 1) should handle all integers (presumably, as I have not personally tested it).
h=(x,s)=>[x.map(y=>!s/y[1]?s=y.shift():y[0]),...s?h(x):[]]

58 bytes
Bonus version, with slight rearranging:
h=x=>[x.map(y=>s&&y[1]?y.shift(s=0):y[0],s=[]),...s||h(x)]

Explanation
Early versions of the code tried to modify a clone of (an array of) the first
elements of each array, but the extra step of initializing that array was expensive... until I realized that mapping over the first elements of each array was roughly the "only" operation necessary if I mutate the original arrays.
Uses a boolean flag to check if any array has been shifted (i.e. shortened) yet.
Golfed the conditional check down further by observing that JS coerces arrays
with a number value as its only element into that number, while coercing
arrays with multiple values as NaN.
var
h = (x, s) =>
    [
        x.map(y =>                 // map to first element of each array
            s|y                    // if s == 1 (i.e. an array has been shortened)
                                   // or the current array y has length == 1
                ? y[0]
                : s = y.shift()    // remove first element of y and set s to truthy
        ),
        ...s ? h(x) : []           // only concatenate a recurrence of the function if an array has had a value removed
    ]


text:
Golfing Emoticons
Introduction
Your challenge today (inspired by this challenge) is to write a number of snippets, functions or full programs each that output various ascii emoticons, without reusing characters.
Challenge

The list of valid ascii emoticons for this challenge is both here and in the code block at the bottom of this post.
Each snippet should be on a separate line in your submission.
You may only use one language for all the snippets.
Each snippet must either output to stdout or return a string containing the emoticon and an optional trailing new line, and nothing else.
You may not use any character more than once across all snippets, however using a character multiple times in a single snippet is fine.
You may not use any character not in your language's codepage (or ascii, if your language doesn't use a custom codepage) in any of the snippets. Put another way, you are restricted to only characters that can be encoded in one byte.
No snippet can take any input.
Standard loopholes are disallowed.
Your score is the number of unique snippets that each print a different ascii emoticon in the text file above.
Highest score wins!

Good luck!

Allowed emoticons, space separated:
:-) :) :-] :] :-3 :3 :-> :> 8-) 8) :-} :} :o) :c) :^) =] =) :-D :D 8-D 8D x-D xD X-D XD =D =3 B^D :-)) :-( :( :-c :c :-< :< :-[ :[ :-|| >:[ :{ :@ >:( :'-( :'( :'-) :') D-': D:< D: D8 D; D= DX :-O :O :-o :o :-0 8-0 >:O :-* :* ;-) ;) *-) *) ;-] ;] ;^) :-, ;D :-P :P X-P XP x-p xp :-p :p :-b :b d: =p >:P :-/ :/ :-. >:\ >:/ :\ =/ =\ :L =L :S :-| :| :$ :-X :X :-# :# :-& :& O:-) O:) 0:-3 0:3 0:-) 0:) 0;^) >:-) >:) }:-) }:) 3:-) 3:) >;) |;-) |-O :-J #-) %-) %) :-###.. :###.. <:-| ',:-| ',:-l <_< >_>

EDIT: Apologies, there was a Unicode character in one of the emoticons which I missed. I have since deleted the emoticon containing it. I hope it won't cause too much inconvenience.

"Each snippet must output (or return a string containing) a different ascii emoticon" <- just to be clear, does this mean that a string containing the emoticon but also other characters is valid? I'm guessing not, but that's the way I first read it, so wanted to make sure.

@sundar no, you are correct. The string needs to just contain the emoticon.

@AsoneTuhid The Haskell answer uses Haskell functions not snippets.

@WW you could make a similar argument about ruby

@AsoneTuhid No you can't, Ruby doesn't have lazily evaluated objects, which is the only criteria the linked answer cites.

Related (but not a dupe)

@WW "In Haskell 26 is a valid anonymous function which takes no argument" While not integers, globally defined 'functions' are actually methods of the main object and, perhaps idealistically, you can see variables as getter methods. Also, ruby has lazy enumerators (.lazy)

Lenguage, 131
I have put all the emoticons I am representing in the format <emoticon> <byte> <length> where the program is <byte> repeated <length>
times.
:-) 0 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
:) 1 2892400118827976939438684163170029797380
:-] 2 736490387500841447075516267663006608725303862349670620478812283647578112884440609487323312712386965678607264902605611675427012612
:] 3 264202969342699153645046819327998571303367330111090974890246487724490982787908355751940
:-3 4 8657402899421565866640894175739857184468743778771208393372298092586390046095597770136092676
:3 5 3105690979328168701182830269522101416768856653828
:-> 6 74366524642622405428665075721999126422007787328051598231869446920043450605361049824610086990930509828
:> 7 26677682375393393246302105048632582268435010638972146679812
8-) 8 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
8) 9 2892400118827976939438684163170029797380
:-} a 58350780111110182577346156792191842346790220983533887814420020926317170260174910391653244380390906064837889652367278401208674211826539380018313418995597836292
:} b 20932315791834567081523240053201294833948611487434768542347530871005539691107893137313828947907611434178521119850500
:o) c 3239118979209708736174752985014882031111216334552277195105326435158161594234375948611157455571250214219021418006029673058983092521806556299268
:c) d 47135384800053852612833041130432422958419430281388881777898152870448562232695635591679564906662772946483627525782544884262590480388
:^) e 1438457788087580951319367710279309782666608590130275933163395778517107001730213488515614614316939287805297916050613997699858436
=] f 264202969342699153645046819327998571303367330111090974890246487724490982787908355751940
=) 10 2892400118827976939438684163170029797380
:-D 11 19494738235915607848691977610067738996770809401324758166895184293407870315491767045222586644150487567302660
:D 12 6993394368615125679158619025868739646176627428942714419231588356
8-D 13 19494738235915607848691977610067738996770809401324758166895184293407870315491767045222586644150487567302660
8D 14 6993394368615125679158619025868739646176627428942714419231588356
x-D 15 19494738235915607848691977610067738996770809401324758166895184293407870315491767045222586644150487567302660
xD 16 6993394368615125679158619025868739646176627428942714419231588356
X-D 17 19494738235915607848691977610067738996770809401324758166895184293407870315491767045222586644150487567302660
XD 18 6993394368615125679158619025868739646176627428942714419231588356
=D 19 6993394368615125679158619025868739646176627428942714419231588356
=3 1a 3105690979328168701182830269522101416768856653828
B^D 1b 3477977520889650736889014052879324099230182173920756338825997078602142158679966714563481466490641782098496260504558444186939511707432172833580792152068
:-)) 1c 5487280990934680753018828240506400232950626778227616999140473333355621344480221047070135810437858502018906538135322099716
:-( 1d 1007854344721600164966761853515619549954862308079750322896556241040396276639727620
:( 1e 361550014853497117429835520396253724676
:-c 1f 193066536141020580302164136470251204437686055691792055134797767284510716823978799133444882487675968730852822850628645467043138793111556
:c 20 69259223195372526933127153405918857475749925384641832521628775278048964191953448010235510788
:-< 21 1161976947540975084822891808156236350343871677000806222372960108125678915708766403509532609233289220
:< 22 416838787115521769473470391384884097944297041233939791876
:-[ 23 11507662304700647610554941682234478261332872849213603444981441931993408013819384523239426761131046338728238514103212682428547076
:[ 24 4128171395979674275703856551999977676615114532985796482660101370695171606061068058628
:-|| 25 4490503514653154593994888171790391155410203882196166795024427350741089979748728649713594708726872557302769860059030544234798515347871831399522962560307902130717984058775353233427641373262315637622954685896613847112512731353207673251960307641577181784460210162728903376900
>:[ 26 6326404256268962375341314423857191467014094403422416400818262089647958639442872076631144582027712607626673470721042183428656778636530024452
:{ 27 327067434247415110648800625831270231780447054491168258474180169859461557673560830270528577311056428659039392497668
:@ 28 1707371672025177167763334723112485265179840680894217387507716
>:( 29 554073785562980215465017227247350859805999403077134660534580217077888830965463104478137810948
:'-( 2a 10717345685419298345739898907239062955989543426288201658648697659470455871802103594384430744225253295339799090003181572
:'( 2b 3844659212957764301173255361616590690802154974454843970302450614408994357252
:'-) 2c 85738765483354386765919191257912503647916347410305613269189581275763646974416828755075445953802026362718392720025452548
:') 2d 30757273703662114409386042892932725526417239795638751762419604915271954857988
D-': 2e 193066536141020580302164136470251204437686055691792055134797767284510716823978805646550931167703616753827688239442675846684408073420804
D:< 2f 638803582514482637985938722326699671446185653303063005249221931372282624304643888007010225504954128458626105348
D: 30 6513106048680027648022974865388814030379641269280309252
D8 31 101767282010625432000358982271700219224681894832504836
D; 32 52104848389440221184183798923110512243037130154242473988
D= 33 3334710296924174155787763131079072783554376329871518334980
DX 34 8062834757772801319734094828124956399638895572237883755195510489639007043088023556
:-O 35 167458526334676536652185920425610358671588951972278350803847452800159342788092683232963125354305467608039012907876356
:O 36 60072800202465067205832115025259229538134452493771044576134610843949072388
:-o 37 13267431338842966983371788226620956799431546865783704518985364512972676097928094894007982561650102539906104005323704405147662831001648414716854276
:o 38 4759457577127833947434564846207944091008496681623630261662476839548057726257842008934364673202165121028
:-0 39 16908990037932745833282996436991908563415515192912516393305269712082793058780464394797060
8-0 3a 16908990037932745833282996436991908563415515192912516393305269712082793058780464394797060
>:O 3b 92061298437605180884439533457875826090662949768337659782530130027559915316565778290258379740810961922785987127587463814832979972
:-* 3c 64502678062182410557872758624999651197111187717104020665379599426585361704942567428
:* 3d 23139200950623815515509473305360238379012
;-) 3f 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
;) 40 2892400118827976939438684163170029797380
*-) 41 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
*) 42 2892400118827976939438684163170029797380
;-] 43 736490387500841447075516267663006608725303862349670620478812283647578112884440609487323312712386965678607264902605611675427012612
;] 44 264202969342699153645046819327998571303367330111090974890246487724490982787908355751940
;^) 45 1438457788087580951319367710279309782666608590130275933163395778517107001730213488515614614316939287805297916050613997699858436
:-, 46 4128171395979674275703856551999977676615116013894657322584294363301463149116324315140
;D 47 6993394368615125679158619025868739646176627428942714419231588356
:-P 48 1339668210677412293217487363404882869372711615778226806430779622401274742304741465863705002834443740864312103263010820
:P 49 480582401619720537646656920202073836305075619950168356609076886751592579076
X-P 4a 1339668210677412293217487363404882869372711615778226806430779622401274742304741465863705002834443740864312103263010820
XP 4b 480582401619720537646656920202073836305075619950168356609076886751592579076
x-p 4c 106139450710743735866974305812967654395452374926269636151882916103781408783424759152063860493200820319248832042589635241181302648013187317734834180
xp 4d 38075660617022671579476518769663552728067973452989042093299814716384461810062736071474917385617320968196
:-p 4e 106139450710743735866974305812967654395452374926269636151882916103781408783424759152063860493200820319248832042589635241181302648013187317734834180
:p 4f 38075660617022671579476518769663552728067973452989042093299814716384461810062736071474917385617320968196
:-b 50 24133317017627572537770517058781400554710756961474006891849720910563839602997349891680610310959496091356602856328580683380392349138948
:b 51 8657402899421565866640894175739857184468740673080229065203596909756120523994181001279438852
d: 52 6513106048680027648022974865388814030379641269280309252
=p 53 38075660617022671579476518769663552728067973452989042093299814716384461810062736071474917385617320968196
>:P 54 736490387500841447075516267663006608725303598146701278260241040220479322532526226322067037926487695382287897020699710518663839748
:-/ 55 2113623754741593229160374554623988570426939399114064549163158714010349132347558049349636
:/ 56 758225336750041186812214421270044291203334148
:-. 57 207303614669421359115184191040952449991117919777870383109146320515198064030126482718877866076650545526414792977894485163640282912122988497207300
>:\ 58 50611234050151699002730515390857531736112755227379331206546096717183669115542976613049156656221700861013387765768337467429254229092240195588
>:/ 59 1161976947540975084822891808156236350343871260162019107609415971405328717636882880482535666496831492
:\ 5a 33025371167837394205630852415999821412920916263886371861280810965561372848488544468996
=/ 5b 758225336750041186812214421270044291203334148
=\ 5c 33025371167837394205630852415999821412920916263886371861280810965561372848488544468996
:L 5d 117329687895439584386390849658709432691668852526896571437762911804588036
=L 5e 117329687895439584386390849658709432691668852526896571437762911804588036
:S 5f 246058189629296915275088343143461804188198717414486198583847366016815400484868
:-| 60 7293847513888772822168269599023980293348777622941735976802502615789646282521863798956655547548863258104736206545909800151084276478317422502289177374449729540
:| 61 2616539473979320885190405006650161854243576435929346067793441358875692461388486642164228618488451429272315139981316
:$ 62 88269046595092069685018437596741636
:-X 63 22475902938868452364365120473114215354165767283620319228479378773424625026990985396952005392834074880328590847857837270368260
:X 64 8062834757772801319734094828124956399638895572237883755195510489639007043088023556
:-# 65 30757273703662114409386042892932725523524850710441599209489631379406624653316
:# 66 11033630824386508710627304699592708
:-& 67 15747724136275002577605653961181555468044723563746098795258691266256191822495748
:& 68 5649218982085892459841180006191464452
O:-) 69 12356258313025317139338504734096077084011903131684407032848168143843669217661859524670204261772879079170965450478974953193258440804270084
O:) 6a 4432590284503841723720137817978806878447995224617077284276641736623110647723704835825102487556
0:-3 6b 13267431338842966983371788226620956799431542106326127399808819977829395756624898061251158122488584656200472850638276239892043942732572982687825924
0:3 6c 4759457577127833947434564846207944091008496681623630264768167818876226427440672278456466089971021774852
0:-) 6d 12356258313025317139338504734096077084011903131684407032848168143843669217661859524670204261772879079170965450478974953193258440804270084
0:) 6e 4432590284503841723720137817978806878447995224617077284276641736623110647723704835825102487556
0;^) 6f 17635441167744220073677733420687434891802896487030356826420001439272855399824227332478064740691799715855116951261424132542286393800713533574133832361923633475307938715070413175521284
>:-) 70 12356258313025317139338504734096077084011903131684407032848168143843669217661859524670204261772879079170965450478974953193258440804270084
>:) 71 4432590284503841723720137817978806878447995224617077284276641736623110647723704835825102487556
}:-) 72 12356258313025317139338504734096077084011903131684407032848168143843669217661859524670204261772879079170965450478974953193258440804270084
}:) 73 4432590284503841723720137817978806878447995224617077284276641736623110647723704835825102487556
3:-) 74 12356258313025317139338504734096077084011903131684407032848168143843669217661859524670204261772879079170965450478974953193258440804270084
3:) 75 4432590284503841723720137817978806878447995224617077284276641736623110647723704835825102487556
>;) 76 35460722276030733789761102543830455027583961796936618253966333061189046605718849544410611318788
|;-) 77 98850066504202537114708037872768616672095225053475256206345501846339744503156212400486939296710743380901705521624650127283876034609414148
|-O 78 167458526334676536652185920425610358671588951972278350803847452800159342788092683232963125354305467608039012907876356
:-J 79 5110428660115861103887509778613597371569487059700877404902571191411112755984273780302829753244185412842987454468
#-) 7a 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
%-) 7b 8062834757772801319734094828124956399638898464638002583172449928323170213117820932
%) 7c 2892400118827976939438684163170029797380
:-###.. 7d 63472263633935557923861736647125082748737134197688614613290540778155514115230551308688039019425910919616813001134916326957795000550316350938650788017945200937461476004474628334886705185455259784117223106102133685656049509651941592790179381411044907204635644645761089920625788481467539398532818999535942522921715094779750348520526769510592544772
:###.. 7e 22769557902708180570154032292525047244944529305685155554445656280981063526325050092172056931673139842713852077242156754930562874861800287931116285873505222881198972551491106610897147536510025664107567227744828946111351823651821405717420690800875100093349774665482097539926086501615885057530438321438724
<:-| 7f 11177788790790293702887103501120273414294472080999244458727694432909828650049566346015521682938653081799074785621881328429812576053504382165802153936498504910891056847057744922241561963821608276490675534388264964
',:-| 80 3894890932912594723800954614979778034738167705203999534297740046617805825001409260143039659396608186752825803082434011496463988584644917884342322616438404709718180718461226350290450773715077612074236332176364411401648796852480132979965285722014892425220
',:-l 81 13837432294794619465253598686799485174738918065898472542221995406271893447330289675331867938000869552982499765940481536206846117610229348870882129377116615066676461930445989701931533395349580971164855939208722231376387401455759135799771140
<_< 82 1658428917355370872921473528327619599928942763290765923893927134800978736248000485688913034091267225200427530628638653297304681376663135508758532
>_> 83 106139450710743735866974305812967654395452336850609019129211336627262639119872031084090434181841102412827361960232873811027499608106440672560545796

Why not 132 though?!

@JonathanAllan Because I was too lazy to work out a unicode character, I'll do it now though.

I didn't even notice the ×!

@JonathanAllan Added. I used 2 different programming languages (Elixir + Java) to get this done as quickly as possible. Java to convert the emoticon to brainfuck because I know it best and Elixir to convert the brainfuck to binary and then to a number, since it has no number limit.

Check out this challenge for some languages being suitable for this challenge! (Unary is too classic...)

Sometimes, the most ridiculous language is the right tool for the job...

Haskell, 3
Here is a start at a haskell solution.
xD
"xD"

Try it online!
This one is just a normal string it uses the characters "xD
:]
':':']':[]

Try it online!
This is a desugared string using cons to construct a list of characters.  It uses the emoticon :] because both : and ] are already used.  In total this uses the characters ':][.
8)
drop 8(show(88,8,8,8))

Try it online!
This is where things start to get a little more interesting.  Since we need a way to make a string without the characters " or ' we use the show function.  show takes something showable and makes a string out of it.  Here we show the tuple (88,8,8,8).  This in tuple in particular ends with 8), the string we want, so we drop the first 8 chracters from the string using drop 8.  The unique characters in this solution are drop 8(shw,)

If we could find some other way to make Chars I'd probably be able to make a 4th. mempty, could be used instead of [] in answer 2, and there are ways of extracting the , from answer 3.

Perhaps if you could completely avoid square brackets in answer 2, you could use chr from Data.Char, turn each char into a string with :[] and then ++ them all together.

@Asone That can't work since show and import both have an o.

Charcoal, 10
These are just the ones I can do without using Charcoal's cat-like ability, which would allow me to add XP and |-0.
%)      ←)%
:(      ℅⁵⁸℅×±⁵±⁸
:-|     :¹↑¹
;]      ⮌];
<_<     <_‖Ｏ
=/      =↗÷χχ
8-0     Ｉ⊖⁹¬⁰Ｉ⁰
B^D     ↓ＥD^Bι
DX      §α³§α²³
xp      ↶⁴px

Try them online! I've added Ｄ⎚ commands to separate the snippets which sort of spaces them out, although it's not perfect, as the code should really be all on one line. Explanation:
←)%

The ← causes the string literal )% to be printed leftwards i.e. reversed.
℅⁵⁸℅×±⁵±⁸

The character code for : is 58. The characer code for ( is 5 times 8. (They are both negated here in case I needed a separator later.)
:¹↑¹

The : is a literal. The ¹ prints a line of length 1 horizontally, which is just a -. The ↓ causes the second line to be printed vertically, which gives the |.
⮌];

The ⮌ reverses the string literal ];.
<_‖Ｏ

The <_ is a string literal and the ‖Ｏ causes the < to be reflected to the other side of the _.
=↗÷χχ

The = is a string literal and the ↗÷χχ draws a line of length 10/10 i.e. 1 diagonally, i.e. /.
Ｉ⊖⁹¬⁰Ｉ⁰

The numbers 9-1 and 0 are cast to string and so print as digits, while the 0 in the middle is logically negated turning it into 1 which is another way of printing a -. (And I haven't even used it as a literal yet!)
↓ＥD^Bι

This takes the string literal D^B and converts it into an array, which would normally print vertically, however the print direction is overriden to vertical which results in... reversed output again!
§α³§α²³

This looks up the characters at positions 3 and 23 in the upper case alphabet (0-indexed).
↶⁴px

The ↶⁴ rotates the print direction through 180° thus causing the string literal px to be printed reversed yet again.

Some snippets seem to have unnecessary complexity like ↶⁴px when xp would work just as well.

@JonathanAllan Yes well I could do about 8 without any code as such, but that would be boring.

Jelly, 6
+1 to come?? dylnan suggested the use of ṭ to free up Ȯ, but can it be used?
Six full programs:
;] “;]
xp ⁾xp
;D ⁽8Ạb⁹Ọ
:0 ”:®ṭ
XP 24,16ịØA
8-0 7‘.NṾṖ⁺
31 distinct bytes used, confirmation here.

”:ṭ@¬ would allow you to use Ȯ in another program

Nice, ”:®ṭ is shorter too.

0”:0 works too freeing tack

It would, but I've yet to think of any unused way to produce non digits or -.

@Michael, Nope it is in fact bytes - Jelly does not become short by abusing character counting - see the code page linked by the word bytes in the header. Not any Unicode character may be used in Jelly code, only 256 (well strictly speaking 257 but two of them, ¶ and the newline character map to the same byte).

@Michael, No worries, it's an oft raised concern and not all that obvious to the uninitiated. FWIW the hexadecimal byte code of the 31 in the same order are FE 3B 5D 8E 78 70 8D 38 AB 62 89 B5 FF 3A 08 E0 32 34 2C 31 36 D8 12 41 37 FC 2E 4E BA CB 8A.

Ruby, 7
=\ Try it online! A string literal
'=\\'

>_> Try it online! Another string literal
">_>"

:p Try it online! Prints the :p symbol including the syntax (:) since it's using the p method
p:p

%) Try it online! Yet another string literal
%{%)}

XP Try it online! Here document notation (basically a multiline string literal)
<<A
XP
A

;] Try it online! Array of 2 characters (':' and ']') joined with '-'
[?;,?]]*?-

D8 Try it online! The source string of a regular expression
/D8/.source

__
Honorable mention Try it online! Executes the code in bash, returns emoticon with a trailing \n
`echo D8`

Python 2, 4
This answer is a pretty simple start.  For the first two we just use python's two different string syntaxes.  For the third we use the same method as my Haskell answer where we make a tuple get its string representation and slice it up.  For the last part we use the chr function to make the characters : and ) and add them together.
xD
"xD"

=\
'=\\'

8)
`88,8,8`[8:]

:)
chr(11+11+11+11+11+1+1+1)+chr(11+11+11+1+1+1+1+1+1+1+1)

I just mentioned it, since the post used to say that is =/.

R, 4
`!`<-`qu\157\164e`;!B^D
intToUtf8(c(88,80))
">_>"
'=]'

Try it online!
A first attempt at an R solution. The need to use brackets for any function call seriously reduces the possibilities. The first snippet is a call to quote which simply returns its argument - Thanks @BLT for showing me a way to do it without parenthesis, allowing me to use intToUtf8 on the following line.
I used another trick that @Giuseppe mentioned in a comment to another question once to spell quote without o and t.

I looked through some of the stock datasets for a field containing an emoticon (e.g. mtcars[4,5]) but no dice so far.

@BLT I've done the same... there is nothing but numbers unfortunately in these datasets :(. All the other thing I can think of (intToUtf8, etc.) use brackets.

How about replacing the first line with +=quote;+XP to free up the parentheses? (not sure how to get it to show up without the Markdown formatting - the + is surrounded by backticks)

Try it online!

@BLT your suggestion contributed to improving this answer

thanks! I just stole it from you though. This challenge was the first one that I thought of when I read it. (I didn't notice that you had also written this tip until just now!)

Fission, 3
|;-)
R"|;-)";

Try it online!
XP
V!P'!X'L

Try it online!
:o
/t<O/oO
U{\ {

Try it online!
There are only 3 ways to output something in Fission, so here we are

Javascript, 5
Three trivial ones, then two interesting ones:
xD
"xD"

XP
'XP'

<_<
`<_<`

:3
[[a=>0?0:0][0]+[]][0][6]+3

No characters for string literals left for the fourth one, so we get strings by concatenating with an array. The colon comes from writing a function which uses a colon, then converting it to a string.
8)
String((function(){(8)})).slice(12,14)

This one works very similarly to the fourth one, but uses slightly different methods to do everything.
Thanks to @steve-bennett for suggesting using the String constructor and .slice as an alternative to concatenating with arrays, and indexing. Managed to squeeze out +1 point from it.

String.fromCharCode(58)+String.fromCharCode(91) would probably be a more straightforward version of the last one.

Or String(D=>1).slice(0,2)

A few of mine: />_>/.source new RegExp().toString().substring(3,5) [((new Date)+[]).charAt(18), ~2].join(name) 0+String(-3)

Perl 5, 6
:-)
':-)'

:)
v58.41

:-3
"\x3a\x2d\x33"

=]
<<A;
=]
A

B^D
q*B^D*

XP
`echo XP`

Try it online.