akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(v, n) sort(v, v+n)
#define VSORT(v) sort(v.begin(), v.end())
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 999999999
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int n;
    cin >> n;
    VI h(n);
    int cnt=0;
    int res=0;
    REP(i,n){
        cin >> h[i];
        if(i==0)continue;
        if(h[i]<=h[i-1])cnt++;
        else if(res<cnt){
            res=cnt;
            cnt=0;
        }else cnt=0;
        //cout <<cnt<<endl;
    }
    if(res<cnt)res=cnt;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<int,int>P;
const int mod =1e9+7;


vector<ll> divisor(ll n)
{
    vector<ll> res;
    for(ll i=1;i*i<=n;i++)
    {
        if(n%i==0)
        {
            res.push_back(i);
            if(i!=n/i)res.push_back(n/i);

        }
    }
    return res;
}
int main()
{
    int n;
    ll m;
    cin>>n>>m;
    auto div=divisor(m);
    sort(div.begin(),div.end());
    ll ans=upper_bound(div.begin(),div.end(),m/n)-div.begin();
    cout<<div[ans-1];

    

}


Measured memory_bytes: 256
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

l = []
for _ in range(5):
    l.append(int(input()))

target_idx = -1
dig_1_min  = 10
for a in l:
    dig_1 = a % 10
    if dig_1 != 0 and dig_1 < dig_1_min:
        dig_1_min = dig_1
        target_idx = l.index(a)

total = 0
for i in range(len(l)):
    val = l[i]
    dig_1 = val % 10
    if dig_1 != 0 and i != target_idx:
        val += 10
        val -= dig_1
    total += val

print(total)

Measured memory_bytes: 12504
#include <stdio.h>
#define MAX_N 110

int a[MAX_N], b[MAX_N];
int x[MAX_N], y[MAX_N];

int main(void)
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    for (int i = 1; i <= n; i++)
        scanf("%d", &b[i]);
    for (int i = 1; i <= n; i++)
        x[i] = x[i - 1] + a[i];
    for (int i = n; i >= 1; i--)
        y[i] = y[i + 1] + b[i];
    int ans = 0;
    for (int i = 1; i <= n; i++)
        if (x[i] + y[i] > ans) ans = x[i] + y[i];
    printf("%d\n", ans);
    return 0;
}


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

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int n, m, k;
VI a, b, c;
#define mod 1000000007
//function-------------------------------------------------------------------------------------------------------------------- 
int main() {
	while ( true ) {
		scanf( "%d %d", &n, &m );
		if ( !n && !m ) {
			return 0;
		}
		rep( i, n ) {
			scanf( "%d", &k );
			a.push_back( k );
		}
		int mx = 0;
		int d = 0;
		rep( i, m ) {
			d += a[ i ];
			mx = d;
		}
		FOR( i, 1, n - m ) {
			d -= a[ i - 1 ];
			d += a[ i + m - 1 ];
			mx = max( mx, d );
		}
		printf( "%d\n", mx );
		a = VI();
	}
	return 0;
}

Measured memory_bytes: 1704
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s,x;
  cin>>s>>x;
 int n=s.length();
  int m=x.length();
  int dp[n+1][m+1];
  for(int i=0;i<=n;i++)
  {
    dp[i][0]=0;
  }
  for(int i=0;i<=m;i++)
  {
    dp[0][i]=0;
  }
   
   for(int i=1;i<=n;i++)
  {
    for(int j=1;j<=m;j++)
    {
      if(s[i-1]==x[j-1])
      {
        dp[i][j]=1+dp[i-1][j-1];
      }
      else
      {
        dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
      }
    }
  }
  int i=n;
  int j=m;
  string a="";
while(i>0 && j>0)
{
  if(s[i-1]==x[j-1])
  {
    a+=s[i-1];
    i--;
    j--;
  }
  else if(dp[i-1][j]>dp[i][j-1])
       i--;
       else
       j--;
       
  }
  
   reverse(a.begin(),a.end());
   cout<<a;
}

  


Measured memory_bytes: 35456
a,b,c,d=map(int,input().split())
mod=998244353
dp=[[1 for i in range(d-b+1)] for j in range(c-a+1)]
for i in range(c-a):
    dp[i+1][0]=dp[i][0]*b
    dp[i+1][0]%=mod
for i in range(d-b):
    dp[0][i+1]=dp[0][i]*a
    dp[0][i+1]%=mod
for i in range(c-a):
    for j in range(d-b):
        dp[i+1][j+1]=dp[i+1][j]*(a+i+1)+dp[i][j+1]*(b+j+1)-dp[i][j]*((b+j)*(a+i))
        dp[i+1][j+1]%=mod
print(dp[-1][-1])

