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

using namespace std;
using ll = long long;
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void initio() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() { initio();
  int H, W, K; cin >> H >> W >> K;
  vector<string> S(H); rep(i, H) cin >> S[i];
  vector<vector<int>> color(H, vector<int>(W, -1));
  int k = 0;
  rep(i, H) rep(j, W) if (S[i][j] == '#') {
    color[i][j] = ++k;
  }
  repr(i, H - 1) rep(j, W) if (color[i][j] == -1) {
    color[i][j] = color[i + 1][j];
  }
  rep(i, H - 1) rep(j, W) if (color[i + 1][j] == -1) {
    color[i + 1][j] = color[i][j];
  }
  rep(i, H) repr(j, W - 1) if (color[i][j] == -1) {
    color[i][j] = color[i][j + 1];
  }
  rep(i, H) rep(j, W - 1) if (color[i][j + 1] == -1) {
    color[i][j + 1] = color[i][j];
  }
  rep(i, H) rep(j, W) cout << color[i][j] << " \n"[j == W - 1];
}


Measured memory_bytes: 1280
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long ll;

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



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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int x;
    cin >> x;
    vector<bool> prime(100004);
    prime[100003] = true;
    rep (i, 100001) {
        if (isPrime(i)) prime[i] = true;
        else prime[i] = false;
    }
    FOR (i, x, 100004) {
        if (prime[i]) {
            cout << i << endl;
            return 0;
        }
    }
    
    return 0;
}



Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <functional>
#include <cstring>
#include <queue>
#include <cmath>
#include <deque>
#include <list>
#include <iomanip>
#include <fstream>
#include <string>
#include <iterator>
#include <set>
#include <bitset>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
#define mp make_pair
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, N) FOR(i, 0, N)
#define SZ(x) ((int)(x).size())

const int MAXN = 100007, MOD = 1000000007;

int main()
{	
	int p = 0;
	char cur;
	string a, b;
	set <char> s;
	cin >> a;
	for (int i = SZ(a) - 1; i >= -1; --i){
		if (SZ(s) == 0){
			for (char c = 'a'; c <= 'z'; ++c)
				s.insert(c);
		}
		b.push_back(*s.begin());
		if (i >= 0) s.erase(a[i]);
	}
	reverse(b.begin(), b.end());
	while (p <= SZ(a)){
		cur = b[p];
		while (p < SZ(a) && a[p] != cur) ++p;
		cout << cur;
		++p;
	}
	//cout << endl; system("pause");//please
	return 0;
}

Measured memory_bytes: 780
class Dice
  def initialize(t,s,e,w,n,b)
    @all = [ [t,s,e,w,n,b],[t,e,n,s,w,b],[t,n,w,e,s,b],[t,w,s,n,e,b],
             [s,t,w,e,b,n],[s,w,b,t,e,n],[s,b,e,w,t,n],[s,e,t,b,w,n],
             [e,t,s,n,b,w],[e,s,b,t,n,w],[e,b,n,s,t,w],[e,n,t,b,s,w],
             [w,t,n,s,b,e],[w,n,b,t,s,e],[w,b,s,n,t,e],[w,s,t,b,n,e],
             [n,t,e,w,b,s],[n,e,b,t,w,s],[n,b,w,e,t,s],[n,w,t,b,e,s],
             [b,s,w,e,n,t],[b,w,n,s,e,t],[b,n,e,w,s,t],[b,e,s,n,w,t] ]
    @val = @all.map{|v| v.join(",")}.min
  end
  def val
    return @val
  end
end

d = []
flag = false
t,s,e,w,n,b = gets.chomp.split(" ").map{|x| x.to_i}
d1 = Dice.new(t,s,e,w,n,b)
t,s,e,w,n,b = gets.chomp.split(" ").map{|x| x.to_i}
d2 = Dice.new(t,s,e,w,n,b)
if d1.val == d2.val
  printf("Yes\n")
else
  printf("No\n")
end


Measured memory_bytes: 8920
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int a, b; string op;
	cin >> a >> op >> b;
	if (op == "+") {
		cout << a + b << endl;
		return 0;
	}
	else if (op == "-") {
		cout << a - b << endl;
		return 0;
	}
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define nl "\n" 

