messages
listlengths
2
21
[ { "role": "user", "content": "In Berland each feudal owns exactly one castle and each castle belongs to exactly one feudal.\n\nEach feudal, except one (the King) is subordinate to another feudal. A feudal can have any number of vassals (subordinates).\n\nSome castles are connected by roads, it is allowed to...
[ { "role": "user", "content": "A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road.\n\nWe assume that the action takes place on a Cartesian plane. The he...
[ { "role": "user", "content": "A sequence of non-negative integers a_1, a_2, ..., a_n is called growing if for all i from 1 to n - 1 all ones (of binary representation) in a_i are in the places of ones (of binary representation) in a_{i + 1} (in other words, a_i \\:\\&\\: a_{i + 1} = a_i, where \\& denotes [...
[ { "role": "user", "content": "Kids-related intro\nWhenever I take my kids to an amusement park, the kids get more nervous the closer we are to the park, with the nerve peak when we are in the parking lot and find no place to park. So I've decided I need a method to find the closest free parking space to min...
[ { "role": "user", "content": "The picture:\n\n\nSick of the same old grid where the answer is simply a square pyramidal number?\nAccept the challenge and write a program that given a positive integer \\$n\\$ counts how many squares are in the \\$n^{\\text{th}}\\$ iteration of the Harter-Heighway dragon!\n\n...
[ { "role": "user", "content": "I am quite surprised that a variant of linear regression has been proposed for a challenge, whereas an estimation via ordinary least squares regression has not, despite the fact the this is arguably the most widely used method in applied economics, biology, psychology, and soci...
[ { "role": "user", "content": "There is a forest that we model as a plane and live n rare animals. Animal number i has its lair in the point (x_{i}, y_{i}). In order to protect them, a decision to build a nature reserve has been made.\n\nThe reserve must have a form of a circle containing all lairs. There is...
[ { "role": "user", "content": "Definition:\n\nA number m is called a primitive root of a prime p the condition that the smallest integer k for which p dividies mk-1 is p-1\n\nYour task\nGiven a tuple (a,b) of positive integers, return the fraction:\n(number of primes p equal to or less than a which has b as...
[ { "role": "user", "content": "A superior highly composite number is an integer where the ratio of its count of divisors to some power of the number is as high as possible. Expressing this as a formula:\nLet d(n) be the number of divisors of n, including the number itself. For a given integer n, if there exi...
[ { "role": "user", "content": "Given a \\$n\\$-dimensional vector \\$v\\$ with real entries, find a closest permutation \\$p\\$ of \\$(1,2,...,n)\\$ with respect to the \\$l_1\\$-distance.\nDetails\n\nIf it is more convenient, you can use permutations of \\$(0,1,...,n-1)\\$ instead. If there are multiple clo...
[ { "role": "user", "content": "After a wonderful evening in the restaurant the time to go home came. Leha as a true gentlemen suggested Noora to give her a lift. Certainly the girl agreed with pleasure. Suddenly one problem appeared: Leha cannot find his car on a huge parking near the restaurant. So he decid...
[ { "role": "user", "content": "Let \\$R, C\\$ be positive integers and let \\$0 < s \\leq 1\\$. Consider the \\$R \\times C\\$ matrix \\$\\mathbf M\\$ defined as\n\\begin{equation}\nM(i,j) = \\frac{\\mathrm{mod}\\,(j, i^s)}{R^s}, \\quad i = 1, \\ldots, R, \\quad j = 1, \\ldots, C\n\\end{equation}\nwhere \\$\...
[ { "role": "user", "content": "Let's assume that\n$$\nf(x) = \\frac{Ax+B}{Cx+D}\n$$\nWhere, \\$x\\$ is a variable and \\$A\\$,\\$B\\$,\\$C\\$,\\$D\\$ are constants.\nNow we have to find out the inverse function of \\$f(x)\\$, mathematically \\$f^{-1}(x)\\$, To do this first we assume,\n$$\ny = f(x)\n\\\\\\ri...
[ { "role": "user", "content": "(related)\nYour challenge is to output the highest number you can. You can output as a number or as a string. You must output something that matches the regex ^\\d+$, as in only 0-9. \nThe Twist\nYour source code must be:\n\nSame forwards and backwards\n3 bytes long\nThe middle...
[ { "role": "user", "content": "Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining exactly two squares at their edges.\nExamples\nFor the pattern on the left, O...
[ { "role": "user", "content": "The new site header has some bits of source code from various questions as the background. Here are the first 3 lines:\n--<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.<<-..<<.<+.>>.>>.<<<.+++.>>.>>-.<<<+. Hello, World! IT'S SHOWTIME TALK TO THE HAND \"Hello, World!\" YOU HAVE BEEN TE...
[ { "role": "user", "content": "Given an integer N. Your task is to find the number of binary strings of length N having no consecutive 1s.\nAs the number can be large, return the answer modulo 10^9+7.\nExample 1:\nInput:\nN = 3\nOutput:\n5\nExplanation:\nAll the binary strings of length 3 having\nno consecut...
[ { "role": "user", "content": "This is a different type of compression challenge. In a normal kolmogorov-complexity challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you wish. What's the catch? Your score is penalized based on how wrong your outp...
[ { "role": "user", "content": "Input: a whole positive number greater than 4\nOutput: A whole positive number that describes the highest possible period an oscillator could have inside a square space of size (input)x(input) in a \"life\" grid that follows the rules of Conway's Game of Life. The oscillator ne...
[ { "role": "user", "content": "It is vacation time and Panda is in his hometown Pandaland. Panda is very bored so he started studying some interesting properties of natural numbers. Some days later he meet his friend Agham, who is pretty good in mathematics and tells him about interesting properties of natur...
[ { "role": "user", "content": "Setup\nTake the following 4x4x4 cube along with a 2D view of 3 of its faces, with a common 1x1x1 cube highlighted:\n\nThe arrows represent the points of view that generated the V1, V2 and V3 faces drawn underneath the big cube.\nGiven an arrangement of some 1x1x1 cubes inside t...
[ { "role": "user", "content": "In this challenge, all bots are wizards. At the beginning of each round, they create a wand which has a certain chance of successfully stunning another wizard. They then fight, by choosing one bot to attack in each turn. The last bot remaining wins.\nResults\n500 games, 1000 ro...
[ { "role": "user", "content": "A generalization of BΓ©zier surfaces, called the S-patch, uses an interesting scheme for indexing its control points.\n\nIn the case of an n-sided surface of degree d, each index has n non-negative integers that sum to d, and all possible configurations are used.\n\nFor example,...
[ { "role": "user", "content": "Part of Advent of Code Golf 2021 event. See the linked meta post for details.\nThe story continues from AoC2018 Day 3.\nBut you're not Bubbler, you're Lyxal! yeah, I know.\n\nAfter a long period of chaos, the Elves have finally agreed on how to cut the fabric. Unfortunately, th...
[ { "role": "user", "content": "Let us define a function `f`such as:\n\n- (1) for k positive odd integer > 2 : \n\n\n\n- (2) for k positive even integer >= 2 : \n\n\n\n- (3) for k positive integer > 1 : \n\n\n\n\nwhere `|x|` is `abs(x)` and Bk the kth Bernoulli number.\n\n`f` is not defined for `0, 1, -1`. Th...
[ { "role": "user", "content": "Petya is an unexperienced programming contestant. Recently he has come across the following problem:\n\nYou are given a non-directed graph which consists of n nodes and m edges. Your task is to determine whether the graph contains a Hamiltonian path.\n\nPetya wrote a quick bug-...
[ { "role": "user", "content": "The challenge\nThe plastic number is a number related to the golden ratio, with many interesting mathematical properties. As such, there are many approaches that can be used to calculate the number.\nIn order to precisely specify the number for the purposes of this challenge, w...
[ { "role": "user", "content": "Given a positive integer \\$n\\$ output the integers \\$a\\$ and \\$b\\$ (forming reduced fraction \\$a/b\\$) such that:\n$$\\frac a b = \\prod ^n _{k=1} \\frac {p^2_k - 1} {p^2_k + 1}$$\nWhere \\$p_k\\$ is the \\$k\\$ th prime number (with \\$p_1 = 2\\$).\nExamples:\n1 -> 3,...
[ { "role": "user", "content": "This is the cops' thread. The robbers' thread is here.\nYour challenge is to make a program that runs forever without halting1, unless it gets a particular input or inputs2. If it receives that input, it must terminate in a finite amount of time3. This is code-golf, so the shor...
[ { "role": "user", "content": "Input\nA string S of length between 10 and 16 inclusive. The characters are taken from the 95 printable ASCII characters, byte values 32 (0x20) to 126 (0x7E) ( to ~)\nOutput\nYour code must compute and output all strings within Levenshtein distance 2 of S. You can have duplica...
[ { "role": "user", "content": "Teiji is a number theory lover. All numbers are his friends - so long as they are integers. One day, while preparing for the next class as a teaching assistant, he is interested in a number-theoretical function called the divisor function. The divisor function Οƒ(n) is defined a...
[ { "role": "user", "content": "This is a cops-and-robbers challenge, the cops' thread is here\nYou can change the word code into golf by changing a letter at a time in four steps:\nCODE\nCOLE\nCOLD\nGOLD\nGOLF\n\nToday, we’ll be doing the same thing with programs.\nYour challenge is to crack an answer on the...
[ { "role": "user", "content": "It's winter, and the time of year has come for it to start getting cold (and for strange colorful headcloths to start appearing... soon). Let's write some code to make avatar pictures and other images frozen over, to fit the theme!\nInput\nThe input to submissions to this chall...
[ { "role": "user", "content": "Your task is to find how many distinct Blackjack sequences can be found in an ordered list of 12 cards.\nA Blackjack sequence is defined as a sequence of consecutive cards whose sum of points is exactly 21. Points are counted according to the following table:\nSymbol | Name | ...
[ { "role": "user", "content": "\\$\\left\\{ n \\atop k \\right\\}\\$ or \\$S(n, k)\\$ is a way of referring to the Stirling numbers of the second kind, the number of ways to partition a set of \\$n\\$ items into \\$k\\$ non-empty subsets. For example, to partition \\$\\{1,2,3,4\\}\\$ into \\$2\\$ non-empty s...
[ { "role": "user", "content": "Berland scientists noticed long ago that the world around them depends on Berland population. Due to persistent research in this area the scientists managed to find out that the Berland chronology starts from the moment when the first two people came to that land (it is conside...
[ { "role": "user", "content": "Your task is to output the exact string\nThe Jabberwocky\n\nwithout taking input. Normal rules for input and output apply, so both functions and programs are allowed.\nOf course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabeti...
[ { "role": "user", "content": "This is a cops-and-robbers challenge, the robbers' thread is here\nYou can change the word code into golf by changing a letter at a time in four steps:\nCODE\nCOLE\nCOLD\nGOLD\nGOLF\n\nToday, we’ll be doing the same thing with programs.\nYour challenge is to:\n\nchoose a progra...
[ { "role": "user", "content": "Background\nThe sequence in the title is A245788 \"n times the number of 1's in the binary expansion of n\" (\"times\" here means multiplication), which starts like this:\n1, 2, 6, 4, 10, 12, 21, 8, 18, 20,\n33, 24, 39, 42, 60, 16, 34, 36, 57, 40,\n63, 6...
[ { "role": "user", "content": "You are responsible for building a new freeway. However, it leads through\nmountainous lands and therefore needs numerous bridges and tunnels. The \nfreeway itself should stay at a single level.\nInput\nYou are given a rough ASCII description of how the mountains look like on \...
[ { "role": "user", "content": "Robber Thread here\nThe Challenge\nChoose any numeric* formula, algorithm, or code challenge. Implement it in such a way that the math is correct, but at least one answer is wildly** wrong due to some defect in how computers/programs operate, e.g. floating point errors, uniniti...
[ { "role": "user", "content": "Your task is to write a program which implements a bijection \\$\\mathbb{N}^n\\to\\mathbb{N}\\$ for \\$n \\ge 1\\$. Your program should take \\$n\\$ natural numbers as input, in any acceptable method (including taking them as a single, \\$n\\$ element list/array) and output a u...
[ { "role": "user", "content": "Write a program or function that takes in the following input in a reasonable format of your choice:\n\nTwo positive integers W and H that define the width and height of the image you'll be generating.\nTwo RGB colors C1 and C2 that will be used to color the image.\nA list of 3...
[ { "role": "user", "content": "Let's assume we've got an imaginary assembler. The assembler supports numerical labels. An infinite loop example:\n:1\n jmp 1\n\nYour task is, to write a preprocessor for this assembler supporting named labels (instead of numerical ones; with up to 8 characters in length), s...
[ { "role": "user", "content": "For robbers' post, Cheapo Enigma machine (Robbers)\nA cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must produce a unique output. (In the other words, your function must be bijective...
[ { "role": "user", "content": "Write a program or function, that given a success probability p, a number n and a number of trials m returns the chance of at least n successes out of m trials.\nYour answer must be precise to at least 5 digits after the decimal.\nTest cases:\n 0.1, 10, 100 -> 0.54871\n 0.2, 10...
[ { "role": "user", "content": "Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total.\nThis challenge was inspired by this video by Matt Parker.\nTestcases\nUse this file if you want to test your code against the English vocabul...
[ { "role": "user", "content": "This rar file, when decompressed, gives a 65024-byte exe file. Requiring you to output the contents of that file would be absolutely no fun.\nBut you aren't required to do that. Actually, you're to do something opposite: Output a binary of the same length (65024 bytes), such th...
[ { "role": "user", "content": "You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your essay with the least movement.\nFormally, you have to assign to each characte...
[ { "role": "user", "content": "The Pareto Distribution is a probability distribution that comes up a lot in nature. It has lots of special properties, such as an infinite mean. In this challenge, you will output a number sampled from this distribution.\nThe Pareto Distribution is defined to be greater than o...
[ { "role": "user", "content": "Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points (x, y) such that x and y are non-negative. Okabe starts at ...
[ { "role": "user", "content": "Output all 95 bytes from 0x20 to 0x7E inclusive (printable ASCII including space), in any order, each at least once. The source code of your program must use all of those bytes, each at least once.\n\nYour program must be irreducible (meaning you cannot strictly remove some cha...
[ { "role": "user", "content": "She was worried. The grades are not good. Although she forced her parents to enroll in a dormitory school, her talent never blossomed. Or maybe he didn't have the talent in the first place, but it was possible that he didn't want to think about it as much as possible.\n\nSo she...
[ { "role": "user", "content": "Based on this game.\nDescription :\nBased on Wikipedia's description.\nThe 24 Game is an arithmetical card game in which the objective is to find a way to manipulate four integers so that the end result is 24.\nFor example, for the card with the numbers 4, 7, 8, 8, a possible s...
[ { "role": "user", "content": "You have to write a program, if its source code is reversed, then it will error.\nFor example, if your source is ABC, then reversing it and writing CBA should crash/throw an error. And ABC itself should be a vaild program (I mean your primary source should be a valid program). ...
[ { "role": "user", "content": "Emperor Palpatine loves owls very much. The emperor has some blueprints with the new Death Star, the blueprints contain n distinct segments and m distinct circles. We will consider the segments indexed from 1 to n in some way and the circles β€” indexed from 1 to m in some way. \...
[ { "role": "user", "content": "A Belphegor number is a number of the form \\$(10^{n+3}+666)*10^{n+1}+1\\$ (1{n zeroes}666{n zeroes}1) where \\$n\\$ is an non-negative integer. A Belphegor prime is a Belphegor number that is also prime.\nThe \\$n\\$ values of the first few Belphegor primes are 0, 13, 42, 506 ...
[ { "role": "user", "content": "This is not the same as m-ss-ng-lette-s\nChallenge:\nGiven a string with masked characters, generate all possible words, inclusive of non-meaningfull words.\nRules:\n\nThe sequence of the characters in the string does not change.\nThe masked character (*) will be one of an Engl...
[ { "role": "user", "content": "Very related\nYou're given a piece of ASCII art representing a piece of land, like so:\n /β€Ύ\\\n__/ β€Ύ\\_\n \\_/β€Ύ\\\n \\\n\nSince an overline (β€Ύ) is not ASCII, you can use a ~ or - instead.\nYour challenge is to determine if it is connected by the lines o...
[ { "role": "user", "content": "Create a program that find the latest 50 challenges with the code-golf-tag that have at least 20 answers. Then, extract the scores for each language in each of the challenges. If there are more than one answer using the same language, count all scores. Thereafter, take the top ...
[ { "role": "user", "content": "Prologue\nAfter installing an anti-XSS browser extension, Stack Snippets suddenly stopped working all across the Stack Exchange network. I could no longer learn from Stack Overflow, see working demos on User Experience and, worst of all, could not test JavaScript answers on Pro...
[ { "role": "user", "content": "Given an expression matching the regex /^[-~]*x$/, evaluate it in terms of x and output a string matching the regex /^-?x[+-]\\d+$/.\nFor example, the string -~x evaluates to x+1, while the string -~-x evaluates to -x+1, and the string -~-~--x evaluates to x+2.\nWe start from x...
[ { "role": "user", "content": "A \\$k\\$-hyperperfect number is a natural number \\$n \\ge 1\\$ such that\n$$n = 1 + k(\\sigma(n) βˆ’ n βˆ’ 1)$$\nwhere \\$\\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...
[ { "role": "user", "content": "Summary:\nFor any given language, what is the smallest amount of unique characters for your language to be Turing-Complete?\nChallenge:\nFor any language of your choice, find the smallest subset of characters that allows your language to be Turing-Complete. You may reuse your s...
[ { "role": "user", "content": "Edit 2020-11-06: This challenge has been edited with new provisions to encourage participation. The edits have been bolded for emphasis.\n\nWelcome to a cops and robbers version of Find an Illegal String.\nAn illegal string is \"a string of characters that cannot appear in any ...
[ { "role": "user", "content": "Please note that this question is different from this question. This one asks for graphical output, while the other one asks for ascii art.\nObjective\nHelp! Timmy's graphing calculator broke! His calculator cannot graph anymore. However, he has found a way to add new programs ...
[ { "role": "user", "content": "As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below:\n\nImage credit: Wikipedia\nFor the purposes of the current task we will say that a norm...
[ { "role": "user", "content": "This is a cops-and-robbers challenge the Robbers' Thread can be found here\nYour challenge is to write a program that outputs an anagram of its source code but not the original source code itself.\nFor example the following Python program,\nprint`'print*2``'*2`\n\nprints\n'prin...
[ { "role": "user", "content": "Challenge\nThe cops created code challenges which result in certain wildly incorrect answers despite correct math. Choose an uncracked, not safe formula from the cop thread.\nYour task is to find an incorrect answer and describe its underlying cause. The challenge author has th...
[ { "role": "user", "content": "Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, or other similar tricks.\nYour goal is to write a polyglot where the output for...
[ { "role": "user", "content": "A pristine program is a program that does not have any errors itself but will error if you modify it by removing any contiguous substring other than the entire program.\nA crystalline program is sort of the opposite. It is a program which doesn't have any errors itself but will...
[ { "role": "user", "content": "The first magic card trick I ever learned as a child was the following:\n\nHave 1 deck of cards where the pattern on the back is not vertically symmetric.\nOrganize all cards to be facing one direction.\nAsk an individual to, \"pick a card, any card, memorize it and give it bac...
[ { "role": "user", "content": "Polycarp plays a well-known computer game (we won't mention its name). Every object in this game consists of three-dimensional blocks β€” axis-aligned cubes of size 1 Γ— 1 Γ— 1. These blocks are unaffected by gravity, so they can float in the air without support. The blocks are pla...
[ { "role": "user", "content": "Find the maximum possible number of disjoint sets of characters, that are Turing complete subsets of your language.\nRules:\n\nYou can assume your Turing complete subset is contained in/called from a main-function if that is required by your language\n\nThe subsets must not sha...
[ { "role": "user", "content": "The code:\nfunction L(){N=null;E=[N,N];t=this;h=E;t.u=i=>h=[i,h];\nt.o=_=>h==E?N:h[+!(h=h[1])];t.e=(i,l)=>h=(l||h)==E?[i, \nE]:[(l||h)[0],t.e(i,(l||h)[1])];t.s=_=>{o=\"\";while(i=t.o())\n{o+=i+\",\"}return o}}\n\nFor my response to this (old) question: https://codegolf.stackexc...
[ { "role": "user", "content": "In this fastest-code challenge, you are provided with a set of \\$n\\$ identical blocks and need to determine how many unique buildings can be constructed with them. Buildings must satisfy the following rules:\n\nNo overhangs - each block must either be on the ground or support...
[ { "role": "user", "content": "Nate U. Smith runs a railroad company in a metropolitan area. In addition to his railroad company, there are rival railroad companies in this metropolitan area. The two companies are in a competitive relationship with each other.\n\nIn this metropolitan area, all lines are rout...
[ { "role": "user", "content": "Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi access point. This access point can be accessed within a rang...
[ { "role": "user", "content": "Robbers thread\nIn this cops-and-robbers challenge, your task is to write a program h that outputs \"Hello Shue!\". Next, you have to choose a string i and also write a Shue program p, so that p(i)=h. Your score is len(p)+len(i). Your answer will contain the language of h, i an...
[ { "role": "user", "content": "Write a program that accepts HTTP requests on any port of your choice above 1024, and responds to requests on any URL of your choice with its own source code. It must work with, at least, Firefox and Chrome. The code should be delivered as text/plain (removed requirement becaus...
[ { "role": "user", "content": "Challenge\nGiven two strings in any default I/O format, do the following:\nNOTE: The challenge will refer to the first string as the \"data\" and the second referred to as the \"program\".\n\nChange the program to an infinite string which is just the program repeated infinitely...
[ { "role": "user", "content": "This programming puzzle is inspired by another question which has been asked here yesterday but which was deleted by the author...\nThe challenge:\nCreate an executable binary (Windows .EXE or Linux binary) using Visual C# (or your favorite C# IDE) which prints the following te...
[ { "role": "user", "content": "Given a number \\$n β‰₯ 2\\$, a blackbox function \\$f\\$ that takes no arguments and returns a random integer in the range 0...n-1 inclusive, and a number \\$m β‰₯ n\\$, your challenge is to generate a random integer in the range 0...m-1 inclusive. You may not use any nondetermini...
[ { "role": "user", "content": "Don't you hate it when you're trying to roughly sort a list based on user data, but you have to poll the user for thousands of comparisons?\nHate no more, because the answers to this challenge are (going to be) here!\nMethod\nThe sorted-ness of a list is defined by how many pos...
[ { "role": "user", "content": "Challenge\nGenerate \\$n-1\\$ consecutive composite numbers using this prime gap formula\n$$n!+2,n!+3,...,n!+n$$\nInput\nAn integer \\$n\\$ such that \\$3 \\leq n \\leq 50 \\$.\nOutput\nSequence of \\$n-1\\$ consecutive composite numbers.\nExample\nInput\n3\n\nOutput\n8\n9\n\nR...
[ { "role": "user", "content": "Inspired by a now deleted StackOverflow question. Can you come up with a way to get a particular method executed, without explicitly calling it? The more indirect it is, the better. \nHere's what I mean, exactly (C used just for exemplification, all languages accepted):\n// Cal...
[ { "role": "user", "content": "If you visit Code Golf often, you may have heard of Kolmogorov complexity. It's usually defined as the amount of bytes required to express some string in a programming language.\nHere the Kolmogorov-complexity of a natural number is defined similarly: the number of bytes requir...
[ { "role": "user", "content": "Let's denote as L(x, p) an infinite sequence of integers y such that gcd(p, y) = 1 and y > x (where gcd is the greatest common divisor of two integer numbers), sorted in ascending order. The elements of L(x, p) are 1-indexed; for example, 9, 13 and 15 are the first, the second ...
[ { "role": "user", "content": "V1.1: Added criterion to help with tiebreakers, a bit overkill but still.\n\nTask: Crack the scrambled code for calculating the argument of a complex number \\$z=x+iy\\$ given two inputs.\nYou must post a comment in the cops’ thread with a link to your working source, mentionin...
[ { "role": "user", "content": "This contest is over.\nDue to the nature of cops-and-robbers challenges, the cops challenge becomes a lot easier when the interest in the associated robbers challenge has diminished. Therefore, while you can still post hash functions, your answer will not get accepted or form p...
[ { "role": "user", "content": "Warm up: Regex, Paper, Scissors\nThis is the challenge I originally wanted to post, before realising that some very short solution exist. Nevertheless, it can be an interesting problem to think about in preparation for the actual challenge below.\nWrite three regexes R, P and S...
[ { "role": "user", "content": "Cops' Thread\nYour challenge is to find an uncracked, unsafe cop on the cops thread, and find an input value for which their code does not do as specified by the challenge.\nYou must use values within the bounds specified by the cop and the challenge - if a float breaks their ...
[ { "role": "user", "content": "Given a natural number c as input, our task is finding the fastest way to calculate one -atleast- availabe integer solution (a,b) of pell equation c=aΒ²-bΒ².\nRules\nBuilt-in functions and loopholes arent given any interest.\nThe program deals with integers (signed), the input is...
[ { "role": "user", "content": "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'.\nThe derivative of the product of two functions fg is f'g + g'f. The deriva...
[ { "role": "user", "content": "Once Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and m - 1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the OX is the ground, and the OY is directed upwards. Each cube is assoc...
[ { "role": "user", "content": "Write a program that precisely clones GNU cat version 8.32, which is\ninstalled on my computer.\nIn any case, if called with the same arguments, same stdin, and same files,\nyour program's output to both stdout and stderr must by byte-for-byte identical\nto that of GNU cat, and...
[ { "role": "user", "content": "In atomic physics and quantum chemistry, the electron configuration is the distribution of electrons of an atom in atomic orbitals. For example, the electron configuration of the neon atom is 1s2 2s2 2p6 (From Wikipedia)\n\nChallenge\nYour challenge is to take a number represen...
[ { "role": "user", "content": "I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition:\n\nAn \\$n\\times n\\$ consists of numbers \\$1,2,\\cdots, n^2\\$.\nAll numbers must be distinct.\nSum of each row and each column is equal.\n\nAccording to Ri...
[ { "role": "user", "content": "I have a cake shop that specialises in birthday cakes. The cakes that I sell must have candles placed in a circle. You would probably think I can just divide 360Β° by the number of candles, but the machine for placing candles is quite unique; it uses a list of numbers representi...
[ { "role": "user", "content": "Much harder than Can this pattern be made with dominoes?\nChallenge\nA grid of width \\$w\\$ and height \\$h\\$ is given, filled with 1s and 0s. You can place a domino somewhere on the grid only if both cells are 1. You cannot overlap dominoes. What is the maximum number of dom...