Measured memory_bytes: 146732
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	while (1) {
		int n,p;
		std::cin >> n >> p;
		if(n==0) break;
		std::vector<int> candidates(n,0);
		int bowl = p;
		int i = 0;
		while(true) {
			if (bowl>0) {
				candidates[i] ++;
				bowl--;
			}
			else {
				bowl = candidates[i];
				candidates[i] = 0;
			}
			if(candidates[i] == p) break;
			i = (i+1)%n;
		}
		std::cout << i << ENDL;
	}
	return 0;
}



Measured memory_bytes: 3100
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <iomanip>
#include <cstring>
#include <math.h>
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
using namespace std;

int swap(int &a,int &b){
	int c;
	c=a;
	a=b;
	b=c;

	return 0;
}



int main(){
	while(1){
		int y,x;
		cin>>y>>x;
		if(x==0&&y==0)
			break;
		for(int i=1;i<=y;i++){
			for(int j=1;j<=x;j++){
				if((i+j)%2==0)
					cout<<'#';
				else
					cout<<'.';


			}
			cout<<endl;
		}
		cout<<endl;

	}

	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define llint long long int
using namespace std;
llint n,k;
llint len[51],full[51];

llint f(llint n, llint k)
{
	if(k<=0)return 0;
	if(n<=0)return 1;
llint ret=0;
	if(k>len[n]/2)
 return full[n-1]+1+f(n-1,k-len[n]/2-1);
 else return f(n-1,k-1); 
}

int main(void)
{
	len[0]=1;
	for(int i=1;i<51;i++) len[i]=len[i-1]*2+3;
	full[0]=1;
	for(int i=1;i<51;i++) full[i]=full[i-1]*2+1;
	cin>>n>>k;
	cout<<f(n,k)<<endl;
	return 0;
}

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  int H,W;
  cin >> H >> W;
  int times_4 = (H/2) * (W/2) ,times_2 = (H%2) * (W/2) + (H/2) * (W%2) , times_1 = (H%2) * (W%2);

  string board[H];
  rep(i,H) cin >> board[i];
  map<char,int> cnt;
  rep(i,H)rep(j,W){
    cnt[board[i][j]]++;
  }

  for(auto num : cnt){
    while(num.second >= 4 && times_4 > 0){
      num.second -= 4;
      times_4 --;
    }

    while(num.second >= 2 && times_2 > 0){
      num.second -= 2;
      times_2--;
    }

    while(num.second >= 1 && times_1 > 0){
      num.second -= 1;
      times_1--;
    }
  }

  if(times_4 == 0 && times_2 == 0 && times_1 == 0){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
const int INF = 1000000007;

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    int N, K, R, S, P;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;
    vector<char> Pre(K, 'a');
    int ans = 0;
    rep(i, N){
        if(T[i] == 'r'){
            if(Pre[i % K] == 'p'){
                Pre[i % K] = 'a';
                continue;
            } else {
                Pre[i % K] = 'p';
                ans += P;
            }
        }
        if(T[i] == 's'){
            if(Pre[i % K] == 'r'){
                Pre[i % K] = 'a';
                continue;
            } else {
                Pre[i % K] = 'r';
                ans += R;
            }
        }
        if(T[i] == 'p'){
            if(Pre[i % K] == 's'){
                Pre[i % K] = 'a';
                continue;
            } else {
                Pre[i % K] = 's';
                ans += S;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
//
// Created by yamunaku on 2019/11/26.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

struct slideMin{
    deque<pair<int, int>> deq;


    void push(pair<int, int> p){
        while(!deq.empty()){
            if(deq.back().first <= p.first) break;
            deq.pop_back();
        }
        deq.push_back(p);
    }

    void pop(int n){
        while(!deq.empty()){
            if(deq.front().second >= n) break;
            deq.pop_front();
        }
    }

    pair<int, int> get(){
        return deq.front();
    }

    int size(){
        return deq.size();
    }
};

int main(){
    // CFS;
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    slideMin q;
    q.push({0, 0});
    vi pre(n + 1);
    repl(i, 1, n + 1){
        if(s[i] == '1') continue;
        q.pop(i - m);
        if(q.size() == 0){
            cout << -1 << endl;
            return 0;
        }
        pre[i] = q.get().second;
        q.push({q.get().first + 1, i});
    }
    vi ans;
    int now = n;
    while(now!=0){
        ans.push_back(now-pre[now]);
        now=pre[now];
    }
    per(i,ans.size()){
        cout << ans[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1528
#include<iostream>

using namespace std;


int main()
{
  int N;
  cin >> N;
  
  long long L[86+1];
  L[0]=2;
  L[1]=1;
  
  for(int i=2;i<86+1;i++){
    L[i]=L[i-1]+L[i-2];
  }
  cout<<L[N]<<endl;
  
}

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

int main()
{
	int n; //n件の情報
	int b, f, r, v;//b:棟 f:階 r:番目の部屋 v:増減した人数
	int house1[4][11] = { 0 }; //1棟
	int house2[4][11] = { 0 }; //2棟
	int house3[4][11] = { 0 }; //3棟
	int house4[4][11] = { 0 }; //4棟

	cin >> n;

	//情報の入力
	for (int i = 0; i < n; i++)
	{
		cin >> b >> f >> r >> v;

		if (b == 1)//1棟目だったら
		{
			house1[f][r] = house1[f][r] + v; //配列は0から始まるから1つずらす
		}

		if (b == 2)//2棟目だったら
		{
			house2[f][r] = house2[f][r] + v; //配列は0から始まるから1つずらす
		}

		if (b == 3)//3棟目だったら
		{
			house3[f][r] = house3[f][r] + v; //配列は0から始まるから1つずらす
		}

		if (b == 4)//4棟目だったら
		{
			house4[f][r] = house4[f][r] + v; //配列は0から始まるから1つずらす
		}
	}

	/*出力*/
	for (int j = 1; j <= 3; j++)
	{
		for (int k = 1; k <= 10; k++)
		{
			cout << " " << house1[j][k];
		}
		cout << "\n";
	}
	cout << "####################" << "\n";

	for (int j = 1; j <= 3; j++)
	{
		for (int k = 1; k <= 10; k++)
		{
			cout << " " << house2[j][k];
		}
		cout << "\n";
	}
	cout << "####################" << "\n";

	for (int j = 1; j <= 3; j++)
	{
		for (int k = 1; k <= 10; k++)
		{
			cout << " " << house3[j][k];
		}
		cout << "\n";
	}
	cout << "####################" << "\n";

	for (int j = 1; j <= 3; j++)
	{
		for (int k = 1; k <= 10; k++)
		{
			cout << " " << house4[j][k];
		}
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main(){
int y,m,d;
char c1,c2;
cin>>y>>c1>>m>>c2>>d;
if(y<2019){
    cout<<"Heisei";
}
else if(y==2019){
    if(m<4||(m==4&&d<=30)){
        cout<<"Heisei";
    }
    else cout<<"TBD";
}
else cout<<"TBD";
  return 0;
}

Measured memory_bytes: 256
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// Atcoder Beginner contest
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
#define ll long long
#define mo 1000000007
using namespace std;
//long long m = 1000000007;
//int prime[1000003];
void solve(int n,bool prime[])
{

//    bool prime[n+1];
//    memset(prime, true, sizeof(prime));
  
    for (int p=2; p*p<=n; p++)
    {
        // If prime[p] is not changed, then it is a prime
        if (prime[p] == true)
        {
            // Update all multiples of p greater than or
            // equal to the square of it
            // numbers which are multiple of p and are
            // less than p^2 are already been marked.
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
  
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.flush();
        int n = 100003;
        bool prime[n+1];
        memset(prime, true, sizeof(prime));
        solve(n,prime);
    int val;cin >> val;
    int res;
    while(true){
        if(prime[val])
        {
            res = val;
            break;
        }
        val++;
    }
    cout<<res<<endl;
//    delete[] size;
//    delete[] parent;
//    mp.clear();
    return 0;
    // Bye Bye 2019
}




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

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

	vector<int> v(3);
	cin >> v[0] >> v[1] >> v[2];
	sort(v.begin(), v.end());
	cout << v[0] <<" " << v[1] <<" "<< v[2] << "\n";
	return 0;
}


Measured memory_bytes: 3136
n, a, b = map(int, input().split())

a, b = min(a,b), max(a,b)

if (b-a) % 2 == 0:
    print((b-a)//2)
    exit(0)

d = min(a - 1, n - b)
print(d + 1 + (b-a-1)//2)


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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<double, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

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

    vector<vector<int>> edges(n);
    rep(i, n - 1) {
        int x, y;
        cin >> x >> y;

        x--;
        y--;

        edges[x].push_back(y);
        edges[y].push_back(x);

    }

    vector<ll> d(n, -1);
    priority_queue<P> q;

    int k;
    cin >> k;
    rep(_, k) {
        int x, y;
        cin >> x >> y;
        x--;
        d[x] = y;
        q.emplace(-y, x);
    }

    while (!q.empty()) {
        int cur = q.top().second;
        q.pop();

        for (auto e : edges[cur]) {
            if (d[e] == -1) {
                d[e] = d[cur] + 1;
                q.push({-d[e], e});
            } else {
                if (abs(d[e] - d[cur]) != 1) {
                    cout << "No" << endl;
                    ret();
                }
            }
        }

    }

    cout << "Yes" << endl;
    for(int a : d) cout << a << endl;

}


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

using namespace std;

typedef long double ld;
typedef long long ll;

const int mod = 1e9 + 7;

int add(int x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
    return x;
}

int mul(ll x, ll y) {
    return x * y % mod;
}

const int M = 100100;
int n, x[M];

void read() {
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> x[i];
}

void kill() {
    int ans = 1;
    int cur = 0;
    for (int i = 0; i < n; ++i) {
        cur++;
        while (cur > (x[i] + 1) / 2) {
            ans = mul(ans, cur);
            --cur;
        }
    }
    while (cur) {
        ans = mul(ans, cur);
        --cur;
    }
    cout << ans << endl;
}

int main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  read();
  kill();

  ios_base::sync_with_stdio(false);

}



Measured memory_bytes: 640
from collections import defaultdict
input()
a = [int(x) for x in input().split()]
input()
b = [int(x) for x in input().split()]
dic = defaultdict(int)
flag = True
for i in a:
  dic[i] += 1
for i in b:
  dic[i] -= 1
  if dic[i] < 0:
    flag = False
if flag: print('YES')
else: print('NO')

Measured memory_bytes: 41572
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

"""
[解答]
最初に生成⇒最大のスライム
2回目以降⇒できるだけ大きい値のスライムを先に生成したい
         ⇒生成できるスライムの中で最大のものを常に選択(貪欲)
         ⇒それをn回繰り返す
降順にソートして前から取ると速い(昇順,後ろからでも)
"""
n = I()
s = LI()
s.sort(reverse=True)
use = [s[0]]
rest = s[1:]
for _ in range(n):
    new_use = []
    que = deque(rest)
    for i in use:
        rest_tmp = []
        while que:
            x = que.popleft()
            if i > x:
                new_use.append(x)
                break
            else:
                rest_tmp.append(x)
        que += rest_tmp
    use += new_use
    use.sort(reverse=True)
    rest = list(que)
    rest.sort(reverse=True)
if len(use) == 2**n:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 134088
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string.h>
#include<math.h>
#define N 10
int main() {
	int A[N][N],i,j;
	char num[11];

	while (~fscanf(stdin, "%s", num)) {
		memset(A, 0, sizeof(A));
		for (i = 0; i < N; i++) A[0][i] = num[i] - '0';

		for (i = 1; i < N; i++)
			for (j = 0; j < N - i; j++)
				A[i][j] = (A[i - 1][j] + A[i - 1][j + 1])%10;
		fprintf(stdout, "%d\n", A[N - 1][0]);
	}
	return 0;
}

Measured memory_bytes: 544
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const ll mod=1e9+7;
using namespace std;
int n,nr;
string s;
map<string,bool>mp;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	while(n--)
	{
		cin>>s;
		if(!mp[s])nr++,mp[s]=1;
	}
	cout<<nr<<endl;
	return 0;
}


Measured memory_bytes: 19208
import java.util.Arrays;
import java.util.Scanner;

class Main{
	static int N;
	static int K;

	static int[] a;

	static boolean[][] memo;
	static boolean[][] flag;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		N = sc.nextInt();
		K = sc.nextInt();

		a = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();

		}

		memo = new boolean[2][K + 1];
		flag = new boolean[2][K + 1];
		for(int i = 0; i < flag.length; i++) {
			Arrays.fill(flag[i], false);
		}

		boolean first = dp(0, K);

		if(first)
			System.out.println("First");
		else
			System.out.println("Second");
		sc.close();
	}

	static boolean dp(int i, int n) {
		boolean turn_1 = (i == 0);
		if(n < 0)
			if(turn_1)	//player1s turn
				return true;
			else			//player2s turn
				return false;

		if(flag[i][n])		//return memo
			return memo[i][n];

		flag[i][n] = true;	//set memoflag

		boolean ans;

		if(turn_1) {
			ans = false;
			for(int j = 0; j < N; j++) {
				if(dp(1, n - a[j])) {
					ans = true;
					break;
				}
			}
		}
		else {
			ans = true;
			for(int j = 0; j < N; j++) {
				if(!dp(0, n - a[j])) {
					ans = false;
					break;
				}
			}
		}
		return memo[i][n] = ans;
	}
}

Measured memory_bytes: 32212
#include <iostream>
#include <vector>
using namespace std;
const long long MOD = 1000000007;
int main(){
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}
	vector<vector<vector<long long>>> dp(n + 1, vector<vector<long long>>(n + 1, vector<long long>(256, 0)));
	dp[0][0][0] = 1;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < n; j++){
			for (int l = 0; l < 256; l++){
				dp[i + 1][j][l] += dp[i][j][l];
				dp[i + 1][j][l] %= MOD;
				dp[i + 1][j + 1][l ^ a[i]] += dp[i][j][l];
				dp[i + 1][j + 1][l ^ a[i]] %= MOD;
			}
		}
	}
	vector<long long> fact(n + 1);
	fact[0] = 1;
	for (int i = 0; i < n; i++){
		fact[i + 1] = fact[i] * (i + 1) % MOD;
	}
	long long ans = 0;
	for (int i = 1; i <= n; i++){
		ans += dp[n][i][k] * fact[i];
		ans %= MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 24356
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::min;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut students: Vec<(i64, i64)> = vec![];
    let mut checkmarks: Vec<(i64, i64)> = vec![];

    for _ in 0..n {
        let a: i64 = read();
        let b: i64 = read();
        students.push((a, b));
    }
    for _ in 0..m {
        let c: i64 = read();
        let d: i64 = read();
        checkmarks.push((c, d));
    }

    for s in &students {
        let mut minv: i64 = std::i64::MAX;
        let mut minpoint = 0;
        for i in 0..checkmarks.len() {
            let ci = checkmarks[i];
            let dist = (ci.0 - s.0).abs() + (ci.1 - s.1).abs();
            if dist < minv {
                minv = dist;
                minpoint = i;
            }
        }
        println!("{}", minpoint +1);
    }
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
int main(){
  int n;cin>>n;
  int p[n];
  for(int i=0;i<n;i++)cin>>p[i];
  sort(p,p+n);
  p[n-1]/=2;
  int ans=0;
  for(int i=0;i<n;i++)ans+=p[i];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define my_max(a, b) ((a) > (b) ? (a) : (b))
#define my_min(a, b) ((a) < (b) ? (a) : (b))
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i, s, t) for(int i = (int)(s); i <= (int)(t); i++)
#define rev(i, t, s) for(int i = (int)(t); i >= (int)(s); i--)
#define lson rt << 1
#define rson rt << 1 | 1
#define sz(x) (int)(x).size()

typedef long long ll;
typedef long double lb;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;
typedef std::vector<int> VI;
typedef std::vector<ll> VL;
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> rbtree;
ll gcd(ll x, ll y){ return y % x == 0 ? x : gcd(y % x, x); }
template<class T>T my_abs(T a){ if(a < 0) a = -a; return a; }
inline ll read(){
    ll ret = 0, sign = 1;
    char c = getchar();
    while(c < '0' || c > '9'){ if(c == '-') sign = -1; c = getchar();}
    while(c >= '0' && c <= '9'){ ret = ret * 10 + c - '0'; c = getchar(); }
    return ret * sign;
}
inline void write(ll x){
    if(x < 0){
        putchar('-');
        x = -x;
    }
    if(x > 9) write(x / 10);
    putchar(x % 10 + '0');
}

//void expand_stack_space(){
//    int size = 256 << 20; // 256MB
//    char *p = (char*)malloc(size) + size;
//    __asm__("movl %0, %%esp\n" :: "r"(p));
//}
const int maxn = 2e5 + 7;
int a[maxn], n, vis[maxn], st[maxn], top;
ll k;

int dfs(int u) {
    if(k == 0) return u;
    if(vis[u]) {
        int cycsz = 0, j;
        for(j = top; j > 0; --j) if(st[j] == u) break;
        cycsz = top - j + 1;
        k %= cycsz;
        return st[j + k];
    }
    st[++top] = u;
    vis[u] = 1;
    --k;
    return dfs(a[u]);
}
int main(){
#ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);
#endif // ONLINE_JUDGE
    scanf("%d%lld", &n, &k);
    for(int i = 1; i <= n; ++i) {
        scanf("%d", a + i);
    }
    printf("%d\n", dfs(1));
    return 0;
}


Measured memory_bytes: 5948
#include <stdio.h>

int miyukiti[12345];

int main(void) {
	int x, y, z;
	int N;
	int i;
	if (scanf("%d", &N) != 1) return 1;
	for (x = 1; x * x <= N; x++) {
		for (y = 1; y * y <= N; y++) {
			for (z = 1; z * z <= N; z++) {
				int satorina = x * x + y * y + z * z + x * y + y * z + z * x;
				if (satorina <= N) miyukiti[satorina]++;
			}
		}
	}
	for (i = 1; i <= N; i++) {
		printf("%d\n", miyukiti[i]);
	}
	return 0;
}



Measured memory_bytes: 1728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 
#define MAX_CHAR 256

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

void dfs(vvpi g) {
       vector<int> visited(g.size(),0);
       vector<int> color(g.size(),0);
       stack<int> st;
       st.push(0);
       visited[0]=1;
       while(!st.empty()){
           int p=st.top();
           st.pop();
           for(int i=0;i<g[p].size();i++){
               if(!visited[g[p][i].first]){
                   visited[g[p][i].first]=1;
                   color[g[p][i].first]=(color[p]+g[p][i].second)%2;
                   st.push(g[p][i].first);
               }
           }
       }
       for(int i=0;i<color.size();i++){
           out(color[i]);
       }
       return ;
  }
void solve(){
    int N;
    cin>>N;
    vvpi g(N);
    for(int i=0;i<N-1;i++){
        int a,b,c;
        cin>>a>>b>>c;
        a--;
        b--;
        g[a].push_back(make_pair(b,c));
        g[b].push_back(make_pair(a,c));
    }
    vi color(N,-1);
    dfs(g);
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

Measured memory_bytes: 13312
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws Exception {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		StringBuilder s = new StringBuilder(br.readLine());
		int q = Integer.parseInt(br.readLine());
		
		boolean flip = false;
		StringBuilder left = new StringBuilder();
		
		for (int i = 0; i < q; i++) {
			String[] fc = br.readLine().split(" ");
			if (fc[0].equals("1")) {
				flip = !flip;
			} else {
				if (fc[1].equals("1") ^ flip) left.append(fc[2]);
				else s.append(fc[2]);
			}
		}
		
		br.close();

		left.reverse().append(s);
		if (flip) left.reverse();
	
		System.out.println(left.toString());
		
	}
	
}


Measured memory_bytes: 49772
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int a = 0;
  char c;
  string s;
  cin >> s;
  c = '2';
  rep(i,s.size())
  {
    if (c == s[i]) {
      a++;
      if (s[i] == '0')
        c = '1';
      else
        c = '0';
    } else
      c = s[i];
  }
  cout << a;
}


Measured memory_bytes: 512
let rec power ( * ) e m n =
  if n <= 0 then e
  else power ( * ) (if n land 1 = 0 then e else m * e) (m * m) (n lsr 1)

let m = 1000000007
let ( *^ ) x y = (x * y) mod m

let perm n k = Array.fold_left ( *^ ) 1 @@ Array.init k @@ ( + ) @@ n - k + 1
let comb n k = power ( *^ ) (perm n k) (perm k k) (m - 2)

let () = Scanf.scanf "%d %d\n" @@ fun x y ->
  Printf.printf "%d\n" @@ if
    2 * x - y < 0 ||
    0 < (2 * x - y) mod 3 ||
    2 * y - x < 0 ||
    0 < (2 * y - x) mod 3
  then 0
  else comb ((x + y) / 3) ((2 * x - y) / 3)


Measured memory_bytes: 8320
Imports System

Module Program
    Sub Main(args As String())
        Dim tmpA As String() = Split(Console.ReadLine(), " ")
        Dim tmpB As String() = Split(Console.ReadLine(), " ")
        Dim StringU As String = Console.ReadLine()

        Dim StringS As String = tmpA(0)
        Dim StringT As String = tmpA(1)
        Dim IntA As Integer = CInt(tmpB(0))
        Dim IntB As Integer = CInt(tmpB(1))

        If StringU = StringS Then
            IntA = IntA - 1
        Else
            IntB = IntB - 1
        End If

        Console.WriteLine(IntA & " " & IntB)

    End Sub
End Module


Measured memory_bytes: 20304
nn = 2002002
P = 10**9+7
fa = [1]
for i in range(1, nn): fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P-2, P)]
for i in range(1, nn)[::-1]: fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]
f = lambda a, b: fa[a+b+2] * fainv[a+1] * fainv[b+1] % P - 1
r1, c1, r2, c2 = map(int, input().split())
print((f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)) % P)

Measured memory_bytes: 177196
#include "iostream"
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <cctype>
#include <stack>
#include <vector>
#include <list>
#include <queue>
using namespace std;
using ll=long long;
#define mod  1000000007

int main(int argc, char const *argv[]) {
  int n,a[100],A=0,B=0;
  std::cin >> n;
  for(int i=0; i<n; i++) std::cin >> a[i];
  sort(a,a+n,greater<int>());
  for(int i=0; i<n; i++){
    if(i%2==0) A+=a[i];
    else B+=a[i];
  }

  std::cout << A-B << '\n';
  
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

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

    vector<string> M(100, string(100, '.'));
    for (int i = 0; i < 100; i++) for (int j = 50; j < 100; j++) M[i][j] = '#';

    A--, B--;

    for (int i = 0; i < A; i++) {
        int x = (i % 24) * 2;
        int y = (i / 24) * 2;
        M[y][x + 51] = '.';
    }

    for (int i = 0; i < B; i++) {
        int x = (i % 24) * 2;
        int y = (i / 24) * 2;
        M[y][x + 1] = '#';
    }

    cout << 100 << " " << 100 << endl;
    for (int i = 0; i < M.size(); i++) cout << M[i] << endl;

    return 0;
}








































Measured memory_bytes: 256
import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static ArrayList<String> strList = new ArrayList<String>();
	static ArrayList<String> strList2 = new ArrayList<String>();
	static ArrayList<Integer> intList = new ArrayList<Integer>();
	static HashMap<String,Integer> Hmap = new HashMap<String,Integer>();
	public static void main(String[] args) {

		String str = sc.next();
		int a1,a2,a3;
		int ans;

		a1 = Integer.parseInt(str);
      
		a2 = a1*a1;
		a3 = a1*a1*a1;

		ans = a1+a2+a3;
		System.out.println(ans);

	}

}



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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int c=1,ans=0;
    rep(i,n){
        if(a[i]==c){
            ++c;
            continue;
        }else{
            ++ans;
        }
    }
    if(ans==n){
        cout << "-1" << "\n";
    }else{
        cout << ans << "\n";
    }
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 100005;
int n, v[N];
LL x[N], c;
LL dp[N][2],pre[N],suf[N];
void solve() {
	for(int i=1; i<=n; i++) {
		pre[i]=pre[i-1]+v[i];
		dp[i][0]=max(dp[i-1][0], pre[i]-x[i]);
		//cout << i << " 0 " << dp[i][0] << endl; 
	}
	for(int i=n; i>=1; i--) {
		suf[i]=suf[i+1]+v[i];
		dp[i][1]=max(dp[i+1][1], suf[i]-(c-x[i]));
	}
	LL ans = max({0LL,dp[n][0],dp[1][1]});
	for(int i=1; i<=n; i++) {
		ans=max(ans, dp[i][0]+suf[i+1]-2*(c-x[i+1]));
	}
	for(int i=n; i>=1; i--) {
		ans=max(ans, dp[i][1]+pre[i-1]-2*x[i-1]);
	}
	printf("%lld\n",ans);
}
int main() {
	scanf("%d%lld",&n,&c);
	for(int i=1; i<=n; i++) {
		scanf("%lld%d",&x[i],&v[i]);
	}
	solve();
	return 0;
}

Measured memory_bytes: 4608
import numpy as np
from itertools import product
H, W, K = map(int, input().split())

C = [None] * H
for i in range(H):
    C[i] = input()

np_c = np.zeros((H, W), dtype=int)
for i in range(H):
    for j in range(W):
        if C[i][j] == "#":
            np_c[i][j] = 1


ans = 0
for h_bin in product([True, False], repeat = H):
    for w_bin in product([True, False], repeat = W):
        copy_array = np_c.copy()
        for i, h in enumerate(h_bin):
            for j, w in enumerate(w_bin):
                if h:
                    copy_array[i, :] = 0
                if w:
                    copy_array[:, j] = 0
        if copy_array.sum() == K:
            ans += 1

print(ans)


Measured memory_bytes: 27296
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int main() {
  ll n, a;
  vector<ll> v(n);
  map<ll, ll> mp;
  cin >> n;
  rep(i,n)
  {
    cin >> a;
    mp[a]++;
    v[i] = a;
  }
  ll all = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    ll b = itr->second;
    all += b * (b - 1) / 2;
  }
  rep(i,n)
  {
    cout << all - (mp[v[i]] - 1) << endl;
  }
}

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

