Build an Authenticating SMTP Client The basic parts of SMTP can be implemented in surprising little code. I was able to build an example SMTP client that works with Gmail and Amazon SES in about 320 characters using PHP.

Your task is to implement an SMTP client that can send UTF-8 email from at least 2 major providers listed here:

Gmail
Yahoo!
Live/Hotmail
Postmark
Amazon SES

Keep in mind that most require SSL support. Some SMTP services (like Amazon) require different SMTP Auth and From addresses. Your function can take input for the actual data transmitted. After all, it woudn't make sense to hard-code anything into the transport layer.

SMTP User
SMTP Password
SMTP Host
SMTP Port
DATA (message)
From email
To email

Sample DATA (message)

Subject: =?UTF-8?B?VGVzdCBFbWFpbA==?=\r\n
To: <him@gmail.com>\r\n
From: <you@gmail.com>\r\n
MIME-Version: 1.0\r\n
Content-Type: text/html; charset=utf-8\r\n
Content-Transfer-Encoding: base64\r\n\r\n
PGgxPlRlc3QgRW1haWw8L2gxPjxwPkhlbGxvIFRoZXJlITwvcD4=\r\n.

In Summary

Build an SMTP client that can send email through at least two of the services above.
Accepts the seven inputs needed to form a valid SMTP Auth request (above). (Might only need six inputs if you combine the "From" and "SMTP User" inputs).
Use as few characters as posible.

Python 3 864 bytes

Extremely quick and dirty. Works with AWS SES and Yahoo!. Could not get it to work with Postmark (requires STARTTLS) or Gmail (requires further authentication outside of the SMTP connection).

import socket,ssl
from base64 import*
N=b'\x00'
U='utf-8'
E=lambda s:s.encode(U)
D=lambda b:b.decode(U)
B=lambda s:D(b64encode(E(s)))
A=lambda f,t,j,b:E('\r\n'.join(['DATA','Subject: =?UTF-8?B?{}?=','To: <{}>','From: <{}>','MIME-Version: 1.0','Content-Type: text/html; charset=utf-8','Content-Transfer-Encoding: base64',B(b),'','.','']).format(B(j),t,f,b))
X=lambda s,e:s.startswith(e)
def S(h,u,p,t,f,j,b):
    c,F,W=ssl.wrap_socket(socket.create_connection((h,465))),lambda m:E(m if'amazonaws'in h else'<'+m+'>'),lambda m:c.write(m+b'\r\n')
    def R(d,o=[]):
        x,y=c.read(),str(d)
        if not(X(x,E(y))or filter(lambda i:X(i,X(x,E(y))),o)):raise RuntimeError(y+' '+repr(x))
    R(220);W(b'EHLO x');R(250);W(b'AUTH PLAIN '+b64encode(N+E(u)+N+E(p)));R(235);W(b'MAIL FROM: '+F(f));R(250);W(b'RCPT TO: '+F(t));R(250);W(A(f,t,j,b));R(250,(354,));W(b'QUIT')

Invoke like S(hostname, username, password, to, from_, subject, body)

Expect bugs and changes (kind of got bored so it feels slightly half-baked).


Lights Out - Find the solution (This code golf task is related to Code-Golf: Lights Off!. The same puzzle is used, but the task is different.)

Introduction
"Lights Out" is a puzzle in which you should switch off all lights in a 5x5 grid. However, when you swap a light from on to off, or from off to on, the four adjacent lights will swap as well!
For example, consider the following grid, in which 1 stands for a light switched on and 0 stands for a light switched off:
00000
00000
00110
01000
00101

Now, if you try to turn the light at row 4, column 2 off, the resulting map will be:
00000
00000
01110
10100
01101

