malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > v[100005];   bool visit[100005];   int n;   vector<int> ans;   bool dfs(int i, int last) {     visit[i] = true;     bool flag = false;     for (int j = 0; j < v[i].size(); j++) {       if (!visit[v[i][j].first]) {         if (v[i][j].second == 2)           flag = flag | dfs(v[i][j].first, v[i][j].first);         else           flag = flag | dfs(v[i][j].first, 0);       }     }     if (flag == false && last != 0) {       flag = true;       ans.push_back(i);     }     return flag;   }   void Readinput() {     int i, x, y, t;     scanf( %d , &n);     for (i = 0; i < n - 1; i++) {       scanf( %d , &x);       scanf( %d , &y);       scanf( %d , &t);       v[x].push_back(pair<int, int>(y, t));       v[y].push_back(pair<int, int>(x, t));     }   }   void solve() {     int i, j;     dfs(1, 0);     cout << ans.size() << endl;     for (i = 0; i < ans.size(); i++) cout << ans[i] <<    ;     cout << endl;   }   int main() {     memset(visit, false, sizeof(visit));     Readinput();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int shuruHoJaa(long long int test) {     while (test--) {       long long int a, b, c, d;       cin >> a >> b >> c >> d;       long long int time = 0;       if (b >= a) {         cout << b;       } else if (c <= d) {         cout << -1;       } else {         time += b;         long long int tmp =             ((a - b) % (c - d) == 0 ? (a - b) / (c - d) : (a - b) / (c - d) + 1);         time += (tmp * (c));         cout << time;       }       cout <<   n ;     }     return 0;   }   int main(int argc, char const *argv[]) {     int t;     cin >> t;     shuruHoJaa(t);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[1010];   int main() {     int n;     scanf( %d , &n);     scanf( %s , s);     int a0 = 0;     int a1 = 0;     int b0 = 0;     int b1 = 0;     for (int i = 0; i < n; i++) {       if (s[i] ==  0 ) {         if (i % 2)           b0++;         else           a0++;       } else {         if (i % 2)           b1++;         else           a1++;       }     }     int ans = min(a0 + b1, a1 + b0);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, pl = 4, otv = 1;     cin >> n;     if (n > 1) {       for (long long i = 1; i < n; i++) {         otv = otv + pl;         pl += 4;       }     } else if (n == 1) {       otv = 1;     }     cout << otv;   }
#include <bits/stdc++.h>   using namespace std;   struct _ {     ios_base::Init i;     _() {       cin.sync_with_stdio(0);       cin.tie(0);     }   } _;   struct House {     int height;     int initial_position;   };   int main() {     int n;     cin >> n;     vector<House> houses;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       House h{x, i};       houses.push_back(h);     }     stable_sort(houses.begin(), houses.end(),                 [&](House h1, House h2) { return h1.height < h2.height; });     int up_to = 0;     int number_of_blocks = 0;     for (int i = 0; i < n; i++) {       int initial_position = houses[i].initial_position;       up_to = max(up_to, initial_position);       if (up_to == i) {         up_to++;         number_of_blocks++;       }     }     cout << number_of_blocks << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, x, freq[100123], pairs = 0;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cin >> n >> x;     long long v[n];     for (long long i = 0; i < n; i++) {       cin >> v[i];       freq[v[i]]++;     }     for (long long i = 0; i < 100123; i++)       if (freq[i] > 0)         if ((x ^ i) < 100123) pairs += freq[i] * (freq[(x ^ i)] - ((x ^ i) == i));     pairs /= 2;     cout << pairs << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Buffer_Size = 1 << 10;   char buffer[Buffer_Size], *ihead = buffer + Buffer_Size, *itail = ihead;   char Next_Char() {     if (ihead == itail) fread(buffer, 1, Buffer_Size, stdin), ihead = buffer;     return *ihead++;   }   template <typename T>   void read(T &n) {     n = 0;     char ch = Next_Char();     while (!isdigit(ch)) ch = Next_Char();     while (isdigit(ch)) {       n = (n << 3) + (n << 1) + (ch & 15);       ch = Next_Char();     }   }   long long r, c, n, k, tp, sum;   long long a[3002], cnt[3002], L[3002], R[3002];   vector<long long> v[3002];   struct Position {     long long x, y;   } p[3002];   bool Cmp(long long x, long long y) { return p[x].y < p[y].y; }   bool DFS(long long x, long long step) {     if (!step || !x) return 1;     if (!DFS(L[x], step - 1))       cnt[L[x]] = cnt[x];     else       cnt[L[x]] += cnt[x];     return 0;   }   int main() {     read(r), read(c), read(n), read(k);     for (long long i = 1; i <= n; ++i) {       read(p[i].x), read(p[i].y);       v[p[i].x].push_back(i);     }     long long ans = 0;     for (long long i = 1; i <= r; ++i) {       tp = sum = 0;       for (long long j = 1; j <= n; ++j)         if (p[j].x >= i) a[++tp] = j;       sort(a + 1, a + tp + 1, Cmp);       a[tp + 1] = n + 1;       memset(cnt, 0, sizeof(cnt));       memset(L, 0, sizeof(L));       memset(R, 0, sizeof(R));       long long now = 0;       for (long long j = 1; j <= c; ++j) {         while (p[a[now + 1]].y == j && now < tp) {           ++now;           L[a[now]] = a[now - 1], R[a[now]] = a[now + 1];         }         long long tmp = a[now];         for (long long l = 1; l < k; ++l) tmp = L[tmp];         ++cnt[tmp];       }       for (long long j = 1; j <= tp; ++j) sum += p[a[j]].y * cnt[a[j]];       ans += sum;       for (long long j = r; j >= i + 1; --j) {         long long sz = (long long)v[j].size();         for (long long l = 0; l < sz; ++l) {           long long x = v[j][l], q = x;           for (long long o = 1; o <= k; ++o) {             sum -= (p[x].y - p[L[x]].y) * cnt[x];             x = L[x];             if (!x) break;           }           x = q;           DFS(x, k);           x = q;           L[R[x]] = L[x], R[L[x]] = R[x];         }         ans += sum;       }     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> a[200020], b[200020];   int x, y, c, d;   int n;   int mx[200020];   int calc(pair<int, int> a[], int len, int val) {     for (int i = 1; i <= len; ++i) {       mx[i] = max(mx[i - 1], a[i].second);     }     int ret = 0;     for (int i = len, j = 1; i >= 1; --i) {       while (j <= len && a[j].first + a[i].first <= val) {         ++j;       }       if (j > 1 && i > 1) ret = max(ret, a[i].second + mx[min(j - 1, i - 1)]);     }     return ret;   }   int main() {     scanf( %d%d%d , &n, &c, &d);     for (int i = 1; i <= n; ++i) {       int u, v;       char op[5];       scanf( %d%d%s , &u, &v, op);       if (op[0] ==  C )         a[++x] = make_pair(v, u);       else         b[++y] = make_pair(v, u);     }     sort(a + 1, a + x + 1);     sort(b + 1, b + y + 1);     int ans = calc(a, x, c);     ans = max(ans, calc(b, y, d));     int mx1 = -1, mx2 = -1;     for (int i = 1; i <= x; ++i)       if (a[i].first <= c) mx1 = max(mx1, a[i].second);     for (int i = 1; i <= y; ++i)       if (b[i].first <= d) mx2 = max(mx2, b[i].second);     if (mx1 != -1 && mx2 != -1) ans = max(ans, mx1 + mx2);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 2;   long long int i, j, n, m, s, ans = 0, cnt = 0;   vector<pair<long long int, long long int> > nf;   vector<long long int> graph[maxn];   bool foundd[maxn];   void dfs(long long int u, bool found[]) {     if (!foundd[u]) ++ans;     found[u] = true;     vector<long long int>::iterator it;     for (it = graph[u].begin(); it != graph[u].end(); ++it) {       if (!found[*it]) dfs(*it, found);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m >> s;     bool found[5200], isreachable[5200];     for (i = 0; i < m; ++i) {       long long int u, v;       cin >> u >> v;       graph[u].push_back(v);     }     memset(found, false, sizeof(found));     dfs(s, found);     for (i = 1; i <= n; ++i) foundd[i] = found[i];     for (i = 1; i <= n; ++i) {       if (!foundd[i]) {         bool found1[5001];         memset(found1, false, sizeof(found1));         ans = 0;         dfs(i, found1);         nf.push_back(make_pair(ans, i));       }     }     sort(nf.begin(), nf.end(), greater<pair<long long int, long long int> >());     for (i = 0; i < nf.size(); ++i) {       if (!foundd[nf[i].second]) {         bool found1[5001];         memset(found1, false, sizeof(found1));         dfs(nf[i].second, found1);         ++cnt;         for (j = 1; j <= n; ++j)           if (found1[j]) foundd[j] = true;       }     }     cout << cnt;   }
#include <bits/stdc++.h>   using namespace std;   void read(int &a) {     a = 0;     char c = getchar();     while (c <  0  || c >  9 ) {       c = getchar();     }     while (c >=  0  && c <=  9 ) {       a = (a << 1) + (a << 3) + c -  0 ;       c = getchar();     }   }   int Set(int n, int pos) { return n = n | (1LL << pos); }   int reset(int n, int pos) { return n = n & ~(1LL << pos); }   bool check(int n, int pos) { return (bool)(n & (1LL << pos)); }   int mul(int a, int b) {     int c;     c = (a % 1000000007 * b % 1000000007) % 1000000007;     return c;   }   int add(int a, int b) {     int c;     c = (a % 1000000007 + b % 1000000007) % 1000000007;     return c;   }   int sub(int a, int b) {     int c;     c = ((a % 1000000007 - b % 1000000007) % 1000000007 + 1000000007) %         1000000007;     return c;   }   int power(int x, int y) {     int res = 1;     x = x;     while (y > 0) {       if (y & 1) res = (res * x);       y = y >> 1;       x = (x * x);     }     return res;   }   long long exgcd(long long x, long long y, long long &a, long long &b) {     int flag = 0;     long long t, la = 1, lb = 0, ra = 0, rb = 1;     while (x % y) {       if (flag == 0)         la -= x / y * ra, lb -= x / y * rb;       else         ra -= x / y * la, rb -= x / y * lb;       t = x, x = y, y = t % y;       flag = 1 - flag;     }     if (flag == 0)       a = ra, b = rb;     else       a = la, b = lb;     return y;   }   int n, m, k, r;   vector<int> rooms[200005];   vector<pair<int, int> > graph[200005];   int st[200005];   int col[200005];   deque<int> q;   bool bfs(int ma_src) {     q.clear();     col[ma_src] = 0;     q.push_back(ma_src);     while (!q.empty()) {       int u = q.front();       q.pop_front();       for (int i = 0; i < graph[u].size(); i++) {         int v = graph[u][i].first;         int _v = graph[u][i].second;         if (col[v] == -1) {           if (_v == 1)             col[v] = col[u];           else             col[v] = col[u] ^ 1;           q.push_back(v);         } else {           if (_v == 1) {             if (col[v] != col[u]) return 0;           } else {             if (col[v] == col[u]) return 0;           }         }       }     }     return 1;   }   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &st[i]);     for (int i = 1; i <= m; i++) {       scanf( %d , &k);       for (int j = 1; j <= k; j++) {         scanf( %d , &r);         rooms[r].push_back(i);       }     }     for (int i = 1; i <= n; i++) {       int u = rooms[i][0];       int v = rooms[i][1];       graph[u].push_back(pair<int, int>(v, st[i]));       graph[v].push_back(pair<int, int>(u, st[i]));     }     memset((col), (-1), sizeof(col));     int ans = 1;     for (int i = 1; i <= m; i++) {       if (col[i] == -1) ans = ans & bfs(i);     }     if (!ans)       cout <<  NO  << endl;     else       cout <<  YES  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long k, sum = 0, i, j, n, cnt = 0;     int a[20] = {0}, value;     string s;     cin >> k;     cin >> s;     for (i = 0; i < ((int)s.size()); ++i) {       n = s[i] -  0 ;       sum += n;       a[n]++;     }     if (sum >= k) {       cout << cnt << endl;       return 0;     }     for (i = 0; i < 10; ++i) {       value = 9 - i;       for (j = 1; j <= a[i]; ++j) {         sum += value;         cnt++;         if (sum >= k) {           cout << cnt << endl;           return 0;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long x, y;   int main() {     ios_base::sync_with_stdio(0);     ;     cin >> x >> y;     if ((long long)sqrt(x * x + y * y + 0.5) == sqrt(x * x + y * y)) {       cout <<  black             <<   n ;       return 0;     }     long long d = sqrt(x * x + y * y);     if ((x > 0 && y > 0) || (x < 0 && y < 0)) {       if (d % 2 == 0)         cout <<  black               <<   n ;       else         cout <<  white               <<   n ;     } else {       if (d % 2 == 0)         cout <<  white               <<   n ;       else         cout <<  black               <<   n ;     }     return 0;   }
#include<bits/stdc++.h>   using namespace std;      typedef long long ll;   typedef pair<int,int> pii;   typedef vector<int> vi;   typedef vector<vi> vvi;   typedef vector<ll> vl;   typedef vector<vl> vvl;   typedef vector<string> vs;   typedef vector<vs> vvs;   typedef vector<pii> vpii;   typedef set<int> si;   typedef unordered_set<int> usi;   typedef multiset<int> msi;   typedef map<int,int> mi;   typedef unordered_map<int,int> umi;   typedef multimap<int,int> mmi;      #define f1(a,b,c) for(int(a)=(b);(a)<(c);(a)++)   #define f2(a,b,c) for(int(a)=(b);(a)<=(c);(a)++)   #define f3(a,b,c) for(int(a)=(b);(a)>(c);(a)--)   #define f4(a,b,c) for(int(a)=(b);(a)>=(c);(a)--)   #define fi(a,b) for(auto(a)=b.begin();(a)!=b.end();(a)++)   #define pb push_back   #define all(v) v.begin(),v.end()   #define nper next_permutation   #define pper prev_permutation   #define mp make_pair   #define F first   #define S second      int main()   {    ios_base::sync_with_stdio(false);    cin.tie(NULL);    int t;    cin>>t;    f1(i,0,t)    {     int n,k,x=1;     cin>>n>>k;     f1(j,0,(2*k)-n-1)     {      cout<<x<<   ;x++;     }     x=k;     f1(j,0,n-k+1)     {      cout<<x<<   ;x--;     }     cout<<  n ;    }    /*f1(i,0,t)    {     cout<<v[i]<<  n ;    }*/    return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline long long read() {     long long x = 0, f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);     return x * f;   }   inline void write(long long x) {     if (x < 0) x = -x, putchar( - );     if (x >= 10) write(x / 10);     putchar(x % 10 +  0 );   }   inline void writeln(long long x) {     write(x);     putchar(  n );   }   inline void wri(long long x) {     write(x);     putchar(   );   }   const int maxn = 1e5 + 233;   const int mod = 1e9 + 7;   int f[maxn];   int main() {     int n = read(), m = read();     f[0] = 1;     f[1] = 1;     for (register int i = (2); i <= int(maxn - 1); ++i)       f[i] = (f[i - 1] + f[i - 2]) % mod;     writeln(2ll * (f[n] + f[m] - 1) % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 7;   int vis1[MAXN], vis2[MAXN], dis[MAXN];   int st, ed, n, ans;   queue<int> q;   vector<int> G[MAXN];   void Bfs1() {     for (; !q.empty();) q.pop();     q.push(1);     vis1[1] = 1;     for (; !q.empty();) {       int u = q.front();       q.pop();       for (auto v : G[u]) {         if (vis1[v]) continue;         q.push(v);         vis1[v] = u;       }       st = u;     }   }   void Bfs2() {     for (; !q.empty();) q.pop();     q.push(st);     vis2[st] = st;     for (; !q.empty();) {       int u = q.front();       q.pop();       for (auto v : G[u]) {         if (vis2[v]) continue;         q.push(v);         vis2[v] = u;       }       ed = u;     }   }   int degree(int x) { return (int)G[x].size(); }   bool check(int root) {     int Tim = 0;     for (int i = 1; i <= n; i++) vis1[i] = dis[i] = 0;     for (; !q.empty();) q.pop();     q.push(root);     vis1[root] = 1;     for (; !q.empty();) {       int u = q.front();       q.pop();       for (auto v : G[u]) {         if (vis1[v]) continue;         if (++Tim == n) {         }         q.push(v);         vis1[v] = vis1[u] + 1;         if (!dis[vis1[v]]) dis[vis1[v]] = v;         if (degree(v) != degree(dis[vis1[v]])) return false;       }     }     ans = root;     return true;   }   bool checkCenter() {     int Tim = 0;     int D = 0;     for (int u = ed; u != st; u = vis2[u]) D++;     if (D & 1) return false;     int center = ed;     for (int i = 0; i != D / 2; i++, center = vis2[center])       ;     if (check(center)) return true;     for (int i = 1; i <= n; i++) vis1[i] = dis[i] = 0;     for (; !q.empty();) q.pop();     q.push(center);     vis1[center] = 1;     for (; !q.empty();) {       int u = q.front();       q.pop();       for (auto v : G[u]) {         if (vis1[v]) continue;         if (++Tim == n) {         }         q.push(v);         vis1[v] = vis1[u] + 1;         if (!dis[vis1[v]]) dis[vis1[v]] = v;         if (degree(v) != degree(dis[vis1[v]])) {           for (int x = v, tim = 0;;) {             if (++tim == n) break;             if (G[x].size() == 1) {               if (check(x))                 return true;               else                 break;             } else               x = (vis1[G[x][0]] == 0) ? G[x][0] : G[x][1];           }           for (int x = dis[vis1[v]], tim = 0;;) {             if (++tim == n) break;             if (G[x].size() == 1) {               if (check(x))                 return true;               else                 break;             } else               x = (vis1[G[x][0]] == 0) ? G[x][0] : G[x][1];           }           return false;         }       }     }     ans = center;     return true;   }   int main() {     cin >> n;     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       G[u].push_back(v);       G[v].push_back(u);     }     Bfs1();     Bfs2();     if (check(st) || check(ed))       cout << ans;     else if (checkCenter())       cout << ans;     else       cout << -1;   }
#include <bits/stdc++.h>   using namespace std;   long long K[5], T[5];   int main() {     queue<pair<long long, long long> > Q[5][2];     string ln;     int n;     getline(cin, ln);     istringstream(ln) >> K[1] >> K[2] >> K[3];     getline(cin, ln);     istringstream(ln) >> T[1] >> T[2] >> T[3];     getline(cin, ln);     istringstream(ln) >> n;     getline(cin, ln);     istringstream in(ln);     long long t0;     for (int i = 0; i < n; i++) {       in >> t0;       Q[1][0].push(pair<long long, long long>(t0, t0));     }     long long t = 0;     for (int i = 1; i <= 3; i++) {       while (Q[i][0].size()) {         t = Q[i][0].front().first;         t = max(t, Q[i][0].front().first);         t0 = Q[i][0].front().second;         Q[i][0].pop();         if (Q[i][1].size() < K[i]) {           Q[i][1].push(pair<long long, long long>(t + T[i], t0));         } else {           t = max(Q[i][1].front().first, t);           Q[i + 1][0].push(Q[i][1].front());           Q[i][1].pop();           Q[i][1].push(pair<long long, long long>(t + T[i], t0));         }       }       while (Q[i][1].size()) {         Q[i + 1][0].push(Q[i][1].front());         Q[i][1].pop();       }     }     long long res = 0;     while (Q[4][0].size()) {       res = max(res, Q[4][0].front().first - Q[4][0].front().second);       Q[4][0].pop();     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2005;   const char vow[] = { a ,  e ,  i ,  o ,  u ,  y };   char str[maxn];   bool check(char ch) {     for (int i = 0; i < 6; ++i) {       if (ch == vow[i]) return true;     }     return false;   }   int main() {     int n;     while (~scanf( %d , &n)) {       scanf( %s , str);       for (int i = 0; i < n; ++i) {         if (check(str[i])) {           for (int j = i + 1; j < n; ++j) {             if (str[i] == 0) continue;             if (check(str[j]))               str[j] = 0;             else               break;           }         }       }       for (int i = 0; i < n; ++i) {         if (str[i]) putchar(str[i]);       }       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double EPS = 1e-11;   void fast() { std::ios_base::sync_with_stdio(0); }   vector<vector<int>> seq(1e5 + 9);   int main() {     int n, x;     cin >> n;     for (int i = 0; i < n; i++) {       scanf( %d , &x);       seq[x].push_back(i);     }     bool flag = true;     vector<pair<int, int>> ans;     for (int i = 0; i <= 1e5; i++) {       flag = true;       if (seq[i].size() == 0)         continue;       else if (seq[i].size() == 1)         ans.push_back({i, 0});       else if (seq[i].size() == 2)         ans.push_back({i, seq[i][1] - seq[i][0]});       else {         for (int j = 2; j < seq[i].size() && flag; j++) {           if (seq[i][j] - seq[i][j - 1] != seq[i][j - 1] - seq[i][j - 2])             flag = false;         }         if (flag) {           ans.push_back({i, seq[i][1] - seq[i][0]});         }       }     }     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) {       printf( %d %d n , ans[i].first, ans[i].second);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       long int a[n + 1][m + 1];       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           cin >> a[i][j];         }       }       long int b[n + 1][m + 1];       for (int i = 1; i <= n; i++) {         b[i][1] = 3;         b[i][m] = 3;       }       for (int i = 1; i <= m; i++) {         b[1][i] = 3;         b[n][i] = 3;       }       b[1][1] = 2;       b[1][m] = 2;       b[n][1] = 2;       b[n][m] = 2;       for (int i = 2; i <= n - 1; i++) {         for (int j = 2; j <= m - 1; j++) {           b[i][j] = 4;           b[i][j] = 4;         }       }       int f = 0;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           if (a[i][j] > b[i][j]) {             f = 1;             break;           }         }       }       if (f == 1) {         cout <<  NO  << endl;       } else {         cout <<  YES  << endl;         for (int i = 1; i <= n; i++) {           for (int j = 1; j <= m; j++) {             cout << b[i][j] <<    ;           }           cout << endl;         }       }     }   }
#include <bits/stdc++.h>   typedef long long LL;   const double INF = 1e100;   const int oo = ~0u >> 2;   const double pi = acos(-1.0);   const double EPS = 1e-8;   const int MAXN = 100033;   double a, b, c;   double x11, x2;   int main() {     scanf( %lf%lf%lf , &a, &b, &c);     x11 = sqrt(b * b - 4.0 * a * c);     if (a > 0) {       x2 = (-b - x11) / 2.0 / a;       x11 = (-b + x11) / 2.0 / a;     } else {       x2 = (-b + x11) / 2.0 / a;       x11 = (-b - x11) / 2.0 / a;     }     printf( %.012lf n%.012lf n , x11, x2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.tie(0);     ios::sync_with_stdio(false);     long long t;     cin >> t;     while (t--) {       vector<long long> A(3);       for (auto &a : A) cin >> a;       sort((A).begin(), (A).end(), greater<long long>());       long long a, b, c;       a = A[0];       b = A[1];       c = A[2];       long long ans = 0;       if (a > 0) {         a--;         ans++;       }       if (b > 0) {         b--;         ans++;       }       if (c > 0) {         c--;         ans++;       }       if (a > 0 && b > 0) {         a--;         b--;         ans++;       }       if (c > 0 && b > 0) {         c--;         b--;         ans++;       }       if (a > 0 && c > 0) {         a--;         c--;         ans++;       }       if (a > 0 && b > 0 && c > 0) {         a--;         b--;         c--;         ans++;       }       cout << ans << endl;     }     return 0;   }