akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 500001
#define M 500001
using namespace std;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int inf = 1000000001;

piii pos[N]; int x[N], y[N];

vector<int> g[N]; int nc;
void adde(int u, int v) {
    //cout << u << "->" << v << endl;
    g[u].push_back(v);
}


int id1[1<<16], id2[1<<16];
void build(int p, int lb, int rb) {
    id1[p] = ++nc; g[nc].clear();
    id2[p] = ++nc; g[nc].clear();
    if (lb + 1 == rb) {
        adde(id1[p], pos[lb].second.second);
        adde(pos[lb].second.first, id2[p]);
    }
    else {
        int mid = (lb + rb) >> 1;
        build(p << 1, lb, mid);
        build(p << 1 | 1, mid, rb);
        adde(id1[p], id1[p << 1]);
        adde(id1[p], id1[p << 1 | 1]);
        adde(id2[p << 1], id2[p]);
        adde(id2[p << 1 | 1], id2[p]);
    }
}

int opp(int x) { return x & 1 ? x + 1 : x - 1; }

void adde(int l, int r, int x, int p, int lb, int rb) {
    if (l >= r) return;
    if (l <= lb && rb <= r) {
        adde(x, id1[p]);
        adde(id2[p], opp(x));
    }
    else {
        int mid = (lb + rb) >> 1;
        if (l < mid) adde(l, r, x, p << 1, lb, mid);
        if (r > mid) adde(l, r, x, p << 1 | 1, mid, rb);
    }
}

int dfn[M], low[M], bel[M], dfc, scc;
bool inst[M]; int scs[M], *sct = scs;
void scc_clr(int n) { scc = 0; fill(dfn + 1, dfn + n + 1, 0); }
int dfs_scc(int u) {
    *sct++ = u; inst[u] = 1;
    dfn[u] = low[u] = ++dfc;
    for (int v : g[u]) {
        if (!dfn[v]) low[u] = min(low[u], dfs_scc(v));
        else if (inst[v]) low[u] = min(low[u], low[v]);
    }
    if (dfn[u] == low[u])
        for (++scc; *sct != u; --sct)
            bel[sct[-1]] = scc, inst[sct[-1]] = 0;
    return low[u];
}

bool check(int d, int n) {
    int m = 2 * n;
    nc = m;
    for (int i = 1; i <= m; ++i)
        g[i].clear();
    build(1, 1, m + 1);
    //cout << string(79, '-') << endl;
    for (int i = 1; i <= m; ++i) {
        int lx = pos[i].first - d, rx = pos[i].first + d;
        int l = upper_bound(pos + 1, pos + m + 1, piii(lx, pii(inf,inf))) - pos;
        int r = lower_bound(pos + 1, pos + m + 1, piii(rx, pii(0,0))) - pos;
        int x = pos[i].second.first;
        adde(l, i, x, 1, 1, m + 1);
        adde(i + 1, r, x, 1, 1, m + 1);
    }
    //cout << string(79, '=') << endl;
    scc_clr(nc);
    for (int i = 1; i <= nc; ++i)
        if (!dfn[i]) dfs_scc(i);

    for (int i = 1; i <= m; ++i) {
        if (i & 1) {
            if (bel[i] == bel[i + 1])
                return false;
        }
    }
    return true;
}

int main(void){
    ios::sync_with_stdio(0); cin.tie(0);
//#ifndef ONLINE_JUDGE
//    ifstream cin("1.in");
//#endif // ONLINE_JUDGE

    int n; cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
        pos[i * 2 - 1] = { x[i], pii(i * 2 - 1, i * 2) };
        pos[i * 2] = { y[i], pii(i * 2, i * 2 - 1) };
    }

    sort(pos + 1, pos + 2 * n + 1);

    int l = 1, r = inf;
    while (l <= r) {
        int mid = (l + r) >> 1;
        if (!check(mid, n)) r = mid - 1;
        else l = mid + 1;
    }

    cout << r << endl;

	return 0;
}

Measured memory_bytes: 37740
#include<bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