The goal of this game is to turn all lights off. You are allowed to switch certain lights on if that helps you to find the solution, as the adjacent ones will swap as well, which makes it possible to switch others off. This is almost always required to find the solution in fact!
Description
Your task is to find out, given an input grid, which lights should be swapped to switch all lights off. Which ones to swap is enough information to solve the puzzle, because due to the swapping the amount does not matter (you can always do mod 2 so it will be 0 (effectively, don't swap) or 1 (effectively, do swap)), and the order of swapping does not matter either obviously.
Input
Input is a two dimensional array of lengths 5 (5x5) which represents the grid, in which:

0 stands for a light switched off
1 stands for a light switched on

Output
Output is another two dimensional array of lengths 5 (5x5) which represents which lights to swap to switch all lights off in the grid, in which:

0 stands for 'this light should not be swapped'
1 stands for 'this light should be swapped'

Winning condition
Shortest code wins.
Hints
There are several algorithms to find the solution. There are mathematical articles about this game available on the Internet.
Important notice
Sometimes multiple solutions are possible. It depends on the algorithm what solution you'll end up with. If you have different but correct solutions to the examples below, your entry obviously is correct as well.
Examples
Example 1 (video to illustrate):
Input:     Output:

00000      00000
00000      00000
00110      00000
01000      00110
00101      00001

Example 2 (video to illustrate):
Input:     Output:

11111      11000
11111      11011
11111      00111
11111      01110
11111      01101

Ruby (130) (121) (113) (102)

EDIT: Saved 9 characters, thanks to Howard.

EDIT 2: Another 8 characters, courtesy of Howard.

EDIT 3: Saved 11 more characters after learning how to use Ruby's % operator for sprintf.

b=(0..4).map{gets.to_i 2}
32.times{|x|z=0;k=b.map{|i|x=z^i^31&(x<<1^x>>1)^z=x;'%05b'%z}
puts k if x<1}

Accepts 5 lines of input from stdin. Outputs all solutions as 5x5 grids as specified, though there are no extra line breaks between solutions (or between the input and the solutions).

Solutions are found by iterating through all 32 possibilities for the top row, since the top row determines the switches that must be flipped in the following rows.

Input:

00000
00000
00110
01000
00101

Output:

00000
00000
00000
00110
00001
01110
10101
11011
10011
01111
10101
10101
00000
10011
10100
11011
00000
11011
00110
11010


Calculate the Upper Divmod Task

Given two positive integers (dividend and divisor), calculate the quotient and the remainder.
Normally it would be calculated as e = o*q+r where q*o<=e and 0<=r<o.
For this challenge it still e = o*q+r but q*o>=e and -o<r<=0.
For example e=20 and o=3, normally it would be 20/3 -> 20=3*6+2, since 18<=20 and 0<=2<3. Here it will be 20/3 -> 20=3*7-1 where 21>=20 and -3<-1<=0

Test Cases

Input -> Output
20, 3 -> 7, -1
10, 5 -> 2, 0
7, 20 -> 1, -13
100, 13 -> 8, -4

You don't need to handle o=0.

Python 3,  39 26 bytes

Martin Ender saved 13 bytes

lambda x,y:(-(x//-y),x%-y)

Try it online!

Python 2, 25 bytes

lambda x,y:(-(x/-y),x%-y)

Try it online!


Wuxings in Positive Action Background
Wuxings(五行) are the five "elements" in Chinese philosophy. They are Fire(火), Water(水), Wood(木), Metal(金), and Soil(土). You can find them on East Asian calendar, where some days (Tuesday through Saturday) are named by the Wuxings.
Some Korean names are given according to Wuxings, so that father's name will have a positive effect to his children. Let's simulate that.
Positive actions

Fire fertilizes Soil.
Soil incubates Metal.
Metal is a container for Water.
Water nourishes Wood.
Wood fuels Fire.

Negative actions
These are irrelevent to this challenge, but I'm showing them anyway.

Fire melts Metal.
Metal chops Wood.
Wood penetrates Soil.
Soil blocks Water.
Water extinguishes Fire.

Ideographs
Some ideographs have a Wuxing as its radical. Here, only the CJK Ideographs(U+4E00–U+9FFF), a Unicode block, will be considered as of Unicode 1.0.1.

火(U+706B)–爩(U+7229) have Fire as the radical.

水(U+6C34)–灪(U+706A) have Water as the radical.

木(U+6728)–欟(U+6B1F) have Wood as the radical.

金(U+91D1)–钄(U+9484) have Metal as the radical.

土(U+571F)–壪(U+58EA) have Soil as the radical.

All other characters fall in don't care situation.

Notes

Some characters, in Unicode's own dictionary, disagree with the categorization above. For example, 泵(U+6CF5) actually doesn't have Water as its radical, but rather "石". For another example, 渠(U+6E20) has ambiguous radical, Water or Wood. Such characters also fall in don't care situation.

After Unicode 1.0.1, Unicode added more characters that has a Wuxing as their radical to the block and other blocks. For example, 龦(U+9FA6) also has Fire as its radical. This detail shall be ignored in this challenge, and such characters also fall in don't care situation.

Objective
Given an ideograph having a Wuxing \$W\$ as its radical, output any ideograph whose radical will be positively acted by \$W\$.
Examples
Given 溒(U+6E92), it has Water as its radical, so output any ideograph having Wood  as its radical, since Water nourishes Wood. For example, 杜(U+675C).
Given 坽(U+577D), it has Soil as its radical, so output any ideograph having Metal as its radical, since Soil incubates Metal. For example, 鉺(U+927A).

JavaScript (Node.js), 39 bytes
I/O: Unicode codepoints as integers.
n=>Buffer("99944,777I")[n/543%62&15]<<9

Try it online!
How?
Step 1
We first look for some divisor \$d\$ such that the following element sets \$S_k\$ are disjoint:
$$S_k=\left\{\left\lfloor\dfrac{n}{d}\right\rfloor,\:C_{min}(k)\le n\le C_{max}(k)\right\}$$
where \$C_{min}(k)\$ and \$C_{max}(k)\$ are the codepoint bounds of the \$k\$-th element.
Because the Unicode range of Water (U+6C34 to U+706A) is immediately followed by the Unicode range of Fire (U+706B to U+7229), there are not many possible options for \$d\$: it must be a proper divisor of \$28779\$ (0x706B), i.e. \$d\in\{1, 3, 53, 159, 181, 543, 9593\}\$. The best value in there that actually works is \$d=543\$.
Step 2
We then look for some modulo chain that takes \$n\$ as input and turns it into an index corresponding to the counterpart element, using \$n/543\$. Instead of rounding the result towards zero, we force the last operation to a bitwise AND rather than a modulo.
A quick brute-force search leads to:
$$f(n)=((n/543)\bmod 62)\operatorname{and}15$$
Step 3
Finally, we look for some multiplier \$m\$ such that there exists some \$q_k\$ for each \$k\$ that satisfies:
$$C_{min}(k)\le q_k\times m\le C_{max}(k)$$
One possible golf-friendly value is \$m=512\$, leading to the following table:
 element | hexa range      | q  | q*512 | as hexa
---------+-----------------+----+-------+---------
  Soil   | 0x571F - 0x58EA | 44 | 22528 | 0x5800
  Wood   | 0x6728 - 0x6B1F | 52 | 26624 | 0x6800
  Water  | 0x6C34 - 0x706A | 55 | 28160 | 0x6E00
  Fire   | 0x706B - 0x7229 | 57 | 29184 | 0x7200
  Metal  | 0x91D1 - 0x9484 | 73 | 37376 | 0x9200

The values of \$q\$ are encoded as the ASCII codes of ,479I.


Tips for golfing Yabasic Yabasic, or Yet Another Basic is a dialect of basic created by Marc-Oliver Ihm that may be run on Windows, Unix and PAL versions of the Sony PlayStation 2. Development for this language is ongoing.

  Helpful Resources

  Yabasic Official Website

  Yabasic Manual

  Yabasic Wikipedia Page

  Yabasic GitHub

  Yabasic PS2 Documentation

  Some Yabasic Programs

  Try it Online

What general tips do you have for golfing in Yabasic? Any ideas that can be applied to code golf problems in general that are at least somewhat specific to Yabasic. Please post one tip per answer.

Use Chr$(...) to Print numbers

By default, all numbers printed using Yabasic print with a space following them, and to remove this space while printing characters individually, one may use the formula below.
It is important to note that this only works for printing digits 0 - 9, meaning that this works best for iterating across numbers digit by digit.
...
?Left$(Str$(n),1);
...

Try it online!
However, if the context allows, this can be golfed down to this formula.
...
?Chr$(n+48);
...

Try it online!


Write a self-aware program A standard (but disputed) test of self-awareness is the mirror test: An animal is considered self aware if it can recognize itself in the mirror.

Your task is to write a program that is self-aware according to this test. More exactly:

The program reads input in whatever form is suitable for your language.
If the input contains a mirror image of its own source code, it produces a truthy value, otherwise a falsey value.
A valid mirror image is the exact source of the program with the order of characters reversed, with no extra characters in between. As a special exception, for systems/languages that don't use single characters to terminate/separate lines (e.g. using a CR/LF sequence), the line termination sequence is allowed, but not required to be kept intact on reversal. However the program must be consistent in its treatment of lines.

For example, on a system using CR/LF as line separator, the sequence  AB<cr><lf>CD may be reversed either to DC<cr><lf>BA (keeping the line ending intact) or to DC<lf><cr>BA (completely reversing the character sequence).
The mirror image must be detected also if it is preceded or followed by junk, even if that junk contains reversed fragments of the code.

This is code golf; the shortest entry wins.

Note this is not the same as this question because of (a) the  reversal of the code, and (b) the fact that it has to tolerate junk before and after the reversed code, including junk that is very similar to the actual reversed code.

Retina, 1 byte

x

Try it online!

Prints a positive integer when the input contains at least one "reversed" copy of the source and 0 otherwise.

Any character that isn't a backtick or a regex metacharacter ([()?*+\\^$.) would work.


The Improved Caesar Pig Latin Cipher The problem with the Caesar cipher is the resulting words are often unpronounceable.  The problem with Pig Latin is that it is easy to decode.  Why not combine them?

Input

A word consisting of the 26 english letters.

Output

First, change every consonant in the word to the next consonant in the alphabet.  So, b goes to c, d goes to f, and z goes to b.  Then, change every vowel to the next vowel in the alphabet (u goes to a).  Last, only if the first letter of the word is a consonant, move that letter to the end of the word and add "ay" to the end of the word.

Examples:

cat -> evday
dog -> uhfay
eel -> iim

This is code-golf, so the shortest code wins.
Case does not matter.
Vowels that will be used are A, E, I, O, and U

Ruby, 96 69 bytes

->s{/^[^aeiou]/=~(r=s.tr'zb-yadehinotu','b-zefijopuva')?$'+$&+'ay':r}

Try it online!

Fun fact of the day: tr() matches strings right-to-left. I always assumed it was left-to-right.


Play a perfect game of Mu Torere Background

Mu Torere is a game that is one of only two known to be played by the Maori people of New Zealand before European influence. This makes it a very unique game in that it has an "objective winning criterion" and rules of play that are different from most other games in existence.

Gameplay:

The board is an octagon. There are connections between each adjacent vertex, and there is a center node that is connected to all of the vertices. At any point in time, eight of the nine nodes are occupied by stones. At the start, there are four white stones and four black stones that are each take up one half of the octagon, with the center node empty. Black moves first.

Each turn, a player can move one of his stones along one of the 16 edges from one node to the empty node. A stone can only be moved from an outer node to the center node if the stone is next to an opponent's stone.

A player loses when he is unable to make a legal move, which occurs when there is no edge connecting a stone to the empty node.

Here is a website that explains the rules (with a diagram) and offers some analysis.

The Challenge

Your challenge is to write the shortest program that can play a perfect game of Mu Torere against a human opponent. Your program should be able to display and update the game board, make moves and receive moves from a human opponent. Most importantly, it should play a perfect game.

Perfect Game?

Yes, perfect game. I've been doing some game analysis, and I found that the game lasts for an infinite amount of time if played perfectly by both sides. This means that your program should never lose. Also, your program should be able to force a win whenever the human opponent makes a mistake that allows the program to force a win. As for how your program finds the perfect move, this is up to you.

Details

After each move (and at the start of the game), your program should print the game board. However you choose to display the board, it must show all of the nodes and be fully connected (all 16 connection lines should be drawn with no crossed lines). At the start, the board should have the correct starting position. One way of accomplishing this is by making the game board a square.

w-w-w
|\|/|
b-o-w
|/|\|
b-b-b

The two colors are black and white, or dark/light. The board must show which nodes are occupied by which player's pieces, such as marking them with a "b" or "w", and which node is vacant. Participants are encouraged (but not required) to make the game board more graphical, rather than plain text.

Your game board should have a numbering system that gives each node a unique number. You may choose to number the board any way you like, but it should be explained in your answer or by the program.
The square board can be numbered as follows:

1-2-3
|\|/|
4-5-6
|/|\|
7-8-9

The human is the first to move. His input will be a single number. This will be the number of the node where the moved stone currently is. If I wanted to move a stone from node 4 to an empty node 5, I will type a 4. The 5 is implied as it is the only empty node.

Assume that the human will always make a legal move.

After the human makes his move, an updated board should be printed. After your program decides on a legal move, it should print another updated board, and then wait for the human to enter another move.

Your program should terminate once it has won.

Notes

Standard code golf rules apply, no accessing external files, etc., etc. Also, I'm going to impose a flexible time limit of 15 seconds (on a reasonable machine) for your program to make each of its moves. As stated, this game has the possibility to form infinite loops, and I don't want a depth-first search getting into an infinite loop.

Ruby, 390 chars
o=->s,c{f=s=~/o/;[*0..8].select{|t|s[t]==c&&(t<1||(t+6)%8+1==f||t%8+1==f||f<1&&(s[(t+6)%8+1]!=c||s[t%8+1]!=c))}.map{|t|k=s*1;k[f]=c;k[t]=?o;k}}
v=->s,c,h{f=o[s,c];f==[]?0:h<1?1:2-f.map{|t|v[t,c>?b??b:?w,h-1]}.min}
q=->g{puts"1-2-3\n|\\|/|\n8-0-4\n|/|\\|\n7-6-5\n".tr"0-8",g;$>.flush}
q[g="obbbbwwww"]
(g.tr!?o,?b;g[gets.to_i]=?o;q[g];q[g=o[g,?w].sort_by{|q|v[q,?w,5]}[-1]])while v[g,?b,5]>0

An implementation in ruby which directly calculates the game tree (which takes quite some code) and thus always plays optimally. The board positions are spiraling outwards as shown in the following figure:
1 - 2 - 3
| \ | / |
8 - 0 - 4
| / | \ |
7 - 6 - 5


Tool-Assisted Code Golf TAS Golf

In the style of a tool-assisted speedrun with a code-golf twist, the goal of this challenge is to complete World 1-1 of the original Super Mario Bros game for the NES in your chosen programming language in as few bytes as possible, using only the in-game controller inputs in the format I'll describe below. Your program must output to stdout a list of lines in this format, created specifically for this challenge:
up down left right start select A B

Starting with the first frame, each newline represents the inputs for Controller 1 for a particular frame. The order of buttons per frame does not matter, and they can be separated by any amount of non-newline whitespace. All or none or some of the button names can be included per line. For example, a simple Python program that presses the D-pad right for 3 frames and then presses A might look like this:
for _ in range(3): print('right')
print('A')

And its output (which I would feed into my emulator to verify) would be:
right
right
right
A

Here, we define 'success' as reaching the flag at the end of World 1-1 pictured above. The score for this example Python submission, if it succeeded (which it doesn't), would be 44 bytes, or the original length of the Python program.
For an example working input file I created based on the current fastest TAS, see this Github Gist: https://gist.github.com/anonymous/6f1a73cbff3cd46c9e1cf8d5c2ff58e1 Note that this file completes the entire game.
There is no way to enter subframe inputs. There is also no way to enter inputs in Player 2's controller, but that also shouldn't be necessary (or useful) for completing the level or game.
The version of SMB used will be the original USA / Japan iNES ROM (md5sum 811b027eaf99c2def7b933c5208636de -- the USA version is the exact same as the Japanese version so either will work, the ROM is commonly labeled Super Mario Bros (JU) (PRG 0) or similar).
To test the submissions, I will run the programs, pipe their stdout into an input.txt file, and load them into FCEUX using this Lua script mario.lua I wrote for this challenge:
for line in io.lines('input.txt') do
   local t = {}
   for w in line:gmatch("%S+") do
      t[w] = true;
   end;
   joypad.set(1, t);
   emu.frameadvance();
end;
while (true) do
   emu.frameadvance();
end;

The specific command I'll be using is fceux mario.nes --loadlua mario.lua. There is no time limit to the programs, though they must eventually terminate.
This is a little Bash one-liner I made to convert a FCEUX movie (.fm2) file to an input.txt for my script, if it helps:
cat movie.fm2 | cut -d'|' -f 3 | sed 's/\.//g' | sed 's/R/right /g' | sed 's/L/left /g' | sed 's/D/down /g' | sed 's/U/up /g' | sed 's/T/start /g' | sed 's/S/select /g' | sed 's/B/B /g' | sed 's/A/A /g' | tail -n +13 > input.txt

For reference, here is a full-resolution map of World 1-1 (open the image in a new tab for full resolution):
(source: mariouniverse.com)
Note: At first glance, this may seem like a Kolmogorov complexity challenge on my given input.txt file. However, in reality the challenge is more complex than that because (a) the input.txt I provided is definitely not the shortest possible and (b) there has never been an attempt to create the shortest possible set of keypresses for SMB in this format. The 'fewest buttons possible' known TAS is different because it allows for holding of buttons for a long time, which would add length to the desired output in this challenge.

Python 2, 69 48 46 44 bytes

print"start\n\n"*19+(27*"A right\n"+"\n")*99

See it in action on youtube!

Automatically found with (a modified version of) this hacky script:

start = 18
oncycle = 21
offcycle = 4

while true do
    emu.poweron()
    -- emu.speedmode("maximum")

    starting = 0
    i = 0
    frames = 0
    last_mario_x = -1

    emu.message(start .. " " .. oncycle .. " ".. offcycle)

    state = 0
    while state ~= 6 and state ~= 11 and frames < 4000 do
        if frames > 500 and frames % 100 == 0 then
            mario_x = memory.readbyte(0x6D) * 0x100 + memory.readbyte(0x86)
            if mario_x == last_mario_x then emu.message("stuck " .. mario_x .. " " .. last_mario_x); break end
            last_mario_x = mario_x
        end

        if starting < start then
            joypad.set(1, {start=1})
            emu.frameadvance(); frames = frames + 1;
            joypad.set(1, {})
            emu.frameadvance(); frames = frames + 1;
            starting = starting + 1
        else
            if i < oncycle then
                joypad.set(1, {A=1, B=1, right=1})
                i = i + 1
            else
                joypad.set(1, {})
                i = i +  1
                if i == oncycle + offcycle then
                    i = 0
                end
            end

            emu.frameadvance()
            frames = frames + 1
        end

        state = memory.readbyte(0x000E)
        if state == 4 then
            emu.message("success!")
            os.exit()
            break
        end

    end

    if start < 30 then
        start = start + 1
    elseif offcycle < 10 then
        start = 18
        offcycle = offcycle + 1
    else
        offcycle = 1
        oncycle = oncycle + 1
    end
end


Am I perfect (number)? This is my first challenge!

Background

Perfect number is a positive integer, that is equal to the sum of all its divisors, except itself.
So 6 is perfect number, since 1 + 2 + 3 = 6.
On the other hand 12 is not, because 1 + 2 + 3 + 4 + 6 = 16 != 12.

Task

Your task is simple, write a program, which will, for given n, print one of these messages:

  I am a perfect number, because d1 + d2 + ... + dm = s == n
  I am not a perfect number, because d1 + d2 + ... + dm = s [<>] n

Where
d1, ... dm are all divisors of n except for n.
s is the sum of all divisors d1, ..., dm (again, without n).
[<>] is either < (if s < n) or > (if s > n).

Examples

For n being 6: "I am a perfect number, because 1 + 2 + 3 = 6 == 6"
For n being 12: "I am not a perfect number, because 1 + 2 + 3 + 4 + 6 = 16 > 12"
For n being 13: "I am not a perfect number, because 1 = 1 < 13"

Rules

n is not bigger than your language's standard int.
You can read n from standard input, from command line arguments or from a file.
Output message has to be printed on standard output and no additional characters can appear in the output (it may have trailing whitespace or newline)
You may not use any built-ins or library functions which would solve the task (or its main part) for you. No GetDivisors() or something like that.
All other standard loopholes apply.

Winner

This is code-golf so shortest code in bytes wins!

Java, 255 270 bytes (Still FF in base 17)

class C{public static void main(String[]a){int i=new Integer(a[0]),k=0,l=0;a[0]=" ";for(;++k<i;)if(i%k<1){l+=k;a[0]+=k+" ";}}System.out.print("I am "+(l==i?"":"not ")+"a perfect number, because "+a[0].trim().replace(" "," + ")+" = "+l+(l==i?" == ":l<i?" < ":" > ")+i);}}

And a more readable version:

class C {
    public static void main(String[] a) {
        int i = new Integer(a[0]), k = 0, l = 0;
        a[0] = " ";
        for(; ++k<i ;){
            if (i % k == 0) {
                l += k;
                a[0] += k + " ";
            }
        }
        System.out.print("I am " + (l == i ? "" : "not ") + "a perfect number, because " + a[0].trim().replace(" "," + ") + " = " + l + (l == i ? " == " : l < i ? " < " : " > ") + i);
    }
}

Previously didn't work for odd numbers, so I had to tweak a few things. At least I got lucky with the byte count again. :)


Fill the Golfeek gutter Golfeek is the working name of an esolang I'm occasionally working on. One distinctive feature of this language is that each statement is encoded as a sequence of bits rather than a sequence of bytes.

Instead of just showing a long binary sequence, the 'gutter' of the source editor contains a representation of each statement in a more digest and (slightly) more readable format:

Format

The binary sequence is always read from left to right.
It is first split into nibbles (groups of 4 bits) shown as uppercase hexadecimal between brackets. A space is inserted after each byte, provided that it's followed by another byte or a last lone nibble.

Example:

[1,1,1,1,0,0,0,0,1,0,1,0] --> "[F0 A]"
 \_____/ \_____/ \_____/

If there are more than 14 nibbles, only the first 6 bytes are shown, followed by a space, followed by .., followed by the closing bracket.
If the number of bits is not a multiple of 4, the remaining bit(s) is/are appended as '0' or '1' right after the closing bracket.

Example:

[0,1,1,1,1,0,0,1,0,1] --> "[79]01"
 \_____/ \_____/ \_/

Your task

Given a sequence of bits, return its representation in Golfeek format.

Rules

The sequence of bits may be taken in any reasonable and non-ambiguous format. Please note that the sequence may contain leading zeros, which your format must be able to deal with.
You can assume that there will always be at least 4 bits in the input sequence, and therefore at least one nibble between the brackets.
The output must be a string (or a list of characters) that conforms exactly to the format described above, with uppercase hexadecimal and correct spacing. A trailing linefeed is optional.
This is code-golf.

Test cases

Input

0101
00001
110101
10100111
101001111100
000000000000000
011110101101001110010011000111
11011110101011011011111011101111
11110101000110000001111011001110011100100110111000100000100
111101010001100000011110110011100111001001101110001000001001
1111010100011000000111101100111001110010011011100010000010010

Output

[5]
[0]1
[D]01
[A7]
[A7 C]
[00 0]000
[7A D3 93 1]11
[DE AD BE EF]
[F5 18 1E CE 72 6E 20]100
[F5 18 1E CE 72 6E ..]
[F5 18 1E CE 72 6E ..]0

05AB1E, 36 34 33 31 bytes

Ć4ô¤¨s¨Ch2ôJDg8@i6∍„..ª}ðý"[ÿ]ÿ

Try it online!


Operation Unz̖̬̜̺̬a͇͖̯͔͉l̟̭g͕̝̼͇͓̪͍o̬̝͍̹̻ I'm sure you're all familiar with Z̃͗̇̚͟Ḁ̬̹̈̊̂̏̚L̜̼͊ͣ̈́̿̚G̱̮ͩ̃͑̆ͤ̂̚Õ̷͇͉̺̜̲ͩ́ͪͬͦ͐ ̪̀ͤͨ͛̍̈͢ĝ̭͇̻̊ͮ̾͂e̬̤͔̩̋ͮ̊̈ͭ̓̃n͖͎̘̭̯̳͎͒͂̏̃̾ͯe͕̖̋ͧ͑ͪ̑r̛ͩa̴͕̥̺̺̫̾ͭ͂ͥ̄ͧ͆t͍̻̘̆o͓̥ͤͫ̃̈̂r̹̤͇̰̻̯̐ͮ̈́ͦ͂͞. If not, you can play with the classical generator a bit. Zalgo text is unicode text that started as English text and had a bunch of combining characters to make it hard to read artistic.

This is operation unzalgo. The object is to undo the generate zalgo text operation. Since only combining characters were added, only combining characters have to be removed. We're only going to be operating on English, because of course we are. However, all proper English text must to come through unmutated. That is, if you were fed proper English, you must output your input. Sounds easy, right? Not so fast. English has combining characters, just not very many, and people are slowly forgetting they exist.

The rules:

1) You may either strip combining characters or filter out all invalid characters, at your discretion. This doesn't have to work at all languages because the operation itself makes no sense if we started with something that wasn't English text. Abandon hope all ye who enter here.

2) You may assume that unicode normalization was not executed after zalgo generation; that is all added combining characters are still combining characters.

3) All printable ASCII characters (codepoints between 0x20 and 0x7E inclusive) must survive, as well as tab (0x09), and newline (0x0A).

4) English has diaresis over vowels. These must survive whether expressed as natural characters or combining characters.

