#define STAT 10
/* wc2017b2 query-structure probe. Values are counts/100 (cap 15000 == 1.5M). */
static char pad[32 << 20];
static inline void dumpv(unsigned long long v) {
if (v > 15000) v = 15000;
volatile char *p = pad;
for (unsigned long long i = 0; i < v; i++) p[i * 4096] = 1;
}
#ifndef STAT
#define STAT 0
#endif
void solve(int n, int q, char *s1, char *s2, int *q_x, int *q_y, int *q_len, unsigned *ans) {
(void)s1; (void)s2;
unsigned long long v = 0; int c = 0;
switch (STAT) {
#if STAT == 10
case 10: for (int i = 0; i < q; i++) { int m = q_x[i] > q_y[i] ? q_x[i] : q_y[i]; if (q_len[i] == n - m) c++; } v = c / 100; break;
#elif STAT == 11
case 11: for (int i = 0; i < q; i++) if (q_x[i] == 0 || q_y[i] == 0) c++; v = c / 100; break;
#elif STAT == 12
case 12: for (int i = 0; i < q; i++) if (q_x[i] == 0) c++; v = c / 100; break;
#elif STAT == 13
case 13: for (int i = 0; i < q; i++) if (q_y[i] == 0) c++; v = c / 100; break;
#elif STAT == 14
case 14: for (int i = 0; i < q; i++) if (q_x[i] == q_y[i]) c++; v = c / 100; break;
#elif STAT == 15
case 15: { int mx = 0; for (int i = 0; i < q; i++) { int m = q_x[i] > q_y[i] ? q_x[i] : q_y[i]; int l2 = n - m; if (l2 > mx) mx = l2; } v = 0; for (int i = 0; i < q; i++) { int m = q_x[i] > q_y[i] ? q_x[i] : q_y[i]; if (q_len[i] > n - m) c++; } v = c / 100 + mx / 100000; break; }
#elif STAT == 16
case 16: for (int i = 0; i < q; i++) if (q_len[i] == 1) c++; v = c / 100; break;
#elif STAT == 17
case 17: { int mx = 0; for (int i = 0; i < q; i++) if (q_len[i] > mx) mx = q_len[i]; int mn = 1 << 30; for (int i = 0; i < q; i++) if (q_len[i] < mn) mn = q_len[i]; v = 0; c = mn; v = (unsigned long long)c / 1 + 0; break; }
#endif
default: break;
}
dumpv(1000 + v);
for (int i = 0; i < q; i++) ans[i] = 0;
}
//qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq