akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h> 
    //#define M_PI 3.14159265358979323846



using namespace std;

#define rep(i,a,b) for(int i=a;i<b;++i)
#define repb(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vl vector<long long int>
#define vc vector<char>
#define vld vector<ld>
#define vvi vector<vector<int> >
#define vvl vector<vector<long long> >
#define vvld vector<vector<ld> >
#define vpii vector<pii>
#define vpll vector<pll>
#define ld long double
#define ll long long
#define sz(a) (ll)a.size()
#define ssortA(arr)   stable_sort(arr.begin(),arr.end())
#define ssortB(arr)   stable_sort(arr.begin(),arr.end(),greater<pair<int,int> >());
#define pii pair<int,int>
#define pll pair<long long,long long>
#define ff first
#define ss second
#define search(arr,c)  binary_search(arr.begin(),arr.end(),c)
#define pb   push_back
#define pf push_front
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define endl "\n" 
#define PI acos(-1.0)
#define GCD(a,b) __gcd(a,b)
#define popcount(x) __builtin_popcountll(x)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fix(f,n) fixed<<setprecision(n)<<f<<endl
#define checkin(ds, a) (ds.find(a)!=ds.end()?1:0)
#define mem(arr)  memset(arr,0,sizeof(arr))
const int p=(int)1e9+7;
vl fac(4000,1);
vl inv(4000,1);
 long long power( long long x, 
                         int y, int p) 
{ 
     long long res = 1; // Initialize result 
  
    x = x % p; // Update x if it is more than or 
    // equal to p 
  
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
 long long modInverse( long long n) 
{ 
    return power(n, p - 2, p); 
} 
  void create(){
    rep(i,1,4000){
        fac[i]=(fac[i-1]*i)%p;
    }
    
}
// Returns nCr % p using Fermat's little 
// theorem. 
 long long comb( long long n, 
                                 int r) 
{ 
    // Base case 
    if (r == 0||n==0) 
    return 1;
    else return (fac[n] * modInverse(fac[r]) % p * modInverse(fac[n - r]) % p) % p; 

}
int main()
{

    int s;cin>>s;
    if(s<3){cout<<0<<endl;return 0;}
    create();
    int a=s/3;
    ll res=0;
    s-=(a*3);
    repb(i,a,1){
        ll x=comb(s+i-1,i-1);
        res=(res+x)%p;
        s+=3;
    }
cout<<res<<endl;

}

Measured memory_bytes: 3656
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll H,W,A[1007][1007];
  vector<pair<ll,ll>> B;
  vector<pair<pair<ll,ll>,pair<ll,ll>>> V;
  cin >> H >> W;
  rep(i,H){
    rep(j,W){
      cin >> A[i+1][j+1];
    }
  }
  ll k,T=0,P=0,Q=0;
  Rep(i,1,H+1){
    Rep(j,1,W+1){
      if(i%2==0){
        k = W - j + 1;
      }
      else{
        k = j;
      }
      if(T){
        V.pb(mp(mp(P,Q),mp(i,k)));
        P=i;Q=k;
        if(A[i][k]%2==1){
          T=0;
        }
      }
      else{
        if(A[i][k]%2==1){
          T=1;P=i;Q=k;
        }
      }
    }
  }
  cout << V.size() << endl;
  rep(i,V.size()){
    cout << V[i].fr.fr << " " << V[i].fr.sc << " " << V[i].sc.fr << " " << V[i].sc.sc << endl;
  }
}

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

typedef long long ll;
const int N = 54;

int n;
ll a[N];

int main() {
	int i; ll r, ans = 0;
	scanf("%d", &n);
	for (i = 0; i < n; ++i) scanf("%lld", a + i);
	for (; ; ) {
		i = std::max_element(a, a + n) - a;
		if (a[i] < n) break;
		ans += r = a[i] / n, a[i] -= r * (n + 1);
		for (i = 0; i < n; ++i) a[i] += r;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1160&lang=jp

int C[99][99];
int w, h;

static void dfs(int i , int j) {
    C[i][j] = 0;

    REP(k, 8) {
        int nx = j + dx8[k];
        int ny = i + dy8[k];
        if (nx >= 0 && nx < w && ny >= 0 && ny < h) {
            if (C[ny][nx] == 1) {
                dfs(ny, nx);
            }
        }
    }          
}

int main() {

    while (true) {
        cin >> w >> h;
        if (w==0&&h==0) break;

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> C[i][j];
            }
        }

        int cnt = 0;
        while(true) {
            bool found = false;
            for (int i = 0; i < h; i++) {
                for (int j = 0; j < w; j++) {
                    if (C[i][j] == 1) {
                        dfs(i, j);
                        cnt++;
                    }
                }
            }

            if (!found) break;
        }

        cout << cnt << "\n";
    }

    return 0;
}


