akhauriyash/Code-Regression huggingface dataset:
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;

const int INF=0x3f3f3f3f;
const int SIZE=100005;
const double EPS=1e-6;

int dp[SIZE];
vector<int> mp[SIZE];

int dfs(int p){
	if(dp[p]) return dp[p];
	else{
		int res=0;
		for(int i=0;i<mp[p].size();i++){
			int to=mp[p][i];
			res=max(res,dfs(to));
		}
		return dp[p]=res+1;
	}
}

int main(){
	/*main function start*/
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		mp[a].push_back(b);
	}
	int ans=0;
	for(int i=0;i<n;i++){
		ans=max(ans,dfs(i)); 
	}
	printf("%d",ans-1);
	return 0;
}


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

namespace ABC137A
{
    class Program
    {
        public static void Main()
        {
            var n = Console.ReadLine()
                    .Split(' ').Select(x => int.Parse(x))
                    .ToArray();
            var m = new List<int>() { n[0]+n[1], n[0] - n[1], n[0] * n[1] };
            Console.WriteLine(m.Max());
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if((a+b)>=10)cout << "error" << endl;
  else cout << a+b<< endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

  int k, x;
  cin >> k >> x;
  for (int i = x - k + 1; i < x + k; ++i) {
    cout << i << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< vector<cat> > A_sum_pos(N, vector<cat>(N+1, 0));
	vector< vector<cat> > A_sum_neg(N, vector<cat>(N+1, 0));
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < i; j++) cin >> A_sum_pos[i][j];
		for(int j = i+1; j < N; j++) cin >> A_sum_neg[j][i];
	}
	for(int i = 0; i < N; i++) {
		for(int j = 0; j < N; j++) A_sum_neg[i][j+1] += A_sum_neg[i][j];
		for(int j = i-1; j >= 0; j--) A_sum_pos[i][j] += A_sum_pos[i][j+1];
	}
	vector< vector<cat> > sum(N, vector<cat>(N, 0));
	for(int i = 1; i < N; i++) sum[i][0] = sum[i-1][0] + A_sum_pos[i][0];
	for(int i = 0; i < N; i++) for(int j = 0; j <= i; j++) {
		cat sp = 0, sn = 0;
		for(int k = i+1; k < N; k++) {
			sp += A_sum_pos[k][j];
			sn += A_sum_neg[k][i];
			sum[k][i+1] = max(sum[k][i+1], sum[i][j] + sp + sn);
		}
	}
	cat max_sum = 0;
	for(int i = 0; i < N; i++) max_sum = max(max_sum, sum[N-1][i]);
	cat ans = -max_sum;
	for(int i = 0; i < N; i++) ans += A_sum_pos[i][0] + A_sum_neg[i][N];
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

struct BIT {
    int n;
    vector<ll> bit;

    void init(int n_) {
        n = n_;
        bit.resize(n+1);
    }

    ll sum(int i) {
        i++;
        ll s = 0;
        while (i > 0) {
            s += bit[i];
            i -= i & -i;
        }
        return s;
    }

    void add(int i, ll x) {
        i++;
        while (i <= n) {
            bit[i] += x;
            i += i & -i;
        }
    }
};

struct RangeBIT {
    BIT bit0;
    BIT bit1;

    RangeBIT(int n) {
        bit0.init(n);
        bit1.init(n);
    }

    int sum(int i) {
        return bit0.sum(i) * i + bit1.sum(i);
    }