Vowel table (Each group of three is in the form (unmodified character, single character, combining characters):

a ä ä A Ä Ä
e ë ë E Ë Ë
i ï ï I Ï Ï
o ö ö O Ö Ö
u ü ü U Ü Ü
y ÿ ÿ Y Ÿ Ÿ

The combining diaresis character is code-point 0x308.

5) English does not have diaeresis over consonants. You must dump them when constructed as combining characters.

6) British English has four ligatures. These must survive:

æ Æ œ Œ

7) The following symbols must survive:

Editor substitution table (includes smart quotes in both directions):

… ¼ ½ ¾ ‘ ’ “ ” ™

Symbol table:

$ ¢ £ ¬ † ‡ • ‰ · ° ± ÷

8) If you get something like ö̎̋̉͆̉ö͒̿̍ͨͦ̽, both oo and öö are valid answers.

9) Input may contain both zalgo and non-zalgo characters; and the non-zalgo characters should be unmodified: if somebody sends 'cöoperate with dͧḯ̍̑̊͐sc͆͐orͩ͌ͮ̎ͬd̄̚', they should still get back 'cöoperate with discord' not 'cooperate with discord'.

10) If any character is not specified, it doesn't matter what you do with it. Feel free to use this rule to lossily compress the keep-drop rules.

11) Your program must handle all unicode codepoints as input. No fair specifying a code-page that trivializes the problem.

Additional test cases:

"z̈ ỏ"        "z o"
"r̈ëën̈ẗr̈ÿ"    "rëëntrÿ"  (don't outsmart yourself)

I have been informed  this case is also excellent but it's starting point contains a few characters with unspecified behavior. If you maul Θ, Ό, Ɲ, or ȳ I don't care.

A pretty comprehensive test input:

    cöoperate with dͧḯ̍̑̊͐sc͆͐orͩ͌ͮ̎ͬd̄̚ æ Æ œ Œ…¼½¾‘’“”™$¢£¬†‡•‰·°±÷

a ä ä A Ä Ä
e ë ë E Ë Ë
i ï ï I Ï Ï   Z̃͗̇̚͟Ḁ̬̹̈̊̂̏̚L̜̼͊ͣ̈́̿̚G̱̮ͩ̃͑̆ͤ̂̚Õ̷͇͉̺̜̲ͩ́ͪͬͦ͐ ̪̀ͤͨ͛̍̈͢ĝ̭͇̻̊ͮ̾͂e̬̤͔̩̋ͮ̊̈ͭ̓̃n͖͎̘̭̯̳͎͒͂̏̃̾ͯe͕̖̋ͧ͑ͪ̑r̛ͩa̴͕̥̺̺̫̾ͭ͂ͥ̄ͧ͆t͍̻̘̆o͓̥ͤͫ̃̈̂r̹̤͇̰̻̯̐ͮ̈́ͦ͂͞
o ö ö O Ö Ö
u ü ü U Ü Ü
y ÿ ÿ Y Ÿ Ÿ
Unz̖̬̜̺̬a͇͖̯͔͉l̟̭g͕̝̼͇͓̪͍o̬̝͍̹̻

ö̎̋̉͆̉ö͒̿̍ͨͦ̽
 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅ

JavaScript (Node.js), 45 bytes

s=>s.replace(/([aeiouy]̈)|[̀-ͯ҉]/ig,'$1')

Try it online!

More readable version:

s=>s.replace(/([aeiouy]\u0308)|[\u0300-\u036f\u0489]/ig,'$1')


Convert integer to string preserving order The quest is to convert an integer to a string in such a way that 1. the order is preserved 2. using the least number of characters in the string.

Let's say I have an integer X; the objective is to create a function f (and respective inverse, g, such that:

Conditions

f(X) is a utf-8 string for all integer X
g(f(X)) = X
Ordering is preserved. That is, if I have another integer Y, X > Y implies f(X) > f(Y)
The integer means it can be negative
Assume integers in [-2^63, 2^63 - 1]

Winning criterion

The answer must fulfill the conditions above
Make f(X) represent the number in the least number of UTF-8 characters.
Of answers complying with 1 and 2, smallest code wins (sum of code of f and code of g)

Example

(Python)

def f(x):
    return '%019d' % x  # log10(2^63 - 1) ~ 18.9

def g(x):
    return int(x)

Notice that it is not clear that f is optimal since it always uses the same number of characters (independent of x).

This is my first challenge here and I'm not sure if this fits this Q&A, but it seemed to me a nice and useful problem. I'm also trying to solve it.

PowerShell, 185

$s=32767
function f($x){$a='';while($x){$r=$x%$s;$a+=[char]($r+$s)
[long]$x=[bigint]::divide($x,$s)};$a}
function g($x){$a=0;0..($x.length-1)|%{$a+=($x[$_]-$s)*[bigint]::pow($s,$_)};$a}

Ungolfed

$shift = 32767

function f($number) {
    $string = ''
    while($number) {
        $remain = $number % $shift
        $string += [char]($remain+$shift)
        [long]$number = [bigint]::divide($number, $shift)
    }
    $string
}

function g($string) {
    [long]$number = 0
    0..($string.length-1)|%{$number += ($string[$_]-$shift)*[bigint]::pow($shift, $_)}
    $number
}

At most, the output will be length 5.

> f ([long]::MaxValue)
耆耟耯耟耇
> g '耆耟耯耟耇'
9223372036854775807
> f ([long]::MinValue)
翷翟翏翟翷
> g '翷翟翏翟翷'
-9223372036854775808


Generate lists in which every sublist has a unique element The problem is defined as follows:
Create a function that takes an integer and returns a list of integers, with the following properties:

Given a positive integer input, n, it produces a list containing n integers ≥ 1.
Any sublist of the output must contain at least one unique element, which is different from all other elements from the same sublist. Sublist refers to a contiguous section of the original list; for example, [1,2,3] has sublists [1], [2], [3], [1,2], [2,3], and [1,2,3].
The list returned must be the lexicographically smallest list possible.

There is only one valid such list for every input. The first few are:
f(2) = [1,2]         2 numbers used
f(3) = [1,2,1]       2 numbers used
f(4) = [1,2,1,3]     3 numbers used

GolfScript (20 18 chars)

{,{.)^2base,}%}:f;

This is a simple binary ruler function, A001511.

Equivalently

