I am wondering if I could always replace all long long type into int64_t type without breaking the program ? Will it somehow affects the program or remains the same ?
And how about the relationship between int and int32_t types
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3382 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 155 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 145 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 134 |
| 9 | maroonrk | 132 |
| 10 | cry | 130 |
I am wondering if I could always replace all long long type into int64_t type without breaking the program ? Will it somehow affects the program or remains the same ?
And how about the relationship between int and int32_t types
Recently while I am solving a problem, I realised that increase iterator after erasing the last element of the map (the map is empty) then it would run infinitively
So I stop the loop by adding a small line to check whether it is empty or not
/// map-looping using either iterator or reverse iterator
{
/// some code upper that erase the element but possible to make the map empty
if (map.empty()) break;
}
Is there an alternative way (some other implementations) to prevent from iterator increament when the map is empty (and reverse_iterator too if possible)
In this problem. How can I solve it using dsu ?
I see the problem has dsu-tag, but the editorial but doesnt show dsu approach there :(
#include <iostream>
#include <vector>
using namespace std;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vb> vmb;
typedef vector<vi> vmi;
int main()
{
int n, q;
cin >> n >> q;
vmb f(3, vb(n + 2, false));
int delta = 0;
while (q--)
{
int r, c;
cin >> r >> c;
f[r][c].flip();
if (r == 1)
delta += (f[1][c] ? +1 : -1) * (f[2][c - 1] || f[2][c] || f[2][c + 1]);
else
{
delta += (f[2][c] ? +1 : -1) * (f[1][c] && !f[2][c - 1] && !f[2][c + 1]);
delta += (f[2][c] ? +1 : -1) * (f[1][c - 1] && !f[2][c - 1] && !f[2][max(c - 2, 0)]);
delta += (f[2][c] ? +1 : -1) * (f[1][c + 1] && !f[2][c + 1] && !f[2][min(c + 2, n + 1)]);
}
cout << (delta == 0 ? "Yes\n" : "No\n");
}
return 0;
}
Are there any effeciency algorithms to find shortest path using disjoin-set data structure ?
I know I am a low-ranker contestant. But during the contest, it took me more than 2 minutes just to do something. And every 30 minutes I been logged out and it take me again 3 ~ 5 minutes to log-in. It is very annoy :( Please help me, why the codeforces was so slow. This is the second time I write this blog (The first was ignore by auto-log-out)
Nice logo Codeforces UwU Love it <3

----------
Time to write first 10.000.000 non-negative numbers
(base on Codeforces Custom Test // GNU G++ 17 7.3.0 // GNU G++ 14 6.4.0 // GNU G++ 11 5.1.0)
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", q);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", q);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << q;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(q); Flusher();
return 0;
}
Time to write 1.000 times first 10000 numbers
(base on Codeforces Custom Test // GNU G++ 17 7.3.0 // GNU G++ 14 6.4.0 // GNU G++ 11 5.1.0)
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
printf("%d", i);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
Flusher();
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
printf("%d", i);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
printf("%d", i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
Flusher();
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
printf("%d", i);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
cout << i;
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
printf("%d", i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
putchar(x / p + '0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e3;
while (q--)
for (int i = 0; i <= 1e4; ++i)
writeInt(i);
Flusher();
return 0;
}
Time to write first 10.000.000 non-positive numbers
(base on Codeforces Custom Test // GNU G++ 17 7.3.0 // GNU G++ 14 6.4.0 // GNU G++ 11 5.1.0)
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-');
writeRec(abs(x));
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", -q);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(-q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-');
writeRec(abs(x));
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", -q);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10)
_putchar_nolock(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
#define pc _putchar_nolock
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
_putchar_nolock(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) _putchar_nolock('-'), x = -x;
writeRec(x);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) _putchar_nolock('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) _putchar_nolock(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(-q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", -q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(-q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-');
writeRec(abs(x));
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-');
writeRec(abs(x));
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", -q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(-q); Flusher();
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int q = 1e7;
while (q--) cout << -q;
return 0;
}
#include <iostream>
using namespace std;
#define pc putchar
inline void writeInt(int n)
{
if (n < 0) pc('-'), n = -n;
if (!n) return (void)pc('0');
int t = n, cnt = 0, rev = 0;
while (!(t%10)) { cnt++; t /= 10;}
do {rev=rev*10 + n%10;} while(n /= 10);
do {pc(rev % 10 + 48);} while(rev /= 10);
while (cnt--) pc('0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeInt(int x)
{
if (x < 0) putchar('-'), x = -x;
int p = 1;
for (int t = x / 10; t > 0; t /= 10)
p *= 10;
for (; p > 0; x %= p, p /= 10) putchar(x / p + '0');
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
inline void writeRec(int n) {
if (n > 9) writeRec(n / 10);
putchar(char(n % 10 + '0'));
}
inline void writeInt(int x)
{
if (x < 0) putchar('-');
writeRec(abs(x));
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <iostream>
using namespace std;
char os[20];
inline void writeInt(int n)
{
if (n < 0) putchar('-'), n = -n;
int i=0;
do os[i++] = n%10; while(n/=10);
while (i--) putchar(os[i] + 48);
}
int main()
{
int q = 1e7;
while (q--) writeInt(-q);
return 0;
}
#include <cstdio>
using namespace std;
int main()
{
int q = 1e7;
while (q--) printf("%d", -q);
return 0;
}
#include <iostream>
using namespace std;
static const int buf_len = (1 << 14);
static const int buf_max = (1 << 04);
static char buf_out[buf_len];
static char buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x) {
if (buf_pos == buf_len) fwrite(buf_out, 1, buf_len, stdout), buf_pos = 0;
buf_out[buf_pos++] = x;
}
inline void writeInt(int x, char end = 0) {
if (x < 0) writeChar('-'), x = -x;
int n = 0;
do buf_num[n++] = x % 10 + '0'; while(x /= 10);
while (n--) writeChar(buf_num[n]);
if (end) writeChar(end);
}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
int main()
{
int q = 1e7;
while (q--) writeInt(-q); Flusher();
return 0;
}
Single Line Template
char os[20];
inline void writeInt(int n){if(n<0)putchar('-'),n=-n;int i=0;do{os[i++]=n%10;}while(n/=10);while(i--)putchar(os[i]+48);}
inline void writeInt(int x){if(x<0)putchar('-'),x=-x;int p=1;for(int t=x/10;t>0;t/=10)p*=10;for(;p>0;x%=p,p/=10)putchar(x/p+'0');}
#define pc putchar
inline void writeInt(int n){if(n<0)pc('-'),n=-n;if(!n)return(void)pc('0');int t=n,cnt=0,rev=0;while(!(t%10)){cnt++;t/=10;}do{rev=rev*10+n%10;}while(n/=10);do{pc(rev%10+48);}while(rev/=10);while(cnt--)pc('0');}
inline void writeRec(int n){if(n>9)writeRec(n/10);putchar(char(n%10+'0'));}
inline void writeInt(int x){if(x<0)putchar('-');writeRec(abs(x));}
char os[20];
inline void writeInt(int n){if(n<0)_putchar_nolock('-'),n=-n;int i=0;do{os[i++]=n%10;}while(n/=10);while(i--)_putchar_nolock(os[i]+48);}
inline void writeInt(int x){if(x<0)_putchar_nolock('-'),x=-x;int p=1;for(int t=x/10;t>0;t/=10)p*=10;for(;p>0;x%=p,p/=10)_putchar_nolock(x/p+'0');}
#define pc _putchar_nolock
inline void writeInt(int n){if(n<0)pc('-'),n=-n;if(!n)return(void)pc('0');int t=n,cnt=0,rev=0;while(!(t%10)){cnt++;t/=10;}do{rev=rev*10+n%10;}while(n/=10);do{pc(rev%10+48);}while(rev/=10);while(cnt--)pc('0');}
inline void writeRec(int n){if(n>9)writeRec(n/10);_putchar_nolock(char(n%10+'0'));}
inline void writeInt(int x){if(x<0)_putchar_nolock('-');writeRec(abs(x));}
printf("%d", x);
ios::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
ios::sync_with_stdio(true),cin.tie(NULL),cout.tie(NULL);
cout << x;
static const int buf_len = (1 << 14), buf_max = (1 << 04);
static char buf_out[buf_len], buf_num[buf_max];
static int buf_pos = 0;
inline void writeChar(int x){if(buf_pos==buf_len)fwrite(buf_out,1,buf_len,stdout),buf_pos=0;buf_out[buf_pos++]=x;}
inline void writeInt(int x,char end=0){if(x<0)writeChar('-'),x=-x;int n=0;do{buf_num[n++]=x%10+'0';}while(x/=10);while(n--)writeChar(buf_num[n]);if(end)writeChar(end);}
struct Flusher{~Flusher(){if(buf_pos)fwrite(buf_out, 1, buf_pos, stdout),buf_pos=0;}}flusher;
----------
----------
----------
I dont know how to use Template for multiple input. Can you help me ?
template <typename T>
bool read_int(T &x) {
bool start = false , neg = false;
T ret = 0;
for (char r; r = getchar(); ) {
if (r == '-') neg = true;
else if ((r < '0' || r > '9'))
if (start) return false; else continue;
else
ret += r - '0';
if (start) ret *=10;
start = true;
}
return x = (neg ? -ret : ret), true;
}
template <typename T, typename... Tnext>
bool read_int(T &x, Tnext... next)
{
read_int(next...);
}
Sorry for my bad English. Correct me if I am wrong.
Thanks for reading <3
I recently found the opperator co_await and co_yield in C++. How should I apply this into the code and should I use these operator in competitive programming ?
Sorry for my bad English and knowledge.
If I am wrong about something please guide me.
Thanks for reading <3
Question: Given two positive numbers N and M, find minimal |c — M| where N mod c = 0
Can we solve this problem in O(log (n)) or faster ?
Here is my approach in O(sqrt(n))
int f(int n, int m)
{
int r = 1;
int rt = sqrt(n);
for (int i = 1; i <= rt; ++i)
{
if (n % i == 0)
{
int j = n / i;
r = abs(r - m) < abs(j - m) ? r : j;
r = abs(r - m) < abs(i - m) ? r : i;
}
}
return r;
}
Sorry for my bad English ;-;
If I have wrong something, please tell me. It is better to do that than just downvote me because I and someone will learn many new things <3
| Name |
|---|