int main() {
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if (a[0] == 5 && a[1] == 5 && a[2] == 7) {
        cout << "YES\n";
    }
    else {
        cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define mod 1000000007

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}
ll priority[9]={1,7,4,5,3,2,9,6,8},cost[10]={0,2,5,5,4,5,6,3,7,6};

int main(){
  ll i=0,N,cnt=0;
  cin>>N;
  vector<ll> list(10,0),a(N+1,0),index(N);
  rep1(i,N+1)cin>>a[i];
  rep1(i,N+1){
    if(i<a[i]){
      if(a[a[i]]==i)cnt++;
    }
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 1792
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   :
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define re return
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 1e5 + 7, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
int arr[3] = { 0, 1, 2 }, n, dp[N][5][5][5];
inline bool check(vi v) {
	int cnt1 = 0, cnt2 = 0;
	lp(j,0,2)
		cnt1 += (v[j] == arr[j]);
	lp(j,1,3)
		cnt2 += (v[j] == arr[j - 1]);
	return (cnt1 == 3 || cnt2 == 3);
}
inline bool can(vi v) {
	if (check(v))
		return true;
	lp(i,0,2)
	{
		swap(v[i], v[i + 1]);
		if (check(v))
			return true;
		swap(v[i], v[i + 1]);
	}
	return false;
}
int solve(int idx, int prv1, int prv2, int prv3) {
	if (idx >= n)
		return 1;
	int &ret = dp[idx][prv1][prv2][prv3];
	if (ret != -1)
		re (ret % mod);
	ret = 0;
	lp(i,0,3)
	{
		vi v;
		v.pb(prv3);
		v.pb(prv2);
		v.pb(prv1);
		v.pb(i);
		if (can(v))
			continue;
		ret += solve(idx + 1, i, prv1, prv2);
		if (ret >= mod)
			ret %= mod;
	}
	re ret;
}
int main() {
	FAST
	clr(dp, -1);
	cin >> n;
	cout << solve(0, 4, 4, 4) << "\n";
	return 0;
}

Measured memory_bytes: 49152
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

std::vector<int> solve(int n, const std::vector<int>& bosses)
{
  std::vector<int> result(n);
  for (int i = 0; i < n - 1; ++i) {
    auto b = bosses.at(i);
    result.at(b - 1) += 1;
  }
  return result;
}

int main()
{
  int n;
  std::cin >> n;
  std::vector<int> bosses(n - 1);
  for (auto& a : bosses) {
    std::cin >> a;
  }

  auto vv = solve(n, bosses);

  std::cout << std::setprecision(20);
  for (auto v : vv) {
    std::cout << v << std::endl;
  }
}


Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int k;
  cin >> k;
  
  int x = 7 % k;
  set<int> s;
  
  int i = 1;
  
  for(int i = 1 ; i <= k ; ++i){
    if(x==0){
      cout << i << endl;
      return 0;
    }
    
    s.insert(x);
    x = (x*10+7)%k;
  }
  
  cout << -1 << endl;
  
  return 0;
  
}


Measured memory_bytes: 50340
# coding: utf-8
k, a, b = map(int, input().rstrip().split())

#a-bを計算しa-b >= -2の場合ポケットを叩き続けた方が最大になる
sub = a - b
if sub >= -2:
    biscuit = 1 + k
    print(biscuit)
    exit()

#ビスケットと1円を交換できるようになるまでに必要な回数
time = a - 1
#k回までに全部で何回交換（ビスケット→円→ビスケット)できるか
can_do = int((k-time)/2)
if (k-time)%2 == 0:
    ans = a + can_do*(b-a)
else:
    ans = a + can_do*(b-a) + 1

print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define pb push_back
#define mem(arr,x) memset(arr,x,sizeof(arr))
long int ans=INT_MAX,n,m,x;
long int row[20];
void calc(vector<vector<long int>>books,vector<long int>price)
{
    vector<long int>vec(m,0);
    long int p=0;
    for(int i=0;i<n;i++)
    {
        if(row[i]==1)
        {
            p+=price[i];
            for(int j=0;j<m;j++)
            vec[j]+=books[i][j];
        }
    }
    for(int i=0;i<m;i++)
    {
        if(vec[i]<x)
        return;
    }
    ans=min(ans,p);
    return;
}
void bactrack(vector<vector<long int>>books,vector<long int>price,int i)
{
    if(i>=n)
    {
        calc(books,price);
        return;
    }
    row[i]=1;
    bactrack(books,price,i+1);
    row[i]=0;
    bactrack(books,price,i+1);
}
int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long int i,j;
    cin>>n>>m>>x;
    vector<vector<long int>>books(n+1,vector<long int>(m+1,0));
    vector<long int>price(n+1);
    for(i=0;i<n;i++)
    {
        cin>>price[i];
        for(j=0;j<m;j++)
        cin>>books[i][j];
    }
    memset(row,0,sizeof(row));
    bactrack(books,price,0);
    if(ans==INT_MAX)
    cout<<-1;
    else
    cout<<ans;
    return 0;
}   

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (int) 1e9+7
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define vi vector<int>
ll xpow(ll a, ll b)
{
	if (b == 0)
		return 1;
	if (b % 2 == 0)
	{
		ll k = xpow(a, b / 2);
		return k * k;
	}
	if (b % 2 != 0)
		return a * xpow(a, b - 1);
}
int main()
{

#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	freopen("out1.txt", "w", stdout);
#endif
	fio;
	int n, k;
	cin >> n >> k;
	priority_queue<int, vector<int>, greater<int>> pq;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		pq.push(x);
	}
	ll ans = 0;
	while (k--) {
		int x = pq.top();
		pq.pop();
		ans += x;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N, K;
int p[200010];


signed main(){
    cin >> N >> K;
    rep(i, 0, N) cin >> p[i];

    long double ans = 0, s = 0;
    rep(i, 0, K) ans += (p[i]+1)/2.0;
    s = ans;
    rep(i, K, N){
        s -= (p[i-K]+1)/2.0;
        s += (p[i]+1)/2.0;
        chmax(ans, s);
    }

    fcout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
////////////////////////////////////
///     Please Give Me AC!!!     ///
////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define forin(in) for(int i=0; i<(int)in.size(); i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    string s, t; cin>> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if(s < t) cout<< "Yes" << endl;
    else cout<< "No" << endl;
}

Measured memory_bytes: 3560
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

int main(int argc, char const *argv[])
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	printf("%d\n", (a * b < c * d) ? (c * d) : (a * b));
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl "\n"
const int MAX= 100005 ;
const long long mod = 1.0e9+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
   
    ll n,i,j;
    cin>>n;
    ld prob[n];
    ld dp[n+1][n+1];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=n;j++)
        {
            dp[i][j]=0;
        }
    }
    for(i=0;i<n;i++)
    {
        cin>>prob[i];
    }
    dp[1][0]=1.0-prob[0];
    dp[1][1]=1.0*prob[0];
    for(i=2;i<=n;i++)
    {
        for(j=0;j<=i;j++)
        {
            if(j!=0)
                dp[i][j]=dp[i-1][j]*(1-prob[i-1])+dp[i-1][j-1]*prob[i-1];
        
            else
                dp[i][j]=dp[i-1][j]*(1-prob[i-1]);
        }
    }
    ld sum=0.0;
    for(i=n/2+1;i<=n;i++)
    {
        sum+=1.0*dp[n][i];
    }
    cout<<fixed<<setprecision(10)<<sum<<endl;
    return 0;
}