int combi(int n){
	return (n*(n-1))/2;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,m;
    cin >> n >> m;
    int ans = combi(n)+combi(m);
    cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

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

    ll ans = 0;
    for (ll i = 1; ll(i * i) <= N; i++) {
        if (N % i == 0) {
            ll m = i - 1;
            if (m != 0 && N / m == N % m) {
                ans += m;
            }
            m = (N / i) - 1;
            if (m != 0 && N / m == N % m) {
                ans += m;
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
// All Heil Fire Lord Zuko

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

typedef long long LL;

const int N = 1000 * 1000 + 19;

int n;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n;
    LL ans = 0, cnt = 1;
    for (int i = 0; i < n; i++) {
        LL a;
        cin >> a;
        if (i == 0)
            ans += a - 1;
        else if (a == cnt + 1)
            cnt++;
        else if (a > cnt + 1)
            ans += (a - 1) / (cnt + 1);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<deque>
#include<cstdlib>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<iomanip>
#include<sstream>
using namespace std;

#define pi acos(-1.0)
#define ms(x,n) memset(x,n,sizeof(x));

typedef long long ll;//string::npos
typedef long long iint;

ll gcd(ll a,ll b) {
	return a%b==0?b:gcd(b,a%b);
}
ll lcm(ll x,ll y) {
	ll z=gcd(x,y);
	return x*y/z;
}

const int MAXX=2e5+5;
const int INF=1e7+5;
const int mod=998244353;

//vector<int> vt;
//pair<int,int> p;
//map<int,int> m;
int cmp(int x,int y){
	return x>y;
}
ll sum=0,x,y,a,b,c;
ll q[MAXX],w[MAXX],e[MAXX];
int main() {
	ios::sync_with_stdio(false);
	cin>>x>>y>>a>>b>>c;
	for(int i=1;i<=a;i++){
		cin>>q[i];
	}
	for(int i=1;i<=b;i++){
		cin>>w[i];
	}
	for(int i=1;i<=c;i++){
		cin>>e[i];
	}
	sort(q+1,q+1+a,cmp);
	sort(w+1,w+1+b,cmp);
	sort(e+1,e+1+c,cmp);
	for(int i=1;i<=x;i++){
		sum+=q[i];
	}
	for(int i=1;i<=y;i++){
		sum+=w[i];
	}
	int qq=x,ww=y,ee=1;
	for(int i=1;i<=c;i++){
		if(e[i]>q[qq]&&e[i]>w[ww]){
			if(q[qq]>w[ww]){
				if(ww>=1){
					sum-=w[ww--];sum+=e[i];
				}else if(qq>=1){
					sum-=q[qq--];sum+=e[i];
				}else{
					break;
				}
			}else if(q[qq]<=w[ww]){
				if(qq>=1){
					sum-=q[qq--];sum+=e[i];
				}else if(ww>=1){
					sum-=w[ww--];sum+=e[i];
				}else{
					break;
				}
			}
		}else if(e[i]>q[qq]&&e[i]<=w[ww]&&qq>=1){
			sum-=q[qq--];
			sum+=e[i];
		}else if(e[i]>w[ww]&&e[i]<=q[qq]&&ww>=1){
			sum-=w[ww--];
			sum+=e[i];
		}else{
			break;
		}
	}
	cout<<sum<<endl;
	
	
	return 0;
}



Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <iomanip>
#include <queue>
#include <functional>
#include <cassert>
#include <cmath>

using namespace std;
using ll = unsigned long long;

int main() {

	int n;
	int ame[2][110] = { 0 };

	cin >> n;

	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < n; j++) {
			cin >> ame[i][j];
		}
	}

	int sum[110] = { 0 };
	int sum2[110] = { 0 };

	sum[0] = ame[0][0];
	sum2[n - 1] = ame[1][n - 1];

	for (int i = 1; i < n; i++) {
		sum[i] = sum[i - 1] + ame[0][i];
		sum2[n - i - 1] = sum2[n - i] + ame[1][n - i - 1];
	}

	int ans = -1;
	for (int i = 0; i < n; i++) {
		ans = max(ans, sum[i] + sum2[i]);
	}

	cout << ans << endl;

		
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#define rep(i) for(int i=0;i<=1;i++)
using namespace std;

vector<int> used(10);
map<vector<int>,int> u;

int n,s,c;
void walk(int now,int dep){
	if(dep==n){
		if(s==now)u[used]=1;
		return;
	}
	for(int i=0;i<=9;i++){
		if(!used[i]){
			used[i]=1;
			walk(now+i,dep+1);
			used[i]=0;
		}
	}
	return;
}
int main(void){
	while(cin>>n>>s,n||s){
		c=0;
		u.clear();
		for(int i=0;i<10;i++)used[i]=0;
		walk(0,0);
		cout<<u.size()<<endl;
	}
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  int j =0;

  // ここにプログラムを追記
  for (int i = 0; i < N; i++){
    int l , r;
    cin >> l >> r;
    j = j + r - l + 1;
  }
  cout << j << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  if(a>=13){
    cout << b << endl;
  }
  else if(6 <= a&& a <= 12){
    cout << b/2 <<endl;
  }
  else{
    cout << 0 <<endl;
  }

}

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

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

  int ans = 0;
  if (!(N % 10)) ans = 10;
  else {
    while (N > 0) {
      ans += N % 10;
      N /= 10;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
// E - Almost Everywhere Zero
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
string N;
int K;
int lt = 0, eq = 1;//lt: <, eq: =
int dp[101][2][4];// digit DP, [|N|+1: 1 origin][lt|eq][k:0~3]

void update(int i, int k, int di){
	dp[i+1][lt][k] = dp[i][lt][k] * 1 + dp[i][eq][k] * (di?1:0);
	if(k) dp[i+1][lt][k] += dp[i][lt][k-1] * 9 + dp[i][eq][k-1] * max(0,di-1);
	if(dp[i][eq][k]) dp[i+1][eq][k+(di>0)] = 1;
}

int main(){
	cin>>N>>K;
	int dn = N.size();
	dp[0][eq][0] = 1;
	rp(i,0,dn) rp(k,0,K+1) update(i, k, N[i]-'0');
	cout<< dp[dn][lt][K] + dp[dn][eq][K] <<endl;
}

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

int main(){

  int n;
  cin >>n;
  
  vector<int> d(n);
  for(int i=0;i<n;i++){
  cin >>d.at(i);
  }
  
  int sum=0;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      sum+=d.at(i)*d.at(j);
    }

  }
      cout<<sum<<endl;
  return(0);
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int A,B,C,D;
	cin >>A>>B>>C>>D;
	//Left side A&B// //Right side C&D
	
	if (A+B>C+D){
		cout << "Left" <<endl;
	}

	else if (A+B==C+D){
		cout << "Balanced"<<endl;
	}
	else if(A+B<C+D){
		cout <<"Right"<<endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	long long unsigned int a, b, a_origin, b_origin, tmp, gcd, lcm;
	while( scanf("%llu %llu", &a, &b) != EOF )
	{
		a_origin = a;
		b_origin = b;
		
		//最大公約数GCDを求める
		//ユークリッドの互除法
		while(a % b != 0)
		{
			tmp = b;
			b = a % b;
			a = tmp;
		}
		gcd = b;
		
		//最小公倍数LCMを求める
		//LCM == (a * b) / GCD
		lcm = (a_origin * b_origin) / gcd;
		
		printf("%llu %llu\n", gcd, lcm);
	}
	
	return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;



int main(){
    ll N, A, B, C, D, E; cin >> N >> A >> B >> C >> D >> E;
    ll Min = min(A, min(B, min(C, min(D, E))));
    int parity = 0;
    if(N % Min != 0) parity = 1;
    cout << N / Min + parity + 4 << endl;


}

Measured memory_bytes: 3556
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace AtCoder_Core
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim().Split(' ').Select(n => int.Parse(n)).ToArray();
            int N = line[0];
            int M = line[1];
            switch (N == M)
            {
                case true:
                    Console.WriteLine("Yes");
                    break;
                case false:
                    Console.WriteLine("No");
                    break;
            }

        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int K, A, B;
    cin >> K >> A >> B;
    rep2(i, A, B){
        if(i%K == 0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3636
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------
int dp[1<<21];
int cnt[21][100010];
int ccnt[21];
//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll n,c,k;cin>>n>>c>>k;
    V<ll>t(n);
    for(ll i=0;i<n;i++)cin>>t[i];
    sort(all(t));
    ll ans=0;
    bool abc=0;ll now=0;ll people=0;
    for(ll i=0;i<n;i++){
        if(abc==0){
            abc=1;
            now=t[i]+k;
            people=1;
            ans++;
            //cout<<i+1<<endl;
        }
        else{
            if(people<c){
                if(t[i]<=now){
                    people++;
                }
                else{
                    abc=0;
                    i--;
                    continue;
                }
            }
            else{
                abc=0;
                i--;
                continue;
            }

        }
    }
    cout<<ans<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

































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

using namespace std;

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

    int n = s.length() - 1;
    int m = 0;

    for (int i = 1; i <= n / 2; i++) {
        for (int j = 0; j < i; j++) {
            if (s[j] != s[i+j]) break;
            if (j == i - 1) m = i;
        }
    }

    cout << m * 2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=1005;
int dp[N][N],n,M,tot,ans;
struct Ask{
	int x,y,z,to;
}A[N];
int cmp(Ask x,Ask y){
	return x.x<y.x||(x.x==y.x&&x.to<y.to);
}
signed main(){
	scanf("%lld%lld",&n,&M);
	for (int i=0;i<n;i++){
		A[++tot].x=(int)sqrt(n*n-i*i-1)+1;
		A[tot].y=1;
		A[tot].to=i==0?2*n:(int)sqrt(4*n*n-i*i)+1;
		A[++tot].x=(int)sqrt(4*n*n-(i+n)*(i+n))+1;
		A[tot].y=2;
	}
	sort(A+1,A+tot+1,cmp);
	for (int i=1;i<=tot;i++){
		A[i].z=A[i-1].z;
		if (A[i].y==2)A[i].z++;
		else A[i].to-=i-1-A[i].z;
	}
	for (int k=0;k<=n;k++){
		memset(dp,0,sizeof dp);
		dp[0][0]=1;
		for (int i=1;i<=tot;i++)
			for (int j=0;j<=i;j++){
				if (A[i].y==1){
					if (j)(dp[i][j]+=(M-1)*dp[i-1][j-1]%M*(A[i].x-j+1-A[i].z))%=M;
					(dp[i][j]+=dp[i-1][j]*(A[i].to-(k-j)-A[tot].z))%=M;
				}
				if (A[i].y==2)
					if ((A[i].x-A[i].z+1-j)>0)(dp[i][j]+=dp[i-1][j]*(A[i].x-A[i].z+1-j))%=M;
			}
		(ans+=dp[tot][k])%=M;	
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 8192
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
ans = a.inject(:+)
hash = Hash.new(0)
aa = a.size
(0..aa-1).each do |i|
    hash[a[i]] += 1
end
q = gets.chomp.to_i
q.times do 
    all = []
    b,c = gets.chomp.split(" ").map(&:to_i)
    hash[c] += hash[b]
    kari = hash[b]
    hash[b] = 0
   ans = ans + kari * c -  kari * b
    puts ans
end

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

vector<P> prime_factorize(ll n) {
    vector<P> res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}



int main(){
	int n; cin >> n;
        int  ans = 0;
	for(int i = 1; i <= n; i+=2){
	    auto vec = prime_factorize(i);
	    int tmp = 1;
	    for(auto it : vec){
		    tmp *= (it.second+1);
        }
        if(tmp==8){
++ans;
        }
	}
cout << ans << endl;
	
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>   
 
#define rep(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007
#define N 200005
#define se second
#define fi first
#define pie 3.14159265359
#define pll pair<ll,ll> 
#define pb push_back
#define sz(x) (int)x.size()
#define endl "\n"
 
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
 
typedef long long ll;
using namespace std;

void solve(){
 	ll n;
 	cin >> n;
 	cout << n*n*n << "\n"; 
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int tc=1;
	//cin>>tc;
	while(tc--)solve();
    return 0;
}

Measured memory_bytes: 256
public class Main {
	public static void main(String args[]) {
		java.util.Scanner sc = new java.util.Scanner(System.in);
		double N = sc.nextInt();

		double X = (double) 100 / 108;

		int result = (int) Math.floor(X * N);

		if (Math.floor(result * 1.08) == N) {
			System.out.println(result);
		} else if (Math.floor((result + 1) * 1.08) == N) {
			System.out.println(result + 1);
		} else {
			System.out.println(":(");

		}

	}
}

Measured memory_bytes: 21844
n, q = (int(i) for i in input().split())
s = input()
cnt, ans = 0, 0

ac_accumulate = [0] * n
preva = False

for i, c in enumerate(s):
  if preva:
    if c == 'C':
      ac_accumulate[i] = ac_accumulate[i-1]+1
      preva = False
      continue
  preva = False
  if c == 'A': preva = True
  if i == 0: ac_accumulate[i] = 0
  else: ac_accumulate[i] = ac_accumulate[i-1]

for i in range(q):
  l, r = (int(i) for i in input().split())
  print(ac_accumulate[r-1] - ac_accumulate[l-1])

Measured memory_bytes: 6084
#include<iostream>
using namespace std;
int main()
{
	int a[100000], b[100000];
	int i,j,r,d;
	for (i = 0; i < 98000; i++){
		cin >> a[i] >> b[i];
		if (a[i] == 0 && b[i] == 0){
			j = i;
			break;
		}
	}
	for (i = 0; i < j; i++){
		for (r=0;r<a[i];r++){
			for (d=0;d<b[i];d++){
				cout << "#";
			}
			cout << endl;
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: i64 = s.next().unwrap().parse().unwrap();
	let a: i64 = s.next().unwrap().parse().unwrap();
	let b: i64 = s.next().unwrap().parse().unwrap();
	let q = n / (a + b);
	let r = n % (a + b);
	println!("{}", q * a + std::cmp::min(r, a));
}


Measured memory_bytes: 4352
import java.util.*;

public class Main {


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

        String S = sc.next();

        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        StringBuilder sb3 = new StringBuilder();

        sb1.append(S);

        for (int i = 0; i < ((S.length()-1)/2); i++) {
            sb2.append(S.charAt(i));
        }

        for (int i = 0; i < ((S.length()-1)/2); i++) {
            sb3.append(S.charAt((S.length()+1)/2 + i));
        }

        if (sb1.toString().equals(sb1.reverse().toString()) &&
                sb2.toString().equals(sb2.reverse().toString()) &&
                sb3.toString().equals(sb3.reverse().toString()))
        {
            System.out.println("Yes");
            return;
        }

        System.out.println("No");

        sc.close();
    }


}

Measured memory_bytes: 23636
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
using namespace std;

#define ll long long
#define mst(a) memset(a, 0, sizeof a)

const int mod = 1e9+7;
const int maxn = 1e5+50;
const int inf = 1e9;

int main()
{
    //freopen("in", "r", stdin);
    ll n, k;
    cin >> n >> k;
    ll ans = (n/k) * (n/k) * (n/k);
    if ((k & 1) == 0)
    {
        ll tmp = (n + k/2) / k;
        ans += tmp * tmp * tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
  string S; cin >> S;
  int K; cin >> K;
  vector<int> a;
  REP(i, S.size()) {
    int num = S[i] - 'a';
    a.PB((26 - num) % 26);
  }

  REP(i, S.size()) {
    if (a[i] <= K) {
      K -= a[i];
      S[i] = 'a';
    }
  }
  S.back() = (S.back() - 'a' + K) % 26 + 'a';
  cout << S << endl;

  return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int gcd(int a, int b)
{
	if (b == 0)
	{
		return a;
	}

	return gcd(b, a % b);
}

int main()
{
	int w, h, c;
	cin >> w >> h >> c;

	int gcd_num = gcd(h, w);
	cout << (h / gcd_num) * (w / gcd_num) * c << endl;

	return 0;
}



Measured memory_bytes: 3108
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;

map<int, int> book;

int a[5][5];
int nx[4][2] = { 0,1,1,0,0,-1,-1,0 };

struct node
{
	int x, y, step;
	int aa[5][5];
};

node getnode(int x, int y, int step, int aa[5][5])
{
	node q;
	q.x = x;
	q.y = y;
	q.step = step;
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			q.aa[i][j] = aa[i][j];
		}
	}
	return q;
}

void bfs(int x, int y, int step, int aa[5][5])
{
	queue<node> q;
	node p;
	q.push(getnode(x, y, step, aa));
	while (!q.empty())
	{

		for (int i = 0; i < 4; i++)
		{
			int tx = q.front().x + nx[i][0];
			int ty = q.front().y + nx[i][1];
			if (tx >= 0 && tx < 3 && ty >= 0 && ty < 3)
			{
				//memcpy(p.aa,q.front().aa,sizeof(q.front().aa));
				for (int i = 0; i < 3; i++)
				{
					for (int j = 0; j < 3; j++)
					{
						p.aa[i][j] = q.front().aa[i][j];
					}
				}

				//				printf("******\n");
				//				for(int i=0;i<3;i++)
				//				{
				//					for(int j=0;j<3;j++)
				//					{
				//						printf("%d ",p.aa[i][j]);
				//					}
				//					printf("\n");
				//				}
				swap(p.aa[q.front().x][q.front().y], p.aa[tx][ty]);
				int sum = 0;
				for (int i = 0; i < 3; i++)
				{
					for (int j = 0; j < 3; j++)
					{
						sum = sum * 10 + p.aa[i][j];
					}
				}
				//				printf("sum===%d\n",sum);


				if (sum == 123456780)
				{
					printf("%d\n", q.front().step + 1);
					return;
				}



				if (!book[sum])
				{
					book[sum] = 1;
					q.push(getnode(tx, ty, q.front().step + 1, p.aa));
				}
			}
		}
		q.pop();
	}
}

int main()
{
	while (~scanf("%d%d%d", &a[0][0], &a[0][1], &a[0][2]))
	{
		for (int i = 1; i < 3; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				scanf("%d", &a[i][j]);
			}
		}

		int sum = 0, x1, y1;
		for (int i = 0; i < 3; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				sum = sum * 10 + a[i][j];
				if (a[i][j] == 0)
				{
					x1 = i;
					y1 = j;
				}
			}
		}
		if (sum == 123456780)
		{
			printf("0\n");
			continue;
		}
		book.clear();
		book[sum] = 1;
		bfs(x1, y1, 0, a);
	}
	return 0;
}


Measured memory_bytes: 12876
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  REP(i, n) cin >> p[i];
  int ans = 0;
  for (int i = 1; i < n - 1; ++i) {
    if (p[i - 1] < p[i] && p[i] < p[i + 1]) ans++;
    if (p[i - 1] > p[i] && p[i] > p[i + 1]) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
typedef long long lint;
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 (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

int main()
{
    int place[5];
    rep(i, 5)
    {
        cin >> place[i];
    }
    int k;
    cin >> k;
    if (place[4] - place[0] > k)
    {
        cout << ":(" << endl;
    }
    else
    {
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


int main()
{
	ll a;
	ld b;
	cin >> a >> b;

	ll c = (ll)(b * 100.0 + 0.5);
	println((a * c) / 100);
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
 
#define for0(i, n) for (int i = 0; i < (int)(n); ++i) 
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define forc(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i) 
#define forr0(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forr1(i, n) for (int i = (int)(n); i >= 1; --i)
#define deb(x) cout << #x << "= " << x << endl
#define pb push_back
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(x) for(auto it = x.begin(); x != x.end(); it++)
#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD 1000000007
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef double ld;
 
int main() {
    fast;
    int t=1;
    while(t--){
        //begin code here
        int n;
        cin>>n;
        int arr[n]; int x;
        int free=0;
        int count[8]={0};
        for0(i,n){
            cin>>x;
            if(x>=3200){
                free++;
                continue;
            }
            else{
                count[x/400]=1;
            }
        }
        int ans=0;
        for0(i,8){
            if(count[i]>0){
                ans++;
            }
        }
       if(ans==0){
        cout << 1 << " " << ans+free;
       }
        else{
          cout << ans << " " << ans+free;
        }
    }
}

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

int main() {
  int n;
  vector<int> d;

  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp_d;
    cin >> tmp_d;
    d.push_back(tmp_d);
  }

  sort(d.begin(), d.end(), greater<int>());

  int counter = 1;
  int lower = d[0];
  for (int i = 1; i < n; i++) {
    if (d[i] == lower) {
      // skip
    } else {
      counter++;
      lower = d[i];
    }
  }
  cout << counter << endl;
  return 0;
}


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

using namespace std;

int n,ans;
char ch[30];

int main(){

	cin >> n >> ch;
	int len = strlen(ch);
	while(n--){
		char s[110];
		cin >> s;
		int na = strlen(s);
		for(int st = 0;st < na;st++){
			for(int kan = 1;kan < na;kan++){
				for(int i = 0;i < len;i++){
					if(st+i*kan > na || s[st+i*kan] != ch[i])goto out;
				}
				ans++;
				goto heven;
				out:
				;
			}
		}
		heven:
		;
	}
	cout << ans << endl;
	return 0;
}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	int cost;
} edge;

int main( void ){
	// initialize();
	int A, B, K;
	cin >> K >> A>> B;
	rep(i,A, B+1){
		if (i%K == 0){
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 3544
import numpy as np

D = int(input())
c = list(map(int, input().split()))
c = np.array(c)
S = np.zeros([D, 26], dtype=int)
for i in range(D):
  S[i, :] = list(map(int, input().split()))

last = np.zeros(26)

#SCORE = 0
DOWN = 0

T = []
for i in range(D):
    score = S[i, :] - DOWN
    argmax = score.argmax()
    t = argmax+1
    last[t-1] = i+1
    T.append(t)
    temp = (i+1-last)*np.array(c)
    down = (temp).sum()
    down = int(down)
    DOWN += down

#score_plus = 0
T_modified = T
for i in range(5000):
    p = np.random.randint(1, 1+D)
    q1 = T[p-1]
    q2 = np.random.randint(1, 27)
    plus, minus = 0, 0
    flag1, flag2 = 1,1
    for j in range(p+1, 1+D):
        if T[j-1] != q2:
            plus += flag1
        elif T[j-1] != q1:
            minus += flag2
        elif T[j-1] == q2:
            flag1 = 0
        elif T[j-1] == q1:
            flag2 = 0
        if flag1 + flag2 == 0:
            break
    
    s = plus*c[q2-1] - minus*c[q1-1] + S[p-1, q2-1] - S[p-1, q2-1]
    if s > 0:
        T_modified[p-1] = q2
        #score_plus += s

for i in range(D):
  print(T_modified[i])

Measured memory_bytes: 27424
fun main(args: Array<String>) {
    val k = readLine()!!.toInt()
    val (a, b) = readLine()!!.split(" ").map{ it.toInt() }
    
    var f = false

    for(i in a .. b){
        if(i % k == 0) f = true
    }

    println(if(f) "OK" else "NG")

}

Measured memory_bytes: 36488
s = input()

m = {str(i).zfill(2) for i in range(1,13)}
y = {str(i).zfill(2) for i in range(13,100)}

if s[:2] not in m and s[2:] in m:
  print('YYMM')
elif s[:2] in m and s[2:] not in m:
  print('MMYY')
elif s[:2] in m and s[2:] in m:
  print('AMBIGUOUS')
else:
  print('NA')

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;

int main(){
   long long a,b;
   cin>>a>>b;
   long long aa=a-(a-3)%4+1;
   long long bb=b-(b-3)%4+1;
   long long sxa=0;
   long long sxb=0;
   for(long long i=aa;i<=a;i++)sxa=sxa^i;
   for(long long i=bb;i<=b;i++)sxb=sxb^i;
   if(a<4){
       sxa=0;
       for(long long i=0;i<=a;i++)sxa=sxa^i;
   }
   if(b<4){
       sxb=0;
       for(long long i=0;i<=b;i++)sxb=sxb^i;
   }

   long long ans=sxa^sxb^a;
   cout<<ans<<endl;
}

   


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=110000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

ll gcd(ll x, ll y){
  if(x%y==0)return y;
  return gcd(y,x%y);
}
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  string s;
  cin >> s;
  int ans=0;
  for(int i=0,j=s.size()-1;i<j;){
    if(s[i]==s[j]){
      i++;
      j--;
    }
    else if(s[i]=='x'){
      ans++;
      i++;
    }
    else if(s[j]=='x'){
      ans++;
      j--;
    }
    else{
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
    using namespace std;
     int n,a[100006],dp[100006];
     int cal( int x){ 
      if(x==n-1)return 0;
      if(dp[x]!=-1)return dp[x];
      int sol1=1e9;
      int sol2=1e9;
      if(x+1<n)sol1=cal(x+1)+abs(a[x]-a[x+1]);
      if(x+2<n)sol2=cal(x+2)+abs(a[x]-a[x+2]);
      return dp[x]=min(sol1,sol2);
    } 
    int main()
    {
      cin>>n;
      for(int i=0;i<n;i++){ 
          cin>>a[i];
      } 
     
      memset(dp,-1,sizeof dp);
      cout<<cal(0)<<endl;  
     
        
        
     
        return 0;
    }

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

int main()
{
	ios::sync_with_stdio(false);
	string s1,s2,s3;
	cin>>s1>>s2>>s3;
	cout<<s1[0]<<s2[1]<<s3[2]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int N, M, A[312][312];
int seek[312], cou[312], max_comp, max_cou, res, ans;
bool isEnable[312];

int main()
{
	in >> N >> M;
	rep(i, N) { rep(j, M) { in >> A[i][j]; } }

	ans = 114514;
	memset(isEnable, true, sizeof(isEnable));
	rep(foo, M)
	{
		// 各選手先頭の A のスポーツをカウント
		memset(cou, 0, sizeof(cou));
		rep(i, N) { ++cou[A[i][seek[i]]]; }

		// 最も重複しているスポーツ #とは
		max_cou = max_comp = 0;
		rep(i, M)
		{
			if (cou[i + 1] > max_cou)
			{
				max_cou = cou[i + 1];
				max_comp = i + 1;
			}
		}
		ans = std::min(ans, max_cou);
		isEnable[max_comp] = false;

		// 各選手の seek を進める
		rep(i, N)
		{
			while (!isEnable[A[i][seek[i]]])
			{
				++seek[i];
				if (seek[i] == M)
				{
					--seek[i];
					break;
				}
			}
		}
	}

	out << ans << std::endl;
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>

int main()
{
  int year, month, day;
  while (~scanf("%d %d %d", &year, &month, &day)) {
    if (year < 1868 || (year == 1868 && (month < 9 || (month == 9 && day < 8))))
      printf("pre-meiji\n");
    else if (year < 1912 || (year == 1912 && (month < 7 || (month == 7 && day < 30))))
      printf("meiji %d %d %d\n", year-1868+1, month, day);
    else if (year < 1926 || (year == 1926 && (month < 12 || (month == 12 && day < 25))))
      printf("taisho %d %d %d\n", year-1912+1, month, day);
    else if (year < 1989 || (year == 1989 && (month < 1 || (month == 1 && day < 8))))
      printf("showa %d %d %d\n", year-1926+1, month, day);
    else
      printf("heisei %d %d %d\n", year-1989+1, month, day);
  }
  return 0;
}

Measured memory_bytes: 0
# frozen_string_literal: true

a = gets.to_i
arry = gets.split(' ').map(&:to_i)
arry.sort!
memo = arry.each_with_index.inject(0.0) do |memo, (e, i)|
  if i == 0
    memo = (e.to_f + arry[i+1].to_f) / 2.0
    memo
  elsif i == 1
    memo
  else
    memo = (memo.to_f + e.to_f) / 2.0
    memo
  end
end

puts memo


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main(){
	int ans=0;
	string s1,s2;
	cin >> s1 >> s2;
	for(int i=0;i<s1.size();i++){
		if(s1[i]!=s2[i]){
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
} 

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
using ll = long long;

#define N 100005
vector<int> adj[N];
int dp[N];

int dfs(int u, int p = -1) {
    if (dp[u]+1) return dp[u];

    int l = 0;

    for (int v : adj[u]) {
        if (v == p) continue;
        l = max(l, 1 + dfs(v, u));
    }

    return (dp[u] = l);
}

int main() {
    FAST;

    memset(dp, -1, sizeof(dp));

    int n, m, i, u, v, ans = 0;
    cin >> n >> m;

    while (m--) {
        cin >> u >> v;
        --u; --v;
        adj[u].push_back(v);
    }

    for (i = 0; i < n; ++i) {
        if (dp[i] == -1) dfs(i);
        ans = max(ans, dp[i]);
    }

    cout << ans;

    return 0;
}


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

#define lli long long
#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define rep(i,n) for (lli i=0;i<(n);i++)

#define INF LONG_MAX/3
#define PB push_back
#define pb push_back
#define all(a) (a).begin(),(a),end()
#define pll pair<lli,lli>

int main(){
  lli K,T,Max=0;
  lli a[100];
  cin>>K>>T;
  rep(i,T){
    cin>>a[i];
    Max=max(Max,a[i]);
  }

  cout<<max((Max-(K-Max))-1,(lli)0)<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s; cin >> s;
  int sz = s.size();
  if (sz == 5) {
    if (s == "KIHBR") {
      cout << "YES" << '\n';
      return 0;
    }
  } else if (sz == 6) {
    if (s == "AKIHBR" || s == "KIHABR" || s == "KIHBAR" || s == "KIHBRA") {
      cout << "YES" << '\n';
      return 0;
    }
  } else if (sz == 7) {
    if (s == "AKIHABR" || s == "AKIHBAR" || s == "AKIHBRA" || s == "KIHABAR" || s == "KIHABRA" || s == "KIHBARA") {
      cout << "YES" << '\n';
      return 0;
    }
  } else if (sz == 8) {
    if (s == "KIHABARA" || s == "AKIHBARA" || s == "AKIHABRA" || s == "AKIHABAR") {
      cout << "YES" << '\n';
      return 0;
    }
  } else if (sz == 9) {
    if (s == "AKIHABARA") {
      cout << "YES" << '\n';
      return 0;
    }
  }
  cout << "NO" << '\n';
  return 0;
}


Measured memory_bytes: 256
K,X = (int(i) for i in input().split())

ans = []
for i in range(K):
    Y = X - i
    if Y >= -1000000:
        ans.append(Y)
    
for i in range(1,K):
    Y = X + i 
    if Y <= 1000000:
        ans.append(Y)

ans.sort()
print(' '.join(map(str, ans)))

Measured memory_bytes: 3060
//#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
const int MAXN=1e5+9;
const double eps=1e-8;
const long double pi=3.1415926535897932384626433832795;
const long double e=2.71828182845904523536028747135266;
struct AAA{
    int x,y;
    bool operator <(const AAA& a) const{
        return y<a.y;
    }
}a[MAXN];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    while(t--){
        int n;ll ans=0;
        cin >> n;
        for (int i=1;i<=n;i++){
            cin >> a[i].y;
            a[i].x=i;
        }
        sort(a+1,a+1+n);
        for (int i=1;i<=n;i++){
            ans+=abs(a[i].x-i)%2;
        }
        cout << ans/2 << endl;
    } 
    return 0;
}




Measured memory_bytes: 1024
n = int(input())

a = []

for i in range(n):
  a.append([int(x) for x in input().split()])

dp = []
for i in range(n):
  dp.append([0, 0, 0])

for i in range(n):
  for j in range(3):
    if i == 0:
      dp[i][j] = a[i][j]
    else:
      for k in range(3):
        if j != k:
          dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i][j])

print(max(dp[-1]))


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

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

    int2(m, d);

    int ans = 0;
    Rep(i, m+1) {
        for (int j = 1; j <= d; j++) {
            if ( (j / 10) >= 2 && (j % 10) >= 2 && 
                    (j / 10) * (j % 10) == i) {
                ans++;
            }
        }
    }

    std::cout << ans << std::endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

int main() {
    int N; cin >> N;
    map<int, int> mp;
    rep(i, N) {
        int a; cin >> a;
        mp[a]++;
    }
    
    int ans = 0;
    for (auto iter = mp.begin(); iter != mp.end(); iter++) {
        int value = iter -> second;
        if (value & 1) ans++;
    }

    cout << ans << endl;
    return 0;
}


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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W;
    cin >> H >> W;
    vector<vector<int>> a(H,vector<int>(W));
    for (int h=0;h<H;h++){
        for (int w=0;w<W;w++){
            int p;
            cin >> p;
            a[h][w] = p % 2;
        }
    }
    vector<pair<pair<int,int>,pair<int,int>>> ans;
    for (int w=0;w<W;w++){
        for (int h=0;h<H-1;h++){
            if (a[h][w]==1){
                ans.push_back(make_pair(make_pair(h,w),make_pair(h+1,w)));
                a[h][w]=0;
                a[h+1][w] = (a[h+1][w] + 1)%2; 
            }
        }
    }
    for (int w=0;w<W-1;w++){
        if (a[H-1][w]==1) {
            ans.push_back(make_pair(make_pair(H-1,w),make_pair(H-1,w+1)));
            a[H-1][w]=0;
            a[H-1][w+1] = (a[H-1][w+1] + 1)%2;
        }
    }
    cout << ans.size() << "\n";
    for (int i=0;i<ans.size();i++){
        cout << ans[i].first.first + 1 << " " << ans[i].first.second + 1;
        cout << " " << ans[i].second.first + 1 << " " << ans[i].second.second + 1 << "\n";
    }
}

Measured memory_bytes: 6264
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
int main()
{
	int A,B,K;
	scanf("%d%d%d",&A,&B,&K);
	for(int i=A;i<=min(A+K-1,B);i++) cout<<i<<endl;
	if(A+K>B) return 0;
	for(int i=max(A+K,B-K+1);i<=B;i++) cout<<i<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

bool check(std::string s) {
  if (std::string(s.begin(), s.begin()+4) == "YAKI")
    return true;
  return false;
}

int main() {
  std::string str;
  std::cin >> str;
  std::cout << (check(str) ? "Yes" : "No") << std::endl;
}


Measured memory_bytes: 256