Skip to content

Instantly share code, notes, and snippets.

@shankerwangmiao
Last active October 2, 2022 10:42
Show Gist options
  • Save shankerwangmiao/64f59ea2213f64dd5fa99fef7ca93ade to your computer and use it in GitHub Desktop.
Save shankerwangmiao/64f59ea2213f64dd5fa99fef7ca93ade to your computer and use it in GitHub Desktop.
/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4O//F9NdADoZSs4dkJsneBz/bNOb8/VIi6mfPJyl4E3R
ZPRcjYWVP8ZadAyWoshi62XKsliYPJ3ZGvuyQYNLzaIm/jpS0gzPRcE5gLB+4tZ4uGlPDpE7k9GZ
pq4A8utK90UGiwuv9fBUm9V7i3VqqeviR3k0gMBMFA9ZaFuE8fgVPumm0RVLqzGsMjjVQKeixvOm
PtLetv0A15UkErykYvsVFqJJr0kqcHNgis9Kbs50SRQKwd02jtw6IUeczWWLH8LeY4xJKaI06VwR
HeQSj01Uq7MfDCXB5TG1fcbmQ8wH0mt0TMpj7hSyB/ftQ3ffs0qJsBlD3H8UD2REt5hz+xDlOmKU
dBbrNzWLgibljkgu6kWIXUDVXfXkLQSIFdY0WkA76QfC//SpIwRV44tdxaLR2FcDIuR9hhN4qn+u
J/of6GZC8VtsSvqAe3QbqMrmDQn7c0kD4xQrm6VAg0KaWsOxE57s0TemWRsm+egHoZdkEIu8BkQV
+ceH8rKKJhHSO0oO3Z7psBdd8lJOPpMulPkC/iwq6xEM96YIPBAmYpJ2nI+ppIyxUX2GCuuEUklH
8wBFkbQkMpK42VGEemXFOIBVC7CXr6HFf+4JdVEqxETB4DCExvMTi4W0ULDIvvLh0gHq6DOPweOs
fB4TpzMlthqCBZ/OXyJviy37nUUgIGSZ+KQNN78e2pMFRDfKY1xk+e+zl14mqklRtTBg0o9EsOPR
aaiS7pSokKibbt2y2MWlQQcdF+VdWISe8aT8e7ZxFvJJDpmVJShSetTWJsEjp3YUwOLb/VA/LRVp
IHGoI/rSJez/YNDEsmIvxPG6r9nj5/b7IoOHnl+ixf+MjL9fThGqZQ/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NL5kn+fMDAHj+wRd1ipy758q/oN7mxuDkVrh2L4GFl7z
Kfjn1HoTwaTFVABlAgHmr7OaOdlzkzyc8t9MjOb5XUjYhWfgh5fIjFFB3EgFcotOj2hW8qzIFfz7
T1jA5rjctLSitu7Ps2dwcibF0RmhPlzW1caW8/lybbx0ZJomMADcKbq5mq6gW1Nw98N7gEE0ies/
sKeA/nyUKLmpueFNp8TZ6JbfBUmITce5dpXBAs5n6QM6LznkLpDgWxzSgm5ngeWaKGxjlrim/bVa
Y2bEcsH8fz6rSapVKG1AJdw6C9xpjvY93jgMW5bcU7Xyeke3OrvJWmXNzNJzqYC8Bts7Po9cP32w
Ld4PvCEuj20FJhuHvj9t41aGjMiekoh/KoogDoc/hUpG0wKpIv5LII3FMWM5eSIJZ5GFNU8wK/gl
nLUV/EGmovTI0KWt6H7qBnIIFuY63mEEfaH55l2HIGbp78WLKmJkjeo2sGzizkPJSfvepXWpa34t
Uj+VTOGIF4xChIr4LsXLAWK/aLxUvLUSURFPlvp0O1j+dXgotiWMevRxif+dHvMgAVG/faZ6pnoq
Tz2AiJAc0gw5aVQodV9uZHFjagCJbNU1YsEDuMsxpFACydK3VxSzP89TIVbaQ6roGLHej+KTXR1h
TjO2VhT5OOsvxNV3CS3hFzcDxIEM2EUdRjVNrMfLAqKoPPcqQq+Y7ctHvhR6uaHzUwIVIKAEGsIb
ovhhDnekdS3T1YAm2O6+/1UqQdpU3ejPaHObZUrmTN6MkN6CgYJIedFMcbQnP50uLScLSUd8JAQl
NaQi5vnJyiQsrvSLyXfGETe1i9bV5XAYQcctbvEqYS5SoJ2CKWNtKPBktLa+KAuiC4Lspaw80JPW
1bYi/shmZcR8KOl9hABUOuH7BH4zVnzFtswBPgboAAAAn/XEItwiH1cAAe8vgOADAAfwQAixxGf7
AgAAAAAEWVo=
#include <stdio.h>
#include <stdlib.h>
#ifdef __WANT_HACK__
# include <sys/resource.h>
#endif
int main(){
#ifdef __WANT_HACK__
struct rlimit myLimit = {
.rlim_cur = RLIM_INFINITY,
.rlim_max = RLIM_INFINITY
};
setrlimit(RLIMIT_AS, &myLimit);
#endif
int *buf = malloc(1026u * 1024 * 1024); // alloc >1G
if(!buf){
perror("malloc");
exit(-1);
}
FILE *fin = fopen("plus.in", "r");
FILE *fout = fopen("plus.out", "w");
fscanf(fin, "%d%d", buf, buf+1024);
fprintf(fout, "%d\n", buf[0] + buf[1024]);
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#ifdef __WANT_HACK__
# include <unistd.h>
# include <sys/types.h>
# include <sys/wait.h>
#endif
int main(){
volatile int a, b;
volatile int c;
FILE *fin = fopen("plus.in", "r");
FILE *fout = fopen("plus.out", "w");
fscanf(fin, "%d%d", &a, &b);
#ifdef __WANT_HACK__
int comm_pipe[2];
pipe(comm_pipe);
pid_t chld = fork();
if(chld > 0){
close(comm_pipe[1]);
waitpid(chld, NULL, 0);
char dummyBuf[1];
read(comm_pipe[0], dummyBuf, 1);
}else{
close(comm_pipe[0]);
pid_t gchld = fork();
if(gchld > 0){
return 0;
}
#endif
clock_t init = clock();
while(1){
for(int j = 0; j < 1000; j++){
for(int k = 0; k < 1000; k++){
c = a + b;
}
}
clock_t now = clock();
if((now - init + 0.0)/CLOCKS_PER_SEC > 1.2){
break;
}
}
fprintf(fout, "%d\n", c);
#ifdef __WANT_HACK__
close(comm_pipe[1]);
}
#endif
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment