Cramming The Gramming - Twelve Task Tweet



Your boss just emailed you a list of 12 programming tasks he needs done as soon as possible. The tasks are simple enough but your boss, being a young software tycoon suckled by social networking, insists that your solutions be able to fit within a single Twitter tweet.

This means that you only have 140 bytes worth of code to solve all the tasks, an average of 11.67 bytes per task. (Yes, Twitter counts characters but your boss specifically said bytes.)

You realize there's no way to solve all 12 tasks in 140 bytes but you suspect that your boss won't actually test all your solutions. So you proceed to solve as many tasks as you can, completely skipping some of them. Your mindset is that it doesn't matter which subset of the tasks you complete, it only matters that the subset is as large as possible.

How many tasks can you complete?


Write up to 12 different programs, each of which accurately solves one of the 12 tasks listed below. The cumulative sum of the lengths of these programs may not exceed 140 bytes

Alternatively, you may write a single program no greater than 140 bytes long that takes an integer from 1 to 12 and (ideally) proceeds to solve the corresponding task, taking more input as necessary. Not all the tasks need to work, but only the ones that do count towards your score. Tasks that don't work are allowed to error or do anything else.

In either case a "program" may in fact be a function that takes the input as arguments or prompts for it and prints or returns the output. So, for example, you might write a 140 byte function that looks like f(taskNumber, taskInput), or you might write separate code snippets for each task, some as functions and some as fully-fledged programs.

Other details:

  • All code must be written in the same language.

  • As usual, input should come from stdin, the command line, a function argument, or whatever is usual for your language. Output is printed to stdout or your language's closest alternative, or returned in an appropriate type.

  • A reasonable amount of input formatting is fine; e.g. quotes around strings or \n instead of actual newlines.

  • Output should be exactly what is called for with no extraneous formatting or whitespace. The exception is an optional single trailing newline.

  • Code that only runs in a REPL environment does not constitute a program or function.

  • You may not write multiple programs that solve multiple tasks. It's either one program that (ideally) solves all the tasks, or (ideally) 12 programs that each solve a single task.

  • Posting a task solution that you didn't write or only slightly modified is not allowed without giving attribution to the original author, and ideally getting permission too. If your answer primarily composes the shortest solutions from all the other answers then it should be a community wiki.


The submission that completes the most tasks is the winner. If two submissions tie, the one with the fewest bytes wins. If the byte counts are tied, the earlier submission wins. Community wiki answers are not allowed to win.

Be sure to tell us which tasks you solved, not just how many!

Handicap for non-golfers:

It's likely that this challenge will be dominated by golfing languages. Many languages may have trouble solving even one or two tasks within 140 bytes. Therefore you may submit a non-competitive answer where the limit is 3 tweets, i.e. 420 bytes. All the other rules remain the same.


Task 1 - Can Three Numbers Form A Triangle?

Take in three positive integers and output a truthy/falsy value indicating whether or not three lines with those lengths could form a triangle. You may not assume the numbers come in any particular order.

Truthy examples (one per line):

20 82 63
1 1 1
2 3 4
1 2 2

Falsy examples:

6 4 10
171 5 4
1 1 2
1 2 3

Task 2 - Closest To One Million

Given a string of exactly 7 decimal digits (0-9), rearrange them to get a number that is as close as possible to one million. That is, abs(1000000 - rearrangedNumber) should be minimized.

Print or return the resulting number as an integer, not a string (so there shouldn't be leading zeroes unless that's the norm for your language).

e.g. an input of 9034318 should result in 984331 (and not 1033489).

2893984 should become 2348899.

0001000 should become 1000000.

0000020 should become 200000.

Task 3 - Simple Keyboard Simulator

Take in a string of lowercase letters (a-z), spaces, and angle brackets <>. Read left to right, this string represents the keys that were pressed on a standard keyboard while an initially empty text editor was open. The letters and space correspond to their normal keys but < corresponds to the left arrow key and > to the right arrow key, both of which move the cursor when pressed.

