You can use several words in query to find by all of them at the same time. In addition, if you are lucky search understands word forms and some synonyms. It supports search by title and author. Examples:

  • 305 — search for 305, most probably it will find blogs about the Round 305
  • andrew stankevich contests — search for words "andrew", "stankevich" and "contests" at the same time
  • user:mikemirzayanov title:testlib — search containing "testlib" in title by MikeMirzayanov
  • "vk cup" — use quotes to find phrase as is
  • title:educational — search in title

Results

1.

seive

Last visit:  10 years ago
Registered:  10 years ago
2.
By box, 5 years ago, In English
On the Min25 sieve and extensions / SPOJ ASSIEVE Consider the following problem (general form of original Min25 sieve): We are given some *multiplicative* function $f(n)$, described at prime powers by $f(p^k)=g(p,k)$, where $g(p,1)$ is a polynomial of low degree, and we can calculate $g(p,k)$ for any singular $p$ and $k$ in $O(1)$. How do we calculate the prefix sum of $f(n)$ at the distinct positive integer values of $\lfloor\frac Nk\rfloor$, where $N\le 10^{10}$? Clearly, brute force or regular sieves are not going to cut it here. --- Prerequisite: For any integer $N$, for all integers $1\le k\le N$ there are at most $2\sqrt N$ distinct values of $\lfloor\frac Nk\rfloor$. Call these $2\sqrt N$ such values the *blocks* of $N$. (A note on notation: In the following text, $\frac Nk$ will be used to describe regular division, and $N/k$ will be used to denote floored division.) <spoiler summary="Proof"> For $k\le\sqrt N$, each $k$ contributes at most one distinct value, for a total of $\sqrt N$ elements. For $k>\sqrt ...
expressed modulo $4$. 1. If $p=1$, then: 1. For $pd=1$, we must have $d=1$. Hence weseive, 1. If $p=1$, then: 1. For $pd=1$, we must have $d=1$. Hence we seive away $p^k[x^1](S(n/p_j,j

Full text and comments »

  • Vote: I like it
  • +161
  • Vote: I do not like it

3.
By Ecrade_, 20 months ago, In English
Codeforces Round 1010 (Div. 1, Div. 2, based on Zhili Cup 2025) Editorial Sorry for the late editorial. Our problem setters were so exhausted with the offline competition yesterday that they really need some good rest. Despite the unexpected and unpleasant incidents that occurred, we are truly surprised and grateful that so many of you still participated in this competition! We sincerely hope you enjoyed it! (Gratitude for all you guys from [user:Ecrade_,2025-03-16]: I felt so heartbroken when I heard about the unexpected issues, but seeing so many people in the comments comforting us, sharing thoughtful and positive messages that showed genuine empathy, and continuing to fully support our competition even after the wasted time, I was deeply moved. Thank you all! Codeforces truly embodies such a positive and uplifting community spirit!) [problem:2082A] <br> Idea: [user:Ecrade_,2025-03-16] <spoiler summary="Hint"> Do we really have to consider the problem on the whole matrix? </spoiler> <spoiler summary="Solution"> Let $r$ be the num...
$\text{id}(x)=x$ and $1(x)=1$, which can be calculated through $\text{min25}$ Seive, but we only need, Where $\text{id}(x)=x$ and $1(x)=1$, which can be calculated through $\text{min25}$Seive, but we

Full text and comments »

  • Vote: I like it
  • +167
  • Vote: I do not like it

4.
By 7oSkaaa, history, 5 years ago, In English
Topics Problems Good Day to you! While a lot of us, when he begins to start competitive programming he found difficult to found problems on some topics in the beginning to practice of it, and same thing for a lot of ICPC Communites that they have started. These are some topic not advanced and videos, problems and articles on them. <br> <spoiler summary="Prefix Sum & Frequency Array"> [Wonderful Coloring](https://codeforces.me/contest/1551/problem/B1) [Do Not Be Distracted](https://codeforces.me/contest/1520/problem/A) [Letter](https://codeforces.me/problemset/problem/43/B) [Pangram](https://codeforces.me/problemset/problem/520/A) [Andryusha and Socks](https://codeforces.me/contest/782/problem/A) [Count Numbers](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/A) [Count Characters](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/B) [Range Sum Query](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/E) [Count a's](https...

Full text and comments »

  • Vote: I like it
  • +23
  • Vote: I do not like it

5.
By Baba, history, 10 years ago, In English
CodeCraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) Editorial [757A &mdash; Gotta Catch Em' All!](http://www.codeforces.com/contest/757/problem/A) ------------------ **Author:** [user:tanujkhattar,2017-01-13] **Testers:** [user:r.arora,2017-01-13] [user:born2rule,2017-01-13] **Expected complexity**: $\mathcal{O}(n)$ **Main idea**: Maintain counts of required characters. Since we are allowed to permute the string in any order to find the maximum occurences of the string "Bulbasaur", we simply keep the count of the letters 'B', 'u', 'l', 'b', 'a', 's', 'r'. Now the string "Bulbasaur" contains 1 'B', 2'u', 1 'l', 2'a', 1 's', 1'r' and 1 'b', thus the answer to the problem is Min(count('B'), count('b'), count('s'), count('r'), count('l'), count('a')/2, count('u')/2). You can maintain the counts using an array. **Corner Cases:** 1. Neglecting 'B' and while calculating the answer considering count('b')/2. 2. Considering a letter more than once ( 'a' and 'u' ). <spoiler summ...
); const int R=int(1e6)+5,P=25,N=R,mod = int(1e9)+7; int F[R][P],LP[N]; inline voidseive, ,mod = int(1e9)+7; int F[R][P],LP[N]; inline void seive(){ LP[1]=1; for(int i=2;i

Full text and comments »

  • Vote: I like it
  • +181
  • Vote: I do not like it

6.
By accord, history, 7 months ago, In English
Codequest 2.0 — Editorial ### [Problem A &mdash; A "tiny" love story](https://codeforces.me/gym/680185/problem/A) Problem Idea by: [user:notalone008,2026-03-25] <br> Problem Preparation by: [user:notalone008,2026-03-25] <br> <spoiler summary="Solution"> The clock only shows values from **0 to 59** and wraps around (modulo 60). The only thing to be checked here was if the call duration was a multiple of 60 seconds or not. - If s % 60 == 0 → print "NO" - Else → print "YES" </spoiler> <spoiler summary="Code"> ~~~~~ #include <bits/stdc++.h> using namespace std; //--------code begins here-------- void solve() { int s; cin >> s; if(s % 60) cout << "YES"; else cout << "NO"; } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int T = 1; cin >> T; while (T--) { solve(); cout << endl; } return 0; } ~~~~~ </spoiler> ### [Problem B &mdash; God is 1 and his name is 1](https://codeforces.me/gym/680185/problem/B) Problem Ide...
// prime seive till 10^4 (safe limit) const int NMAX = 1e4; bitset bits; bits.set, ::sync_with_stdio(false); cin.tie(0); // prime seive till 10^4 (safe limit) const int NMAX = 1e4

Full text and comments »

  • Vote: I like it
  • +13
  • Vote: I do not like it

7.
By PrinzeOP, history, 4 years ago, In English
CSES Problem Set Coin Combinations II -- TLE in Correct code. Problem Link : https://cses.fi/problemset/task/1636/ If you are getting TLE in your correct code, then don't get deprecated. I have submitted several times and get frustrated. So, here is the solution <spoiler summary="Solution"> just change long long to int </spoiler> Thanks for reading, Keep coding. <spoiler summary="My Code"> ```// Peacefull soul PrinZe // Practice is the only shortcut to improve #include <bits/stdc++.h> using namespace std; #define tc(t) int t; cin >> t; while (t--) #define REP(i,a,b) for(int i=a;i<b;++i) #define REPI(i,a,b) for(int i=a;i>=b;--i) #define vi vector<int> #define endl "\n" #define Ka_chow ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const int M = 1e9 + 7; vector<vector<int>> dp; void Cyan() { // Think Twice Code Once int n, k; cin >> n >> k; vi a(n); REP(i, 0, n) cin >> a[i]; dp.resize(n + 1, vi(k + 1, 0)); dp[n][0] = 1; REPI(i, n - 1, 0) { REP(sum, 0 , k + 1) { ...
() { Ka_chow // seive(); // tc(t) Cyan(); } ```

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

8.
By bugbuster404, history, 5 years ago, In English
[HELP]1600 Rated Graph Problem involving shortest paths I have been trying this for a long time but still getting WA on test 22 (onwards) [Problem](https://codeforces.me/contest/954/problem/D) Basically you are given an undirected graph consisting of **n vertices** and **m edges** where every edge has **weight=1**. The distance between two vertices is equal to the minimum possible number of edges on a path between them. There are given two vertices **S** and **T** . You have to select two vertices **u** and **v** (where u and v don't have a direct edge) such that joining them **DOES NOT** decrease the distance between S and T. We have to print how many such distinct unordered pairs exist... ... I ran BFS two times and found the shortest distance of every vertices from S and T and used the following relation to find whether u and v should be added or not:- `if ((distance_s[u] + distance_t[v] + 1 < distance_s[t]) || (distance_s[v] + distance_t[u] + 1 < distance_s[t]))` Here is the entire code :- <spoiler> ~~~~~ #...
freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif // seive(); int, ); #endif //seive(); int tc = 1; // cin >> tc; while (tc--) solve(); } ~~~~~

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

9.
By vaibhav_t_3000, history, 4 years ago, In English
1000 rating to Specialist , This is actually working for me #1000 rating to Specialist , This is actually working for me. Focus on Doing these many Topics and get problem A, B, C of div2 within 30-40 min. Step 1: https://youtu.be/U2E9PxRd680 -road map by candidate master Priyansh31dec Step 2: NUMBER THEORY: 1: Modular arithmatic, Primes, Multiples , Divisors 2: Bitwise, Euclidean algo, Seive of Eratosthenes 3: Binary Modular Exponentiation 4: Combinatorics RESOURCES: 1) https://www.youtube.com/watch?v=dg1CUYrLrD0&list=PL5DyztRVgtRWblnyEHtajWijQffrfwLz6 2) https://cp-algorithms.com/#algebra 3) https://www.youtube.com/watch?v=tDM6lT-qjys Step 3: BINARY & TERNARY SEARCH: 1: Monotonic Functions & Binary search on answers 2: C++ STL ( upper and lower bound ) 3: Convex functions & Ternary Functions RESOURCES: 1) https://codeforces.me/edu/courses 2) https://www.youtube.com/watch?...
2: Bitwise, Euclidean algo, Seive of Eratosthenes

Full text and comments »

  • Vote: I like it
  • -21
  • Vote: I do not like it

10.
By prakharmishra, history, 15 months ago, In English
C++ STL and Functions for Beginners **Hello Everyone**, 1. I found this C++ STL (standard template library) sheet online. Useful for someone starting out. Contains mostly everything about the basic data structures and how to implement them.<br> **Attaching link to pdf**, [Link](https://drive.google.com/file/d/1etfkqWxn-jxI6xMZgc6slibTi1TUr0f8/view?usp=sharing) 2. Also attaching a small document I made, contains frequently used functions and tricks like finding MEX of array, nCr(combination), GCD, LCM, Seive, binary exponentiation for finding power etc.<br> **Attaching link to document**, [Link](https://drive.google.com/file/d/1PG0v5kaWsBHVgYneFz00jHYFvV_uJKoV/view?usp=sharing) **Preview,**<br> ![ ](/predownloaded/61/1a/611a3b5485d6be5cd384ba8b67790f1349478336.png) <br> ![ ](/predownloaded/7b/73/7b73df514e1084ceb4c0abdc3b003ce9d46e861a.png) <br> **PS:** _Please suggest if you have more such functions or notice any errors and I'll fix them right away._ <br> UPD: Added some questions in the document to practi...
finding MEX of array, nCr(combination), GCD, LCM, Seive, binary exponentiation for finding power etc., used functions and tricks like finding MEX of array, nCr(combination), GCD, LCM,Seive, binary

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

11.
By corpulent, history, 6 years ago, In English
I have a problem, Segmented Seive. I have to perform segmenteed seive. This is my code. It shows segmented fault error, please tell the correction. [My Code](https://ideone.com/UU78qz) ThankYou
I have a problem, Segmented Seive., I have to perform segmenteed seive. This is my code. It shows segmented fault error, please tell

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it

12.
By slow_hare, history, 6 years ago, In English
How to find exact count of prime no.s in a given range ? Problem Link : [**Here**](https://mycode.prepbytes.com/problems/bit-manipulation/TOMDIVIDES) How to approach this problem? I got the logic to solve as: - The no.s in the range **>60 and <=n(given)** which are not **special**(See the problem statement) has to be prime. - So the ans would be like n &mdash; (count of primes in range [61,n]) - Would seive work Here?(as constraints are high) I came to know about the prime no. theorem which gives the **approx count** of prime no.s less than x [as _pi(x) = x/ln(x)_ or _pi(x) = x/(ln(x)-1)_] Every bit of help would be appreciated :) Thank you so much! for giving a look to this blog.
be like n — (count of primes in range [61,n]) - Would seive work Here?(as constraints are, ]) - Would seive work Here?(as constraints are high)

Full text and comments »

  • Vote: I like it
  • +11
  • Vote: I do not like it

13.
By Ehsan_sShuvo, history, 10 years ago, In English
How does Segmented Seive work? Can anyone please help me to understand the "Segmented Seive"?I have tried myself as i can do enough to get it but unfortunately still now i don't catch it. Thanks in advance!
How does Segmented Seive work?, Can anyone please help me to understand the "Segmented Seive"?I have tried myself as i can do

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it

14.
By jash2703, history, 2 years ago, In English
Seive function Can any one solve this C++ code N^(f(X)) mod M f(X) is defined as product of primes upto X 1<=N,M<=10^9 1<=X<=10^6
Seive function

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

15.
By z_e_z_e, history, 6 years ago, In English
seive hello, I want to ask you a question , what is the real time complexity of seive? is it nlog(log(n)) or sqrt(n)log(log(n)) , and why? and whish loop of this code is cost that time complexity ? 1- for(int i=2; i<=n; i++) { 2- if(isprime[i]) 3- { for(int j=i*i; j<=n; j+=i) isprime[j]=0; } } thanks alot.
seive

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

16.
By Ssaranshh13, history, 4 years ago, In English
WHY TLE? I have written the code to solve [problem:1609C] problem, but it gives TLE. I think the complexity of my soln. is O(n*log(log(n) because of Seive rest of the work i have done in linear time. My approach is as follows: Suppose arr[i] is prime I have calculated the number of chains of 1 on left of arr[i] and similarly on right of arr[i]. Then i have used sum+=onesLeft[i]+onesRight[i]+onesLeft[i]*onesRight[i]; to get the answer. Here is my submission ----> https://codeforces.me/contest/1609/submission/160055418. Please tell where I am wrong in calculating the time complexity? Thanks in advance.
of my soln. is O(n*log(log(n) because of Seive rest of the work i have done in linear time. My

Full text and comments »

Tags dp
  • Vote: I like it
  • -10
  • Vote: I do not like it

17.
By I_lOVE_ROMAN, history, 5 years ago, In English
Sieve of Eratosthenes Why second loop of sieve of Eratosthenes starting from square of current prime number? ~~~~~ vector<bool>vc(100006,1); void seive(int n) { vc[0]=vc[1]=0; int i,j; for(i=2;i*i<=n;i++) { if(vc[i]==1) { for(j=i*i;j<=n;j=j+i) { vc[j]=0; } } } } ~~~~~ My question is why the second loop starting from square of i. How the multiples before the square of current prime(i) getting marked ?Actually how are we so sure of it?
? ~~~~~ vectorvc(100006,1); void seive(int n) { vc[0]=vc[1]=0; int i,j; for(i=2;i*i, ~~~~~ vectorvc(100006,1); void seive(int n) { vc[0]=vc[1]=0; int i,j; for(i

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

18.
By jaigurudev, 12 years ago, In English
Different methods of finding prime in a given range [l,u] Method 1 : for all n belonging to [l,u]{ if(n==2 || n==3) then n is prime and continue for all odd i belonging from 3 to sqrt(n) if i is a factor of n => n is not prime else n is prime } Method 2: seive of eratosthenes Consider an array a = {2,3,4,...,u} do until array 'a' is non empty{ let x be the first element of 'a' in ascending order remove x and all its multiples from 'a' if x>=l => x is a prime in [l,u] } For Any other good methods .. please comment
n is prime } Method 2: seive of eratosthenes Consider an array a = {2,3,4,...,u} do until, Method 2: seive of eratosthenes Consider an array a = {2,3,4,...,u} do until array 'a' is non

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

19.
By kvishu, history, 9 years ago, In English
Need Help on SPOJ ETFS Question. I am try to solve SPOJ ETFS Question [Question Link](https://www.spoj.com/problems/ETFS). [My Solution Link](http://ideone.com/3IMO41) I calculate prime no less than 10^7 using Seive and then suing segemnt seive calculate phi(i) for every i But getting WA asnwer...
Solution Link](http://ideone.com/3IMO41) I calculate prime no less than 10^7 usingSeive and then suing

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it