instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
the goal Build an optimizing Brainfuck implementation. Whether it is a compiler, an interpreter, a JIT compiler, or whatever else is up to you. scoring A reference implementation (bfi) will be given. Each implementation will run the same program (mb.b) also given at the end. Your score is time spent to run `mb.b` trans...
stackexchange_codegolf
Dennis puts in a huge amount of effort for this community, including as moderator, language designer, and provider of TIO. Unfortunately, his four-year-old daughter has caught a cold, so let us all help him keep track of her recovery (may it be speedy) by providing him with a thermometer: .-----------. | | | ...
stackexchange_codegolf
Roman numerals can be (mostly) written in a one column format, because each letter intersects the top and the bottom of the line. For example: I, or 1 intersects both the top and bottom of the line, and V or 5 intersects the bottom and top lines, the top twice and the bottom at one place. The value of all roman numeral...
stackexchange_codegolf
Consider the following string: Tin Snips This string contains several atomic symbols on the periodic table. We could rewrite this string to identify several of them: [Ti][N] [Sn][I][P][S] Of course, we could also write it this way: T[In] [S][Ni][P][S] The rules for rewriting the input are as follows: The case of th...
stackexchange_codegolf
Yes, this is very similar to this question. However, that concerns infinite linked lists, and you do not need to handle out of bounds indexes in that question. You are in a strange city, looking for the fabled Nineteenth Bakery, where it is said they sell the most delicious deleted posts. The order of shops here is s...
stackexchange_codegolf
Imagine you are given an array/string containing \$5\$ letters of the English alphabet, with each letter having any value from A to Z (inclusive). Every day, each letter will perform a job, which can affect itself or other letters in the array. The letter's job is determined by the letter itself. Most letters are, due ...
stackexchange_codegolf
Introduction I have a room full of magic mirrors. They are mysterious artifacts that can duplicate any item, except another magic mirror. More explicitly, a duplicate version of the item will appear on the other side of the mirror, at the same distance. However, if there is another magic mirror in the way on either sid...
stackexchange_codegolf
What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in the given string. Take the character's ASCII value and subtract it by 48. Multiply the output value by 10. (The output at...
stackexchange_codegolf
Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next character in an occurence of the subtring in \$S\$. You are guaranteed that this substring occurs exactly once in \$S\$ and do...
stackexchange_codegolf
Repost and improvement of this challenge from 2011 A vampire number is a positive integer \$v\$ with an even number of digits that can be split into 2 smaller integers \$x, y\$ consisting of the digits of \$v\$ such that \$v = xy\$. For example: $$1260 = 21 \times 60$$ so \$1260\$ is a vampire number. Note that the dig...
stackexchange_codegolf
Task Given a positive integer n, output the joined compound of circles The circles are of square of size n+2 but removing the corner edges and the middle, before finally overlapping n times of itself E.g. 2 -> #### #### #### #### -> ## # # # # ## -> ## ## # # # # # # ## ## Testcases 1 -> # # # # 2 -> ...
stackexchange_codegolf
Challenge In this challenge, all numbers are in \$\mathbb{N}_0\$. Create a function or program that, when given a number \$N\$ and a tuple of \$k\$ numbers \$(n_i)\$ (all ≤ \$N\$), returns the number of ways \$N\$ can be written as a sum of \$k\$ integers (\$x_1 + x_2 + ... + x_k\$) such that \$n_i \le x_i \le N\$. The...
stackexchange_codegolf
Given a pattern representing a list of lengths, and a string representing those lengths, do they match? For those interested, this is question equivalent to verifying if a row or column of a Nonogram may be correct. However, I have omitted all language relating to Nonograms to make the question less confusing for those...
stackexchange_codegolf
The Jaccard index / similarity coefficient, also known as the Tanimoto index / coefficient, is a statistic used for gauging the similarity and diversity of finite sample sets. It was developed by Grove Karl Gilbert in 1884 for the field of weather forecasting [1] and later independently developed by Paul Jaccard [2] wh...
stackexchange_codegolf
A pangram is a string that contains every letter a-z of the English alphabet, case-insensitive. (It's OK if the pangram contains more than one copy of a letter, or if it contains non-letter characters in addition to the letters.) Write a program or function whose input is a list of strings, and which outputs one or mor...
stackexchange_codegolf
Consider the following probability puzzle. We start with a string of bits all set to 0. At each step we choose a bit uniformly and independently at random and flip it. The value your code has to compute is the probability of getting to the all 1s bit string before you get back to the all 0s bit string. Let \$n\$ be the...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. As we all know, Santa comes down the chimney to deliver presents to good kids. But chimneys are normally full of smoke, and the Elves are worried about Santa's health. So they decide to blow the smoke out using an electronic air blower...
stackexchange_codegolf
Your task is to create an interpreter for a calculator. It has to parse commands like 5 + 5 and return the answer. It has to be able to add, subtract, multiply, and divide. The interpreter only needs to accept two numbers (ex. 9 * 5 and 3 + 3) The interpreter will take input from a console/whatever, not a file. Eval is...
stackexchange_codegolf
The challenge Write a function that returns the nth element of an array even if its out of bound. function safeGet(index, arr) { const safeIndex = ??? return arr[safeIndex] } const arr = ["a", "b", "c"]; safeGet(0, arr) // "a" safeGet(1, arr) // "b" safeGet(2, arr) // "c" safeGet(3, arr) // "a" go back to the be...
stackexchange_codegolf
Wheat Wizard has once tried to come up with a parsing problem unsuitable for regex, but it failed due to Anders Kaseorg's Perl regex answer. This is the second attempt. Now that we know that Perl regex is far more powerful than we've imagined, this challenge aims to be un-golfy for it instead. Introduction A lambda ter...
stackexchange_codegolf
This is a repost of this challenge, intended to revamp it for looser I/O formats and updated rules You are to write a program which takes an integer polynomial in \$t\$ as input and outputs the Laplace transform of this polynomial. Some definitions and properties: The Laplace transform of a given function \$f(t)\$ is ...
stackexchange_codegolf
Task Given a positive integer n, draw the corresponding rocket. Examples From n = 1 to 4 the rockets are below. For your program's output, the trailing newline after a rocket is optional. | / \ *---* | o | | o | *---* /_\ | / \ / \ *-----* | o o | | o o | | o o | | o o | *-----* /___\ | / \ / ...
stackexchange_codegolf
Here, x (supplied as input) and n (the result of your computation) are both positive integers. n * x = n shifted. Find n. Here's an example of shifting: 123456789 -> 912345678 abcdefghi -> iabcdefgh (letters = any 0~9 digit) 123 -> 312 Shifting only happens once to the right. Shifting left, e.g. 123456789 -> 234...
stackexchange_codegolf
Task Given a finite permutation output its inverse. You may take input and output in any reasonable format equivalent to a list of natural numbers. You may choose to use 0 indexing or 1 indexing. Your input and output format should be the same. You may assume a permutation has at least 1 element. This is code-golf so...
stackexchange_codegolf
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ When printing to stdout, an optional trailing newline after y...
stackexchange_codegolf
Challenge description We've had a few challenges involving the Look-and-say sequence. Quick reminder: The sequence starts with 1, Subsequent terms of this sequence are generated by enumerating each group of repeating digits in the previous term, So the first few terms are: 1 "one" 11 "one one" (we look a...
stackexchange_codegolf
Your challenge is to create a clock that displays the time as a hex number, and the background color as the hex color code of the time. Requirements: No input. In the center of your output you should display the number sign and the current time in 24 hour format as "#hhmmss". The program should update to the current t...
stackexchange_codegolf
Related: Cleaning up decimal numbers Background A continued fraction is a way to represent a real number as a sequence of integers in the following sense: $$ x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{\ddots + \cfrac{1}{a_n}}}} = [a_0; a_1,a_2,\cdots,a_n] $$ Finite continued fractions represent rational number...
stackexchange_codegolf
I would like to generate (as a return result of a function, or simply as the output of a program) the ordinal suffix of a positive integer concatenated to the number. Samples: 1st 2nd 3rd 4th ... 11th 12th 13th ... 20th 21st 22nd 23rd 24th And so on, with the suffix repeating the initial 1-10 subpa...
stackexchange_codegolf
Your life could depend on this. Don't blink. Don't even blink. Blink and you're dead. They are fast. Faster than you can believe. Don't turn your back, don't look away, and don't blink! Good luck. Weeping Angels are an alien race that cannot move while being observed by another being (even another Angel). They feed ...
stackexchange_codegolf
Not to be confused with Is my OS 32-bit or 64-bit. This one is very simple, tell me whether or not my CPU supports 64-bit instructions. If my CPU supports 32-bit instructions, print '32', if my CPU supports 64 bit instructions, print '64', if my processor naitively supports other lengths of instructions, print 'other'....
stackexchange_codegolf
Given an array of integers, find "the next to the middle". The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is neither the mean, median or mode and is also contained in the array. For example, in the following array [ 7, 5, 2, 8, 0, 2, 9, ...
stackexchange_codegolf
A \$k\$-hyperperfect number is a natural number \$n \ge 1\$ such that $$n = 1 + k(\sigma(n) − n − 1)$$ where \$\sigma(n)\$ is the sum of the divisors of \$n\$. Note that \$\sigma(n) - n\$ is the proper divisor sum of \$n\$. The sequence of \$k\$-hyperperfect numbers begins $$6, 21, 28, 301, 325, 496, 697, \dots$$ This ...
stackexchange_codegolf
Moderator note: https://strawpoll.me has officially shut down, and the linked API no longer appears to work or provide data. Therefore, new answers cannot actually do the task and so the challenge has been closed to prevent any new answers. Strawpolls are great, and we use them in chat all the time for getting opinio...
stackexchange_codegolf
Challenge Create a program that will build a recursive list of all linked webpages (given a starting point), to a depth determined by user input. Any valid link in the HTML should be crawled, whether or not it is a script, image, etc. Example Input <program name> <url to crawl> <depth> webcrawler http://crawlthissite.c...
stackexchange_codegolf
Given \$n, m\ge 1\$. There are \$n\$ balls. Do \$m\$ moves, each choose a ball (maybe also the first one), and exchange with the one currently on the first place. At the end, the order of balls should be the same as the initial state. You can either output all possibilities, or a random one provided all possibilities h...
stackexchange_codegolf
Santa's Decision: In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get coal or toys. But unfortunately, Santa is unorganised, in some of his entries, the naughty, nice and name fields are in the wrong order. Input Input will come in the follo...
stackexchange_codegolf
Create a program that outputs "Hi, Hello!" in k bytes. By altering n bytes, the code should output all odd numbers in the range 5 <= x <= 25. Changing another m bytes should result in a code that prints the following frame in ASCII-art: +-+ | | +-+ Change another o bytes, and print Hello, bye!. m, n and o are calculat...
stackexchange_codegolf
A Walsh matrix is a special kind of square matrix with applications in quantum computing (and probably elsewhere, but I only care about quantum computing). Properties of Walsh matrices The dimensions are the same power of 2. Therefore, we can refer to these matrices by two's exponent here, calling themW(0), W(1), W(2)....
stackexchange_codegolf
Your task is, given a positive integer n, to generate an expression that equals the number n. The catch is: you're only allowed the number 1 in the output. The operators at your disposal are: +, -, * and / / is floating-point division (so 5/2 = 2.5). sqrt (as s) ceil and floor (as c and f respectively) ! (factorial...
stackexchange_codegolf
Given a distance in meters as an integer \$60\le d \le 260\$, return the number of clubs that may be used according to the following arbitrary chart, where both \$min\$ and \$max\$ are inclusive: club | min | max ----------------+-----+----- Driver | 200 | 260 3-wood | 180 | 235 5-wood ...
stackexchange_codegolf
This was related to a program I am writing. Although the title is simple, the challenge is a lot more complicated. Your challenge You must write a program that takes an input, and your answer must match the sample outputs in this question. What the program should be is that you must output "HelloWorld" with the length ...
stackexchange_codegolf
In this challenge about prefix code, we learnt that prefix codes are uniquely concatenable. That means, they can be joined together without separator, and without ambiguity. For example, since [1,2,45] is a prefix code, I can join them together without separator as such: 1245245112145, and there will be no ambiguity. H...
stackexchange_codegolf
Children are very good at classifying objects and counting them. Computers seem to have more trouble. This is a simplified version of this problem. Can you write a small program that can classify and count objects in an image? The problem: Given an image containing one or more circles and rectangles, return 2 integers ...
stackexchange_codegolf
Challenge: Print the entire printable ASCII charset (not just a range!) in order. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Rules: read closely No other characters allowed in the output. Program/function does not accept input. Try not to hardcode/embed the outpu...
stackexchange_codegolf
The Challenge Given an integer input, return the first Fibonacci number that contains the input within itself along with the index of that Fibonacci number (indexes starting at 0 or 1 - up to you, but please mention which in your answer). For example, if given the input of 12, the program would return 26: 121393 as 12 ...
stackexchange_codegolf
In this challenge, your bot has landed on an island with the stereotypical knights and knaves. Knights always tell the truth, and knaves always lie. The objective is to find the correct 32 digit hexadecimal string before anyone else, by asking knights and knaves and trying to trick other bots into giving you answers or...
stackexchange_codegolf
Hearts is a 4-player game that uses the following scoring rules: Everyone starts with score 0. Each round every player gets a non-negative amount of points. The sum of the points is 26, and at least one player gets 13 or more points.1 The points are then added to the players' score except if a player gets 26 points. I...
stackexchange_codegolf
(l, r) defines a line whose left end is at l and the right end is at r, on a 1-dimensional space. Given 2 lines b = (0, bz) and f = (i, i + fz), v = (l, r) is the overlapping part of these lines. When b and f do not overlap (when v cannot have a positive length), v = (0, 0). (input) -> (output) bz, fz, i -> l, r The...
stackexchange_codegolf
The title is pretty self-explanatory, isn't it? Your task is to output the alphabet (the string "abcdefghijklmnopqrstuvwxyz") to STDOUT, using each and every letter of the alphabet in your program once and only once. Oh, and for a bit of extra fun? The letters "g", "o", "l" and "f" must be in order (just for the code t...
stackexchange_codegolf
New Posts and New Sandbox Posts are chatbots that occupy CGSE's main chatroom, The Nineteenth Byte. They've been doing their jobs for almost one full year now, so I thought I'd make a challenge to honor their contributions! The challenge is simple: Draw the profile picture of either New Posts (NP) or New Sandbox Posts ...
stackexchange_codegolf
Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado) Your task is simple, given a positive integer n, output the spiked building to size n Testcases 1 -> ^ /|\ /.|.\ /..|..\ _______ 2 -> ^ ^ /|\/|\ /.|..|.\ /..|..|..\ __________ 7 -> ^ ^ ^ ^ ^ ^ ^ /|\/|\/|\/|\/...
stackexchange_codegolf
Given two strings \$ A \$ and \$ B \$ and a positive integer \$ n \$, determine whether \$ B \$ is composed entirely of (possibly overlapping) strict substrings of \$ A \$ of a length of at least \$ n \$. Test cases n A B Output ----------------------------------------- 2 abcdefg ...
stackexchange_codegolf
Given a position with a row of rooks and/or empty spaces, output how many different rook moves are possible. A rook can move left or right to an empty space, but not to one that requires passing over another rook. When a rook moves, the other rooks remain in place. For example, from this position, 6 moves are possible:...
stackexchange_codegolf
Given a string containing only the characters -, |, + and newline determine the longest straight line contained in it. A straight line is either an uninterupted run of -s and +s in a single row or an uninterupted run of |s and +s in a single column. So for example: | | ---- | --+-- ...
stackexchange_codegolf
Six is a number perfect in itself, and not because God created all things in six days; rather, the converse is true. God created all things in six days because the number six is perfect. I am fascinated by numbers. As were Sophie Germain and Marin Mersenne. To be more specific, these two were fascinated by primes: a ...
stackexchange_codegolf
This challenge is inspired by this other challenge, which you may want to read first for some context. However, a competitive answer is likely to look very different, so after reading some posts on Meta I decided it was best posted as a separate question. The goal here is to write a polyglot program; that is, a program...
stackexchange_codegolf
The challenge here is simple, and not at all about byte-count. Your job is to output the first 50 characters of the previous quine's source code, concatenated with the first 50 characters of yours starting with the 50 characters I've placed below: abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY So, lets take an exa...
stackexchange_codegolf
Determining whether a Turing machine halts is well known to be undecidable, but that's not necessarily true for simpler machines. A Foo machine is a machine with a finite tape, where each cell on the tape has an integer or the halt symbol h, e.g. 2 h 1 -1 The instruction pointer starts by pointing to the first cell: 2 ...
stackexchange_codegolf
Background A binary tree is a rooted tree whose every node has at most two children. A labelled binary tree is a binary tree whose every node is labelled with a positive integer; moreover, all labels are distinct. A BST (binary search tree) is a labelled binary tree in which the label of each node is greater than the l...
stackexchange_codegolf
Write a program or function that given a string (or your language's equivalent), determine if the string is a word, or not, and output a truthy or falsy value. (This is not a duplicate of Is this even a word? The incorrect words are generated in a very different way that I believe makes this a completely different chal...
stackexchange_codegolf
Dedicated to Martin Gardner, taken from his book Background In the old days, the Slavs had a divination method for finding out whether a girl would get married. The girl would clutch six straws in her hand so that the ends would poke out the top and bottom of her fist. Then her friend would join together the ends of pa...
stackexchange_codegolf
In LLAMA, you want to dump cards from your hand as quickly as you can, but you might not be able to play what you want. Each player starts a round with six cards in hand; the deck consists of llama cards and cards numbered 1-6, with eight copies of each. On a turn, the active player can play a card or draw a card. To p...
stackexchange_codegolf
A long period prime is a prime number \$p\$ such that decimal expansion of \$1/p\$ has period of length \$(p-1)\$. Your task is to output this number sequence. For purposes of this challenge we will consider only odd primes. Period of a decimal expansion of a rational number is the smallest period \$k\$ that makes the ...
stackexchange_codegolf
The goal is to raise the error message with the most bytes! The error message may not be generated by the program itself, such as Python's raise. errors that do not terminate the program are not allowed unless they do not show an error message. Here is an example in python that raises 243041 bytes of error code: def a(...
stackexchange_codegolf
Your challenge is to expand some brackets in a program's input as shown: Find a string s between two matching brackets [ and ], with a single digit n after the closing bracket. Remove the brackets. Replace s with itself repeated n times. (If n is 0, simply remove s.) Go to step 1 until there are no more matching brack...
stackexchange_codegolf
Context In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we need in order to have a sound train. Task Given the sequence of function arities in the train, determine if the train is va...
stackexchange_codegolf
Challenge You are given an array \$a\$ of integers. With a move you can increase or decrease an element of the array by 1. Your task is to equalize the array, that is make all the elements of the array equal by performing some moves. But that's not enough! You also want to make as few moves as possible. Input A non-em...
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
In the webcomic Darths & Droids, Pete, who plays R2-D2 in the fictional roleplaying campaign around which the comic is based, once claims (warning: potential spoilers in the linked comic) that, with the Lost Orb of Phanastacoria rigged up to his shock probe, he can now dish out a whopping 1048576d4 of damage. (The GM h...
stackexchange_codegolf
Background: The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely decision-problem repost of the challenge. Challenge Given a positive integer through any standard input format, distinguish between wh...
stackexchange_codegolf
You will be given a positive, whole number (that will never contain a 0) as input. Your task is to check whether it is a Lynch-Bell number or not. A number is a Lynch-Bell number if all of its digits are unique and the number is divisible by each of its digits. In fact, there are actually only 548 Lynch-Bell numbers, s...
stackexchange_codegolf
In chess, a knight can only move to the positions marked with X relative to its current position, marked with ♞: A Knight's Graph is a graph that represents all legal moves of the knight chess piece on a chessboard. Each vertex of this graph represents a square of the chessboard, and each edge connects two squares th...
stackexchange_codegolf
Introduction and credit Assume you're a bartender. You have many happy people in your bar at most times, but many only ever drink the very same drink and too few for your taste and you want to change that. So you introduce a system where the price of a drink is variable, depending on how many have already been sold, bu...
stackexchange_codegolf
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the...
stackexchange_codegolf
I call this sequence "the Jesus sequence", because it is the sum of mod.</pun> For this sequence, you take all the positive integers m less than the input n, and take the sum of n modulo each m. In other words: $$a_n = \sum_{m=1}^{n-1}{n\bmod m}$$ For example, take the term 14: 14 % 1 = 0 14 % 2 = 0 14 % 3 = 2 14 % 4 =...
stackexchange_codegolf
A Hamiltonian path in a graph is a path that visits each vertex exactly once; a Hamiltonian cycle is a Hamiltonian path that is a cycle – the path forms a simple closed loop. In this challenge the graph will be a n x n grid, where n is an even number greater than 2. Here is an example of a Hamiltonian cycle on 12x12 re...
stackexchange_codegolf
You are trying to guess my emotion. I will give you an adjective, as the input to the function/program. Your task is to output my emotion, either :) for happy, or :( for sad. Details For these adjectives, you must output the happy face :) contented delighted merry overjoyed pleased blessed chipper content convivial gle...
stackexchange_codegolf
Write a program that takes in an odd length string containing only the characters . and :. With the aid of an initially empty stack, generate a number from this string as follows: For every character c in the string (going from left to right)... If c is . and the stack has less than 2 elements, push 1 on the stack. If...
stackexchange_codegolf
This will be a bit of a different challenge. Back in 2023, I developed a 2D esolang called Electra, and looking back at my hello world program, (which is 582 bytes by the way) I see a lot of room for golfing. There are some topics that aren't covered in the spec, e.g. in which order the currents are generated/interpret...
stackexchange_codegolf
In the English language, a surefire way to make a pronounceable nonsense letter combination is to make it entirely out of consonant-vowel pairs, e.g., Wu ko pa ha, or, Me fa ro, consonant first, followed by vowel. Challenge: Write a program or function that will, given a user-specified number of letters, create a rando...
stackexchange_codegolf
For a given positive integer, try to find out the smallest possible rotation resulted by rotating it 0 or more bits. For example, when the given number is 177, whose binary representation is \$10110001_{(2)}\$: \$ 10110001_{(2)}=177 \$ \$ 01100011_{(2)}=99 \$ \$ 11000110_{(2)}=198 \$ \$ 10001101_{(2)}=141 \$ \$ 00011...
stackexchange_codegolf
Given an integer n >= 1 as input, output a sample from the discrete triangular distribution over the integers k, for 1 <= k <= n (1 <= k < n is also acceptable), defined by p(k) ∝ k. E.g. if n = 3, then p(1) = 1/6, p(2) = 2/6, and p(3) = 3/6. Your code should take constant expected time, but you are allowed to ignore o...
stackexchange_codegolf
Dowker notation is a common way of representing mathematical knots. Dowker notation can be derived from a knot diagram in the following way (based on the description from the wikipedium): We will label each of the \$n\$ intersections with two numbers whose absolute value is on the range \$1, \dots 2n\$ (one odd one ev...
stackexchange_codegolf
In this challenge you will be determining how controversial a vote is, given an array of other votes, by figuring out a number called the C-factor. What is the C-factor, you ask? Well, imagine you've got multiple votes on an election. We'll use 1 and 0 for the sake of the challenge to represent two different candidates...
stackexchange_codegolf
This challenge is pretty simple: you need to alert / print / show to the user the text "beep boop bop" (or "beep\nboop\nbop", with newlines), but it needs to be obfuscated. (where you couldn't see anything saying "beep", "boop", or "bop"). Points are calculated where your point value is in characters (not bytes)
stackexchange_codegolf
It's August 10th, 2019, but your task still involves Y2K. Weird, right? Create a program that prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a t...
stackexchange_codegolf
It is currently December 31, 2015, 11:59:00pm, and you must be at least 1324900 seconds old to be able to go to the New Year Celebration. Given the year, month, day, hour, minute, and second of your birth, determine if you are old enough to go. Notes: Assume that you are in the same timezone. Leap years are every 4 ye...
stackexchange_codegolf
This is the robbers' thread. For the cops' thread, click here. Cops' Task For the cops' thread, click here. Robbers' Task Find an uncracked submission on the cops' thread. (A submission may only be cracked once.) Unscramble the code to find a working quine. Post an answer on the robbers' thread. Include the language, ...
stackexchange_codegolf
Following this question: Tut-tut-tut-tut-tut Write a program that writes "tut-tut-tut" without using the characters "t", "u" or "-" in the code itself. This is code golf, shortest code in bytes wins.
stackexchange_codegolf
At runtime, keep prompting for a line of input until the user inputs something (other than an empty newline), i.e. does not just press Enter or OK. Output or result is neither required nor prohibited. Pseudo-code 1 myform = new form("GUI") myform.mytxt = new editfield("") myform.ok = new button("OK") repeat waitfor(m...
stackexchange_codegolf
Given a number x, find the sum of all primes up to that number. The input will always be a positive number, bigger than 2. An upper limit isn't defined, so data types can be ignored. Use whichever you want. This is a code-golf, so the shortest code in bytes wins. Example for 5: 2 + 3 + 5 = 10 Test cases: Input Ou...
stackexchange_codegolf
Problem A fact you may have noticed about factorials is that as \$n\$ gets larger \$n!\$ will have an increasing number of \$0\$s at the end of it's base \$10\$ representation. In fact this is true for any base. In this challenge you will be given a base \$b > 1\$ and an integer \$n > 0\$ and you will determine the sm...
stackexchange_codegolf
I'm letting this one out of the sandbox. Hopefully it is well-written and make sense, feel free to improve. So in order to make 1+ more popular (and ease the creation of golfed 1+ text-printing programs) here comes the metagolf challenge: The 1+ Language 1+ is a fun deque-based esolang where 1 is the only literal, and ...
stackexchange_codegolf
I didn't invent this challenge, but I find it very interesting to solve. For every input number, e.g.: 4 Generate a range from 1 to that number: [1 2 3 4] And then, for every item in that list, generate a list from 1 to that number: [[1] [1 2] [1 2 3] [1 2 3 4]] Then, reverse every item of that list. [[1] [2 1] [3 2...
stackexchange_codegolf
Today is Halloween and it's time to carve some pumpkins! & ((^.^)) Given an input integer, string, list of integers, etc., output the corresponding pumpkin. The input will always be of the form Stem, Eyes, Mouth, Width. For example, 2331 would be a valid input. The pumpkin takes the form: S ((EME)) where S is t...
stackexchange_codegolf
Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday). Your challenge is to display the number of days my estimates are off by. Challenge Given a day of the week I think it is, and the day of the week it actually is, output/return the number of days betwe...
stackexchange_codegolf
For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input. If P receives character K, P says how many times K appeared in Q. (You can use any output format for P or Q; they need not be the same, the only requirement is that your format can represent any n...
stackexchange_codegolf
Given a list of date ranges r as input, output or return any ranges not found in r. For the sake of this example, input will be in YYYY-MM-DD format. Let's say you have three date ranges: [2019-01-01, 2019-02-01] [2019-02-02, 2019-04-05] [2019-06-01, 2019-07-01] You can see that there is a gap in between 2019-04-05 an...
stackexchange_codegolf
The Puzzle You have to write a program or function p(n) that returns the square of what is entered into it and you may assume that the input is a non-negative integer. Put in simpler terms, return n2. Rules You are not allowed to use * or / (or any other power or square root operator, such as POW or SQRT, if your lang...
stackexchange_codegolf