instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
In a desolate, war-torn world, where cities have been overrun by thugs and thieves, civilization has reinvented itself in the form of small, isolated, industrial cooperatives, scattered throughout the previously uninhabited landscape. The existence of these communities is reliant on teams of mercenary workers called "s...
stackexchange_codegolf
Given an integral polynomial of degree strictly greater than one, completely decompose it into a composition of integral polynomials of degree strictly greater than one. Details An integral polynomial is a polynomial with only integers as coefficients. Given two polynomials p and q the composition is defined by (p∘q)(...
stackexchange_codegolf
Sandbox A spin-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/argument. The tricky part is that if I left shift your source code, the output must be left shifted too. Likewise, if I right shift your so...
stackexchange_codegolf
Sandbox A spin-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/argument. The tricky part is that if I left shift your source code, the output must be left shifted too. Likewise, if I right shift your so...
stackexchange_codegolf
The Challenge Given a string indicating the symbolic notation of UNIX permission of a file and its ownership (user ID and group ID), decide whether a given user A has permission to read / write / execute it. Related. Permissions in UNIX system In UNIX, every file has three classes of permissions (user, group and others...
stackexchange_codegolf
Challenge In this challenge, you will be writing the first program, p1, of an infinite sequence of programs, in which running pn outputs/generates program pn+1. When concatenating the first n >= 2 programs, the sequence should output n. Example Let's say the first 4 programs are: p1 p2 p3 p4 If I were to run p1, it sh...
stackexchange_codegolf
Inspired by this challenge and related to this one. Background Badugi [bæduːɡiː] is a low-ball draw-poker variant. The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll need to know how good my hands are! The game uses a standard deck of 52 cards of four suits and thirteen ranks. The suits...
stackexchange_codegolf
Your task is when given a chemical formula as input, output the total number of atoms in the formula. Input A chemical formula in any reasonable format. Each chemical formula has the following: A leading coefficient, which is a number \$N > 1\$. At least 0 groupings of elements surrounded by parentheses. Groupings ca...
stackexchange_codegolf
The objective Given a Russian text, encrypt it with Caesar cipher with key 16. The basic Cyrillic alphabets The basic Cyrillic alphabets are: (U+0410 – U+042F) АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ By the Caesar cipher, they are mapped to: РСТУФХЦЧШЩЪЫЬЭЮЯАБВГДЕЖЗИЙКЛМНОП The small letters (U+0430 – U+044F) are also mappe...
stackexchange_codegolf
Here is an image: %%%%%%%%%%%%% % Hello, % % world! % %%%%%%%%%%%%% But it is too confusing for our undersized brains to compute. So we average it like this: Split it into 2 x 2 sections. If the picture ends before a section is complete, imagine that there are spaces there. Average the values of the ASCII chara...
stackexchange_codegolf
Given a word, get the indexes of each letter in the alphabet. For example: uncopyrightable becomes: [21, 14, 3, 15, 16, 25, 18, 9, 7, 8, 20, 1, 2, 12, 5] Convert these indexes to the given numeral system. For example, if the radix is 36, then the array above would become: ['l', 'e', '3', 'f', 'g', 'p', 'i', '9', '7',...
stackexchange_codegolf
Here's an advanced version of the Count the Liberties challenge. The definitions of the terms liberty and group are the same as the previous challenge, so have a look at the previous one for details, but briefly put, A group is a group of stones that are connected horizontally or vertically. Liberty is the number of e...
stackexchange_codegolf
Given the number of vertices N of a convex polygon and each of their (x, y) calculate the polygon's area. vertexes are in clockwise order You must handle all N <= 45 ,-600 <= x,y <= 600, and your answer must be accurate to at least 2 decimal places. Example: 3 1 6 1 2 -4 2 The area is 10.00. This is code-golf, fewe...
stackexchange_codegolf
Consider the following spiral of positive integers: We now define grambulation as a binary operation \$\lozenge : \mathbb N \times \mathbb N \to \mathbb N\$, using this grid. Some example inputs and outputs for grambulation are: \begin{align*} 1 & \lozenge 9 = 25 \\ 1 & \lozenge 2 = 11 \\ 11 & \lozenge 10 = 25 \\ 9 & ...
stackexchange_codegolf
Coders are always trying to flatten arrays into boring 1-dimensional entities and it makes me sad. Your task is to unflatten an arbitrary string of characters, outputting a lovely city skyscape. Consider the string: aaabbbbbccqrrssstttttttPPw It looks much better like this: tt tt bb tt ...
stackexchange_codegolf
Background You've been given a task to take notes for a meeting. You start typing on your Google Doc, but you don't have enough time during the meeting to look at your keyboard while you type. Fortunately for you, you can type without looking at your keyboard. After the meeting, you realize that everything you typed wa...
stackexchange_codegolf
Given an integer \$N>3\$, you have to find the minimum number of bits that need to be inverted in \$N\$ to turn it into a square number. You are only allowed to invert bits below the most significant one. Examples \$N=4\$ already is a square number (\$2^2\$), so the expected output is \$0\$. \$N=24\$ can be turned int...
stackexchange_codegolf
There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too. You have to print a tennis court, but you have to do it in the fewest bytes possible because of confidential reasons. Tennis court...
stackexchange_codegolf
In the US, clothing size sometimes has rough designations like M, L, XXL, etc. The US designation of the "men's jacket" category depends on the height of the person. So, in this challenge, you should implement this conversion, which is defined by the following table, taken from this site: US size Body height (cm) XXXS...
stackexchange_codegolf
Your challenge is simple. Write two programs that share no characters which output each other. Example Two programs P and Q are mutually exclusive quines if: P outputs Q Q outputs P There is no character c which belongs to both P and Q Each program P and Q are proper quines This counts empty quines and quines that re...
stackexchange_codegolf
Given an alphabet represented as a nonempty set of positive integers, and a word made up of symbols from that alphabet, find that word's position in the lexicographically ordered set of all words, assuming words can't contain duplicate symbols. Example Consider the alphabet {1, 2, 3} and the word [2, 3, 1]. The set of ...
stackexchange_codegolf
Problem Description Imagine you're a turtle on a grid. You're given two numbers f and b, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, according to the following rules: By default, you write the count to the cell you're in, then walk forward. If the count is di...
stackexchange_codegolf
Background You know how in text editors and just text fields in general, there's always that blinking bar where you type? Yeah, simulate typing there. You'll be given 3 inputs: The current text field, the position of the cursor, and the input sequence. Here's an example: Hello, World! 5 [U];[U];[B];[B];[B];[B];[B];[U];...
stackexchange_codegolf
In The Settlers of Catan board game, there are five resource types: Brick, Log, Ore, Wheat, and Sheep. Building a settlement costs a Brick, a Log, a Wheat, and a Sheep. However, you can also trade in four identical resources to get a resource of a different type. For instance, if you had four ores in your hand, you cou...
stackexchange_codegolf
The round function in Python 3 will round values of the form \$k+\frac{1}{2}\$ (with \$k\$ being an integer) to the nearest even integer, which is apparently better than the rounding method taught in school Your task is to recreate this functionality: write a program of function that given a (real) number as input, out...
stackexchange_codegolf
Challenge Given an integer \$Q\$ in the range \$-2^{100} ≤ Q ≤ 2^{100}\$, output the number of digits in that number (in base 10). Rules Yes, you may take the number as a string and find its length. All mathematical functions are allowed. You may take input in any base, but the output must be the length of the number i...
stackexchange_codegolf
Task Write a function/program that, given three positive integers a, b and c, prints a Truthy value if a triangle (any triangle) could have side lengths a, b and c and outputs a Falsy value otherwise. Input Three positive integers in any sensible format, for example: three distinct function arguments, f(2, 3, 5) a lis...
stackexchange_codegolf
These are the hosts of the "Weekend Update" news segment on Saturday Night Live, with the years they hosted and their initials: Chevy Chase 1975-1976 CC Jane Curtain 1976-1980 JC Dan Aykroyd 1977-1978 DA Bill Murray 1978-1980 BM Charles Rocket 1980-1981 CR Gail Matthius 19...
stackexchange_codegolf
Your task is to convert a given positive integer from Arabic numeral to Roman numeral. Things get difficult when you count to 4000. The romans did this by adding a line above a symbol to multiply that symbol by 1 000. However, overlines aren't exactly displayable in ASCII. Also, there are double overlines to multiply a...
stackexchange_codegolf
Preamble We've already proven we're good at adding two numbers, but many solutions only operate on tiny numbers like 2³²-1, honestly we can do a lot better. The Challenge Given two unsigned, non-negative integers, add them together and return the output. Input may be taken in any convenient format (String, Array of byt...
stackexchange_codegolf
Write a program or function that takes a character as input and outputs a character. Also, choose a list of 13 distinct ASCII printable characters (32-126). When a character from this list is passed into the program or function, it should output the character at the corresponding position in Hello, world!. This way, ru...
stackexchange_codegolf
Given a drawing of the letter shoot system, where an existing piece of pipe is marked with a *, and an empty spot is marked with a ., your task is to compile a lexicographically sorted list of index tuples [entry row, entry column, exit row, exit column], where each index is 0-based. Entry and exit points are always on...
stackexchange_codegolf
If you have ever had any exposure to Japanese or East Asian culture you will have surely encountered the Amidakuji game: As Wikipedia explains, it is a type of lottery drawn on paper and used to randomly select a permutation of N items. For example, it may be used to randomly assign a starting sequence to N people, o...
stackexchange_codegolf
Introduction For a given rational number r, find a pair of integers p,q so that p/q=r and the number of less used bits in p and q are minimized (details below). Challenge A positive rational number r can be expressed as the ratio of two positive integers, r=p/q. The representation is not unique. For each of these repre...
stackexchange_codegolf
A truncated square-pyramid of height \$h\$ has \$h\$ square layers where each layer has a side \$1\$ greater than the one above it, apart from the top layer which is a square of blocks with a given side length. Here is a truncated square-pyramid of height \$7\$ and top side-length \$4\$ viewed from the side: ...
stackexchange_codegolf
Randomly choose one out of k-length, ordered subset of characters in a string, while only storing a limited number of characters. The subset must be chosen with equal probability and may contain repeated characters. Do this without generating all possible permutations and assume k is at most the length of the string. F...
stackexchange_codegolf
You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that are not. e.g. "absbn[mesl]meslo[eyyis]me" -> "absbn" "mesl" "meslo" "eyyis" "me" Super simple right? Well hold your horses. ...
stackexchange_codegolf
We will say a string \$x\$ is cyclic maximal if there is no way to cycle its elements to get a lexicographically larger string. In other words there is no \$a\$ and \$b\$ such that \$a \oplus b = x\$ and \$b \oplus a > x\$, where \$\oplus\$ is concatenation. For example [3,2,3,3] is not cyclic maximal because you can c...
stackexchange_codegolf
This is similar to the alignment used in word. Task 3 inputs: A 1 line string, a positive integer k, and direction (left or middle or right) Your job is to insert new lines(\n) and spaces in the string such that every line has k characters in it and aligned to the direction given. Rules The words must not be split(unle...
stackexchange_codegolf
As input you will be given a ragged list of positive integers containing at least one integer at some level. For example: [[],[[1,2,[3]]],[]] You should output the depth of the least deep integer. For example if the input is just a list of integers, then the every integer is 1 level deep so the answer is 1. There m...
stackexchange_codegolf
Objective Given an expression involving ternary values, evaluate it into a ternary value. Ternary Values The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L...
stackexchange_codegolf
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique. To complete a hand and win, the 13 tiles in your hand are combined w...
stackexchange_codegolf
kolmogorov-complexity is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, sta...
stackexchange_codegolf
Using ASCII print a section of a hexagon ring tiling. Here's a small section: /\__/\ /_/ \_\ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ \ \__/ / \/__\/ Here's a larger...
stackexchange_codegolf
proposed by @Adám in chat Given an even number of finite points return a line \$y=mx+b\$ that evenly splits the points on both sides. Specs Take a list of distinct points \$(x,y)\$ (or a list of x-coordinates and a list of y-coordinates), output a possible \$(m,b)\$ pair Half of the points should be true for \$y>mx+b\...
stackexchange_codegolf
You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your essay with the least movement. Formally, you have to assign to each character of !"$%&'()+,-./0123456789:;<=?[]`abcdef...
stackexchange_codegolf
This is inspired by one of Downgoat's questions in Sandbox, where I suggested that he include April 31 as Pi day for people who use day/month format, only for him to inform me that there is no April 31! Given a date string in month/day format that might be invalid, output the correct date using rollover. (First rollove...
stackexchange_codegolf
Challenge The cops created code challenges which result in certain wildly incorrect answers despite correct math. Choose an uncracked, not safe formula from the cop thread. Your task is to find an incorrect answer and describe its underlying cause. The challenge author has the responsibility to confirm whether the expl...
stackexchange_codegolf
Challenge You find yourself in a bash terminal, and want to do some simple tests on sqlite3. So you issue the following command: echo "CREATE TABLE T (id INT NON NULL PRIMARY KEY)" | sqlite3 test.db Now you want to insert the first N integers (starting from 0, excluding N) into the table T. For convenience, you execut...
stackexchange_codegolf
Given a string, return that string's "luck". A string's luck, as I completely just made up for the purpose of this challenge, is an integer, determined as so: The base luck for a string is 1. For each consecutive letter it shares with the word "lucky" (case insensitive), multiply the luck by 2. For instance, if your s...
stackexchange_codegolf
Task Given two positive integers: Draw the rectangle with dimensions specified by the two integers. Repeat Step 3 until there is no more space. Draw and fill the largest square touching three sides of the (remaining) rectangle. Output the resulting rectangle. Example For example, our input is 6 and 10. We draw the ho...
stackexchange_codegolf
Robbers thread Cops, Choose two strings of code, one public and one secret. We will call them P and S. You will be writing a program using only repetitions of these strings. For example: if you choose P=helloand S=world, valid programs would be hello, world, helloworld, worldhello, helloworldworldhello, hellohellohello...
stackexchange_codegolf
Background As noted in the PPCG challenge Compress a maximal discrepancy-2 sequence – which inspired this challenge – the authors of the paper Computer-Aided Proof of Erdős Discrepancy Properties found a maximal discrepancy-2 sequence, namely -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, -1, 1, -1, -1, 1, -1, -1, ...
stackexchange_codegolf
Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest. Pitches will be given in scientific pitch notation, consisting of a tone name followed by an octave number. Here, the tone name will be a single letter A–G, possibly followed ...
stackexchange_codegolf
One of many unique features of the Malbolge programming language is its highly unintuitive OP operator, referred to only as "op" in the documentation and source code but popularly known as the "crazy" operator. As described by Ben Olmstead, the creator of the language, in its documentation: "don't look for pattern, it'...
stackexchange_codegolf
Introduction This challenge consists in finding the greatest number removing y digits from the original number n which has x digits. Assuming y=2 n=5263 x=4, the possible numbers removing y=2 digits are: [52, 56, 53, 26, 23, 63] So, the greatest number is 63 which must be the output for this example. Another logic wo...
stackexchange_codegolf
Challenge I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform. The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ...
stackexchange_codegolf
Challenge: I have thousands of songs in my music collection, and luckily for me, my favorite player has a search function. I also have a great memory—I can remember the title of every song in my collection. However, I'm very lazy and don't like to type—each extra keystroke is a chore! What is the shortest string I mus...
stackexchange_codegolf
A strictly non-palindromic number N is a number that isn't a palindrome in any base (in bases 2 to N-2). These numbers are listed on OEIS For example, the number 19 in base 2,3,4,5,6,...17 is: 10011,201,103,34,31,...12. None of these representations is palindromic, so the number is strictly non-palindromic. For this ...
stackexchange_codegolf
Your task is to print this exact text: | | | | | | &***********& | Code Golf | | e---------f | | d___________l | | o-------------o | | C_______________G | ###Dennis$Dennis### ##################### Rules Trailing or leading newline is allowed code-golf, so shortest code wins!
stackexchange_codegolf
Write a program that halts producing a random finite numerical output with probability 1. The expected value of the outputs of the program must be infinite. For physical limits, you can assume your language and related functions use infinite precision numbers. E.g. for languages with random function providing range \$[...
stackexchange_codegolf
Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the second challenge in this series. The first challenge can be found here. In this challenge,...
stackexchange_codegolf
The input for the continuous knapsack problem is as follows. For each item 1...n we are given a positive weight and profit. Overall we are also given a positive capacity which is the maximum weight we can carry. The goal is to pick items so that the profit is maximized without exceeding the capacity. This is hard if ...
stackexchange_codegolf
Consider an array of unique integers, with an arbitrary length greater than 2. It is sometimes possible to express elements of the array as the sum of at least two other elements. For example, if our array is [2, 3, 1], we can express 3 as the sum 2+1. However, we can't express either 2 or 1 as the sum of other element...
stackexchange_codegolf
quintopia has posted here a challenge to compute multinomial coefficients (some of the text here is copied from there). There is a fun algorithm to compute multinomial coefficients mod 2. Given a list of numbers, k1, k2, ... ,km, output the residue of the multinomial coefficient: reduced mod 2. The following algorith...
stackexchange_codegolf
Objective Given an integer \$n\$ interpreted as two's complement binary, output two integers, namely the integer consisting of \$n\$'s bits at places of \$2^0, 2^2, 2^4, \cdots\$, and the integer consisting of \$n\$'s bits at places of \$2^1, 2^3, 2^5, \cdots\$. Note that the input may be negative. Since \$n\$ is inter...
stackexchange_codegolf
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 ...
stackexchange_codegolf
Given a string of printable ASCII, output the frequency of each character in that string. The Challenge Input is given as a string of printable ASCII characters (decimal [32-126] inclusive). Output the frequency of each character, in ASCII order. The output must have a format similar to [character][separator][count]. ...
stackexchange_codegolf
Challenge: Add two numbers. In O(n^m) time, where n and m are the two numbers given. Sleeping, or your language equivalent, is not allowed. Input: Two integers, separated by a space. Output: The sum of the two integers. Additional notes: The exact timing doesn't matter, as long as the input 1000 2 takes roughly 1/1000t...
stackexchange_codegolf
Enterprise Quality Code! TL;DR Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen language only supports unary or other based output) separated by newlines (optional trailing linefeed). You may post cracks ...
stackexchange_codegolf
Your challenge, should you choose to accept it, is to write a program in a language of your choice that, when given a string (limited to printable ASCII) as input, outputs a new program in the same language that outputs that string without using any characters from that string in the code. But this task is impossible a...
stackexchange_codegolf
Note: This is an attempt at recycling guest271314's permutation question(s) There's an interesting pattern that forms when you find the differences between lexographically sorted permutations of base 10 numbers with ascending unique digits. For example, 123 has permutations: 123 132 213 231 312 321 When you find the d...
stackexchange_codegolf
Given integers k and n, generate a sequence of n unique k-tuples of pairwise coprime integers. Every such tuple must occur once eventually, that is, for any existing k-tuple of pairwise coprime integers, some n will eventually generate it. The output may be printed or evaluated in any list/tuple-like form. Definitions ...
stackexchange_codegolf
This challenge takes place on a grid. +----------+ | | | | | | | | | | | | | | | | | | +----------+ This one's 10 x 10, but it can be any rectangular shape. There are four directions on this grid. Up, down, left and right. The task is to ...
stackexchange_codegolf
Your job is to write a program that takes a number N as input and outputs all 2-by-N mazes that are solvable. Output format can be in the form of any two distinct values representing wall and empty - I use x and . here but you can use anything. You can have a matrix, array, string, ascii art, whatever is convenient, an...
stackexchange_codegolf
What is Crazyhouse Chess? Crazyhouse Chess is a chess variant that is basically normal chess except you can place a piece you previously captured back on the board instead of a regular turn. Bot interface Only JavaScript bots are allowed. A bot is a JavaScript function that takes 3 arguments (board, side, bank) and ret...
stackexchange_codegolf
Several Mathematica functions have system-defined short forms, e.g., /@ for Map. Many of them are listed here: https://reference.wolfram.com/language/tutorial/OperatorInputForms.html However, there also exist some system-defined short forms for function-option combinations. E.g., Log2@ninstead of Log[2, n] and Log10@...
stackexchange_codegolf
Imagine a text file where each csv record may have different numbers of fields. The task is to write code to output how many fields there are in each record of the file. You can assume there is no header line in the file and can read in from a file or standard input, as you choose. You can assume a version of rfc418...
stackexchange_codegolf
Sandbox Finding radicals of arbitrary ideals in rings is hard! However, it's a doable task in polynomial rings, since they are Noetherian (all ideals are finitely generated) Background A quick introduction to radical ideals A ring is a set, paired with two binary operations + and * such that 0 is a additive identity, 1...
stackexchange_codegolf
Challenge Input two integers. Integer I/O must be decimal. If the integers are equal, output a truthy value. Otherwise, output a falsy value. Clarifications You will never receive non-integer inputs. You will never receive an input that is outside the bounds [-2³¹, 2³¹). Rules Standard loopholes are disallowed....
stackexchange_codegolf
I was seen multiple shortest "Hello World!" program, but this is the longest program. The Rules Each submission must be a full program. This must be non-interpreted language (for example, JavaScript, Python, HTML, etc.) Target OS must be Windows, Mac, Linux or MS-DOS. The challenge Writing a longest Hello World prog...
stackexchange_codegolf
This is the robbers' thread. The cops' thread is here. Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the cop's submission when you've cracked their code.
stackexchange_codegolf
Guidelines Task Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array (lists in some languages). Rules This is code golf so the shortest answer in bytes wins! You will always get a valid array There will always be exactly one letter missing Th...
stackexchange_codegolf
I have read: Tips for golfing in Python I would like to golf this code further. Any more tips? x,y,q,w=[int(i) for i in raw_input().split()] while 1: a=int(input()) s=d="" if q>x: s="W" q-=1 elif q<x: s="E" q+=1 if w>y: d="N" w-=1 elif w<y: d="S" w+=1 print d+s The program: You move on a map whi...
stackexchange_codegolf
Inspired by a tweet by Nathan W. Pyle There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle... Use your first name: a - add “t” after it e - add “boo” after it h - becomes “s” n - add “oo” after it r - add “eee” after it...
stackexchange_codegolf
Picolisp has a feature called "super parentheses": Brackets ('[' and ']') can be used as super parentheses. A closing bracket will match [all parentheses to and including] the innermost opening bracket, or [if there are no unmatched opening brackets] all currently open parentheses. src Taking a string containing only...
stackexchange_codegolf
The Task In this challenge, your task is to write some code which outputs one of its anagrams chosen randomly with uniform distribution but it should never output itself. Elaboration Given no input, your program should output any one of the anagrams of its source code. Your program should never output its own source a...
stackexchange_codegolf
In this task, your goal is to write a program for generating hexdumps of files of arbitrary types. Input The input consists of a (relative or absolute) path to the file to be processed. It may be taken from STDIN, a function argument, or a command line argument. Output The output (which may be written to a separate pla...
stackexchange_codegolf
There are two forms of nouns, singular and plural. The conversion between these two is quite easy. Normally, you end it with s. ex. car => cars. If it ends with s,x,z,ch or sh, end it with es. ex. bus=>buses. If it ends with y with a consonant just before it, change the y to ies. ex. penny => pennies. If it ends wi...
stackexchange_codegolf
Traditionally presents are kept secret in boxes wrapped in paper. Since the ice caps are melting Santa Claus has begun to investigate some ways they might make the whole gift wrapping operation a little more eco-friendly. The first thing they've decided to do is to put all presents in perfectly cubic boxes. This makes...
stackexchange_codegolf
The challenge Implement the C equivalent of the pow() function (exponentiation) for natural numbers, in a language of your choosing, using only addition, subtraction (which includes negation and comparisons), bit-shifting, boolean operations on signed and/or unsigned integers, and of course looping. (Note that this is ...
stackexchange_codegolf
This challenge consists in coding an interpreter for a Mondrian painting description language (MPDL). Language definition The language operates on a stack of rectangles. A rectangle is defined by its upper left coordinate and lower right coordinate. Coordinates must be integers. The stack is initialized with a single r...
stackexchange_codegolf
These are ASCII dandelions: \|/ \ / | /|\ | \|/ | | | | _\|/_ | | | /|\ ASCII dandelions have three parameters: Length of the stem (positive number between 1 and 256, number of seeds (positive number between 0 and 7), and orientation (^ or ...
stackexchange_codegolf
A person has two first names if their last name is also a common first name. You are tasked with determining which full names in a list are two first names. John Smith John Doe Luke Ryan Ryan Johnson Jenna Jackson Tom John Any name that occurs in the first name column is potentially a first name. If the number of occu...
stackexchange_codegolf
On 4chan, a popular game is get. Every post on the site gets a sequential post ID. Since you can't influence or determine them, people try to guess (at least a part of) their own post number, usually the first few digits. Another version of the game is called dubs, and it's goal is to get repeating digits at the end of...
stackexchange_codegolf
Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost. For example, with this array: [ [ [5, 1, 4], [10, 7, 21] ], [ [9, 20, 2], [4, 2, 19] ] ] You'd sort at the deepest first: [ [ [1, 4, 5], [7, 10, 21] ], [ [2,...
stackexchange_codegolf
A company is arranged in a heirarchical structure, with a layer of workers at the bottom. Each worker is managed by a manager. Consequently, each manager is managed by another manager until there is a company "boss". Each manager is restricted to managing, at most, x workers. For a company of size y calculate the numbe...
stackexchange_codegolf
Convert a string containing digits as words into an integer, ignoring leading zeros. Examples "four two" -> 42. "zero zero zero one" -> 1. Assumptions Submissions can assume that: The input string is comprised of space-separated digit words. All words are valid (in the range "zero".."nine") and lowercase. Behaviour ...
stackexchange_codegolf
A current internet meme is to type 2spooky4me, with a second person typing 3spooky5me, following the (n)spooky(n+2)me pattern. Your mission is to implement this pattern in your chosen language. You should write a program or function that takes a value n (from standard input, as a function argument, or closest alternati...
stackexchange_codegolf
The Tangram is a dissection puzzle made from seven shapes: Five differently sized triangles, a parallelogram and a square. Given a shape, the goal is recreating the shape using all the pieces and without overlapping. There are obviously infinitely many ways to arrange this set of pieces in the plane. An interesting sub...
stackexchange_codegolf