malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int N, B, Q;   int a[200005];   vector<int> adj[200005];   void init() {     B = sqrt(N);     for (int i = 1; i <= N; i++) {       a[i] = i;       adj[i / B].push_back(i);     }   }   long long work(int l, int r) {     if (l == r) return 0;     int idx, idy, x, y, k;     x = a[l];     y = a[r];     idx = l / B;     k = find(adj[idx].begin(), adj[idx].end(), x) - adj[idx].begin();     adj[idx][k] = y;     sort(adj[idx].begin(), adj[idx].end());     idy = r / B;     k = find(adj[idy].begin(), adj[idy].end(), y) - adj[idy].begin();     adj[idy][k] = x;     sort(adj[idy].begin(), adj[idy].end());     int ans = 0, f;     if (x > y)       f = -1, swap(x, y);     else       f = 1;     if (idx == idy) {       for (int i = l + 1; i <= r - 1; i++) {         if (x < a[i] && a[i] < y) ++ans;       }     } else {       for (int i = l + 1; i < (idx + 1) * B; i++) {         if (x < a[i] && a[i] < y) ++ans;       }       for (int id = idx + 1; id < idy; id++) {         ans += upper_bound(adj[id].begin(), adj[id].end(), y) -                lower_bound(adj[id].begin(), adj[id].end(), x);       }       for (int i = idy * B; i < r; i++) {         if (x < a[i] && a[i] < y) ++ans;       }     }     swap(a[l], a[r]);     return (2 * ans + 1) * f;   }   int main() {     scanf( %d%d , &N, &Q);     init();     int l, r;     long long ans = 0;     while (Q--) {       scanf( %d%d , &l, &r);       if (l > r) swap(l, r);       ans += work(l, r);       printf( %lld n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   long long a[N], pre[N];   int n;   long long check(int p, int len) {     return pre[p] - pre[p - len - 1] + pre[n] - pre[n - len];   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %lld , &a[i]);     sort(a + 1, a + 1 + n);     for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i];     int p = 1, len = 0;     long long ans = 0;     for (int i = 1; i <= n; i++) {       int l = 1, r = min(i - 1, n - i), mid;       while (r >= l) {         mid = l + r >> 1;         if ((long long)check(i, mid) * (mid * 2 - 1) >=             (long long)check(i, mid - 1) * (mid * 2 + 1)) {           l = mid + 1;           if ((long long)check(i, mid) * (len * 2 + 1) -                   a[i] * (len * 2 + 1) * (mid * 2 + 1) >               (long long)ans * (mid * 2 + 1) -                   a[p] * (len * 2 + 1) * (mid * 2 + 1))             ans = check(i, mid), p = i, len = mid;         } else           r = mid - 1;       }     }     printf( %d n , len * 2 + 1);     for (int i = p - len; i <= p; i++) printf( %d  , pre[i] - pre[i - 1]);     for (int i = n - len + 1; i <= n; i++) printf( %d  , pre[i] - pre[i - 1]);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[110], b[110], n;   int main() {     int t;     cin >> t;     while (t--) {       cin >> n;       for (register int i = 1; i <= n; i++) cin >> a[i];       for (register int i = 1; i <= n; i++) cin >> b[i];       sort(a + 1, a + n + 1);       sort(b + 1, b + n + 1);       for (register int i = 1; i <= n; i++) cout << a[i] <<    ;       puts(  );       for (register int i = 1; i <= n; i++) cout << b[i] <<    ;       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double EPS = 1e-9;   int INF = 2000000000;   long long INFF = 8000000000000000000LL;   double PI = acos(-1);   string IntToString(int a) {     char x[100];     sprintf(x,  %d , a);     string s = x;     return s;   }   int StringToInt(string a) {     char x[100];     strcpy(x, a.c_str());     int res;     sscanf(x,  %d , &res);     return res;   }   int spaces = 0;   char c[5];   int main() {     while (scanf( %c , &c[0]) != EOF && c[0] !=   n ) {       scanf( %c%c , &c[1], &c[2]);       if (c[2] ==  > ) {         spaces += 2;         for (int(i) = (1); (i) <= (spaces - 2); (i)++) printf(   );         for (int(i) = (0); (i) <= (2); (i)++) printf( %c , c[i]);         puts(  );       } else {         scanf( %c , &c[3]);         spaces -= 2;         for (int(i) = (1); (i) <= (spaces); (i)++) printf(   );         for (int(i) = (0); (i) <= (3); (i)++) printf( %c , c[i]);         puts(  );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000 + 100;   const int maxk = 45;   const int mod = 1000000007;   int dp[maxk][maxn];   int cnt[maxk][maxn];   void input_output() {     int t;     cin >> t;     for (int i = 0; i < t; i++) {       int n, k;       cin >> n >> k;       if (k < maxk)         cout << dp[k][n] << endl;       else         cout << 0 << endl;     }   }   void dpp() {     for (int i = 0; i < maxn; i++) dp[0][i] = 1, cnt[0][i] = i + 1;     for (int i = 1; i < 45; i++) {       for (int j = i; j < maxn; j++) {         dp[i][j] = (dp[i][j - i] + (long long)i * cnt[i - 1][j - i]) % mod;         cnt[i][j] = (cnt[i][j - 1] + dp[i][j]) % mod;       }     }   }   int main() {     dpp();     input_output();   }
#include <bits/stdc++.h>   using namespace std;   template <class T1, class T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  {  << p.first <<  ,  << p.second <<  } ;     return os;   }   const int N = 3e5 + 5;   const int oo = 1e9 + 7;   vector<pair<pair<int, int>, int> > X, Y;   pair<int, int> operator+(pair<int, int> x, pair<int, int> y) {     return {x.first + y.first, x.second + y.second};   }   bool pos() {     for (int i = 0; i < 4; i++) {       pair<int, int> a, b;       cin >> a.first >> a.second;       cin >> b.first >> b.second;       if (a == b) return 0;       if (a.first == b.first) {         if (b < a) swap(a, b);         Y.push_back({a, b.second - a.second});       } else if (a.second == b.second) {         if (b < a) swap(a, b);         X.push_back({a, b.first - a.first});       } else         return 0;     }     if (X.size() != 2) return 0;     if (Y.size() != 2) return 0;     sort(X.begin(), X.end());     sort(Y.begin(), Y.end());     if (X[0].second != X[1].second or X[0].first.first != X[1].first.first)       return 0;     if (Y[0].second != Y[1].second or Y[0].first.second != Y[1].first.second)       return 0;     if (X[0].first != Y[0].first) return 0;     if (X[0].first + make_pair(0, Y[0].second) != X[1].first) return 0;     if (Y[0].first + make_pair(X[0].second, 0) != Y[1].first) return 0;     return 1;   }   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     cout << (pos() ?  YES n  :  NO n );   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e6 + 10;   int z[MAXN];   void Zvalue(const string &s) {     z[0] = s.size();     int l = 0, r = 0, x;     for (int i = 1; i < s.size(); i++) {       if (r < i || z[i - l] >= r - i + 1) {         r < i ? x = i : x = r + 1;         while (x < s.size() && s[x] == s[x - i]) x++;         z[i] = x - i;         if (i < x) {           l = i;           r = x - 1;         };       } else         z[i] = z[i - l];     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int T;     cin >> T;     while (T--) {       string s;       cin >> s;       int p;       for (p = 0; p < s.size() - 1 - p; p++)         if (s[p] != s[s.size() - 1 - p]) break;       string smid = s.substr(p, s.size() - p * 2);       string revsmid = smid;       reverse(revsmid.begin(), revsmid.end());       Zvalue(smid +  $  + revsmid);       int ls = 0, rs = 0;       for (int i = 1; i <= smid.size(); i++)         if (i == z[smid.size() * 2 + 1 - i]) ls = i;       Zvalue(revsmid +  $  + smid);       for (int i = 1; i <= smid.size(); i++)         if (i == z[smid.size() * 2 + 1 - i]) rs = i;       if (ls > rs)         cout << s.substr(0, p + ls) + s.substr(s.size() - p, p) <<   n ;       else         cout << s.substr(0, p) + s.substr(s.size() - p - rs, p + rs) <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   int t, n;   long long a[100005];   int get_bit(long long x) {     int ans = 0;     while (x) {       ans++;       x >>= 1;     }     return ans;   }   int main() {     int i, j;     scanf( %d , &t);     while (t--) {       scanf( %d , &n);       for (i = 1; i <= n; i++) scanf( %lld , &a[i]);       int ans = 0, last = a[1];       for (i = 2; i <= n; i++) {         if (a[i] >= last) {           last = a[i];           continue;         }         ans = max(ans, get_bit(last - a[i]));       }       printf( %d n , ans);     }     return 0;   }
// Jai Shree Ram      #include<bits/stdc++.h>   typedef long long int ll;   #define pb push_back   #define max2(a,b) (a>b)?a:b   #define mi2(a,b) (a<=b)?a:b   #define fori(i,n) for(ll i=0;i<(ll)n;i++)   #define ford(i,n) for(ll i=n;i>=0;i--)   #define pll pair<ll,ll>   #define mod 1000000007   #define ff first   #define ss second   using namespace std;   #define MAXI 1e15   #define MAX_LIMIT 500001         void solve()   {              ll n;       cin>>n;       vector<ll> v(n),neg;       ll pos=MAXI;       bool fl=0;       fori(i,n)       {           cin>>v[i];           if(v[i]<=0)           {               neg.pb(v[i]);           }           else if(v[i]>0)           {               fl=1;               pos=min(pos,v[i]);           }       }       sort(neg.begin(),neg.end(),greater<ll>());       ll ans=neg.size();       if(fl==0)       {                      cout<<ans<<  n ;           return;       }       else       {              ll mini=MAXI;           for(int i=1;i<neg.size();i++)           {               ll val=abs(neg[i]-neg[i-1]);               mini=min(mini,val);           }                                        if(mini>=pos)               {                   ans++;               }                                              cout<<ans<<  n ;           return;                     }                                  }              int main()   {                      ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);                          ll T;       T=1;       cin>>T;              fori(_,T)       {                      solve();                  }                                   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int k, a, b;     cin >> k >> a >> b;     string s;     cin >> s;     int l = s.length();     double c = (double)l / k;     int c1 = floor(c);     int c2 = ceil(c);     int flag1 = 0, flag2 = 0;     if ((l - (c1 * (k - 1))) > b || (l - (c1 * (k - 1))) < a) {       flag1 = 1;     }     if ((l - (c2 * (k - 1))) > b || (l - (c2 * (k - 1))) < a) {       flag2 = 1;     }     if ((flag1 == 1 || c1 < a || c1 > b) && (flag2 == 1 || c2 < a || c2 > b)) {       cout <<  No solution ;       return;     }     if (flag1 == 0) {       int i1 = 0;       int kk = 0;       while (i1 <= l) {         kk++;         for (long long int i = i1; i < min(i1 + c1, l); i++) {           cout << s[i];         }         i1 += c1;         if (kk == k) {           for (long long int i = i1; i < l; i++) {             cout << s[i];           }           return;         }         printf(  n );       }     } else {       int i1 = 0;       int kk = 0;       while (i1 <= l) {         kk++;         for (long long int i = i1; i < min(i1 + c2, l); i++) {           cout << s[i];         }         i1 += c2;         if (kk == k) {           for (long long int i = i1; i < l; i++) {             cout << s[i];           }         }         printf(  n );       }     }   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   long long rt(long long a) {     long long p = 0, q = a;     while (p < q) {       long long s = (p + q + 1) / 2;       long long sv = s * (s + 1) / 2;       if (sv < a) p = s;       if (sv > a) q = s - 1;       if (sv == a) return s;     }     if (p * (p + 1) / 2 == a) return p;     return -1;   }   long long a, b, c, d;   bool possible(long long z, long long j) {     long long n = z + j;     if (a + b + c + d != n * (n - 1) / 2) {       return 0;     }     return 1;   }   bool solve(long long z, long long j) {     if (!possible(z, j)) {       return 0;     }     long long n = z + j;     if (j == 0) {       for (int i = 0; i < n; i++) cout <<  0 ;       return 1;     }     if (z == 0) {       for (int i = 0; i < n; i++) cout <<  1 ;       return 1;     }     long long ord[5];     ord[0] = b / j;     ord[2] = (ord[0] * j != b);     ord[3] = b - ord[0] * j;     ord[4] = z - ord[0] - ord[2];     ord[1] = j - ord[3];     for (int i = 0; i < 5; i++) {       for (int k = 0; k < ord[i]; k++) {         cout << (i % 2);       }     }     return 1;   }   int main() {     ios_base::sync_with_stdio(0);     cin >> a >> b >> c >> d;     if (a + b + c + d == 0) {       cout <<  1 n ;       return 0;     }     long long z = rt(a);     long long j = rt(d);     if (z == -1 || j == -1) {       cout <<  Impossible n ;       return 0;     }     ++z;     ++j;     if (z == 1 && j == 1) {       if (solve(0, 0)) return 0;       if (solve(0, 1)) return 0;       if (solve(1, 0)) return 0;       if (solve(1, 1)) return 0;       cout <<  Impossible n ;       return 0;     }     if (z == 1) {       if (solve(0, j)) return 0;       if (solve(1, j)) return 0;       cout <<  Impossible n ;       return 0;     }     if (j == 1) {       if (solve(z, 0)) return 0;       if (solve(z, 1)) return 0;       cout <<  Impossible n ;       return 0;     }     if (solve(z, j)) return 0;     cout <<  Impossible n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e15;   long long arr[100003];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %lld , &arr[i]);     if (n == 1 || n == 2)       printf( 0 n );     else {       long long res = INF;       for (int i = -1; i <= 1; i++) {         for (int j = -1; j <= 1; j++) {           long long a = arr[0] + i;           long long b = (arr[1] + j) - (arr[0] + i);           long long cnt = abs(i) + abs(j);           for (int k = 2; k < n; k++) {             if (abs(a + (k * b) - arr[k]) > 1)               cnt = INF;             else               cnt += abs(a + (k * b) - arr[k]);           }           res = min(res, cnt);         }       }       if (res <= 1e9)         printf( %lld n , res);       else         printf( -1 n );     }   }
#include <bits/stdc++.h>   template <class T>   T _diff(T a, T b) {     return (a < b ? b - a : a - b);   }   template <class T>   T _abs(T a) {     return (a < 0 ? -a : a);   }   template <class T>   T _max(T a, T b) {     return (a > b ? a : b);   }   template <class T>   T _min(T a, T b) {     return (a < b ? a : b);   }   template <class T>   T max3(T a, T b, T c) {     return (_max(a, b) > c ? _max(a, b) : c);   }   template <class T>   T min3(T a, T b, T c) {     return (_min(a, b) < c ? _min(a, b) : c);   }   template <class T>   T GCD(T a, T b) {     a = _abs(a);     b = _abs(b);     T tmp;     while (a % b) {       tmp = a % b;       a = b;       b = tmp;     }     return b;   }   template <class T>   T LCM(T a, T b) {     a = _abs(a);     b = _abs(b);     return (a / GCD(a, b)) * b;   }   using namespace std;   long long n, k, mul;   int main() {     cin >> n >> k;     mul = (n * (n - 1)) / 2;     if (mul <= k)       cout <<  no solution n ;     else {       for (int i = 0; i < n; i++) {         cout << 0 <<     << i << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   static inline void canhazfast() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);   }   template <typename T>   T gcd(T a, T b) {     return b == 0 ? a : gcd(b, a % b);   }   template <typename T>   T extgcd(T a, T b, T &x, T &y) {     T x0 = 1, y0 = 0, x1 = 0, y1 = 1;     while (b) {       T q = a / b;       a %= b;       swap(a, b);       x0 -= q * x1;       swap(x0, x1);       y0 -= q * y1;       swap(y0, y1);     }     x = x0;     y = y0;     return a;   }   static inline int ctz(unsigned x) { return __builtin_ctz(x); }   static inline int ctzll(unsigned long long x) { return __builtin_ctzll(x); }   static inline int clz(unsigned x) { return __builtin_clz(x); }   static inline int clzll(unsigned long long x) { return __builtin_clzll(x); }   static inline int popcnt(unsigned x) { return __builtin_popcount(x); }   static inline int popcntll(unsigned long long x) {     return __builtin_popcountll(x);   }   static inline int bsr(unsigned x) { return 31 ^ clz(x); }   static inline int bsrll(unsigned long long x) { return 63 ^ clzll(x); }   vector<int> adj[300016];   int id[300016], lo[300016];   int par[300016], rnk[300016], dist[300016];   vector<int> tadj[300016];   vector<pair<int, int> > br;   int nxt = 0;   int fin(int x) { return par[x] == x ? x : par[x] = fin(par[x]); }   void uni(int x, int y) {     if (rnk[x] < rnk[y]) {       par[x] = y;     } else {       par[y] = x;       rnk[x] = max(rnk[x], rnk[y] + 1);     }   }   void dfs(int u, int p = 0) {     id[u] = lo[u] = ++nxt;     for (int v : adj[u]) {       if (!id[v]) {         dfs(v, u);         lo[u] = min(lo[u], lo[v]);         if (lo[v] > id[u]) {           br.emplace_back(u, v);         } else {           int ru = fin(u), rv = fin(v);           if (ru != rv) uni(ru, rv);         }       } else if (v != p) {         lo[u] = min(lo[u], lo[v]);       }     }   }   int bfs(int s, int n) {     queue<int> q;     int r = 0;     fill_n(dist + 1, n, 1010101);     dist[s] = 0;     q.push(s);     while (!q.empty()) {       int u = q.front();       q.pop();       r = u;       for (int v : tadj[u]) {         if (dist[u] + 1 < dist[v]) {           dist[v] = dist[u] + 1;           q.push(v);         }       }     }     return r;   }   int main() {     canhazfast();     int n, m, t;     cin >> n >> m;     for (int i = 1; i <= n; ++i) par[i] = i;     for (int i = 0; i < m; ++i) {       int a, b;       cin >> a >> b;       adj[a].push_back(b);       adj[b].push_back(a);     }     dfs(1);     for (pair<int, int> e : br) {       int a = fin(e.first), b = fin(e.second);       tadj[a].push_back(b);       tadj[b].push_back(a);     }     t = bfs(fin(1), n);     t = bfs(t, n);     cout << dist[t];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INFLL = 1e18;   const int MAXN = 1e6 + 100;   const long long INF = 1e9;   const long long mod1 = 1e9 + 7;   const long long mod2 = 2e9 + 11;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t;     cin >> t;     while (t--) {       long long a, b;       cin >> a >> b;       if (a == b)         cout << 0 <<   n ;       else {         if (b < a) {           if ((a - b) % 2 == 0)             cout << 1 <<   n ;           else             cout << 2 <<   n ;         } else {           if ((a - b) % 2 == 0)             cout << 2 <<   n ;           else             cout << 1 <<   n ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <class U, class V>   ostream& operator<<(ostream& os, const pair<U, V>& p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   template <class U, class V>   istream& operator>>(istream& in, pair<U, V>& p) {     in >> p.first >> p.second;     return in;   }   vector<vector<long long> > al;   long long n;   bool bfs(long long s, long long fr, long long* col) {     bool mark[n];     memset(mark, 0, sizeof(mark));     ;     mark[s] = 1;     queue<long long> q;     for (long long v : al[s]) {       if (v != fr) {         q.push(v);       }     }     while (!q.empty()) {       long long u = q.front();       q.pop();       if (col[u] != col[s]) {         return false;       }       mark[u] = 1;       for (long long v : al[u]) {         if (!mark[v]) {           q.push(v);           mark[v] = 1;         }       }     }     return true;   }   int main() {     scanf( %lld , &n);     ;     al = vector<vector<long long> >(n);     long long c[n];     vector<pair<long long, long long> > inp;     for (long long i = 0; i < n - 1; i++) {       long long u, v;       scanf( %lld %lld , &u, &v);       ;       u--, v--;       al[u].push_back(v);       al[v].push_back(u);       inp.push_back(make_pair(u, v));     }     for (long long i = 0; i < n; i++) {       scanf( %lld , &c[i]);       ;     }     for (auto& e : inp) {       if (c[e.first] != c[e.second]) {         bool f = 0;         for (long long v : al[e.first]) {           if (!bfs(v, e.first, c)) {             f = 1;             break;           }         }         if (!f) {           puts( YES );           printf( %lld n , e.first + 1);           ;           return 0;         }         for (long long v : al[e.second]) {           if (!bfs(v, e.second, c)) {             puts( NO );             return 0;           }         }         puts( YES );         printf( %lld n , e.second + 1);         ;         return 0;       }     }     puts( YES );     printf( %lld n , (long long)1);     ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long k, l;   int main() {     cin >> k >> l;     long long K = k;     int res = 0;     while (K < l) {       K *= k;       res++;     }     if (K == l) {       cout <<  YES  << endl;       cout << res << endl;     } else {       cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct sgmnt {     long long L, R;     int mxL, mxR, w;     sgmnt() {}     sgmnt(long long L, int mxL, long long R, int mxR, int w)         : L(L), mxL(mxL), R(R), mxR(mxR), w(w) {}   };   const int MAXN = 3 * 1000 * 100 + 10;   long long arr[MAXN];   sgmnt seg[MAXN * 4];   sgmnt merge(sgmnt a, sgmnt b, int s, int m, int e) {     sgmnt c = sgmnt(a.L, a.mxL, b.R, b.mxR, max(a.w, b.w));     if ((a.R > 0 && b.L != 0) || (a.R < 0 && b.L < 0)) {       if (a.mxL == m - s) c.mxL = a.mxL + b.mxL;       if (b.mxR == e - m) c.mxR = b.mxR + a.mxR;       c.w = max(c.w, a.mxR + b.mxL);     }     c.w = max({c.w, c.mxR, c.mxL});     return c;   }   void add(int p, int v, int s, int e) {     if (e - s <= 1) {       seg[v] = sgmnt(arr[s], 1, arr[s], 1, 1);       return;     }     int m = (s + e) / 2;     if (p < m)       add(p, v * 2, s, m);     else       add(p, v * 2 + 1, m, e);     seg[v] = merge(seg[v * 2], seg[v * 2 + 1], s, m, e);   }   int main() {     int n, b;     scanf( %d %d , &n, &b);     n--;     for (int i = 0; i < n; i++) {       int a;       scanf( %d , &a);       arr[i] = a - b;       add(i, 1, 0, n);       b = a;     }     int q;     scanf( %d , &q);     while (q--) {       int l, r, d;       scanf( %d %d %d , &l, &r, &d);       l--;       if (!n) {         cout << 1 << endl;         continue;       }       if (l != 0) {         arr[l - 1] += d;         add(l - 1, 1, 0, n);       }       if (r != n + 1) {         arr[r - 1] -= d;         add(r - 1, 1, 0, n);       }       printf( %d n , seg[1].w + 1);     }     return 0;   }