/*
References / 引用:
- jiegec, https://duck.ac/submission/48022: Complete public source: direct DuckInfo parsing, a*b-a-b and decimal output.
No separate license notice is present in these public submission sources.
All existing upstream attribution is retained above.
Approach / 思路:
Use the cited implementation unchanged as our first official online baseline.
There is no new algorithmic claim in this submission.
Experiment purpose / 试验目的:
Measure this account on duck.ac and test the exact user-specified threshold;
stop this problem immediately if the baseline qualifies.
*/
// This code is AI-generated. (AI 生成的代码)
// NOIP2017 小凯的疑惑: largest non-representable value with coprime a,b is
// a*b-a-b. Read a,b from DuckInfo and print it directly.
typedef unsigned long long u64;
struct DuckInfo {
u64 abi;
const char *in; u64 in_size;
char *out; u64 out_limit; u64 out_size;
char *err; u64 err_limit; u64 err_size;
const char *ib; u64 ib_limit;
char *ob; u64 ob_limit; u64 tsc;
} __attribute__((packed));
int main(void) { return 0; }
void __libc_start_main(int (*mf)(int, char **, char **), int ac, char **av) {
(void)mf;
struct DuckInfo *d = (struct DuckInfo *)((u64 *)av)[29];
const char *s = d->in;
u64 a = 0, b = 0;
while (*s != ' ') a = a * 10 + (u64)(*s++ - '0');
++s;
while (*s >= '0' && *s <= '9') b = b * 10 + (u64)(*s++ - '0');
u64 r = a * b - a - b;
char *o = d->out, *st = o;
do { *o++ = (char)('0' + r % 10); r /= 10; } while (r);
*o++ = '\n';
char *e = o - 2;
while (st < e) { char t = *st; *st = *e; *e = t; ++st; --e; }
d->out_size = (u64)(o - d->out);
__asm__ volatile("mov $60,%%eax; xor %%edi,%%edi; syscall" ::: "rax","rdi","rcx","r11","memory");
__builtin_unreachable();
}