malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long MAXN = 200011;   long long a[MAXN], v[MAXN];   int main() {     long long ii, tt, i, j, k, m, n, d, md, maxt, mx, t, ct, oct, res1, res2, sum,         osum, L, R, M;     cin >> tt;     for (ii = 0; ii < tt; ii++) {       cin >> n >> m >> maxt;       for (i = 0; i < n; i++) {         cin >> a[i];         v[i] = a[i];       }       sort(v, v + n);       mx = 0;       md = 1;       L = 0;       R = n;       while (L + 1 < R) {         M = (L + R) / 2;         d = v[M];         osum = 0;         sum = 0;         oct = 0;         ct = 0;         t = 0;         for (i = 0; i < n; i++) {           if (a[i] <= d) {             sum += a[i];             osum += a[i];             ct++;             if (osum > maxt) break;             oct++;             if (ct == m) {               ct = 0;               osum += sum;               sum = 0;               if (osum > maxt) break;             }           }         }         if (oct >= mx) {           mx = oct;           md = d;         }         if (osum <= maxt) {           L = M;         } else {           R = M;         }       }       d = v[L];       osum = 0;       sum = 0;       oct = 0;       ct = 0;       t = 0;       for (i = 0; i < n; i++) {         if (a[i] <= d) {           sum += a[i];           osum += a[i];           ct++;           if (osum > maxt) break;           oct++;           if (ct == m) {             ct = 0;             osum += sum;             sum = 0;             if (osum > maxt) break;           }         }       }       if (oct >= mx) {         mx = oct;         md = d;       }       md = min(md, maxt);       cout << mx <<     << md << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int max(long long int a, long long int b) {     if (a > b)       return a;     else       return b;   }   long long int gcd(long long int a, long long int b) {     if (a == 0) return b;     return gcd(b % a, a);   }   long long int lcm(long long int a, long long int b) {     return (a * b) / gcd(a, b);   }   bool isPowerOfTwo(long long int n) {     if (n == 0) return false;     return (ceil(log2(n)) == floor(log2(n)));   }   bool comp(const pair<long long int, bool>& a,             const pair<long long int, bool>& b) {     if (a.second != b.second) {       return a.first < b.first;     }     return false;   }   void solve() {     long long int n, k;     cin >> n >> k;     long long int arr[n][n];     for (long long int i = 0; i < n; i++)       for (long long int j = 0; j < n; j++) arr[i][j] = 0;     long long int x = ceil(k * 1.0 / (n * 1.0));     bool f = 0;     for (long long int l = 1; l <= x && k; l++) {       for (long long int i = 0; i < n && k; i++) {         for (long long int j = 0; j < n && k; j++) {           if (i + j == n + l - 2 || i + j == l - 2) arr[i][j] = 1, k--;         }       }     }     long long int ans = 0, rma = 0, rmi = INT_MAX, cma = 0, cmi = INT_MAX;     for (long long int i = 0; i < n; i++) {       long long int c = 0;       for (long long int j = 0; j < n; j++)         if (arr[i][j]) c++;       rma = max(rma, c);       rmi = min(rmi, c);     }     for (long long int i = 0; i < n; i++) {       long long int c = 0;       for (long long int j = 0; j < n; j++)         if (arr[j][i]) c++;       cma = max(cma, c);       cmi = min(cmi, c);     }     ans = (pow(rma - rmi, 2) + pow(cma - cmi, 2));     cout << ans << endl;     for (long long int i = 0; i < n; i++) {       for (long long int j = 0; j < n; j++) cout << arr[i][j];       cout <<   n ;     }   }   void solve1() {     long long int n;     cin >> n;     if (n & 1)       cout <<  NO n ;     else {       n /= 2;       if (n & 1)         cout <<  NO n ;       else         cout <<  YES n ;     }   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t = 1;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = INT_MAX;   const int NINF = INT_MIN;   const long long INF_LL = LLONG_MAX;   const long long NINF_LL = LLONG_MIN;   const double PI = acos(-1.0);   const int MOD = 1e9 + 7;   int main() {     long long n, m;     cin >> n >> m;     long long ans = n * n;     int nr = 0, nc = 0;     vector<bool> r(n, false), c(n, false);     while (m--) {       int y, x;       cin >> y >> x;       --x, --y;       bool ds = false;       if (!r[y] and !c[x]) {         --ans;         ds = true;       }       if (!r[y]) {         ans -= (n - nc - ds);       }       if (!c[x]) {         ans -= (n - nr - ds);       }       if (!r[y]) {         nr++;         r[y] = true;       }       if (!c[x]) {         nc++;         c[x] = true;       }       cout << ans;       if (m) cout <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T abs(T x) {     return x > 0 ? x : -x;   }   int n;   int m;   int l[100], v[100][100], t[100][100], q[200];   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) {       scanf( %d , &l[i]);       for (int j = 0; j < l[i]; j++) {         scanf( %d%d , &v[i][j], &t[i][j]);         if (j > 0) t[i][j] += t[i][j - 1];       }     }     int ans = 0;     for (int i = 0; i < n; i++)       for (int j = i + 1; j < n; j++) {         int k = 0;         q[k++] = 0;         for (int p = 0; p < l[i]; p++) q[k++] = t[i][p];         for (int p = 0; p < l[j]; p++) q[k++] = t[j][p];         sort(q, q + k);         int a = 0, b = 0, ls = 0, x = 0, y = 0;         for (int p = 1; p < k; p++) {           int d = q[p] - q[p - 1];           while (a + 1 < l[i] && t[i][a] < q[p]) a++;           while (b + 1 < l[j] && t[j][b] < q[p]) b++;           x += v[i][a] * d;           y += v[j][b] * d;           int cs = int(x > y) - int(x < y);           if (ls == 0)             ls = cs;           else if (cs != 0 && ls != cs) {             ls = cs;             ans++;           }           if (x == m || y == m) break;         }       }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, x, a, b;       cin >> n >> x >> a >> b;       if (abs(a - b) + x >= n)         cout << n - 1 << endl;       else {         cout << abs(a - b) + x << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int read() {     int x = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 )       x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();     return x * f;   }   int n, a[710];   bool flag[710][710], f[710][710][2];   int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }   int main() {     const char LL[] =  %lld n ;     n = read();     for (int i = 1; i <= n; i++) a[i] = read();     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++)         if (gcd(a[i], a[j]) > 1) flag[i][j] = 1;     for (int i = 1; i <= n + 1; i++) f[i][i - 1][0] = f[i][i - 1][1] = 1;     for (int k = 1; k <= n; k++)       for (int i = 1; i <= n - k + 1; i++) {         int j = i + k - 1;         for (int d = i; d <= j; d++)           if (f[i][d - 1][1] && f[d + 1][j][0]) {             if (flag[i - 1][d]) f[i][j][0] = 1;             if (flag[j + 1][d]) f[i][j][1] = 1;           }       }     for (int i = 1; i <= n; i++)       if (f[1][i - 1][1] && f[i + 1][n][0]) {         cout <<  Yes ;         return 0;       }     cout <<  No ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2 * 1e5 + 5;   double sum;   int i, j, l, o, n, k, a[maxn];   int main() {     scanf( %d %d , &n, &k);     for (int j = 1; j <= n; j++) scanf( %d , &a[j]);     for (i = 1; i <= n; i++) {       if (i <= k) {         if (n - k + 1 >= i)           sum += 1.0 * i * a[i];         else {           l = i + k - 1 - n;           l = i - l;           sum += 1.0 * l * a[i];         }       } else {         if (n - k + 1 >= i)           sum += 1.0 * k * a[i];         else {           sum += 1.0 * (n - i + 1) * a[i];         }       }     }     sum /= (n - k + 1);     printf( %.10lf n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long int LINF = 0x3f3f3f3f3f3f3f3fll;   const long double pi = acos(-1);   const int MOD = 1e9 + 7;   const int N = 310;   int l[N], c[N];   map<long long int, int> mapa;   int mdc(int a, int b) {     if (b == 0) return a;     return mdc(b, a % b);   }   bool add(int x, int custo) {     if (mapa.count(x)) {       if (mapa[x] > custo) {         mapa[x] = custo;         return true;       }       return false;     } else {       mapa[x] = custo;       return true;     }   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &l[i]);     for (int i = 0; i < n; i++) scanf( %d , &c[i]);     set<int> q;     for (int i = 0; i < n; i++) {       add(l[i], c[i]);       q.insert(l[i]);     }     for (int i = 0; i < 100000; i++) {       if (q.size() == 0) break;       int x = *q.begin();       q.erase(q.begin());       for (int j = 0; j < n; j++) {         int valnovo = mdc(x, l[j]);         int custonovo = c[j] + mapa[x];         if (add(valnovo, custonovo)) q.insert(valnovo);       }     }     if (mapa.count(1)) {       printf( %d n , mapa[1]);     } else {       int coco = -1;       printf( %d n , coco);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   struct node {     int u, v, w;     friend bool operator<(node a, node b) { return a.w > b.w; }   } itm[200005];   int fa[200005];   int gf(int x) {     if (x != fa[x]) return fa[x] = gf(fa[x]);     return fa[x];   }   int main() {     while (~scanf( %d%d , &n, &m)) {       for (int i = 1; i <= n; i++) fa[i] = i;       priority_queue<node> q;       for (int i = 0; i < m; i++) {         scanf( %d%d%d , &itm[i].u, &itm[i].v, &itm[i].w);         q.push(itm[i]);       }       int cnt = 0, ans = 0;       while (!q.empty() && cnt < (n - 1)) {         node sta = q.top();         q.pop();         queue<node> q1, q2;         q1.push(sta);         while (!q.empty() && q.top().w == sta.w) {           q1.push(q.top());           q.pop();         }         while (!q1.empty()) {           node cur = q1.front();           q1.pop();           int f1 = gf(cur.u);           int f2 = gf(cur.v);           if (f1 != f2) q2.push(cur);         }         if (!q2.empty()) {           node cur = q2.front();           q2.pop();           int f1 = gf(cur.u);           int f2 = gf(cur.v);           fa[f1] = f2;           cnt++;           while (!q2.empty()) {             node tp = q2.front();             q2.pop();             f1 = gf(tp.u);             f2 = gf(tp.v);             if (f1 == f2)               ans++;             else               fa[f1] = f2, cnt++;           }         }       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 2e5 + 100;   int a[M], b[M];   int n, x, y;   int di[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};   bool check(int xx, int yy) {     if (xx < 1 || xx > x || yy < 1 || yy > y) return 0;     return 1;   }   bool bfs() {     queue<int> q;     int l = 0;     q.push(a[l]);     l++;     while (q.size()) {       if (l == n) return 1;       int ans = q.front();       int y1, x1;       if (ans % y == 0) {         y1 = y;         x1 = ans / y;       } else {         y1 = ans % y;         x1 = ans / y + 1;       }       q.pop();       for (int i = 0; i < 4; i++) {         int nx = x1 + di[i][0], ny = y1 + di[i][1];         int res = (nx - 1) * y + ny;         if (check(nx, ny) && res == a[l]) {           q.push(a[l]);           l++;           break;         }       }     }     if (l == n + 1)       return 1;     else       return 0;   }   int main() {     while (~scanf( %d , &n)) {       int mac = 0;       for (int i = 0; i < n; i++) {         scanf( %d , &a[i]);         mac = max(a[i], mac);       }       int l = 0;       bool f = 1;       for (int i = 0; i < n - 1; i++) {         if (l == 0 && abs(a[i] - a[i + 1]) > 1) l = abs(a[i] - a[i + 1]);         if (l && abs(a[i] - a[i + 1]) > 1)           if (l != abs(a[i] - a[i + 1])) {             f = 0;             break;           }       }       if (!f)         printf( NO n );       else {         if (l == 0) {           x = 1;           y = mac;         } else {           y = l;           x = mac / l + 1;         }         bool tt = bfs();         if (tt) {           printf( YES n );           printf( %d %d n , x, y);         } else           printf( NO n );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, i, j, ans, sum1, sum2;   long long x[100000], y[100000];   int main() {     scanf( %I64d , &n);     sum1 = 0;     sum2 = 0;     ans = 0;     for (i = 0; i < n; i++) {       scanf( %I64d %I64d , &x[i], &y[i]);       ans += (n * (x[i] * x[i] + y[i] * y[i]));       sum1 += x[i];       sum2 += y[i];     }     ans -= (sum1 * sum1);     ans -= (sum2 * sum2);     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     int arr[n][n];     for (int i = 0; i < n; i++)       for (int j = 0; j < n; j++) scanf( %d , &arr[i][j]);     int q;     scanf( %d , &q);     int res = 0;     for (int k = 0; k < n; k++) {       res += arr[k][k];       res %= 2;     }     for (int p = 0; p < q; p++) {       int t;       scanf( %d , &t);       switch (t) {         case 1: {           int k;           scanf( %d , &k);           res = 1 - res;         } break;         case 2: {           int k;           scanf( %d , &k);           k--;           res = 1 - res;         } break;         case 3: {           printf( %d , res);         } break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     long long int n, i, j, x, in = 0;     string s;     vector<pair<string, long long int>> v;     priority_queue<long long int, vector<long long int>, greater<long long int>>         pq;     cin >> n;     long long int mn = 1000000000000000000LL, dummy = -1;     for (i = 1; i <= n; i++) {       cin >> s;       if (s ==  insert ) {         cin >> x;         v.push_back(make_pair(s, x));         pq.push(x);       } else if (s ==  getMin ) {         cin >> x;         if (pq.size() != 0)           mn = pq.top();         else           mn = -1;         if (x != mn) {           if (x > mn) {             while (x > mn && pq.size() != 0) {               mn = pq.top();               if (mn >= x) break;               pq.pop();               v.push_back(make_pair( removeMin , -1));             }             if (x == mn && pq.size() != 0) {               v.push_back(make_pair(s, x));             } else if ((mn > x && pq.size() != 0) || pq.size() == 0) {               v.push_back(make_pair( insert , x));               pq.push(x);               v.push_back(make_pair(s, x));             }           } else {             v.push_back(make_pair( insert , x));             pq.push(x);             v.push_back(make_pair(s, x));           }         } else {           v.push_back(make_pair(s, x));         }       } else if (s ==  removeMin ) {         if (pq.size() != 0)           pq.pop();         else {           v.push_back(make_pair( insert , 0));         }         v.push_back(make_pair(s, -1));       }     }     cout << v.size() << endl;     for (i = 0; i < v.size(); i++) {       cout << v[i].first <<    ;       if (v[i].first !=  removeMin )         cout << v[i].second << endl;       else         cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   const int MOD = 1e9 + 7;   const int MAXN = 2e5 + 17;   const int magic = (1 << 7);   using namespace std;   struct p {     long double x, y;     p(long double x, long double y) : x(x), y(y) {}     p() {}     long double len() const { return sqrt(x * x + y * y); }   };   p operator-(const p &a, const p &b) { return p(a.x - b.x, a.y - b.y); }   string s;   bool solve(int l, int r) {     int q = 0;     map<char, int> c;     int num = 0;     for (int i = l; i <= r; i++) {       if (s[i] ==  ? )         q++;       else         c[s[i]]++;     }     if (c.size() + q >= 26) {       for (int i = l; i <= r; i++) {         if (s[i] ==  ? )           for (int x = int( A ); x <= int( Z ); x++) {             if (c[char(x)] == 0) {               s[i] = char(x), c[char(x)]++;               break;             }           }       }       return true;     }     return false;   }   int main() {     if (1) {       ios_base::sync_with_stdio(false);       cin.tie(nullptr);       cout.tie(nullptr);     }     long long n;     cin >> n;     long long cur = 2;     for (long long i = 1; i <= n; i++) {       cout << (i * (i + 1) * (i + 1) - cur / i) <<   n ;       cur = i * (i + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char ch = getchar();     while (ch >  9  || ch <  0 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   const int N = 1e5 + 19;   long long A[N], day[N];   signed main() {     long long n, m, d;     set<pair<long long, int> > S;     n = read();     m = read();     d = read();     for (int i = 1; i <= n; ++i) {       long long x;       x = read();       S.insert(pair<long long, int>(x, i));     }     int now = 0;     while (S.size()) {       ++now;       pair<long long, int> tmp = *S.begin();       long long s = tmp.first;       day[tmp.second] = now;       S.erase(S.begin());       for (auto iter = S.lower_bound(pair<long long, int>(s + d + 1, 0));            iter != S.end();            iter = S.lower_bound(pair<long long, int>(s + d + 1, 0))) {         day[iter->second] = now;         s = iter->first;         S.erase(iter);       }     }     printf( %d n , now);     for (int i = 1; i <= n; ++i) printf( %I64d  , day[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, ans, a[2000010], a0[2000010];   struct Node {     long long MaxL, MaxR, Max;   };   Node tree[2000010];   long long Sign(long long x) {     if (x > 0) {       return 1;     }     if (x == 0) {       return 0;     }     return -1;   }   void Merge(long long idx, long long l, long long r) {     if (l == r) {       return;     }     long long mid = (l + r) / 2;     tree[idx].Max = max(tree[idx * 2 + 1].Max, tree[idx * 2 + 2].Max);     if (!a[mid] or !a[mid + 1] or Sign(a[mid]) < Sign(a[mid + 1])) {       tree[idx].MaxL = tree[idx * 2 + 1].MaxL;       tree[idx].MaxR = tree[idx * 2 + 2].MaxR;     } else {       tree[idx].Max =           max(tree[idx].Max, tree[idx * 2 + 1].MaxR + tree[idx * 2 + 2].MaxL);       if (tree[idx * 2 + 1].MaxL == mid - l + 1) {         tree[idx].MaxL = tree[idx * 2 + 1].MaxL + tree[idx * 2 + 2].MaxL;       } else {         tree[idx].MaxL = tree[idx * 2 + 1].MaxL;       }       if (tree[idx * 2 + 2].MaxR == r - mid) {         tree[idx].MaxR = tree[idx * 2 + 2].MaxR + tree[idx * 2 + 1].MaxR;       } else {         tree[idx].MaxR = tree[idx * 2 + 2].MaxR;       }     }   }   void Init(long long idx, long long l, long long r) {     if (l == r) {       if (a[l]) {         tree[idx] = {1, 1, 1};       } else {         tree[idx] = {0, 0, 0};       }       return;     }     long long mid = (l + r) / 2;     Init(idx * 2 + 1, l, mid);     Init(idx * 2 + 2, mid + 1, r);     Merge(idx, l, r);   }   void Update(long long idx, long long x, long long val, long long l,               long long r) {     if (l == r) {       a[l] += val;       if (a[l]) {         tree[idx] = {1, 1, 1};       } else {         tree[idx] = {0, 0, 0};       }       return;     }     long long mid = (l + r) / 2;     if (x <= mid) {       Update(idx * 2 + 1, x, val, l, mid);     } else {       Update(idx * 2 + 2, x, val, mid + 1, r);     }     Merge(idx, l, r);   }   signed main() {     ios_base::sync_with_stdio(0);     cout.tie(0);     cin.tie(0);     cin >> n;     for (long long i = 0; i < n; ++i) {       cin >> a0[i];     }     for (long long i = 0; i < n - 1; ++i) {       a[i] = a0[i + 1] - a0[i];     }     if (n > 1) {       Init(0, 0, n - 2);     }     cin >> m;     for (long long i = 0; i < m; ++i) {       long long l, r, x;       cin >> l >> r >> x;       if (n == 1) {         cout <<  1 n ;         continue;       }       if (l >= 2) {         Update(0, l - 2, x, 0, n - 2);       }       if (r < n) {         Update(0, r - 1, -x, 0, n - 2);       }       cout << tree[0].Max + 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int mm = 1e6 + 1;   const int mx = 1 << 20;   const int N = 3e5 + 10;   int a[N], b[N];   int seg_t[mx * 2 + 10], tag[mx * 2 + 10];   void up(int o) { seg_t[o] = max(seg_t[o << 1], seg_t[o << 1 | 1]); }   void down(int o) {     if (tag[o] == 0) {       return;     }     seg_t[o << 1] += tag[o];     tag[o << 1] += tag[o];     seg_t[o << 1 | 1] += tag[o];     tag[o << 1 | 1] += tag[o];     tag[o] = 0;   }   void update(int o, int l, int r, int ql, int qr, int v) {     if (ql <= l && r <= qr) {       seg_t[o] += v;       tag[o] += v;       return;     }     down(o);     int mid = (l + r) / 2;     if (mid >= ql) update(o << 1, l, mid, ql, qr, v);     if (mid < qr) update(o << 1 | 1, mid + 1, r, ql, qr, v);     up(o);   }   int query(int o, int l, int r) {     if (seg_t[o] <= 0) return -1;     if (l == r) return l;     down(o);     int mid = (l + r) / 2;     if (seg_t[o << 1 | 1] > 0) {       return query(o << 1 | 1, mid + 1, r);     }     return query(o << 1, l, mid);   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a[i];       update(1, 1, mm, 1, a[i], 1);     }     for (int i = 0; i < m; i++) {       cin >> b[i];       update(1, 1, mm, 1, b[i], -1);     }     int q;     cin >> q;     while (q--) {       int opt, x, y;       cin >> opt >> x >> y;       --x;       if (opt == 1 && a[x] != y) {         update(1, 1, mm, 1, a[x], -1);         a[x] = y;         update(1, 1, mm, 1, a[x], 1);       } else if (opt == 2 && b[x] != y) {         update(1, 1, mm, 1, b[x], 1);         b[x] = y;         update(1, 1, mm, 1, b[x], -1);       }       cout << query(1, 1, mm) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     long long int x1, y1;     cin >> x1 >> y1;     long long int x2, y2;     cin >> x2 >> y2;     int n;     cin >> n;     int ans = 0;     for (int i = 0; n > i; i++) {       long long int a, b, c;       cin >> a >> b >> c;       long long int res1 = a * x1 + b * y1 + c;       long long int res2 = a * x2 + b * y2 + c;       if ((res1 < 0 && res2 > 0) || (res1 > 0 && res2 < 0)) {         ans++;       }     }     cout << ans;   }