Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results1,202 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Least Common Multiple and Greatest Common DivisorFor multiple integer pairs, compute and print each pair's least common multiple and greatest common divisor. | Easy1 | MathNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Jerry and TomSubtract the fraction A/B from 1 and print the remaining cheese as P/Q in lowest terms. | Easy1 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Fraction SumAdd two given fractions and output the sum reduced to lowest terms using GCD. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Least Common MultipleFor each of up to 1000 pairs of numbers, compute and print the least common multiple. | Easy2 | MathNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Restoring NumbersFor each given integer up to 100,000, output its prime factorization as prime-exponent pairs in increasing order. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Greatest Common Divisor and Least Common MultipleGiven two natural numbers up to 10000, output their greatest common divisor and least common multiple. | Easy2 | MathNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Next NumberGiven three distinct integers from an arithmetic or geometric progression, decide which type it is and print the label with the next term. | Easy2 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| RecipesMultiply each recipe amount by a constant and print the result as a reduced integer or mixed fraction. | Easy2 | ImplementationMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Greatest Common DivisorRead n pairs of positive integers and print the greatest common divisor of each pair on its own line. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Least Common MultipleFor each of n test cases, read two natural numbers a and b and print their least common multiple. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PerfectionFor each number below 60000, sum its proper divisors and classify it as perfect, deficient, or abundant. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Terms of OfficePrint every year from X to Y in which all four offices change, which happens on multiples of lcm(4,2,3,5) = 60, formatted as a fixed sentence. | Easy2 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Fraction ActionReduce a numerator and denominator to simplest form, then print it as a whole number, a proper fraction, or a mixed number. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Mod InverseGiven x and m, find n with 0 < n < m such that x*n mod m equals 1, or report that none exists. | Easy2 | Number theoryBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| DivisibilityGiven a base-62 string, decide whether the number it represents is divisible by 61. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TeleprimeGiven a six-digit number and a digit to prepend, print Yes if both the original and the resulting seven-digit number are prime. | Easy2 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Non-DivisorsGiven n, print the smallest and the largest integers from 1 to n that do not divide n. | Easy2 | Number theoryMath | No attempts yet | 1s | 128 MB | Judgeable |
| Perfect Number CheckDecide whether each given integer equals the sum of its proper divisors and print the equation or a negative verdict. | Easy2 | Number theoryImplementation | No attempts yet | 2s | 128 MB | Judgeable |
| EuclidRead two positive integers up to 32767 and print their greatest common divisor. | Easy2 | Number theory | No attempts yet | 2s | 512 MB | Judgeable |
| Divisor CountFor each of up to 10 values of n below 10000, print n and its divisor count. | Easy2 | Number theoryBrute force | No attempts yet | 2s | 512 MB | Judgeable |
| Least Common MultipleGiven two integers below 100,000,000, print their least common multiple, which can exceed the 32-bit range. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Math ContestGiven a huge decimal integer x, print YES if x is divisible by 9 and NO otherwise. | Easy2 | Number theoryMath+1 | No attempts yet | 1s | 512 MB | Judgeable |
| One Hundred to TenParse a ratio written as n:m, divide both numbers by their greatest common divisor, and print the reduced ratio in the same format. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Perfect, deficient, or abundantFor each of T numbers below 10000, sum its proper divisors and classify it as Perfect, Deficient, or Abundant. | Easy2 | MathBrute force+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Bedtime Reading IGiven an integer I, compute the sum of all its divisors. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sharing apples and bananasGiven a apples and b bananas, print every common divisor n of a and b with the per-friend apple and banana counts. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Congruent NumbersGiven the two legs of a right triangle as fractions p1/q1 and p2/q2, print 1 if the triangle's area is an integer, otherwise 0. | Easy2 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Sum Squared Digits FunctionFor each of P datasets, convert the given integer n to base b, square each digit, and report the total with the dataset number. | Easy2 | MathImplementation+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Is N primeGiven an integer N, decide whether N is prime and print Yes or No. The trailing line of N integers is unused. | Easy2 | MathNumber theory+1 | No attempts yet | 1s | 256 MB | Judgeable |
| Overflow and ModuloMultiply N integers and print the product modulo M, reducing after each multiplication to avoid overflow. | Easy2 | MathImplementation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| N! mod P (1)Given N and a prime P larger than N, compute N! modulo P. | Easy2 | MathImplementation+2 | No attempts yet | 3s | 1024 MB | Judgeable |
| Even or Odd?Given n, decide whether the sum of any n consecutive positive integers is always even, always odd, or depends on the starting point. | Easy2 | MathImplementation+1 | No attempts yet | 1s | 512 MB | Judgeable |
| ABCD CodeFor each four-digit code, check whether the square of its first two digits plus the square of its last two digits leaves remainder 1 modulo 7. | Easy2 | MathImplementation+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DivisorsGiven all proper divisors of an unknown number N, compute N using the fact that the smallest and largest proper divisors multiply to N. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 512 MB | Judgeable |
| UnderprimeCount integers in a range whose total number of prime factors (with multiplicity) is itself a prime number. | Easy3 | Number theoryMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Least Common Multiple of at Least Three NumbersGiven five distinct positive integers up to 100, find the smallest number divisible by at least three of them, essentially the minimum LCM over all triples. | Easy3 | MathBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Lee-myeon and Im-hyeonClassify a number 1 to 2700 as Lee-myeon and/or Im-hyeon based on digit sum parity and prime factorization rules, then output one of four codes. | Easy3 | Number theoryImplementation+1 | No attempts yet | 2s | 128 MB | Judgeable |
| K-Sejun NumbersCount integers from 1 to N whose every prime factor is at most K, given N up to 100000 and K up to 100. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| DietGiven G, find all natural numbers a such that a^2 minus some natural number's square equals G, printing them in increasing order or -1 if none exist. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Modular ExponentiationCompute A raised to the power B modulo C efficiently using fast modular exponentiation. | Easy3 | MathNumber theory+1 | No attempts yet | 0.5s | 128 MB | Judgeable |
| Number of Trailing Zeros in a FactorialCount the trailing zeros of N! for N up to 500 by counting factors of 5. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Encryption KeyDetermine for each large number S whether all its prime factors exceed one million, using trial division up to that bound. | Easy3 | Number theoryMath+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Safe Password CheckGiven a number P equal to the product of two primes and a threshold K, decide if both primes are at least K, otherwise output the smaller prime. | Easy3 | Number theoryMath+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Find Prime NumbersPrint all prime numbers between two given bounds M and N, one per line, using an efficient sieve up to 1,000,000. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 256 MB | Judgeable |
| Counting Consecutive SumsCount the number of ways to express a given natural number N as a sum of one or more consecutive natural numbers. | Easy3 | MathNumber theory | No attempts yet | 2s | 32 MB | Judgeable |
| Diagonal Across TilesGiven a grid of x by y unit tiles, count how many tiles a diagonal from corner to corner passes through using the gcd formula. | Easy3 | MathNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Making Equal-Length SticksGiven piece lengths, find the smallest stick length such that all pieces can be regrouped into sticks of that equal length (the sum divided by a suitable divisor, bounded by the maximum piece). | Easy3 | MathGreedy+1 | No attempts yet | 3s | 128 MB | Judgeable |
| Greatest Common Divisor and Least Common MultipleGiven the gcd and lcm of two unknown natural numbers, find the pair with the smallest sum satisfying both conditions. | Easy3 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime NumbersGiven a range M to N up to 10,000, find all primes in it and print their sum plus the smallest one, or -1 if none exist. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Ruler and ProtractorGiven N base angles closable under addition/subtraction mod 360, determine for K query angles whether each is reachable, which reduces to checking divisibility by gcd of the base angles and 360. | Easy3 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Apple Distribution MethodsGiven R and G, list every common divisor N of both, printing N along with R/N and G/N as red and green apples per player. | Easy3 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Pascal Loop OutputGiven N up to 1e9, simulate finding the largest divisor of N smaller than N by scanning downward, and output how many steps that takes without brute force. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RingsGiven radii of N touching rings, compute how many rotations each ring after the first makes as a reduced fraction when the first ring completes one rotation. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Heart Number SystemConvert a decimal integer to balanced ternary notation using digits 1, 0, and - for -1, without leading zeros. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Cutting ChocolateGiven an N by M chocolate bar, find the minimum number of square pieces obtained by repeatedly cutting it fully along rows or columns. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime Gap SequenceGiven a number k, find the gap length between the two consecutive primes surrounding it if k is composite, otherwise output 0. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Remainder CalculationFor each test case, find the remainder when a base-B number D with up to ten million digits is divided by B-1. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Chain of FoolsGiven sprocket prongs, chain links, and start positions of a broken prong and bent link, find when they first meet at location 0, printing revolutions and fraction or Never. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| BlocksGiven N unit cubes, find positive integers a, b, c with a*b*c = N that minimize the surface area 2(ab+bc+ca). | Easy3 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Geek Challenge [SKRZAT] (Base Minus Two)Convert numbers between decimal and base -2 (Weird Binary), echoing each query with its formatted result. | Easy3 | MathImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Primorial Number SystemRepresent each positive integer in the mixed-radix primorial system where the i-th place value is the product of the first i primes. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Faulty OdometerRead odometer values that skip the digit 4 and print the true mileage by treating each reading as a base-9 number. | Easy3 | MathImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Casting Out NinesFor each line like a+b=c. or a*b=c., compute digit sums modulo 9 and print PASS if the operation is congruent, otherwise NOT!. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Dirichlet's Theorem on Arithmetic ProgressionsFor each dataset, print the n-th prime in the arithmetic progression a, a+d, a+2d, ... , where a and d are coprime. | Easy3 | Number theoryMath+1 | No attempts yet | 1s | 128 MB | Judgeable |
| SequencesFor each query with a first term, non-zero common difference, and value, print the term index if the value is in the arithmetic sequence, otherwise X. | Easy3 | MathImplementation+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Common DivisorsGiven 2 or 3 numbers up to 1e8, print every positive integer that divides all of them, in increasing order. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 256 MB | Judgeable |
| Divide and ConquerAmong integers from M to N, pick the one with the most divisors, breaking ties by the largest value, and report it with its divisor count. | Easy3 | Number theoryBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Perfect SquaresGiven N, count ordered pairs (A, B) with 1 <= B <= A <= 500 and A^2 - B^2 = N. | Easy3 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime QualificationCount primes between A and B whose decimal representation contains the digit D. | Easy3 | Number theoryMath+2 | No attempts yet | 2s | 128 MB | Judgeable |
| The Drunken JailerA jailer toggles the doors of cells that are multiples of k in round k; count how many doors end up open after n rounds. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Digital RootGiven positive integers up to 1000 digits, each line until a terminating 0, print the digital root of each number. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Prime CutsFor each N and C, build the primes from 1 to N and print the middle C*2 or C*2-1 of them, or the whole list if that many do not exist. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Uniform GeneratorFor each pair STEP and MOD, decide whether seed(x+1) = (seed(x) + STEP) mod MOD cycles through all MOD values, which holds exactly when gcd(STEP, MOD) = 1. | Easy3 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Kilometers to MilesConvert each kilometer value to miles by writing it in Zeckendorf Fibonacci form, dropping the lowest bit, and re-evaluating. | Easy3 | MathGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Easiest Problem Is This OneFor each positive integer N up to 100000, find the smallest multiplier p greater than 10 such that N and N*p have the same decimal digit sum. | Easy3 | Brute forceMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Goldbach's ConjectureFor each even n below 2^15, count the unordered pairs of primes that sum to n, stopping at a terminating 0. | Easy3 | Number theoryMath+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cool NumbersCount integers in [a, b] that are both a perfect square and a perfect cube, meaning perfect sixth powers. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| RSA NumbersCount how many integers in an inclusive range below 1000 have exactly four divisors, then print the count in a fixed sentence. | Easy3 | MathNumber theory+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Picture PerfectFor each C, find the factor pair (W, H) with W*H = C closest to a square, and report the smallest perimeter along with W and H. | Easy3 | MathBrute force+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Deficient, Perfect, and AbundantFor each integer, sum its proper divisors and classify it as deficient, perfect, or abundant. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Big NumberFor each m up to 10^7, print the number of decimal digits in m factorial. | Easy3 | MathNumber theory+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Can You Exponentiate?Given a and b up to 1e9, print the last decimal digit of a^b. | Easy3 | MathNumber theory+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Smallest Perfect-Square MultipleRead n and print the smallest multiple of n that is a perfect square. | Easy3 | Number theory | No attempts yet | 1s | 128 MB | Judgeable |
| Divisor Set InclusionDecide for each pair whether every divisor of a also divides b, which holds exactly when a divides b. | Easy3 | Number theory | No attempts yet | 1s | 128 MB | Judgeable |
| The Cheerful MonkeyStarting from one closed cage in a circle of n, repeated jumps of length d open each landing cage until a repeat, and you count the opened cages. | Easy3 | Number theoryMath | No attempts yet | 1s | 128 MB | Judgeable |
| GymCount the integers from 1 to n that are multiples of a or of b. | Easy3 | MathNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Goldbach's ConjectureGiven an even number n, print the two primes that sum to n with the smallest gap between them. | Easy3 | Number theoryTwo pointers | No attempts yet | 2s | 256 MB | Judgeable |
| Primality TestDecide whether each of up to 10 numbers up to 100000000 is prime and print YES or NO. | Easy3 | Number theoryMath | No attempts yet | 1s | 128 MB | Judgeable |
| BiorhythmsGiven one peak day for each of the 23, 28, and 33 day cycles and a date d, find the days from d to the next day when all three peak together. | Easy3 | Number theoryMath | No attempts yet | 1s | 128 MB | Judgeable |
| Counting non-decreasing digit sequencesCount length-N non-decreasing sequences of digits 0 to 9, modulo 1000000007, for each test case. | Easy3 | CombinatoricsNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Largest Pairwise GCDFor each test case, print the largest GCD found among all pairs of the given integers. | Easy3 | Number theoryBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| GCD SumGiven several integers per test case, add the greatest common divisor of every unordered pair and print each sum. | Easy3 | Number theoryBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| SifarFor each N up to 1,000,000 given one per line until 0, print the count of trailing zeros of N! as Case #x: M. | Easy3 | Number theoryMath | No attempts yet | 1s | 128 MB | Judgeable |
| Product of two distinct primesFor each K, print the smallest number at or above K that equals the product of two different primes. | Easy3 | Number theoryBrute force | No attempts yet | 1s | 128 MB | Judgeable |
| Six EquationsRecover six bounded primes from six pairwise products by taking gcds of the pairs that share a prime. | Easy3 | Number theory | No attempts yet | 1s | 128 MB | Judgeable |
| Largest Pairwise GCDGiven up to 100 positive integers below one million, find the largest GCD over all pairs from distinct positions. | Easy3 | Brute forceNumber theory | No attempts yet | 1s | 128 MB | Judgeable |
| Common FractionReduce each of n fractions to lowest terms by dividing out the greatest common divisor. | Easy3 | Number theory | No attempts yet | 1s | 128 MB | Judgeable |
| The nth prime numberGiven n up to 10000, print the nth prime number. | Easy3 | Number theoryMath | No attempts yet | 2s | 512 MB | Judgeable |
| Federation FavoritesRead integers until -1 and print each perfect number with its divisors or state that it is not perfect. | Easy3 | Number theoryImplementation | No attempts yet | 1s | 256 MB | Judgeable |
| RibbonAfter dropping the dirty inch at each end of every roll, find the longest common piece length that uses up every roll and count the total pieces. | Easy3 | Number theory | No attempts yet | 2s | 256 MB | Judgeable |