instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
For all you American folk out there, remove the "s" in "maths". Ugh, my maths teacher gave me so much algebra to do. There's just lines and lines of meaningless junk like Expand (x+1)(x+6) and Factorise x^2+2x+1. My hands are literally dying from the inside. So I figured out a way to hack the system - why not write a p...
stackexchange_codegolf
Challenge Create a console program to display each byte of a file. Winning Since this is code-golf, fewest bytes wins. Rules Program must be a console application, meaning that it will be ran from some sort of command-line interpreter; Every byte must be uppercase hexadecimal, separated by a space, and it must be 2 ...
stackexchange_codegolf
Consider an eight bit number in which an even position bit will never be 1 if one of its neighbors is 0 (considering MSB and LSB as neighbors). There are fewer than 64 such numbers, so there is at least some reversible mapping of them to 6 bit numbers. Your task is to write a pair of functions (or code blocks or your l...
stackexchange_codegolf
The goal of this challenge is to create a program that outputs a string depending on the time of year. Output If the date is December 25, output: Merry Christmas! If the date is December 31 or January 1, output: Have a Happy New Year! If the date is between December 25 and December 31 (exclusive), output: Happy Hold...
stackexchange_codegolf
Leaderboard 154 Calculator 144 Taxman 138 Statistician 137 Solver 137 RandoAggroLawyer 136 Gambler 134 Turncoat 119 Lawyer 119 BloodyMurder 113 Bandit 79 Challenger 74 Mask 64 Random An archive of the latest match, including the log and all output files, is available. Calculator, by Brilli...
stackexchange_codegolf
My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. For example if my phone number were abaababbab Then by repeatedly removing ab we would eventually get nothing (I encluse ...
stackexchange_codegolf
Design a random number generator where the i th number has i% chance of occurring for all 0 < i < 14. 0 should have exactly 9% chance of occurring. The seed for the generator should be the system time. You cannot use a pre-defined function for random number generation. Basically 1 has 1% chance of occurring, 2 ...
stackexchange_codegolf
In some languages, strings are started and ended with a quote mark ('). And quote itself is escaped by writing it twice sequentially. For example, empty string is written as '', and I'm is written as 'I''m'. This question is about find out all non-overlapping strings from left to right in such format from the given inp...
stackexchange_codegolf
The challenge Output an array or string representation of Dürer's famous magic square: that is, 16 3 2 13 5 10 11 8 9 6 7 12 4 15 14 1 Some properties of this square, which can perhaps be exploited, are: It contains each integer from 1 to 16 exactly once The sum of each column or row, as well as the the sum...
stackexchange_codegolf
PPCG hasn't had enough of quines already... Challenge: Your task is to create a program "A0". When this program is run with no input, it outputs nothing. When this program is run with input, it outputs "A1". When "A1" is run with no input, it outputs "A0". When "A1" is run with input, it outputs "A2". Pretty much, "A(k...
stackexchange_codegolf
I've recently stumbled upon a Russian site called acmp.ru, in which one of the tasks, HOK, asks us to find the LCM of two positive integers. The full statement, translated to English is as follows: The only line of the input contains two natural numbers A and B separated by a space, not exceeding 46340. In the only l...
stackexchange_codegolf
Scientists have made contact with a parallel universe. Just one problem: They write math differently. Help the scientists make a program that can convert normal math expressions to their equivalent in alternate universe math. The connection through the portal is bad so your code needs to be as short as possible Given a...
stackexchange_codegolf
In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as f'(x), and these can sometimes be abbreviated to f and f'. The derivative of the product of two functions fg is f'g + g'f. The derivative of three fgh is f'gh + fg'h + fgh'. In...
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
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random distribution (uniform, binomial, Poisson etc.) you use so long as each integer has a non-zero chance of being generated and i...
stackexchange_codegolf
Given an input of a Pig, SickPig, DeadPig, QuinePig, or DeafPig program, choose one of those "languages" randomly and interpret the input as that "language." First, randomly choose between one of the five members of the "Pig series": Pig If the choice was Pig, mimic the reference interpreter by doing the following: F...
stackexchange_codegolf
The challenge How well can you gerrymander North Carolina into 13 voting districts? In this challenge, you use the following files to draw different maps for Republicans and Democrats. File 1: NC_2016_presidential_election.csv File 2: NC_county_adjacency.csv File 1 gives county-level voting data from the 2016 president...
stackexchange_codegolf
Introduction It was just a normal day, here at your military base. Suddenly, you looked up to see a bomb falling down from the sky! You need to create a program to predict where it will fall, and tell you the location. Challenge You will be given a bomb in the form of Start-X Start-Y X-velocity Y-velocity. You can assu...
stackexchange_codegolf
Introduction During work with BMP (bitmap) generator I face problem of converting number to little endian hex string. Here is function which I create in JavaScript - but wonder how small code can works similarly let liEnd= num => num.toString(16).padStart(8,'0').match(/../g).reverse().join``; console.log(liEnd(304767...
stackexchange_codegolf
A lawn is defined as a rectangular field with of one character surrounded by two layers of visible whitespace. This means two lines above and twos lines below, and a two space padding on the left (the right has visible whitespace, so you do not need to include it).     ||||| ||||| |||||     A mowed lawn is...
stackexchange_codegolf
My first code golf question post! Hope u like it ;-) The task is simple. Write either an stdin-stdout program or a function. Input is a 2D array which contains only either characters or the integer 0. You are allowed to replace the integers with the character '0' or null instead in any language (kudos to @SuperStormer ...
stackexchange_codegolf
CLOSED to competing entries New bots are welcome but are not part of the main competition and probably won't be officially tested. You stand on a dusty stretch of code, watching the other programs stare at you. Will they shoot? How much ammunition do they have left? All you know is that you want to be the last one stan...
stackexchange_codegolf
Given a positive integer n > 1 determine how many numbers can be made by adding integers greater than 1 whose product is n. For example if n = 24 we can express n as a product in the following ways 24 = 24 -> 24 = 24 24 = 12 * 2 -> 12 + 2 = 14 24 = 6 * 2 * 2 -> 6 + 2 + 2 ...
stackexchange_codegolf
I have encountered this type of puzzle, that usually involves apples, several times. It goes as follows: There is a certain number of apples in a basket. Ava takes a third of the apples. Bob takes a quarter of the apples that are left. Finally, Dennis takes one-sixth of the apples left. In the end, there are 10 leftov...
stackexchange_codegolf
I was walking through a pumpkin patch the other day for a birthday party, and noticed the pumpkin vines making a nifty pattern, with whirls, loops, and offshoots. We're going to simulate that here with some ASCII art. (()) \ p--q p-----q / \ / \ (()) b--d (()) Vine ...
stackexchange_codegolf
Fermat's last theorem says that there there are no positive, integral solutions to the equation a^n + b^n = c^n for any n>2. This was proven to be true by Andrew Wiles in 1994. However, there are many "near misses" that almost satisfy the diophantine equation but miss it by one. Precisely, they are all the greater than...
stackexchange_codegolf
Introduction You're making a robot that can navigate a set of books of varying heights. It can climb books and jump off books, but if the distance is too big it will stop to prevent damage. To figure out the ideal design, you're writing a simulator. Your program will take as input a list of numbers, representing the he...
stackexchange_codegolf
A marquee is a low-tech board that allows customizable letters. For example, here is a marquee: SALE ON SNEAKERS However, someone might come along and vandalize it by removing letters to send a different message: S N AKE Given two non-empty string inputs, an original message and a new message, determine whethe...
stackexchange_codegolf
I have recently been on a quest to create really really slow sorting algorithms that make Bogosort seem like it is the best. The task is simple: Sort an array of integers in as long average time as possible, with the average Bachmann–Landau notation begin as high as possible, while keeping the best case performance fas...
stackexchange_codegolf
Challenge Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy. Rules The accuracy of the solution should be measured against this CSV file (which countains syllable counts for all the 52,439 entries in the CMU Pronounc...
stackexchange_codegolf
Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses. For example, given ASTNORDYUVKFMCLWIHEBQGPJXZ as the permutation, and ASTRONAUT as the word, we know that the word was guessed. Only 2 letters (DY) were wrong...
stackexchange_codegolf
99 bugs in the code The adaption of "99 bottles of beer on the wall" for computer science where the bugs increase instead of the bottles decreasing is often re-posted around the internet. Example T-Shirt Here. I think it'll be interesting to see potential recursion and random number generation across a huge variety of ...
stackexchange_codegolf
Inspired by Greg Martin's "Shiny cryptarithm" puzzle. A cryptarithm is a game consisting of a mathematical equation among unknown numbers, whose digits are represented by letters of the alphabet. The goal is to identify the value of each letter. They are usually represented by an addition operation, such as SEND + MORE...
stackexchange_codegolf
Background SKI combinator calculus, or simply SKI calculus, is a system similar to lambda calculus, except that SKI calculus uses a small set of combinators, namely S, K, and I instead of lambda abstraction. Unlike lambda calculus, beta reduction is possible only when a combinator is given enough arguments to reduce. T...
stackexchange_codegolf
The string tut-tutut-tut-tuttut-tut can be constructed with overlapping or concatenated instances of the word tut-tut: tut-tutut-tut-tuttut-tut tut-tut tut-tut tut-tut tut-tut The string tut-tututut-tutut-tut cannot: tut-tututut-tutut-tut tut-tut^ |tut-tut | tut-tut ...
stackexchange_codegolf
><>, or Fish, is a two-dimensional esoteric programming language where the instruction pointer (IP) toroidally moves around the codebox, wrapping when it hits an edge. ><> has four basic movement instructions - <, >, ^, and v, which respectively mean to change the IP's direction to left, right, up and down. It also has...
stackexchange_codegolf
At Hackerrank.com, the love letter mystery is a simple programming problem, which I already solved. My solution involved calculating the palindrome and counting the number of operations to do it. On Hackerrank, they have another approach, which I don't understand completely: Given a string, you have to convert it int...
stackexchange_codegolf
Charcoal is a language created by ASCII-only and DLosc that specialises in ASCII art challenges. What tips do you have for golfing in Charcoal? Obviously I am looking for tips related specifically to Charcoal, not those which can be applied to most - if not all - languages.
stackexchange_codegolf
In mathematics, the factorial, shortened "fact" of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is 1 * 2 * 3 * 4 * 5 = 120 The factorial of 0 is 1, according to the convention for an empty product. These are the regular facts we are used to. ...
stackexchange_codegolf
Make a program that simulates the basic logic gates. Input: An all-caps word followed by 2 1 digit binary numbers, separated by spaces, such as OR 1 0. The gates OR, AND, NOR, NAND, XOR, and XNOR are needed. Output: What the output of the entered logic gate would be given the two numbers: either 1 or 0. Examples: AND ...
stackexchange_codegolf
Challenge Given an integer, \$s\$, as input where \$s\geq 1\$ output the value of \$\zeta(s)\$ (Where \$\zeta(x)\$ represents the Riemann Zeta Function). Further information \$\zeta(s)\$ is defined as: $$\zeta(s) = \sum\limits^\infty_{n=1}\frac{1}{n^s}$$ You should output your answer to 5 decimal places (no more, no le...
stackexchange_codegolf
From Wikipedia, Gabriel's Horn is a particular geometric figure that has infinite surface area but finite volume. I discovered this definition in this Vsauce's video (starting at 0:22) where I took the inspiration for this problem. You begin with a cake (a cuboid) of dimension \$x \times y \times z\$. In your first sli...
stackexchange_codegolf
Given a list of countries in alphabetical order, put them in the same order as they are given in the song "Yakko's World". Specifically, you are given the following list of countries* exactly: Abu Dhabi, Afghanistan, Albania, Algeria, Algiers, Angola, Argentina, Australia, Austria, Bahamas, Bahrain, Bangladesh, Barbado...
stackexchange_codegolf
I came across an interesting tiling of the plane using squashed hexagons in a popular math book. All the six edges of the squashed hexagon are the same length. Two opposite corners are right angles and the rest four corners are 135 degrees each. This shape allows four squashed hexagons be arranged so that they meet at ...
stackexchange_codegolf
Write a program which parses the output of uptime and generates an anatomically suggestive progress bar (as shown) with a length equal to the current uptime in days: $ uptime 23:01 up 34 days, 7:30, 5 users, load averages: 0.23 0.27 0.24 $ uptime|<command> 8==================================D (34 days = 34 equal sig...
stackexchange_codegolf
A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, among other things. One of the first people to compile a life table was Edmond Halley, of cometary fame. These probabi...
stackexchange_codegolf
The new site header has some bits of source code from various questions as the background. Here are the first 3 lines: --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+. Hello, World! IT'S SHOWTIME TALK TO THE HAND "Hello, World!" YOU HAVE BEEN TERMINATED "9!dlroW ,olleH"ck,@ 72a101a+7aa+3a4...
stackexchange_codegolf
The question uses C to formulate the problem, but solutions in any language can be accepted. At the end of the question you can find a pythonic version. As part of a bigger software, we have a C function: void wrapper(void* p); Which is a wrapper function around the C function: void handler(void* p); wrapper() is tri...
stackexchange_codegolf
Say I have text like this (each word on one line, with no spaces) Programming Puzzles & Code Golf That makes no sense! It totally defies the laws of physics. Your challenge is to remedy this impossible situation and collapse the text like so: P Prog &uzz Coderam Golflesming So that there is no empty space underneath ...
stackexchange_codegolf
The task Your program will be given the following inputs: a number n, and an array of n positive integers. Your program only has to work when n=1000. The program must do the following: If the input array is a permutation of the range [1, 2, …, n], output Huh!? Otherwise, return a three-element array [i, j, n], where i...
stackexchange_codegolf
Well the title says it all. Standard loopholes apply Nothing to read from stdin, and output goes to stdout 1-byte-long programs are... nonsense. They don't qualify A program with a single byte repeated is also a nonsense (like aaa) Please mark it out if your program is a palindrome Sample: A program with source code...
stackexchange_codegolf
This is the second in a series of Island Golf challenges. Previous challenge Two hermits have arrived on a desert island. Since they came seeking solitude, they wish to live as far away from each other as possible. Where should they build their huts to maximize the walking distance between them? Related reading Input Y...
stackexchange_codegolf
Your task is to make a script with the shortest byte count, that reverses a word then replaces each letter with the next letter next in the alphabet. Examples: input: hi output: ji input: hello output: pmmfi input: test output: utfu A few notes: Should the letter's value be 27 (z+1), assume it is an a. Symbols, num...
stackexchange_codegolf
Let A be an m by n rectangular matrix of positive integers, where m and n are also positive integers. We are interested in RoD ('Right-or-Down') paths from the upper-left cell of A to the lower right cell; in an RoD path, each successive cell of the path is either one cell to the Right of or one cell Down from the prev...
stackexchange_codegolf
Cop's thread here In this cops-and-robbers challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs. Cops will then reveal the program in an answer keeping the number a...
stackexchange_codegolf
Is it a good chord? Definition of a chord: We define a chord as three notes together. Definition of a note: We define a note as a number between 1 and 7, inclusive. As in music, we define 1 as do, 2 as re, 3 as fa, etc. However, the note names are not important. They will not be included in the question and likely not ...
stackexchange_codegolf
Codidact post, CGCC Sandbox, Codidact Sandbox Given three positive integers as input, animate an ascii-art polygonal loading symbol on the screen. Intro You will be given three inputs, \$n\$, \$l\$, and \$d\$... \$n\$ (one of \$3\$, \$4\$, \$6\$, or \$8\$), is the number of sides of a polygon: ...
stackexchange_codegolf
Background Complex floor is a domain extension of the mathematical floor function for complex numbers. This is used in some APL languages to implement floor ⌊, ceiling ⌈, residue |, GCD ∨, and LCM ∧ on complex numbers. For the rest of this challenge, an integer refers to a Gaussian integer, i.e. a complex number whose ...
stackexchange_codegolf
I wrote a code that separates the numbers from 1 to 9999 by comma void p(n){printf("%d,",n);if(n<9999){p(n+1);}}main(){p(1);} Is there a way to make this short code without using a repeat statement?
stackexchange_codegolf
Your job is to animate this circle illusion. It looks like the points rotating inside of the circle, but they are actually just moving in straight lines. Criterias The result has to be animated. The way you do the animation is irrelevant, it can generate a .gif, it can draw to a window, some device screen or whatever...
stackexchange_codegolf
Creating a golfing language can be hard. Let's help budding golfing language creators out and provide some helpful tips on how to create one. I'm looking for tips on: The design process Implementation Community engagement One tip per answer would be appreciated, and tips like "don't create a new language, use an exis...
stackexchange_codegolf
Given two positive reals \$a\$ and \$b\$, output some positive reals \$r_i\$, such that \$\sum r_i=a\$ and \$\prod\left(r_i+1\right)=b\$. You can assume that it's possible. You can also assume that your float type have infinite precision. Test cases: 2,3 => 2 2,4 => 1,1 or 1/2,(sqrt(57)+9)/12,(9-sqrt(57))/12 or etc. 2,...
stackexchange_codegolf
Here's a programming puzzle for you: Given a list of pairs of strings and corresponding numbers, for example, [[A,37],[B,27],[C,21],[D,11],[E,10],[F,9],[G,3],[H,2]], output another list which will have just the strings in the following manner: The total count of any string should be exactly equal to its corresponding ...
stackexchange_codegolf
This is inspired by an 05AB1E answer by Magic Octupus Urn. Given two arguments, a positive integer and a string/list of characters: Translate the number to base-n, where n is the length of the string. For each character, replace every appearance of the index of that character in the base-n number with that character. ...
stackexchange_codegolf
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 ...
stackexchange_codegolf
Introduction: Ever used Dropbox with some other people and you both modified the same file? Ever had a multi-user application with a relational database, and two people were modifying (or worse, one was deleting and the other modifying) the same object? Well, let's simulate that with this challenge (sort-of). For the s...
stackexchange_codegolf
You are the best and most famous hero of the area. Lately there have been rumors that a Hydra has been hanging out in a nearby ravine. Being the brave and virtuous hero that you are you figure you'll go check it out sometime later today. The problem with hydrae is that every time you try to cut off their heads some ne...
stackexchange_codegolf
This is my friend Thomas. He is half tree, half emoticon. | | | :D | | | He is lonely. Let's make him some friends! Given a text-based emoticon as input (e.g. ಠ_ಠ, :P, >_>, not , , or ), output the corresponding treemote. A treemote's length is how many characters it is lon (basically most builtin length functi...
stackexchange_codegolf
The new site header has some bits of source code from various questions as the background. Here are the first 3 lines: --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+. Hello, World! IT'S SHOWTIME TALK TO THE HAND "Hello, World!" YOU HAVE BEEN TERMINATED "9!dlroW ,olleH"ck,@ 72a101a+7aa+3a4...
stackexchange_codegolf
Your Programs: You'll write two programs (both in the same language). The storage program takes a string from STDIN and stores it somewhere persistent (see below) and then exits without error. The retrieval program takes no input, retrieves the string that was stored, and prints it to STDOUT. Objective test of Persiste...
stackexchange_codegolf
I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down the rabbit hole so let's start simple. Consider the following replacements: B or b = 8 E or e = 3 I or i = 1 S or s = 5 Let...
stackexchange_codegolf
Task In this challenge, your task is to write a program or function which takes an array of paths with an additional boolean indicating it is a file or directory and outputs a file/directory tree in any reasonable format. Remarks Some directories can end with a forward slash ("/") but this is not always the case A par...
stackexchange_codegolf
Near the middle of the semester in chemistry, we get problems like: Convert 1.283850057 to Scientific Notation and Convert 3.583✕106 to Standard Notation This is just stupid busy work for people who already know how to do this. So… The Challenge Given an input in any reasonable, convenient format, in either standar...
stackexchange_codegolf
The ECMAScript 6 standard added many new features to the JavaScript language, including a new arrow function notation. Your task is to write a basic ES6-to-ES5 transpiler. Given only an ES6 arrow function as input, output its ES5-compatible counterpart. It's code-golf! May the shortest program in bytes win! The Basics...
stackexchange_codegolf
Sandbox The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note....
stackexchange_codegolf
Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array [5,2,2,3] ^ [5,2,2,3] ^ [5,2,2,3] ...
stackexchange_codegolf
This is an interesting one. I have written a short program in objective-c to encode a string into a brainf_ck string, this is what it looks like: NSString *input; // set this to your input string NSMutableString *output = [[NSMutableString alloc] init]; int currentPosition = 0; for (int i = 0; i<[input length]; i++) { ...
stackexchange_codegolf
We often see music videos on Youtube. Many Youtube channels that host music videos are "powered by VEVO". Those can be easily identified by both embedding VEVO at their video thumbnails and appending VEVO to their channel name. Now write some code to test whether a string given by user is a VEVO user account or not. Re...
stackexchange_codegolf
Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two options: Draw the unique infinitely long straight line passing through points \$(x, y)\$ and \$(x', y')\$ Draw the uni...
stackexchange_codegolf
Given a positive integer, write it as the sum of numbers, where each of them is in \$\{kt|k\in{1,9,81},t\in{1,2,3,...,64}\}\$. How many numbers at least are used? Shortest code win. Samples: Input Output Method 1 1 1 2 1 2 64 1 64 65 2 64+1 72 1 72 343 2 342+1 576...
stackexchange_codegolf
About Hangul As I'm Korean, I'm really proud of Korean character, Hangul(한글). Hangul is a syllabary invented by King Sejong the great, 4th king of Joseon dynasty, in 1443. Because today (October 9th) is Hangul day in Korea, I'll give you a challenge: Make some Hangul ascii-art List of characters So, To make ASCII art, ...
stackexchange_codegolf
Church Subtraction Lambda calculus has always been a fascination of mine and the emergent behaviors of passing functions into each other is delightfully complex. Church numerals are representations of natural numbers contructed from the repeated application of a function (normally the unary addition of a constant). For...
stackexchange_codegolf
Your challenge is to construct a proper quine using as few distinct characters as possible. Scoring Your score is equal to the number of distinct characters in your code, aiming to minimise this. Standard quine rules apply.
stackexchange_codegolf
Context After attempting to program in Grass for the entire morning, you decide to go outside and mow some real grass. The grass can be viewed as a string consisting exclusively of the following characters: wWv. w denotes tall grass which takes \$ 1 \$ unit of energy to mow. W denotes extremely tall grass which takes \...
stackexchange_codegolf
Given one of the following inputs: Sweet Onion Chicken Teriyaki Oven Roasted Chicken Turkey Breast Italian BMT Tuna Black Forest Ham Meatball Marinara output a number from 1-7 (or 0-6) representing the day of the week that you get that deal, starting with Monday as the lowest number. Input can be all lowercase or uppe...
stackexchange_codegolf
Summer Klerance turned in her term assignment for this challenge. Her professor was miffed (but also amused) when he overheard a disgruntled classmate of Summer's saying she got her answers by simulation rather than by the probabilistic methods covered in the course. Summer received a note to see the prof during his ne...
stackexchange_codegolf
Leonardo of Pisa (ca. 1175 - ca. 1245) is better known as Fibonacci. But this is actually a short for the Latin "filius Bonacci" (the son of Bonacci) which was made up during the 18th century (according to Wikipedia). In this challenge, you'll be given an ordinal number (in the literal sense) between 1st and 20th and y...
stackexchange_codegolf
Let's have a ragged list containing no values, only more lists. For example: [[[],[[]],[],[]],[],[[],[],[]],[]] And the list will be finite, meaning that eventually every path terminates in an empty list []. It's simple enough to determine if two of these are structurally equal. Check each element in order for equali...
stackexchange_codegolf
Squares looks symmetric, and so are the required codes. Objective: Write a program whose source code is a solid square (N lines with N printable, non-whitespace characters each line) and prints a square of equal size. A program (or output) with inconsistent width and height is invalid. (e.g. 6x5) Example (HQ9+) QAA AAA...
stackexchange_codegolf
Challenge Given the equation of a line and the coordinates of the vertices of a shape, output the coordinates of the shape when reflected across the given line. Further Information The line's equation will be given with a y and an x separated by an equals sign (there may not always be a y and an x). Some examples: y=x ...
stackexchange_codegolf
Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -x2 can be expressed as ∫x∫111dtxdu. E := 1 | var | ∫EEEdvar Any reasonable input/output method is allowed. Examples: Your score will be the your code length...
stackexchange_codegolf
For today's challenge you have to take an input, and if your source code is reversed, then the input should be printed doubled. Let's say your source code is ABC and its input is xyz. If I write CBA instead and run it, the output must be any of be xyzxyz or xyz xyz or xyz xyz For any numerical input you should not mu...
stackexchange_codegolf
Challenge : Count the number of ones 1 in the binary representation of all number between a range. Input : Two non-decimal positive integers Output : The sum of all the 1s in the range between the two numbers. Example : 4 , 7 ---> 8 4 = 100 (adds one) = 1 5 = 101 (adds two) = 3 6 = 110 (adds two) = 5...
stackexchange_codegolf
Valve's KV file format is as follows (in pseudo-EBNF): <pair> ::= <text> <value> <value> ::= <text> | <block> <text> ::= "\"" <char>* "\"" <block> ::= "{" <pair>* "}" The parsing starts on <pair> state. Whitespace is allowed anywhere, but is only required between two consecutive <text> tokens ("a""b" is invalid, but "...
stackexchange_codegolf
The goal of this challenge is to print the following tongue twister: She sells seashells by the seashore, The shells she sells are seashells, I'm sure. So if she sells seashells on the seashore, Then I'm sure she sells seashore shells. This is more complicated than just calling your language's print equivalent. Since ...
stackexchange_codegolf
The following problem is a common interview question, thus dull answers are discouraged. Go short or creative, best if both: Create the following pattern ########### ## ## # # # # # # # # # # # # # # # # # # # # # # # # # # # ## ## ########### In case you cry "dupe", I see y...
stackexchange_codegolf
Challenge Description: An anagram is a word or phrase formed by rearranging the letters of another word or phrase. For example, "listen" and "silent" are anagrams. In this challenge, your task is to write a program or function that takes a list of strings as input and returns the unique anagrams. Write a program or fun...
stackexchange_codegolf
An Octothorpe, (also called number sign, hash or hashtag, or pound sign) is the following ASCII character: # Isn't that a fun shape? Lets make bigger versions of it! So here is your challenge: Given a positive integer N, output an ASCII hashtag of size N. For example, an ASCII hashtag of size 1 looks like this: # #...
stackexchange_codegolf
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the robbers' thread; the cops' thread is here. Robbers The cops will post abstract rewriting systems. Your task is to crack their submissions by proving that the target string either can or can not be reached from the source string by applying their...
stackexchange_codegolf
The task Write a program or function that given three strings A, B, C produces an output string where each instance of B in A has been recursively substituted with C. Recursively substituting means repeating a substitution where at each step all non-overlapping instances of B in A (chosen greedily from left to right) a...
stackexchange_codegolf