#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int FFTMOD = 119 << 23 | 1;
const int INF = (int) 1e9 + 23111992;
const ll LINF = (ll) 1e18 + 23111992;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ull isqrt(ull k) {ull r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
mt19937 mt(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int mrand() {return abs((int) mt());}
inline int mrand(int k) {return abs((int) mt()) % k;}
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
#define endln cerr << "\n";
void chemthan() {
int test; cin >> test;
FOR(it, 1, test + 1) {
db(it) endln;
cout << "Case #" << it << ": ";
int n, m, k, l; cin >> n >> m >> k >> l, k--;
vector<string> s(n);
FOR(i, 0, n) cin >> s[i];
vii changes(l);
FOR(i, 0, l) {
int u, v; cin >> u >> v; u--, v--;
changes[i] = mp(u, v);
}
{
vector<string> ss = vector<string>(m);
FOR(i, 0, m) {
FOR(j, 0, n) ss[i] += s[j][i];
}
s = ss;
}
auto solve = [&] () {
int C = min(n, m) + 5;
vector<vi> fen(m, vi(n + 5));
auto upd = [&] (vi& fen, int p, int v) {
p++;
for (; p < sz(fen); p += p & -p) {
fen[p] += v;
}
};
auto query = [&] (vi& fen, int p) {
p++;
chkmin(p, sz(fen) - 1);
int res = 0;
for (; 0 < p; p -= p & -p) {
res += fen[p];
}
return res;
};
FOR(i, 0, m) FOR(j, 0, n) {
if (s[i][j] == 'X') {
upd(fen[i], j, 1);
}
}
vi f(C);
auto ss = s;
auto upd_col = [&] (int col, int s) {
int sum = query(fen[col], k - 1);
FOR(i, 0, C) {
if (k + i < n) {
sum += ss[col][k + i] == 'X';
}
if (k + i < n && ss[col][k + i] == 'X') {
f[i] += s;
}
else {
if (k + 1 <= sum) {
f[i] += s;
}
}
}
};
FOR(i, 0, m) upd_col(i, 1);
vi res;
for (auto [u, v] : changes) {
upd_col(v, -1);
if (ss[v][u] == '.') {
ss[v][u] = 'X';
upd(fen[v], u, 1);
}
else {
ss[v][u] = '.';
upd(fen[v], u, -1);
}
upd_col(v, +1);
res.pb(INF);
FOR(i, 0, C) chkmin(res.back(), f[i] + i);
}
return res;
};
vi res(l, INF);
FOR(it, 0, 2) {
auto tmp = solve();
FOR(i, 0, l) chkmin(res[i], tmp[i]);
FOR(i, 0, m) reverse(all(s[i]));
for (auto& [u, v] : changes) {
u = n - u - 1;
}
k = n - k - 1;
}
cout << accumulate(all(res), 0LL) << "\n";
}
}
int32_t main(int32_t argc, char* argv[]) {
ios_base::sync_with_stdio(0), cin.tie(0);
if (argc > 1) {
assert(freopen(argv[1], "r", stdin));
}
if (argc > 2) {
assert(freopen(argv[2], "wb", stdout));
}
chemthan();
cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Ci8vI3ByYWdtYSBHQ0Mgb3B0aW1pemUoIk9mYXN0IikKLy8jcHJhZ21hIEdDQyB0YXJnZXQoInNzZSxzc2UyLHNzZTMsc3NzZTMsc3NlNCxwb3BjbnQsYWJtLG1teCxhdngsdHVuZT1uYXRpdmUiKQogCiNkZWZpbmUgbXMocywgbikgbWVtc2V0KHMsIG4sIHNpemVvZihzKSkKI2RlZmluZSBGT1IoaSwgYSwgYikgZm9yIChpbnQgaSA9IChhKTsgaSA8IChiKTsgKytpKQojZGVmaW5lIEZPUmQoaSwgYSwgYikgZm9yIChpbnQgaSA9IChhKSAtIDE7IGkgPj0gKGIpOyAtLWkpCiNkZWZpbmUgRk9SYWxsKGl0LCBhKSBmb3IgKF9fdHlwZW9mKChhKS5iZWdpbigpKSBpdCA9IChhKS5iZWdpbigpOyBpdCAhPSAoYSkuZW5kKCk7IGl0KyspCiNkZWZpbmUgc3ooYSkgaW50KChhKS5zaXplKCkpCiNkZWZpbmUgcHJlc2VudCh0LCB4KSAodC5maW5kKHgpICE9IHQuZW5kKCkpCiNkZWZpbmUgYWxsKGEpIChhKS5iZWdpbigpLCAoYSkuZW5kKCkKI2RlZmluZSB1bmk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sdXRpb25fY2xvY2s6Om5vdygpLnRpbWVfc2luY2VfZXBvY2goKS5jb3VudCgpKTsKaW5saW5lIGludCBtcmFuZCgpIHtyZXR1cm4gYWJzKChpbnQpIG10KCkpO30KaW5saW5lIGludCBtcmFuZChpbnQgaykge3JldHVybiBhYnMoKGludCkgbXQoKSkgJSBrO30KI2RlZmluZSBkYih4KSBjZXJyIDw8ICJbIiA8PCAjeCA8PCAiOiAiIDw8ICh4KSA8PCAiXSAiOwojZGVmaW5lIGVuZGxuIGNlcnIgPDwgIlxuIjsgCgp2b2lkIGNoZW10aGFuKCkgewogICAgaW50IHRlc3Q7IGNpbiA+PiB0ZXN0OwogICAgRk9SKGl0LCAxLCB0ZXN0ICsgMSkgewogICAgICAgIGRiKGl0KSBlbmRsbjsKICAgICAgICBjb3V0IDw8ICJDYXNlICMiIDw8IGl0IDw8ICI6ICI7CiAgICAgICAgaW50IG4sIG0sIGssIGw7IGNpbiA+PiBuID4+IG0gPj4gayA+PiBsLCBrLS07CiAgICAgICAgdmVjdG9yPHN0cmluZz4gcyhuKTsKICAgICAgICBGT1IoaSwgMCwgbikgY2luID4+IHNbaV07CiAgICAgICAgdmlpIGNoYW5nZXMobCk7CiAgICAgICAgRk9SKGksIDAsIGwpIHsKICAgICAgICAgICAgaW50IHUsIHY7IGNpbiA+PiB1ID4+IHY7IHUtLSwgdi0tOwogICAgICAgICAgICBjaGFuZ2VzW2ldID0gbXAodSwgdik7CiAgICAgICAgfQogICAgICAgIHsKICAgICAgICAgICAgdmVjdG9yPHN0cmluZz4gc3MgPSB2ZWN0b3I8c3RyaW5nPihtKTsKICAgICAgICAgICAgRk9SKGksIDAsIG0pIHsKICAgICAgICAgICAgICAgIEZPUihqLCAwLCBuKSBzc1tpXSArPSBzW2pdW2ldOwogICAgICAgICAgICB9CiAgICAgICAgICAgIHMgPSBzczsKICAgICAgICB9CiAgICAgICAgYXV0byBzb2x2ZSA9IFsmXSAoKSB7CiAgICAgICAgICAgIGludCBDID0gbWluKG4sIG0pICsgNTsKICAgICAgICAgICAgdmVjdG9yPHZpPiBmZW4obSwgdmkobiArIDUpKTsKICAgICAgICAgICAgYXV0byB1cGQgPSBbJl0gKHZpJiBmZW4sIGludCBwLCBpbnQgdikgewogICAgICAgICAgICAgICAgcCsrOwogICAgICAgICAgICAgICAgZm9yICg7IHAgPCBzeihmZW4pOyBwICs9IHAgJiAtcCkgewogICAgICAgICAgICAgICAgICAgIGZlbltwXSArPSB2OwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9OwogICAgICAgICAgICBhdXRvIHF1ZXJ5ID0gWyZdICh2aSYgZmVuLCBpbnQgcCkgewogICAgICAgICAgICAgICAgcCsrOwogICAgICAgICAgICAgICAgY2hrbWluKHAsIHN6KGZlbikgLSAxKTsKICAgICAgICAgICAgICAgIGludCByZXMgPSAwOwogICAgICAgICAgICAgICAgZm9yICg7IDAgPCBwOyBwIC09IHAgJiAtcCkgewogICAgICAgICAgICAgICAgICAgIHJlcyArPSBmZW5bcF07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICByZXR1cm4gcmVzOwogICAgICAgICAgICB9OwogICAgICAgICAgICBGT1IoaSwgMCwgbSkgRk9SKGosIDAsIG4pIHsKICAgICAgICAgICAgICAgIGlmIChzW2ldW2pdID09ICdYJykgewogICAgICAgICAgICAgICAgICAgIHVwZChmZW5baV0sIGosIDEpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIHZpIGYoQyk7CiAgICAgICAgICAgIGF1dG8gc3MgPSBzOwogICAgICAgICAgICBhdXRvIHVwZF9jb2wgPSBbJl0gKGludCBjb2wsIGludCBzKSB7CiAgICAgICAgICAgICAgICBpbnQgc3VtID0gcXVlcnkoZmVuW2NvbF0sIGsgLSAxKTsKICAgICAgICAgICAgICAgIEZPUihpLCAwLCBDKSB7CiAgICAgICAgICAgICAgICAgICAgaWYgKGsgKyBpIDwgbikgewogICAgICAgICAgICAgICAgICAgICAgICBzdW0gKz0gc3NbY29sXVtrICsgaV0gPT0gJ1gnOwogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICBpZiAoayArIGkgPCBuICYmIHNzW2NvbF1bayArIGldID09ICdYJykgewogICAgICAgICAgICAgICAgICAgICAgICBmW2ldICs9IHM7CiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoayArIDEgPD0gc3VtKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmW2ldICs9IHM7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CiAgICAgICAgICAgIEZPUihpLCAwLCBtKSB1cGRfY29sKGksIDEpOwogICAgICAgICAgICB2aSByZXM7CiAgICAgICAgICAgIGZvciAoYXV0byBbdSwgdl0gOiBjaGFuZ2VzKSB7CiAgICAgICAgICAgICAgICB1cGRfY29sKHYsIC0xKTsKICAgICAgICAgICAgICAgIGlmIChzc1t2XVt1XSA9PSAnLicpIHsKICAgICAgICAgICAgICAgICAgICBzc1t2XVt1XSA9ICdYJzsKICAgICAgICAgICAgICAgICAgICB1cGQoZmVuW3ZdLCB1LCAxKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGVsc2UgewogICAgICAgICAgICAgICAgICAgIHNzW3ZdW3VdID0gJy4nOwogICAgICAgICAgICAgICAgICAgIHVwZChmZW5bdl0sIHUsIC0xKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIHVwZF9jb2wodiwgKzEpOwogICAgICAgICAgICAgICAgcmVzLnBiKElORik7CiAgICAgICAgICAgICAgICBGT1IoaSwgMCwgQykgY2hrbWluKHJlcy5iYWNrKCksIGZbaV0gKyBpKTsKICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gcmVzOwogICAgICAgIH07CiAgICAgICAgdmkgcmVzKGwsIElORik7CiAgICAgICAgRk9SKGl0LCAwLCAyKSB7CiAgICAgICAgICAgIGF1dG8gdG1wID0gc29sdmUoKTsKICAgICAgICAgICAgRk9SKGksIDAsIGwpIGNoa21pbihyZXNbaV0sIHRtcFtpXSk7CiAgICAgICAgICAgIEZPUihpLCAwLCBtKSByZXZlcnNlKGFsbChzW2ldKSk7CiAgICAgICAgICAgIGZvciAoYXV0byYgW3UsIHZdIDogY2hhbmdlcykgewogICAgICAgICAgICAgICAgdSA9IG4gLSB1IC0gMTsKICAgICAgICAgICAgfQogICAgICAgICAgICBrID0gbiAtIGsgLSAxOwogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGFjY3VtdWxhdGUoYWxsKHJlcyksIDBMTCkgPDwgIlxuIjsKICAgIH0KfQoKaW50MzJfdCBtYWluKGludDMyX3QgYXJnYywgY2hhciogYXJndltdKSB7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApLCBjaW4udGllKDApOwogICAgaWYgKGFyZ2MgPiAxKSB7CiAgICAgICAgYXNzZXJ0KGZyZW9wZW4oYXJndlsxXSwgInIiLCBzdGRpbikpOwogICAgfQogICAgaWYgKGFyZ2MgPiAyKSB7CiAgICAgICAgYXNzZXJ0KGZyZW9wZW4oYXJndlsyXSwgIndiIiwgc3Rkb3V0KSk7CiAgICB9CiAgICBjaGVtdGhhbigpOwogICAgY2VyciA8PCAiXG5UaW1lIGVsYXBzZWQ6ICIgPDwgMTAwMCAqIGNsb2NrKCkgLyBDTE9DS1NfUEVSX1NFQyA8PCAibXNcbiI7CiAgICByZXR1cm4gMDsKfQo=
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
^
Main.java:6: error: illegal character: '#'
#define ms(s, n) memset(s, n, sizeof(s))
^
Main.java:6: error: class, interface, or enum expected
#define ms(s, n) memset(s, n, sizeof(s))
^
Main.java:7: error: illegal character: '#'
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:7: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:7: error: class, interface, or enum expected
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
^
Main.java:8: error: illegal character: '#'
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
^
Main.java:8: error: class, interface, or enum expected
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
^
Main.java:8: error: class, interface, or enum expected
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); --i)
^
Main.java:9: error: illegal character: '#'
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
^
Main.java:9: error: class, interface, or enum expected
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
^
Main.java:9: error: class, interface, or enum expected
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
^
Main.java:10: error: illegal character: '#'
#define sz(a) int((a).size())
^
Main.java:11: error: illegal character: '#'
#define present(t, x) (t.find(x) != t.end())
^
Main.java:12: error: illegal character: '#'
#define all(a) (a).begin(), (a).end()
^
Main.java:13: error: illegal character: '#'
#define uni(a) (a).erase(unique(all(a)), (a).end())
^
Main.java:14: error: illegal character: '#'
#define pb push_back
^
Main.java:15: error: illegal character: '#'
#define pf push_front
^
Main.java:16: error: illegal character: '#'
#define mp make_pair
^
Main.java:17: error: illegal character: '#'
#define fi first
^
Main.java:18: error: illegal character: '#'
#define se second
^
Main.java:19: error: illegal character: '#'
#define prec(n) fixed<<setprecision(n)
^
Main.java:20: error: illegal character: '#'
#define bit(n, i) (((n) >> (i)) & 1)
^
Main.java:21: error: illegal character: '#'
#define bitcount(n) __builtin_popcountll(n)
^
Main.java:23: error: class, interface, or enum expected
typedef unsigned long long ull;
^
Main.java:24: error: class, interface, or enum expected
typedef long double ld;
^
Main.java:25: error: class, interface, or enum expected
typedef pair<int, int> pi;
^
Main.java:26: error: class, interface, or enum expected
typedef vector<int> vi;
^
Main.java:27: error: class, interface, or enum expected
typedef vector<pi> vii;
^
Main.java:28: error: class, interface, or enum expected
const int MOD = (int) 1e9 + 7;
^
Main.java:29: error: class, interface, or enum expected
const int FFTMOD = 119 << 23 | 1;
^
Main.java:30: error: class, interface, or enum expected
const int INF = (int) 1e9 + 23111992;
^
Main.java:31: error: class, interface, or enum expected
const ll LINF = (ll) 1e18 + 23111992;
^
Main.java:32: error: class, interface, or enum expected
const ld PI = acos((ld) -1);
^
Main.java:33: error: class, interface, or enum expected
const ld EPS = 1e-9;
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:34: error: class, interface, or enum expected
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
^
Main.java:35: error: class, interface, or enum expected
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:36: error: class, interface, or enum expected
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
^
Main.java:37: error: '{' expected
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
^
Main.java:37: error: <identifier> expected
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
^
Main.java:37: error: : expected
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
^
Main.java:38: error: illegal start of type
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
^
Main.java:38: error: '{' expected
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
^
Main.java:38: error: <identifier> expected
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
^
Main.java:38: error: : expected
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
^
Main.java:39: error: ';' expected
inline ull isqrt(ull k) {ull r = sqrt(k) + 1; while (r * r > k) r--; return r;}
^
Main.java:39: error: invalid method declaration; return type required
inline ull isqrt(ull k) {ull r = sqrt(k) + 1; while (r * r > k) r--; return r;}
^
Main.java:40: error: ';' expected
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
^
Main.java:40: error: invalid method declaration; return type required
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
^
Main.java:41: error: <identifier> expected
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
^
Main.java:41: error: <identifier> expected
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
^
Main.java:41: error: <identifier> expected
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
^
Main.java:41: error: ';' expected
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
^
Main.java:42: error: <identifier> expected
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
^
Main.java:42: error: <identifier> expected
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
^
Main.java:42: error: <identifier> expected
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
^
Main.java:42: error: ';' expected
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
^
Main.java:43: error: <identifier> expected
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
^
Main.java:43: error: ',', ')', or '[' expected
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
^
Main.java:44: error: <identifier> expected
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
^
Main.java:44: error: ',', ')', or '[' expected
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
^
Main.java:45: error: <identifier> expected
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
^
Main.java:46: error: <identifier> expected
inline int sign(ld x, ld y) {return sign(x - y);}
^
Main.java:47: error: <identifier> expected
mt19937 mt(chrono::high_resolution_clock::now().time_since_epoch().count());
^
Main.java:48: error: <identifier> expected
inline int mrand() {return abs((int) mt());}
^
Main.java:49: error: <identifier> expected
inline int mrand(int k) {return abs((int) mt()) % k;}
^
Main.java:50: error: illegal character: '#'
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
^
Main.java:50: error: invalid method declaration; return type required
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
^
Main.java:50: error: <identifier> expected
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
^
Main.java:50: error: ';' expected
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
^
Main.java:50: error: illegal character: '#'
#define db(x) cerr << "[" << #x << ": " << (x) << "] ";
^
Main.java:51: error: illegal character: '#'
#define endln cerr << "\n";
^
Main.java:51: error: ';' expected
#define endln cerr << "\n";
^
Main.java:54: error: not a statement
int test; cin >> test;
^
Main.java:55: error: ';' expected
FOR(it, 1, test + 1) {
^
Main.java:56: error: ';' expected
db(it) endln;
^
Main.java:56: error: not a statement
db(it) endln;
^
Main.java:57: error: not a statement
cout << "Case #" << it << ": ";
^
Main.java:58: error: not a statement
int n, m, k, l; cin >> n >> m >> k >> l, k--;
^
Main.java:58: error: ';' expected
int n, m, k, l; cin >> n >> m >> k >> l, k--;
^
Main.java:59: error: ';' expected
vector<string> s(n);
^
Main.java:59: error: not a statement
vector<string> s(n);
^
Main.java:59: error: ';' expected
vector<string> s(n);
^
Main.java:60: error: ';' expected
FOR(i, 0, n) cin >> s[i];
^
Main.java:60: error: not a statement
FOR(i, 0, n) cin >> s[i];
^
Main.java:61: error: ';' expected
vii changes(l);
^
Main.java:61: error: not a statement
vii changes(l);
^
Main.java:61: error: ';' expected
vii changes(l);
^
Main.java:62: error: ';' expected
FOR(i, 0, l) {
^
100 errors