using namespace std;

int main() {
	string s, p = "ACGT";
	map<char, int> mp;
	for (char c : p) mp[c] = 1;
	cin >> s;
	s = s + '.';
	int tmp = 0, res = 0;
	for (char c : s)
		if (!mp[c]) { res = max(res, tmp); tmp = 0; }
		else tmp++;
	cout << res;
	return 0;
}


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

long long int COM(long long int n){
    if (n < 2) return 0;
	return n*(n-1)/2;
}

int main(){
	long long int N,A[200000],B[200001]={0},sum=0;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
		B[A[i]]++;
	}
	for(int i=1;i<=N;i++)sum+=COM(B[i]);
	for(int i=0;i<N;i++){
		cout<<sum-COM(B[A[i]])+COM(B[A[i]]-1)<<endl;
	}
	return 0;
}

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;

#define NIL NULL

void insert(int);
void inorder(Node);
void preorder(Node);

Node root;

int main(){

  int n, i, x;
  char com[20];

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
  
    if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } 
  }

  return 0;
}

void insert(int k){

  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

 
  while(x != NIL){

    y = x;

    if(z->key < x->key){
      x = x->left;
    }

    else{
      x = x->right;
    }
  }

  z->parent = y;

  if(y == NIL){
    root = z;
  }

  else if(z->key < y->key){
    y->left = z;
  }

  else y->right = z;

}