Measured memory_bytes: 140928
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    vec H(N); cin >> H;
    Sort(H);
    int n = max(0LL, N - K);
    int ans = 0;
    REP(i, n) ans += H[i];
    Out(ans);

    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/

 
int par[300005];
int n,m;
vector<int> adj[100005];
int find(int a){
     if(par[a]==a)return a;
     return par[a]=find(par[a]);
}
void unite(int a,int b){
     a=find(a),b=find(b);if(a==b)return ;
     par[b]=a;
}
int main(){
     cin>>n>>m;
     for(int i=1;i<=n;i++){
          int k;cin>>k;
          while(k--){
               int l;cin>>l;
               adj[i].pb(l);
          }
     }
     for(int i=1;i<=n+m;i++){
          par[i]=i;
     }
     for(int i=1;i<=n;i++){
          for(auto it:adj[i]){
               unite(i,it+n);
          }
     }
     int res=find(1);
     for(int i=1;i<=n;i++){
          if(find(i)!=res){cout<<"NO";return 0;}
     }
     cout<<"YES";
}
 
 
 
 
 

























Measured memory_bytes: 12916
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cassert>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

// ModInt
ll extgcd(ll a, ll b, ll &x, ll &y) {
  auto d = a;
  if (b != 0) {d = extgcd(b, a%b, y, x); y -= (a/b)*x;} else { x = 1; y = 0;}
  return d;
}
ll minv(ll a, ll m) {
  ll x, y; extgcd(a, m, x, y); return (m + x%m)%m;
}
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint& operator/=(const mint& a){ (x*=minv(a.x, mod))%=mod; return *this; }
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  mint operator/(const mint& a)const{ return mint(*this) /= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, c; cin >> n >> c;
  vector<int> a(n);
  rep(i, n) {
    cin >> a[i];
  }
  vector<int> b(n);
  rep(i, n) {
    cin >> b[i];
  }

  vector<vector<mint>> expo(401, vector<mint>(c+1));
  vector<vector<mint>> rexpo(401, vector<mint>(c+1));

  for(int i=1; i<=400; i++) {
    mint now = 1;
    for(int j=0; j<=c; j++) {
      expo[i][j] = now;
      now *= i;
    }
  }

  for(int i=1; i<=400; i++) {
    for(int j=0; j<=c; j++) {
      rexpo[i][j] = expo[i][j] + rexpo[i-1][j];
    }
  }

  vector<vector<mint>> dp(n+1, vector<mint>(c+1));
  dp[0][0] = 1;
  for(int i=1; i<=n; i++) {
    for(int j=0; j<=c; j++) {
      for(int k=0; k<=j; k++) {
        dp[i][j] += dp[i-1][j-k]*(rexpo[b[i-1]][k] - rexpo[a[i-1]-1][k]);
      }
    }
  }
  cout << dp[n][c] << endl;
}