< moves the cursor one character left, or does nothing if the cursor is at the start of the string.
> moves the cursor one character right, or does nothing if the cursor is at the end of the string.

Output the string that would be in the text editor once all the keys in the input string have been pressed. Outputting escape codes to move the cursor is not allowed.

There will always be at least one non–arrow key character in the input.

e.g. the input ui<<q>>ck <<<<<<the<<<<>>> >>>>>>>>brown x<o<f should yield the quick brown fox.

op<<l>>t<<<lam>>>>>>imi<<<><>>>zer<<<<<<<<<<<<<<<<<<>>><>m should give llammoptimizer.

e< <c<b<a should give abc e.

<<<>><><<><toast>><<>><><<>>< should give toast.

Task 4 - FILTHE Letters

In many fonts, 6 of the uppercase English alphabet letters consist entirely of horizontal and vertical lines: E, F, H, I, L, and T. We'll calls these the FILTHE letters.

Take in a string of uppercase letters (A-Z) and count the number of lines in the FILTHE letters, outputting the resulting integer.

E, F, H, I, L, and T have 4, 3, 3, 3, 2, and 2 lines respectively.

e.g. GEOBITS has 4 + 3 + 2 = 9 lines part of FILTHE letters (for .E..IT.), so the output should be 9.




Task 5 - Alex Recursive A.

Our moderator Alex A. has a fairly mysterious initial, "A".

Now I'm not certain, but I think the A. stands for .A xelA. And I'm also pretty sure that the .A there sneakily stands for Alex A..

Thus to get Alex's full name we must expand out the A.'s and .A's:

Alex A. -> Alex [A.] -> Alex [.A xelA] -> Alex .A xelA -> Alex [.A] xelA -> Alex [Alex A.] xelA -> Alex Alex A. xelA -> etc.

Have your program take in a non-negative integer and expand Alex A. that many times, outputting the resulting string.

0 becomes Alex A.,
1 becomes Alex .A xelA,
2 becomes Alex Alex A. xelA,
3 becomes Alex Alex .A xelA xelA,
4 becomes Alex Alex Alex A. xelA xelA,
5 becomes Alex Alex Alex .A xelA xelA xelA,
and so on.

(I made this because I felt bad for inadvertently leaving Alex out of my mod tribute challenge. :P)

Task 6 - Numpad Rotation

Take in an integer from 1 to 9 inclusive (you may take it as a string). Output the 3×3 square of digits


rotated in increments of 90° such that the input digit appears anywhere on the top row. When 5 is input any rotation is valid output since 5 cant be rotated to the top.

e.g. when 3 is input, both




are valid outputs.

For input 4, only


is valid output.

Task 7 - Splitting Digits Into Tens

Take in a nonempty string of decimal digits (0-9) and output a truthy value if it can be broken up into contiguous sections where all the digits in each section sum exactly to 10. If this is not possible, output a falsy value.

e.g. 19306128 can be split up like 19|3061|28, the sections all summing to 10 (1+9, 3+0+6+1, 2+8), so a truthy value should be output.

Truthy examples (one per line):


Falsy examples:


Task 8 - Square Clock

Take in a consistently sized multiline string.

Output 12 if the input is

 _ _
| | |
|_ _|

Output 3 if the input is

 _ _
| |_|
|_ _|

Output 6 if the input is

 _ _
| | |

Output 9 if the input is

 _ _
|_| |
|_ _|

There are no other input cases.

Task 9 - Bracket Art

