malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long MX = 100;   long long A[MX][MX];   long long acum[MX][MX];   long long n, m;   long long getAns(long long a, long long b) {     long long ans = n * m;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < m; j++) {         if (i + a - 1 < n && j + b - 1 < m) {           long long cur = 0;           for (long long l = i; l <= i + a - 1; l++) {             cur += acum[l][j + b] - acum[l][j];           }           ans = min(ans, cur);         }       }     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < m; j++) {         cin >> A[i][j];       }     }     for (long long i = 0; i < n; i++) {       for (long long j = 0; j < m; j++) {         acum[i][j + 1] = acum[i][j] + A[i][j];       }     }     long long a, b;     cin >> a >> b;     long long ans = min(getAns(a, b), getAns(b, a));     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   int const nmax = 100;   int v[1 + nmax];   map<int, int> dp;   int mex(vector<int> v) {     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     for (int i = 0; i < v.size(); i++)       if (v[i] != i) return i;     return v.size();   }   int computedp(int mask) {     map<int, int>::iterator it = dp.find(mask);     if (it != dp.end()) return it->second;     vector<int> v;     for (int i = 1; (1 << i) <= mask; i++) {       int newmask = ((mask & ((1 << i) - 1)) | (mask >> i));       v.push_back(computedp(newmask));     }     dp[mask] = mex(v);     return dp[mask];   }   map<int, int> frec;   void decompose(int number) {     for (int i = 2; i * i <= number; i++) {       if (number % i == 0) {         int p = 0;         while (number % i == 0) {           number /= i;           p++;         }         frec[i] |= (1 << p);       }     }     if (1 < number) frec[number] |= 2;   }   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> v[i];     for (int i = 1; i <= n; i++) decompose(v[i]);     int result = 0;     for (map<int, int>::iterator it = frec.begin(); it != frec.end(); it++) {       result ^= computedp(it->second | 1);     }     if (result == 0)       cout <<  Arpa ;     else       cout <<  Mojtaba ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void fast() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   long long cmp(pair<int, int> a, pair<int, int> b) {     return a.second < b.second;   }   int main() {     int n, m;     cin >> n >> m;     char a[n + 1][m + 1];     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         cin >> a[i][j];       }     }     long long ans = 0;     long long x[n + 1][m + 1];     long long y[n + 1][m + 1];     for (int i = 0; i <= n; i++) {       for (int j = 0; j <= m; j++) {         x[i][j] = 0;         y[i][j] = 0;       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (a[i][j] ==  0 ) {           x[i][j] = x[i][j - 1] + 1;           y[i][j] = y[i - 1][j] + 1;           long long ymin = y[i][j];           long long xmin = x[i][j];           for (int k = j - x[i][j] + 1; k <= j; k++) {             ymin = min(ymin, y[i][k]);           }           for (int k = i - y[i][j] + 1; k <= i; k++) {             xmin = min(xmin, x[k][j]);           }           long long p1 = ymin + x[i][j];           long long p2 = xmin + y[i][j];           long long p = (max(p1, p2)) * 2;           ans = max(p, ans);         }       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, m, a, b, s1, s2;     cin >> n >> m >> a >> b;     if (n % m == 0)       cout <<  0  << endl;     else {       s1 = (n - ((n / m) * m)) * b;       s2 = (((n / m) + 1) * m - n) * a;       if (s1 > s2)         printf( %I64d , s2);       else         printf( %I64d , s1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solution() {     int n, m;     cin >> n >> m;     int rows[n][m];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> rows[i][j];       }     }     int cols[m][n];     for (int i = 0; i < m; i++) {       for (int j = 0; j < n; j++) {         cin >> cols[i][j];       }     }     int el = cols[0][0];     for (int i = 0; i < n; i++) {       if (find(rows[i], rows[i] + m, el) != rows[i] + m) {         int l = find(rows[i], rows[i] + m, el) - rows[i];         int arrangement[n];         for (int j = 0; j < n; j++) {           for (int k = 0; k < n; k++) {             if (cols[0][j] == rows[k][l]) {               arrangement[j] = k;               break;             }           }         }         for (int i = 0; i < n; i++) {           for (int j = 0; j < m; j++) {             cout << rows[arrangement[i]][j] <<    ;           }           cout << endl;         }         return;       }     }     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int count, counter = 0;     cin >> count;     while (counter++ < count) {       solution();     }     return 0;   }
#include<bits/stdc++.h>      using namespace std;      #define task  sol    #define lb lower_bound   #define ub upper_bound   #define fi first   #define se second   #define pb push_back   #define mp make_pair   #define zs(v) ((int)(v).size())   #define BIT(x, i) (((x) >> (i)) & 1)   #define CNTBIT __builtin_popcountll   #define ALL(v) (v).begin(),(v).end()   #define endl   n       typedef long double ld;   typedef long long ll;   typedef pair<int, int> pii;      const ll base=331;   const int dx[8]={0,-1,0,1,1,-1,-1,1};   const int dy[8]={-1,0,1,0,-1,-1,1,1};      int c[55][55];   int mod;   ll dp[55][55*55];   ll fact[55];   int f[4005];   int n;         void gogo()   {       cin>>n>>mod;          dp[0][0]=1;       for (int i=1;i<=n;++i)       {           for (int num=0;num<=n*n;++num)           {               for (int k=1;k<=i;++k)                   if (num+i-k<=n*n) (dp[i][num+i-k]+=dp[i-1][num])%=mod;           }       }          for (int i=0;i<=n;++i)       {           c[i][0]=1;           for (int j=1;j<=i;++j)               c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;       }       fact[0]=1;       for (int i=1;i<=n;++i) fact[i]=fact[i-1]*i%mod;             int ans=0;       for (int i=0;i<n;++i)       {           ll val=c[n][i]*fact[i]%mod;           int len=n-i-1;           int m=len*(len-1)/2;              for (int i=0;i<=m;++i) f[i]=0;           for (int inv1=0;inv1<=m;++inv1)           {               for (int inv2=0;inv2<=inv1;++inv2)               {                   (f[inv1-inv2]+=dp[len][inv1]*dp[len][inv2]%mod)%=mod;               }           }           for (int i=1;i<=m;++i) (f[i]+=f[i-1])%=mod;           int value=0;           for (int x=1;x<=len+1;++x)           {               for (int y=x+1;y<=len+1;++y)               {                   assert(y-x>=0);                   if (m>y-x)                       (value+=(f[m]-f[y-x]+mod)%mod)%=mod;               }           }   //        cout<<value<<endl;           ans=(ans+val*value%mod)%mod;       }       cout<<ans;   }   int main()   {       ios_base::sync_with_stdio(0); cin.tie(0);       if (fopen(task .inp ,  r ))       {           freopen(task .inp ,  r , stdin);           freopen(task .out ,  w , stdout);       }       gogo();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, m, k, x = 0;     cin >> n >> m >> k;     if (n + m - 2 < k) {       cout << -1;       return 0;     }     if (m > n) swap(m, n);     if (k < m) x = n * (m / (k + 1));     if (k < n) x = max(x, m * (n / (k + 1)));     if (k >= n) x = m / (k - n + 2);     cout << x;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   long long int gcd(long long int a, long long int b) {     if (a < b)       return gcd(b, a);     else if (b == 0)       return a;     else       return gcd(b, a % b);   }   long long int isPrime(long long int n) {     long long int p = (long long int)sqrt(n);     for (int i = (2); i <= (p); i += (1))       if (n % i == 0) return 0;     return 1;   }   long long int pow(long long int b, long long int e) {     if (e == 0)       return 1;     else if (e % 2 == 0) {       long long int a = pow(b, e / 2);       return a * a;     } else {       long long int a = pow(b, e / 2);       return b * a * a;     }   }   long long int powm(long long int x, long long int y,                      long long int m = 1000000007) {     x = x % m;     long long int res = 1;     while (y) {       if (y & 1) res = res * x;       res %= m;       y = y >> 1;       x = x * x;       x %= m;     }     return res;   }   long long int modInverse(long long int a, long long int m) {     return powm(a, m - 2, m);   }   void solve() {     long long int n;     cin >> n;     vector<long long int> arr(n);     for (int i = (0); i <= (n - 1); i += (1)) cin >> arr[i];     if (n == 1) {       cout <<  1 1  <<   n             << (-arr[0]) <<   n             <<  1 1             <<   n0  <<   n             <<  1 1 n             <<  0  <<   n ;       return;     }     vector<vector<long long int>> ans;     ans.push_back({1, 1, -arr[0]});     arr[0] = 0;     vector<long long int> temp;     temp.push_back(2);     temp.push_back(n);     for (int i = (1); i <= (n - 1); i += (1)) {       long long int x = arr[i] % n;       arr[i] += x * (n - 1);       temp.push_back(x * (n - 1));     }     ans.push_back(temp);     temp.clear();     temp.push_back(1);     temp.push_back(n);     for (int i = (0); i <= (n - 1); i += (1)) {       temp.push_back(-arr[i]);     }     ans.push_back(temp);     for (int i = (0); i <= (2); i += (1)) {       cout << ans[i][0] <<     << ans[i][1] <<   n ;       for (int j = (2); j <= ((int)ans[i].size() - 1); j += (1))         cout << ans[i][j] <<    ;       cout <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int T = 1;     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, k;     cin >> n >> k;     string s;     cin >> s;     int l = -1;     for (int i = 0; i < n - 1 && k > 0; i++) {       if (s[i] ==  4  && s[i + 1] ==  7 ) {         if (i % 2 == 1) {           if (i - 1 >= 0 && s[i - 1] ==  4 ) {             l = i;             break;           }         }         --k;         if (i % 2 == 0)           s[i + 1] =  4 ;         else           s[i] =  7 ;       }     }     if (l != -1) {       if (k % 2 == 1) s[l] =  7 ;     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       long long n, i, j = 0, x;       cin >> n;       string s =   ;       stack<long long> q;       deque<long long> d;       for (i = 0; i < (n); i++) {         cin >> x;         d.push_back(x);       }       q.push(0);       while (!d.empty()) {         if (d.front() >= q.top() &&             (d.front() < d.back() || d.back() < q.top())) {           q.push(d.front());           s +=  L ;           d.pop_front();         } else if (d.back() >= q.top() &&                    (d.front() >= d.back() || d.front() < q.top())) {           q.push(d.back());           s +=  R ;           d.pop_back();         } else           break;       }       cout << q.size() - 1 <<   n ;       cout << s;     }   }
#include <bits/stdc++.h>   using namespace std;   const int MOD(1000000007);   const int Max_W(1000050);   inline int Mult(const int &a, const int &b) { return (a * 1LL) * b % MOD; }   constexpr int Add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }   constexpr int Sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }   void exgcd(const int &a, const int &b, int &x, int &y) {     if (b == 0)       x = 1, y = 0;     else       exgcd(b, a % b, y, x), y -= x * (a / b);   }   inline int inverse(const int &a) {     int invx, invy;     exgcd(a, MOD, invx, invy);     return (invx % MOD + MOD) % MOD;   }   int power(int a, int n) {     int Ret(1);     while (n) {       if (n & 1) Ret = Mult(Ret, a);       a = Mult(a, a), n >>= 1;     }     return Ret;   }   int W, A[Max_W], Fac[Max_W], Inv[Max_W];   inline int P(const int &n, const int &m) {     return (0 <= m && m <= n) ? Mult(Fac[n], Inv[n - m]) : 0;   }   int work(const int &N) {     int Ans(0);     if (W == 1)       Ans = N;     else       Ans = Mult(Sub(power(W, N + 1), W), inverse(Sub(W, 1)));     for (int len = N + 1; len - N <= W; ++len)       if (len - N < N + 1)         Ans =             Add(Ans, Mult(Mult(A[len - N], A[len - N]), power(W, N - (len - N))));       else         Ans = Add(Ans, Mult(A[len - N], P(W - ((len - N) - (N + 1) + 1), N)));     return Ans;   }   int main() {     int N;     scanf( %d%d , &W, &N);     A[0] = 1;     for (int i = 1; i <= W; ++i) A[i] = Mult(A[i - 1], W - i + 1);     Fac[0] = 1;     for (int i = 1; i <= W; ++i) Fac[i] = Mult(Fac[i - 1], i);     Inv[W] = inverse(Fac[W]);     for (int i = W - 1; i >= 0; --i) Inv[i] = Mult(Inv[i + 1], i + 1);     printf( %d , Sub(work(N), work(N - 1)));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   void solve() {     int n, k;     cin >> n >> k;     string s;     cin >> s;     set<char> st;     for (auto i : s) st.insert(i);     if (k > n) {       string p = s;       char ch = *st.begin();       for (int i = 0; i < k - n; i++) {         p += ch;       }       cout << p;     } else {       int p = k;       k--;       char ch = *st.rbegin();       if (s[k] == ch) {         for (; k >= 0; k--) {           if (s[k] != ch) break;         }         for (int i = 0; i < k; i++) cout << s[i];         cout << *(st.upper_bound(s[k]));         ch = *st.begin();         for (int i = 0; i < p - k - 1; i++) cout << ch;       } else {         for (int i = 0; i < k; i++) cout << s[i];         cout << *(st.upper_bound(s[k]));       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     solve();   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, c;   int n;   long long X1, Y1, X2, Y2;   long long sign(long long a) {     if (a > 0) return 1;     if (a < 0) return -1;     return 0;   }   int main() {     cin >> X1 >> Y1 >> X2 >> Y2;     cin >> n;     int ans = 0;     for (int i = 0; i < n; ++i) {       cin >> a >> b >> c;       if (sign(a * X1 + b * Y1 + c) != sign(a * X2 + b * Y2 + c)) ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       vector<long long> v(n);       set<long long> s;       for (long long x = 0; x < n; x++) {         cin >> v[x];       }       long long index = -1;       if (v[n - 1] > v[n - 2]) {         for (long long x = n - 1; x >= 1; x--) {           if (v[x] < v[x - 1]) {             index = x;             break;           }         }         cout << (index == -1 ? 0 : index) <<   n ;       } else {         long long count = 0;         long long index = -1;         for (long long x = n - 1; x > 0; x--) {           if (v[x] < v[x - 1] && count == 1) {             index = x;             break;           }           if (v[x] > v[x - 1]) {             count = 1;           }         }         cout << (index == -1 ? 0 : index) <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const int maxn = 110000;   int n, m, h;   int head[maxn], num;   struct road {     int to, next;   } edge[maxn * 2];   void add(int u, int v) {     edge[num].to = v;     edge[num].next = head[u];     head[u] = num++;   }   int dfn[maxn], low[maxn], block[maxn];   int id, cnt, vis[maxn], numxx[maxn];   int out[maxn];   stack<int> q;   void dfs(int u, int fa) {     dfn[u] = low[u] = ++id;     q.push(u);     vis[u] = 1;     for (int i = head[u]; i != -1; i = edge[i].next) {       int v = edge[i].to;       if (!dfn[v]) {         dfs(v, u);         low[u] = min(low[v], low[u]);       } else if (vis[v])         low[u] = min(low[u], dfn[v]);     }     if (dfn[u] == low[u]) {       cnt++;       int v;       do {         v = q.top();         vis[v] = 0;         q.pop();         block[v] = cnt;         numxx[cnt]++;       } while (v != u);     }   }   int tim[maxn];   void init() {     id = num = cnt = 0;     memset(dfn, 0, sizeof(dfn));     memset(low, 0, sizeof(low));     memset(edge, 0, sizeof(edge));     memset(numxx, 0, sizeof(numxx));     memset(block, 0, sizeof(block));     memset(vis, 0, sizeof(vis));     while (!q.empty()) q.pop();     memset(head, -1, sizeof(head));     memset(out, 0, sizeof(out));   }   int main() {     while (scanf( %d%d%d , &n, &m, &h) != EOF) {       init();       for (int i = 1; i <= n; i++) {         scanf( %d , &tim[i]);       }       for (int i = 1; i <= m; i++) {         int a, b;         scanf( %d%d , &a, &b);         if ((tim[a] + 1) % h == tim[b]) add(a, b);         if ((tim[b] + 1) % h == tim[a]) add(b, a);       }       for (int i = 1; i <= n; i++) {         if (!dfn[i]) dfs(i, -1);       }       for (int i = 1; i <= n; i++) {         for (int j = head[i]; j != -1; j = edge[j].next) {           int v = edge[j].to;           if (block[v] != block[i]) {             out[block[i]]++;           }         }       }       int ans = INF;       int flag = 0;       for (int i = 1; i <= cnt; i++) {         if (out[i] == 0) {           if (ans > numxx[i]) {             ans = numxx[i];             flag = i;           }         }       }       cout << ans << endl;       for (int i = 1; i <= n; i++) {         int putt = 0;         if (block[i] == flag) {           ans--;           putt = 1;         }         if (ans != 0 && putt == 1)           cout << i <<    ;         else if (ans == 0 && putt == 1)           cout << i << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 200001;   const long long int M = 21;   struct point {     long long int x, y, cur;     bool operator==(const point b) {       if (this->x == b.x && this->y == b.y) return 1;       return 0;     }     bool operator!=(const point b) { return !(*this == b); }     friend bool operator<(const point a, const point b) {       if (a.x != b.x) return a.x < b.x;       return a.y < b.y;     }   };   void debug(stringstream &s) {}   template <typename T, typename... Args>   void debug(stringstream &s, T a, Args... args) {     string word;     s >> word;     cout << word <<   =   << a << endl;     debug(s, args...);   }   bool overflow;   long long int fast_exp(long long int x, long long int n) {     if (n == 0) return 1;     long long int ans;     if (n % 2 == 0) {       ans = fast_exp(x, n / 2);       if (ans > ans * ans % 998244353) overflow = 1;       ans = ans * ans % 998244353;     } else {       ans = fast_exp(x, n - 1);       if (ans > ans * x % 998244353) overflow = 1;       ans = ans * x % 998244353;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int _ = 1;     while (_--) {       long long int n, m = 0, x = 0, y = 0, ans = 0, k;       string s, sol;       cin >> s;       n = s.size();       set<long long int, greater<long long int>> c[26];       s =  0  + s;       for (int i = 1; i <= n; i++) c[s[i] -  a ].insert(i);       long long int dp[n + 1][51];       memset(dp, -1, sizeof(dp));       for (int i = 0; i <= n; i++) dp[i][0] = n + 1;       for (int i = 1; i <= n; i++) {         for (int j = 1; j < 51; j++) {           dp[i][j] = dp[i - 1][j];           x = dp[i - 1][j - 1];           auto it = c[s[i] -  a ].upper_bound(x);           if (it != c[s[i] -  a ].end() && *it >= i) {             dp[i][j] = max(dp[i][j], *it);           }         }       }       x = -1;       for (int i = 50; i > 0; i--) {         bool flag = 0;         m = 0;         for (int j = 1; j <= n; j++) {           if (dp[j][i] != -1) {             if (dp[j][i] - j >= m) {               x = j;               y = i;               m = dp[j][i] - j;             }             flag = 1;           }         }         if (flag) break;       }       for (int i = x; i > 0; i--) {         if (dp[i - 1][y] != dp[i][y]) {           if (dp[i][y] > i)             sol = s[i] + sol + s[i];           else             sol = s[i];           y--;         }       }       cout << sol <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1);   const double EPS = 1e-7;   const int inf = 1e8;   int main() {     int n, sum = 0;     cin >> n;     vector<int> in(n);     for (int i = 0; i < n; i++) cin >> in[i];     for (int i = 0; i < n; i++) sum += in[i];     vector<int> used(n);     for (int i = 0; i < n; i++)       if (!used[i]) {         for (int j = i + 1; j < n; j++)           if (!used[j] && in[i] + in[j] == sum * 2 / n) {             used[i] = used[j] = true;             cout << i + 1 <<     << j + 1 << endl;             break;           }       }   }
#include <bits/stdc++.h>   using namespace std;   long long n, p, q, r, e, ans;   vector<long long> fst, lst, mid, Ans;   int main() {     cin >> n >> p >> q >> r;     for (int i = 0; i < n; i++) {       cin >> e;       fst.push_back(p * e);       mid.push_back(q * e);       lst.push_back(r * e);     }     long long mxe;     mxe = fst[0];     for (int i = 1; i < n; i++) {       mxe = max(mxe, fst[i]);       fst[i] = mxe;     }     mxe = lst[n - 1];     for (int i = n - 2; i >= 0; i--) {       mxe = max(mxe, lst[i]);       lst[i] = mxe;     }     for (int i = 0; i < n; i++) {       ans = fst[i] + mid[i] + lst[i];       Ans.push_back(ans);     }     cout << *max_element(Ans.begin(), Ans.end());   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int a[m][n];     for (int i = 0; i < m; i++)       for (int j = 0; j < n; j++) cin >> a[i][j];     int ans[n];     memset(ans, 0, sizeof(ans));     int k = 0;     int x = 0, y = 0;     int ma = INT_MIN;     for (int i = 0; i < m; i++) {       for (int j = 0; j < n; j++) {         if (a[i][j] > ma) {           x = j;           ma = a[i][j];         }       }       ans[x]++;       ma = INT_MIN;     }     ma = INT_MIN;     for (int i = 0; i < n; i++) {       if (ans[i] > ma) {         x = i;         ma = ans[i];       }     }     cout << x + 1 << endl;   }
#include <bits/stdc++.h>   using namespace std;   map<string, set<string> > ma;   set<string> hostname;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     while (n--) {       string s;       cin >> s;       int i = s.find( / , 7);       if (i != -1) {         string path = s.substr(i, s.size());         string name = s.substr(0, i);         ma[name].insert(path);         hostname.insert(name);       } else {         ma[s].insert( lorem );         hostname.insert(s);       }     }     map<set<string>, vector<string> > ans;     for (string s : hostname) {       ans[ma[s]].emplace_back(s);     }     for (auto it = begin(ans); it != end(ans);) {       if ((it->second).size() == 1) {         ans.erase(it->first);         it = begin(ans);       } else         ++it;     }     cout << ans.size() <<   n ;     for (auto [key, val] : ans) {       for (string s : val) {         cout << s <<    ;       }       cout <<   n ;     }     return 0;   }