    void add(int l, int r, int x) {
        bit0.add(l, x);
        bit0.add(r + 1, -x);
        bit1.add(l, -x * (l - 1));
        bit1.add(r + 1, x * r);
    }
};

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

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    REP(i, N) cin >> A[i];
    while (K > 0 && *min_element(ALL(A)) != N) {
        RangeBIT rb(N);
        REP(i, N) rb.add(max(0, i - A[i]), min(N - 1, i + A[i]), 1);
        REP(i, N) A[i] = rb.sum(i) - (i > 0 ? rb.sum(i - 1) : 0);
        K--;
    }
    REP(i, N) cout << A[i] << (i < N - 1 ? " " : "\n");
}

Measured memory_bytes: 7172
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238
#define fastIO(); ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(int i=a;i<b;i++)
#define f0(a,b) for(int i=a;i<b;i++)
#define fn(b,a) for(int i=b;i>a;i--)
#define dbg(x); cout<<"\n"<<#x<<": "<<x;
#define ret return
#define ub upper_bound
#define lb lower_bound
#define psb push_back
#define psf push_front
#define pof pop_front
#define pob pop_back
#define mp make_pair
#define sq(a) (a)*(a)
#define fs first
#define sc second
#define el "\n"
#define brk break
#define cont continue
#define all(a) a.begin(),a.end()
#define E9 1000000007
#define E5 100007
#define INF 1e18+7
typedef long long int lli;  //  1e-18 to 1e18
typedef vector<int> vi;
typedef multiset<int> msi;
typedef set<int> si;
typedef string str;
typedef priority_queue<int> pqi;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef vector<long long int> vll;
typedef pair<long long int,long long int> pll;
typedef vector<vector<long long int>> vvll;
typedef long double ld;
void readVec(vi &a,int n){
    a.resize(n);
    f0(0,n) cin>>a[i];
}
void writeVec(vi &a){
	for(int x:a) cout<<x<<" ";
	cout<<el;
}
//----------------------------------------
void solve(){
    int x1(1),x2(2),x3(3),x4(4),x5(5);
    cin>>x1>>x2>>x3>>x4>>x5;
    if(!x1) cout<<1<<el;
    if(!x2) cout<<2<<el;
    if(!x3) cout<<3<<el;
    if(!x4) cout<<4<<el;
    if(!x5) cout<<5<<el;
}
int main(){
    fastIO();
    int t(1);
    // cin>>t;
    while(t--) solve();
    ret 0; 
}

Measured memory_bytes: 3544
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, r;
  while (cin >> n >> r) {
    VI a(n);
    REP(i, 0, n) a[i] = i;
    REP(i, 0, r) {
      int c;
      cin >> c;
      VI b(a.begin(), a.begin() + n / 2);
      a = VI(a.begin() + n / 2, a.end());
      int apos = 0, bpos = 0;
      VI d;
      while (apos < a.size() || bpos < b.size()) {
        if (apos < a.size()) {
          int len = min((int) a.size() - apos, c);
          REP(i, 0, len) d.push_back(a[apos + i]);
          apos += len;
        }
        if (bpos < b.size()) {
          int len = min((int) b.size() - bpos, c);
          REP(i, 0, len) d.push_back(b[bpos + i]);
          bpos += len;
        }
      }
      a = d;
    }
    cout << a[n - 1] << endl;
  }
}



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

int main()
{
    int N;
    cin >> N;

    map<string, int> map;
    bool ok = true;
    rep(i,N){
        string s;
        cin >> s;
        map[s] += 1;
        if(map[s] > 1) ok = false;
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 24832
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;
typedef long long ll;

ll fact[100000 + 1];

int main()
{
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int N, M;
	cin >> N >> M;

	fact[0] = 1;
	for (int i = 1; i <= max(N, M); i++)
		fact[i] = fact[i - 1] * i % MOD;

	ll count = 0;
	if (N == M)
	{
		count = fact[N] * fact[N] * 2;
	}
	else if (abs(N - M) == 1)
	{
		count = fact[N] * fact[M];
	}
	else
	{
		count = 0;
	}

	cout << count % MOD << "\n";

	return 0;
}


Measured memory_bytes: 1024
from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))
A.sort()
accumA = [*accumulate(A)]
check = [0] * (N-1)
for i in range(N-1):
    if A[i+1] <= 2*accumA[i]:
        check[i] = 1
ans = 1
j = N-2
while check[j]:
    ans += 1
    j -= 1
    if j == -1:
        break
print(ans)