Take in a 4 byte string containing one of each of the left brackets (, [, {, and < in any order.

Add the corresponding right brackets so the string is 8 bytes long and has a vertical line of symmetry. e.g. [<({ becomes [<({})>].

Then reverse every bracket in this string. e.g. [<({})>] becomes ]>)}{(<[.

Output the original 8 byte bracket string with the reversed version above and below on separate lines.

So the final output for input [<({ would be


Similarly, the output for <({[ should be


The input (<<[ is invalid because the { is missing and there is an extra <.

Task 10 - Perimiterize

Take in a rectangular grid of text (1×1 at smallest) made of .'s that represent empty space and X's that represent solid tiles. Cells beyond the grid bounds are considered empty. You may assume each of the 4 grid edge rows and columns will contain at least one X.

e.g. a valid input might be:


Output another rectangular grid of text where every empty cell that neighbors an X orthogonally or diagonally, including those outside the input grid, becomes o. So essentially a perimiter of o's is drawn around all the portions of solid tiles. The new grid should not be any larger than it has to be.

So the output of the example above would be:

Similarly, the output of input XXX..X.X should be


and outputting


would be invalid since the empty rightmost column is unnecessary.

You may use any 3 distinct printable ASCII characters in place of ., X, and o.

Task 11 - Sator Square

Output the Sator Square:


Any of the letters may be lowercase or uppercase, so


is also valid output.

There is no input.

Task 12 - Prime Tweet

Take no input but output a 140 byte printable ASCII string that contains at least one of each of the 95 printable ASCII characters. (So 45 characters will be duplicates.)

The sum of the character codes of all 140 bytes in this string must be a Sophie Germain prime, i.e. a prime number p such that 2p+1 is also prime. The character code for space is 32, 33 for !, 34 for ", and so on up to 126 for ~. The sum could be calculated in Python as sum(map(ord, myString)).

An example output is:

! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~d

The character code sum is the prime 12203 whose corresponding safe prime is 24407.

Calvin's Hobbies

Posted 2015-10-12T08:34:57.067

Reputation: 84 000

7I will be impressed if anyone actually manages to solve everything in less than 140 bytes, even with CJam/Pyth – Fatalize – 2015-10-12T08:46:03.410

9I am honored to be in .a ni eb ot deronoh ma I... challenge of yours. :P – Alex A. – 2015-10-12T19:04:02.323

are tasks allowed to end with an error after the result is printed to the output? – torcado – 2015-10-12T20:57:15.887

1How should we count bytes from imports? Let's say I write 5 functions where 2 need the same module (e.g. import Math), is this counted twice? – nimi – 2015-10-12T21:15:48.960

@nimi It would be counted twice unfortunately. Though you can write one program for all the tasks and thus only need one import. – Calvin's Hobbies – 2015-10-12T21:22:09.223

@torcado The default is yes. (Calvin's Hobbies, you should override that explicitly if that is your intention, although that might be a bit late now... one of my solutions actually did terminate with an error before I golfed it further.)

– Martin Ender – 2015-10-13T07:21:59.917

@MartinBüttner Well fine, let's stick to the default. – Calvin's Hobbies – 2015-10-13T07:53:17.117

Are submissions allowed to count flags as extra bytes, per usual policy? I ask because Pip frequently uses flags for output formatting. – DLosc – 2015-10-23T22:14:33.023

Mathematica string manipulation is expensive... – LegionMammal978 – 2015-10-24T12:20:07.817

After this bounty expires, I will offer another 400-point bounty for the shortest combined solution in TI-BASIC in another week. – lirtosiast – 2015-10-25T05:47:18.957

@ThomasKwa Do you mean task 3? You can assume there's at least 1 non <>. – Calvin's Hobbies – 2015-10-26T02:27:41.550

Yes, I meant 3. – lirtosiast – 2015-10-26T02:29:28.623

In TI-BASIC, the newline character 0x3F can't actually be typed in on a default calculator. Can we still (a) take input from the Ans variable (command line-ish, can be entered using a hex editor) or (b) take input from Input? In the first case a hex editor can be used to pass the string. – lirtosiast – 2015-10-26T16:52:56.990

@ThomasKwa Both sound alright since TI-BASIC is a special case. – Calvin's Hobbies – 2015-10-26T18:21:09.950

As @jacobly pointed out, it's impossible to get a quote character in a string in TI-BASIC without taking input. Is it acceptable to assume that the Ans variable contains a quote character (which is what @Weregoose did)? – lirtosiast – 2015-10-27T19:14:09.500

@ThomasKwa That sounds fine for TI-BASIC. – Calvin's Hobbies – 2015-10-27T19:25:44.300

In Task 12, do we need to display all of the tokens corresponding to the ASCII characters, or can we just display tokens like sin( counting as s, i, n, and (? – lirtosiast – 2015-10-28T16:07:57.380

@ThomasKwa Those can count. – Calvin's Hobbies – 2015-10-28T17:20:51.243

@pppery I believe that consensus covers new challenges, not existing ones. I see no need to close this challenge based on that decision – caird coinheringaahing – 2019-10-20T12:53:19.350

@cairdcoinheringaahing So, why was First code golf decathlon closed and locked if the consensus I linked to only applies to challenges that postdate it.

– pppery – 2019-10-20T13:48:36.150


I'm voting to close this question as off-topic because it's a multi-part challenge with insufficient interaction between the parts

– pppery – 2020-01-22T01:39:15.133



Pyth, 9 tasks in 136 bytes

Task 1: 7 bytes



Sort in descending order (_SQ), fold subtraction over them (a-b-c), check if the result is negative.

Task 2: 14 bytes



Form all string permutations (.pz), sort them (o) based on the absolute value of the difference (.a-) between the number (sN) and one million (^T6).

Take the first such string (h), and convert it to a num. (s).

Task 4: 19 bytes



Replicate "EFHILT" three times (*3), remove the trailing LT (PP), and add an E (+\E). Map each letter in the input to its appearance count in that string. (/L ... z). Sum. (s).

Task 5: 16 bytes

u+"Alex "_GhQ".A


Starting with "A.", reverse and add an "Alex " to the start, input + 1 times.

Task 7: 13 bytes


Convert the input string into a list of 1-digit numbers (sMz). Form all partitions (./). Sum each element of each partition (sMM). Remove all 10s from each sublist (-RT). Check if this emptied out any of the sublists by checking if the empty list is in the overall list (}Y).

Task 8: 11 bytes



Modulo magic. Convert to number (CQ), take it mod 199 (C\Ç = 199), and take that mod 4. Then add 1, and multiply by 3.

Task 9: 21 bytes



First, we generate the first line, which consists of the input translated to the mirror characters (Xz"<{[()]}>")), followed by the reversed input (+ ... _z), and save it to J. Then print that line, its reverse, and that line again (J_JJ).

Task 11: 22 bytes



Just print a string and its reversal, but don't duplicate the center N.

Task 12: 13 bytes



There is an invisble DEL (7F) character at the end of the code.

This prints

abcdefghijklmnopqrstuvwxyz3333333333333333333 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

which has character sum 11321. It consists of G, the alphabet, 19 3s, and all of the printable ASCII characters.


Posted 2015-10-12T08:34:57.067

Reputation: 39 268


CJam, 8 9 tasks in 140 bytes

First off, here is a script you can use to sort your solutions and tell you which ones will fit into the tweet:


Just paste your 12 solutions into the input, one on each line. Run it here. The first column is the task number, the second its size (in characters - you'll have to fix this yourself if that is different from the byte count), the third the cumulative size. The programs which fit into the tweet are separated from the rest with a line of ===.

For me, the output looks like this:

 1   7   7 q~$~\->
 8  10  17 qDbJ%5/)3*
12  12  29 ',32>_51>'d
 7  13  42 Aq{~-Ace|}/N&
 2  15  57 qe!{~1e6-z}$0=~
 4  19  76 q"FIHEELT"3*H<fe=:+
 5  20  96 ".A"q~){" xelA"+W%}*
 9  22 118 q_{_')>+)}%W%+_W%N@N3$
11  22 140 "SATOR\AREPO\TEN"_W%1>
 6  25 165 9,:)s3/zq~))3mdg*{W%z}*N*
 3  43 208 LLq{_'=-z({+}{'=>_)$\[{)@+\}{\(@\+}]=&}?}/\
10  45 253 0XW]_m*qN/{'.f+W%z}4*f{\~@m>fm>N*}(\{8f^.e>}/

So here are the tasks I can currently fit into the tweet.

Task 1 - Can Three Numbers Form A Triangle? - 8 7 bytes

Thanks to jimmy23013 for saving 1 byte.


Test suite.

Input is expected to be CJam-style list.

This is fairly straightforward: check if the largest side is shorter than the sum of the other two. Or equivalently, check that the shortest side is longer than the difference of the other two:

q~  e# Read and eval input.
$~  e# Sort the values and dump them on the stack.
\-  e# Subtract the middle value from largest.
>   e# Check if the smallest value is greater than that.

Task 2 - Closest To One Million - 15 bytes


Test suite.

Simple brute force:

q        e# Read input.
e!       e# Get all permutations.
{        e# Sort by...
  ~      e#   Evaluate the permutation to get its numerical value X.
  1e6-z  e#   abs(X - 1,000,000)
0=       e# Pick the first element (which minimises the difference)
~        e# Evaluate it to get rid of the leading zeroes.

Task 4 - FILTHE Letters - 21 19 bytes

Thanks to jimmy23013 for saving 2 bytes.


Test suite.

The idea is to create a string which contains each of the FILTHE letters once for each of their orthogonal lines. This is done via some funny string manipulation:

q          e# Read the input.
"FIHEELT"  e# Push this string. It first contains the 3-line letters, then the 2-line 
           e# letters, where we include 'E' twice to make it count for 4.
3*         e# Repeat 3 times: "FIHEELTFIHEELTFIHEELT"
H<         e# Truncate to 17 characters: "FIHEELTFIHEELTFIH". This is chosen such that
           e# it discards the third repetition of the 2-line letters.
fe=        e# For each character in the input, count its occurrences in this new string.
:+         e# Sum them all up.

Task 5 - Alex Recursive A. - 27 20 bytes

".A"q~){" xelA"+W%}*

Test suite.

Implemeting the substition of A. and .A directly is way too expensive. Instead, we notice that we only have to handle one case, if we reverse the string each time. Furthermore, prepending Alex (and a space) each time is equivalent to expanding the initial. We can save another byte by appending the reverse before reversing the string:

".A"        e# Start with ".A" (the -1st iteration if you like).
q~)         e# Read input, eval, increment (so the following block is run at least once.)
{           e# Repeat this block that many times...
  " xelA"+  e#   Append " xelA".
  W%        e#   Reverse the string.

Task 7 - Splitting Digits Into Tens - 18 16 13 bytes


Test suite. (With brackets around each output.)

Not exactly user friendly: the truthy value is a single newline, the falsy value is the empty string.

The basic idea is simple: add the digits to a running total which we reset whenever it hits exactly 10. The total must be zero at the end of the input. For a start it turns out to be shorter to the total at 10 and subtract the digits, resetting the total whenever we hit 0. However, we need to make sure that we don't return something truthy when the input is all zeroes. The shortest way I found to do that was to reset the total to the character with code point 10 (the linefeed), and then check at the end that we actually have that character on the stack, and not the number 10. This works, because both the integer zero and the character zero (the null byte) are falsy:

A     e# Push a 10, the initial running total.
q{    e# For each character in the input...
  ~-  e#   Evaluate the character to get the digit and subtract it from the total.
  Ac  e#   Push a linefeed character.
  e|  e#   Logical OR of the running total and the linefeed character (using
      e#   short-circuiting).
N&    e# Take the set intersection with the string containing a linefeed character.
      e# If the total is still a number of any character other than the linefeed,
      e# this will yield an empty string. Otherwise, the string will remain unchanged
      e# and the linefeed will be printed.

Task 8 - Square Clock - 10 bytes


Test suite.

This is just some pretty random modulo magic on the character codes which happens to hash to the correct values. I'm fairly convinced that something shorter is possible, but it's the shortest I found (programmatically) for this kind of structure:

q   e# Read the input.
Db  e# Treat the character codes of the string as digits in base 13. This maps the
    e# four inputs to the values: 2023940117708546863
    e#                            2023940113755405840
    e#                            2023940781838850791
    e#                            2023940113755390292
J%  e# Take the result modulo 19. This gives [2, 5, 12, 18], respectively.
5/  e# Divide by 5 (rounding down). [0, 1, 2, 3], respectively.
)   e# Increment. [1, 2, 3, 4], respectively.
3*  e# Multiply by 3. [3, 6, 9, 12], respectively.

Task 9 - Bracket Art - 23 22 bytes

Thanks to Sp3000 for saving 1 byte.


Test suite.

Fairly straightforward. The mapping between the left and right brackets is done by adding 2 (or 1 for parentheses):

q_      e# Read input and duplicate.
{       e# Map this block onto each character...
  _')>  e#   Duplicate and check if it's not a parenthesis.
  +     e#   Add the result, leaving parentheses unchanged and incrementing the
        e#   other bracket types.
  )     e#   Increment again.
W%+     e# Reverse and add to the original, giving the middle line.
_W%     e# Duplicate and reverse, giving the first line.
N@      e# Push a linefeed, pull up the middle line.
N3$     e# Push another linefeed, copy the first line.

Task 11 - Sator Square - 22 bytes


Test it here.

Probably the most boring solution of all. It pushes the first half of the string and then reverses it:

TEN"    e# Push everything up to the centre of the square.
_W%     e# Duplicate and reverse.
1>      e# Discard the "N", because we don't want that twice.

Task 12 - Prime Tweet - 13 12 bytes


Test it here. (With diagnostic output for the result.)

After ' there's the unprintable <DEL> (0x7F), which SE strips out. For copy-pasting, use this version instead:


The printed string is


That is, it contains one run of all characters, followed by another run from S to ~, followed by a single d. The sum of the character codes is 12203. I found this via a bit of trial and error.

'~),32>  e# Push a string with all printable characters.
_51>     e# Duplicate this and discard the first 51 of them.
'd       e# Push a "d".

Martin Ender

Posted 2015-10-12T08:34:57.067

Reputation: 184 808

1q~$~\-> q"FIHEELT"3*H<fe=:+. – jimmy23013 – 2015-10-12T13:16:02.587

@jimmy23013 Ohhhh, I keep forgetting that we have e= these days. – Martin Ender – 2015-10-12T13:17:04.903

I was hoping to get enough answers to post something before you spotted how to do #5 in 20 chars. – Peter Taylor – 2015-10-12T13:57:30.560


Pyth, 9 tasks in 138 bytes

This took quite a while.

I think 9 tasks is the limit for Pyth. Including the next shortest program (Sator Square) results in 160 bytes. Golfing 20 bytes is quite unlikely. There are 2 or 3 tasks which are a little bit ugly and maybe can be shortened, but overall I'm quite pleased with the solutions.

Task 1 - Can Three Numbers Form A Triangle?, 8 bytes


Try it online: Regular Input or Test Suite

Task 2 - Closest To One Million, 14 bytes


Try it online: Regular Input or Test Suite

Task 4 - FILTHE Letters, 20 bytes


Try it online: Regular Input or Test Suite

Task 5 - Alex Recursive A., 16 bytes

u+"Alex "_GhQ".A

Try it online: Regular Input or Test Suite

Task 6 - Numpad Rotation, 20 bytes


Try it online: Regular Input or Test Suite

Task 7 - Splitting Digits Into Tens, 15 bytes


Try it online: Regular Input or Test Suite

Task 8 - Square Clock, 12 bytes

*3%%Cz1978 5

Try it online: Regular Input or Test Suite

Task 9 - Bracket Art, 20 bytes


Try it online: Regular Input or Test Suite

Task 12 - Prime Tweet, 13 bytes


Try it online: Regular Input


Posted 2015-10-12T08:34:57.067

Reputation: 21 462

2Combining our submissions results in 133 bytes. – isaacg – 2015-10-14T07:27:21.930


TI-BASIC, 4 Tasks in 110 bytes

Task 1 in 7 bytes


Input is a list in Ans.

Task 4 in 35 bytes


Input is a string in Ans.

Task 8 in 29 bytes

:18fPart(sum(seq(I(sub(Ans,I,1)=" ")/6,I,1,15

Input is a string in Ans.

Task 11 in 39 bytes

:Disp "SATOR
:Disp "AREPO
:Disp "TENET
:Disp "OPERA
:Disp "ROTAS

Bonus round! Here are all the other tasks just for fun.

Task 2 in 92 110 bytes


Prompts for a list of digits Input is a string in Ans.

Task 3 in 119 bytes

:Input Str1
:"  →Str2
:If Ans:Then

Prompts for a string. Assumes C and L are either undefined or 0.

Task 5 in 63 bytes

 :"Alex "+Ans
 :If I≠C
  :Ans+" xelA

Input is a number in Ans.

Task 6 in 66 bytes

 :Disp sum(seq((5-real(AnsX+AnsY)-3imag(AnsX+AnsY))₁₀^(X+1),X,⁻1,1

Input is a number in Ans.

Task 7 in 36 43 bytes

:Input <strike>L₁</strike>Str1
 :If 10=int(Ans

Prompts for a list of digits string.

Task 9 in 83 bytes

 :If I<8
 :Disp sub(Ans,9-8abs(I),8

Input is a string in Ans.

Task 10 in 159 bytes

:Input Str1
:While 2+L>length(Ans
:While 1
 :Disp sub(Ans,L+3,L
 :Input Str1

Uses X0. instead of .Xo respectively (sorry nothing matches). Prompts for input line by line. You have to enter two lines of Xs to see all the output, and then 2nd+Quit to quit.

Task 12 in 77 bytes

:Ans+"tvm_I%LinReg(ax+b) DS<(getKeyconj(1-PropZTest(dayOfWk(Manual-Fit C/YANOVA(*row(HorizRegEQUnarchive [J]!#$&'',.234567890:;=>?@GBQX\^_`qw{|}~

Or as hex:


Input is a string containing " in Ans.


Posted 2015-10-12T08:34:57.067

Reputation: 881


Perl, 4 tasks in 117 bytes

Let's try a real language ;)

Haven't given up yet, might even be able to squeeze 5 tasks in 140 bytes, although unlikely!

* Task 1: 30+1 = 31 bytes


Usage: perl -aM5.010 input.txt

* Task 4: 32+1 = 33 bytes


Usage: perl -p input.txt

Task 5: 54 bytes

say"Alex "x($_/2+1).qw(A. .A)[$_%2]." xelA"x(--$_/2+1)

-2b thanks to Dom Hastings

Usage: echo 4 | perl -M5.010

Task 7: 37+2 = 39 bytes


Usage: perl -pF input.txt

* Task 8: 21+2 = 23 bytes


This is a bit of a tricky one. Started out by replacing each | with x and each _ with y then replacing spaces to produce a unique two digit string for each grid (yyxxyxxyyx, yyxxyxxyyxyyxxxxyxyx, yyxxxxyxyxyyxyxxxyyx, yyxyxxxyyxyyxxxxyyx, yyxxxxyyx). Next, I wrote a program to bruteforce values for x and y, and mathematical operations that could be done on the numbers produced after substituting x and y to give an output of 3,6,9,12 for each number. In the end, x=1, y=4 and the magic operation was /64%14.

Usage: perl -0p input.txt

Task 11: 34 bytes


Usage: perl -M5.010

* Task 12: 30 bytes

say d.pack"C*",32..126,83..126

Usage: perl -M5.010

Disclaimer: -M5.010 is considered 'free'


Posted 2015-10-12T08:34:57.067

Reputation: 2 045

Is Ruby less real than Perl? ;) – Martin Ender – 2015-10-13T07:14:07.243

9When I see you answers (which look like noise), I wouldn't qualify Perl as a real language ;) – Fatalize – 2015-10-13T09:13:32.380

1Nice work! I think you can save 2 bytes with qw(A. .A)[$_%2] instead of ("A.",".A")[$_%2] in task 5, and I'm sure you can get another few bytes off... – Dom Hastings – 2015-10-22T09:06:24.070


Ruby, 4 tasks in 280 bytes (non-competitive)

This is just an attempt, I'll keep making tasks later (and hopefully golf the existing ones).

Task 1 &:to_i;p a.all?{|e|e<a.inject(:+)-e}

Task 2


Task 4

n,b='EFHILT',0;{|c|b+=n[c]==p ? 0:[4,3,3,3,2,2][n.index c]};p b

Task 5

a='Alex A.';gets.to_i.times{|i|i%2<1 ? a.sub!('A.','.A xelA'):a.sub!('.A',a)};$><<a

Peter Lenkefi

Posted 2015-10-12T08:34:57.067

Reputation: 1 577


TI-BASIC, 4 tasks in 114 bytes

Download all as a TI group file (.8xg)

(Spoiler tags added per request.)

Task 1 - Can Three Numbers Form A Triangle? - 7 bytes

Download as a TI-83+ program file (.8xp)


Task 4 - FILTHE Letters - 34 bytes

Download as a TI-83+ program file (.8xp)


Task 8 - Square Clock - 35 bytes

Download as a TI-83+ program file (.8xp)

:12-3max(seq(X(sub(Ans,6gcd(X,2)+X,1)≠" "),X,1,3

Task 11 - Sator Square - 38 bytes

Download as a TI-83+ program file (.8xp)


Bonus round! Here are all the other tasks just for fun.

Task 2 - Closest To One Million - 114 bytes

Download as a TI-83+ program file (.8xp)

:If Ans
:If max(\L\X=1

Task 3 - Simple Keyboard Simulator - 131 127 bytes

Download as a TI-83+ program file (.8xp)

:Input Str1
:DelVar X1→Y
:If Ans

Task 5 - Alex Recursive A. - 107 bytes

Download as a TI-83+ program file (.8xp)

:Input X
:sub(Str1,1,Ans+1)+sub(".A xelAlex A.",6gcd(X,2)-5,7)+sub(Str1,Ans+4,5X-Ans+1

Task 6 - Numpad Rotation - 86 bytes

Download as a TI-83+ program file (.8xp)

:Disp Ans(3,X

Task 7 - Splitting Digits Into Tens - 77 bytes

Download as a TI-83+ program file (.8xp)

:Repeat Ans≥dim(\L\X
:If 10=sum(\L\X,X,Ans

Task 9 - Bracket Art - 86 bytes

Download as a TI-83+ program file (.8xp)

:Input Str1

Task 10 - Perimiterize - 218 bytes

Download as a TI-83+ program file (.8xp)

:Input Str1
:If Str1≠".
:Disp sub(Ans,2,B+2

These substitutions have been made: 0=., 1=X, 2=o

For input (after the program begins), type one row at a time, pressing enter at each line break, until the last row is written out. Then press enter, type one period, then hit enter again to submit the entire string.

Task 12 - Prime Tweet - 151 bytes

Download as a TI-83+ program file (.8xp)


Ans should contain a double quote, performed by typing one directly into \Y1\ from the equation editor and running Equ►String(\Y1\,Str1:Str1 from the home screen.

The output length is 140. 8 appears twice, and there are 45 spaces along with the other ASCII characters each appearing once. This amounts to (33+34+...+126) + 56 + 32×45 = 8969, a Sophie Germain prime.


Posted 2015-10-12T08:34:57.067

Reputation: 81

I asked OP, and you can count a token like sin( as displaying s, i, n, and ( in Task 12 – lirtosiast – 2015-10-28T17:35:26.140


Python 3, 1 task, 268 bytes, non-competitive

I tried Task #2 in Python 3.5.2 I am new to code golfing and python

import itertools
def f2(l):
    j = len(l)
    while j>0:
        j -= 1
        m[j]= int(''.join(str(i) for i in l[j]))
    return(n+l[0],k)[k in m]


Posted 2015-10-12T08:34:57.067

Reputation: 1

Welcome to PPCG. You'll find in python 3 you can put some of your statements on one line for example you could write x=10;print(x) This would help some of your indented sections. – george – 2017-01-20T13:56:49.753