malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int fastio() {     ios_base::sync_with_stdio(false);     cout << fixed << setprecision(10);     cin.tie(nullptr);     return 0;   }   int __fastio = fastio();   void __print(int x) { cerr << x; }   void __print(long x) { cerr << x; }   void __print(long long x) { cerr << x; }   void __print(unsigned x) { cerr << x; }   void __print(unsigned long x) { cerr << x; }   void __print(unsigned long long x) { cerr << x; }   void __print(float x) { cerr << x; }   void __print(double x) { cerr << x; }   void __print(long double x) { cerr << x; }   void __print(char x) { cerr <<      << x <<     ; }   void __print(const char *x) { cerr <<     << x <<    ; }   void __print(const string &x) { cerr <<     << x <<    ; }   void __print(bool x) { cerr << (x ?  true  :  false ); }   template <typename T, typename V>   void __print(const pair<T, V> &x) {     cerr <<  { ;     __print(x.first);     cerr <<  , ;     __print(x.second);     cerr <<  } ;   }   template <typename T>   void __print(const T &x) {     int f = 0;     cerr <<  { ;     for (auto i : x) cerr << (f++ ?  ,  :   ), __print(i);     cerr <<  } ;   }   void _print() { cerr <<  ] n ; }   template <typename T, typename... V>   void _print(T t, V... v) {     __print(t);     if (sizeof...(v)) cerr <<  ,  ;     _print(v...);   }   void solve() {     int n, m;     cin >> n >> m;     vector<int> res(n + 1);     set<int> alive;     for (int i = 1; i <= n; i++) alive.insert(i);     vector<tuple<int, int, int>> events;     for (int i = 0; i < m; i++) {       int l, r, x;       cin >> l >> r >> x;       events.emplace_back(l, r, x);     }     for (auto [l, r, x] : events) {       auto lb = alive.lower_bound(l);       vector<int> killed;       while (lb != alive.end() && *lb <= r) {         killed.push_back(*lb);         ++lb;       }       for (auto &k : killed) {         if (k != x) {           res[k] = x;           alive.erase(k);         }       }     }     for (int i = 1; i <= n; i++) cout << res[i] <<    ;   }   int main() {     int t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   const long long N = 2e5 + 5, MOD = 1e9 + 7;   using namespace std;   int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};   int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};   long long n, m, a[N], cnt, ans;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> a[i], a[i] += a[i - 1];     for (long long i = 1, x; i <= m; i++) {       cin >> x;       long long lb = lower_bound(a + 1, a + n + 1, x) - a;       cout << lb <<     << x - a[lb - 1] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   enum { MAXN = 100010 };   pair<long long, long long> d[MAXN];   int x[MAXN], t[MAXN];   long long minv[MAXN];   int solveB(int n) {     int mans = 0;     for (int i = 0; i < n; i++) {       int f = upper_bound(minv, minv + mans, d[i].second) - minv + 1;       if (f > mans) {         minv[mans] = d[i].second;         mans = f;       } else         minv[f - 1] = min(minv[f - 1], d[i].second);     }     return mans;   }   int solveA(int n) {     int mans = 1;     minv[0] = 0;     for (int i = 0; i < n; i++)       if (d[i].first >= 0) {         int f = upper_bound(minv, minv + mans, d[i].second) - minv + 1;         if (f > 1) {           if (f > mans) {             minv[mans] = d[i].second;             mans = f;           } else             minv[f - 1] = min(minv[f - 1], d[i].second);         }       }     return mans - 1;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d%d , &x[i], &t[i]);     int v;     scanf( %d , &v);     for (int i = 0; i < n; i++)       d[i] = make_pair(x[i] + (long long)t[i] * v, -x[i] + (long long)t[i] * v);     sort(d, d + n);     int ansA = solveA(n);     int ansB = solveB(n);     printf( %d n%d n , ansA, ansB);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     long long n;     cin >> n;     long long arr[n];     for (long long i = 0; i < n; ++i) {       cin >> arr[i];     }     if (n == 1) {       cout << 1 <<     << 1 <<   n ;       cout << 1 <<   n ;       cout << 1 <<     << 1 <<   n ;       cout << 1 <<   n ;       cout << 1 <<     << 1 <<   n ;       cout << -(arr[0] + 2) <<   n ;       return 0;     }     if (n == 2) {       cout <<  1             <<                <<  1             <<   n ;       cout << n - arr[0] <<   n ;       cout << 2 <<     << 2 <<   n ;       cout << n - arr[1] <<   n ;       cout << 1 <<     << 2 <<   n ;       cout << -n <<     << -n <<   n ;       return 0;     }     long long dist[n];     for (long long i = 0; i < n; ++i) {       dist[i] = n - (arr[i] % n);       dist[i] %= n;     }     vector<long long> vec;     for (long long i = 0; i < n - 1; ++i) {       long long X = ((n - 1) - dist[i]) % (n - 1);       X %= (n - 1);       X += n - 1;       X %= (n - 1);       long long temp = (dist[i] + n * X);       vec.push_back(temp);       assert(temp >= -1000000000000000000 && temp <= 1000000000000000000);       assert(temp % (n - 1) == 0);     }     cout <<  1   << n - 1 <<   n ;     for (long long i = 0; i < vec.size(); ++i) {       cout << vec[i] <<    ;       arr[i] = arr[i] + vec[i];       assert(arr[i] % n == 0);     }     cout <<   n ;     cout << n <<     << n <<   n ;     cout << dist[n - 1] <<   n ;     arr[n - 1] += dist[n - 1];     assert(arr[n - 1] % n == 0);     cout << 1 <<     << n <<   n ;     for (long long i = 0; i < n; ++i) {       cout << -arr[i] <<    ;       assert(arr[i] % n == 0);     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     int a;     for (int i = 0; i < t; i++) {       int n, m;       cin >> n >> m;       if (n == 1 && m == 1) {         cout << 1 << endl;       } else if ((n == 1 && m != 1) || (m == 1 && n != 1)) {         if ((n * m) % 2 == 0) {           a = (n * m) / 2;           cout << a << endl;         } else {           a = (n * m) / 2;           cout << a + 1 << endl;         }       }       if ((n * m) % 2 == 1 && n != 1 && m != 1) {         a = (n * m) / 2;         a++;         cout << a << endl;       }       if ((n * m) % 2 == 0 && n != 1 && m != 1) {         a = (n * m) / 2;         cout << a << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 10;   const int TMXN = 1e6 * 4 + 1;   const int INF = 1e9 + 7;   const long long INFL = 1e18;   int n, k;   char a[N];   int mink = INF;   int pref[N];   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (!(a[i] - 48)) {         pref[i] = pref[i - 1] + 1;       } else {         pref[i] = pref[i - 1];       }     }     for (int i = n + 1; i <= N; i++) {       pref[i] = pref[i - 1];     }     for (int i = 1; i <= n; i++) {       int l = 0;       int r = max(n - i, i - 1) + 1;       if (a[i] ==  0 ) {         while (r - l > 1) {           int mid = (r + l) / 2;           if (pref[i + mid] - pref[max(i - mid - 1, 0)] >= k + 1) {             r = mid;           } else {             l = mid;           }         }         if (pref[i + r] - pref[max(i - r - 1, 0)] >= k + 1) {           mink = min(mink, r);         }         if (pref[i + l] - pref[max(i - l - 1, 0)] >= k + 1) {           mink = min(mink, l);         }       }     }     cout << mink;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     int64_t t;     cin >> t;     for (int64_t i = 0; i < t; i++) {       int64_t a, b;       cin >> a >> b;       if (a == b) {         cout << 0 << endl;         continue;       }       int64_t k = abs(b - a);       int64_t ans = k / 5;       k %= 5;       ans += k / 2;       k %= 2;       ans += k;       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> all[2010];   int dist(pair<int, int> a, pair<int, int> b) {     return abs(a.first - b.first) + abs(a.second - b.second);   }   int main() {     int n, m, k;     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         all[i].push_back(j);       }     }     for (int q = 0; q < k; q++) {       int x, y;       scanf( %d%d , &x, &y);       int d = sqrt(q);       pair<int, int> ans(1000000, 1000000);       for (int j = 0; j <= n && j <= dist(ans, make_pair(x, y)); j++) {         for (int k = 0; k < 2; k++) {           int i = x;           if (k)             i = min(n, i + j);           else             i = max(0, i - j);           if (all[i].size() == 0) continue;           int t = lower_bound(all[i].begin(), all[i].end(), y) - all[i].begin();           int p1 = all[i][(t == all[i].size() ? t - 1 : t)];           int p2 = all[i][(t - 1 == -1 ? t : t - 1)];           pair<int, int> now(i, p2);           if (abs(p1 - y) < abs(p2 - y)) now.second = p1;           if (dist(make_pair(x, y), ans) > dist(make_pair(x, y), now)) ans = now;           if (dist(make_pair(x, y), ans) == dist(make_pair(x, y), now) &&               now < ans)             ans = now;         }       }       printf( %d %d n , ans.first, ans.second);       all[ans.first].erase(           lower_bound(all[ans.first].begin(), all[ans.first].end(), ans.second));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int i, i0, n, m, a[105];   bool vis[100];   vector<int> ans;   int main() {     while (scanf( %d , &n) != EOF) {       for (i = 0; i < n; i++) scanf( %d , &a[i]);       sort(a, a + n);       for (i = 0; i < n; i++) {         if (a[i] == 0) {           ans.push_back(a[i]);           vis[0] = 1;           break;         }       }       for (i = 0; i < n; i++) {         if (a[i] < 10 && a[i] != 0) {           ans.push_back(a[i]);           vis[1] = 1;           break;         }       }       for (i = 0; i < n; i++) {         if (a[i] < 100 && a[i] % 10 == 0 && a[i] >= 10) {           ans.push_back(a[i]);           vis[2] = 1;           break;         }       }       for (i = 0; i < n; i++) {         if (a[i] == 100) {           ans.push_back(a[i]);           vis[3] = 1;           break;         }       }       if (vis[1] == 0 && vis[2] == 0) {         for (i = 0; i < n; i++)           if (a[i] < 100 && a[i] >= 10) {             ans.push_back(a[i]);             break;           }       }       printf( %d n , ans.size());       for (i = 0; i < ans.size(); i++) {         printf( %d , ans[i]);         if (ans.size() - 1 == i)           printf(  n );         else           printf(   );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     int n;     cin >> n;     string second;     cin >> second;     for (int i = 0; i < (int)n; i++) {       if (i < n - 2 && second[i] ==  o  && second[i + 1] ==  g  &&           second[i + 2] ==  o ) {         cout <<  *** ;         int j = i + 3;         bool flag = false;         while (j < n - 1) {           if (second[j] ==  g  && second[j + 1] ==  o ) {             flag = true;             j += 2;           } else             break;         }         i = j - 1;       } else {         cout << second[i];       }     }   }
#include <bits/stdc++.h>   int f[1000001];   int main() {     int n;     scanf( %d , &n);     f[0] = 0;     f[1] = 1;     f[2] = 1;     int i, j, k;     for (i = 3;; i++) {       f[i] = f[i - 1] + f[i - 2];       if (f[i] > 1000000000) break;     }     int idx = i;     int no = 0;     for (i = 0; i < idx; i++) {       for (j = i; j < idx; j++) {         for (k = i; k < idx; k++) {           if ((long long)f[i] + (long long)f[j] + (long long)f[k] == n) {             no = 1;             printf( %d %d %d n , f[i], f[j], f[k]);             break;           }         }         if (no) break;       }       if (no) break;     }     if (no == 0) printf( I m too stupid to solve this problem n );     scanf(   );   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   int n, nn, sz[133333], p;   vector<int> g[133333], V;   void dfs_sz(int x, int par) {     sz[x] = 1;     for (int to : g[x]) {       if (to != par) {         dfs_sz(to, x);         sz[x] += sz[to];       }     }     if (sz[x] == n / 2 || sz[x] == n / 2 + 1) {       V.push_back(x);       if (~par) V.push_back(par);     }   }   int dp[133333];   int dfs(int x, int par) {     if (g[x].size() - (par != -1) == 0) {       dp[x] = 1;       return dp[x];     }     vector<int> v;     for (int to : g[x]) {       if (to != par) {         dfs(to, x);         v.push_back(dp[to]);       }     }     sort(v.begin(), v.end());     if (v.size() == 1) {       if (v[0] == 1) {         dp[x] = -2;         p = x;       } else {         dp[x] = inf;       }     } else if (v.size() == 2) {       if (v[1] < 0) {         dp[x] = inf;       } else if (v[0] < 0) {         if (v[0] + v[1] == 0)           dp[x] = v[0] - 1;         else           dp[x] = inf;       } else {         if (v[0] == v[1]) {           dp[x] = v[0] + 1;         }       }     } else if (v.size() == 3) {       if (v[0] == v[1] && v[2] == v[1] + 1) {         dp[x] = -v[2] - 1;         p = x;       } else {         dp[x] = inf;       }     }     return dp[x];   }   int main() {     cin >> nn;     n = (1 << nn) - 2;     for (int i = 1; i < n; i++) {       int x, y;       cin >> x >> y;       g[x].push_back(y);       g[y].push_back(x);     }     dfs_sz(1, -1);     set<int> ans;     for (int x : V) {       p = 0;       dfs(x, -1);       if (dp[x] == -nn && p) ans.insert(p);     }     cout << ans.size() << endl;     for (int x : ans) {       cout << x <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string a, s =   ;     int b;     cin >> b;     for (int i = -1; i < b; i++) {       getline(cin, a);       int len = a.length();       if (len >= 2 and a.substr(len - 2, 2) ==  po ) {         s +=  FILIPINO ;         s +=   n ;       } else if (len >= 4 and a.substr(len - 4, 4) ==  masu  or                  len >= 4 and a.substr(len - 4, 4) ==  desu ) {         s +=  JAPANESE ;         s +=   n ;       } else if (len >= 5 and a.substr(len - 5, 5) ==  mnida ) {         s +=  KOREAN ;         s +=   n ;       }     }     cout << s;   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC optimize( unroll-loops )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   int type0, type1;   void dfs(int s, bool visited[], vector<int> adj[], int type[], int ctr) {     if (visited[s]) return;     visited[s] = true;     type[s] = ctr;     if (ctr == 0)       type0++;     else       type1++;     ctr = (ctr + 1) % 2;     for (auto u : adj[s]) dfs(u, visited, adj, type, ctr);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       bool visited[n + 1];       memset(visited, false, sizeof(visited));       vector<int> adj[n + 1];       for (int i = 0; i < m; i++) {         int a, b;         cin >> a >> b;         adj[a].push_back(b);         adj[b].push_back(a);       }       int type[n + 1];       memset(type, -1, sizeof(type));       type0 = 0;       type1 = 0;       int ctr = 0;       for (int i = 1; i <= n; i++) {         if (!visited[i]) {           dfs(i, visited, adj, type, ctr);         }       }       if (type0 <= type1) {         cout << type0 <<   n ;         for (int i = 1; i <= n; i++) {           if (type[i] == 0) cout << i <<    ;         }       } else {         cout << type1 <<   n ;         for (int i = 1; i <= n; i++) {           if (type[i] == 1) cout << i <<    ;         }       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> l[1000000];   int main() {     int n;     cin >> n;     int a[n], b[n], c[n];     for (int i = 0; i < n; i++) {       cin >> a[i];       l[a[i]].push_back(i + 1);     }     int q = 0;     for (int i = 0; i < n; i++) {       int j = a[i];       if (a[j - 1] != j) q = 1;     }     int m = 1;     for (int i = 1; i <= n; i++) {       int z = 0;       for (std::vector<int>::iterator it = l[i].begin(); it != l[i].end(); ++it) {         b[*it - 1] = m;         z = 1;       }       if (z == 1) {         c[m - 1] = i;         m++;       }     }     if (q == 0) {       cout << m - 1 << endl;       for (int i = 0; i < n; i++) {         cout << b[i] <<    ;       }       cout << endl;       for (int i = 0; i < m - 1; i++) {         cout << c[i] <<    ;       }     } else       cout <<  -1 ;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long mxmx = -1, mnmx = -1;     while (n--) {       long long x, y, h, w;       char c;       cin >> c;       if (c ==  + ) {         cin >> x >> y;         if (x < y) swap(x, y);         mxmx = max(mxmx, x);         mnmx = max(mnmx, y);       } else {         cin >> h >> w;         if (max(h, w) >= mxmx && min(h, w) >= mnmx)           cout <<  YES                 <<   n ;         else           cout <<  NO                 <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (b == 0) {       return a;     } else {       return gcd(b, a % b);     }   }   long long lcm(long long a, long long b) { return (a * b) / (gcd(a, b)); }   void solve() {     long long n;     cin >> n;     vector<long long> arr(n);     map<long long, vector<long long>> vec;     for (long long i = 0; i < n; i++) {       cin >> arr[i];       for (long long k = 0; k < 32; k++) {         if (arr[i] & 1 << k) {           vec[k].push_back(i);         }       }     }     long long ans = -1;     for (auto itr = vec.rbegin(); itr != vec.rend(); itr++) {       if (itr->second.size() == 1) {         ans = *itr->second.begin();         cout << arr[ans] <<    ;         break;       }     }     for (long long i = 0; i < n; i++) {       if (i == ans) {         continue;       }       cout << arr[i] <<    ;     }     cout <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin.tie(0);     cout.tie(0);     long long t;     t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   #define inf 0x3f3f3f3f   #define IOS ios_base::sync_with_stdio(0); cin.tie(0);   #define rep(i, a, n) for(int i = a; i <= n; ++ i)   #define per(i, a, n) for(int i = n; i >= a; -- i)   //#define ONLINE_JUDGE   using namespace std;   typedef long long ll;   const int mod=1e9+7;   template<typename T>void write(T x)   {       if(x<0)       {           putchar( - );           x=-x;       }       if(x>9)       {           write(x/10);       }       putchar(x%10+ 0 );   }      template<typename T> void read(T &x)   {       x = 0;char ch = getchar();ll f = 1;       while(!isdigit(ch)){if(ch ==  - )f*=-1;ch=getchar();}       while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;   }      int gcd(int a,int b){return b==0?a:gcd(b,a%b);}   int lcm(int a,int b){return a/gcd(a,b)*b;};   ll ksm(ll a,ll n){    ll ans=1;    while(n){     if(n&1) ans=(ans*a)%mod;     a=a*a%mod;     n>>=1;    }    return ans%mod;   }   //==============================================================   #define int ll   const int maxn=1e3+100;   int t,n,k,a[maxn];   ll cnt[maxn];   map<int,int>need;   ll f[maxn],finv[maxn];   void init(){    f[0]=1;    rep(i,1,maxn-1)f[i]=f[i-1]*i%mod;    finv[maxn-1]=ksm(f[maxn-1],mod-2);    per(i,0,maxn-2){     finv[i]=(finv[i+1]*(i+1))%mod;    }   }   ll C(ll n,ll k){    return (f[n]*finv[n-k]%mod*finv[k]%mod)%mod;   }      signed main()   {    #ifndef ONLINE_JUDGE    freopen( in.txt , r ,stdin);    freopen( out.txt , w ,stdout);    #endif    //clock_t c1 = clock();    //===========================================================    read(t);    init();    while(t--){     need.clear();     read(n),read(k);     rep(i,1,n) read(a[i]);     sort(a+1,a+1+n);     int mx=0;     ll ans=1;     per(i,n-k+1,n)mx+=a[i],need[a[i]]++;     rep(i,1,n)cnt[a[i]]++;     for(auto x:need){      int now=x.first;      int num=x.second;      ans=(ans*C(cnt[now],num))%mod;     }     write(ans%mod),putchar(  n );     fill(cnt,cnt+n+1,0);    }    //===========================================================    //std::cerr <<  Time:  << clock() - c1 <<  ms  << std::endl;    return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long i, j, n, m, f1, f2, t, k, a, b, x1, x2, w;   long long ans = -1;   vector<long long> vis;   vector<vector<long long>> adj;   long long dfs(long long v) {     vis[v] = 1;     long long value = 1;     for (long long u : adj[v]) {       if (!vis[u]) {         value += dfs(u);       }     }     if (value % 2 == 0) ans++;     return value;   }   int main() {     t = 1;     while (t--) {       cin >> n;       adj.assign(n + 1, {});       vis.assign(n + 1, 0);       for (i = 1; i < n; i++) {         cin >> a >> b;         adj[a].push_back(b);         adj[b].push_back(a);       }       if (n & 1) {         cout << -1;         return 0;       }       dfs(1);       cout << ans;     }   }
#include <bits/stdc++.h>   using namespace std;   long long sum(long long a[], long long n, long long s) {     for (long long i = 0; i < n; i++) s += a[i];     return s;   }   long long power(long long x, long long y, long long p) {     long long res = 1;     x = x % p;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   void solve() {     long double a, b, x, y, z;     cin >> a >> b;     x = int((a + b) / (2 * b));     y = 2.0 * x;     z = (1.0 * a + 1.0 * b) / y;     if (a < b) {       cout << -1 << endl;       return;     }     cout << setprecision(12) << z << endl;     return;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     long long t, T;     T = 1;     for (t = 1; t <= T; t++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e3 + 9;   char s[N];   bool vis[N];   struct Point {     long long x, y, id;     Point(long long _x = 0, long long _y = 0, long long _id = 0) {       x = _x;       y = _y;       id = _id;     }     Point operator-(const Point& b) const { return Point(x - b.x, y - b.y); }   } p[N], p0, tem[N];   long long cross(Point a, Point b) { return a.x * b.y - b.x * a.y; }   bool cmp(Point a, Point b) { return cross(a - p0, b - p0) >= 0; }   int main() {     int n;     scanf( %d , &n);     p0 = Point(10000000000, 10000000000);     for (int i = 1; i <= n; ++i) {       scanf( %lld %lld , &p[i].x, &p[i].y);       p[i].id = i;       if (p[i].y < p0.y || (p0.y == p[i].y && p[i].x < p0.x)) p0 = p[i];     }     scanf( %s , s);     vector<int> ans;     ans.push_back(p0.id);     vis[p0.id] = 1;     int sp = 0;     for (int i = 2; i <= n; ++i, ++sp) {       int cnt = 0;       for (int j = 1; j <= n; ++j) {         if (vis[j]) continue;         tem[++cnt] = p[j];       }       sort(tem + 1, tem + 1 + cnt, cmp);       int nex;       if (s[sp] ==  L )         nex = tem[1].id;       else         nex = tem[cnt].id;       ans.push_back(nex);       vis[nex] = 1;       p0 = p[nex];     }     for (int i = 0; i < (int)ans.size(); ++i) printf( %d  , ans[i]);     return 0;   }