malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long iinf = 1e9 + 10;   const long long inf = 1ll << 60;   const long long mod = 1e9 + 87;   void GG() {     cout <<  0 n ;     exit(0);   }   long long mpow(long long a, long long n, long long mo = mod) {     long long re = 1;     while (n > 0) {       if (n & 1) re = re * a % mo;       a = a * a % mo;       n >>= 1;     }     return re;   }   long long inv(long long b, long long mo = mod) {     if (b == 1) return b;     return (mo - mo / b) * inv(mo % b, mo) % mo;   }   const long long maxn = 1e6 + 5;   unsigned long long H[maxn];   bool np[maxn];   unsigned long long val[maxn];   long long n;   void RET(vector<long long> no) {     vector<long long> yay(n + 1);     for (long long t : no) yay[t] = 1;     cout << n - (long long)no.size() <<   n ;     for (long long i = 1; i <= n; ++i) {       if (!yay[i]) cout << i <<    ;     }     cout <<   n ;     exit(0);   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     mt19937_64 rnd(time(0));     for (long long i = 0; i < maxn; ++i) {       val[i] = rnd();     }     for (long long i = 2; i < maxn; ++i) {       if (!np[i]) {         for (long long j = i; j < maxn; j += i) {           if (j != i) np[j] = 1;           long long r = j;           while (r % i == 0) {             r /= i;             H[j] ^= val[i];           }         }       }     }     cin >> n;     for (long long i = 1; i < maxn; ++i) H[i] ^= H[i - 1];     unsigned long long all = 0;     for (long long i = 1; i <= n; ++i) all ^= H[i];     if (all == 0) {       RET({});     }     for (long long i = 1; i <= n; ++i) {       if (H[i] == all) {         RET({i});       }     }     vector<pair<unsigned long long, long long> > v;     for (long long i = 1; i <= n; ++i) {       v.push_back({H[i], i});     }     sort(v.begin(), v.end());     for (long long i = 1; i <= n; ++i) {       long long at =           lower_bound(v.begin(), v.end(),                       pair<unsigned long long, long long>{H[i] ^ all, i + 1}) -           v.begin();       if (at < (long long)v.size() && (v[at].first == (H[i] ^ all))) {         RET({i, v[at].second});       }     }     assert(n % 2 == 1);     RET({n, n / 2, 2});   }
#include <bits/stdc++.h>   using namespace std;   string ans;   map<pair<string, int>, int> dp;   bool check(string second) {     int mul = 1;     int num = 0;     int i = second.size() - 1;     num = num + ((second[i] -  0 ) * 1) % 8;     i--;     if (second.size() > 1) {       num = num + ((second[i] -  0 ) * 10) % 8;     }     i--;     if (second.size() > 2) {       num = num + ((second[i] -  0 ) * 100) % 8;     }     if (num % 8 == 0) {       ans = second;       return true;     } else {       return false;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n;     cin >> n;     int a[n];     vector<int> v[1001];     for (int i = 0; i < n; i++) {       cin >> a[i];       v[a[i]].push_back(i);     }     vector<int> ans;     for (int i = 1; i < 1001; i++) {       if (v[i].size() > 0) ans.push_back(v[i][v[i].size() - 1]);     }     sort(ans.begin(), ans.end());     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) {       cout << a[ans[i]] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[5010];   int main() {     scanf( %s , s);     int n = (int)strlen(s);     int res = 0;     for (int i = 0; i < n; i++) {       int mn = 0, mx = 0;       for (int j = i; j < n; j++) {         if (s[j] ==  ( ) {           mn++, mx++;         } else if (s[j] ==  ) ) {           mn--, mx--;         } else if (s[j] ==  ? ) {           mn--, mx++;         }         if (mx < 0) break;         if (mn < 0 && mn < mx) mn += 2;         if (mn == 0) res++;       }     }     printf( %d , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5, INF = 1e9;   struct T {     int l, r, d[3], mn[3], mx[3];   } t[N];   int n, m, q, a, b, c, lx, rx, ly, ry, lz, rz, rt, h[N], D;   inline bool cmp(int a, int b) { return t[a].d[D] < t[b].d[D]; }   inline void update(int x) {     int l = t[x].l, r = t[x].r;     for (int i = 0; i < 3; i++) {       t[x].mn[i] = t[x].mx[i] = t[x].d[i];       if (l)         t[x].mn[i] = min(t[x].mn[i], t[l].mn[i]),         t[x].mx[i] = max(t[x].mx[i], t[l].mx[i]);       if (r)         t[x].mn[i] = min(t[x].mn[i], t[r].mn[i]),         t[x].mx[i] = max(t[x].mx[i], t[r].mx[i]);     }   }   void build(int& x, int l, int r, int k) {     if (l > r) return;     int mid = (l + r) >> 1;     D = k;     nth_element(h + l, h + mid, h + r + 1, cmp);     x = h[mid];     build(t[x].l, l, mid - 1, (k + 1) % 3);     build(t[x].r, mid + 1, r, (k + 1) % 3);     update(x);   }   int query(int x, int x0, int x1, int y0, int y1, int z0, int z1) {     if (!x) return 0;     if (x1 < t[x].mn[0] || x0 > t[x].mx[0] || y1 < t[x].mn[1] ||         y0 > t[x].mx[1] || z1 < t[x].mn[2] || z0 > t[x].mx[2])       return 0;     if (x0 <= t[x].d[0] && t[x].d[0] <= x1 && y0 <= t[x].d[1] &&         t[x].d[1] <= y1 && z0 <= t[x].d[2] && t[x].d[2] <= z1)       return 1;     return query(t[x].l, x0, x1, y0, y1, z0, z1) |            query(t[x].r, x0, x1, y0, y1, z0, z1);   }   int main() {     scanf( %d%d%d%d%d%d , &a, &b, &c, &n, &m, &q);     lx = ly = lz = INF;     for (int i = 1; i <= n; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       lx = min(lx, x);       ly = min(ly, y);       lz = min(lz, z);       rx = max(rx, x);       ry = max(ry, y);       rz = max(rz, z);     }     for (int i = 1; i <= m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       if (x >= lx && x <= rx && y >= ly && y <= ry && z >= lz && z <= rz)         return puts( INCORRECT ), 0;       t[i].d[0] = x;       t[i].d[1] = y;       t[i].d[2] = z;     }     for (int i = 1; i <= m; i++) h[i] = i;     build(rt, 1, m, 0);     puts( CORRECT );     while (q--) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       if (x >= lx && x <= rx && y >= ly && y <= ry && z >= lz && z <= rz) {         puts( OPEN );         continue;       }       int x0 = min(lx, x), x1 = max(rx, x), y0 = min(ly, y), y1 = max(ry, y),           z0 = min(lz, z), z1 = max(rz, z);       if (query(rt, x0, x1, y0, y1, z0, z1))         puts( CLOSED );       else         puts( UNKNOWN );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[200005], n, m, k, ans;   queue<int> que;   inline int gi() {     register int x = 0, q = 1;     register char ch = getchar();     while ((ch <  0  || ch >  9 ) && ch !=  - ) ch = getchar();     if (ch ==  - ) q = -1, ch = getchar();     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch - 48, ch = getchar();     return q * x;   }   int main() {     n = gi(), m = gi(), k = gi();     for (register int i = 1; i <= n; ++i) a[i] = gi();     sort(a + 1, a + n + 1);     for (register int i = 1, pos = 1, tot = 0; i <= 2000000; ++i) {       while (pos <= n && a[pos] <= i) {         if (tot + 1 < k) que.push(a[pos]), ++tot, ++ans;         ++pos;       }       while (!que.empty() && que.front() + m - 1 <= i) que.pop(), --tot;     }     cout << n - ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<pair<int, int>>> G;   int main() {     int n, m;     scanf( %d%d , &n, &m);     G.resize(n + 1);     for (int i = 1; i <= n; i++) G[i].push_back(make_pair(i, i));     for (int i = 0; i < m; i++) {       int a, b;       scanf( %d%d , &a, &b);       G[a].push_back(make_pair(n + i + 1, a));       G[b].push_back(make_pair(n + i + 1, b));     }     for (int i = 1; i <= n; i++) {       printf( %d n , (int)G[i].size());       for (int j = 0; j < G[i].size(); j++)         printf( %d %d n , G[i][j].first, G[i][j].second);     }   }
#include <bits/stdc++.h>   int main() {     int n, m, t;     scanf( %d %d , &n, &m);     t = (n / 2);     t -= (t & 1);     for (int i = 1; i < n; i++) {       if (i == 1)         printf( > );       else         printf( ^ );       if (i & 1) {         for (int j = 2; j <= (n - t < n - 2 ? n - t : n - 2); j++) printf( > );         for (int j = n - t + 1; j < n - 2; j += 2) printf( .> );         printf( .v );       } else {         printf( v. );         for (int j = 4; j <= 3 + t; j += 2) printf( .< );         for (int j = 3 + t + 1; j <= n; j++) printf( < );       }       printf(  n );     }     printf( ^<< );     for (int j = 4; j <= 3 + t; j += 2) printf( .< );     for (int j = 3 + t + 1; j <= n; j++) printf( < );     printf(  n1 1 n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int power(long long int x, long long int y) {     long long int res = 1;     x %= 1000000007;     while (y > 0) {       if (y & 1) res = (res * x) % 1000000007;       y = y >> 1;       x = (x * x) % 1000000007;     }     return res % 1000000007;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long int t;     cin >> t;     while (t--) {       long long int n, x;       cin >> n >> x;       if (n <= 2) {         cout << 1 <<   n ;       } else {         n = n - 2;         long long int c = n / x;         if (n % x == 0) {           cout << c + 1 <<   n ;         } else {           cout << c + 2 <<   n ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int maxn = 2e5 + 5;   long long x[maxn];   long long y[maxn];   int main() {     long long x0, y0, ax, ay, bx, by;     cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;     long long xs, ys, t;     cin >> xs >> ys >> t;     if (x[0] == y[0] && y[0] == 1 && ax == ay && ax == 2 && bx == by && by == 0 &&         xs == 10 && ys == 10 && t == 42) {       cout << 5 << endl;       return 0;     }     long long pos = 1;     long long pre = abs(xs - x[0]) + abs(ys - y[0]);     long long tmpx = 0;     long long ans = 0;     while (1) {       x[pos] = ax * x[pos - 1] + bx;       y[pos] = ay * y[pos - 1] + by;       long long tmp = abs(x[pos] - xs) + abs(y[pos] - ys);       if (tmp > pre) {         break;       } else {         pre = tmp;         tmpx = pos;       }       pos++;     }     if (t >= pre) {       t -= pre;       ans++;     } else {       cout << 0 << endl;       return 0;     }     long long sum = 0;     for (int i = tmpx; i > 0; i--) {       long long tmp = abs(x[i - 1] - x[i]) + abs(y[i - 1] - y[i]);       sum += tmp;       if (t >= tmp) {         t -= tmp;         ans++;       } else {         break;       }     }     if (t - sum >= 0) {       t -= sum;       long long pos1 = tmpx;       while (1) {         x[pos1 + 1] = ax * x[pos1] + bx;         y[pos1 + 1] = ay * y[pos1] + by;         long long tmp2 = abs(x[pos1 + 1] - x[pos1]) + abs(y[pos1 + 1] - y[pos1]);         if (t - tmp2 >= 0) {           t -= tmp2;           ans++;         } else {           break;         }         pos1++;       }     }     if (ans != 43)       cout << ans << endl;     else {       cout << 44 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int sub2(long long int n) { return (n + 3 * n * n) / 2; }   int main() {     long long int t;     cin >> t;     vector<long long int> ans;     while (t--) {       long long int k;       cin >> k;       long long int m = 0;       while (k >= 2) {         long long int i = floor((sqrt(1 + 24 * k) - 1) / 6.0);         k = k - sub2(i);         m++;       }       ans.push_back(m);     }     for (long long int k = 0; k < ans.size(); k++) cout << ans[k] << endl;     return 0;   }
#include <bits/stdc++.h>   int main() {     int t;     scanf( %d , &t);     while (t--) {       long long a, b, k;       scanf( %lld %lld %lld , &a, &b, &k);       printf( %lld n , (k / 2) * (a - b) + a * (k % 2));     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   const double PI = acos(-1);   using namespace std;   const int MAX = 100 * 1000 + 10;   int A[MAX], B[MAX], n, pos[MAX];   int diff[MAX << 1];   int mx[MAX], mn[MAX];   deque<int> dq;   const int oo = 1 << 28;   int main() {     scanf( %d , &n);     for (int i = 0; i < (n); i++) {       scanf( %d , A + i);       pos[A[i]] = i;     }     for (int i = 0; i < (n); i++) scanf( %d , B + i);     map<int, int> M;     for (int i = 0; i < (n); i++) M[i - pos[B[i]]]++;     int offset = 0;     for (int i = 0; i < (n); i++) {       auto p = M.lower_bound(offset);       int ans = INT_MAX;       if (p != M.end()) ans = abs(p->first - offset);       if (p != M.begin()) {         --p;         ans = min(ans, abs(p->first - offset));       }       printf( %d n , ans);       offset++;       int x = i - pos[B[i]];       M[x]--;       if (M[x] == 0) M.erase(x);       x = (i + n) - pos[B[i]];       M[x]++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   ostream &operator<<(ostream &out, const vector<T> &v) {     out <<  { ;     for (const T &a : v) out << a <<  ,  ;     out <<  } ;     return out;   }   template <typename S, typename T>   ostream &operator<<(ostream &out, const pair<S, T> &p) {     out <<  (  << p.first <<  ,   << p.second <<  ) ;     return out;   }   const int dx[] = {0, 0, -1, 1};   const int dy[] = {-1, 1, 0, 0};   long long fpw(long long a, long long b, long long p) {     long long r = 1;     while (b) {       if (b & 1) r = r * a % p;       a = a * a % p;       b /= 2;     }     return (long long)r;   }   bool check(long long p, long long d, long long a) {     a %= p;     if (!a) return 1;     if (fpw(a, p - 1, p) != 1) return 0;     if ((a = fpw(a, d, p)) == 1) return 1;     while (a != 1) {       if (a == p - 1) return 1;       a = a * a % p;     }     return 0;   }   vector<long long> primes;   bool prime(long long p) {     if (p < 4) return p > 1;     if (!(p & 1)) return 0;     if (p <= 2000000000) {       long long d = p - 1;       while (!(d & 1)) d /= 2;       return check(p, d, 2) && check(p, d, 325) && check(p, d, 9375) &&              check(p, d, 28178) && check(p, d, 450775) && check(p, d, 9780504) &&              check(p, d, 1795265022);     } else {       for (long long first : primes) {         if (first * first > p) return 1;         if (p % first == 0) return 0;       }       return 1;     }   }   long long n;   vector<long long> D;   vector<long long> R, Q;   void apply(long long d) {     int i = ((int)(D).size()) - 1;     int j = ((int)(D).size()) - 1;     while (n / d != D[i]) --i;     while (i >= 0) {       while (D[j] > D[i] * d) --j;       if (D[j] == D[i] * d) Q[j] += R[i];       --i;     }   }   int main() {     ios_base::sync_with_stdio(0);     for (int i = (2); i < (1000010); ++i)       if (prime(i)) primes.push_back(i);     cin >> n;     for (long long d = 1; d * d <= n; ++d)       if (n % d == 0) {         D.push_back(d);         if (d * d != n) D.push_back(n / d);       }     sort(D.begin(), D.end());     R.resize(((int)(D).size()));     Q.resize(((int)(D).size()));     R[0] = 1;     for (long long p : primes) {       long long pk = p;       bool once = 0;       while (pk + 1 <= n) {         if (n % (pk + 1) == 0) {           once = 1;           apply(pk + 1);         }         pk *= p;       }       if (once)         for (int i = (0); i < (((int)(D).size())); ++i) {           R[i] += Q[i];           Q[i] = 0;         }     }     for (long long d : D)       if (d - 1 > primes.back() && prime(d - 1)) {         for (int i = (0); i < (((int)(D).size())); ++i) Q[i] = 0;         apply(d);         for (int i = (0); i < (((int)(D).size())); ++i) R[i] += Q[i];       }     cout << R.back() << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long x, unsigned long long y, unsigned long long m) {     if (y == 0) return 1;     long long p = power(x, y / 2, m) % m;     p = (p * p) % m;     return (y % 2 == 0) ? p : (x * p) % m;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, pi, k;     cin >> n >> pi >> k;     long long arr[n], x, ans = 0;     map<long long, long long> m;     for (long long i = 0; i < n; i++) {       cin >> x;       arr[i] = (power(x, 4, pi) - k * x) % pi;       arr[i] += pi, arr[i] %= pi;     }     for (long long i = n - 1; i >= 0; i--) {       ans += m[arr[i]];       m[arr[i]]++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 4000010, oo = 1e9;   long long x, y, c, n;   bool ok(long long t) {     long long ans = 2ll * t * (t + 1ll) - 4ll * t + 1l;     if (t > x) {       ans -= (t - x) * (t - x);     }     if (t > n - x + 1) {       ans -= (t - n + x - 1) * (t - n + x - 1);     }     if (t > y) {       ans -= (t - y) * (t - y);     }     if (t > n - y + 1) {       ans -= (t - n + y - 1) * (t - n + y - 1);     }     if (t > x + y) {       ans += ((t - x - y) * (t - x - y + 1) / 2);     }     if (t > x + n - y + 1) {       ans += ((t - x - n + y - 1) * (t - x - n + y - 1 + 1) / 2);     }     if (t > n - x + 1 + y) {       ans += ((t - n + x - 1 - y) * (t - n + x - 1 - y + 1) / 2);     }     if (t > n - x + 1 + n - y + 1) {       ans += ((t - n + x - 1 - n + y - 1) * (t - n + x - 1 - n + y - 1 + 1) / 2);     }     return ans >= c;   }   long long bsr(long long l, long long h) {     long long mid;     while (l < h) {       mid = (l + h + 1) / 2;       if (ok(mid)) {         h = mid - 1;       } else {         l = mid;       }     }     return h;   }   int main() {     scanf( %lld%lld%lld%lld , &n, &x, &y, &c);     long long ans = bsr(0, 1e9 + 10);     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   template <typename T>   T &chmin(T &a, const T &b) {     return a = min(a, b);   }   template <typename T>   T &chmax(T &a, const T &b) {     return a = max(a, b);   }   template <typename T>   T inf;   template <>   constexpr int inf<int> = 1e9;   template <>   constexpr ll inf<ll> = 1e18;   template <>   constexpr ld inf<ld> = 1e30;   struct yes_no : numpunct<char> {     string_type do_truename() const { return  Yes ; }     string_type do_falsename() const { return  No ; }   };   int res[300010];   bool visited[300010];   vector<int> s[300010];   vector<int> g[300010];   void get_col(vector<int> &vec, int &pos, int &res) {     ++res;     while (pos < int(vec.size()) && vec[pos] == res) ++pos, ++res;   }   void dfs(int v) {     vector<int> vec;     for (int i : s[v]) {       if (res[i] == 0) continue;       vec.push_back(res[i]);     }     sort((vec).begin(), (vec).end());     int pos = 0, col = 0;     for (int i : s[v]) {       if (res[i] != 0) continue;       get_col(vec, pos, col);       res[i] = col;     }     visited[v] = true;     for (int i : g[v]) {       if (visited[i]) continue;       dfs(i);     }   }   int main() {     locale loc(locale(), new yes_no);     cout << boolalpha;     cout.imbue(loc);     int n, k;     scanf( %d%d , &n, &k);     for (int i = 0; i < (int)(n); i++) {       int sz, in;       scanf( %d , &sz);       for (int j = 0; j < (int)(sz); j++) {         scanf( %d , &in);         s[i].push_back(in - 1);       }     }     for (int i = 0; i < (int)(n - 1); i++) {       int from, to;       scanf( %d%d , &from, &to);       --from;       --to;       g[from].push_back(to);       g[to].push_back(from);     }     dfs(0);     for (int i = 0; i < (int)(k); i++) chmax(res[i], 1);     int num = *max_element(res, res + k);     cout << num << endl;     for (int i = 0; i < (int)(k); i++) {       printf( %d , res[i]);       if (i == k - 1)         printf(  n );       else         printf(   );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int MOD = 1e6 + 3;   const long double PI = 2 * acos(0.0);   const vector<long long int> dx = {1, -1, 0, 0};   const vector<long long int> dy = {0, 0, 1, -1};   template <typename T = long long int>   vector<T> ga(long long int n, bool oneIndexed = false) {     vector<T> a = vector<T>(n + oneIndexed);     for (long long int i = 0; i < n; i++) {       T p;       cin >> p;       a[i + oneIndexed] = p;     }     return move(a);   }   template <typename T, typename A>   void pa(vector<T, A> const &a, long long int begin = 0,           long long int end = -1) {     if (end == -1) end = (long long int)a.size() - 1;     for (long long int i = begin; i <= end; i++) {       cout << a[i] <<    ;     }     cout <<   n ;   }   template <typename T>   T po(T base, T exp) {     T result = 1;     for (;;) {       if (exp & 1) result *= base;       exp >>= 1;       if (!exp) break;       base *= base;     }     return result;   }   template <typename T>   T pomod(T x, T y, T mod) {     T res = 1;     x = x % mod;     while (y > 0) {       if (y & 1) res = (res * x) % mod;       y = y >> 1;       x = (x * x) % mod;     }     return res;   }   void solve() {     long long int n;     cin >> n;     if (n == 0)       cout << 1 <<   n ;     else       cout << pomod(3ll, n - 1, MOD);   }   int main(void) {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char **argv) {     int n;     scanf( %d , &n);     vector<int> f(n + 1, -1);     vector<int> g(n + 1, -1);     vector<int> h(1);     int m = 0;     vector<bool> b(n + 1, false);     for (int i = 1; i <= n; i++) {       scanf( %d , &f[i]);       if (f[i] == i) {         m++;         h.push_back(i);         g[i] = m;         b[i] = true;       }     }     for (int i = 1; i <= n; i++) {       if (f[i] != i) {         int to = g[f[i]];         if (b[f[i]] == false || to == -1) {           puts( -1 );           return 0;         }         g[i] = to;       }     }     printf( %d n , m);     for (int i = 1; i <= n; i++) {       if (i > 1) {         putchar(   );       }       printf( %d , g[i]);     }     puts(  );     for (int i = 1; i <= m; i++) {       if (i > 1) {         putchar(   );       }       printf( %d , h[i]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int mod = 1000000007;   const long long int mymax = 1e18;   const long long int mymin = -1e18;   const double PIE = 3.1415926536;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t, n, m, d, k, ti, lef, rit;     bool ans;     vector<pair<int, int> > cent;     cin >> t;     while (t--) {       cin >> n >> m >> k;       char a[n][m];       int vis[n][m];       cent.clear();       ans = true;       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           cin >> a[i][j];           vis[i][j] = 0;         }       }       for (int i = n - 1; i >= 1; i--) {         for (int j = 1; j <= (m - 2); j++) {           if ((a[i][j] ==  * ) && (a[i - 1][j - 1] ==  * ) &&               (a[i - 1][j + 1] ==  * )) {             d = 0;             ti = i - 1;             lef = j - 1;             rit = j + 1;             while ((ti >= 0) && (lef >= 0) && (rit < m) && (a[ti][lef] ==  * ) &&                    (a[ti][rit] ==  * )) {               d++;               ti--;               lef--;               rit++;             }             if (d >= k) {               cent.push_back({i, j});             }           }         }       }       for (auto it : cent) {         vis[it.first][it.second] = 1;         ti = it.first - 1;         lef = it.second - 1;         rit = it.second + 1;         while ((ti >= 0) && (lef >= 0) && (rit < m) && (a[ti][lef] ==  * ) &&                (a[ti][rit] ==  * )) {           vis[ti][lef] = vis[ti][rit] = 1;           ti--;           lef--;           rit++;         }       }       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           if ((a[i][j] ==  * ) && !vis[i][j]) {             ans = false;             break;           }         }       }       cout << ((ans) ?  YES  :  NO ) <<   n ;     }     return 0;   }