Created
May 5, 2023 00:56
-
-
Save DT3264/8f9e66eb2e7a55692aa3cfd798d5ea96 to your computer and use it in GitHub Desktop.
Stress test to eat all of the ram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<vector> | |
#include<map> | |
#define ll long long | |
#define v vector | |
using namespace std; | |
int main(){ | |
ll lim = 1e9; | |
v<int> vec; | |
map<int, bool> mp; | |
for(int i=2; i<lim; i++){ | |
if(!mp[i]){ | |
vec.push_back(i); | |
for(int j=i*2; j<lim; j+=i){ | |
mp[j]=1; | |
vec.push_back(j); | |
} | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment