Tasks
All competitors try to solve the following list of 10 tasks:
Read a positive integer n from input and return the sum of the cubes of the first n non-negative integers.
For input
1
, this should return0
.Read a positive integer n from input and return a truthy value if and only if n is a Mersenne prime.
Read a non-empty list of n integers from input and return their median.
If n is even, use the lesser of the two middle values.
For example, the median of
[1 4 3 2]
is2
.Read an integer (positive, negative or 0), or a string representation in base 10 or unary, from input and return its digits in negabinary, without leading zeroes (with the exception of input 0).
The output can be formatted in any convenient way (digits, array, string, etc.).
Return
pneumonoultramicroscopicsilicovolcanoconiosis
.Check the current date and return
Happy New Year!
if appropriate according to the Gregorian calendar.Pseudo-randomly select 64 unique assigned code points from the Unicode block CJK Unified Ideographs Extension-A (U+3400 – U+4DB5) and return the string of the corresponding characters.
All possible strings should have the same probability of getting selected.
Read two strings of printable ASCII characters from input and return a truthy value if and only if the character of the first string form a subsequence of the second string.
For example,
abc
,axbxc
should return truthy andbac
,axbxc
should return falsy.
- Read a multidimensional, rectangular array of integers and an integer n from input and return the modified array with all integers multiplied by n.
Read a non-negative integer n from input and return a chain of n train wagons, as shown below.
Example output for n = 3:
______ ______ ______ | | | | | | ()--() ~ ()--() ~ ()--()
The output may be surrounded by any amount of whitespace as long as it looks like in the example.
Clarifications
0 is neither positive nor negative.
Trailing whitespace is always permitted in the output.
Several pieces of input may be read in any consistent, convenient order.
Rules
No answer may solve two different tasks in the same programming language.1
For each individual task, standard code-golf rules apply.
In particular, you can submit programs or functions with the usual I/O defaults, but cannot take advantage of these loopholes.
Task 5 is essentially a kolmogorov-complexity challenge, so hardcoding the output is not only allowed but expected.
Only one answer per user should be posted, containing at most one solution for each of the tasks.
Please format your answer as in the following example:
## Task 1, Python, 42 bytes <code goes here> Explanation, I/O, required Python version, etc. go here. --- ## Task 7, C, 42 bytes <code goes here> Explanation, I/O, required compiler (flags), etc. go here.
Scoring
For every task you solve, you get one point.
This means that you don't have to solve all tasks to participate.
If your solution for the task n is the shortest one in that programming language, you get an additional point.
If your solution for the task n is the shortest one of all programming languages, you get an additional point.
The bonus points will be awarded only once for each task-language combination and each task, respectively.
As usual, if two solutions have the same byte count, posting time is the tie breaker.
If somebody outgolfs you later, you lose the bonus point(s) the other answerer earns.
You can golf submission, add/remove languages from your answer or swap the languages used for two tasks.
Any time somebody edits his answer, all answers are rescored.
Once you change languages for a task, you forfeit seniority.2
The answer with the highest score wins.3
Per-task leaderboard
<style>body{text-align:left!important}#answer-list{padding:10px;width:290px;float:left}#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</style><script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script><link rel=stylesheet href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><div id=answer-list><table class=answer-list><thead><tr><td>Task<td>Author<td>Language<td>Score<tbody id=answers></table></div><table style=display:none><tbody id=answer-template><tr><td>{{TASK}}<td>{{NAME}}<td>{{LANGUAGE}}<td>{{SIZE}}</table><script>function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function process(){answers.forEach(function(e){var s=e.body_markdown.split("\n").filter(function(e){return"#"==e[0]});s.forEach(function(s){var r=s.match(NUMBER_REG)[0],t=(s.match(SIZE_REG)||[0])[0],a=s.match(LANGUAGE_REG)[1],n=e.owner.display_name;entries.push({task:r,user:n,language:a,size:t})})}),entries.sort(function(e,s){var r=e.task-s.task;return r?r:e.size-s.size});for(var e=0;e<entries.length;e++){var s=jQuery("#answer-template").html();s=s.replace("{{TASK}}",entries[e].task).replace("{{NAME}}",entries[e].user).replace("{{LANGUAGE}}",entries[e].language).replace("{{SIZE}}",entries[e].size),s=jQuery(s),jQuery("#answers").append(s)}}var QUESTION_ID=52152,ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*.*?,\s*\[*([^,\]]+)/,entries=[];</script>
Combined leaderboard (2015-07-30 20:00 UTC)
User / Task 1 2 3 4 5 6 7 8 9 A TOTAL Tie breaker (if any)
DLosc 2 2 3 2 2 2 2 3 2 2 22
Sp3000 2 2 2 2 2 3 2 2 2 2 21
Doorknob 2 2 2 2 2 2 2 2 2 2 20
mathmandan 2 2 2 2 2 2 2 2 2 2 20 Combined byte count.
MickyT 2 2 2 2 2 2 1 2 2 2 19
Alex A. 2 1 2 2 2 2 1 2 2 2 18
Jacob 2 2 2 2 2 1 0 0 0 2 13
alephalpha 2 2 2 0 2 2 0 0 2 0 12
Martin Büttner 2 0 0 2 2 0 0 2 2 2 12 Combined byte count.
kirbyfan64sos 1 2 2 0 2 X 0 2 0 3 12 Per-language wins.
Maltysen 3 0 0 0 3 2 1 X 2 0 11
plannapus 2 2 0 0 2 2 0 2 0 2 10
jimmy23013 0 0 2 3 0 0 3 2 0 0 10 Solved tasks.
Tom 0 3 0 0 2 2 0 X 3 0 10 Combined byte count.
FryAmTheEggman 1 0 2 0 2 0 2 0 2 0 9
Vioz- 1 0 2 2 2 2 0 0 0 0 9 Combined byte count.
Toby Speight 2 0 0 0 2 2 0 0 0 2 8
Ismael Miguel 0 0 0 0 2 2 0 0 0 2 6
Pulga 0 2 2 0 0 0 0 0 0 2 6 Combined byte count.
flawr 2 0 2 0 0 0 0 0 0 0 4
manatwork 2 0 0 0 0 2 0 0 0 0 4 Combined byte count.
TheNumberOne 1 0 0 0 2 0 0 0 0 0 3
Tasks marked with X
are present but invalid.
The combined leaderboard has been constructed by hand. Please tell me if there are any errors.
1 Languages count as different if they are not different versions of the same language, so there's only one JavaScript, one Python, and one TI-BASIC, but C, C++, Octave and MATLAB are four different languages.
2 If you solve task n using language L in x bytes, somebody else solves the same task in the same language with the same byte count, you change to language M and roll back your edit, the other answerer will keep the bonus point.
3 The number of points earned from scoring rules 1, 2 and 3 (in that order), the combined byte count of all solved tasks (lower is better) and, finally, the vote tally (higher is better) serve as tiebreakers.