akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 234567;
int A[MAXN];
bool take[MAXN];

int main() {
    int N;
    scanf("%d", &N);
    for (int i = 1; i <= N; i++)
        scanf("%d", &A[i]);
    int tg = 1;
    for (int cur = 1; cur <= N; cur++) {
        if (A[cur] == tg) {
           take[cur] = 1;
           tg++;
        }
    }
    int ans = 0;
    for (int i = 1; i <= N; i++)
        if (!take[i]) ans++;
    if (ans == N) ans = -1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1280
#include<iostream>
using namespace std;
int main(){
int a[3],f=0,s=0;
  for(int i=0;i<3;i++){
  cin>>a[i];
  }
  for(int i=0;i<3;i++){
  
   if(a[i]==5)
     f++;
    else if(a[i]==7)
      s++;
    }
  
  if(f==2 && s==1)
    cout<<"YES";
  else
    cout<<"NO";
  
  
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int main(){
  int a;
  string s;
  cin>>a>>s;

  if(a>=3200) cout<<s;
  else cout<<"red";

}

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

int main() {
  int N, d[110];
  cin >> N;
  for (int i=0; i<N; i++) cin >> d[i];
  
  int count=0;
  bool t=true;
  for (int i=0; i<N-1; i++){
  	for (int j=i+1; j<N; j++){
    	if (d[i]==d[j]) t=false;
    }
    if (t==false){
      t=true;	
      continue;
    }
    else count++;
  }
  
  cout << count+1 <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define STACK_SIZE 199
#define MAX_LEN 398

int stack[STACK_SIZE];
int stack_size = 0;

int pop(void);
void push(int a);
int jud_digit(char *s);
int get_number(char *s);
int calc(char *s);

int main()
{
  char s[MAX_LEN];
  int i;
  scanf("%[^\n]*s", s);
  printf("%d\n",calc(s));
}

int pop()
{
  if (stack_size <= 0) return 0;
  return stack[--stack_size];
}

void push(int a)
{
  stack[stack_size++] = a;
}

int jud_digit(char *s)
{
  if (*s >= '0' && *s <= '9') return 1;
  return 0;
}

int get_number(char *s)
{
  int n = 0;
  while (*s >= '0' && *s <= '9') {
    n = n * 10 + (*s - '0');
    s++;
  }
  return n;
}

int calc(char *s)
{
  int a, b, n;
	
  // 終端まで繰り返す
  while (*s) {
		
    // 数値なら取り出してスタックに積む
    if (jud_digit(s)) {
      n = get_number(s);
      push(n);
      while (*s == '-' || *s == '+') {
	s++;
      }
      while (n) {
	n /= 10;
	s++;
      }
    } else {
      switch (*s) {
      case '+':
	a = pop();
	b = pop();
	push(b+a);
	break;
      case '-':
	a = pop();
	b = pop();
	push(b-a);
	break;
      case '*':
	a = pop();
	b = pop();
	push(b*a);
	break;
      }
      s++;
    }
  }
  return pop();
}



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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/01/27  Problem: nikkei_2019_qual B / Link: __CONTEST_URL__  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	LL N; cin >> N;
	string a, b, c; cin >> a >> b >> c;
	FOR(i, 0, N) {
		set<char>s;
		s.insert(a[i]);
		s.insert(b[i]);
		s.insert(c[i]);
		if (SZ(s) == 3)ans += 2;
		else if (SZ(s) == 2)ans += 1;

	}
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
public class ABC134D {
    public static void Main() {
        int N, M = 0, sum = 0;
        string ans = "";
        List<int> a = new List<int>(), b = new List<int>();
        N = int.Parse(Console.ReadLine());
        string[] str = Console.ReadLine().Split(' ');
        for (int i = 0; i < N; i++) {
            a.Add(int.Parse(str[i]));
            b.Add(0);
        }
        for (int i = N - 1; i >= 0; i--) {
            sum = 0;
            for (int j = N / (i + 1); j > 1; j--) {
                sum += b[j * (i + 1) - 1];
            }
            sum %= 2;
            if (sum == a[i]) b[i] = 0;
            else {
                b[i] = 1;
                M++;
            }
        }
        Console.WriteLine(M);
        for (int i = 0; i < N; i++) {
            if (b[i] == 1) {
                Console.Write((i + 1).ToString() + " ");
            }
        }
    }
}


Measured memory_bytes: 29268
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,y;
	while(1){
		cin >> x >> y;
		if(x==0 && y==0)break;
		if(x>y) swap(x,y);
		cout << x << " " << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <iostream>
#include <queue>

using namespace std;

#define MAX_H 1000
#define MAX_W 1000

typedef pair<int, int> point;

char A[MAX_H][MAX_W];
bool visited[MAX_H][MAX_W];
pair<int, int> dirs[4] = {make_pair( 0, 1 ), make_pair( 0, -1 ),
                          make_pair( 1, 0 ), make_pair( -1, 0 )};

int main( int argc, char **argv )
{
    int H, W;
    cin >> H >> W;

    auto q = priority_queue<pair<int, point>>();

    for ( int h = 0; h < H; h++ )
    {
        cin >> A[h];
        for ( int w = 0; w < W; w++ )
            if ( A[h][w] == '#' ) q.push( make_pair( 0, make_pair( h, w ) ) );
    }

    int ans = 0;
    int count = 0;
    while ( count < H * W )
    {
        auto e = q.top();
        q.pop();

        int c = e.first, h = e.second.first, w = e.second.second;
        // cout << "(" << h << ", " << w << ") " << c << endl;
        if ( visited[h][w] ) continue;

        ans = c;
        visited[h][w] = true;
        count++;

        for ( auto d : dirs )
        {
            int dh = d.first, dw = d.second;
            int nh = h + dh, nw = w + dw;

            if ( nh < 0 or H <= nh ) continue;
            if ( nw < 0 or W <= nw ) continue;
            if ( visited[nh][nw] ) continue;

            q.push( make_pair( c - 1, make_pair( nh, nw ) ) );
        }
    }

    cout << -ans << endl;

    return 0;
}


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

int main() {
//   7 4 2
//   3
    int a,b,c,k;
    cin>>a>>b>>c;
    cin>>k;
    string ans="No";
    int cnt=0;
    rep(i,k+1){
        if(a>=b){
            b*=2;
            cnt++;
        }
    }
    rep(i,k+1){
        if(b>=c){
            c*=2;
            cnt++;
        }
    }
    if(cnt<=k){
            ans="Yes";
            cout<<ans<<endl;
        }
    else{
            cout<<ans<<endl;
        }
        
    return 0;
    }

Measured memory_bytes: 3608
num = int(input())
nums = input().split()
nums = [int(x) for x in nums]
nums = sorted(nums)
count = 0

for i in range(len(nums)-2):
  num1 = nums[i]

  for j in range(len(nums)-2-i):
    num2 = nums[j+i+1]

    for k in range(len(nums)-2-i-j):
      num3 = nums[k+j+i+2]
      
      if (num1 + num2) > num3 and num1 < num2 and num2 < num3:
        count += 1
        
      #print('1: {}, 2: {}, 3: {}'.format(num1,num2,num3))

print(count)
        
        
        

Measured memory_bytes: 9160
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    for(char c='a';c<='z';c++){
        if(count(ALL(s),c)==0){
            cout<<c<<endl;
            return 0;
        }
    }
    cout<<"None"<<endl;
}


Measured memory_bytes: 512
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long N;cin >> N;
    long long sum = 0;
    int maxi = 0;
    for(int i = 1;i<=N+10;i++){
        sum += i;
        if(sum > N) {
            maxi = i;
            break;
        }
    }
    long long except = sum-N;
    for(int i = 1;i<=maxi;i++){
        if(i == except) continue;
        cout << i << endl;
    }
}


Measured memory_bytes: 256
#!/user/bin/python
# coding: UTF-8

N = int(input())
A = input().split()
l = len(A)
n = 0

for i in range(l):
    A[i] = int(A[i])

def check(list):
    leng = len(list)
    for j in range(leng):
        if list[j] % 2 == 1:
            return 1
    return 0

while check(A) == 0:
    for s in range(l):
        A[s] = A[s] / 2
    n += 1

print(n)

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

int main(){
	int n ,k; cin>>n>>k;
    if( n <= 1 ){
    	cout << "0" << endl;
        return 0;
    }
  	vector<int > a(n),dp(n,INT_MAX);
  	for(int i=0;i<n;i++)
      cin>> a[i];
    dp[0] = 0;dp[1] = abs(a[1]-a[0]);
    for(int i=2;i<n;i++){
        for( int j=1;j<=k;j++ ){
            if( i-j >= 0 )
    	        dp[i] = min( dp[i-j]+abs(a[i]-a[i-j]) , dp[i] );
        }
    
    }
    cout << dp[n-1] << endl;
    
    return 0;
	
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

ll N, K, T, W, H, M, C;

const int MAX = 510000;
const int MOD = 1e9;

const double PI=3.14159265358979323846;

/*
long long fac[MAX], finv[MAX], inv[MAX];

vector<double> cx, cy, c;
 ll MM = 1e12;

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

std::vector<int> Eratosthenes(int n ){
    std::vector<bool> is_prime( n + 1 );
    for( int i = 0; i <= n; i++ ) is_prime[ i ] = true;
    std::vector<int> P;
    for( int i = 2; i <= n; i++ ){
        if( is_prime[ i ] ){
            for( int j = 2 * i; j <= n; j += i ){
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}*/

int length(vector<int> v, int u, int HW){
    if(v.size() == 0) return HW;
    if(v[0] > u) return v[0];
    if(v[v.size() - 1] < u) return HW - v[v.size()- 1] -1;
    else{
        int i = lower_bound(ALL(v), u)- v.begin();
        return v[i] - v[i-1] -1;
    }
}

int main(){
    int a, b;
    cin >> a >> b;
    for(int i = 0; i <= 2000; ++i){
        int k = i * 0.08;
        int l = i * 0.10;
        if(k == a and l == b) {cout << i; return 0;}
    }
    cout << -1;
    return 0;
}


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

int N, xx, yy, T;
int field[105][105];
int pos[2][4][105][105];
//          N  E  W  S
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
int opp[]= {3, 2, 1,  0};
int clear(int idx){
	idx %= 2;
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 105; j++){
			for(int k = 0; k < 105; k++){
				pos[idx][i][j][k] = 0;
			}
		}
	}
}
void print(int idx){
	for(int i = 6; i >= 0; i--){
		for(int j = 0; j < 6; j++){
			cout << " ";
			for(int k = 0; k < 4; k++){
				cout << pos[idx][k][i][j];
			}
		}
		cout << endl;
	}
	cout << "===============" << endl;
}

int main(){
	for(int i = 0; i < 105; i++){
		for(int j = 0; j < 105; j++){
			field[i][j] = 0;
		}
	}

	cin >> N >> xx >> yy >> T;
	xx = xx * 2 + 1;
	yy = yy * 2 + 1;

	for(int i = 0; i < N; i++){
		int xs,xe,ys,ye;
		cin >> xs >> ys >> xe >> ye;
		xs = xs * 2 + 1;
		ys = ys * 2 + 1;
		xe = xe * 2 + 1;
		ye = ye * 2 + 1;

		if(xs == xe){
			if(ye < ys) swap(ys, ye);
			for(int j = ys; j <= ye; j++){
				field[j][xs] = 1;
			}
		}else{
			if(xe < xs) swap(xs, xe);
			for(int j = xs; j <= xe; j++){
				field[ys][j] = 1;
			}
		}
	}
/*
	for(int i = 0; i < 6; i++){
		for(int j = 0; j < 6; j++){
			cout << field[i][j] ;
		}
		cout << endl;
	}
	cout << "============" << endl;
*/
	int idx = 0;
	clear(0);

	for(int i = 0; i < 4; i++){
		if(field[yy + dy[i]][xx + dx[i]]){
			pos[0][i][yy][xx] = 1;
		}
	}

	for(int i = 0; i < T; i++){
		int d;
		char c;
		cin >> d >> c;
		int dd;
		if(c == 'N'){
			dd = 0;
		}else if(c == 'E'){
			dd = 1;
		}else if(c == 'W'){
			dd = 2;
		}else{
			dd = 3;
		}

		//cout << dd << endl;
		for(int j = 0; j < d; j++){
			int ni = (idx + 1) % 2;
			clear(ni);
			for(int k = 0; k < 4; k++){
				for(int r = 0; r < 105; r++){
					for(int c = 0; c < 105; c++){
						int nx = c + dx[k]*2;
						int ny = r + dy[k]*2;
						if(pos[idx][k][r][c]){
							for(int l = 0; l < 4; l++){
								if(opp[k] != l && field[ny + dy[l]][nx + dx[l]]){
									if(j < d - 1 || k == dd || l == dd){
										pos[ni][l][ny][nx] = 1;
									}
								}
							}
						}
					}
				}
			} 
			//print(idx);
			idx = ni;
		}
	} 
	//print(idx);
	for(int i = 0; i < 105; i++){
		for(int j = 0; j < 105; j++){
			for(int k = 0; k < 4; k++){
				if(pos[idx][k][j][i]){
					cout << (i - 1)/2 << " "<<  (j - 1)/2 << endl;
					break;
				}
			}
		}
	}

}

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

using namespace std;

int a, b, c;

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

    cin >> a >> b >> c;

    if (b - a == c - b) {
        cout << "YES" << '\n';
    } else {
        cout << "NO" << '\n';
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
//#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

int main(void){
    string s,t;
    cin>>s>>t;
    rep(i,26){
        string tmp = s+(char)('a'+i);
        if(tmp == t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3656
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

vector<int> eds[120000];
int n;
int a[120000];

int dfs1(int v) {
	vector<int> vv;
	for (int u: eds[v])
		vv.push_back(dfs1(u));
	sort(vv.begin(), vv.end());
	reverse(vv.begin(), vv.end());
	int mx = vv.size();
	for (int i = 0; i < vv.size(); ++i)
		mx = max(mx, vv[i] + i + 1);
	return mx;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i < n; ++i)
		scanf("%d", a + i), --a[i], eds[a[i]].push_back(i);
	cout << dfs1(0) << "\n";
	return 0;
}




Measured memory_bytes: 16000
#include<iostream>
using namespace std;
int main()
{
	char s[1000][1000];
	int n,m,i,j,l;
	cin>>n>>m;
	for (i=0;i<n;i++)
		for (j=0;j<m;j++)
			cin>>s[i][j];
	for (i=0;i<n;i++)
	{
		for (j=0;j<m;j++)
		{
			l=0;
			if (s[i][j]=='#')
			{
				cout<<"#";
				continue;
			} 
			else
			{
				if (s[i-1][j-1]=='#') l++;
				if (s[i-1][j]=='#') l++;
				if (s[i-1][j+1]=='#') l++;
				if (s[i][j-1]=='#') l++;
				if (s[i][j+1]=='#') l++;
				if (s[i+1][j-1]=='#') l++;
				if (s[i+1][j]=='#') l++;
				if (s[i+1][j+1]=='#') l++;
			}
			cout<<l;
		}
		cout<<endl;
	}
	return 0;
} 

Measured memory_bytes: 256
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

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

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;
const int LOGN = 19;

int N;
vector<int> G[MAXN];

void input()
{
    read(N);
    for (int i = 1; i < N; ++i) {
        int u, v;
        read(u); read(v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
}

int calc(int u, int f)
{
    int st = 0, mask = 0;
    for (int i = 0; i < SZ(G[u]); ++i) {
        int v = G[u][i];
        if (v == f)
            continue;
        int t = calc(v, u);
        if (mask & t)
            chkmax(st, 31 - __builtin_clz(mask & t));
        mask |= t;
    }
    while (mask >> st & 1) {
        ++st;
    }
    return (mask & (~0 ^ ((1 << st) - 1))) | (1 << st);
}

void solve()
{
    int ans = 31 - __builtin_clz(calc(1, 0));
    printf("%d\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 汉兵已略地，四方楚歌声。
//     -- 虞姬《和项王歌》


Measured memory_bytes: 10240
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-06-01 18:13:06
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

#if __cplusplus >= 201703L
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void tuple_out(std::basic_ostream<Ch, Tr>& os, const Tuple& tp, std::index_sequence<Is...>) {
  ((os << (Is ? ", " : "(") << std::get<Is>(tp)), ...) << ")";
}

template <class Ch, class Tr, class... Args>
auto& operator<<(std::basic_ostream<Ch, Tr>& os, const std::tuple<Args...>& tp) {
  tuple_out(os, tp, std::index_sequence_for<Args...>{});
  return os;
}
#endif

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class Compare>
std::ostream& operator<<(std::ostream& os, const std::set<T, Compare>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U, class Compare>
std::ostream& operator<<(std::ostream& os, const std::map<T, U, Compare>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

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

  int64 a; cin >> a;
  double b; cin >> b;
  b *= 100;
  b = round(b);
  int c = b;

  cout << a * c / 100 << endl;

  return 0;
}


Measured memory_bytes: 3788
# 入力
n = gets.to_i
a = gets.chomp.split.map(&:to_i)

# 配列から偶数をだす
even = a.select{|x|x%2==0}

# 3と５で割れるかの判定
if even.all?{|i|i%3==0 || i%5==0}
   puts "APPROVED"
else
   puts "DENIED"
end

Measured memory_bytes: 1788
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;
int n,t,a;
int h[1101];

signed main(){

    cin >> n >> t >> a;

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

    

    
    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 256
b1,b2,b3=map(int,input().split())

if b1==1:
    if b2==0:
        print("Close")
    else:
        print("Open")
if b1==0:
    if b2==1:
        print("Close")
    if b2==0:
        if b3==1:
            print("Open")
        if b3==0:
            print("Close")



Measured memory_bytes: 5592
#include<stdio.h>
int main(void){
    int H, W;
    int i, j;
    while(1){
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0){
            break;
        }
        for(i = 0; i < H; i++){
            for(j = 0; j < W; j++){
                if(j == (W - 1)){
                    printf("#\n");
                }else{
                    printf("#");
                }
            }
        }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 588
n = int(input())
s = input()
w = [0]*(n+1)
e = [0]*(n+1)
for i in range(1,n+1):
    if s[i-1] == 'E':
        e[i] = e[i-1] + 1 
        w[i] = w[i-1]
    else:
        e[i] = e[i-1]
        w[i] = w[i-1] + 1

ans = n
for i in range(n):
    ans = min(ans,w[i]+e[n]-e[i+1])
print(ans)

Measured memory_bytes: 17624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.1415926536
struct Point
{
    int x;
    int y;
};
inline double dist(Point a, Point b)
{
    return sqrt( pow(a.x - b.x , 2) + pow(a.y - b.y, 2) );
}
Point point[200005];
Point st[200005];
void getExtremePoint(int n)///at index 0
{
    int pos = 0;
    for(int i=1; i<n; i++){
        if(point[i].y < point[pos].y || (point[i].y == point[pos].y && point[i].x < point[pos].x))
            pos = i;
    }
    swap(point[0], point[pos]);
}
inline int triArea(Point p1, Point p2, Point p3)
{
    ll area = 1LL*p1.x*(p2.y - p3.y) + 1LL*p2.x*(p3.y - p1.y) + 1LL*p3.x*(p1.y - p2.y);
    if(area==0) return area;
    else return area/llabs(area);
}
inline bool comp(Point p1, Point p2)
{
    int tri = triArea(point[0],p1,p2);
    if(tri<0) return false;
    if(tri==0 && dist(point[0], p1) > dist(point[0], p2)) return false;
    return true;
}
bool comp2(Point p1, Point p2)
{
	if(p1.x==p2.x) 
		return p1.y<p2.y;
	return p1.x<p2.x;
}
int id;
void genConvexPoints(int n)
{
    getExtremePoint(n);
    sort(point+1, point+n, comp);
    id = 0;
    for(int i=0; i<3 && i<n; i++)
        st[id++] = point[i];
    for(int i = 3; i<n; i++){
        while(triArea(st[id-2], st[id-1], point[i]) <= 0 && id>=2)
            id--;
        st[id++] = point[i];
    }
}
int main()
{
    int tc,cs=1,n,d;
    tc = 1;
    while(tc--){
    	set< pair<int, int> >mp;
        scanf("%d",&n);
        int idx = 0;
        for(int i=0; i<n; i++){
            scanf("%d%d",&point[i].x,&point[i].y);
            mp.insert( make_pair(point[i].x,point[i].y));
            if(mp.size() > idx )
            	point[idx++] = point[i];
        }
        n = idx;
        genConvexPoints(n);
      assert(id<=200);
        int ans = 0;
        for(int i=0; i<id; i++){
        	for(int j=i+1; j<id; j++){
        		ans = max(ans, abs(st[i].x-st[j].x) + abs(st[i].y - st[j].y  ));
        	}
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 14756
# require 'byebug'

n, m  = gets.strip.split.map(&:to_i)
as = gets.strip.split.map(&:to_i)

match_numbers = [nil, 2, 5, 5, 4, 5, 6, 3, 7, 6].map.with_index {|e, i| [e, i]}.select {|e, i| as.include?(i) }.sort.to_h

# p match_numbers
# p match_numbers.to_h

dp = Hash.new(0)
(1..n).each do |i|
  tmp = match_numbers[i].to_i.to_s
  # p tmp
  # byebug
  match_numbers.keys.each do |k|
    unless dp[i-k].zero?
      a = dp[i-k].to_s
      b = match_numbers[k].to_s
      str = a < b ? (b+a) : (a+b)
      if tmp.length < str.length || (tmp.length==str.length && tmp < str )
        tmp = str
      end
    end
  end
  dp[i] = tmp.to_i
end

# p dp
p dp[n]


Measured memory_bytes: 50068
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int a[60], b[60];
	int N, M;

	cin >> N >> M ;
	for(int i = 1; i <= M; i++) {
		cin >> a[i] >> b[i];
	}

	int w[60];
	for(int i = 1; i <= N; i++) {
		w[i] = 0;
	}
	for(int i = 1; i <= M; i++) {
		w[a[i]] ++;
		w[b[i]] ++;
	}

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


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const double EPS = 1e-10;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

int main()
{
	ll q, h, s, d, n;

	cin >> q >> h >> s >> d >> n;

	ll min1 = n * s;
	ll min2 = n * s;

	for(ll i25=0;i25<9;i25++)
		for (ll i50 = 0;i50<9;i50++)
			for (ll i1 = 0;i1<9;i1++)
				for (ll i2 = 0;i2 < 9;i2++) {
					ll temp = i25 / 4 + i50 / 2 + i1 + 2 * i2;
					ll sum = q * i25 + h * i50 + s * i1 + d * i2;

					if (temp == 1) {
						if (min1 > sum) min1 = sum;
					}

					if (temp == 2) {
						if (min2 > sum) min2 = sum;
					}
				}

	if (n % 2) {
		cout << (n / 2) * min2 + min1 << endl;
	}
	else {
		cout << (n / 2) * min2 << endl;
	}

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<double> v(n);
  for(int i = 0; i < n; i++) cin >> v.at(i);
  
  sort(v.begin(), v.end());
  double ans = v.at(0);
  for(int i = 1; i < n; i++){
    ans = (v.at(i) + ans) / 2.0;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] A = new int[N];
		Arrays.setAll(A, i -> sc.nextInt());
		Map<Integer, Long> x = new HashMap<>();
		int[] S = new int[N];
		S[0] = A[0] % M;
		x.put(0, 1L);
		x.put(S[0], x.getOrDefault(S[0], 0L) + 1);
		for(int i = 1; i < N; i++) {
			S[i] = (S[i-1] + A[i]) % M;
			x.put(S[i], x.getOrDefault(S[i], 0L) + 1);
		}
		long ans = 0;
		for(int i : x.keySet())
			ans += x.get(i) * (x.get(i) - 1) / 2;
		System.out.println(ans);
	}

}

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

int asc(const void *a, const void *b) {
  return *(int *)b - *(int *)a;
}

int main() {
	string s;
	cin >> s;
	if(s == "Sunny") cout << "Cloudy" << endl;
	else if(s == "Cloudy") cout << "Rainy" << endl;
	else if(s == "Rainy") cout << "Sunny" << endl;
}

Measured memory_bytes: 256
import math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

n=I()
a1=n*(n+1)//2
a2=3*(1+int(n/3))*int(n/3)//2
a3=5*(1+int(n/5))*int(n/5)//2
a4=15*(1+int(n/15))*int(n/15)//2
ans=a1-a2-a3+a4
print(ans)

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

int main(){
    int a,b,c;
    int a1,b1,c1;
    int a2,b2,b3;

    cin>> a>> b >> c;
    
    if (a < b) {
        a1 = a;
        b1 = b;
    }
    else {
        a1 = b;
        b1 = a;
    }
    if (b1 < c){
        b2 = b1;
        c1 = c;
    }
    else {
        b2 = c;
        c1 = b1;
    }
        if (a1 < b2){
        a2 = a1;
        b3 = b2;
    }
    else {
        a2 = b2;
        b3 = a1;
    }

    cout <<a2<<" "<<b3<<" "<<c1<< endl;

    return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
bool ok(vector<vector<char>> v) {
    rep(i, 8) rep(j, 8) {
        if (v[i][j] != 'Q') continue;
        rep(y, 8) rep(x, 8) {
            if (v[y][x] != 'Q') continue;
            if (y == i && x == j) continue;
            if (y == i || x == j || y - x == i - j || y + x == i + j) {
                return false;
            }
        }
    }
    return true;
}
int main() {
    int k;
    cin >> k;
    auto v = make_vec<char>(8, 8);
    vector<int> x(k), y(k);
    rep(i, k) cin >> y[i] >> x[i];

    vector<int> p = {0, 1, 2, 3, 4, 5, 6, 7};
    do {
        rep(i, 8) rep(j, 8) v[i][j] = '.';
        rep(i, 8) v[i][p[i]] = 'Q';
        if (!ok(v)) continue;
        bool flg = 1;
        rep(i, k) {
            flg &= (v[y[i]][x[i]] == 'Q');
        }
        if (flg) {
            rep(i, 8) {
                rep(j, 8) cout << v[i][j];
                cout << endl;
            }
            return 0;
        }
    } while (next_permutation(all(p)));
}


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

int get_max(int A[], int N) {
    int max = -10000;
    for(int i = 0; i < N; i++) {
        if(max < A[i]) {
            max = A[i];
        }
    }
    return max;
}

int main() {
    int A;
    int B;
    cin >> A >> B;
    int N = 3;
    int C[N];
    C[0] = A + B;
    C[1] = A - B;
    C[2] = A * B;
    int ans = get_max(C, N);
    cout << ans;
}


Measured memory_bytes: 256
'use strict'

function main(input) {
    let l = Number(input.split('\n')[0].split(' ')[0]);
    let r = Number(input.split('\n')[0].split(' ')[1]);
    let d = Number(input.split('\n')[0].split(' ')[2]);

    let ans = 0;
    for (let i = l; i <= r; i++) {
        if (i%d===0) {
            ans++;
        }
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define forin(i,array) for(auto& x:array)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mod 1000000007
#define inf 10000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

vll x(1000),y(1000);
vll arm(40);

int main(){

    int n;

    cin>>n;

    rep(i,n){
        cin>>x[i]>>y[i];
        if(abs(x[i]+y[i])%2!=abs(x[0]+y[0])%2){
            cout<<-1<<endl;
            return 0;
        }
    }

    int m=39;
    rep(i,m)arm[i]=(ll)pow(2,m-i-1);
    if(abs(x[0]+y[0])%2==0){
        m++;
        arm[m-1]=1;
    }
    cout<<m<<endl;
    rep(i,m)cout<<arm[i]<<" ";
    cout<<endl;
    rep(i,n){
        string s="";
        rep(j,m){
            if(abs(x[i])>=abs(y[i])){
                if(x[i]>=0){
                    s+="R";
                    x[i]-=arm[j];
                }
                else{
                    s+="L";
                    x[i]+=arm[j];                  
                }
            }
            else{
                if(y[i]>=0){
                    s+="U";
                    y[i]-=arm[j];
                }
                else{
                    s+="D";
                    y[i]+=arm[j];                  
                }
            }
        }
        cout<<s<<endl;
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#define ll long long
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>> s(h+2,vector<char>(w+2,'.'));
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            cin>>s[i][j];
        }
    }
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            if('#'==s[i][j]){
                if('.'==s[i-1][j]&'.'==s[i+1][j]&'.'==s[i][j-1]&'.'==s[i][j+1]){
                    cout<<"No"<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    int N, K, d, tmp, cnt;
    cnt = 0;

    cin >> N >> K;

    int A[N];
    m0(A);
    for(int i = 0; i < K; i++) {
        cin >> d;
        for(int j = 0; j < d; j++) {
            cin >> tmp;
            A[tmp - 1] = 1;
        }
    }

    for(int i = 0; i < N; i++) {
        if(A[i] == 0)
            cnt++;
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <queue>
#include <stdlib.h>
#include<algorithm>

using namespace std;

#define ll long long
#define MAX_V ((long long)1e5 + 5)
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define print(x) cout<<(x)<<endl;
//#define int long long
const int MOD = 1e9 + 7;

int exist[1 << 21], a[1 << 21];
int N;

int perm[20];
signed main() {
	cin >> N;
	REP(i, 1 << N) {
		cin >> a[i];
	}
	
	//int perm[N] = {};
	//bitの本数
	int ans = 0;
	//i本立てる
	REP(i, N + 1) {

		REP(j, i) {
			perm[N - j - 1] = 1;
		}
		do {
			int bit = 0;
			REP(j, N) {
				if (perm[j] == 1) {
					bit += (1 << j);
				}
			}
			/*REP(i, N) {
				if (bit & (1 << (i)))cout << 1; else cout << 0;
			}cout << endl;*/
			//死
			if (a[bit] == 1) {
				//print("dead");
				bool found = false;
				REP(j, N) {
					if (!(bit & (1 << j)))continue;
					int nextbit = bit - (1 << j);//一本下ろす
					//cout << "next " << nextbit << endl;
					if (exist[nextbit]) {
						//exist[bit]=true;
						found = true;
					}
					//exist[nextbit] = true;
				}
				if (!found)ans++;
				exist[bit] = true;
			}
			//生
			else {
				//print("alive");
				REP(j, N) {
					if (!(bit & (1 << j)))continue;
					int nextbit = bit -( 1 << j);//一本下ろす
					if (exist[nextbit]) {
						print(-1); return 0;
					}
				}
			}

		} while (next_permutation(perm, perm + N));
	}
	print(ans);
}


Measured memory_bytes: 11284
#include<stdio.h>
#include<stdlib.h>

int main()
{
  int i, n, t, min;
  long differ=-10000000000;

  scanf("%d", &n);
  
  for( i=0; i<n; i++ )
    {
      scanf("%d", &t);
      if( i == 0 )
	{
	  min = t;
	  continue;
	}
      
      if( differ < t - min ) differ = t - min;
      
      if( t < min ) min = t;	
      
    }
  
  printf("%d\n", differ);
  
  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int a[100005];
int main()
{
	int N,K,Q,i,j,m,n;
	cin>>N>>K>>Q;
	for(i=1;i<=N;i++)
	{
		a[i]=K-Q;
	}
	for(j=1;j<=Q;j++)
	{
		cin>>m;
		a[m]++;
	}
	for(i=1;i<=N;i++)
	{
		if(a[i]<=0)
		cout<<"No\n";
		else
		cout<<"Yes\n";
	}
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/range/algorithm.hpp>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main() {
  int a;
  cin >> a;
  int ans = a*a;
  cout << ans << endl;
  return 0;
}


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

string f[10] = {
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** "
};

int main(){
	string s;
	bool flag = false;

	while( cin >> s ){
		string ans[10];
		if( flag ){
			cout << endl;
		}else{
			flag = true;
		}
		while( s.size() < 5 ){
			s = "0" + s;
		}

		for(int i=0 ; i < s.size() ; i++ ){
			ans[i] = f[s[i]-'0'];
		}
		for(int x=0 ; x < 8 ; x++ ){
			for(int y=0 ; y < s.size() ; y++ ){
				cout << ans[y][x];
			}
			cout << endl;
		}
	}
}

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

#define forn(i,n) for(ll i = 0;i<n;i++)
#define forne(i,j,n) for(ll i = j;i<n;i++)
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ll INF = 1000000001;
const ll N = 100001;
const lld PI = 3.141593;
#define F first
#define pb(a) push_back(a)
#define S second
#define pii pair<int,int>
typedef pair<ll,ll> pll;

ll powm(ll base,ll exp) {
	ll ans=1;
	while(exp){
		if(exp&1) ans=(ans*base)%mod;
		exp>>=1,base=(base*base)%mod;
	}
	return ans;
}

// ll dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
// bool valid(ll i, ll j) {
// 	return i >= 1 && i <= n && j >= 1 && j <= m; 
// }
// int maxdepth = INT_MAX;
// vector<int> edgeVector[100000];
// ll minans = 1;
// printf("1 %d D\n",abs(r));
// priority_queue<ll,vector<ll>,greater<ll>> pq;
// ll a[N],b[N];
// vector<vector<ll>> adj(N);
// vector<set<ll>> adjs(N);
// ll adj[1001][1001];
// vector<vector<ll>> ans(1001);
// bool visited[N];
// ll cnt[1001];
// ll h,c,t;
// vector<pair<int, pair<int, int> > > g[300043];



int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

ll t,a = 0,b = 0,c = 0,d = 0;
cin>>t;
string s;
while(t--){
	cin>>s;
	if(s == "AC") a++;
	if(s == "WA") b++;
	if(s == "TLE") c++;
	if(s == "RE") d++;
}
cout<<"AC x "<<a<<endl;
cout<<"WA x "<<b<<endl;
cout<<"TLE x "<<c<<endl;
cout<<"RE x "<<d<<endl;

}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define per(i, a, b) for(int i=(b)-1; i>=(a); i--)
#define sz(a) (int)a.size()
#define de(a) cout << #a << " = " << a << endl
#define dd(a) cout << #a << " = " << a << " "
#define all(a) a.begin(), a.end()
#define pw(x) (1ll<<(x))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef double db;

void file_put() {
    freopen("filename.in", "r", stdin);
    freopen("filename.out", "w", stdout);
}

const int N=505;
int n,a[N*N],x[N],b[N*N],L,R,num[N];

void batL(int p,int x,int k) {
	for (; L<=p && k; ++L) if (!a[L]) a[L]=x,--k;
	if (k) {
		printf("No\n");
		exit(0);
	}
}

void batR(int p,int x,int k) {
	for (; R>=p && k; --R) if (!a[R]) a[R]=x,--k;
	if (k) {
		printf("No\n");
		exit(0);
	}
}

int main() {
//	file_put();
	
	scanf("%d",&n),R=n*n,L=1;
	rep(i,1,n+1) scanf("%d",&x[i]),a[x[i]]=b[x[i]]=i;
	rep(i,1,n*n+1) {
		if (!b[i]) continue;
		batL(i-1,b[i],b[i]-1);
	}
	per(i,1,n*n+1) {
		if (!b[i]) continue;
		batR(i+1,b[i],n-b[i]);
	}
	printf("Yes\n");
	rep(i,1,n*n+1) printf("%d%c",a[i]," \n"[i==n*n]);
	rep(i,1,n*n+1) {
		num[a[i]]++;
		if (b[i]) {
			assert(a[i]==b[i]);
			assert(num[a[i]]=b[i]);
		}
	}
	rep(i,1,n+1) assert(num[i]==n);
	
	return 0;
}



Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int main(){
  vector<int> coin = {1,5,10,50,100,500};
  int s = 0;
  for(int i = 0;i < coin.size();i++){
    int a;
    cin >> a;
    s += a * (coin[i]);
  }
  cout << (s >= 1000) << endl;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n)repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

struct edge{int x, y, z;};
int a[200][200];
queue<edge> G;
signed main(){
	int n, m;
	scanf("%lld%lld", &n, &m);
	
	fill((int*)a, (int*)(a+200), inf);
	rep(i,200)a[i][i] = 0;
	rep(i,m){
		int x, y, z;
		scanf("%lld%lld%lld", &x, &y, &z);
		G.push((edge){x, y, z});
		a[x][y] = z;a[y][x] = z;
	}
	
	rrep(i,n)rrep(j,n)rrep(k,n){
		a[j][k] = min(a[j][k], a[j][i]+a[i][k]);
	}
	
	int ans = m;
	rep(i,m){
		edge e = G.front();G.pop();
		int f = 0;
		rrep(j,n)if(e.z+a[e.x][j] == a[e.y][j])f = 1;
		//if(e.z == a[e.x][e.y])f = 1;
		ans -= f;
	}
	
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 640
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

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

  int N, M, L;
  cin >> N >> M >> L;
  vector<vector<int>> d(N, vector<int>(N, INF<int>));
  REP(i, N) { d[i][i] = 0; }
  REP(i, M) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    if (c <= L) {
      d[a][b] = c;
      d[b][a] = c;
    }
  }
  REP(k, N) {
    REP(i, N) {
      REP(j, N) { chmin(d[i][j], d[i][k] + d[k][j]); }
    }
  }

  vector<vector<int>> dd(N, vector<int>(N, INF<int>));
  REP(i, N) {
    dd[i][i] = 0;
    REP(j, N) {
      if (d[i][j] <= L) {
        dd[i][j] = 1;
      }
    }
  }
  REP(k, N) {
    REP(i, N) {
      REP(j, N) { chmin(dd[i][j], dd[i][k] + dd[k][j]); }
    }
  }

  int Q;
  cin >> Q;
  REP(i, Q) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    if (dd[s][t] == INF<int>) {
      cout << "-1\n";
    } else {
      cout << dd[s][t] - 1 << "\n";
    }
  }

  return 0;
}

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

int main(){
	string a,b;
	cin>>a>>b;
	string s=a+b;
	int c=sqrt(stoi(s));
	if(sqrt(stoi(s))==c){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}


Measured memory_bytes: 256