Problem:


Score : 100 points

Problem Statement

How many multiples of d are there among the integers between L and R (inclusive)?

Constraints

All values in input are integers.

1 \leq L \leq R \leq 100

1 \leq d \leq 100

Input

Input is given from Standard Input in the following format:

L R d

Output

Print the number of multiples of d among the integers between L and R (inclusive).

Sample Input 1

5 10 2

Sample Output 1

3

Among the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.

Sample Input 2

6 20 7

Sample Output 2

2

Among the integers between 6 and 20, there are two multiples of 7: 7 and 14.

Sample Input 3

1 100 1

Sample Output 3

100



Sample input:
5 10 2


Sample output:
3

Submission status: Runtime Error

Solution code:
N=int(input())

for h in range(1,N+1):
    num=0
    for i in range(1,h):
        for j in range(1,h):
            for k in range(1,h):
                if i**2+j**2+k**2+i*j+j*k+k*i==h:
                    num+=1
    print(num)

Submission status: Runtime Error

Solution code:
#AIsing2020 d
 
import sys,math,collections,itertools,copy
input = sys.stdin.readline
 
 
def popcount(n):
    bin_str = bin(n)
    cou1 = bin_str.count('1')
    return cou1
 
def count(nc):
    co = 0
    while nc >0:
        cou1 = popcount(nc)
        nc = nc%cou1
        co +=1
    return co
 
N = int(input())
X = list(input().rstrip())
 
for i in range(N):
    Y = copy.copy(X)
    if Y[i] == '1':
        Y[i] = '0'
    else:
        Y[i] = '1'
    s = '0b'+"".join(Y)
    a =int(s,2)
    co = count(a)
    print(co)

Submission status: Runtime Error

Solution code:
l,r,d=map(int,input().split())
if l > r:
  print(0)
  break