Measured memory_bytes: 3072
N = int(input())
A = [int(input()) for _ in range(N)]
is_visited = [False for _ in range(N)]

idx = 0
count = 0
while True:
    if not is_visited[idx]:
        is_visited[idx] = True
    else:
        print(-1)
        break
    idx = A[idx] - 1
    count += 1
    if idx == 1:
        print(count)
        break


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

typedef long long ll;
typedef long double ld;
const ll N = 1e5+7;
const ll N2 = 1e2+7;

#define mkp make_pair
#define pb push_back
#define pq priority_queue
#define minpq priority_queue <int, vector<int>, greater<int> >
#define vi vector <int> 
#define vll vector <ll>
#define pii pair<int,int>

vll v(N2),v1(N2); 
ll arr[N][N2];
ll n;

ll dp_func(ll w, ll i){
	if(w==0 || i==0) arr[w][i]=0;
	else if(arr[w][i]==-1){
		if(v[i]<= w) arr[w][i] = max(dp_func(w-v[i],i-1)+v1[i],dp_func(w,i-1));
		else arr[w][i] = dp_func(w,i-1);
	}
	return arr[w][i];
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	for(int i=0;i<N;++i)
		for(int j=0;j<N2;++j)
			arr[i][j]=-1;
	ll w; cin>>n>>w;
	for(int i=1;i<=n;++i) cin>>v[i]>>v1[i];
	ll ans = dp_func(w,n);
	cout<<ans<<endl;
    return 0;
} 

Measured memory_bytes: 83840
MOD = 998244353
class ModInt:
    def __init__(self, x):
        self.x = x % MOD

    def __str__(self):
        return str(self.x)

    __repr__ = __str__

    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )

    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )

    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )

    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )

    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )

    __radd__ = __add__

    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )

    __rmul__ = __mul__

    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )

    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )

def cmb(fact, n ,r):
    return ModInt(1) * fact[n] / fact[n - r] / fact[r]

def solve(N, M, K):
    fact = [ModInt(1)]
    for i in range(1, N + 1):
        fact.append(fact[i -1] * i)

    ret = ModInt(0)
    for x in range(K + 1):
        ret += cmb(fact, N - 1, x) * M * pow(M - 1, N - x - 1, MOD)
    return ret

if __name__ == '__main__':
    N, M, K = map(int, input().split())
    print(solve(N, M, K))

Measured memory_bytes: 93752
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define MOD 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(), (VECTOR).end()