Measured memory_bytes: 20468
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#include<set>
#include <stdexcept>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
typedef long long ll;
int ceil(int a,int b){// a以上でｂの倍数の最小値を出力//
    return (a+b-1)/b*b;
}
int stoii(string s){ //stoi関数の代用//
    return atoi(s.c_str());
}
int main(void){
    string s,t,u;
    cin>>s>>t>>u;
    int a=0,b=0,c=0;
    int next=0;
    while(1){
        if(next==0){
            if(a==s.size()){
                cout<<"A"<<endl;
                return 0;
            }
            if(s[a]=='a') next=0;
            else if(s[a]=='b') next=1;
            else if(s[a]=='c') next=2;
            a++;
        }
        else if(next==1){
            if(b==t.size()){
                cout<<"B"<<endl;
                return 0;
            }
            if(t[b]=='a') next=0;
            else if(t[b]=='b') next=1;
            else if(t[b]=='c') next=2;
            b++;
        }
        else if(next==2){
            if(c==u.size()){
                cout<<"C"<<endl;
                return 0;
            }
            if(u[c]=='a') next=0;
            else if(u[c]=='b') next=1;
            else if(u[c]=='c') next=2;
            c++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define fastestiointhewest   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{  
   int a,b,c; cin>>a>>b>>c;
   int ans=2*min(b,c);
   c-=ans/2,b-=ans/2;
   ans+=b;
   ans+=min(a,c);
   c-=min(a,c);
   if(c) ans++;
   cout<<ans;   
}  
int main()
{   
    fastestiointhewest;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const double pi=3.14159265358979323846;
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b){
    if (a % b == 0){
        return(b);
    }else{
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
bool isprime(int n){
    if (n < 2) return false;
    else if (n == 2) return true;
    else if (n % 2 == 0) return false;

    for (int i = 3; i <= sqrt(n); i += 2){
        if (n % i == 0){
            return false;
        }
    }
    return true;
}
void sayYes(bool f) {
    if (f) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
void sayYES(bool f) {
    if (f) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

int main() {
  string s;
  cin >> s;
  for(int i=1;i<s.size();++i){
    if(s[i-1]==s[i]){
      cout << "NO" << endl;
      return 0;
    }
  }
  if(s.size()>9){
    cout << "NO" << endl;
    return 0;
  }
  if(s.substr(1,3)=="KAI"||s.substr(1,3)=="KIA"||s.substr(0,3)=="KAI"||s.substr(0,3)=="KIA"){
    cout << "NO" << endl;
    return 0;
  }
  s.erase(remove(s.begin(), s.end(), 'A'), s.end());
  
  if(s=="KIHBR"){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 3568
#include<iostream>
using namespace std;
int main() {
    int a[100 + 1] = {0};
    int n;
    int Max = 0;
    while (cin >> n) {
        a[n]++;
        Max = Max < n ? n : Max;
    }
    int ans[100] = {0};
    int cnt = 0;
    int id[100] = {0};
    for (int i = 1; i <= Max; i++) { //~a[Max]
        if (ans[0] < a[i]) {
            ans[0] = a[i]; id[0] = i;
            for (int j = 1; j <= cnt; j++) {
                id[j] = 0;
            }
            cnt = 0;
        } else if (ans[0] == a[i]) {
            id[++cnt] = i;
        }
    }
    for (int i = 0; i < Max; i++) {
        if (id[i] != 0) {
            cout << id[i] << endl;
        }
        else break;
    }
    
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n ;
    cin >> n ;
    vector<string> v ;
    for(int i = 0; i < n; i++){
        string s ;
        cin >> s ;
        v.push_back(s) ;
    }
    sort(v.begin(), v.end()) ;
    int total = 0 ;
    vector<pair<string,int> > vv ;
    for(int i = 0; i < n; i++){
        int L = i + 1, R = n - 1 ;
        int ans = -1 ;
        while(L <= R){
            int mid = (L + R) / 2 ;
            if ( v[mid] > v[i] ){
                ans = mid ;
                R = mid - 1 ;
            }
            else L = mid + 1 ;
        }
        if ( ans == -1 ) ans = n ;

        if ( ans - i >= total ){
            total = ans - i ;
            vv.push_back(make_pair(v[i], total)) ;
        }
    }
    int cnt = 0 ;
    for(auto p : vv){
        if ( p.second == total ){
            cout << p.first << endl;
        }
    }
    return 0 ;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    int A,B; cin >> A >> B;

    int ans = 0;

    if(A > B){ans += A; A--;}
    else {ans += B; B--;}

     if(A > B){ans += A; A--;}
    else {ans += B; B--;}

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[202020];
int rev[202020];

template<class V,int NV> class SegTree_1 {
public:
	vector<V> val;
	static V const def=303030;
	V comp(V l,V r){ return min(l,r);};
	
	SegTree_1(){val=vector<V>(NV*2,def);};
	V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i<y
		if(r<=x || y<=l) return def;
		if(x<=l && r<=y) return val[k];
		return comp(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1));
	}
	void update(int entry, V v) {
		entry += NV;
		val[entry]=v;
		while(entry>1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]);
	}
};

SegTree_1<int,1<<20> ev,od;
set<vector<int>> cand;

void add(int L,int R) {
	vector<int> ret;
	if(R<=L) return;
	
	int tar;
	if(L%2==0) tar=ev.getval(L,R);
	else tar=od.getval(L,R);
	int x=rev[tar];
	ret.push_back(tar);
	
	if((x+1)%2==0) tar=ev.getval(x+1,R);
	else tar=od.getval(x+1,R);
	int y=rev[tar];
	ret.push_back(tar);
	
	ret.push_back(L);
	ret.push_back(x);
	ret.push_back(y);
	ret.push_back(R);
	cand.insert(ret);
}

void dodo(vector<int> V) {
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	
	cin>>N;
	FOR(i,N) {
		cin>>A[i];
		if(i%2==0) {
			ev.update(i,A[i]);
			od.update(i,1<<20);
		}
		else {
			od.update(i,A[i]);
			ev.update(i,1<<20);
		}
		rev[A[i]]=i;
	}
	
	vector<int> Q;
	
	add(0,N);
	while(cand.size()) {
		vector<int> v=*cand.begin();
		cand.erase(cand.begin());
		Q.push_back(v[0]);
		Q.push_back(v[1]);
		add(v[2],v[3]);
		add(v[3]+1,v[4]);
		add(v[4]+1,v[5]);
	}
	
	
	FOR(i,N) _P("%d%c",Q[i],(i==N-1)?'\n':' ');
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 24052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
ll mod=1e9+7;
using P=pair<int,int>;
struct op{int a,b,c,d;};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;cin>>h>>w;
    vector<vector<int>> a(h,vector<int>(w));
    vector<op> ans;
    rep(i,h)rep(j,w)cin>>a[i][j];
    rep(i,h){
        if(i){
            for(int j=w-1;j>=0;j--){
                if(i==h-1 && j==0)break;
                if(j!=0 && a[i][j]%2!=0){
                    a[i][j-1]++;
                    ans.push_back({i,j,i,j-1});
                }
                else if(j==0 && a[i][j]%2!=0){
                    a[i+1][j]++;
                    ans.push_back({i,j,i+1,j});
                }
            }
        }
        else {
            for(int j=0;j<w;j++){
                if(i==h-1 && j==w-1)break;
                if(j!=w-1 && a[i][j]%2!=0){
                    a[i][j+1]++;
                    ans.push_back({i,j,i,j+1});
                }
                else if(j==w-1 && a[i][j]%2!=0){
                    a[i+1][j]++;
                    ans.push_back({i,j,i+1,j});
                }
            }
        }
    }
    cout<<ans.size()<<endl;
    for(auto p:ans) cout<<p.a+1<<' '<<p.b+1<<' '<<p.c+1<<' '<<p.d+1<<endl;
    return 0;
}


Measured memory_bytes: 5236
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <unordered_map>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <iomanip>
#include <type_traits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
constexpr long long MOD = 1e9 + 7;
constexpr long long MAX = 1000000;

//long long MOD = 998244353;
constexpr ll INF = 1e17;
constexpr double PI = 3.141592653589793;
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; }

ll h, w;
vector<ll> dx = { -1, 0, 1, 0 };
vector<ll> dy = { 0, -1, 0, 1 };


bool isInField(ll x, ll y) {
    bool f = x >= 0 && x < w && y >= 0 && y < h;
    return f;
}

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

    int h, w;
    cin >> h >> w;
    vector<vector<char>> field(h, vector<char>(w));

    vector<int> dx = { 0,1,0,-1 };
    vector<int> dy = { 1,0,-1,0 };

    for (size_t rowIndex = 0; rowIndex < h; ++rowIndex)
    {
        for (size_t columnIndex = 0; columnIndex < w; ++columnIndex)
        {
            cin >> field[rowIndex][columnIndex];
        }
    }

    int max = -1;
    for (size_t rowIndex = 0; rowIndex < h; rowIndex++)
    {
        for (size_t columnIndex = 0; columnIndex < w; columnIndex++)
        {
            if (field[rowIndex][columnIndex] == '#') {
                continue;
            }
            vector<vector<int>> distance(h, vector<int>(w, -1));
            queue<pair<int, int>> q;
            q.push(make_pair(rowIndex, columnIndex));
            distance[rowIndex][columnIndex] = 0;
            while (!q.empty()) {
                auto current = q.front();
                q.pop();
                for (size_t i = 0; i < 4; ++i)
                {
                    int ny = current.first + dy[i];
                    int nx = current.second + dx[i];
                    if (nx < 0 || w <= nx || ny < 0 || h <= ny) {
                        continue;
                    }
                    if (field[ny][nx] == '#' || distance[ny][nx] != -1) {
                        continue;
                    }
                    distance[ny][nx] = distance[current.first][current.second] + 1;
                    q.push(make_pair(ny, nx));
                }
            }

            for (auto row : distance) {
                for (auto d : row) {
                    max = max < d ? d : max;
                }
            }
        }
    }

    cout << max << "\n";
    return 0;
}



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

int main(int argc, char *argv[])
{
    int n;
    std::vector<int> a;

    std::cin >> n;
    a.resize(n);

    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }

    int count = 0;
    for (int i = 0; i < n; i++) {
        const int no = i + 1;
        if ((no % 2 == 1) && (a[i] % 2 == 1)) {
            count++;
        }
    }

    std::cout << count << std::endl;

    return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pl;
typedef vector<int>     vi;
typedef vector<ll>      vl;
typedef vector<pii>     vpii;
typedef vector<pl>      vpl;
typedef vector<vi>      vvi;
typedef vector<vl>      vvl;
int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);
const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================
string getString(char t){
  string s(1, t);
  return s;
}

bool check(string s){
  int t = stoi(s);
  if((t%8)==0)
    return true;
  else
    return false;
}

// void solve() {

// }


int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while(t--) {
        int a; cin>>a;
        int temp = a;
        temp = temp + a*a + a*a*a;
        cout<<temp<<"\n";
    }
    return 0;
}

// int mpow(int base, int exp) {
//   base %= mod;
//   int result = 1;
//   while (exp > 0) {
//     if (exp & 1) result = ((ll)result * base) % mod;
//     base = ((ll)base * base) % mod;
//     exp >>= 1;
//   }
//   return result;
// }

// void ipgraph(int n, int m){
//     int i, u, v;
//     while(m--){
//         cin>>u>>v;
//     u--, v--;
//         g[u].pb(v);
//         g[v].pb(u);
//     }
// }

// void dfs(int u, int par){
//     for(int v:g[u]){
//         if (v == par) continue;
//         dfs(v, u);
//     }
// }


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

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

using namespace std;

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

int a[110];

vector<int> even,odd;

int main(void){
	int n,m;
	cin >> n >> m;

	rep(i,m) cin >> a[i];
	sort(a,a+m);
	
	rep(i,m){
		if(a[i]&1)
			odd.push_back(a[i]);
		else
			even.push_back(a[i]);
	}

	if(int(odd.size())>=3){
		puts("Impossible");
		return 0;
	}

	
	vector<int> sa;

	if(1<=int(odd.size())) sa.push_back(odd[0]);
	for(auto &it:even) sa.push_back(it);
	if(2<=int(odd.size())) sa.push_back(odd[1]);
	

	vector<int> sb;

	if(m==1){
		sb.push_back(sa[0]-1);
		sb.push_back(1);
	}else{
		rep(i,m) sb.push_back(sa[i]);
		sb[0]--,sb[m-1]++;
	}

	auto it=begin(sb);
	while(it != end(sb)){
	    if(*it == 0)
	        it = sb.erase(it);
		else
	        it++;
	}

	rep(i,sa.size()) cout << (i?" ":"") << sa[i];
	cout << endl;

	cout << int(sb.size()) << endl;
	rep(i,sb.size()) cout << (i?" ":"") << sb[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int f(int x)
{
  int res = 0;
  while (x) {
    x /= 10;
    ++res;
  }
  return res;
}

signed main()
{
  cout << fixed << setprecision(10);
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n;
  cin >> n;

  int ans = 0;
  for (int i = 1; i <= n; ++i) if (f(i) & 1) ++ans;

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3612
#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>//cout << fixed からの cout << setprecision(n) << 小数　によって小数を整数部分含めてn桁表示できるようにする
#include <cctype>
#include <unordered_map>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  string s,t;
  cin >> s >> t;
  vector<vector<int> > dp(s.length()+1,vector<int>(t.length()+1,0));
  for(int i = 0;i < s.length();i++){
    for(int j = 0;j < t.length();j++){
      if(s[i] == t[j]) dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1);
      dp[i+1][j+1] = max(dp[i+1][j+1],dp[i+1][j]);
      dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j+1]);
    }
  }
  int i = s.length();
  int j = t.length();
  string res = "";
  while(i > 0 && j > 0){
    if(dp[i][j] == dp[i][j-1]) j--;
    else if(dp[i][j] == dp[i-1][j]) i--;
    else{
      res = s[i-1] + res;
      j--,i--;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 35584
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String w, t;
    int count = 0;

    w = sc.next();
    while (1 > 0) {
      t = sc.next();
      if (t.equalsIgnoreCase(w)) {
        count++;
      } else if (t.equals("END_OF_TEXT")) {
        break;
      }
    }

    System.out.println(count);
    sc.close();
  }
}



Measured memory_bytes: 26164
module Main where

    import Data.List
    
    import Control.Monad
    
    solve :: [Int] -> String
    solve l = show (minimum l) ++ " " ++ show (maximum l) ++ " " ++ show (sum l)
    
    readLine:: IO [Int]
    readLine = fmap (map read . words) getLine
    
    readLines :: Int -> IO [[Int]]
    readLines = flip replicateM readLine
        
    main :: IO() 
    main = do
        [n] <- readLine
        l <- readLine
        let ans = solve l
        putStrLn ans
    


Measured memory_bytes: 11184
#include<stdio.h>
#define MAX 2000000

int n,A[MAX+1];
void maxHeapify(int i){
    int l,r,largest;
    int temp;
    l = 2*i;
    r = 2*i + 1;
    if(l <= n && A[l] > A[i]){
        largest = l;
    }else{
        largest = i;
    }
    if(r <= n && A[r] > A[largest]){
        largest = r;
    }
    if(largest != i){
        temp = A[i];
        A[i] = A[largest];
        A[largest] = temp;
        maxHeapify(largest);
    }
}
int main(){
    int i;
    scanf("%d",&n);
    for(i = 1;i <= n;i++){
        scanf("%d",&A[i]);
    }
    for(i = n/2;i >= 1;i--){
        maxHeapify(i);
    }
    for(i = 1;i <= n;i++){
        printf(" %d",A[i]);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 3652
import sys
input = sys.stdin.readline

n,k,c = map(int,input().split())
s = list(input())
l1 = []
l2 = []
count = 0
pena = 0
for i in range(n):
    if s[i] == "o":
        if pena == 0:
            count += 1
            pena = c+1
            l1.append(i+1)
    if pena > 0:
        pena -= 1
    if count == k:
        break

pena = count = 0
for i in range(n-1,-1,-1):
    if s[i] == "o":
        if pena == 0:
            count += 1
            pena = c+1
            l2.append(i+1)
    if pena > 0:
        pena -= 1
    if count == k:
        break
l2.sort()

for i,j in zip(l1,l2):
    if i == j:
        print(i)



Measured memory_bytes: 22072
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,i,j;
    cin>>n>>x>>y;
    int ar[n+1][n+1];
    long long  ans[n]={0};
    for(i=1;i<n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            ar[i][j]=min(j-i,abs(x-i)+abs(y-j)+1);
            ans[ar[i][j]]+=1;
        }
    }
    for(i=1;i<n;i++)
    {
        cout<<ans[i]<<"\n";
    }
    return 0;
}


Measured memory_bytes: 15488
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
    return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
    Int g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}

struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};

vector<vector<int>> K;


int main(){
    cin.tie(0);

    int N, M;
    cin >> N >> M;
    UnionFind uf(M+N+1);
    for (int i = 0; i < N; i++){
        int K;
        cin >> K;
        for (int j = 0; j < K; j++){
            int L;
            cin >> L;
            uf.unite(M+1+i, L);
        }
    }
    for (int i = 1; i < N; i++){
        if(!uf.same(M+1+i, M+i)){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
} 


Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int A[2011][51];
int mark[2011];
void MAIN() {
    const int K = 38;
    const int N = K*(K-1)+1;
    printf("%d %d\n", N, K);
    int cnt = 1;
    REP (i, K) {
	A[0][i] = cnt;
	REP (j, K-1) A[i*(K-1)+1+j][0] = cnt;
	cnt++;
    }
    REP (c, K-1) REP (r, K-1) {
	A[1+c][1+r] = cnt;
	REP (i, K-1) {
	    A[1 + K-1 + i*(K-1) + (r+i*c)%(K-1)][1+c] = cnt;
	}
	cnt++;
    }
    REP (i, N) rprintf("%d", A[i], A[i]+K);

//    eprintf("%d %d\n", N, cnt-1);
//    REP (i, N) {
//	cnt++;
//	REP (k, K) mark[A[i][k]] = cnt;
//	REP (j, i) {
//	    int tmp = 0;
//	    REP (k, K) if (mark[A[j][k]] == cnt) tmp++;
//	    if (tmp != 1) eprintf("%d %d\n", j, i);
//	    assert(tmp == 1);
//	}
//    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 768
/*
created by sanyam singhal
*/

#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long int
#define mod 1000000007
#define w(t) int t;	cin>>t while(t--)
#define triplet pair<int,pair<int,int>>
#define vi vector<int>
#define vll vector<ll>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
#define loop(i, k, n) for(ll i=k; i<n; i+=1)
#define loop2(i, k, n) for(ll i=k; i>=n; i--)

const ll inf = 1e18;

void take_fileIO(){
  #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  return;
}

double dp[3005][3005];

double rec(vector<double> &coins, int i, int head_count, int tail_count, int n){
  if(i==n){
    if(head_count <= tail_count)
      return 0;
    else
      return 1;
  }
  else if(dp[head_count][tail_count]!=-1)
    return dp[head_count][tail_count];  

  else {
    double op1=1, op2=1;
    
    op1 = coins[i] * rec(coins, i+1, head_count+1, tail_count, n);
    op2 = (1 - coins[i]) * rec(coins, i+1, head_count, tail_count+1, n);
    // cout<<op1<<" "<<op2<<endl;
    return dp[head_count][tail_count] = op1+op2;
  }
}

void solve() {
  int n;  cin>>n;
  vector<double>coins(n+1);
  loop(i, 0, n)
    cin>>coins[i];
  
  for(int i=0; i<=n; i++){
    for(int j=0; j<=n; j++){
      dp[i][j]=-1;
    }
  }

  cout<<fixed << setprecision(10)<<rec(coins, 0, 0, 0,  n)<<endl;

  // for(int i=0; i<=n; i++){
  //   for(int j=0; j<=n; j++){
  //     cout<<dp[i][j]<<"\t";
  //   }
  //   cout<<endl;
  // }

}

int main(){

  fastIO;
  //take_fileIO();
  solve();
  return 0;
}

Measured memory_bytes: 71040
/*
 *
 *
 */

#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;

int main() {
  string in;
  cin >> in;
  stack<char> mewmew;
  REP(i, in.length()){
    switch(in[i]) {
    case 'm':
      if (mewmew.empty() && i != 0) {
        cout << "Rabbit" << endl;
        return 0;
      }
      mewmew.push('m');
      break;
    case 'e':
      if(!mewmew.empty() && mewmew.top() == 'm') {
        mewmew.pop();
        mewmew.push('e');
      }else{
        // REP(j, i){
        //   cout << in[j];
        // }
        // cout << endl;
        cout << "Rabbit" << endl;
        return 0;
      }
      break;
    case 'w':
      if(!mewmew.empty() && mewmew.top() == 'e') {
        mewmew.pop();
      }else{
        // REP(j, i){
        //   cout << in[j];
        // }
        // cout << endl;
        // cout << 'w' << endl;
        cout << "Rabbit" << endl;
        return 0;
      }
      break;
    }
  }
  cout << "Cat" << endl;
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef vector<set<int>> Graph;
vector<int> p = {0, 1, 2, 3, 4, 5, 6, 7};

int main() {
	int N,M,a,b,c=0;
	cin >> N >> M;
	Graph g(N);

	rep(i,M) {
		cin >> a >> b;
		--a, --b;
		g.at(a).insert(b);
		g.at(b).insert(a);
	}

	do {
		bool ok = 1;
		rep(i,N-1)
			if(!g.at(p.at(i)).count(p.at(i+1))) {
				ok = 0;
				break;
			}
		
		if(ok)
			++c;
	} while(next_permutation(p.begin()+1, p.begin()+N));

	cout << c << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif
#define FILE_IO freopen("input.txt","r",stdin);
#define f first
#define int long long
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
const int MAXN=1e5+1;
bool isprime[MAXN];
int v[MAXN];
void solve(){
   string s;
   cin>>s;
   vector<char> v;
   for(auto it:s)v.emplace_back(it);
   for(int i=0;i<(int)v.size();i++){
     if(i%2==0)cout<<v[i];
   }
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
    IOS;
    solve();
    #ifdef LOCAL_DEFINE
    cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
    #endif
}


Measured memory_bytes: 592
# Author: cr4zjh0bp
# Created: Mon Mar 23 19:34:20 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()
ab = nan(m)

g = [[] for _ in range(n)]
for i in range(m):
    a, b = ab[i]
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

for i in range(n):
    print(len(g[i]))

Measured memory_bytes: 3064
X,Y,A,B,C=list(map(int,input().split()))
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)
eat=[]
eat.extend(p[:X])
eat.extend(q[:Y])
eat.sort(reverse=True)
i=0
j=0
result=0
for v in eat:
  if i<C and eat[j]<r[i]:
    result+=r[i]
    i+=1
  else:
    result+=eat[j]
    j+=1
  if i+j==X+Y:
    break
print(result)

Measured memory_bytes: 105836
// Words are flowing out like endless rain into a paper cup
// They slither while they pass they slip away across the universe
// Pools of sorrow, waves of joy are drifting through my open mind
// Possessing and caressing me

#include <bits/stdc++.h>
using namespace std;

using LL = long long;

namespace _buff {

const size_t BUFF = 1 << 19;
char ibuf[BUFF], *ib = ibuf, *ie = ibuf;
char getc() {
    if (ib == ie) {
        ib = ibuf;
        ie = ibuf + fread(ibuf, 1, BUFF, stdin);
    }
    return ib == ie ? -1 : *ib++;
}

}

LL read() {
    using namespace _buff;
    LL ret = 0;
    bool pos = true;
    char c = getc();
    for (; (c < '0' || c > '9') && c != '-'; c = getc()) {
        assert(~c);
    }
    if (c == '-') {
        pos = false;
        c = getc();
    }
    for (; c >= '0' && c <= '9'; c = getc()) {
        ret = (ret << 3) + (ret << 1) + (c ^ 48);
    }
    return pos ? ret : -ret;
}

const int MOD = 1e9 + 7;

int main() {
    int n = read();

    auto qpow = [](int base, int e) {
        int ret = 1;
        for (; e; e >>= 1) {
            if (e & 1) {
                ret = (LL) ret * base % MOD;
            }
            base = (LL) base * base % MOD;
        }
        return ret;
    };

    vector<int> fac(n + 2, 1), inv(n + 2, 1), arr(n + 1), sum(n + 1), ssu(n + 1);
    for (int i = 2; i <= n + 1; ++i) {
        fac[i] = (LL) fac[i - 1] * i % MOD;
    }
    inv[n + 1] = qpow(fac[n + 1], MOD - 2);
    for (int i = n + 1; i >= 1; --i) {
        inv[i - 1] = (LL) inv[i] * i % MOD;
    }

    generate_n(&arr[1], n, read);
    for (int i = 1; i <= n; ++i) {
        sum[i] = (sum[i - 1] + arr[i]) % MOD;
        ssu[i] = (ssu[i - 1] + sum[i]) % MOD;
    }

    auto get_sum = [&](int l, int r) {
        return sum[r] - sum[l - 1];
    };
    auto get_ssu = [&](int l, int r) {
        return ssu[r] - ssu[l - 1];
    };

    int ans = 0;
    for (int len = 1; len <= n - 2; ++len) {
        ans = (ans + ((LL) get_ssu(len + 1, n - 1) - get_ssu(1, n - len - 1)) * inv[len + 2] % MOD * fac[len] * 2) % MOD;
    }
    for (int j = 1; j <= n - 1; ++j) {
        ans = (ans + (LL) get_sum(1, j) * inv[j + 1] % MOD * fac[j]) % MOD;
    }
    for (int i = 2; i <= n; ++i) {
        ans = (ans + (LL) get_sum(i, n) * inv[n - i + 2] % MOD * fac[n - i + 1]) % MOD;
    }
    ans = (LL) (ans + sum[n]) * fac[n] % MOD;
    if (ans < 0) ans += MOD;
    cout << ans;
    return 0;
}


Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>

#define loop(i, num)  for (lint i = 0; i < num; i++)
#define l  first
#define r  second
#define lint  long long

using namespace std;

lint n, ans;

int upp[100000], mid[100000], low[100000];

int main() {
    
    ios_base::sync_with_stdio(0);
    
    cin >> n;
    
    loop (i, n)  cin >> upp[i];
    
    loop (i, n)  cin >> mid[i];
    
    loop (i, n)  cin >> low[i];
    
    lint up = 0, lw = 0;
    
    sort(upp, upp + n);
    
    sort(mid, mid + n);
    
    sort(low, low + n);
    
    loop (md, n) {
        
        lint x, y;
        
        while (up < n && upp[up] < mid[md])  ++up;
        
        while (lw < n && mid[md] >= low[lw])  ++lw;
        
        x = up;
        
        y = n - lw;
        
        ans += x * y;
        
    }
    
    cout << ans << endl;
    
    return 0;
    
}


Measured memory_bytes: 1408
N,M=map(int,input().split())
L=[[] for i in range(N+1)]
A=[]
for i in range(M):
  P,Y=map(int,input().split())
  L[P].append([i,Y])
for i in range(1,N+1):
  li=sorted(L[i],key=lambda x:x[1])
  k=0
  for city in li:
    k+=1
    A.append([city[0],str(i).zfill(6)+str(k).zfill(6)])
A.sort(key=lambda x:x[0])
for item in A:
  print(item[1])

Measured memory_bytes: 48832