else:
  print((r-l)//d)

Submission status: Runtime Error

Solution code:
from sys import stdin,stdout
from collections import Counter

n=int(stdin.readline().strip())
l=[]
for i in range(1,10):
    for j in range(1,10):
        for k in range(1,10):
            l.append((i*i)+(j*j)+(k*k)+(i*j)+(j*k)+(i*k))
ld=dict(Counter(l))

for i in range(1,21):
    if i in ld:
        stdout.write(str(ld[i])+'\n')
    else:
        stdout.write("0"+"\n")

Submission status: Runtime Error

Solution code:
/*
 * A.cpp
 *
 *  Created on: 2020/07/11
 *      Author: 17k1028
 */



#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0; i<ll(n); i++)
#define REPD(i,n) for(ll i=n-1; i>=0; i--)
#define FOR(i,a,b) for(ll i=a; i<=ll(b); i++)
#define FORD(i,a,b) for(ll i=a; i>=ll(b); i--)

int main(){
	int L, R;
	int d;
	cin >> L >> R >> d;
	int i=1;
	int count=0;
	while(i*d <= R){
		if(L<=i*d){
			if(i*d<=R){
				count++;
			}
		}
		i++;
	}
	cout << count <<endl;
}

Submission status: Runtime Error

Solution code:
L,R,d = int(input())

for num in range(L, R, d):
print(count(num))

Submission status: Runtime Error

Solution code:
def fx(n):
  cnt = 0

  for i in range(1,10000):
    if (i+1+1)**2 - i*1 - 1*1 - 1*i > n: break
    for j in range(1, 10000):
      if (1+j+1)**2 - 1*j - j*1 - 1*1 > n : break
      for k in range(1, 10000):
        formula = (i+j+k)**2 - i*j - j*k - k*i
        if formula == n:
          cnt+=1
        if formula >= n:
          break
  
  return cnt


n = int(input())
for i in range(1,n+1):
  print(fx(i))

Submission status: Runtime Error

Solution code:
N = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(0, len(l), 2):
  if l[i] % 2 != 0:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = N

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        ans[cal(x,y,z)] += func(i,x,y,z)
        while z >= math.ceil(sn / 2):
            y += 1
            z -= 1
            if x > z or y > z:
                break
            ans[cal(x,y,z)] += func(i,x,y,z)
            for j in range(y):
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                ans[cal(x,y,z)] += func(i,x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

def func(n,x,y,z):
    if x == y and y == z and z == x:
        return 1
    elif x != y and y != z and z != x:
        return 6
    else:
        return 3

def cal(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

main()

Submission status: Runtime Error

Solution code:
import math

def main():
    N = int(input())
    ans = [0]*(N+1)

    end = math.ceil(math.sqrt(N))

    for i in range(3,end+1):
        sn = i
        x = 1
        y = 1
        z = sn - 2
        ans[cal(x,y,z)] += func(i,x,y,z)
        while z >= math.ceil(sn / 2):
            y += 1
            z -= 1
            if x > z or y > z:
                break
            ans[cal(x,y,z)] += func(i,x,y,z)
            for j in range(y):
                x += 1
                z -= 1
                if x > z or y > z:
                    break
                ans[cal(x,y,z)] += func(i,x,y,z)
    
    for i in range(1,N+1):
        print(ans[i])
        

def func(n,x,y,z):
    if x == y and y == z and z == x:
        return 1
    elif x != y and y != z and z != x:
        return 6
    else:
        return 3

def cal(x,y,z):
    return x**2+y**2+z**2+x*y+y*z+z*x

main()

Submission status: Runtime Error

Solution code:
from math import sqrt
N=int(input())
num=1
def checker(n):
    hoge=n
    if hoge>2:
        hoge=n-2
    count=0
    x=1
    for a in range(int(sqrt(hoge))):
        y=1
        for b in range(int(sqrt(hoge))):
            z=1
            for c in range(int(sqrt(hoge))):
                ans=x*x+y*y+z*z+x*y+x*z+z*y
                if ans==n:
                    count=count+1
                z=z+1
            y=y+1
        x=x+1
    return count
for i in range(N):
    print(checker(num)) 
    num=num+1

Submission status: Runtime Error

Solution code:
arr=[0,1,1,2]
n=4*(10**5)+100
for i in range(4,n):
    b=bin(i)[2:]
    k=b.count('1')
    arr.append(arr[i%k]+1)
    #print(b,arr[i])
n=int(input())
z=input()
l=z.count('1')
l1=l+1
l2=l-1
ans1=0
ans2=0
for i in range(n):
    if(z[i]=='1'):
        u=pow(2,n-1-i,l1)
        ans1=(ans1+u)%l1
        if l2>0:
            ans2=(ans2+pow(2,n-1-i,l2))%l2
for i in range(n):
    if z[i]=='0':
        p=ans1+pow(2,n-1-i,l1)
        p%=l1
        print(1+arr[p])
    else:
        if l2==0:
            print(0)
        else:
            p=ans2-pow(2,n-1-i,l2)
            p%=l2
            print(1+arr[p])

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
n = int(input())

cnt = [0]*n

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            if x**2 + y**2 + z**2 + x*y + x*z + y*z - 1 < n:
                cnt[x**2 + y**2 + z**2 + x*y + x*z + y*z - 1] += 1
print(*cnt,sep='\n')

Submission status: Runtime Error

Solution code:
N = int(input())
cs = [0]*N
for i in range(1,130):
    for j in range(1,130):
        for k in range(1,130):
            temp = i**2 + j**2 + k**2 + i*j + j*k + k*i
            if temp =< N and temp > 0:
                cs[temp-1] += 1
for i in range(N):
    print(cs[i])

Submission status: Runtime Error

Solution code:
N = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(0, min(N, len(l)), 2):
  if l[i] % 2 != 0:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
for i in range(1, N+1):
    count = 0
    for j in range(1, int(np.sqrt(i))+2):
        for k in range(j, int(np.sqrt(i))+2):
            for l in range(k, int(np.sqrt(i))+2):
                n = j*j + k*k + l*l + j*k + k*l + l*j
                #print(i, j, k, l)
                if n == i:
                    if j == k == l:
                        count += 1
                    elif j==k or k==l or l==j:
                        count += 3
                    else:
                        count += 6
    print(count)

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import sys
import resource
sys.setrecursionlimit(10 ** 9)
#resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))

mm = {}

def popcorn(n):
    n = bin(n)
    return n.count("1")

def f(n):
    n%=popcorn(n)
    return n
    
def nf(n,count):
    if(n == 0):
        return count
    elif(n in mm):
        count += mm[n]-1
        return count
    else:
        n%=popcorn(n)
        return nf(n,count+1)


n = int(input())
a = input()
moto = int(a,2)
for i in range(n-1,0-1,-1):
    if(a[n-1-i] == "0"):
        k=moto+2**i
    else:
        k=moto-2**i
    mo = f(k)
    if(mo in mm):
        print(mm[mo])
        continue
    else:
        count = nf(mo,1)
        print(count)
        mm[mo]=count

Submission status: Runtime Error

Solution code:
N = int(input())
l = list(map(int, input().split()))

cnt = 0
for i in range(0, N, 2):
  if l[i] % 2 != 0:
    cnt += 1

print(cnt)

Submission status: Runtime Error

Solution code:
l,r,d=map(int,input().split)
print((r-l)//d)

Submission status: Runtime Error

Solution code:
L = int(input())
R = int(input())
d = int(input())
pan = L%d
X = L//d
Y = R//d
if pan == 0:
    print(Y-X+1)
else:
    print(Y-X)

Submission status: Runtime Error

Solution code:
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def MI():return map(int,input().split())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in R(V)]
    FromStdin=True if ls==None else False
    for i in R(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in R(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in R(base**n):s=[tb//(base**bt)%base for bt in R(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read;readline=sys.stdin.buffer.readline;input=lambda:sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

ans=0

def f(x):
    c=0
    while x>0:
        c+=1
        y=bin(x).count('1')
        x%=y
    return c

def f_init(x):
    rt=[0]*3
    p=x.count('1')
    N=len(x)
    for i in range(N):
        if x[i]=='1':
            for j in [-1,0,1]:
                rt[j]+=b[j][N-1-i]
                rt[j]%=p+j
    show('init',x,rt,1+a[rt[0]])
    ans=[0]*3
    for j in [-1,0,1]:
        ans[j]=1+f(rt[j])
    return rt,ans
    


n=I()
s=S_()

N=2*10**5+10
N=10
N=n
a=[0]*(N+1)

b=[[1]*(N+2) for i in rep(3)]

p=s.count('1')


for i in rep(N):
    #print(x,f(x),bin(x)[2:])
    a[i]=f(i)
    for j in [-1,0,1]:
        b[j][i+1]=(2*b[j][i])%(p+j)

rem,fx=f_init(s)
show(rem,fx)

for i in rep(n):
    if s[i]=='0':
        j=1
    else:
        j=-1
        #R=rem[0]+b[1][N-1-i]
        ans=a[(rem[j]+b[j][N-1-i])%(p+j)]+1
        print(ans,(rem[j]+b[j][N-1-i]),(p+j),(rem[j],b[j][N-1-i],p+j),N)
    if s[i]=='1' and False:
        #R=rem[-1]+b[-1][N-1-i]
        ans=a[(rem[-1]+b[-1][N-1-i])%(p-1)]
    print(ans)

show(p,b)
show(f_init(bin(3)[2:]))
#print(a[:100])
for i in rep(n):
    show(i,a[i])