CodeChef Logo CodeChef Logo
Courses

Programming and DSA

Learn to think like a programmer. Develop your problem-solving skills with essential data structures and algorithms.

Career Paths

From beginner to job-ready. Explore our curated career paths designed to help you succeed in the tech industry.

Other Courses

Programming and DSA

Explore courses

Catalogue

Programming and DSA

Learn to think like a programmer. Develop your problem-solving skills with essential data structures and algorithms.

Career Paths

From beginner to job-ready. Explore our curated career paths designed to help you succeed in the tech industry.

Other Courses

Explore courses
Practice Compete Compiler

Courses

Programming and DSA

Learn to think like a programmer. Develop your problem-solving skills with essential data structures and algorithms.

Career Paths

From beginner to job-ready. Explore our curated career paths designed to help you succeed in the tech industry.

Other Courses

Programming and DSA

Explore courses

Catalogue

Programming and DSA

Learn to think like a programmer. Develop your problem-solving skills with essential data structures and algorithms.

Career Paths

From beginner to job-ready. Explore our curated career paths designed to help you succeed in the tech industry.

Other Courses

Explore courses
Practice Compete Compiler
Home
Practice(hard)

624431

  • Login or register to post comments

Product of Digits Again

Chef has called on you many times in the past to solve unusual tasks that seem irrelevant to cooking, and today is no different. Today Chef demands that you find integers whose product of digits is equal to a given integer, but in bases besides 10. Given a string S, you are to determine the smallest positive integer I such that there exists a base B>1 for which the product of the digits of I gives the integer represented by S. For example, if S="11", then the smallest I is 8, because the base 3 representation of I is 22, and in base 3 2*2=11.

  • Login or register to post comments
  • Read more

Frosting Cupcakes

Now that Chef has streamlined his cupcake baking procedure, he's turning his attention toward frosting the cupcakes. He recently purchased a machine that produces frosting. Each cupcake requires one unit of frosting, and the frosting machine requires K2 units of energy to produce K units of frosting in one minute (K need not be an integer). Cupcakes arrive in batches, once per minute, needing frosting. The cupcakes must be frosted within a minute of when they arrive. The frosting machine also has a reserve unit, so it can produce extra frosting to be used later.

  • Login or register to post comments
  • Read more

593178

  • Login or register to post comments

Generalized Independent Sets

  • Login or register to post comments

585861

  • Login or register to post comments

Exponentiation Commutativity

For a given prime number p find the number of all pairs (m, n) of positive integers such that 1 <= m, n <= p*(p-1) and p divides nm - mn. Output the result modulo 1000000007.

Input

The first line contains a single positive integer T <= 100, the number of test cases. T test cases follow. The only line of each test case contains a prime number p , where 2 <= p <= 1012.

  • Login or register to post comments
  • Read more

567561

  • Login or register to post comments

567559

  • Login or register to post comments

Buying Land

After recent success of cooking reality shows, Chef decided to borrow the idea and host his own "Devil's Kitchen" show. But his ambitions are even bigger. He plans to build a whole complex of hotels, gyms and other entertainment facilities along with one main restaurant where he'll host the show. But first of all, he needs to purhase some land to build on. The country is divided into a grid with R rows and C columns of smaller parcels. Chef wants to buy a rectangular piece of land H parcels high and W parcels wide. He also has a preferred layout in mind.

  • Login or register to post comments
  • Read more
‹ previous
10 of 25
next ›
Workden, MNR PRIDE, 14, HAL Old Airport Rd, Domlur I Stage, 1st Stage, DOMLUR, Bengaluru, Karnataka 560071 [email protected] +91 95911 47880
Find us online

ROADMAPS

Learn Python
Learn Java
Learn C
Learn C++
Data structures and Algorithms
Competitive Programming
More Roadmaps

CAREER PATHS

React JS Developer
Full stack Developer
SQL for Data Analysis
Frontend Developer
Java Backend Developer
Data Analysis using Python
Python Backend Developer
C++ Developer
Machine Learning using Python

COMPILERS

HTML online compiler
C++ online compiler
C online compiler
Java online compiler
Python online compiler
SQL online compiler
JavaScript online compiler
React online compiler
More compilers

COMPANY

About us
For colleges
Coding Contests
Blogs
Contact us
Privacy Policy
Frequently Asked Questions

© 2026 CodeChef Inc. All rights reserved.

We use cookies to improve your experience and for analytical purposes. Read our Privacy Policy and Terms to know more. You consent to our cookies if you continue to use our website.