instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
In a now deleted stackoverflow question, someone posted the following: Write a program or function to print alternating patterns in * and # based on a given integer n. Some examples: Input: n=1 Output: * Input n=5 Output: *#### ###** ***## ###** *#### Input: n=8 Output: *####### ######** ***##### ####**** ****#### ##...
stackexchange_codegolf
Background The summary of a non-negative integer \$n\$ is the concatenation of all digits that appear in \$n\$ in increasing order, with each digit being preceded by the number of times it appears in \$n\$. Some Examples: n -> summary(n) 1221 -> 2122 (2 ones, 2 twos) 1212 -> 2122 (2 ones, 2 t...
stackexchange_codegolf
Write functions \$x(a)\$, \$y(a)\$ and \$z(a)\$ such that for any rational \$a\$ all functions return rational numbers and $$x(a) \times y(a) \times z(a) \times (x(a) + y(a) + z(a)) = a$$ You may assume \$a \ge 0\$ You do not need to use rational types or operations in your program, as long as your program is mathemati...
stackexchange_codegolf
In 1988, the International Mathematical Olympiad (IMO) featured this as its final question, Question Six: Let \$a\$ and \$b\$ be positive integers such that \$ab + 1\$ divides \$a^2 + b^2\$. Show that \$\frac{a^2 + b^2}{ab + 1}\$ is the square of an integer. (IMO problems) This can be proven using a technique called ...
stackexchange_codegolf
Without taking any input, output this exact text: A B A C B A D C B A E D C B A F E D C B A G F E D C B A H G F E D C B A I H G F E...
stackexchange_codegolf
Let's define a simple language that operates on a single 8-bit value. It defines three bitwise operations (code explanation assumes 8-bit value variable): ! Negate the least significant bit (value ^= 1) < Wrapping left-shift (value = value << 1 | value >> 7) > wrapping right-shift (value = value >> 1 | value << 7) In...
stackexchange_codegolf
The first Letters, Get Moving! was very popular, but had limited participation. This one will be easier to solve, but hopefully involve some tricks in golfing. You are given a string of only lowercase letters. For each letter, with position in the alphabet m, move it so it becomes the mth letter from the end. If the va...
stackexchange_codegolf
Generate the shortest possible code in any programming language that can generate all Pythagorean triples with all values not exceeding a given integer limit. A Pythagorean triple is a set of three integers \$(a, b, c)\$ that satisfy the equation \$a^2 + b^2 = c^2\$. The program should output the triples in any format,...
stackexchange_codegolf
You have a bunch of cities on a grid which you wish to link up. Roads can be placed on any tile that doesn't contain a city, and connect to all roads or cities adjacent to them, vertically, horizontally or diagonally. Roads can link up via cities, for example C \ C-C is fully linked up. However, there are some moun...
stackexchange_codegolf
Task You must write a program in Language A that will output the source code for a program in Language B which will then output the source code for a program in Language C and so on and so forth. The final program must output the x root y where x and y are the inputs e.g. in Python: print(int(input()) ** (1/int(input()...
stackexchange_codegolf
Isolated prime definition from Wikipedia: An isolated prime is a prime number p such that neither p − 2 nor p + 2 is prime. In other words, p is not part of a twin prime pair. For example, 23 is an isolated prime since 21 and 25 are both composite. Consider strings which consists of character x repeated n times, wher...
stackexchange_codegolf
Challenge Description: Write a program that asks the user for input. The user will enter Good or Bad. You do not have to support any other input. If the user enters Good, print Bad and vice versa (to stdout etc). Notes: 1) You cannot use any other pair of two words. 2) Your program only has to ask and print once. 3) Yo...
stackexchange_codegolf
The Matoran Alphabet is the alphabet used by many of the characters in the Bionicle universe. Your challenge is to create a program or function that takes a string as input and creates an image of the input written in the Matoran alphabet. The input will only consist of uppercase letters (A-Z), numbers (0-9), and spac...
stackexchange_codegolf
Given an input integer from 1, 2, ..., n, the task to write code to make a number as close as possible (as measured by absolute distance) to e using only the four mathematical operations +, -, *, / and parentheses (brackets). You can use any of the integers up to n once but don't have to use all the numbers and you are...
stackexchange_codegolf
The Zen of Python must surely be one of the most beautiful Easter eggs in any language. (It is created by writing import this) So why not create a version for your own language? For those who don't have access to Python 2 or 3, your code should output the following: The Zen of [YOUR LANGUAGE] Beautiful is better than ...
stackexchange_codegolf
The Challenge Your challenge is to write a program that evaluates the following function: f(x, t) = d^x / dt^x (sin t) That is, the x-th derivative of sin t. In case you aren't familiar with calculus, here is a table of derivatives for the sine function: ... f(-1, t) = -cos t f(0, t) = sin t f(1, t) = cos t f(2, t)= -s...
stackexchange_codegolf
Exposition Your mathematics teacher is a big fan of Vieta's formulas, and he believes that you should use them to solve quadratic equations. Given the equation ax^2 + bx + c = 0 the product of its roots is c/a, and their sum is -b/a. When all of a, b and c are nonzero integers, assuming the roots are rational numbers,...
stackexchange_codegolf
Input A string S of length between 2 and 30. The only letters in the string will be a or b. Output All strings within Levenshtein distance 2 of S. You must output all the strings without duplicates but in any order you like. Example If S = aaa then the output would be (in any order): aa abab ab aabba aaaa abaa bbaaa ab...
stackexchange_codegolf
This code-challenge is based on OEIS sequence A261865. \$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$. The goal of this challenge is to write a program that can find a value of \$n\$ that makes \$A261865(n)\$ as large as you can. A brute-force program ...
stackexchange_codegolf
Given a non-empty list/vector of positive integers, write a function to check the following conditions in as few bytes as possible. Take the first integer (the key, or k1) and check that the next k1 values have no duplicate values, excluding instances of k1. Take the last integer (the second key, or k2) and check tha...
stackexchange_codegolf
Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy value if it is the masculine version. For example, hen is the feminine version for chicken and rooster is the masculine...
stackexchange_codegolf
Your input is an array of integers in the range [-1,4]. An array element of -1 means that there might be a bomb in that position. A non-negative element means that there is not a bomb in that position and also the numeric value tells how many bombs there are within distance 2. For example, if we have the following arra...
stackexchange_codegolf
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever. Your task is to create a program that gives the next word in sequence giv...
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
I have a hardware that has a 32-bit input register. The register has the following characteristics: The 32-bit register consists of eight 4-bit fields. Each 4-bit field holds a value in signed-magnitude; it can hold an integer between -7 and +7 inclusive, including -0 and +0 (signed zeroes). For example, the hexadeci...
stackexchange_codegolf
I was looking for this page to help me enhance my first answer with SQLite, but I couldnt find one. So here we are! What general tips do you have for golfing in SQLite? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to SQLite. Please post one tip per answe...
stackexchange_codegolf
Challenge Given some input string, return a truthy value if it represents a correct roman numeral between 1 (=I) and 3999 (=MMMCMXCIX), and a falsey value otherwise. Details The input is a non-empty string that only comprises the characters IVXLCDM. The roman numerals (that we use here in this challenge) are defined a...
stackexchange_codegolf
Objective Write a full program that outputs (to STDOUT or closest alternative) an arbitrary string of text, no more than 64 characters long. Simple enough, right? Well, here's the catch: You may not use any characters that were present in the previous answer's output. That's right, none of them. Thus, you are trying to...
stackexchange_codegolf
Display the remaining battery charge, as a percentage of maximum charge Remember if you can't run your code on a phone, calculator, etc, you can probably install your environment on a laptop at least. If you absolutely can't run on a device that has a battery, then unfortunately your language isn't eligible since you h...
stackexchange_codegolf
Challenge Given an IPv4 address in dotted-quad notation, and an IPv4 subnet in CIDR notation, determine if the address is in the subnet. Output a distinct and consistent value if it is in the subnet, and a separate distinct and consistent value if it is not in the subnet. The output values do not necessarily need to be...
stackexchange_codegolf
Make a program (or a function) that copies the exact text "Hello, World!" to the clipboard, and terminates.
stackexchange_codegolf
Given an \$m \times n\$ matrix of integers A, there exist a \$m \times m\$ matrix P, an \$m \times n\$ matrix D, and an \$n \times n\$ matrix Q such that: \$A = P D Q\$. P and Q are unimodular matrices (i.e. matrices which are invertible and whose inverses are also integer matrices); D is diagonal; each diagonal entry...
stackexchange_codegolf
The goal is to calculate all the squares up to x with addition and subtraction. Rules: The code must be a function which takes the total number of squares to generate, and returns an array containing all those squares. You can not use strings, structures, multiplication, division, or built-in functions for calculating...
stackexchange_codegolf
Inspired by This answer to a Puzzling question Background - exponentiation by squaring If you don't want to read the background, or don't understand it, there's a worked example in Java, linked at the bottom of the post. \$a^{2^{x+1}} = a^{2^{x}} * a^{2^{x}}\$ Therefore to find \$a^b\$ (where \$a\$ and \$b\$ are base-1...
stackexchange_codegolf
This is a repost of this challenge Challenge There is an old, popular riddle: Find an English word with 8 letters that, taken away one letter, creates a new valid word. Repeat that until there are no letters left. Example solution: starting staring string sting sing sin in I Your task is to write a program, which t...
stackexchange_codegolf
Given an ascii-art road and the time it took me to cross it, tell me if I was speeding. Units Distance is in the arbitrary unit of d. Time is in the arbitrary unit of t. The road Here is a simple road: 10===== The 10 means 10 d per t. That is the speed limit for the road. The road has 5 =s, so its d is 5. Therefore, i...
stackexchange_codegolf
If we assign each letter a respective integer, starting from 1, then a is 1, b is 2, c is 3, and so on. After z, the letters loop back around, but with a in front (aa, ab, ac). It then goes to ba, bb, bc... After this is completed, as you may have figured, another letter is added (aaa, aab, aac). "Prime letters" would...
stackexchange_codegolf
Challenge Given two digits 0-9 as input, output a domino (from the double-nine domino set) with these number of pips (dots) on the two faces. The ten possible faces look like this (separated by pipes): | | o| o|o o|o o|o o o|o o o|o o o|o o o | o | | o | | o | | o |o o|o o ...
stackexchange_codegolf
In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions: push a positive number pop two numbers and push their sum pop two numbers and push their difference (second number - first number) pop a number and push it twice (dup) p...
stackexchange_codegolf
Adam West passed away, and I'd like to honor his memory here on PPCG, though I doubt he knew of our existence. While there are many, many different things that this man is known for, none are more prominent than his role as the original batman. I'll always remember my step-father still watching the old-school Batman an...
stackexchange_codegolf
In the classic days of Starbucks before these newfangled sticker-printers and wireless drivethrough headset palmtop scanner dealies, in the heady days of 2000-ish, Starbucks had a concise system for describing beverages with a strict syntax and accompanying encoded form. Vertically on the cup there are a series of labe...
stackexchange_codegolf
You know it: keyboard or mouse input is just too mainstream to create Random Numbers through human behavior. Create the most unique (Pseudo)Random Number Generator that create its numbers through human behavior. Web-API's are not restricted! Anyone should use the code provided, so any special hardware is restricted. (I...
stackexchange_codegolf
We've had challenges for SIGSEGV and SIGILL so why not... Write the shortest code that results in a Bus Error (SIGBUS) in any programming language. Your program can't call raise() or kill(getpid(),sig) or pthread_kill(pthread_self(),sig), or any other equivalent.
stackexchange_codegolf
I was surprised to not find this asked already, though there is a great question on darts checkouts: Darts meets Codegolf Your challenge is to calculate which scores are not possible with 'n' darts below the maximum score for 'n' darts. E.g. for n=3, the maximum possible score is 180 so you would return [163,166,169,17...
stackexchange_codegolf
A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...) You're given as input a nested, potentially ragged array of positive integers: [1, [[2, 3, [[4], 5], 6, [7, 8]], 9, [10, [[[11]]]], 12, 13], 14] Your task is to determine its depth, which is the greatest nesting-dep...
stackexchange_codegolf
Challenge Assume two vectors \$\mathbf{a} = (a_1,a_2,\cdots,a_n)\$ and \$\mathbf{b} = (b_1,b_2,\cdots,b_n)\$ are given in an \$n\$-dimensional space, where at least one of \$b_1,\cdots,b_n\$ is nonzero. Then \$\mathbf{a}\$ can be uniquely decomposed into two vectors, one being a scalar multiple of \$\mathbf{b}\$ and on...
stackexchange_codegolf
Given Google's recent announcement of official Kotlin support for Android development, I thought it might be timely to poll the community for some awesome golfing tips for this relatively new JVM language. Kotlin includes a unique combination of features among it's JVM siblings which makes it potentially attractive for...
stackexchange_codegolf
Write a program or function that draws a mountain range, where each subsequent larger mountain peak is "behind" the ones in front, and alternates which side is visible. This is a mountain range of size 1 /\ This is a mountain range of size 2 /\ /\ \ This is a mountain range of size 3 /\ / /\ / /\ \ This is a mou...
stackexchange_codegolf
*What is a transmogrifier? In the C programming language, there are formations called digraphs and trigraphs that are two and three characters sequences that evaluate to less common characters. For example, you can use ??- if your keyboard doesn't have ~. Given text, replace all instances of the following digraphs and ...
stackexchange_codegolf
Introduction I recently came across an oral exam where the candidates were asked to find a logical circuit than can negate 3 inputs A,B,C using only two NOT gates. The question also specified that such a circuit is unique up to removal of useless gates and reordering inputs/outputs. The candidates were asked to prove t...
stackexchange_codegolf
Here’s how to backspace-and-retype from one string to another: Start from the first string. Remove characters at the end until the result is a prefix of the second string. (This may take 0 steps.) Add characters at the end until the result equals the second string. (This may take 0 steps, too.) For example, the path ...
stackexchange_codegolf
Introduction Yesterday I saw a birthday puzzle. Congrats!! Also this week I watched an episode of the TV show Bones where a dead body was found buried under a tree. To calculate the time of death, they counted the tree rings. Tree rings form because trees grow slower during the winter and faster during the summer. Thus...
stackexchange_codegolf
Have you ever wanted to ask the compiler "Why?" Most of us have been frustrated when the code isn't working as it should. Mathworks has therefore implemented a nice little function, why, that answers the question. To give a few examples from MATLAB: why The programmer suggested it. why To fool the tall good and smart ...
stackexchange_codegolf
Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: +[]. Note: I'm not sure if this is possible. Scoring criterion: The number of bytes of code used. Why? I've set myself a challenge to be able to write code using only the above three char...
stackexchange_codegolf
Tallying is a simple counting system that works in base 5. There are various different tallying systems used around the world, but the one that is used in most English-speaking countries is perhaps the most simple - count units by marking vertical lines, then for each 5th mark put a horizontal line through the previous...
stackexchange_codegolf
Write a program/function that finds the amount of fuel needed to escape Earth's gravity well given the exhaust velocity of the fuel and the amount of mass to transport using the Tsiolkovsky rocket equation: $$\Delta v = v_\text{exhaust}\ln\dfrac{m_\text{start}}{m_\text{end}}$$ where \$\Delta v\$ is the change in veloc...
stackexchange_codegolf
Definition The infinite spiral used in this question has 0 on the position (0,0), and continues like this: 16-15-14-13-12 | | 17 4--3--2 11 | | | | 18 5 0--1 10 | | | 19 6--7--8--9 | 20--21... It is to be interpreted as a Cartesian plane. For example, 1 is on the position (1,0), and 2 i...
stackexchange_codegolf
An ant starts on an edge of a dodecahedron, facing parallel to it. At each step, it walks forward to the next vertex and turns either left or right to continue onto one of the other two edges that meet there. A sequence of left/right choices that returns the ant to its initial state (edge and direction) is called a rou...
stackexchange_codegolf
Your task today will be to take an existing file and append zeros to it until it reaches a certain size. You must write a program or function which takes the name of a file in the current directory f and a number of bytes b. While maintaining the original content of f, you must write zeroes (null bytes, not ascii 0s) ...
stackexchange_codegolf
Challenge Given a non-empty string S of length L consisting entirely of printable ASCII chars, output another string of length L that consists entirely of printable ASCII chars, but is not equal to S. For the purposes of this challenge, a printable ASCII char is one between U+0020 and U+007E, inclusive; that is, from ...
stackexchange_codegolf
Introduction Write a program or function that, given the coordinates of where a dart lands on a dartboard, return the score of that dart. Dart coordinates are given as two integers, x,y measured from the center of the dartboard, with millimeter precision. How to score a dart Darts is a game played by throwing a dart at...
stackexchange_codegolf
This challenge is in honor of the tacky Christmas lights at my in laws' house. The challenge is to create a graphical output showing the decoration in "real time". The video (gif or other format) will have n-by-m vertical and horizontal "lights". 5 <= m,n <= 40. The frame size and resolution may vary dependent on n a...
stackexchange_codegolf
Robbers thread In this thread, your task is to find a non-recursive solution which produces the same integer series of a submission not marked as 'safe' in the Cops' thread. Challenge synopsis In many languages, recursive functions can significantly simplify a programming task. However, the syntax overhead for a prope...
stackexchange_codegolf
Introduction A circle-tangent polynomial is a polynomial of degree \$N\ge3\$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the circle are considered tangent at their intersection points from inside as well. You may consider such polynomials are w...
stackexchange_codegolf
Input A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$. Output The output is obtained by applying successive rotations to the input string. For each letter ([a-zA-Z]) in the input string, going from left to right: if the letter is in upper case, rotate all characters before it by o...
stackexchange_codegolf
Challenge: Given a checkerboard, output the smallest amount of moves it would take (assuming black does not move at all) to king a red piece, if possible. Rules: Red's side will always be on the bottom, however their pieces may start in any row (even the king's row they need to get to). Black pieces are stationary, me...
stackexchange_codegolf
/o\ Jimmy has been receiving a lot of attention on this site recently and it has caused Jimmy to get a little stressed. The bodybuilder Jimmys /-o-\ started bad mouthing the OG / acrobat /o\ Jimmys saying they are way cooler because they are bigger. But of course the acrobat Jimmys thinks they are way cooler since afte...
stackexchange_codegolf
It seems flags are a trend now, so what better place to start an account? I thought bars could use a twist to them, so I found this flag. Produce the following in the console output the fewest possible bytes: +----------------------------------+ |XXXXX | |XXXXXXXX | ...
stackexchange_codegolf
Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat. What to implement Smokey's !!/alive command uniformly at random picks one of these messages: Yup You doubt me? Of course ... did I miss something? plz send teh coffee Watching this endless list of new question...
stackexchange_codegolf
Background Conway's Soldiers is a version of peg solitaire played on an infinite checkerboard. The board is initially full of pegs below an infinite horizontal line, and empty above it. Following the ordinary peg solitaire rules (move a peg by jumping over another one horizontally or vertically, removing the one that w...
stackexchange_codegolf
You are given an array A of non-negative integers. You can pick any non-empty subset, S from the array A. The score of a subset S is the sum of the elements in S raised to the power of K, i.e. for a subset S={s1,s2,…,sm}, the score of S is (s1+s2+…,sm)K. Output the sum of scores over all possible non-empty subsets of A...
stackexchange_codegolf
For any ragged list its dimensions will be a list of non-negative integers defined as follows: Elements that are not a list will have dimensions \$\textbf{[}\,\,\textbf{]}\$. An empty list has dimensions \$[0]\$. An \$n\$ dimensional list \$L\$ of length \$x\$ has dimensions \$x : k\$ where \$k\$ is the element wise m...
stackexchange_codegolf
Welcome Back to the Future's fans and enthusiastic codegolfers. Let's begin with this simple statement : Marty arrives in 2015 in one month (On october the 21st !). Therefore I propose we use the time remaining to pay him and the saga the best homage we can. Task Marty left for 2015 on October the 26, 1985. Thus, you ...
stackexchange_codegolf
This is the robbers' thread. The cops' thread goes here. Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made. The winner will be the robber that crac...
stackexchange_codegolf
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here This Challenge Given a bunch of rectangles, figure out whether or not they fill a rectang...
stackexchange_codegolf
This is a brainfuck version of Largest Number Printable, and this. Let's think about brainfuck interpreter such that, Has array that can be stretched left & right arbitrary large Each cell can contain arbitrary large integer Can contain negative integer too When the interpreter starts, every cell is intialized by ...
stackexchange_codegolf
Background This challenge is about the game of Go. Go is a game played on a board with a square grid N x N. You don't have to know how to play the game to do this challenge, but if you are interested, google "Tromp-Taylor rules" for a minimal and precise set of rules to play a full game. Let's use a 4 x 4 board. As the...
stackexchange_codegolf
A program ordinal is a (possibly transfinite) ordinal which can be assigned to programs in some language depending on their output. To be more specific: Strings that give no output have ordinal 0 Programs that output a program of ordinal n have ordinal n+1 Programs P0 outputting multiple programs P1, P2... Pn have ord...
stackexchange_codegolf
The Challenge The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard. This is code golf, so shortest solution in bytes wins! IO Input will be a single String of zero or more characters in the ASCII decimal range of 32-126 inclusive. You may ...
stackexchange_codegolf
You need to make a program, that when giving a list and a string, searches on the list for items that contains the string. Examples: Input: th [thing, awesome, potato, example] Output: thing (Because it starts with "th") Input: ing [thing, potato] Output: thing (Because it ends with "ing") Input: tat [thing, potato] ...
stackexchange_codegolf
Below on the left is a picture of a sorting network that can sort 4 inputs. On the right you can see it sorting the input 3,2,4,1. A sorting network of size n consists of a set of n horizontal wires where two wires can be connected by a vertical wire. The inputs to a sorting network move from the left to the right on ...
stackexchange_codegolf
Modern regular expressions (regexes) have many features (\d, {n,m}, \1, etc.), but to define a regular language (modern regexes can define broader classes of languages, in their defense), all you need are three operators: concatenation (+), union (|), and the Kleene star (*). Here are some examples: a - Matches the str...
stackexchange_codegolf
Sequel of this AWESOME challenge You, a genius tech prodigy detective, have successfully disarmed the bomb and want to break into the computer. The police found the password 67890-=yuiop[]hjkl;'\vbnm^&*()_+:"| on a piece of paper, but much of the keyboard is broken and there are no other ways of inputting characters. T...
stackexchange_codegolf
We already have a base conversion question, but not one with negative bases (nope, this doesn't count). (Corresponding wiki article.) You will receive a number (may be negative) and a base (must be negative), and your task is to convert the number into the base. The base will only be from -10 to -2. Specs You may rece...
stackexchange_codegolf
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded. However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2...
stackexchange_codegolf
Background The Italian definite article (corresponding to English the) has seven different forms: l', il, lo, gli, i, la, le. Which one to use depends on three variables: Gender: masculine / feminine. Number: singular / plural. Initial letter of the subsequent word: vowel / consonant type A / consonant type B. Vowel...
stackexchange_codegolf
33 is a simple esolang I created. You may have seen me use it in a few questions. You're not going to be writing a full interpreter. The interpreter you will be writing is for a simplified version of 33. This simplified 33 has two numeric registers: the accumulator and the counter. The accumulator holds all the post-ar...
stackexchange_codegolf
Inspired by this question. Challenge Let L be a list of n distinct elements. Let P be the set of all (unordered) pairs of positions in P. Let R be a result of applying a pair-swap operation on L by every pair in P in any order. Example: L = [1, 7, 8] P = {(1, 2), (0, 1), (0, 2)} L = [1, 7, 8] -> [1, 8, 7] -> [8, 1, 7] ...
stackexchange_codegolf
The scene is: Peter is at the gym with his buddy Brian when Brian suddenly is in dire need of his inhaler. Brian manages to tell Peter the code to his combination lock before he collapses on the floor. The moment Peter gets to Brian's locker and sees what the indicator is pointing at, Stewie ambushes him and sprays a f...
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 Rules Each submission must be a full program. The program must take input as two comma-separated dates in the form YYYY-MM-DD, and print the number of days that has passed since the second date to STDOUT as if today was the first date (if the second date would be in the future, output a negative number) plus an o...
stackexchange_codegolf
Given two integers, which may be negative, zero, or positive, \$a\$ and \$b\$ (taken in any reasonable format, including inputting a plain complex number), convert it to \$a + bi\$ where \$i\$ is the imaginary number (square root of negative one). Then, raise it to the power of a third (positive integer) input variable...
stackexchange_codegolf
Your task is to create a program where if any one character is deleted, it will detect which character was deleted and then re-insert the deleted character in its own source file. For instance, if your program is RadiationHardened and it is modified to RadiaionHardened, then your program must output that the 5th byte (...
stackexchange_codegolf
Premise: For those in networking, you've most likely sent a ping to or from some device to make sure everything's properly connected. Cisco, a popular company in networking[citation needed], has a command for it in their IOS that looks like this: (Image source) Your challenge is to graphically recreate a portion of t...
stackexchange_codegolf
Find a maximally profitable sequence of exchanges given an exchange rate table. As an example consider the currencies Ariary (your home currency), Baht, Cedi, and Denar where the rate from one to another (after any transaction rate has been levied) is given by the (row, column) entry in the exchange rate table below: ...
stackexchange_codegolf
Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in the following image. A triangle hole may appear in the middle, but that isn't a ...
stackexchange_codegolf
Create a program that generates a drum fill. Your program will output a pattern of L (left hand hits), 'R' (right hand hits), and K for kick drum hits. Rules The pattern must never have more than 2 of the same hits consecutively. The pattern must be loopable, so it mustn't have more than 2 of the same hits when it lo...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. There's a good news and a bad news. Good news: you got a Christmas present from Santa. (Already?! Christmas is two weeks away!) Bad news: the present is locked with a laser lock. And a note next to it says: Only the ones who can prope...
stackexchange_codegolf
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line. So the end-result becomes: cccccccccc oooooooooooo nnnnnnnnnnnnnn eeeeeeeeeeeeeeee mmmmmmmmmmmmmmmmmm ooooooo...
stackexchange_codegolf
The challenge is to write a deterministic program (any language/OS) which takes no arguments or other input and behaves differently in a debugger from how it behaves when not being debugged. For example, the program may output something when being debugged but not output anything when not being debugged. Or output some...
stackexchange_codegolf