func_code_string: #include <bits/stdc++.h>   using namespace std;   const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};   const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1},             ddy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};   const int nx[8] = {1, 2, 2, 1, -1, -2, -2, -1},             ny[8] = {-2, -1, 1, 2, 2, 1, -1, -2};   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int t = 1;     cin >> t;     while (t--) {       int n, k;       string s;       cin >> n >> k >> s;       bool ans = true;       for (int i = 0; i < k; i++) {         bool ze = true, on = true;         for (int j = i; j < n; j += k) {           if (s[j] ==  0 ) on = false;           if (s[j] ==  1 ) ze = false;         }         if (ze && !on) {           for (int j = i; j < n; j += k) s[j] =  0 ;         }         if (!ze && on) {           for (int j = i; j < n; j += k) s[j] =  1 ;         }         if (!ze && !on) {           ans = false;         }       }       int ze = 0, on = 0, qu = 0;       for (int i = 0; i < k; i++) {         if (s[i] ==  0 ) ze += 1;         if (s[i] ==  1 ) on += 1;         if (s[i] ==  ? ) qu += 1;       }       if (ze > k / 2 || on > k / 2) ans = false;       cout << (ans ?  YES  :  NO );     done:;       cout <<   n ;     }   }   