{,{).~)&2base,}%}:f;
{,{~.~)&2base,}%}:f;
{,{).(~&2base,}%}:f;
{,{{1&}{2/}/,)}%}:f;

Thanks for primo for saving 2 chars.


Number of cycles of a permutation Consider a permutation of the integers 1, ..., n, such as this one for n = 6:
[5,2,4,3,6,1]

If you view the permutation as a mapping from [1,2,3,4,5,6] to [5,2,4,3,6,1], the permutation can be decomponsed into disjoint cycles. A cycle is a subset of elements that map to each other. For example, 1 gets mapped to 5, which gets mapped to 6, which gets mapped back to 1. So one cycle is [1,5,6]. The other cycles are [2] and [3,4]. Thus the number of cycles for this permutation is 3.
In general, the cycles of a permutation are unique (up to order), and the number of cycles for a permutation of size n varies from 1 to n.
The challenge
Given a non-empty permutation, output its number of cycles.
Input is an array formed by the n integers 1, 2, ..., n, where n > 0. Each integer occurs exactly once. The order in which they appear defines the permutation, as in the example above.
Instead of an array you can use a list, a string with a separator between the numbers, a separate input for each number, or anything that's reasonable.
For a permutation of size n, instead of the 1-based set of integers 1, ..., n you can consistently use the 0-based set 0, ..., n-1. If so, please indicate it in your answer.
The code should work for n up to 20 in a reasonable time, say less than one minute.
Code golf. All builtins allowed.
Test cases
This assumes 1-based, array input.
 [1] -> 1
 [3,2,1] -> 2
 [2,3,4,5,1] -> 1
 [5,2,4,3,6,1] -> 3
 [8,6,4,5,2,1,7,3] -> 2
 [4,5,11,12,7,1,3,9,10,6,8,2] -> 1
 [4,2,5,11,12,7,1,3,9,10,6,8] -> 5
 [5,8,6,18,16,9,14,10,11,12,4,20,15,19,2,17,1,13,7,3] -> 3
 [14,5,17,15,10,18,1,3,4,13,11,16,2,12,9,7,20,6,19,8] -> 7

Related
This related challenge asks for the actual cycles of the permutation, not the number of them. Requiring only the number of cycles can lead to shorter algorithms that sidestep generating the actual cycles.

J, 4 bytes

#@C.

This assumes that the permutation is 0-based. It uses the builtin C. which given a list representing a direct permutation outputs a list of cycles. Then # composed @ on that returns the number of cycles in that list.

Try it here.


"Atomic" code golf - determine the number of neutrons in an isotope Your task is to take an string containing an isotope of an element as input, encoded like the following example with the atomic number followed by a space and the IUPAC chemical symbol for the element:

162 Dy

and return the number of neutrons in an atom of that isotope.

