malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma warning(disable : 4996)   #pragma comment(linker,  /STACK:666000000 )   using namespace std;   const int inf = (1 << 30) - 1;   const long double eps = 1e-9;   const long double pi = fabs(atan2(0.0, -1.0));   void ML(const bool v) {     if (v) return;     int *ass;     for (;;) {       ass = new int[2500000];       for (int i = 0; i < 2500000; i++) ass[i] = rand();     }   }   void TL(const bool v) {     if (v) return;     int *ass;     ass = new int[250];     for (;;) {       for (int i = 0; i < 250; i++) ass[i] = rand();     }   }   void PE(const bool v) {     if (v) return;     puts( ass 1 2 3 4 5 6 fuck );     exit(0);   }   int n, m;   bool was[300][300];   void LoAd() { cin >> n >> m; }   vector<pair<int, int> > res;   bool swapped;   int x = 1, y = 1;   bool can_dn() { return !was[x + 1][y]; }   bool can_up() { return !was[x - 1][y]; }   bool can_lt() { return !was[x][y - 1]; }   bool can_rt() { return !was[x][y + 1]; }   void go_dn() {     res.push_back(make_pair(x, y));     was[x][y] = true;     x++;   }   void go_up() {     res.push_back(make_pair(x, y));     was[x][y] = true;     x--;   }   void go_lt() {     res.push_back(make_pair(x, y));     was[x][y] = true;     y--;   }   void go_rt() {     res.push_back(make_pair(x, y));     was[x][y] = true;     y++;   }   void SoLvE() {     if (min(n, m) == 1 && max(n, m) == 2) {       puts( 0 );       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) printf( %d %d n , i, j);       printf( 1 1 );       return;     }     if (n == 1 || m == 1) {       puts( 1 );       printf( %d %d %d %d n , n, m, 1, 1);       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) printf( %d %d n , i, j);       printf( 1 1 );       return;     }     if (n % 2 == 0 && m % 2 == 1) {       swap(n, m);       swapped = true;     }     for (int i = 0; i < 300; i++)       for (int j = 0; j < 300; j++)         if (1 <= i && i <= n && 1 <= j && j <= m)           was[i][j] = false;         else           was[i][j] = true;     if (1 == n % 2 && 1 == m % 2) {       puts( 1 );       printf( %d %d %d %d n , n, m, 1, 1);       while (x != n || y != m) {         while (can_dn()) go_dn();         if (can_rt()) go_rt();         while (can_up()) go_up();         if (can_rt()) go_rt();       }       res.push_back(make_pair(n, m));       res.push_back(make_pair(1, 1));     } else {       puts( 0 );       while (true) {         while (can_dn()) go_dn();         if (can_rt()) go_rt();         if (x == n && y == m) break;         while (can_up() && x > 2) go_up();         if (can_rt()) go_rt();       }       while (can_up()) go_up();       while (can_lt()) go_lt();       res.push_back(make_pair(x, y));       res.push_back(make_pair(1, 1));     }     for (int i = 0; i < (int)res.size(); i++) {       if (swapped) swap(res[i].first, res[i].second);       printf( %d %d n , res[i].first, res[i].second);     }   }   int main() {     srand((int)time(NULL));     LoAd();     SoLvE();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1000005], b[1000005], ans[1000005];   int main() {     int n;     cin >> n;     vector<int> v;     int y = 1;     while (y < n) {       v.push_back(y);       y *= 2;     }     int j = v.size() - 1, x;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (i < n - 1) {         x = a[i] + b[i];         if (i == 0)           ans[i] = x;         else           ans[i] = ans[i - 1] + x;         while (i + v[j] >= n && j < v.size()) {           j--;         }         b[i + v[j]] += x;       }     }     for (int i = 0; i < n - 1; i++) cout << ans[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long PLUS = -1;   const long long MULT = -2;   string fo;   vector<long long> tmp, whereMULT;   long long i, nr, lo, hi, total, add, crt, j, p, ans;   int main() {     cin >> fo;     fo =  1*  + fo +  *1 ;     for (i = 0; i < fo.size();) {       if (!( 0  <= fo[i] && fo[i] <=  9 )) {         (fo[i] ==  + ) ? tmp.push_back(PLUS) : tmp.push_back(MULT);         i += 1;       }       long long nr = 0;       while ( 0  <= fo[i] && fo[i] <=  9 ) {         nr = nr * 10 + fo[i] -  0 ;         i += 1;       }       tmp.push_back(nr);     }     for (i = 0; i < tmp.size(); ++i)       if (tmp[i] == MULT) whereMULT.push_back(i);     for (i = 0; i < whereMULT.size(); ++i)       for (j = i + 1; j < whereMULT.size(); ++j) {         lo = whereMULT[i] + 1, hi = whereMULT[j] - 1;         crt = 0;         add = tmp[lo];         lo += 1;         p = 0;         while (lo <= hi) {           if (tmp[lo] == MULT) {             lo += 1;             add *= tmp[lo];             lo += 1;           } else {             crt += add;             lo += 1;             add = tmp[lo];             lo += 1;           }         }         crt += add;         lo = 1, hi = tmp.size() - 1;         total = 0, add = 1;         while (lo <= hi) {           if (lo == whereMULT[i]) {             add *= crt;             lo = whereMULT[j];             continue;           }           if (tmp[lo] == MULT) {             lo += 1;             add *= tmp[lo];             lo += 1;           } else {             total += add;             lo += 1;             add = tmp[lo];             lo += 1;           }         }         total += add;         ans = max(ans, total);       }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int su(int n) {     int r, sum = 0;     while (n != 0) {       r = n % 10;       sum = sum + r;       n = n / 10;     }     return sum;   }   int main() {     int n;     cin >> n;     int k = n;     int i = 0;     while (i != 10) {       int d = su(k + i);       if (d % 4 == 0) {         cout << k + i << endl;         break;       }       i++;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       int n, m;       cin >> n >> m;       string s[n];       for (int i = 0; i < n; ++i) {         cin >> s[i];       }       int cnt = 0;       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           if (s[i][j] ==  B ) cnt++;         }       }       cnt = sqrt(cnt);       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           if (s[i][j] ==  B ) {             cout << i + cnt / 2 + 1 <<     << j + cnt / 2 + 1 << endl;             return 0;           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long res, d, e, k;   int N;   int h[2020];   long long dp[2020][2020];   long long pw(long long a, long long n) {     long long ret = 1;     while (n) {       if (n % 2) ret *= a, ret %= 998244353;       a *= a, a %= 998244353;       n >>= 1;     }     return ret;   }   long long C(long long n, long long r) {     if (r == 0 || r == n) return 1;     if (dp[n][r]) return dp[n][r];     return dp[n][r] = (C(n - 1, r - 1) + C(n - 1, r)) % 998244353;   }   int main() {     scanf( %d %d , &N, &k);     if (k == 1) return !printf( 0 );     for (int i = 0; i < N; i++) scanf( %d , &h[i]);     for (int i = 0; i < N; i++) {       if (h[i] == h[(i + 1) % N])         e++;       else         d++;     }     for (long long s = 0; s < d; s++) {       long long mul = 1;       mul *= pw(k - 2, s);       mul %= 998244353;       mul *= C(d, s);       mul %= 998244353;       long long sum = 0;       for (long long m = 0; m <= (d - s - 1) / 2; m++) {         sum += C(d - s, m);         sum %= 998244353;       }       mul *= sum;       mul %= 998244353;       res += mul;       res %= 998244353;     }     res *= pw(k, e);     res %= 998244353;     printf( %lld , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w,       x, y, z, ans, maxi, mini, res;   string s1, s2;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cin >> x;     if (x == 2)       cout << 2;     else       cout << 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int on[100005];   int prime[100005], cnt = 0;   void ola() {     for (int i = 2; i <= 100005; i++) {       if (!on[i]) prime[cnt++] = i;       for (int j = 0; j < cnt && i * prime[j] <= 100005; j++) {         on[i * prime[j]] = 1;         if (i % prime[j] == 0) break;       }     }   }   int main() {     int n, flag = 0;     cin >> n;     ola();     for (int i = 2; i <= n + 1; i++) {       if (on[i] == 1) {         on[i] = 2;         flag = 1;       } else         on[i] = 1;     }     if (flag == 1)       cout << 2 << endl;     else       cout << 1 << endl;     for (int i = 2; i <= n; i++) cout << on[i] <<    ;     cout << on[n + 1] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double EPS = 1E-9;   const int INF = 1000000000;   const long long INF64 = (long long)1E18;   const double PI = 3.1415926535897932384626433832795;   long long gcd(long long a, long long b) {     if (a < b) return gcd(b, a);     if (b == 0) return a;     return gcd(b, a % b);   }   int main() {     char *s = new char[2000000];     char *z = new char[2000000];     long long i, j, n, a, b, c, x = 0, y = 0, slen;     memset(s, 0, 2000000);     memset(z, 0, 2000000);     cin >> s;     slen = strlen(s);     for (i = 0; i < slen; ++i)       if (s[i] ==  x )         x++;       else         y++;     if (x > y) {       x = x - y;       for (i = 0; i < x; ++i) z[i] =  x ;     } else {       y = y - x;       for (i = 0; i < y; ++i) z[i] =  y ;     }     cout << z;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k, T;   long long doit(long long n, long long k) {     if (n == 1) return k * (k + 1) / 2;     long long tp = (n - 1) / k + 1, v1 = doit(tp, k), tp2 = (n - 1) % k + 1;     long long f1 = (tp - 1) * (k * k + 1), f2 = v1 - f1;     if (tp2 * k < f2)       return (f1 * 2 + tp2 * 2 * k - k + 1) * k / 2;     else if ((tp2 - 1) * k >= f2)       return (f1 * 2 - k + 3 + tp2 * 2 * k) * k / 2;     else       return (f1 * 2 - k + 1 + tp2 * 2 * k) * k / 2 + tp2 * k - f2 + 1;   }   long long solve(long long n, long long k) {     long long tp = (n - 1) / (k * k + 1) + 1, st = doit(tp, k);     if (n == st)       return tp * (k + 1);     else       return (n - tp + (n < st) - 1) / k + n - tp + (n < st);   }   int main() {     scanf( %d , &T);     while (T--) scanf( %lld%lld , &n, &k), printf( %lld n , solve(n, k));   }
#include <bits/stdc++.h>   using namespace std;   int t, n, m, a[5][200], ans;   vector<pair<int, int> > v, vec;   int getidx(int i, int j) { return (i - 1) * m + j; }   int geti(int idx) { return (idx - 1) / m; }   int getj(int idx) { return (((idx - 1) % m) + 1); }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> t;     while (t--) {       cin >> n >> m;       v.clear();       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= m; j++) {           cin >> a[i][j];           v.push_back({a[i][j], getidx(i, j)});         }       }       ans = 0;       sort(v.rbegin(), v.rend());       if (n < 4 || m == 1) {         for (int i = 0; i < n; i++) {           ans += v[i].first;         }       } else {         int ar[] = {0, 0, 0, 0, 1, 1, 1, 1};         do {           int tmp = 0;           vec.clear();           for (int i = 0; i < 8; i++) {             if (ar[i] == 1) {               int ii = geti(v[i].second);               int jj = getj(v[i].second);               vec.push_back({jj, ii});               tmp += v[i].first;             }           }           sort(vec.begin(), vec.end());           int ct = 1;           for (int i = 1; i < 4; i++)             if (vec[i].first != vec[i - 1].first) ct++;           if (ct != 2 || vec[1].first == vec[2].first ||               ((vec[1].second - vec[0].second + 4) % 2 ==                (vec[3].second - vec[2].second + 4) % 2)) {             ans = max(ans, tmp);           }         } while (next_permutation(ar, ar + 8));       }       cout << ans <<   n ;     }   }
#include <bits/stdc++.h>   const int INF = 2147483647;   using namespace std;   unsigned char like[7][7];   int fenzu[7];   int n, totjy[3];   int getnum(char l[50]) {     switch (l[0]) {       case  A :         return 0;       case  C :         if (l[1] ==  h )           return 1;         else           return 2;       case  T :         return 3;       case  D :         return 4;       case  S :         return 5;       case  H :         return 6;     }   }   void init_and_read() {     int i;     char pa[50], pb[50];     scanf( %d , &n);     memset(like, 0, sizeof(like));     for (i = 1; i <= n; i++) {       scanf( %s likes %s , &pa, &pb);       like[getnum(pa)][getnum(pb)] = 1;     }     for (i = 0; i < 3; i++) scanf( %d , &totjy[i]);   }   void Dec_To_Three(int x) {     int i = 0;     while (i < 7) {       fenzu[i] = x % 3;       x /= 3;       i++;     }   }   int Abs(int x) { return (x > 0) ? x : (-x); }   int max(int a, int b, int c) {     a = (a > b) ? a : b;     return (a > c) ? a : c;   }   void solve_and_print() {     int i, j, k, flag, peplo[3], jingyan[3], minidif = INF, maxlike = -INF;     int tmp, totlike;     for (i = 0; i <= 2186; i++) {       Dec_To_Three(i);       peplo[0] = peplo[1] = peplo[2] = 0;       for (j = 0; j <= 6; j++) {         peplo[fenzu[j]]++;       }       flag = 0;       for (j = 0; j <= 2; j++) {         if (!peplo[j]) {           flag = 1;           break;         }         jingyan[j] = totjy[j] / peplo[j];       }       if (flag) continue;       tmp = max(Abs(jingyan[0] - jingyan[1]), Abs(jingyan[0] - jingyan[2]),                 Abs(jingyan[1] - jingyan[2]));       if (tmp < minidif) {         minidif = tmp;         maxlike = -INF;       }       if (tmp == minidif) {         totlike = 0;         for (j = 0; j <= 6; j++) {           for (k = 0; k <= 6; k++) {             if ((fenzu[j] == fenzu[k]) && (like[j][k])) {               totlike++;             }           }         }       }       if (totlike > maxlike) maxlike = totlike;     }     printf( %d %d n , minidif, maxlike);   }   int main() {     init_and_read();     solve_and_print();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MAXN = 1e6 + 7;   const long double maxx = 1e11;   int tmp[MAXN];   int main() {     int n, k;     cin >> n >> k;     string s;     cin >> s;     k--;     if (k >= n / 2) k = n - k - 1;     int ans = 0, l = 0, r = 0;     for (int i = 0, j = n - 1; i < j; i++, j--) {       tmp[i] = min(abs(s[i] - s[j]), 26 - abs(s[i] - s[j]));     }     for (int i = 1; i <= n / 2; i++) tmp[i] += tmp[i - 1];     for (int i = 0; i < n / 2; i++) {       if (tmp[i]) {         l = i;         break;       }     }     for (int i = 0; i < n / 2; i++)       if (tmp[i] == tmp[n / 2]) {         r = i;         break;       }     if (tmp[n / 2]) ans = tmp[n / 2] + min(abs(k - l), abs(k - r)) + abs(l - r);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, tmp, curr = 0;     cin >> n;     int v[n], res[n];     for (int i = 0; i < n; i++) {       cin >> tmp;       v[tmp] = i + 1;     }     for (int i = 0; i < n; i++) {       cin >> tmp;       if (v[tmp] > curr) {         res[i] = v[tmp] - curr;         curr = v[tmp];       } else         res[i] = 0;     }     for (int i = 0; i < n; i++) cout << res[i] <<    ;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int Time = 0;   string s;   bool dp[2][(int)1e5 + 10];   struct Node {     int nxt[26];     bool leaf;     Node() {       for (int i = 0; i < 26; i++) nxt[i] = -1;       leaf = 1;     }   } trie[(int)1e5 + 10];   void dodaj(string s) {     int niz[100010];     for (int i = 0; i < s.size(); i++) niz[i] = s[i] -  a ;     int tr = 0;     for (int i = 0; i < s.size(); i++) {       if (trie[tr].nxt[niz[i]] == -1) trie[tr].nxt[niz[i]] = ++Time;       trie[tr].leaf = 0;       tr = trie[tr].nxt[niz[i]];     }   }   bool uradi0(int tr, bool minn) {     if (trie[tr].leaf) {       dp[0][tr] = 1;       return 1;     }     for (int i = 0; i < 26; i++) {       if (trie[tr].nxt[i] != -1) minn = min(minn, uradi0(trie[tr].nxt[i], 1));     }     dp[0][tr] = 1 ^ minn;     return dp[0][tr];   }   bool uradi1(int tr, bool minn) {     if (trie[tr].leaf) {       dp[1][tr] = 0;       return 0;     }     for (int i = 0; i < 26; i++) {       if (trie[tr].nxt[i] != -1) minn = min(minn, uradi1(trie[tr].nxt[i], 1));     }     dp[1][tr] = 1 ^ minn;     return dp[1][tr];   }   int main() {     cin >> n >> k;     for (int i = 0; i < n; i++) {       cin >> s;       dodaj(s);     }     uradi0(0, 1);     uradi1(0, 1);     if (dp[0][0] == 1 && dp[1][0] == 1)       cout <<  First  << endl;     else if (dp[0][0] == 1)       cout <<  Second  << endl;     else if (dp[1][0] == 1)       cout << ((k % 2 == 1) ?  First  :  Second ) << endl;     else       cout <<  Second  << endl;   }
#include <bits/stdc++.h>   int main() {     int n, t, i;     scanf( %d%d , &n, &t);     if (n == 1 && t == 10)       printf( -1 );     else {       if (t == 10) {         printf( 1 );         for (i = 0; i < n - 1; i++) printf( 0 );       } else         for (i = 0; i < n; i++) printf( %d , t);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 52;   int n, m, a[N][N], b[N][N], i, j;   int main() {     cin >> n >> m;     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) cin >> a[i][j];     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) cin >> b[i][j];     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++)         if (a[i][j] > b[i][j]) swap(a[i][j], b[i][j]);     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         if (a[i][j] <= a[i][j - 1] || i < n && (a[i][j] >= a[i + 1][j])) {           cout <<  Impossible ;           return 0;         }       }     }     for (i = 1; i <= n; i++) {       for (j = 1; j <= m; j++) {         if (b[i][j] <= b[i][j - 1] || i < n && (b[i][j] >= b[i + 1][j])) {           cout <<  Impossible ;           return 0;         }       }     }     cout <<  Possible ;   }
#include <bits/stdc++.h>   int n;   char s[20];   int main() {     scanf( %d , &n);     getchar();     int ans = 0;     for (int i = 1; i <= n; i++) {       scanf( %s , s);       if (s[0] ==  T ) {         ans += 4;       } else if (s[0] ==  C ) {         ans += 6;       } else if (s[0] ==  O ) {         ans += 8;       } else if (s[0] ==  D ) {         ans += 12;       } else {         ans += 20;       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = (long long)1e9 + 7;   const long double PI = 3.141592653589793238462643383279502884197;   long long fac[1] = {1}, inv[1] = {1};   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long mp(long long a, long long b) {     long long ret = 1;     while (b) {       if (b & 1) ret = ret * a % MOD;       a = a * a % MOD;       b >>= 1;     }     return ret;   }   long long cmb(long long r, long long c) {     return fac[r] * inv[c] % MOD * inv[r - c] % MOD;   }   int n[3];   int vec[3][200];   long long dp[201][201][201];   long long go(int a, int b, int c) {     if (dp[a][b][c] != -1) return dp[a][b][c];     long long mav = 0;     int nn[3] = {a, b, c};     for (int i = 0; i < 3; i++) {       int flag = 0;       for (int j = 0; j < 3; j++) {         if (i == j) continue;         if (nn[j] == n[j]) flag = 1;       }       if (flag) continue;       if (i == 0) mav = max(mav, go(a, b + 1, c + 1) + vec[1][b] * vec[2][c]);       if (i == 1) mav = max(mav, go(a + 1, b, c + 1) + vec[0][a] * vec[2][c]);       if (i == 2) mav = max(mav, go(a + 1, b + 1, c) + vec[0][a] * vec[1][b]);     }     return dp[a][b][c] = mav;   }   int main() {     memset(dp, -1, sizeof(dp));     scanf( %d %d %d , &n[0], &n[1], &n[2]);     for (int i = 0; i < 3; i++) {       for (int j = 0; j < n[i]; j++) scanf( %d , &vec[i][j]);       sort(vec[i], vec[i] + n[i], greater<long long>());     }     long long ans = go(0, 0, 0);     printf( %lld , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long int ar[500009], br[500009], cr[500009], tr[500009];   long long int fx[] = {-1, 1, 0, 0};   long long int fy[] = {0, 0, 1, -1};   map<long long int, long long int> mp;   vector<long long int> v;   string s;   struct evan {     long long int l, r, pos;   } st[500009];   bool com(evan i1, evan i2) { return (i1.r < i2.r); }   int main() {     long long int a, b, c, d, e, i, j, k, x, y, z, f, g, h, n, m;     cin >> a;     while (a--) {       cin >> b;       c = b / 4;       j = (b * 4) - b;       b -= c;       for (i = 1; i < b; i++) {         cout <<  9 ;       }       if (j % 4)         cout <<  8 ;       else {         cout <<  9 ;       }       for (i = 1; i <= c; i++) {         cout <<  8 ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x1, x2, y1, y2, x, y;     cin >> x1 >> y1 >> x2 >> y2 >> x >> y;     int temp1 = abs(x1 - x2), temp2 = abs(y1 - y2);     int temp3 = temp1 / x, temp4 = temp2 / y;     if (temp1 % x == 0 && temp2 % y == 0 && temp3 % 2 == temp4 % 2)       cout <<  YES n ;     else       cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   struct point {     double x, y, z;     point() {}     point(double _x, double _y, double _z) : x(_x), y(_y), z(_z) {}   };   const double eps = 1e-8;   double vlen(point p) { return sqrt(p.x * p.x + p.y * p.y + p.z * p.z); }   point xmult(point u, point v) {     point ret;     ret.x = u.y * v.z - v.y * u.z;     ret.y = u.z * v.x - u.x * v.z;     ret.z = u.x * v.y - u.y * v.x;     return ret;   }   point subt(point u, point v) {     point ret;     ret.x = u.x - v.x;     ret.y = u.y - v.y;     ret.z = u.z - v.z;     return ret;   }   int dot_online_in(point p, point l1, point l2) {     return (((vlen(xmult(subt(p, l1), subt(p, l2)))) > 0                  ? (vlen(xmult(subt(p, l1), subt(p, l2))))                  : -(vlen(xmult(subt(p, l1), subt(p, l2))))) < eps) &&            (l1.x - p.x) * (l2.x - p.x) < eps &&            (l1.y - p.y) * (l2.y - p.y) < eps && (l1.z - p.z) * (l2.z - p.z) < eps;   }   double x[10001], y[10001], z[10001], d[10001];   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i <= n; i++) scanf( %lf %lf %lf , &x[i], &y[i], &z[i]);     double vp, vs, px, py, pz;     scanf( %lf %lf , &vp, &vs);     scanf( %lf %lf %lf , &px, &py, &pz);     double lo = 0, hi = 0;     for (int i = 1; i <= n; i++) {       d[i] = sqrt((x[i] - x[i - 1]) * (x[i] - x[i - 1]) +                   (y[i] - y[i - 1]) * (y[i] - y[i - 1]) +                   (z[i] - z[i - 1]) * (z[i] - z[i - 1]));       hi += d[i] / vs;     }     if (hi * vp < sqrt((x[n] - px) * (x[n] - px) + (y[n] - py) * (y[n] - py) +                        (z[n] - pz) * (z[n] - pz)))       printf( NO n );     else {       double X = -1, Y = -1, Z = -1;       while ((hi - lo) >= 1e-10) {         double mid = (lo + hi) / 2;         double s = mid * vs;         for (int i = 1; i <= n; i++)           if (s > d[i])             s -= d[i];           else {             double t = s / d[i];             X = x[i - 1] + (x[i] - x[i - 1]) * t;             Y = y[i - 1] + (y[i] - y[i - 1]) * t;             Z = z[i - 1] + (z[i] - z[i - 1]) * t;             if (!dot_online_in(point(X, Y, Z),                                point(x[i - 1], y[i - 1], z[i - 1]),                                point(x[i], y[i], z[i]))) {               X = x[i - 1] - (x[i] - x[i - 1]) * t;               Y = y[i - 1] - (y[i] - y[i - 1]) * t;               Z = z[i - 1] - (z[i] - z[i - 1]) * t;             }             break;           }         if (mid * vp >=             sqrt((X - px) * (X - px) + (Y - py) * (Y - py) + (Z - pz) * (Z - pz)))           hi = mid;         else           lo = mid;       }       printf( YES n );       printf( %.10lf n , lo);       printf( %.10lf %.10lf %.10lf n , X, Y, Z);     }     return 0;   }