func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAX_SIZE = 1e6 + 10, INF = 2 * 1e9, MAX_N = 7e3 + 5, MAX_K = 3e4 + 5;   const long long SuperINF = 1e18;   const double eps = 0.5, PI = 20 / 7;   void files() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   int tests;   int main() {     std::ios::sync_with_stdio(0);     cin >> tests;     for (int tt = 0; tt < tests; tt++) {       int n, k;       cin >> n >> k;       string s;       cin >> s;       set<int> open, close;       for (int i = 0; i < s.size(); i++) {         if (s[i] ==  ( )           open.insert(i);         else           close.insert(i);       }       vector<pair<int, int> > indexes;       bool need_open = false;       int cnt = 2 * (k - 1);       int ost = (n - 2 * (k - 1)) / 2;       int now_ost = 0;       bool flag = false;       for (int i = 0; i < s.size(); i++) {         if (cnt > 0)           need_open ^= true;         else {           flag = true;           if (ost > 0) {             need_open = true;           } else             break;         }         if (need_open) {           if (s[i] !=  ( ) {             if (open.size() == 0) return 1;             int f = *open.begin();             close.insert(f);             close.erase(i);             if (open.find(f) == open.end()) return 1;             open.erase(f);             indexes.push_back(make_pair(i + 1, f + 1));             swap(s[i], s[f]);           } else {             if (open.find(i) == open.end()) return 1;             open.erase(i);           }         } else {           if (s[i] !=  ) ) {             if (close.size() == 0) return 1;             int f = *close.begin();             open.insert(f);             open.erase(i);             if (close.find(f) == close.end()) return 1;             close.erase(f);             indexes.push_back(make_pair(i + 1, f + 1));             swap(s[i], s[f]);           } else {             if (close.find(i) == close.end()) return 1;             close.erase(i);           }         }         cnt--;         if (flag) ost--;       }       cout << indexes.size() <<   n ;       for (auto x : indexes) cout << x.first <<     << x.second <<   n ;     }   }   