Measured memory_bytes: 4096
// snuke氏のyoutube解説を参照(公式解説)
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int INF = 1001001000;
int dp[1000100][2];

int main()
{
    string S;
    cin >> S;
    reverse(S.begin(),S.end());
    S += '0';
    int n = S.size();
    for(int i = 0; i <= n; ++i) for(int j = 0; j < 2; ++j) dp[i][j] = INF;
    dp[0][0] = 0;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < 2; ++j) {
            int x = S[i] - '0';
            if(j == 1) ++x; // 繰り下がりがある場合
            for(int a = 0; a < 10; ++a) {
                int ni = i+1, nj = 0;
                int b = a - x;
                if(b < 0) b += 10, nj = 1;
                dp[ni][nj] = min(dp[ni][nj], dp[i][j] + a + b);
            }
        }
    }
    cout << dp[n][0] << endl;
    return 0;
}

Measured memory_bytes: 9220
#include <bits/stdc++.h>
using namespace std;
long long ans = LLONG_MAX;
int main () {
	long long n;
	cin>>n;
	for(long long i=1;i*i<=n;i++){
		if(n%i==0){
			long long p=i,q=n/i;
			ans=min(p-1+q-1,ans);
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>
#include <ctime>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool debug=false;
 
/*---------------------------------------------------*/

int main(){
  int a,b;
  bool ok=true;
  string s;
  cin>>a>>b>>s;
  rep(i,a){
    if(s[i]!='-')continue;
    else ok=false;
    
  }
  if(s[a]!='-')ok=false;
  REP(i,a+1,a+1+b){
    if(s[i]!='-')continue;
    else ok=false;
    
  }
  if(ok)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
    int n,k,c,L[200010],R[200010];
    string s;
    cin>>n>>k>>c>>s;
    int j=0;
    for(int i=1;i<=k&&j<n;){
        if(s[j]=='o'){
            L[i]=j+1;
            i++;
            j+=c+1;
        }
        else{
            j++;
        }
    }
    j=n-1;
    for(int i=k;i>0&&j>=0;){
        if(s[j]=='o'){
            R[i]=j+1;
            i--;
            j-=(c+1);
        }
        else{
            j--;
        }
    }
    for(int i=1;i<=k;i++){
        if(L[i]==R[i]){
            printf("%d\n",L[i]);
        }
    }
}

Measured memory_bytes: 3332
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

string s;

int main() {
    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (i-1 >= 0 && s[i-1] == s[i]) {
            cout << i << " " << i+1 << "\n";
            return 0;
        }
        if (i-2 >= 0 && s[i-2] == s[i]) {
            cout << i-1 << " " << i+1 << "\n";
            return 0;
        }
    }

    cout << "-1 -1\n";
    return 0;
}

Measured memory_bytes: 512
N, K = map(int, input().split())

mod = 10 ** 9 + 7
ans = 0

for k in range(K, N + 2):
    a = k * (k - 1) // 2
    b = k * (2 * N - k + 1) // 2
    ans += (b - a + 1) % mod
    ans %= mod

print(ans % mod)
# print(l)


Measured memory_bytes: 9160
t = map(int, raw_input().split())
kaisu = len(t)

for i in range(kaisu-1):
    for j in range(i+1, kaisu) :
        if t[i] > t[j] :
            temp = t[i]
            t[i] = t[j]
            t[j] = temp

for i in range(kaisu):
    print "%d" %t[i] , 

Measured memory_bytes: 6440
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int main(){
	int N;
	cin >> N;
	set<string> S;

	rep(i,N){
		string str;
		cin >> str;
		S.insert(str);
	}

	cout <<  S.size() << endl;
}

Measured memory_bytes: 19224
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
  ll N;
  cin>>N;
  ll ans=1;
  for(ll i=1; i<=N; ++i){
    ans=ans*i%1000000007;
  }
  cout<<ans<<endl;
}
  
      
      


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a = 0;
    int b = 0;
    int d = 0;
    int r = 0;
    double f = 0;
    
    scanf("%d%d",&a,&b);
    
    d = a/b;
    r = a%b;
    f = (double)a/(double)b;
    
    printf("%d %d %.5lf",d,r,f);
    
    return 0;
}


