Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7576261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:52:40+00:00 2026-05-30T16:52:40+00:00

this is a simple piece of code which is suppose to read n numbers

  • 0

this is a simple piece of code which is suppose to read n numbers and suppose to print how many numbers out of these n numbers are divisible by k

n=int(raw_input())
k=int(raw_input())
ans=0
while n > 0:
  t=int(raw_input())
  if(t%k == 0):
    ans = ans + 1
  n = n - 1
print ans 

I got a NZEC error for this on codechef. Can someone point out where does the issue lie? This NZEC error has bothered me a lot since last week. I am new to python and have searched a lot on internet but could not find anything concrete. I got the answer that NZEC error occurs when the stack size goes beyond limit. But what is the issue with my this code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T16:52:41+00:00Added an answer on May 30, 2026 at 4:52 pm

    I suppose the codechef question is this one. You should take in account that the value of n and k are around 10^7, which could be a problem with your program.

    Also, n and k are on the same line. You are using raw_input twice, so you are reading two lines. This can be solved by using:

    n, k = raw_input().split(" ")
    n = int(n)
    k = int(k)
    

    If that won’t help, you could try looping over an xrange instead, or using a different algorithm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a simple piece of code which i wrote to check whether it
I've wrote this simple piece of code. And I have a slight problem with
i want to do this simple piece of code work. #include <iostream> #include <windows.h>
I've got this really simple piece of code that I thought was the correct
i am trying to compile this very simple piece of code class myList {
A common piece of code I use for simple string splitting looks like this:
I have a very simple little piece of Lua code, which I wrote while
I wrote this simple test code, by adapting a piece from a book, to
friends, I have a piece of code which can perform simple add, subtraction, multiplication,
Given a simple piece of code which can return the name of a property

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.