int main(){

	int N;
	cin >> N;
	bool isPrime[1000];
	for(int i = 2; i < 1000; i ++){
		isPrime[i] = true;
		for(int j = 2; j < i; j ++){
			if(i%j == 0){
				isPrime[i] =  false;
				break;
			}
		}
	}
	map<int, ll> m;
	for(int i = 2; i <= N; i ++){
		int tmp = i;
		for(int j = 2; j <= i; j ++){
			/*if(isPrime[j] && i%j == 0){
				m[j] ++;
			}*/
			while(tmp%j == 0){
				tmp /= j;
				m[j] ++;
			}
		}
	}
	ll ans = 1;
	auto itr = m.begin();
	for(auto itr = m.begin(); itr != m.end(); itr ++){
		ans *= itr->second + 1;
		//cout << "itr->first = " << itr->first << " , itr->second = " << itr->second << endl;
		ans %= MOD;
	}
	cout << ans << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

int main(){
    ll n;
    cin >> n;
    while(n > 0){
        n -= 1000;
    }
    cout << -n;
    return 0;
}

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

int main() {
    int X;
    cin >> X;
    bool is_answered = false;
    for (int i = -200; i < 201; i++) {
        if (is_answered) break;
        for (int j = -200; j < 201; j++) {
            if (pow(i, 5) - pow(j, 5) == X) {
                cout << i << " " << j << endl;
                is_answered = true;
                break;
            }
        }
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;
using str = string;

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

long int M = 1e+9+7;
int inf = 1e+9;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    int n,m;
    cin >> n >> m;
    vi a(m),b(m);
    vvi pa(n+1);
    vi kita(n+1);
    kita[1] = 1;
    rep(i,m){
        cin >> a[i] >> b[i];
        pa[a[i]].pb(b[i]);
        pa[b[i]].pb(a[i]);
    }
    //cout << pa[2][2] << endl;
    vi qu;
    qu.pb(1);
    bool flag = true;
    while(flag){
        flag = false;
        vi qut;
        int qulen = qu.size();
        rep(i,qulen){
            int palen=pa[qu[i]].size();
            //cout << palen << endl;
            rep(j,palen){
                if(kita[pa[qu[i]][j]]) continue;
                qut.pb(pa[qu[i]][j]);
                kita[pa[qu[i]][j]]=qu[i];
            }
        }
        qu=qut;


        rrep(i,n){
            if(!kita[i]){
                flag=true;
                break;
            }
        }
    }

    cout << "Yes" << endl;
    srep(i,2,n+1){
        cout << kita[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 12172
from bisect import bisect_left

N, Q = map(int, input().split())
R = [tuple(map(int, input().split())) for i in range(N)]
R.sort(key=lambda r: r[2])
q = [int(input()) for _ in range(Q)]

ans = [-1] * Q
skip = [-1] * (Q + 1)

for s, t, x in R:
    l = bisect_left(q, s - x)
    r = bisect_left(q, t - x)
    while l < r:
        if skip[l] == -1:
            skip[l] = r
            ans[l] = x
            l += 1
        else:
            l = skip[l]
for i in range(Q):
    print(ans[i])

Measured memory_bytes: 53992
#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>
#include <set>
#include <map>
#include <iomanip>
#include <cassert>
#include <functional>

using namespace std;

typedef pair<int, int> P;
#define FOR(i, a, b) for(int (i)=a;(i)<(b);++(i))
#define rep(i, n)  FOR(i,0,n)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort((v).begin(), (v).end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#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 all(c) (c).begin(),(c).end()
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define Print(p) cout<<(p)<<endl
#define _1 first
#define _2 second
#define pb push_back
#define mod 1000000007
#define INF 105000000000

const int maxn = 1e5 + 10;



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

	int n; cin >> n;
	vl a(200005);
	rep(i, n) {
		cin >> a[i];
	}
	
	for (int i = n - 1; i >= 0; i -= 2)
	{
		cout << a[i] << " ";
	}

	for (int i = n % 2; i < n; i += 2)
	{
		cout << a[i] << " ";
	}
	cout << endl;

	return 0;
	
}

Measured memory_bytes: 3712
#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n ,m;
	cin >> n >> m;
	
	vector<int> ans(n);
	
	for(int i = 0;i < m;i++){
		int a, b;
		cin >> a >> b;
		ans[a-1]++; 
		ans[b-1]++;
	}
	
	for(int i = 0;i < n;i++){
		cout << ans[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
s = raw_input()
N = len(s)
def run():
    for i in range(N):
        if (i+1 < N) and (s[i] == s[i+1]):
            return (i+1, i+2)
        elif (i+2 < N) and (s[i] == s[i+2]):
            return (i+1, i+3)
    return (-1, -1)
print "%d %d" % run()

Measured memory_bytes: 5892
#include<stdio.h>
int main()
{
    int D;
    scanf("%d",&D);

    if(D==25){

        printf("Christmas\n");

    }
    else if(D==24){

        printf("Christmas Eve\n");

    }

   else  if(D==23){

        printf("Christmas Eve Eve\n");

    }
    else if(D==22){

        printf("Christmas Eve Eve Eve\n");

    }
    return 0;



}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
int dir_x[]={0, 1};
int dir_y[]={1, 0};
int h, w;
int dp[1005][1005];
char s[1005][1005];

int func(int p, int q)
{
    if(dp[p][q]!=-1) return dp[p][q];
    if(p==h-1 && q==w-1) return 1;
    int ans=0;
    for(int i=0; i<2; i++) {
        int x=p+dir_x[i];
        int y=q+dir_y[i];
        if(x<h && y<w && s[x][y]!='#') ans+=func(x, y);
    }
    dp[p][q]=ans%1000000007;
    return dp[p][q];
}

main()
{
    fastio;
    cin>>h>>w;
    for(int i=0; i<h; i++) {
        for(int j=0; j<w; j++) {
            cin>>s[i][j];
        }
    }
    memset(dp, -1, sizeof(dp));
    cout<<func(0, 0);
}


Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
static const int NIL = -1;

void dfs(int r, int n, vector<int> G[], int con_id, int connection[]) {
    stack<int> S;
    S.push(r);
    connection[r] = con_id;

    while (!S.empty()) {
        int u = S.top();
        S.pop();

        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i];
            if (connection[v] == NIL) {
                connection[v] = con_id;
                S.push(v);
            }
        }
    }
}

int main() {
    int n, s, t, m, q;
    cin >> n >> m;
    vector<int> G[n];

    for (int i = 0; i < m; i++) {
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    int id = 1;
    int connection[n];
    for (int i = 0; i < n; i++) connection[i] = NIL;
    for (int u = 0; u < n; u++) {
        if (connection[u] == NIL) dfs(u, n, G, id++, connection);
    }

    cin >> q;

    for (int i = 0; i < q; i++) {
        cin >> s >> t;
        if (connection[s] == connection[t]) {
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }

    return 0;
}



Measured memory_bytes: 9012
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define f first
#define s second
using namespace std;
typedef pair<int,int>P;
int main(){
  string st;
  vector<P>v;
  int n,x,y;
  while(cin>>n,n){
    v.clear();
    while(n--){
      cin>>st;
      if(st=="W"){
        cin>>x>>y;
        r(i,v.size()+1){
          if(i==v.size()){
            v.push_back(P(x,y));
            break;
          }
          else if(v[i].f==-1){
            if(v[i].s-y<0)v[i].f=x,y-=v[i].s;
            else{
              v[i].s-=y;
              v.insert(v.begin()+i,P(x,y));
              goto L;
            }
          }
        }
      }
      else if(st=="D"){
        cin>>x;
        r(i,v.size())if(v[i].f==x)v[i].f=-1;
      }
      else{
        int p=0,fl=0;
        cin>>x;x++;
        r(i,v.size()){
          if(p<=x&&x<=p+v[i].s){
            cout<<v[i].f<<endl;
            fl++;
            break;
          }
          p+=v[i].s;
        }
        if(!fl)cout<<-1<<endl;
      }L:;
    }
    cout<<endl;
  }
}

Measured memory_bytes: 3108
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t A, B, V, W, T;
  cin >> A >> V >> B >> W >> T;
  if (V <= W) {
    cout << "NO" << endl;
    return 0;
  }
  int64_t diffV = V - W;
  int64_t diffD = abs(A - B);
  if (diffD <= diffV * T) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


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

template<typename T, typename U>
using pv=vector<pair<T,U>>;
template<typename T>
using matrix=vector<vector<T>>;
template<typename T>
using pque=priority_queue<T>;
template<typename T>
using lpque=priority_queue<T,vector<T>,greater<T>>;

using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using ilpair=pair<int,ll>;
using lipair=pair<ll,int>;
using intvec=vector<int>;
using llvec=vector<ll>;
using intq=queue<int>;
using llq=queue<ll>;
using intmat=vector<intvec>;
using llmat=vector<llvec>;

#define PI 3.141592653589793
#define INTINF ((1<<30)-1)
#define LLINF 1LL<<60
#define MPRIME 1000000007
#define MPRIME9 998244353
#define MMPRIME (1ll<<61)-1

#define len length()
#define pushb push_back
#define fi first
#define se second

#define setpr fixed<<setprecision(15)
#define all(name) name.begin(),name.end()
#define rall(name) name.rbegin(),name.rend()
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

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

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

template<class T>
inline void init(T& v) {
	for(auto &a: v) cin>>a;
}
template<class T, class U>
inline void init(vector<pair<T,U>>& v) {
	for(auto &a: v) cin>>a.first>>a.second;
}
template<class T, class N>
inline void init(T& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a;
}
template<class T, class U, class N>
inline void init(vector<pair<T,U>>& v, N n) {
	v.resize(n);
	for(auto &a: v) cin>>a.first>>a.second;
}

inline void out() {
	cout<<endl;
}
template<class T, class... U>
inline void out(T a, U... alist) {
	cout<<a<<" ";
	out(forward<U>(alist)...);
}

template<class N>
void resiz(N n) {
	//empty
}
template<class N, class T, class... U>
void resiz(N n, T&& hd, U&&... tl) {
	hd.resize(n);
	resiz(n,forward<U>(tl)...);
}

bool isout(int h, int w, int H, int W) {
	return ( h<0 || h>=H || w<0 || w>=W );
}

ll binpow(ll a, ll ex, ll p) {
	ll result=1;
	while(ex>0) {
		if(ex&1) result=result*a%p;
		ex>>=1;
		a=a*a%p;
	}
	return result;
}


int N,K;
intvec A;

void input() {
	cin>>N>>K;
	init(A,N);
}

void solve() {
	for(int i=K; i<N; i++) {
		if(A[i]>A[i-K]) cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

int main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(15);
	int t=1;
	while(t) {
		input();
		solve();
		t--;
	}
}


Measured memory_bytes: 3996
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;


namespace Otoshidama
{
    class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                var ny = GetArrayIntInput();
                for (int i = 0; i <= ny[0]; i++) // 10000
                {
                    for (int j = 0; j + i <= ny[0]; j++) // 5000
                    {
                        int thousandNum = ny[0] - i - j;
                        if (ny[1] == i * 10000 + j * 5000 + thousandNum * 1000)
                        {
                            CWrite($"{i} {j} {thousandNum}");
                            return;
                        }
                    }
                }
                CWrite("-1 -1 -1");
            }
        }

        static string[] GetArrayCharInput() => Console.ReadLine().Split();
        static int[] GetArrayIntInput() => Console.ReadLine().StringToIntArray();
        static int GetIntInput() => Console.ReadLine().ToInt();
        static void CWrite(string str) => Console.WriteLine(str);

    }



    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static int[] StringToIntArray(this string str) =>
            str.Split().Select(int.Parse).ToArray();
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define enld endl

int main() {
	lint X;
	cin >> X;
	cout << 10 - X / 100 / 2 << endl;
}

Measured memory_bytes: 3680
//long time no ac
#include <bits/stdc++.h>
using namespace std;

#define 	ll				long long int
#define 	vll				vector<ll>
#define 	vi				vector<int>
#define		rep(i,n) 		for(i=0;i<n;i++)
#define		repe(i,I1,I2) 	for(i=I1;i<I2;i++)
#define		pb  			push_back
#define		mp  			make_pair
#define		endl			'\n'
#define 	mod				1000000007


ll cd(ll n)
{ 
    ll count = 0; 
    while (n != 0) { 
        n = n / 10; 
        ++count; 
    } 
    return count; 
} 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n,k,t,c=0,i,m,x,y;
	t=1;
	//cin>>t;
	
	while(t--)
	{
		cin>>n>>m;
		vector<pair<ll,pair<ll,ll> > > h(m);
		pair<ll,ll> a[m];
		rep(i,m)
		{
			cin>>x>>y;
			a[i].first=x;
			a[i].second=y;
			h[i].first=x;
			h[i].second.first=y;
			h[i].second.second=i;

		}
		sort(h.begin(), h.end());
		ll prev=h[0].first;
		rep(i,m)
		{
			if(h[i].first==prev)
			{
				c++;
			}
			else
			{
				prev=h[i].first;
				c=1;
			}
			a[h[i].second.second].second=c;
		}
		rep(i,m)
		{
			x=cd(a[i].first);
			//cout<<x<<"#\n";
			while(x<6)
			{
				x++;
				cout<<"0";
			}
			cout<<a[i].first;
			x=cd(a[i].second);

			//cout<<x<<"#\n";
			while(x<6)
			{
				x++;
				cout<<"0";
			}
			cout<<a[i].second<<"\n";

		}
		if(t!=0)
	   		cout<<"\n";
	}
	return 0;
}

Measured memory_bytes: 5376
x,y= map(int, input().split())
a = list(map(int, input().split()))
#print(a)
b=[]
for _ in range(y):
    b.append(list(map(int, input().split())))
b.sort(key = lambda x: x[1],reverse=True) 
for l in b:
    if(len(a)<=x*2):
        a.extend([l[1]]*l[0])
#print(len(a))        
#print(a)
a.sort(reverse=True)
print(sum(a[:x]))


Measured memory_bytes: 34896
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define MAX 2000000
#define INFTY (1<<30)
using namespace std;

int H, A[MAX + 1];

inline int parent(int i) { return i / 2; }
inline int right(int i) { return 2 * i + 1; }
inline int left(int i) { return 2 * i; }

void maxHeapify(int i) {
	int l = left(i);
	int r = right(i);
	int largest;
	if (l <= H && A[l] > A[i])  largest = l;
	else  largest = i;
	if (r <= H && A[r] > A[largest])  largest = r;

	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

int extract() {
	if (H < 1) return -1;
	int max = A[1];
	A[1] = A[H];
	H--;
	maxHeapify(1);
	return max;
}

void increaseKey(int i, int key) {
	if (A[i] > key) return;
	A[i] = key;
	while (i > 1 && A[parent(i)] < A[i]) {
		swap(A[parent(i)], A[i]);
		i = parent(i);
	}
}

void insert(int key) {
	H++;
	A[H] = -INFTY;
	increaseKey(H, key);
}

int main() {
	string input;
	string cmd;
	int key;
	stringstream ss;
	while (getline(cin,input) && input!="end") {
		ss << input;
		ss >> cmd;
		if (cmd == "insert") {
			ss >> key;
			insert(key);
		}
		else if (cmd == "extract") {
			cout << extract() << endl;
		}
		else if (cmd == "end") {
			break;
		}
		ss.clear(stringstream::goodbit);
	}
}

Measured memory_bytes: 39608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define drep(n,m) for(int i=0;i<n;i++)for(int j=0;j<m;j++)
#define Sort(x) sort((x).begin(),(x).end())
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000009
#define pb push_back
#define mp make_pair
typedef long long ll;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

ll gcd(ll a,ll b){
    if(a<b){
        int t=a;a=b;b=t;
    }
    int c=a%b;
    while(c!=0){
        a=b;
        b=c;
        c=a%b;
    }
    return b;
}

ll lcm(ll a,ll b){
    return a*b/gcd(a,b);
}

bool isPrime(int x){
    if(x==1)return false;
    if(x==2)return true;
    if(x%2==0)return false;
    for(int i=3;i<=sqrt(x);i+=2){
        if(x%i==0)return false;
    }
    return true;
}

int kaizyo(int x){
    if(x==1)return x;
    else return x*kaizyo(x-1);
}


int main() {
    int a,b,c;
    char x;
    int ans1=0,ans2=0;
    while(cin>>a>>x>>b>>x>>c){
        if(a*a+b*b==c*c)ans1++;
        else {
            if(a==b)ans2++;
               
        }
    }
  cout<<ans1<<endl<<ans2<<endl;
    return 0;
}



Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int abs(int a){return a>0?a:-a;}
int main(){
	char s;
	int N,w=0,r=0,ans,white,red;
	int count[200000]={0};
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>s;
		count[i]=s=='W';
		w+=count[i];
		r+=!count[i];
		if(i>0)count[i]+=count[i-1];
	}
	ans=min(w,r);
	for(int i=1;i<N;i++){//白がi個
		white=count[N-1]-count[N-1-i];
		if(w>=i)ans=min(ans,(i-white)+(w-i));
		else ans=min(ans,i-white);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main() {
    // Input
    int N;
    vector<int> X;

    cin >> N;
    X = vector<int>(N);
    for (int i = 0; i < N; i++) cin >> X[i];

    // Process
    vector<int> person_num = vector<int>(100, 0);
    for (int x : X) person_num[x - 1]++;

    int ans;
    for (int p = 1; p <= 100; p++){
        int sum = 0;
        for (int x = 1; x <= 100; x++){
            sum += pow(x - p, 2) * person_num[x - 1];
        }
        if (p == 1 || sum < ans) ans = sum;
    }

    // Output
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{
    static int[][] costs = new int[105][105];
    static int[] matrix = new int[105];
    static int length;

    public static void main(String[] args){
	Scanner read = new Scanner(System.in);
	int j=0;

	//make matrix
	length = read.nextInt();
	for(int i=0; i<length; i++){
	    matrix[i] = read.nextInt();
	    j=read.nextInt();
	}
	matrix[length]=j;

	/*for(int i=0; i<=length; i++)System.out.print(" "+matrix[i]);
	  System.out.println();*/
	matrixChainOrder();
	//print
	/*
	for(int i=0; i<=length; i++){
	    for(int k=0; k<=length; k++){
		System.out.print(costs[i][k]+" ");
	    }
	    System.out.println();
	}
	*/
	System.out.println(costs[1][length]);

    }

    static void matrixChainOrder(){
	int n = length;
	int j;
	int q;

	for(int i=1; i<=n; i++)costs[i][i]=0;

	for(int l=2; l<=n; l++){
	    for(int i=1; i<=n-l+1; i++){
		j=i+l-1;
		costs[i][j] = Integer.MAX_VALUE;
		
		for(int k=i; k<=j-1; k++){
		    q=costs[i][k]+costs[k+1][j]+matrix[i-1]*matrix[k]*matrix[j];
		    //System.out.println("aaaaa "+q);
		    costs[i][j] = Math.min(costs[i][j], q);
		}
		
	    }
	}
    }
}

Measured memory_bytes: 12000
# coding: utf-8
N = int(input())
l = [0]
def dfs(v, N):
    if int(v)<= N:
        flag = True
        if v.count("3") <= 0:
            flag = False
        if v.count("5") <= 0:
            flag = False
        if v.count("7") <= 0:
            flag = False
        if flag:
            l[0] += 1
    else:
        return
    dfs(v + "7", N)
    dfs(v + "5", N)
    dfs(v + "3", N)
dfs("0", N)
print(l[0])



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

int main(){
    int N,K;
    cin >> N >> K;
    vector<int> v(N);
    for(int i=0;i<N;i++){
        int x; cin >> x;
        v[i]=x;
    }
    long long ans=0;
    for(int l=0;l<=K;l++){
        for(int r=0;r<=K-l;r++){
            if(l+r>N) continue;
            int d=K-l-r;
            vector<int> t(N);
            long long tmp=0;
            for(int i=0;i<l;i++){
                tmp+=v[i];
                t.push_back(v[i]);
            }
            for(int i=N-r;i<N;i++){
                tmp+=v[i];
                t.push_back(v[i]);
            }
            sort(t.begin(),t.end());
            for(int i=0;i<d;i++){
                if(i>=t.size()) break;
                if(t[i]>0) break;
                tmp-=t[i];
            }
            ans=max(tmp,ans);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    S=input()
    tmp=(S[0]=="A")
    f=0
    a=""
    for i in range(1,len(S)):
        if S[i]=="C":
            if i>=2 and i<len(S)-1:
                f=1
                tmp+=1
            else:break
        else:a+=S[i]        
    tmp+=(a.islower())
    print(["WA","AC"][tmp==3])
    
    #print()
#%%submit!
resolve()

Measured memory_bytes: 38256
#include<stdio.h>
int main(){
int num,tnum,dgt=1,cnt,rem;
scanf("%d",&num);
cnt=0;
tnum=num;
while(tnum>0){
    rem=tnum%10;
    if(rem==dgt)
        cnt++;
    tnum=tnum/10;
}
printf("%d",cnt);
return 0;
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	h := nextInt()
	a := nextInt()
	var ans int
	for true {
		h = h - a
		ans++
		if h <= 0 {
			break
		}
	}
	fmt.Println(ans)
}


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

int main() {
  int n,t,a;
  cin >> n >> t >> a;
  int h[n];
  int ans;
  rep(i,n) cin >> h[i];
  double x;
  double min=INF;
  rep(i,n) {
    x = abs(a-t+h[i]*0.006);
    if(min>x) {
      min = x;
      ans = i+1;
    }
  }
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

int main(){

    ll N;
    cin >> N;
    V v(N);
    rep(i, N)cin >> v[i];
    ll l = 2, h = 2;
    rrep(i, N){
        ll l2 = (l / v[i] + (l % v[i] > 0)) * v[i];
        ll h2 = (h / v[i]) * v[i] + (v[i] - 1);
        if(l2 > h2){
            cout << -1 << endl;
            return 0;
        }
        l = l2;
        h = h2;
    }
    cout << l << " " << h << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

template <typename T>
T gcd(T a, T b) {
    if(a < b) swap(a, b);
    return (b == 0)? a : gcd(b, a % b);
}

int gcd_vec(vector<int>& v) {
    int ret = 0;
    for(int x : v) ret = gcd(ret, x);
    return ret;
}

int main() {
    int n, x, a = 0;
    vector<int> v;

    cin >> n ;
    rep(i, n + 1) { cin >> a; v.push_back(a); }

    sort(v.begin(), v.end());
    rep(i, n) v[i] = v[i+1] - v[i];
    v.pop_back();

    cout << gcd_vec(v) << endl;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
 
const int maxn = 5e2 + 20;

int a[maxn] , t[maxn] , res[maxn * maxn];

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

	int n;
	cin >> n;

	for(int i = 1; i <= n; i++)
		cin >> a[i] , t[i] = i;

	set<pair<int , int> > st , last;
	for(int i = 1; i <= n; i++)
	{
		if(i > 1)
			st.insert({a[i] , i});
		else
			last.insert({a[i] , i});
	}

	vector<int> garbage;
	for(int i = 1; i <= n * n; i++)
	{
		if(!last.empty() && (last.begin() -> first) == i)
		{
			res[i] = last.begin() -> second;
			last.erase(last.begin());

			for(int _ = 0; _ < n - res[i]; _++)
				garbage.pb(res[i]);
		}
		else if(!st.empty())
		{
			int x = st.begin() -> second;
			st.erase(st.begin());
			res[i] = x;

			if(a[x] <= i)
				return cout << "No" << endl , 0;

			t[x]--;
			if(t[x] > 1)
				st.insert({a[x] , x});
			else
				last.insert({a[x] , x});
		}
		else if(!garbage.empty())
		{
			res[i] = garbage.back();
			garbage.pop_back();
		}
		else
			return cout << "No" << endl , 0;
	}

	cout << "Yes" << endl;
	for(int i = 1; i <= n * n; i++)
		cout << res[i] << " ";
	cout << endl;
}


















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


typedef long long int ll;

vector<ll> adj[1000001]; 


#define mod 1000000007
#define pb push_back
#define endl cout<<"\n";
#define prt1(a) cout<<a<<" "
#define prt2(a,b) cout<<a<<" "<<b<<" "
#define prt3(a,b,c) cout<<a<<" "<<b<<" "<<c<<" "
#define rep(i,st,end) for( i=st;i<end;i++)
#define repv(i,st,end) for( i=st;i>=end;i--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define TEST cin>>tc;while(tc--)

int main()
{
    ll n;
    cin>>n;
    ll a =(n*(n+1))/2;
    ll q=n/3;
    ll b= 3 *( (q*(q+1))/2);
    q=n/5;
    ll c=5 *( (q*(q+1))/2);
    q=n/15;
    ll d=15*( (q*(q+1))/2);;

    ll ans= a -b - c + d;
    cout<<ans;
}

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

int main() {
  int K, X;
  cin >> K >> X;

  for (int i = 1; i < K; i++){
      cout << X-(K-i) << " ";
  }
  for (int i = 0; i < K; i++){
      if(i != 0) cout << " ";
      cout << X+i;
  }
  cout << endl;
}

Measured memory_bytes: 256
n = int(input())
d = sorted(list(map(int,input().split())))
#print(d)
cnt = 0
import bisect
for k in range(1,d[n-1]+1):
    if bisect.bisect_left(d,k) == n//2:
        cnt += 1
        #print(bisect.bisect_left(d,k))
        #print(k)
print(cnt)

Measured memory_bytes: 20652
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_output(v) for(auto it=v.begin();it!=v.end();it++){if(it!=v.begin())cout<<" ";cout<<*it;}cout<<endl;
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int series_sum(long long int);

int main(){
    ll n,x,ans;
    cin>>n>>x;
    vector<int> vec(n);
    rep(i,n){
        cin>>vec[i];
        if(i==0) ans=abs(vec[i]-x);
        else ans=__gcd(ans,abs(vec[i]-x));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S,T;
  cin >> S >> T;
  int offsetMAX = S.size() - T.size();
  vector<int> num(offsetMAX + 1,0);

  
  for(int i=0;i<=offsetMAX;i++){
    int tmp=0;
    for(int j=0;j<T.size();j++){
      if(S[i + j] == T[j]) tmp++;
    }
    num[i] = T.size() - tmp;
  }

  int repnum=T.size();
  
  for(int i=0;i<=offsetMAX;i++){
    if(num[i] < repnum) repnum = num[i];
  }

  cout << repnum << endl;
}


Measured memory_bytes: 3540
#include <iostream>

void swap(int &x, int &y)
{
  int t = x;
  x = y;
  y = t;
}
void sort(int &a, int &b)
{
  if (a>b) swap(a, b);
}
int main()
{
  int a, b, c;

  std::cin >> a >> b >> c;

  sort(b, c);
  sort(a, b);
  sort(b, c);

  std::cout << (c-b)+(b-a) << '\n';

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,m;
int w;
int v;
long long  dp[100001];
int main(){
    ios::sync_with_stdio(0);cin.tie(0);
    cin>>n>>m;
    for(int i = 1;i<=n;i++){
        cin>>w>>v;
        for(int j=m;j>=w;j--)
            if (dp[j] < dp[j-w] + v) dp[j] = dp[j-w] + v;
    }
    cout<<dp[m];
}



Measured memory_bytes: 4416
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<cstring>
#include<map>
#include<vector>
#include<set>
#define rep(i,j,k) for(register int i = j; i <= k; i++) 
#define dow(i,j,k) for(register int i = j; i >= k; i--)
#define fi first
#define se second
//#define P pair<ull,ull>
//#define PP pair<int,pair<int,int> >
//#define mp(a,b) make_pair(a,b)
#define ll long long
#define ull unsigned long long
using namespace std;
 
inline int read() { 
	int s = 0, t = 1; char c = getchar();
	while( !isdigit(c) ) { if( c == '-' ) t = -1; c = getchar(); }
	while( isdigit(c) ) s = s * 10 + c - 48, c = getchar();
	return s * t;
}

const int N = 1005, M = 5e3+5, inf = 1e9+7;
inline void Min(int &x,int v) { if( x > v ) x = v; }
struct edge{ int to, nxt; } e[N];
int head[N], f[2][M], g[N], w[N], cnt = 0;
inline void add(int x,int y) { 
	e[++cnt].to = y, e[cnt].nxt = head[x], head[x] = cnt;
}
inline void out() { puts("IMPOSSIBLE"), exit(0); }
#define ez(i,j) for(register int i = head[j]; i; i=e[i].nxt)
#define to e[i].to 
inline void dfs(int x,int fa=0) {
	ez(i,x) if( to != fa ) dfs(to,x);
	int now = 0, pre = 1;
	rep(i,0,w[x]) f[now][i] = inf;
	f[now][0] = 0;
	ez(i,x) if( to != fa ) { 
		swap(now,pre);
		rep(i,0,w[x]) f[now][i] = inf;
		dow(j,w[x],0) { 
			if( f[pre][j] == inf ) continue; 
			if( j + g[to] <= w[x] ) Min(f[now][j+g[to]],f[pre][j]+w[to]);
			if( j + w[to] <= w[x] ) Min(f[now][j+w[to]],f[pre][j]+g[to]);
		}
	}
	int ans = inf;
	rep(i,0,w[x]) Min(ans,f[now][i]);
	if( ans == inf ) out();
	g[x] = ans;
}

int main() {
	int n = read();
	rep(i,2,n) add(read(),i);
	rep(i,1,n) w[i] = read();
	dfs(1);
	puts("POSSIBLE");
	return 0; 
}

Measured memory_bytes: 384
def solve2 ns
  a, b, c, d, e, f = ns
  det = a * e - b * d
  x = (c * e / det) - (b * f / det)
  y = (a * f / det) - (c * d / det)
=begin
  x = (c * e - b * f) / det
  y = (a * f - c * d) / det
=end
  [x, y]
end

while ln = gets
  ns = ln.split.map(&:to_f)
  puts "%.3f %.3f" % solve2(ns)
end


Measured memory_bytes: 6132