In the above example, dysprosium-162 has 96 neutrons (162 total nucleons, minus 66 protons because it's dysprosium), so the output should be 96.

You may assume that the element given will be one of the 114 elements currently given permanent names by the IUPAC (including flerovium and livermorium) and not a generic name such as Uus for "ununseptium". You may also assume that the atomic number of the isotope will not exceed 1000, or be less than the number of protons in the element.

You may not use built-ins to retrieve data about the proton or neutron number of elements, or use any function within your code that evaluates a string or number token as code on its own.

The program to use the fewest tokens to do this in any language wins. However, for the purpose of this challenge, every character in a string, or a variable name converted into a string, counts as a token.

List of elements and their atomic number for reference:

{
    "H": 1,
    "He": 2,
    "Li": 3,
    "Be": 4,
    "B": 5,
    "C": 6,
    "N": 7,
    "O": 8,
    "F": 9,
    "Ne": 10,
    "Na": 11,
    "Mg": 12,
    "Al": 13,
    "Si": 14,
    "P": 15,
    "S": 16,
    "Cl": 17,
    "Ar": 18,
    "K": 19,
    "Ca": 20,
    "Sc": 21,
    "Ti": 22,
    "V": 23,
    "Cr": 24,
    "Mn": 25,
    "Fe": 26,
    "Co": 27,
    "Ni": 28,
    "Cu": 29,
    "Zn": 30,
    "Ga": 31,
    "Ge": 32,
    "As": 33,
    "Se": 34,
    "Br": 35,
    "Kr": 36,
    "Rb": 37,
    "Sr": 38,
    "Y": 39,
    "Zr": 40,
    "Nb": 41,
    "Mo": 42,
    "Tc": 43,
    "Ru": 44,
    "Rh": 45,
    "Pd": 46,
    "Ag": 47,
    "Cd": 48,
    "In": 49,
    "Sn": 50,
    "Sb": 51,
    "Te": 52,
    "I": 53,
    "Xe": 54,
    "Cs": 55,
    "Ba": 56,
    "La": 57,
    "Ce": 58,
    "Pr": 59,
    "Nd": 60,
    "Pm": 61,
    "Sm": 62,
    "Eu": 63,
    "Gd": 64,
    "Tb": 65,
    "Dy": 66,
    "Ho": 67,
    "Er": 68,
    "Tm": 69,
    "Yb": 70,
    "Lu": 71,
    "Hf": 72,
    "Ta": 73,
    "W": 74,
    "Re": 75,
    "Os": 76,
    "Ir": 77,
    "Pt": 78,
    "Au": 79,
    "Hg": 80,
    "Tl": 81,
    "Pb": 82,
    "Bi": 83,
    "Po": 84,
    "At": 85,
    "Rn": 86,
    "Fr": 87,
    "Ra": 88,
    "Ac": 89,
    "Th": 90,
    "Pa": 91,
    "U": 92,
    "Np": 93,
    "Pu": 94,
    "Am": 95,
    "Cm": 96,
    "Bk": 97,
    "Cf": 98,
    "Es": 99,
    "Fm": 100,
    "Md": 101,
    "No": 102,
    "Lr": 103,
    "Rf": 104,
    "Db": 105,
    "Sg": 106,
    "Bh": 107,
    "Hs": 108,
    "Mt": 109,
    "Ds": 110,
    "Rg": 111,
    "Cn": 112,
    "Fl": 114,
    "Lv": 116
}


How can Pyth be improved? Pyth is in ongoing development, meaning that new features are being added all the time.

I want to make Pyth a better langauge, so I'd like to know what features people are looking for.

This is the place the post ideas you have for making Pyth better.

In your answer, please state:

What you'd like to see changed/added.
An example usage of the change.

I'll comment if I'm planning to implement the suggestion.

Please check if the idea you want to suggest has already been suggested. Upvote ideas you'd like implemented.

Implemented suggestions:

Eval string in Pyth, as .v
More Regex operations
Apply While as .W
Nested Loops and More Lambdas (They use the same mechanism underneath)
Flatten nested lists as .n

This was on topic as per this meta question when I posted the question, it is no longer clear.

Nested loops
If you want to nest for loops, you currently have to waste a byte for using F<var><seq> inside a V<seq> or vice versa. I'd love to have the same thing as with lambdas, where the variable used for the loop would change when nesting loops.


Print the Lost numbers As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are:

\$ 4, 8, 15, 16, 23, 42\$ (A104101)

Using any programming language, write a code that outputs these numbers.

Scoring:

Shortest answer wins
The output must not contain any other numbers or letters. You may use any other character as separator, or even no separator at all.
You cannot separate digits of the same number. \$ 48\_15162342 \$ is a valid answer, but \$481\_5162342\$ is not.
You must respect the order.
If your code does not contain any of the numbers from the sequence, reduce your score by 30%. This rule does allow you to enter the digits separately. E.g.:

abcde1fg5h

Is a valid candidate because the answer does not contain the number \$15\$, only its digits. However, any \$4\$ or \$8\$ will invalidate the bonus.
If the code does not contain any digit at all, reduce your score by 50%. Other characters like \$¹\$, \$²\$ or \$³\$ are still valid for this bonus.

Lost, 29 27/2 = 13.5 bytes

%?\>>>>>>>>>>
>>\"*"@"

Try it online! or verify that it is deterministic

Seemed like the right language to use.

Explanation:

Lost is a 2D language where the pointer starts anywhere, going in any direction. This generally leads to a lot of double checking that the pointer hasn't entered a section early.

...>>>>>>>>>>  These arrows filter all pointers that appear on the top line
.............  Or going vertically

%............  This flips the flag so that the program can end
.............  This stops premature termination

.?\..........  Clear the stack by skipping if a value popped from the stack is positive
.............  When the stack is empty, the \ directs the pointer down

.............  The \ directs the pointer right
..\"*"..  The string literal pushes all the Lost values to the stack

..\..........  The @ terminates the program if the % flag is switched
>>\........@.  Otherwise it clears the stack and repeats

.............  The quote here is to prevent the pointer getting stuck
............"  This happens when the pointer starts between the other quotes


Is there any web esoteric language(like javascript)? Is there any javascript-like language? Something that can be interpreted by browsers?


Build me some string stairs String Stairs

Disclaimer: This is the first challenge I propose. Any and all feedback is welcome. If this is a duplicate, please point it out.

Here's a link to the sandbox post.

Goal

The goal of this challenge is to, given a string and an integer, print the string into blocks of that integer's size. If a word has more characters than the size of a block, print it into a descending "stair" pattern.

Rules

The "stair pattern" mentioned above means that, for every block of a same word, that block must begin exactly where the block above it ends. Check the test cases (or ask) if you have any questions.
If a word is broken in multiple blocks, the following word must be printed with an adequate number of spaces, that is, it must be separated from the preceding word's lowermost block by exactly one whitespace. Check the test cases (or ask) for clarification.
You can assume the input string will consist only of printable ASCII characters. Also, it will not have multiple whitespaces in a row.
You can also assume that the integer will always be in the range [1, +∞).
Trailing whitespace or newlines are allowed.
You can use any reasonable method for I/O.
Standard Loopholes apply.
This is code-golf, so shortest code (in bytes, per language) wins. After a week (or so), I'll accept the overall shortest answer.

Test Cases

(String, Integer) => (Output)

"This is a large string", 3 => Thi is a lar  str
                                 s        ge   ing

"This is an even larger string!", 2 => Th  is an ev  la   st
                                        is        en  rg   ri
                                                       er   ng
                                                             !
"Ooooh dear, what a big string you have!", 3
=> Ooo  dea  wha a big str   you hav
     oh   r,   t         ing       e!

"Staphylococcus saprophyticus", 4 => Stap        sapr
                                        hylo        ophy
                                           cocc        ticu
                                              us          s

"I hope you find this challenge interesting", 2
=> I ho  yo fi  th  ch    in
      pe  u  nd  is  al    te
                      le    re
                       ng    st
                        e     in
                               g

"Well, this test case looks kinda pointless now doesn't it?", 15
=> Well, this test case looks kinda pointless now doesn't it?

"This one looks a lot more interesting!", 1 => T o l a l m i
                                               h n o   o o n
                                               i e o   t r t
                                               s   k     e e
                                                   s       r
                                                           e
                                                           s
                                                           t
                                                           i
                                                           n
                                                           g
                                                           !
"Keep in mind, people: 'Punctuation! Does! Matter!'", 2
=> Ke  in mi  pe   'P      Do  Ma
    ep     nd  op   un      es  tt
            ,   le   ct      !   er
                 :    ua          !'
                       ti
                        on
                         !

Charcoal, 22 bytes

Ｆ⪪θ «↑⸿⸿ＦＬι«Ｍ¬﹪κＩη↙§ικ

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

  θ                      First input
 ⪪                      Split on spaces
Ｆ   «                   Loop over each word
     ↑⸿⸿                Move the cursor to the top row and two columns right*
          ι             Current word
         Ｌ              Length
        Ｆ  «            Loop over implicit range
               κ        Current index
                 η      Second input
                Ｉ       Cast to integer
              ﹪         Modulo
             ¬          Logical not
            Ｍ     ↙     Move that many characters down and left
                    ι   Current word
                     κ  Current index
                   §    Index into word and implicitly print

*More precisely, "move to the start of the next line twice, but as if the canvas was rotated." Edit: In between this challenge being set and this answer being accepted, Charcoal actually acquired a means of splitting a string into pairs of characters, reducing the code 16 bytes:
Ｆ⪪θ «↑⸿⸿Ｆ⪪ιＩη«κ↙ Try it online! Link is to verbose version of code. Explanation:

  θ                 First input
 ⪪                  Split on spaces
Ｆ   «               Loop over each word
     ↑⸿⸿            Move the cursor to the top row and two columns right
          ι         Current wordＩη
            η       Second input
           Ｉ        Cast to integer
         ⪪          Split into substrings of that length
        Ｆ    «      Loop over each substring
              κ     Print the substring
               ↙    Move the cursor down and left


Calculate the date of Easter Your function or program should take a year as input and return (or print) the date (in the Gregorian calendar) of that years Easter (not the Eastern Orthodox Easter). The date returned should be formatted according to ISO 8601, but with support for years greater than 9999 (such as 312013-04-05 or 20010130), and it only needs to work with years greater than or equal to 1583 (the year of the adoption of the Gregorian calendar), and years less than or equal to 5701583 (as that is when the sequence of Easter dates starts to repeat itself).

Examples:

e(5701583) = 5701583-04-10
e(2013)    = 2013-03-31
e(1583)    = 1583-04-10
e(3029)    = 30290322
e(1789)    = 17890412
e(1725)    = 17250401

The use of built-in functions for returning the date of easter is boring and therefore disallowed. Shortest answer (in characters) wins.

Resources:

http://en.wikipedia.org/wiki/Computus#Algorithms
http://web.archive.org/web/20150227133210/http://www.merlyn.demon.co.uk/estralgs.txt

Python 2 - 125 120 119 chars

This is Fors's answer shamelessly ported to Python.

y=input()
a=y/100*1483-y/400*2225+2613
b=(y%19*3510+a/25*319)/330%29
b=148-b-(y*5/4+a-b)%7
print(y*100+b/31)*100+b%31+1

Edit:  Changed last line from print"%d-0%d-%02d"%(y,b/31,b%31+1) to save 5 characters.  I would have loved to represent 10000 as 1e4, but that would produce floating point necessitating a call to int.

Edit2:
Thanks to Peter Taylor for showing how to get rid of that 10000 and save 1 character.


I'm Jelly of Python (Cops) What does "jelly" mean in the title?. Robber's thread
Jelly has an "Evaluate the argument as Python 3" atom, ŒV which takes a string as an argument as evaluates that string as Python 3 code: Try it online!.
It also has compressed strings, delimited with “...» that can compress any string containing printable ASCII (plus newlines), which can reduce the size of such programs. For example, a Hello, World! program using ŒV
Now, this is much longer that Jelly's normal Hello, World! program, by 9 bytes. But is this always the case?
Cops, you are to choose an code-golf challenge; write a Python solution to this challenge; compress that solution into Jelly and submit that as your answer.
The challenge you choose must meet these criteria:

It is open
It it unlocked
It has a net score of 5 or more
Its winning criteria is code-golf and only code-golf
All languages are open to compete in it (so no python-only challenges etc.)
It is not a tips question
It was posted before the 28th of March, 2021

This is a search query that should return (mostly) valid challenges. There's no way to filter challenges on the 4th and 5th criteria, so double check the challenges you choose from this search.
Your answer should contain:

A piece of Jelly code in the format “...»ŒV, where the ... may be any string of characters from Jelly's code page, aside from “”‘’«»
A link to the challenge you solved
The length of your "Python to Jelly" code, in bytes

Note that your program must follow any and all rules stated in the challenge you solve, including builtin bans, strict I/O formats and whatever else. To fully cover all edge cases: Your program must be able to be posted as a valid answer to the challenge. The only exception to this rule is that if the challenge scores in characters, you should instead score in bytes.
Jelly currently is written in Python 3.7.4 (Try it online!, the same version that TIO's Python 3 uses), so your program must work in that version of Python.
You may not edit the rules of the challenge you've chosen. You may not simply compress an existing Python answer to the challenge and submit that as your own work. However, you are allowed to attempt to modify existing users' code in order to improve your score, so long as you provide proper attribution to the original answerer. Alternative wording.
Your answer is "cracked" if a Robber finds a Jelly program shorter than your "Python to Jelly" program, that completes the same task. Note that a Robber's crack is valid even if it's of the same form (compressed Python eval'ed by Jelly), so long as it's shorter.
Your answer is "safe" if it is uncracked after 2 weeks. You must mark your answer as safe to be considered so. The shortest safe answer, in bytes, wins
This is, as far as we know, the most optimal Jelly compressor which might help you
Example submission
# 17 bytes, solves https://codegolf.stackexchange.com/questions/55422/hello-world

    “¤ṙẋȯ½Ġ<rŻ£ƤḤO»ŒV

[Try it online!][TIO-kmrxghbo]

[TIO-kmrxghbo]: https://tio.run/##ASsA1P9qZWxsef//4oCcwqThuZnhuovIr8K9xKA8csW7wqPGpOG4pE/Cu8WSVv// "Jelly – Try It Online"

21 bytes, solves Shortest code to throw SIGILL (safe)
“A{gœỴ¹⁻ėe⁾÷ỤḞḂ4ḷ$»ŒV

Try it online!
This decompresses to the following Python 3 code (which is 22 bytes long, only one byte longer than the compressed version):
import os
os.kill(0,4)

Try it online!
The basic idea is to pick a task that's completely out of scope for Jelly; in this case, we're interacting with the OS, something that Jelly doesn't have builtins for (short of ŒV). So this probably isn't solvable in Jelly without shelling out to Python, and hopefully isn't solvable any more tersely than this.
(In case you're wondering how it works: 4 is the signal number for SIGILL, and os.kill appears to just copy its arguments to the kill(2) system call literally. 0 means "send this signal to every process in my process group", which if the program is run from a shell, will raise a SIGILL in the Python/Jelly program and nothing else. On TIO, the program is being run from TIO's runner, so the SIGILL happens in the runner rather than in the program itself, but there's still a SIGILL being raised.)


Balanced Zero-One Encoding Task

Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple!

Rules

Your program/function must correctly handle any valid input string of length 8.
The results must have the same length for all inputs.
The results must be distinct for distinct inputs.
The results must be as short as possible.
The results must be zero-one balanced (have number of ones similar to that of zeros). They don't have to be equal (i.e. perfectly balanced), but your score will be penalized for that.

You don't have to provide a program/function that decodes your encoding.

Input and Output

You can decide to accept any set of 26 distinct printable ASCII characters instead of A-Z.
You can decide to output any pair of distinct printable ASCII characters instead of 0 and 1.
You are not allowed to output an integer instead of a bit string, since it may have leading zeros and it's unclear if you actually met the rule 2.
If you decide to deviate from the default (A-Z input and 01 output), you must specify the input/output character sets in your submission.

Scoring

Base score: Code size, or 1 if your program happens to be empty.
Penalties

Penalty for length: multiply 1.5 ** (encoded length - 42)
There is no bonus for being shorter; 42 is the minimal length for a perfectly balanced encoding of 8-length strings with alphabet size 26.
Penalty for being unbalanced: multiply 2 ** max(abs(ones - zeros) for every valid input of length 8), where ones and zeros are the counts of 1 and 0 in each output, respectively.
Your submission must either show a worst-case example (input/output) or theoretical explanation on the penalty value.

The lowest score wins.

Example Submission

Hypothetical esolang, 0 Bytes, Score 74733.8906

Here is a hypothetical esolang, where an empty program prints out all the ASCII codes of input's characters in binary.

For example, if you give AAAAAAAA as input, the program will print 1000001 8 times in a row, i.e. 10000011000001100000110000011000001100000110000011000001.

The input alphabet is chosen to be CEFGIJKLMNQRSTUVXYZabcdefh. This way, all of the chars are converted to seven digits in binary, and the zero-one counts differ only by one per char (they all have three 1's and four 0's or vice versa when converted to binary).

The output length is always 56, and the worst-case unbalance occurs on the inputs like CCCCCCCC, where zeros appear 8 more times than ones.

Therefore, the score of this submission is 1.5 ** (56 - 42) * 2 ** 8 == 74733.8906.

Jelly, 18 bytes
2Ḷx21Œ!Q
O_65ḅ26ị¢

Try it online!
-1 byte thanks to caird coinheringaahing
might remember to re-add the explanation since it was restructured for golfing


Tips for golfing in The Powder Toy Have fun with this one, The Powder Toy is a interesting challenge for golf, especially with filt logic.

The thing that makes TPT a challenge is the many many many many ways to approach a problem: Should I use Cellular Automaton rules, SWCH logic, Filt logic, subframe filt logic, and/or wall logic?

As such, a location for tips for TPT golfing would be quite helpful, so I made this question thread.

This thread will likely use a lot of abbreviations. A lot of them will be in-game elements, so searching them up on the Wiki will bring you a lot of information about them, like what they are.

Here are the most common ones you'll likely see in this thread, with their ingame description attached (and their full name), for people who don't want to go searching:

SPRK: Electricity. The basis of all electronics in TPT, travels along wires and other conductive elements.
FILT: Filter. Filter for photons, changes the color.
ARAY: Ray Emitter. Rays create points when they collide.
BTRY: Battery. Generates infinite electricity.
DRAY: Duplicator ray. Replicates a line of particles in front of it.
CRAY: Particle Ray Emitter. Creates a beam of particles set by its ctype, with a range set by tmp.
SWCH: Switch. Only conducts when switched on. (PSCN switches on, NSCN switches off)

List of all elements

Only use subframe logic when it's smaller

And, for more complex machines, it's often much smaller.

Subframe generally imposes the overhead of creating solid SPRK (about 3 pixels for most directions, an extra pixel compared to just a BTRY), FILT 'channels' (for fast BRAY transfer), and minimizing the amount of nonsubframe logic, even if it's smaller, due to it being many times (4x to 20x-30x slower!) slower.

Subframe logic is often good for complex operations (which is most of the challenges here), but for simpler ones, subframe logic is probably not optimal.


Palindromic palindrome generator Create a program, that converts input string to a palindrome starting with the input string. The program itself must be a palindrome.

For example input: neverod, print neveroddoreven. You should handle multi-word, multi-line inputs as well.

Dyalog APL, 6 4

⌽,,⌽

Try it here.

Other solutions:

⌽,⊢⊢,⌽
⌽⊢⊢,⊢⊢⌽

Explanation

They are just:

{⌽((,⍵),(⌽⍵))}
{⌽((,⍵)⊢((⊢⍵),(⌽⍵)))}
{(⌽⍵)⊢((⊢⍵),((⊢⍵)⊢(⌽⍵)))}

Monadic , and ⊢ does nothing on strings. Dyadic , is concatenation. Dyadic ⊢ returns its right operand. And ⌽ is obviously reversion.


Draw the flag of Bangladesh The flag of Bangladesh is very simple. It looks like below:

The flag will be in bottle green (#006a4e) and rectangular in size in the proportion of length to width of 10:6, with a red circle in near middle. The red circle (#f42a41) will have a radius of one-fifth of the length of the flag. This image will help you to understand the proportions properly:

In this Graphical output challenge, you need to draw the flag of Bangladesh like first image. Standard loopholes apply, Shortest code wins.
Resolution cannot be 0px, or echo style answers not supported.
Minimum resolution is 286*176

Wolfram Language (Mathematica), 23 bytes
¯\__(ツ)_/¯   of course there is a built in for this...
"BD"~CountryData~"Flag"

but you can also get the same result with...
Wolfram Language (Mathematica), 78 bytes
Graphics@{(c=RGBColor)@"#006a4e",{0,0}~Cuboid~{5,3},c@"#f42a41",Disk[{9,6}/4]}

-8 bytes {first code) thanks to @Makonede for "Bangladesh" to "BD"
-4 bytes (second code) thanks to @att


Manipulate "RELATIVE" using 8 OP-codes Rules:

Your program can be in any programming language.
Your program should not take any input.
Your program should transform the word "RELATIVE" into "STATIC". The word can at any stage only consist of uppercase letters A-Z.
Your program can only use 8 different operations.
The length, in number of letters, of the word cannot exceed 10 letters. If letters moves beyond that limit the letters will be deleted.
Your program must use all 8 operations before it can start reusing the operations again. All operations must be used the same amount of times.
The word must be "STATIC" at the end of the last chunk of 8 operations.
The very first OP used in the first chunk of OPs is never executed, so the program must output word "RELATIVE" of the first row.
The lines should be outputted in chunks of 8 lines, separated by a double linefeed between the chunks.
Your program should output the lines describing how it manipulates the string. Output each iteration of operations, one line for every applied operation in this form:

<iteration # in 6 numbers>: <operation> <current word after OP is executed>

The operations available:

INS     Move the current word 1 character to the right and
        replace first letter with 'A'.

DEL     Deletes the last letter in the word.

INC     Increase the second letter from the left with 1.
        Example: 'A' converts into 'B' or a 'Z' converts into 'A'.
        If the letter position is outside of the current word, nothing happens.

DEC     Decrease the fourth letter from the left with 4.
        Example: 'T' converts into 'P' or a 'C' converts into 'Y'.
        If the letter position is outside of the current word, nothing happens.

SWT     Swith letter number three from left with letter number two from right.
        If any of the letters are outside of current word, nothing happens.

INV     Invert the current word.

JMP     Invalidates the nextcoming OP.
        If this OP is used as OP #8 in a chunk, nothing happens.

REP     Execute the previous op again.
        If this OP is used as OP #1 in a chunk, nothing happens.

Example output (incomplete as the word is not "STATIC" at the end of the last chunk of 8 OPs):

000001: REP RELATIVE
000002: DEL RELATIV
000003: INS ARELATIV
000004: INC ASELATIV
000005: SWT ASILATEV
000006: INV VETALISA
000007: JMP VETALISA
000008: DEC VETALISA

000009: DEC VETWLISA
000010: JMP VETWLISA
000011: INS VETWLISA
000012: DEL VETWLIS
000013: REP VETWLI
000014: SWT VELWTI
000015: INC VFLWTI
000016: INV ITWLFV

The scoring is: (Sourcecode size in bytes) * (# OP-chunks). The program with the smallest score wins. The competition ends at 2014-12-31.

GolfScript, 338 323 307 300 280 * 15 10 = 2800
{:x;.2$<)65-x+26%65+[]++\@>+}:d;
{[{}{4-4d}{);}{2 1d}{'A'\+}{-1%}{2$~}{....2<\[-2=]+\3>-2<+\[2=]+\-1>+}]=}:L;
1:i;
'RDLATIVE':&;
'"S<(hR\50%!iS[SA*v7qpq&={=kkkk."Y+iEpi5-]'{32-}%95base`8/
{1:j;0L.@{48-:^j*L@;.&\~:&;i'0'6*\+-6>': ''JDDIIIRSMEENNNEWPCLCSVPT'^>8%' '&n^0>:j;i):i;}%n@;@;}/

Newlines added for clarity only, and can be removed. Pretty sure the output is correct.
Test online
It probably can be golfed further.

I managed to chop off an entire 5 chunks of op-codes (although I did have to rewrite most of the algorithm).
Output:
000001: INC RELATIVE
000002: DEL RELATIV
000003: REP RELATI
000004: INS ARELATI
000005: DEC AREHATI
000006: INV ITAHERA
000007: JMP ITAHERA
000008: SWT ITAHERA

000009: DEC ITADERA
000010: INS AITADERA
000011: INV AREDATIA
000012: DEL AREDATI
000013: INC ASEDATI
000014: JMP ASEDATI
000015: SWT ASEDATI
000016: REP ASEDATI

000017: DEC ASEZATI
000018: INV ITAZESA
000019: DEL ITAZES
000020: SWT ITEZAS
000021: INS AITEZAS
000022: JMP AITEZAS
000023: INC AITEZAS
000024: REP AITEZAS

000025: DEC AITAZAS
000026: REP AITWZAS
000027: INS AAITWZAS
000028: INC ABITWZAS
000029: INV SAZWTIBA
000030: DEL SAZWTIB
000031: JMP SAZWTIB
000032: SWT SAZWTIB

000033: DEC SAZSTIB
000034: DEL SAZSTI
000035: INV ITSZAS
000036: SWT ITAZSS
000037: INS AITAZSS
000038: REP AAITAZSS
000039: JMP AAITAZSS
000040: INC AAITAZSS

000041: DEL AAITAZS
000042: INV SZATIAA
000043: INC SAATIAA
000044: REP SBATIAA
000045: INS ASBATIAA
000046: JMP ASBATIAA
000047: DEC ASBATIAA
000048: SWT ASAATIBA

000049: SWT ASBATIAA
000050: INS AASBATIAA
000051: INV AAITABSAA
000052: INC ABITABSAA
000053: DEL ABITABSA
000054: JMP ABITABSA
000055: DEC ABITABSA
000056: REP ABITABSA

000057: INV ASBATIBA
000058: DEL ASBATIB
000059: INS AASBATIB
000060: DEC AASXATIB
000061: JMP AASXATIB
000062: INC AASXATIB
000063: SWT AAIXATSB
000064: REP AASXATIB

000065: INV BITAXSAA
000066: DEL BITAXSA
000067: REP BITAXS
000068: SWT BIXATS
000069: INS ABIXATS
000070: INC ACIXATS
000071: JMP ACIXATS
000072: DEC ACIXATS

000073: INS AACIXATS
000074: INC ABCIXATS
000075: INV STAXICBA
000076: DEL STAXICB
000077: REP STAXIC
000078: JMP STAXIC
000079: SWT STAXIC
000080: DEC STATIC


Substring Chainification Introduction

For this example, let's take the string Hello, World! and the array [3, 2, 3]. To find the substring chain, we go through the following process:

The first number of the array is 3, so we get the substring [0 - 3], which is Hel. After that, we remove the first 3 characters from the initial string, which leaves us with lo, World!.

The second number of the array is 2, so we get the substring [0 - 2] from our new string, which gives us lo. The leftover string becomes , World!.

The last number is a 3, which gives us , W. The substring chain is all of the substrings combined, which gives us:

['Hel', 'lo', ', W']

For a more visual example:

[3, 2, 3], 'Hello, World!'
3 -> Hel
2 ->    lo
3 ->      , W

The task

Given a non-empty string and a non-empty array only consisting of positive integers (> 0), output the substring chain. You may assume that the sum of all integers in the array does not exceed the length of the string.

You can also assume that the strings will never contain any newlines.

Test cases

Input: abcdefghijk, [2, 1, 3]
Output: ['ab', 'c', 'def']

Input: Code Golf, [4, 1]
Output: ['Code', ' ']

Input: Ayyy, [3]
Output: ['Ayy']

Input: lexicographically, [2, 2, 2, 7, 4]
Output: ['le', 'xi', 'co', 'graphic', 'ally']

This is code-golf, so the submission with the smallest number of bytes wins!

05AB1E, 1 byte

£

This is the substring(0,N) command.
Applied on a list this works repeatedly on the remainder on the string.

Try it online!


Find all unambiguous prefixes of a set of strings For this challenge, you must implement Ruby's Abbrev module in as little code as possible.

Challenge

The input will be whatever your language has as an array (array, list, sequence, etc.) of strings. You may write a function, or you may accept comma-separated words on STDIN.
You must then calculate the set of unambiguous prefixes for those strings. This means you must return a hash (or map, object, etc.) of abbreviations to their original strings.

A "prefix" is a substring of the original string starting at the beginning of the string. For example, "pref" is an prefix of the word "prefix."
An unambiguous prefix is one that can only mean one word. For example, if your input is car,cat, then ca is not an unambiguous prefix because it could mean either "car" or "cat."
The exception to this rule is that a word is always a prefix of itself. For example, if you have input such as car,carpet, car:car must be in your output.

You can then return the hash/map/object/etc. from your function (or do the equivalent in your language), or print it out to STDOUT in key:value pairs in the form of f:foo,fo:foo,.... (The key-value pairs may also be separated by whitespace if it makes your code shorter.)

Test cases

Input  code,golf,going
Output c:code,co:code,cod:code,code:code,gol:golf,golf:golf,goi:going,goin:going,going:going

Input  pie
Output p:pie,pi:pie,pie:pie

Input  pie,pier,pierre
Output pie:pie,pier:pier,pierr:pierre,pierre:pierre

Input  a,dog
Output a:a,d:dog,do:dog,dog:dog

Rules

The input will not contain duplicate elements.
Your output may be in any order; you don't have to sort it.
You may not use a built-in Abbrev module/function/thing like Ruby's.
This is code-golf, so the shortest code in bytes will win!

Python 2.7 - 146 141 bytes

l=raw_input().split(',')
for w in l:
 for a in range(len(w)):
    e=w[:a+1]
    if e==w or len(filter(lambda b:b.startswith(e),l))==1:print e+':'+w

Note that the indentation on lines 4 and 5 is not 4 spaces, that's a side effect of SE's markdown interpreter. That's a literal tab character, so only one byte.

This is not technically up to spec, but I'll change it if Doorknob clarifies. It uses newlines instead of commas to separate the output. For example:

$ python2 abbreviations.py <<< code,golf,golfing
c:code
co:code
cod:code
code:code
golf:golf
golfi:golfing
golfin:golfing
golfing:golfing

New: I was able to get rid of 5 characters by assigning the string that I'm checking to a variable e. This means that I only have to type e instead of w[:a] three times. It also means I save characters by doing e=w[:a+1] and changing ...range(1,len(w)+1) to range(len(w)).

Explanation:

l=raw_input().split(',') # Gets a line of input from stdin and splits it at every ',' to make a list
for w in l: # For each word in that list...

 for a in range(1,len(w)+1): # For each number a from 1 to the length of that word...

    if (w[:a]==w # w[:a] gets the string w up to the ath index. For example, 'aeiou'[:3] == 'aei'.
                 # We're testing every possible w[:a] to see if it's a unique abbreviation.
                 # However, a word is always its own abbreviation, so we hardcode that in by testing
                 # if w[:a] is the same as w.

or len(filter( # filter takes a function and an iterable as an argument, and returns a list of every
               # element of that iterable where that_function(that_element) returns a True-y value

lambda b:b.startswith(w[:a]),l) # We define an anonymous function that returns True for any string
                                # that begins with our current w[:a]. We filter for words that return
                                # True.

)==1): # If exactly one word returns True for this, it's a unique abbreviation!

     print w[:a]+':'+w # Print the abbreviation, a colon, and the full word.


Enumerate Derangements Given some positive integer \$n\$ generate all derangements of \$n\$ objects.
Details

A derangement is a permutation with no fixed point. (This means in every derangement number \$i\$ cannot be in the \$i\$-th entry).
The output should consist of derangements of the numbers \$(1,2,\ldots,n)\$ (or alternatively \$(0,1,2,\ldots,n-1)\$).
You can alternatively always print derangements of \$(n,n-1,\ldots,1)\$ (or \$(n-1,n-2,\ldots,1,0)\$ respectively) but you have to specify so.
The output has to be deterministic, that is whenever the program is called with some given \$n\$ as input, the output should be the same (which includes that the order of the derangements must remain the same), and the complete output must be done within a finite amount of time every time (it is not sufficient to do so with probability 1).
You can assume that \$ n \geqslant  2\$
For some given \$n\$ you can either generate all derangements or alternatively you can take another integer \$k\$ that serves as index and print the \$k\$-th derangement (in the order you chose).

Examples
Note that the order of the derangements does not have to be the same as listed here:
n=2: (2,1)
n=3: (2,3,1),(3,1,2)
n=4: (2,1,4,3),(2,3,4,1),(2,4,1,3), (3,1,4,2),(3,4,1,2),(3,4,2,1), (4,1,2,3),(4,3,1,2),(4,3,2,1)

OEIS A000166 counts the number of derangements.

Jelly, 6 bytes

Œ!=ÐṂR

A monadic Link accepting a positive integer which yields a list of lists of integers.

Try it online!

How?

Œ!=ÐṂR - Link: integer, n
Œ!     - all permutations of (implicit range of [1..n])
     R - range of [1..n]
   ÐṂ  - filter keep those which are minimal by:
  =    -   equals? (vectorises)
       -   ... i.e. keep only those permutations that evaluate as [0,0,0,...,0]


RTA (Reverse-Then-Add) root of a number The reverse-then-add (RTA) sequence is a sequence obtained by adding a number to its reverse, and repeating the process on the result. For eg.,

$$ 5 + 5 = 10 \Rightarrow 10 + 01 = 11 \Rightarrow 11 + 11 = 22 \Rightarrow 22 + 22 = 44 \Rightarrow\text{ }...  $$

Thus, 5's RTA sequence contains 10, 11, 22, 44, 88, 176, etc.

The RTA root of a number \$n\$ is the smallest number that is either equal to \$n\$ or gives raise to \$n\$ in its RTA sequence.

For eg., 44 is found in the RTA sequence of 5, 10, 11, 13, 22, 31, etc. Of these, 5 is the smallest, and hence RTAroot(44) = 5.

72 is not part of any number's RTA sequence, and so is considered its own RTA root.

Input is a positive integer in a range that your language can naturally handle.

Output is the RTA root of the given number, as defined above.

Test cases

Input
Output

44
5

72
72

132
3

143
49

1111
1

999
999

Related OEIS: A067031. The output will be a number from this sequence.

Perl 6 Raku, 45 44 39 bytes

{+(1...{$_∈($^a,{$_+.flip}...*>$_)})}

Try it online!
Explanation:
{                                   }  # Anonymous code block
 +(1...                            )     # Find the first integer
       {                          }      # Where
        $_∈                              # The input is an element of
           (              ...    )         # A sequence defined by
            $^b,                           # The first element is the number we're checking
                {$_+.flip}                 # Each element is the previous element plus its reverse
                             *>$_          # The last element is larger than the input


Find all the coordinates on a path Given a 2D string as input, either as a string with newlines or a list of lines, output the coordinates (x, y) of all the hashes (#) in the list.  The input will only contain hashes and spaces. (and newlines, if you choose to take input as a 2D string)

If there are no hashes, you can output anything.

Output should be unambiguous as to which numbers are paired with which.

Example:

##

Should output:

(0,0), (1,0)

That assumes 0-based indexing, starting from the top left. You may start from any corner, use 0 or 1-based indexing, and/or output y first. (e.g. in the form y,x).

More test cases (again, all using 0-based top-left (x, y) indexing):

    #
#####
#

(4, 0), (0, 1), (1, 1), (2, 1), (3, 1), (4, 1), (0, 2)

# ###
### #

(0, 0), (2, 0), (3, 0), (4, 0), (0, 1), (1, 1), (2, 1), (4, 1)

Note that these test cases all list by rows, not by following the path.

You may assume the hashes will form a continuous trail, i.e. # # will never be the input. (probably won't matter, but in case somebody wants to regex this)

You also can output the coordinates in any order you want, i.e. vertical columns, horizontal rows, or just an unsorted list.

Slip, 2 + 1 = 3 bytes
+1 byte for the p flag. Code:
`#

Explanation:
The p-flag returns the position of each occurence of the following:
`#      // The character '#'

Try it here!


Tips for golfing in tinylisp tinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can be found here. It features a small amount of builtins, which can be used to create practically anything.

There is a repository for the "official" tinylisp interpreter/documentation here, and it is available to try online here.

What tips do you have for golfing (creating the shortest program possible) in tinylisp? This question is looking for tips to golf specifically in tinylisp, not general tips that can be applied to any language.

Use lambdas instead of full functions

To save a few bytes, you can make your answer a lambda instead of a full function:

Predecessor function:
(q (
  (n)
  (s n 1)))

Golfed:
(q((n)(s n 1)))

This is only useful if the function doesn't recurse.


The hourglass challenge The Hourglass

This hourglass has 60 "sands of time", and it completely fills each chamber. The clock is 19 characters wide and 13 characters in height. Each chamber has 5 rows of sand and there is a row in the centre that can hold 1 sand. The top row can hold 17 sands, the next one 15 and so on (see below). Sands fall in to the bottom chamber at the rate of one sand per second.

       START                     3 SECONDS LATER               38 SECONDS LATER

███████████████████            ███████████████████            ███████████████████
█.................█   17       █..............   █   14       █                 █    0
██...............██   15       ██...............██   15       ██               ██    0
███.............███   13       ███.............███   13       ███.......      ███    7
█████.........█████   09       █████.........█████   09       █████.........█████   09
███████.....███████   05       ███████.....███████   05       ███████.....███████   05
█████████.█████████   01       █████████.█████████   01       █████████.█████████   01
███████     ███████            ███████  .  ███████            ███████  .  ███████
█████         █████            █████    .    █████            █████    .    █████
███             ███            ███      .      ███            ███....         ███
██               ██            ██               ██            ██...............██
█                 █            █                 █            █.................█
███████████████████            ███████████████████            ███████████████████

The Challenge

Display the hourglass (no numbers or headings are required) after a certain period of time (0 ≤ t ≤ 60).

Coding Rules

The hourglass should look exactly as shown here. You may replace the █ character and/or the . character with whatever you like to fit your language (Unicode, ASCII compatibility issues).
The input should be a number such as 45 or 7. Display the clock after these many seconds.
The output can either be displayed or saved to a file. No extra text or labels as shown above are required - just the hourglass is all we need.
If the user enters t > 60, you don't have to handle the error.

Points

Shortest code wins.

JavaScript (ES6), 203  208 233 270 256 characters
Edit Revised using a loop instead of a sequence of calls.
Edit Added top and bottom row that were missing.
A function returning the output. Run the snippet in Firefox to test.

f=w=>[h='█'[R='repeat'](19),...[17,15,13,9,5,1,5,9,13,15,17].map((d,i)=>(t=i>5?-v:v,v-=i<5?d:1-d,e=' '[R](d/2),b='█'[R](10-d/2),b+('.'[R](t<d&&d-t)+e+' .'[i>4&w>i-6&t>=d|0]+e).slice(0,d)+b),v=w),h].join`
`

// Less golfed
F=
w=>[h='█'.repeat(19),
    ... [17, 15, 13, 9, 5, 1, 5, 9, 13, 15, 17].map(
     (d,i) => (
       t = i>5 ? -v : v,
       v -= i<5 ? d : 1-d,
       e = ' '.repeat(d / 2),
       b = '█'.repeat(10 - d / 2),
       b +
        ('.'.repeat(t < d && d - t)
         + e + ' .'[i > 4 & w > i-6 & t >= d | 0]
         + e).slice(0,d)
       + b
     ), v = w
    ),
    h].join('\n')

// TEST

O.innerHTML=f(+I.value)

function tick(d) {
  var i=+I.value+d
  I.value=i
  O.innerHTML=f(i)
}

var int=0;

function auto()
{
  function go()
  {
    var t = I.value;
    O.innerHTML=f(++t)
    if (t>70)t=0;
    I.value = t;
  }
  if (A.checked && !int)
  {
    int = setInterval(go, 200);
  }
  else if (!A.checked && int)
  {
    clearInterval(int);
    int = 0;
  }
}
input[type=text] { width: 3em }
<button onclick='tick(-1)'>-</button>
<input type=text id=I value=0 onchange='tick(0)' >
<button onclick='tick(1)'>+</button>
<input type=checkbox id=A onclick='auto()'>Fly time
<pre id=O><pre>


Computing a specific coefficient in a product of polynomials Generator functions

This gives the context for why this challenge came to life. Feel free to ignore.

Generator functions are a nice way of encoding the solution to a problem of combinatorics. You just write some polynomials, multiply them and then your solution is the coefficient of one of the terms.

For example, how many bouquets of 10 flowers can you make if you want to use 3 or more dandelions, really want to use an even number of lilies and cannot afford more than 5 roses? Easy, just find the coefficient of x^10 in

$$(x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^{10})\times(1 + x^2 + x^4 + x^6 + x^8 + x^{10})\times(1 + x + x^2 + x^3 + x^4 + x^5)$$

Task

Compute a specific coefficient from a product of polynomials.

Example

If k = 3 and the product given is "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" then we have

$$(1 + 3x + 5x^2)(5 + 3x + 2x^2) = (5 + 3x + 2x^2) + (15x + 9x^2 + 6x^3) + (25x^2 + 15x^3 + 10x^4) = 5 + 18x + 36x^2 + 21x^3 + 10x^4$$

And because k = 3 we get 21.

Input

You receive an integer k and several polynomials. k is always a non-negative integer, and so are the coefficients and the exponents in the input polynomials.

k may be larger than the combined degree of all the input polynomials.

The input polynomials can be in any sensible format. A few suggestions come to mind:

A string, like "(1 + 3x + 5x^2)(5 + 3x + 2x^2)"
A list of strings, like ["1 + 3x + 5x^2", "5 + 3x + 2x^2"]
A list of lists of coefficients where index encodes exponent, like [[1, 3, 5], [5, 3, 2]]
A list of lists of (coefficient, exponent) pairs, like [[(1, 0), (3, 1), (5, 2)], [(5, 0), (3, 1), (2, 2)]]

An input format must be sensible AND completely unambiguous over the input space.

Test cases

0, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 5
1, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 18
2, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 36
3, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 21
4, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 10
5, "(1 + 3x + 5x^2)(5 + 3x + 2x^2)" -> 0
6, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 8
7, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 0
8, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 32
9, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 0
17, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 0
18, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 160
19, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 0
20, "(1 + 2x^2 + 4x^4)(2x^2 + 4x^4 + 8x^8)(4x^4 + 8x^8 + 16x^16)" -> 384

J, 21 19 18 bytes

{ ::0[:+//.@(*/)/>

Try it online!

-1 byte thanks to FrownyFrog

J has a nice geometric idiom for multiplying polynomials, which we
represent as lists of coefficients, with explicit zeroes where needed:

+//.@(*/)

Let's see how this works using the example:

1 3 5 +//.@(*/) 5 3 2

First it creates a multiplication table */:

 5  3  2
15  9  6
25 15 10

And @: then it computes the sums along each diagonal +//. using the Oblique /. adverb:

This works because moving down a diagonal is equivalent to decrementing the
power of one x while incrementing the power of another, meaning that the
numbers along a diagonal represent all the components of some a factor x^n
for some n.

The rest of the solution is just mechanics for the problem as stated:

{ ::0[: <polynomial idiom> />

Since we can have an arbitrary number of polynomials, we represent them as a list of boxes (each box containing one polynomial) and take that as the right arg.  The left arg is the index we want.

Now { ::0 ... is a dyadic hook asking for the index specified by the left arg, after transforming the right arg by everything in ....  And, if you can't find the index, return 0 ::0.

Finally [: <polynomial idiom> /> says to first unbox > the right arg lists, filling any missing coefficients with 0.  Then reduce / that list using the polynomial multiplication idiom.


Output integer given a digital clock style input Input

    _  _     _  _  _  _  _  _
  | _| _||_||_ |_   ||_||_|| |
  ||_  _|  | _||_|  ||_| _||_|

output

1234567890

Rules

Code golf - shortest code wins.

Input will be given as a 3-line string with each line separated by a newline, or as 3 separate strings. Each line is guaranteed to be a multiple of 3 characters long with no additional whitespace, and all lines will be the same length.

Each digit is represented as a 3x3 block of characters as above. Note that the 1 digit has two leading spaces in order to fill the 3x3 block.

JavaScript (ES6),  105  104 bytes

Takes input as an array of 3 strings. Returns an array of digit characters.

a=>a.map(s=>s.match(/.../g).map(([a,b,c],n)=>'3789465021'[(o[n]=~~o[n]+[++a|7*++b^44*++c])%13]),o=[])[2]

Try it online!

How?

Finding a concise way to process the input

A common trick to turn an input string into an identifier is to use parseInt(). But it only works with alphanumeric strings and is therefore pointless here. Other than that, JS is not very good at processing ASCII codes in few bytes, so we'd better find another trick.

We can notice that each digit in this font can still be uniquely identified if we replace each character with a binary value: \$1\$ for space, \$0\$ for not space:

  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9
-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
  _  |     |  _  |  _  |     |  _  |  _  |  _  |  _  |  _
 | | |   | |  _| |  _| | |_| | |_  | |_  |   | | |_| | |_|
 |_| |   | | |_  |  _| |   | |  _| | |_| |   | | |_| |  _|
-----+-----+-----+-----+-----+-----+-----+-----+-----+-----
 101 | 111 | 101 | 101 | 111 | 101 | 101 | 101 | 101 | 101
 010 | 110 | 100 | 100 | 000 | 001 | 001 | 110 | 000 | 000
 000 | 110 | 001 | 100 | 110 | 100 | 000 | 110 | 000 | 100

That looks like a good golfing start: it means that we can abuse the fact that a space is coerced to \$0\$ and can be turned into a \$1\$ by applying the pre-increment operator to it, while it will result in NaN for the other characters.

Hence the idea to implement something along these lines:

s.match(/.../g)        // split each line into groups of 3 characters
.map(([a, b, c], n) => // for each group (a, b, c) of characters at position n:
  ???                  //   do some bitwise magic with ++a, ++b and ++c
                       //   and use it to update an identifier for the n-th digit
)                      // end of map()

Bitwise magic

After some experiments and brute-forcing, it turned out that a pretty short and efficient formula is:

o[n] = ~~o[n] + [++a | 7 * ++b ^ 44 * ++c]

Step-by-step example:

The 1st line of a "0" is " _ ". Therefore, we have ++a -> 1, ++b -> NaN and ++c -> 1.

So, ++a | 7 * ++b ^ 44 * ++c evaluates to 1 | 7 * NaN ^ 44 * 1, which is \$45\$.

Because o[n] is initially undefined, ~~o[n] evaluates to \$0\$. And because \$45\$ is coerced to a string, o[n] is updated to "045".
The 2nd line of a "0" is "| |". This time, we have ++a -> NaN, ++b -> 1 and ++c -> NaN. The bitwise expression evaluates to \$7\$ and o[n] is updated to "457". (Note that the leading 0 is thrown away by ~~o[n].)
The 3rd line of a "0" is "|_|", leading to ++a -> NaN, ++b -> NaN and ++c -> NaN. The bitwise expression evaluates to \$0\$ and the final value of o[n] is "4570".

Minimal perfect hash function

Of course, the parameters of the bitwise formula were not chosen at random (well ... at least no completely): by coercing the final identifier of a digit back to an integer and applying a modulo \$13\$, we get a unique value in \$[0..9]\$.

The following table summarizes the results for all digits:

  digit |   0   |   1   |   2   |   3   |   4   |   5   |   6   |   7   |   8   |   9
--------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------
     ID |  4570 |  4377 | 45144 |  4511 |  4307 | 45441 | 45440 |  4577 |  4500 |  4501
--------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------
 mod 13 |   7   |   9   |   8   |   0   |   4   |   6   |   5   |   1   |   2   |   3

Hence the 10-byte lookup table: '3789465021'.


Divisor Rich and Poor Numbers Introduction
In the strange world of integer numbers, divisors are like assets and
they use to call "rich" the numbers having more divisors than their reversal, while they call "poor" the ones having less divisors than their reversal.
For example, the number \$2401\$ has five divisors : \$1,7,49,343,2401\$, while its reversal, \$1042\$, has only four : \$1,2,521,1042\$.
So \$2401\$ is called a rich number, while \$1042\$ a poor number.
Given this definition, we can create the following two integer sequences of rich and poor numbers :
(here we list the first 25 elements of the sequences)

 Index | Poor | Rich
-------|------|-------
     1 |   19 |   10
     2 |   21 |   12
     3 |   23 |   14
     4 |   25 |   16
     5 |   27 |   18
     6 |   29 |   20
     7 |   41 |   28
     8 |   43 |   30
     9 |   45 |   32
    10 |   46 |   34
    11 |   47 |   35
    12 |   48 |   36
    13 |   49 |   38
    14 |   53 |   40
    15 |   57 |   50
    16 |   59 |   52
    17 |   61 |   54
    18 |   63 |   56
    19 |   65 |   60
    20 |   67 |   64
    21 |   69 |   68
    22 |   81 |   70
    23 |   82 |   72
    24 |   83 |   74
    25 |   86 |   75
   ... |  ... |  ...

Notes :

as "reversal" of a number we mean its digital reverse, i.e. having its digits in base-10 reversed. This means that numbers ending with one or more zeros will have a "shorter" reversal : e.g. the reversal of 1900 is 0091 hence 91
we intentionally exclude the integer numbers having the same number of divisors as their reversal i.e. the ones belonging to OEIS:A062895

Challenge
Considering the two sequences defined above, your task is to write a program or function that, given an integer n (you can choose 0 or 1-indexed), returns the n-th poor and n-th rich number.
Input

An integer number (>= 0 if 0-indexed or >= 1 if 1-indexed)

Output

2-integers, one for the poor sequence and one for the rich sequence, in the order you prefer as long as it is consistent

Examples :
INPUT          |   OUTPUT
----------------------------------
n (1-indexed)  |   poor    rich
----------------------------------
1              |   19      10
18             |   63      56
44             |   213     112
95             |   298     208
4542           |   16803   10282
11866          |   36923   25272
17128          |   48453   36466
22867          |   61431   51794
35842          |   99998   81888

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

05AB1E, 16 bytes

∞.¡ÂÑgsÑg.S}¦ζsè

Try it online!

0-indexed [rich,poor]:

∞                # Push infinite list.
 .¡        }     # Split into three lists by...
   ÂÑgsÑg.S      # 1 if rich, 0 if nothing, -1 if poor.
            ¦ζ   # Remove list of nothings, and zip rich/poor together.
              sè # Grab nth element.

Maybe someone can explain why this version doesn't seem to terminate, but when I click "cancel execution" on TIO it finishes with the correct answer, or if you wait 60 seconds you get the correct answer. For a version that terminates "correctly" you could use: T+nL.¡ÂÑgsÑg.S}¦ζsè +3 bytes


Unshorten Google Links Challenge

Given a valid goo.gl shortened link, output the original URL.

Example

goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl if you only want the end of the URL. A slash at the end is optional for input and output. So, your input will end up matching the regex (https?://)?(www\.)?(goo\.gl/)?[A-Za-z0-9]+/?. For the output, you can choose whether or not to output https?://, whether or not to output www., and whether or not to output a trailing slash. However, you must be consistent with your I/O formatting.

I will say that you do not have to be consistent with https vs. http for output (but you must be consistent for input), as long as you are consistent with whether or not you include the whole https?:// part.

Test Cases

These are written with no https://, no www., no trailing slash in the input; yes https://, no www., and yes trailing slash in the output.

input -> output
goo.gl/HaE8Au -> https://codegolf.stackexchange.com/
goo.gl/IfZMwe -> https://stackoverflow.com/
goo.gl/JUdmxL -> https://chat.stackexchange.com/rooms/240/the-nineteenth-byte

Assumptions

You may assume that the shortened link will not point to another shortened link and that the destination site will return a status code of 2xx or 4xx (no redirections).

You can go here and enter a URL to apply the inverse operation of this: https://goo.gl/

CJam, 7 bytes

lg'"/5=

Test run

$ alias cjam
alias cjam='java -jar ~/.local/share/cjam-0.6.5.jar'
$ cjam unshorten.cjam <<< goo.gl/HaE8Au; echo
https://codegolf.stackexchange.com/
$ cjam unshorten.cjam <<< goo.gl/IfZMwe; echo
https://stackoverflow.com/
$ cjam unshorten.cjam <<< goo.gl/JUdmxL; echo
https://chat.stackexchange.com/rooms/240/the-nineteenth-byte

How it works

lg reads a line from STDIN and makes a GET request to that URL. The shortened URL issues a 301 redirect, which CJam doesn't follow. For the first test case, this pushes

<TITLE>Moved Permanently</TITLE>

Moved Permanently

The document has moved here.

on the stack. Finally, '"/ splits at double quotes, and 5= gets the sixth chunk. Output is implicit.


Can square tree rings be generated from primes? Apparently yes! In three easy steps.
Step 1
Let f(n) denote the prime-counting function (number of primes less than or equal to n).
Define the integer sequence s(n) as follows. For each positive integer n,

Initiallize t to n.
As long as t is neither prime nor 1, replace t by f(t) and iterate.
The number of iterations is s(n).

The iterative process is guaranteed to end because f(n) < n for all n.
Consider for example n=25. We initiallize t = 25. Since this is not a prime nor 1, we compute f(25), which is 9. This becomes the new value for t. This is not a prime nor 1, so we continue: f(9) is 4. We continue again: f(4) is 2. Since this is a prime we stop here. We have done 3 iterations (from 25 to 9, then to 4, then to 2). Thus s(25) is 3.
The first 40 terms of the sequence are as follows. The sequence is not in OEIS.
0 0 0 1 0 1 0 2 2 2 0 1 0 2 2 2 0 1 0 3 3 3 0 3 3 3 3 3 0 3 0 1 1 1 1 1 0 2 2 2

Step 2
Given an odd positive integer N, build an N×N array (matrix) by winding the finite sequence s(1), s(2), ..., s(N2) to form a square outward spiral. For example, given N = 5 the spiral is
s(21)   s(22)   s(23)   s(24)   s(25)
s(20)   s(7)    s(8)    s(9)    s(10)
s(19)   s(6)    s(1)    s(2)    s(11)
s(18)   s(5)    s(4)    s(3)    s(12)
s(17)   s(16)   s(15)   s(14)   s(13)

or, substituting the values,
 3       3       0       3       3
 3       0       2       2       2
 0       1       0       0       0
 1       0       1       0       1
 0       2       2       2       0

Step 3
Represent the N×N array as an image with a grey colour map, or with some other colour map of your taste. The map should be gradual, so that the order of numbers corresponds to some visually obvious order of the colours. The test cases below show some example colour maps.
The challenge
Given an odd positive integer N, produce the image described above.
Rules

The spiral must be outward, but can be clockwise or counter-clockwise, and can start moving right (as in the above example), left, down or up.

The scales of the horizontal and vertical axes need not be the same. Also axis labels, colorbar and similar elements are optional. As long as the spiral can be clearly seen, the image is valid.

Images can be output by any of the standard means. In particular, the image may be displayed on screen, or a graphics file may be produced, or an array of RGB values may be output. If outputting a file or an array, please post an example of what it looks like when displayed.

Input means and format are flexible as usual. A program or a function can be provided. Standard loopholes are forbidden.

Shortest code in bytes wins.

Test cases
The following images (click for full resolution) correspond to several values of N. A clock-wise, rightward-first spiral is used, as in the example above. The images also illustrate several valid colour maps.

N = 301:

N = 501:

N = 701:

MATLAB - 197 185 178 175 184 163 162 148 142 140 bytes

Shaved 12 bytes, thanks to Ander and Andras, and lots thanks to Luis for putting the two together. Shaved 16 thanks to Remco, 6 thanks to flawr

function F(n)
p=@primes
s=@isprime
for a=2:n^2
c=0
if~s(a)
b=nnz(p(a))
while~s(b)
b=nnz(p(b))
c=c+1
end
end
d(a)=c
end
imagesc(d(spiral(n)))

Result for N=301 (F(301)):

Explanation:

function F(n)
p=@primes % Handle
s=@isprime % Handle
for a=2:n^2 % Loop over all numbers
    c=0 % Set initial count
    if~s(a) % If not a prime
        b=nnz(p(a)) % Count primes
        while~s(b) % Stop if b is a prime. Since the code starts at 2, it never reaches 1 anyway
            b=nnz(p(b)) % count again
            c=c+1 % increase count
        end
    end
    d(a)=c % store count
end
imagesc(d(spiral(n))) % plot