void inorder(Node u){

  if(u != NIL){
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }

}

void preorder(Node u){

  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }

}

Measured memory_bytes: 24036
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
using namespace std;
using namespace boost;
main() {
  int n;
  cin >> n;
  int m = -1, ans = 0;
  for (auto i : irange(0, n)) {
    int p;
    cin >> p;
    m = max(p, m);
    ans += p;
  }
  ans -= m/2;
  cout << ans << endl;
}
  

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

using namespace std;

#define ll long long int
const int mod = 1e9 + 7;

int main() {
    //code
    string s,t;
    cin>>s>>t;
    int n,m;
    n = s.length();
    m = t.length();
    vector<vector<int>> dp(n+1,vector<int>(m+1,0));
    for(int i = n-1; i>=0;i--){
        for(int j = m-1 ; j>=0; j--){
            if(s[i]==t[j]){
                dp[i][j] = 1 + dp[i+1][j+1];
            }
            else{
                dp[i][j] = max(dp[i+1][j],dp[i][j+1]);
            }
        }
    }

    int i = 0;
    int j = 0;
    string ans = "";
    while(i<n and j<m){
        if(s[i]==t[j]){
            ans += s[i];
            i++,j++;
        }
        else{
            int a = i + 1,b = j;
            if(dp[a][b]<dp[i][j+1])a = i,b = j + 1;
            i = a,j = b;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 38576
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;
 
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 = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 

vll dp(100100);

ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    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;
    }
}
 
 
#define comuse Comuse()
 
ll combi(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;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  	ci(n);
  ll count=0;
  ll ans=0;
  ll left;
  	ci(left);
  
  FOR(i,1,n){
    ll right;
    	ci(right);
    if(left>=right){
      count++;
    }
    else{
      chmax(ans,count);
      count=0;
    }
    left=right;
  }
  chmax(ans,count);
  co(ans)
}

Measured memory_bytes: 1024
#include <stdio.h>
int main (){
    int n,s[10001],i,q,t[500],j,cnt=0;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    scanf("%d",&q);
    for(i=0;i<q;i++){
        scanf("%d",&t[i]);
    }
    for(i=0;i<q;i++){
        j=0;
        s[n]=t[i];
        while(s[j]!=t[i]){
            j++;
        }
        if(j!=n){
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}



Measured memory_bytes: 2108
n, m, q = map(int, input().split())
start_goal = [[0]*n for _ in range(n)]
for _ in range(m):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    start_goal[l][r] += 1
#print(start_goal)

#2次元累積和
s_2 = [[0]*(n+1) for _ in range(n+1)]
for i in range(n):
    for j in range(n):
        s_2[i+1][j+1] = s_2[i][j+1] + s_2[i+1][j] - s_2[i][j] + start_goal[i][j]
#print(s_2)

for _ in range(q):
    l, r = map(int, input().split())
    ans = s_2[n][r] - s_2[l-1][r]
    print(ans)


Measured memory_bytes: 80040
s = input()
lib = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

if s[0] == "A" and "C" in s[2:-1]:
	idx = s.index("C")
	for i in range(1,len(s)):
		if i == idx:
			continue
		elif s[i] in lib:
			print("WA")
			break
	else:
		print("AC")

else:
	print("WA")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,k,turn;
	scanf("%d%d%d%d",&a,&b,&c,&k);
	for(;;)
	{
		if(b<=a)
		{
			b*=2;
			turn++;
		}
		else
		{
			break;
		}
	}
	for(;;)
	{
		if(c<=b)
		{
			c*=2;
			turn++;
		}
		else
		{
			break;
		}
	}
	if(turn<=k)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
}

Measured memory_bytes: 3808
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author dyominov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARoundUpTheMean solver = new ARoundUpTheMean();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARoundUpTheMean {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            out.print((int) Math.ceil((in.nextInt() + in.nextInt() + 0.0) / 2));
        }

    }

    static class InputReader implements AutoCloseable {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public void close() {
        }

    }
}



Measured memory_bytes: 23252
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
string s[n];
for(int i=0;i<n;i++)
{
cin>>s[i];
}
ll dp[n][m]={};
for(int i=0;i<n;i++)
{
dp[i][0]=1;
if(s[i][0]=='#')
{
for(i;i<n;i++)
{
dp[i][0]=0;
}
}
}
for(int i=0;i<m;i++)
{
dp[0][i]=1;
if(s[0][i]=='#')
{
for(i;i<m;i++)
{
dp[0][i]=0;
}
}
}

for(int i=1;i<n;i++)
{
for(int o=1;o<m;o++)
{
dp[i][o]=0;
if(s[i][o]!='#')
{
dp[i][o]=(dp[i-1][o]+dp[i][o-1])%mod;
}
}
}
cout<<dp[n-1][m-1]%mod<<endl;
}


Measured memory_bytes: 9088