Measured memory_bytes: 2052
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> S(H, vector<char>(W));
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      cin >> S[i][j];

  vector<vector<int>> ans(H, vector<int>(W, -1));
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      if (S[i][j] == 'c')
        ans[i][j] = 0;

  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W - 1; ++j)
      if (ans[i][j] != -1 && ans[i][j + 1] != 0)
        ans[i][j + 1] = ans[i][j] + 1;

  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      if (j == W - 1)
        cout << ans[i][j] << endl;
      else
        cout << ans[i][j] << ' ';
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

int main(){
    int n;
    cin >> n;
    vector<int> a(n), z(n);
    int memo;
    rep(i, n){
        cin >> a[i];
        z[i] = abs(a[i]);
        if(a[i] < 0) memo++;
    }
    sort(z.begin(), z.end());
    ll ans = 0;
    if(memo % 2 == 1) ans -= z[0];
    else ans += z[0];
    for(int i = 1; i < n; i++){
        ans += z[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
const input = require('fs').readFileSync('/dev/stdin/', 'utf8');
const numbers = input.trim().split('\n')[0].split(' ');

const a = numbers[0];
const b = numbers[1];

const result = `${Math.floor(a/b).toString()} ${a % b} ${(a*1.0/b).toFixed(8)}`;
console.log(result);


Measured memory_bytes: 15368
# -*- coding:utf-8 -*-
if __name__ == "__main__":
    x = int(input())
    ans = float('-inf')
    for p in range(1,x+1):
        for b in range(2, x+2):
            if p**b <= x:
                ans = max(ans, p**b)
            else:
                break
    else:
        print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K,ans=0;
  cin >> N >> K;
  int h;
  for(int i=0;i<N;i++){
    cin >> h;
    if(K <= h) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
a,b,c,d=map(int, input().split())
answer=0

if a<c:
    if b>c:
        if b>d:
            answer=d-c
        else:
            answer=b-c
else:
    if d>a:
        if d>b:
            answer=b-a
        else:
            answer=d-a
print(answer)

        

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}

int main(void) {
	int n;
	read(n);
	int sg = 0;
	rep (i, n) {
		int a, k;
		read(a); read(k);
		while (a % k) {
			int down = (a / k) * k;
			int per = a / k + 1;
			int step = (a - down + per - 1) / per;
			a -= step * per;			
		}
		sg ^= a / k;
	}
	puts(sg ? "Takahashi" : "Aoki");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int k,a,b;
bool c =0;
cin>>k>>a>>b;
if(a>=1&&b>=a&&b<=1000&&k>=1&&k<=1000){
    int n =0 ;
    while(true){
        n+=k;
        if(n>=a&&n<=b)
            {c = 1;break;}
        if(n>b)
            break;
    }
    if(c==1)
        cout<<"OK"<<endl;
    else if(c==0)
        cout<<"NG"<<endl;

    }
return 0;}


Measured memory_bytes: 3616
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n,r;
    cin>>n>>r;

    if(n<10)
        cout<<r+100*(10-n);
    else
        cout<<r;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A,B,C,X,Y;
    cin>>A>>B>>C>>X>>Y;
    long long COA;
    long long COB;
    long long  COC;
    COA=A*X+B*Y;
    int MIN=min(X,Y);
    COB=MIN*C*2+A*(X-MIN)+B*(Y-MIN);
    int MAX=max(X,Y);
    COC=MAX*C*2;
    long long ans=min(COA,min(COB,COC));
    cout <<ans<<endl;
}

Measured memory_bytes: 3636
#!/usr/bin/env python
import math

chebyshev = []

n = int(input())

x = input().split()
y = input().split()

for i in range(n):
    x[i] = int(x[i])
for i in range(n):
    y[i] = int(y[i])

for p in range(3):
    total = 0
    for i in range(n):
        total += (math.fabs(x[i]-y[i]))**(p+1)
    distance = total**(1/(p+1))
    print("%.5f" % distance)

for i in range(n):
    chebyshev.append(math.fabs(x[i]-y[i]))
print("%.5f" % max(chebyshev))

Measured memory_bytes: 7784
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def solve():
    n, k = MI()
    ans = n % k

    ans = min(ans, abs(ans - k))
    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s;
	cin >> s;

	int n = s.length(), i, j, k;
	bool found = false;

	if ((n == 2) && (s[0] == s[1])) {
		found = true;
		cout << "1 2\n";
	}
	else {
		for (i = 0; i + 2 < n; i++) {
			if ((s[i] == s[i + 1]) || (s[i] == s[i + 2]) || (s[i + 1] == s[i + 2])) {
				found = true;
				cout << i + 1 << " " << i + 3 << "\n";
				break;
			}
		}
	}

	if (!found) cout << "-1 -1\n";

	return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
using namespace std;
int main(){
long long int A, B, C, D ,E ,F, N,M;
long long V[10000000] = {};
long long G[10000000] = {};
string S,Sa,Sb,Sc;
bool ans = true;
cin >> A;
B = 0;
  C = 0;
  D = 0;
for(int i = 0;i < A;i++){
	cin >> V[i];
	if(V[i] % 4 == 0)B++;
	else if(V[i] % 2 == 0)C++;
  else D++;
}
if(C % 2 == 1)D++;
if(D <= B + 1)cout << "Yes" << endl;
else cout << "No" << endl;

return 0; 
}


Measured memory_bytes: 78336
#include <iostream>
#include <string>
using namespace std;

int main(){
	string x;
	while (cin >> x){
		if (x == (string)"0") break;
		long s = 0;
		for (long i = 0; i < x.size(); i++){
			s += (char)x[i] - (long)'0';
		}
		cout << s << endl;
	}
	return 0;
}

Measured memory_bytes: 1192
N,M=map(int,input().split());D=[0]+[9**9]*(1<<N)
for i in range(M):
 a=int(input().split()[0]);s=sum(1<<~-int(c)for c in input().split())
 for j in range(1<<N):D[s|j]=min(D[s|j],D[j]+a)
print(D[-2]%(9**9)or-1)

Measured memory_bytes: 3188
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import deque
from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# a/b の切り上げ


def round_up(a, b):
    """ a/b の切り上げ """
    c = (a + b - 1) / b
    return c


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


def main():
    n, x, y = map(int, input().split())
    ans = [0] * n
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            a = min(abs(x-i)+1+abs(j-y), abs(j-i))
            ans[a] += 1
    for i in range(1, len(ans)):
        print(ans[i])


if __name__ == '__main__':
    main()


Measured memory_bytes: 46172
#include <stdio.h>
int main(){
int nedan,i,oturi=0;
while(1){
scanf("%d",&nedan);
if(nedan==0)break;
int k=1000-nedan;
for(i=0;k!=0;i++){
if(k>=500){
    oturi++;
    k-=500;}
else if(500>k&&k>=100){
    oturi++;
    k-=100;}
    else if(100>k&&k>=50){
    oturi++;
    k-=50;}

    else if(50>k&&k>=10){
    oturi++;
    k-=10;}
    else if(10>k&&k>=5){
    oturi++;
    k-=5;}
    else if(5>k&&k>=1){
    oturi++;
    k-=1;}
    }




printf("%d\n",oturi);
oturi=0;}

return 0;

}

Measured memory_bytes: 1720
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  ll n,l;
  cin>>n>>l;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  int re=-1;
  rep(i,n-1) if(a[i]+a[i+1]>=l) re=i;
  if(re<0){
    cout<<"Impossible"<<endl;
  }else{
    cout<<"Possible"<<endl;
    rep(i,re) cout<<i+1<<endl;
    rrep(i,n-1){
      cout<<i+1<<endl;
      if(i==re) break;
    }
  }
  return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
#define N 100010
vector<int> p[N];
vector<int> q[N];
int vis[N],s[N];
int Spfa(int x)
{
    int i,j,k,t,mx,mi;
    queue<int> Q;
    vis[x]=1;
    s[x]=0;
    Q.push(x);
    mx=0;
    mi=0;
    while(!Q.empty())
    {
        t=Q.front();
        Q.pop();
        k=p[t].size();
        for(i=0;i<k;i++)
        {
            j=p[t][i];
            if(vis[j]==0)
            {
                s[j]=s[t]+q[t][i];
                mx=max(mx,s[j]);
                mi=min(mi,s[j]);
                if(mx-mi>1000000000)
                    return 0;
                vis[j]=1;
                Q.push(j);
            }
            else
            if(vis[j]==1&&(s[j]!=s[t]+q[t][i]))
                    return 0;
        }
    }
    return 1;
}
int main()
{
    int n,m,x,y,z,i,j,k,flag=1;
    scanf("%d%d",&n,&m);
    for(i=1;i<=m;i++)
    {
        scanf("%d%d%d",&x,&y,&z);
        p[x].push_back(y);
        p[y].push_back(x);
        q[x].push_back(z);
        q[y].push_back(-z);
    }
    for(i=1;i<=n;i++)
    if(vis[i]==0)
    {
        j=Spfa(i);
        if(j==0)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 14208
#include <bits/stdc++.h>	
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

// random_device rd; mt19937 g(rd());    
                                        	
using namespace std;
using namespace __gnu_pbds;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}

template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
const int mod = (int)1e9 + 7;

int n;

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();
	string s;
	cin >> s;
	for(auto to : s) if(to == '7') cout <<"Yes", exit(0);
	cout << "No";
}      

Measured memory_bytes: 3584
def binary_search(arr, key)
  left = 0
  right = arr.size
  while left < right
    mid = (left + right) / 2
    return true if arr[mid] == key

    if key < arr[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  false
end


n = gets.to_s
s = gets.split.map(&:to_i)
q = gets.to_s
t = gets.split.map(&:to_i)

puts t.map{|v| binary_search(s, v)}.count{|v| v}

Measured memory_bytes: 18300
loop do
  str   = gets.chomp.chars
  stack = []
  if str == ["."] then exit end
  cont = true

  str.each do |x|
    if x == "["
      stack << "["
    elsif x == "("
      stack << "("
    elsif x == "]"
      if stack[-1] == "["
        stack.pop
      else
        cont = false
      end
    elsif x == ")"
      if stack[-1] == "("
        stack.pop
      else
        cont = false
      end
    end
  end
  puts stack.size == 0 && cont == true ? :yes : :no
end



Measured memory_bytes: 6916
import java.io.*;
public class Main{
    public static void main(String args[]) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        out.println(go(Long.parseLong(br.readLine().trim())));
        out.flush();
    }
    public static String go(long n){
        if(n==0) return "";
        --n;
        return go(n/26)+((char)('a'+(n%26)));
    }
}

Measured memory_bytes: 37056
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC063A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b,c;
            var word = Console.ReadLine().Split(' ');
            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = a + b;
            if (c>=10)
            {
                Console.WriteLine("error");
            }
            else
            {
                Console.WriteLine(c);
            }
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,m; cin>>n>>m;
	int a[n], b[n], c[m], d[m];
	for (int i=0; i<n; i++) cin>>a[i]>>b[i];
	for (int i=0; i<m; i++) cin>>c[i]>>d[i];
	for (int i=0; i<n; i++) {
		int mn=1e9, ret=-1;
		for (int j=0; j<m; j++) {
			int cur=abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(mn>cur) mn=cur, ret=j+1;
		}
		cout << ret << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
using i64 = long long;
using namespace std;

const int maxn = 100;
const int maxv = 1e3;
i64 dp[maxv * maxn + 1] = {0};
i64 w[maxn];
i64 v[maxn];

int main() {
  int n, W;
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = maxn * maxv; j >= v[i]; j--) {
      if (j != v[i] && dp[j - v[i]] == 0) 
        continue;
      i64 sol = dp[j - v[i]] + w[i];
      dp[j] = dp[j] == 0 ? sol : min(dp[j], sol);
    }
  }
  for (int i = maxn * maxv; i >= 0; i--) {
    if (dp[i] > 0 && dp[i] <= W) {
      cout << i << ' ' << '\n';
      return 0;
    }
  }
  cout << 0 << '\n';
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<string> S(N);
    vector<int> P(N);
    for (int i = 0; i < N; i++)
    {
        cin >> S[i]>>P[i];
    }

    vector<int> ans(N);
    for (int i = 0; i < N; i++)
    {
        ans[i]=i+1;
    }

    for (int i = 0; i < N; i++)
    {
        int minl=i;
        for (int l = i; l < N; l++)
        {
            if((S[l]<S[minl]) ||(S[l] == S[minl] && P[l]>P[minl])){
                minl=l;
            }
        }
        string s = S[i];
        S[i] = S[minl];
        S[minl] = s;
        int a = ans[i];
        ans[i] = ans[minl];
        ans[minl] = a;
        int p = P[i];
        P[i] = P[minl];
        P[minl] = p;
    }

    for (int i = 0; i < N; i++)
    {
        cout << ans[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;
int main(int argc, char const *argv[]) {
  int K, T;
  cin >> K >> T;
  vector<int> a(T, 0);
  int temp;
  for (int i = 0; i < T; i++) {
    cin >> temp;
    a[i] = temp;
  }

  sort(a.begin(), a.end());
  int res;
  if (T == 1) {
    res = K - 1;
  } else {
    res = max(2*a[T-1] - K - 1, 0);
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>

int main() {
  std::string s;
  std::cin >> s;

  auto is_acgt = [](char c) {
    return c == 'A' || c == 'C' || c == 'G' || c == 'T';
  };

  size_t max = 0;
  size_t length = 0;
  for (auto&& c : s) {
    length = is_acgt(c) ? length + 1 : 0;
    max = std::max(max, length);
  }
  std::cout << max << std::endl;
}

Measured memory_bytes: 256