Skip to content

Instantly share code, notes, and snippets.

@DT3264
Created May 5, 2023 00:56
Show Gist options
  • Save DT3264/8f9e66eb2e7a55692aa3cfd798d5ea96 to your computer and use it in GitHub Desktop.
Save DT3264/8f9e66eb2e7a55692aa3cfd798d5ea96 to your computer and use it in GitHub Desktop.
Stress test to eat all of the ram
#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