akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main (){
    int x, y;
    
    while(1){
        cin >> x >> y;
        if ( x == 0 && y == 0 ) break;
        
        if ( x < y ){
            cout << x << " " << y << endl;
        }else{
            cout << y << " " << x << endl;
        }
    }
    return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
	int n;
	cin >> n;
	deque<int> dq;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		if (i % 2) {
			dq.push_back(x);
		} else {
			dq.push_front(x);
		}
	}
	if (n % 2 == 0) {
		reverse(dq.begin(), dq.end());
	}
	bool first = true;
	while (!dq.empty()) {
		if (first) first = false;
		else cout << ' ';
		cout << dq.front(); dq.pop_front();
	}
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif
    int N;
    cin >> N;
    vector<int> X(N), Y(N);
    for(int i = 0; i < N; i++) {
        cin >> X[i];
        Y[i] = X[i];
    }
    sort(Y.begin(), Y.end());
    int left = Y[N / 2 - 1], right = Y[N / 2];
    for(int i = 0; i < N; i++) {
        if(X[i] < right) {
            cout << right;
        } else {
            cout << left;
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int phi(int n){
    int sum=n;
    for(int i=2;i*i<=n;i++){
        int k=0;
        while(n%i==0) {
            n /= i;
            k++;
        }  
        if(k) (sum /= i) *= i - 1;
    }
    if(n>1) (sum /= n) *= n - 1;
    return sum;
}
int main(){
    int n;
    while(cin>>n){
        int sum = phi(n);
        cout<<sum<<endl;
    }
    return 0;
}

Measured memory_bytes: 3080
# A - Fifty-Fifty
A = str(input())
Acount =[]
ans = 'No'

for i in range(len(A)):
    if A.count(A[i]) == 2:
        Acount.append(2)
    else:
        Acount.append(0)

if Acount == [2,2,2,2]:
	print('Yes')
else:
	print('No')

Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<sstream>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define strep(it,v) for(it=v.begin();it!=v.end();++it)
#define ii pair<pair<ll,ll>,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
#define rs resize
int main()
{
   std::ios::sync_with_stdio(false);
   int n,m,i,j,k,z;
   cin>>n>>m>>z;
   int a[z],b[n][m];
   rep(i,0,z) cin>>a[i];
   i = j = 0;
   rep(k,0,z)
   {
      while(a[k] > 0)
      {
         b[i][j] = k + 1;
         if(j&1)
          i--;
         else
          i++;
         if(i == n)
          j++,i = n - 1;
         if(i == -1)
          j++,i = 0;
         a[k]--;
      }
   }
   rep(i,0,n){
     rep(j,0,m)
      cout<<b[i][j]<<" ";
     cout<<endl;
   }
   return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

K, X = MAP()

ans = []
for i in range(X-K+1, X+K):
    ans.append(i)
print(*ans)


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

using namespace std;

int main()
{
	string n;
	int m = 0;
	cin >> n;
	for (int i = 1; i < n.length(); i++)
		if (n[i] != '9')
			goto pnz;
	cout << n[0] - '0' + (n.length() - 1) * 9 << endl;
	return 0;
pnz:
	cout << n[0] - '1' + (n.length() - 1) * 9 << endl;
	return 0;
}


Measured memory_bytes: 256
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include "unordered_map"
#include "bitset"

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false)

typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 15, S = (1 << N) + 10, inf = 1e9;

int dp[S][N], g[N][N] = {0}, c[S][N], n;
bool seen[S][N] = {0};
unordered_map <int, int> mp;

inline int cost(int s1, int s2);
int f(int i, int t);

int main()
{
	int m;
	cin >> n >> m;
	for (int i = 0; i < m; ++i)
	{
		int u, v, w;
		cin >> u >> v >> w;
		g[u - 1][v - 1] = g[v - 1][u - 1] = w;
	}

	int subsets = (1 << n);
	for (int i = 1; i < subsets; ++i)
	{
		int u = -1;
		for (u = 0; u < n and !(i & (1 << u)); ++u);
		
		for (int j = 0; j < n; ++j)
			c[i][j] += c[i - (1 << u)][j] + g[u][j];
	}

	cout << f(subsets - 1, n - 1);
}

inline int cost(int s1, int s2)
{
	int ans = 0;
	for (int i = 0; i < n; ++i)
		if (s1 & (1 << i))
			ans += c[s2][i];

	return ans;
}

int f(int i, int t)
{
	if (i == (1 << t))
		return 0;

	if (seen[i][t])
		return dp[i][t];

	seen[i][t] = true;
	int temp = (1 << __builtin_popcount(i)), ans = inf;
	for (int j = 1; j < temp - 1; ++j)
	{
		int s1 = 0, ctr = 0;
		for (int k = 0; k < n; ++k)
		{
			if (i & (1 << k))
			{
				if (j & (1 << ctr++))
					s1 |= (1 << k);
			}
		}

		if ((s1 & 1) and (s1 & (1 << t)))
			ans = min(ans, f(s1, t) + cost(s1 - (1 << t), i - s1));
	}

	if (t)
	{
		for (int u = 0; u < n; ++u)
		{
			if (u == t or !(i & (1 << u)) or !g[u][t])
				continue;

			ans = min(ans, f(i - (1 << t), u) + c[i - (1 << u)][t]);
		}
	}

	dp[i][t] = ans;
	return ans;
}

Measured memory_bytes: 4608
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <fstream>
#include <complex>
#include <math.h>
using namespace std;

//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();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#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(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const double INF = 1e12;

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

int main(){
	int n;
	while(cin>>n){
		long cnt=0;
		REP(a,10)REP(b,10)REP(c,10)REP(d,10)if(a+b+c+d==n)cnt++;
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define REPS(i,n) for(int i=1;i<=(n);i++)
#define RREPS(i,n) for(int i=(n);i>0;i--)
#define mp make_pair
#define pb(a) push_back(a)
#define VSORT(v) sort(v.begin(), v.end());
typedef long long ll;
int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    cout << min(A,B) + min(C,D) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

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

__attribute__((constructor)) void initial() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

/**
 * i が K を超えるのに何度2倍する必要があるか
 */
int calExp(int i, int K) {
    int cnt = 0;
    while (i < K) {
        cnt++;
        i = i * 2;
    }
    return cnt;
}

int main() {
    int N, K;
    cin >> N >> K;
    int maxExp = calExp(1, K);
    // DEBUG(maxExp);
    ll sumBunshi = 0;
    for (int i = N; i >= 1; i--) {
        int tmpCalExp = calExp(i, K);
        // DEBUG(tmpCalExp);
        ll bunshi = pow(2, maxExp - tmpCalExp);
        // DEBUG(bunshi);
        sumBunshi = sumBunshi + bunshi;
    }
    // DEBUG(sumBunshi);
    long double bunbo = N * pow(2, maxExp);
    // DEBUG(bunbo);
    long double result = sumBunshi / bunbo;
    cout << fixed << setprecision(12) << result << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 800000000
#define MAX 1000

vector<int> tree;
int n=1;

void update(int i,int x){
  int k=n-1+i;
  tree.at(k)=x;
  while(k>0){
    k=(k-1)/2;
    tree.at(k)=max(tree.at(2*k+1),tree.at(2*k+2));
  }
}

int solve(int a,int b,int i,int left,int right){
  if(b<=left||right<=a){
    return -1;
  }
  if(a<=left&&right<=b){
    return tree.at(i);
  }
  return max(solve(a,b,2*i+1,left,(left+right)/2),solve(a,b,2*i+2,(left+right)/2,right));
}


int main(){
  int N,M;
  cin>>N>>M;
  vector<pair<ll,ll>> BA(N);
  for(int i=0;i<N;i++){
    cin>>BA.at(i).second>>BA.at(i).first;
  }
  sort(BA.begin(),BA.end());
  reverse(BA.begin(),BA.end());

  while(n<N){
    n*=2;
  }
  tree.resize(2*n-1,-1);
  for(int i=0;i<N;i++){
    tree.at(i+n-1)=i;
  }
  for(int i=n-2;i>=0;i--){
    tree.at(i)=max(tree.at(2*i+1),tree.at(2*i+2));
  }

  int i=0;
  ll ans=0;
  while(i<N){
    int r=M-BA.at(i).second;
    int x=solve(0,r+1,0,0,n);
    if(x!=-1){
      update(x,-1);
      ans+=BA.at(i).first;
    }
    i++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2816
#define DIN freopen("input.txt","r",stdin);
#define DOUT freopen("output.txt","w",stdout);
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define REP(i,a,b) for(int i=(a);i<=(int)(b);i++)
#define REP_(i,a,b) for(int i=(a);i>=(b);i--)
#define pb push_back
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef pair<int,int> P;
int read()
{
    int x=0,flag=1; char c=getchar();
    while((c>'9' || c<'0') && c!='-') c=getchar();
    if(c=='-') flag=0,c=getchar();
    while(c<='9' && c>='0') {x=(x<<3)+(x<<1)+c-'0';c=getchar();}
    return flag?x:-x;
}

int main()
{
    int x=read();
    if(x<600) putchar('8');
    else if(x<800) putchar('7');
    else if(x<1000) putchar('6');
    else if(x<1200) putchar('5');
    else if(x<1400) putchar('4');
    else if(x<1600) putchar('3');
    else if(x<1800) putchar('2');
    else if(x<2000) putchar('1');

    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)


struct Matrix
{
    using vec = std::vector<lint>;
    using mat = std::vector<vec>;
    mat X;
    lint MOD;

    static mat mul(const mat &A, const mat &B, lint M)
    {
        unsigned H = A.size(), W = B[0].size(), K = B.size();
        mat C(H, vec(W));
        REP(i, H) REP(j, W)
        {
            REP(k, K) (C[i][j] += A[i][k] * B[k][j]) %= M;
            C[i][j] += (C[i][j] < 0) ? M : 0;
        }
        return C;
    }

    Matrix(const mat &matrix, lint mod) : X(matrix), MOD(mod)
    {
        for (auto &vec : X) for (auto &val : vec)
        {
            val = (val % MOD + MOD);
            val = (val >= MOD) ? val - MOD : val;
        }
    }

    Matrix power(lint n)
    {
        int m = X.size();
        mat B(m, vec(m));
        mat C = X;
        REP(i, m) B[i][i] = 1;
        while (n > 0)
        {
            if (n & 1) B = mul(B, C, MOD);
            C = mul(C, C, MOD);
            n >>= 1;
        }
        return Matrix(B, MOD);
    }

    vec dot(const vec &v)
    {
        vec ans(X.size());
        REP(i, X.size()) REP(j, v.size())
        {
            (ans[i] += X[i][j] * v[j]) %= MOD;
        }
        for (auto &v : ans) v += (v < 0) ? MOD : 0;
        return ans;
    }
};

int N, M;
vector<lint> X;
constexpr lint MOD = 1000000007;

int main()
{

    vector<lint> st{1, 0, 0, 0};
    vector<vector<lint>> tr1{
        {1, 1, 2, 1},
        {1, 1, 2, 1},
        {1, 0, 1, 1},
        {1, 0, 0, 1}};

    Matrix M1(tr1, MOD);

    cin >> N >> M;

    X.resize(M + 1);
    REP(i, M) cin >> X[i + 1];
    X.push_back(N);

    FOR(i, 1, X.size())
    {
        st = M1.power(X[i] - X[i - 1]).dot(st);
        st[0] = 0;
    }

    cout << st[1] << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

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

// auto mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
  int n, k;
  cin >> n >> k;
  v(mint) d(k+1);
  REPe(i, k) {
    mint c = k/i;
    d[i] = c.pow(n);
  }
  rREPe(i, k) {
    for (int j = 2*i; j <= k; j+=i) {
      d[i] -= d[j];
    }
  }
  mint ans = 0;
  REPe(i, k) ans += d[i]*i;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 4004
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<functional>
#include<cmath>
#include<algorithm>
typedef  long long ll;
 
int main() {
	int n, a, b,sum = 0,dig = 0;
	int f = 0;
	int count = 0;
	int ans = 0;
	std::cin >> n >> a >> b;
	for (int i = 1; i <= n; i++) {
		f = i;
		while (f!=0) {
			dig = f % 10;
			sum = sum + dig;
			f = f / 10;
		}
		if (sum >= a && sum <= b) {
			ans += i;
		}
		sum = 0;
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MN 1<<24
using namespace std;priority_queue<pair<int,int>> Q;int d[MN],n,s,L,x[MN],y[MN],t[MN],ti[MN],mn,mid,i;int main(){cin>>n>>s>>L;Q.push(make_pair(0,-1));x[0]=1;t[0]=0;y[0]=0;t[s+1]=L;for(i=1;i<=s;i++){cin>>x[i]>>t[i]>>y[i];}for(i=0;i<=s;i++){d[x[i]]+=y[i];Q.push(make_pair(d[x[i]],-x[i]));while(1){pair<int,int>p=Q.top();if(p.first==d[-p.second]){ti[-p.second]+=t[i+1]-t[i];break;}Q.pop();}}for(i=1;i<=n;i++){if(mn<ti[i]){mn=ti[i];mid=i;}}cout<<mid<<endl;}

Measured memory_bytes: 18712
K, X = map(int, input().split())

_max = 1000000
_min = -1000000


ans_l = []

for i in range(K-1, 0, -1):
    if X-i <= _max and X-i >= _min:
        ans_l.append(X-i)


for i in range(K):
    if X+i <= _max and X+i >= _min:
        ans_l.append(X+i)

print(*ans_l)

Measured memory_bytes: 3060
import java.util.Scanner;
 
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int max = 100000001;
		boolean [] sosuu = new boolean [max];
 		
		sosuulist(sosuu, max);
 		
 		syuturyoku(sosuu);
		
	}
 
	private static void sosuulist(boolean [] sosuu, int max) {
		for (int i = 1; i <= max - 1; i++) {
			sosuu[i] = true;
		}
		sosuu[0] = false;
		sosuu[1] = false;
 
		for (int i = 2; i <= Math.sqrt(max); i++) {
			if (sosuu[i] == true) {
				for (int j = i + i; j <= max - 1; j += i) {
					sosuu[j] = false;
				}
			}
 
		}
	}
	
	private static void syuturyoku(boolean [] sosuu) {
		int [] n = new int [10000];
		int count = 0;
		
		Scanner cin = new Scanner (System.in);
		int x = cin.nextInt();
 
		for (int i = 0; i < x; i++) {
			n[i] = cin.nextInt();
			if (sosuu[n[i]] == true) count++;
		}
 
		System.out.println(count);
	}
}

Measured memory_bytes: 141256
#include<iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <numeric>
typedef long long int ll;
using namespace std;

int main(){
	int H,W,count,sum;
	char a;
	cin>>H>>W;
	vector<vector<char>> data(H,vector<char>(W,'1'));
	vector<vector<int>> Data(H,vector<int>(W,500));
	count=0;
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin>>a;
			data[i][j]=a;
		}
	}
	if(data[0][0]=='#'){
		Data[0][0]=1;
	}else{
		Data[0][0]=0;
	}
	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(i>=1){
				Data[i][j]=min(Data[i][j],Data[i-1][j]+(data[i-1][j]=='.'&&data[i][j]=='#'));
			}
			if(j>=1){
				Data[i][j]=min(Data[i][j],Data[i][j-1]+(data[i][j-1]=='.'&&data[i][j]=='#'));
			}
		}
	}
	cout<<Data[H-1][W-1]<<endl;
	return 0;
}

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

using namespace std;

const int key[] = {
    18680907, 19120729, 19261224, 19890107
};
const string era[] = {
    "pre-meiji", "meiji", "taisho", "showa", "heisei"
};
const int offset[] = {
    0, 1868, 1912, 1926, 1989
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    int Y, M, D;
    while(cin >> Y >> M >> D) {
        int v = Y*10000 + M * 100 + D;
        int pos = 0;
        while(pos < 4 && key[pos] < v) ++pos;
        if(pos == 0) {
            cout << era[pos] << endl;
        } else {
            cout << era[pos] << ' ' << Y-offset[pos]+1 << ' ' << M << ' ' << D << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1208
import math

A, B, H, M = map(int, input().split())

H *= 30
H += 0.5 * M
M *= 6

p, q = max(H, M), min(H, M)
r = min(p-q, (360-p)+q)
c = round(math.radians(r), 40)
l = A ** 2 + B ** 2 - 2 * A * B * math.cos(c)
print(math.sqrt(l))

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

int main(void) {
	int N, a, b;
	cin >> N;
	if (N == 1)
		cout << "Hello World" << endl;
	else if (N == 2) {
		cin >> a >> b;
		cout << a + b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    ll x; cin>>x;
    ll ans=0;
    int X=x/500;
    int y=x-X*500;
    int Y=y/5;
    Y=Y*5;
    ans=X*1000+Y;
    //cout<<X<<" "<<Y<<endl;
    cout<<ans<<endl;
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static final String REGIX_COMMA = ",";

    public static void main(String[] args) {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int wide = 0;
        int num = 0;

        try {
            wide = Integer.valueOf(in.readLine());
            num = Integer.valueOf(in.readLine());

            int[] lot = new int[wide];

            for (int i = 0; i < lot.length; i++) {
                lot[i] = i + 1;
            }

            for (int j = 0; j < num; j++) {

                String[] changePosition = in.readLine().split(REGIX_COMMA);
                int left = Integer.valueOf(changePosition[0]) - 1;
                int right = Integer.valueOf(changePosition[1]) - 1;

                int temp = lot[left];
                lot[left] = lot[right];
                lot[right] = temp;
            }

            for (int answer : lot) {
                System.out.println(answer);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

Measured memory_bytes: 16936
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// debug
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}
#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif

int N;
vi X, Y;
double f(double x, double y) {
  double ans = 0;
  rep(i, N) {
    double d = (X[i] - x) * (X[i] - x) + (Y[i] - y) * (Y[i] - y);
    if (d > ans) ans = d;
  }
  return sqrt(ans);
}
double g(double x) {
  double left = 0, right = 1000;
  while (abs(left - right) > 1e-9) {
    double m1 = (right + 2 * left) / 3;
    double m2 = (2 * right + left) / 3;
    if (f(x, m1) > f(x, m2))
      left = m1;
    else
      right = m2;
  }
  return f(x, left);
}

int main() {
  cin >> N;

  X.resize(N), Y.resize(N);
  rep(i, N) {
    cin >> X[i] >> Y[i];
  }

  double left = 0, right = 1000;
  while (abs(left - right) > 1e-9) {
    double m1 = (right + 2 * left) / 3;
    double m2 = (2 * right + left) / 3;
    if (g(m1) > g(m2))
      left = m1;
    else
      right = m2;
  }
  cout << fixed << setprecision(16) << g(left) << endl;


  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll n,h,w,a[2000],b[2000],ans;
  cin >> n >> h >> w;
  rep(i,n)cin >> a[i] >> b[i];
  rep(i,n)if(a[i]>=h&&b[i]>=w)ans++;
  printf("%lld",ans);
}

Measured memory_bytes: 256
num=open(0).read()
A=int(num[0])
B=int(num[1])
C=int(num[2])
D=int(num[3])
for i in range(2):
    for j in range(2):
        for k in range(2):
            b=B*(-1)**i
            c=C*(-1)**j
            d=D*(-1)**k
            ans=A+b+c+d
            if ans==7:
                sgn=[i,j,k]
                for l in range(3):
                    if sgn[l]%2==0:
                        sgn[l]='+'
                    else:
                        sgn[l]='-'
print(str(A)+sgn[0]+str(B)+sgn[1]+str(C)+sgn[2]+str(D)+'=7')                

Measured memory_bytes: 9132
#include <bits/stdc++.h>
#include<vector>
using namespace std;
int main(){
  int a=0,b=0;
  string n;
  cin>>n;
  for(int i=0;i<n.size();i++){
    if(n.at(i)=='1')a++;
    else b++;
  }
  cout<<min(a,b)*2;
}

Measured memory_bytes: 512
N = int(input())
a = [0]+list(map(int,input().split()))
b = [0]*(N+1)
b[-1] = a[-1]
for i in range(N-1,0,-1):
    hoge = a[i]
    for j in range(i,N+1,i):
        hoge += b[j]
    b[i] = hoge%2
print(sum(b))
for i in range(N+1):
    if b[i] == 1:
        print(i,end = " ")

Measured memory_bytes: 7072
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
const ll BetsuMOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -MOD * MOD;
const long double pi = 3.141592653589793;
int main() { // 問題文はしっかり読め!!!
	int n;
	cin >> n;
	V a(2 * n);
	rep(i, 2 * n) {
		cin >> a[i];
	}
	sort(all(a));
	ll ans = 0;
	for (int i = 0; i < 2 * n; i += 2) {
		ans += a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(int i=a; i<n; i++)
#define loop(i,a,n)	for(int i=a; i>=n; i--)

int main() 
{	
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a;
	cin>>a;
	string s;
	cin>>s;
	int b;
	cin>>b;
	vector<set<int>> v(26);
	map<int,char> m;
	forr(i,0,s.size())
	{
		v[int(s[i]-'a')].insert(i);
		m[i]=s[i];
	}
	while(b--)
	{
		int x,y;
		cin>>x>>y;
		if(x==1)
		{
			char z;
			cin>>z;
			char t=m[y-1];
			v[int(t-'a')].erase(y-1);
			v[int(z-'a')].insert(y-1);
			s[y-1]=z;
			m[y-1]=z;
		}	
		else
		{
			int z,ct=0;
			cin>>z;
			forr(i,0,26)
			{
				auto it=v[i].lower_bound(y-1);
				if(it!=v[i].end() and *it<z)	ct++;
			}
			cout<<ct<<'\n';
		}
	}
	return 0;	
}

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) cout << 1 << endl;
  else if (a == b || b == c || c == a) cout << 2 << endl;
  else cout << 3 << endl;
}

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

int main() {
	int n, k, r, s, p;
	cin >> n >> k >> r >> s >> p;
	string t;
	cin >> t;

	vector<vector<char>> cnt(k);

	rep(i, n) {
		int ii = i % k;
		cnt[ii].push_back(t[i]);
	}
	ll ans = 0;
	rep(i, k) {
		int u = cnt[i].size();
		rep(j, u) {
			if (j == u - 1) {
				if (cnt[i][j] == 's') ans += r;
				if (cnt[i][j] == 'p') ans += s;
				if (cnt[i][j] == 'r') ans += p;
				continue;
			}
			if (cnt[i][j] == 's') ans += r;
			if (cnt[i][j] == 'p') ans += s;
			if (cnt[i][j] == 'r') ans += p;
			if (cnt[i][j] == cnt[i][j + 1]) {
				cnt[i][j + 1] = 'd';
			}
		}
	}
	cout << ans << endl;
}


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

int n, k;
vector<long long> a;
template <class T>
void readVector(int n, vector<T> &v){
	for(int i=0; i<n; ++i){
		T t;
		cin >> t;
		v.push_back(t);
	}
}
long long sum, ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> k;
	readVector(n, a);
	vector<long long> b(a);
	for(int i=0; i<n; ++i)
		if(b[i] < 0)
			b[i] = 0;
	for(int i=1; i<n; ++i){
		b[i] += b[i-1];
		a[i] += a[i-1];
	}
	sum = b[n-1];
//	cout << b[n-1] << "\n";
	for(int i=0; i+k-1<n; ++i){
		long long pl, mi;
		mi = (i == 0 ? b[k-1] : (b[i+k-1] - b[i-1]));
		pl = (i == 0 ? a[k-1] : (a[i+k-1] - a[i-1]));
		pl = max(pl, 0ll);
//		cout << i << " " << pl << " " << mi << "\n";
		ans = max(ans, sum + pl - mi);
	}
	cout << ans << "\n";
}

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

using namespace std;

int main(){
	int n;
	bool sol = false;
	cin >> n;
	while(n){
		int prev = n;
		int k = n%10;
		if(k == 7)
			sol = true;
		n /=10;
		
	}
	if(sol)
		cout << "Yes" <<'\n';
	else 
		cout << "No" << '\n';
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define ms memset
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define lower_bound lb
#define upper_bound ub

int main()
{
    int n; cin >> n; vi f(n+1);
    for (int i = 1; i <= 100; i++){
        for (int j = 1; j <= 100; j++){
            for (int k = 1; k <= 100; k++){
                ll ans = i*i + j*j + k*k + i*j +i*k + j*k;
                if (ans > n) continue;
                f[ans]++;
            }
        }
    }
    for (int i = 1; i <= n; i++){
        cout << f[i] << '\n';
    }
    return 0;
}

Measured memory_bytes: 3632
#coding:utf-8
import itertools
N = int(input())
coms = []
for n in range(N):
    A = int(input())
    com = []
    for a in range(A):
        tmp = list(map(int,input().split()))
        com.append(tmp)
    coms.append(com)
#print (coms)
nums = [0, 1]
ans = 0
for pt in itertools.product(nums, repeat=N):
    flag = False
    
    if sum(pt) > ans:
        for idx in range(len(pt)):
            if pt[idx]==1:
                for com in coms[idx]:
                    if pt[com[0]-1] + com[1] == 1:
       
                        flag = True
        if not flag:
            ans = sum(pt)
            #print (pt)
    else:
        pass
        

print (ans)

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	// Code for C - Go Home
	var X int
	fmt.Scanf("%d", &X)

	var sum int
	for i := 0; ; i++ {
		sum += i + 1
		if sum >= X {
			fmt.Println(i + 1)
			break
		}
	}

}


Measured memory_bytes: 1832
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    input!(n: usize, xy: [(i64, i64); n]);

    let mut mp = BTreeMap::new();

    // 座標同士の差分の組みがどれだけあるかを調べる
    // 最も多い差分の組みをp, qとして見なすのが最適
    // (ここらへんの証明を正しく言語化できてないから、「有効辺の個数の最大化」「連結成分」などについて要学習)
    // コストはN - その組みの個数
    for i in 0..n {
        let (x1, y1) = xy[i];
        for j in 0..n {
            if i == j {
                continue;
            }
            let (x2, y2) = xy[j];
            *mp.entry((x2 - x1, y2 - y1)).or_insert(0) += 1;
        }
    }

    let mut nax = 0;
    for (_, c) in mp.iter() {
        nax = max(nax, *c);
    }
    let cost = n - nax;
    println!("{}", cost);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl
#define dd(x) cout<<#x<<"="<<x<<" "
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define all(a) a.begin(),a.end()
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef double db;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;

const int mod = 1e9+7;
const int N = 1e6+6;
const int M = 2e6+6;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;

bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==0?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=1;a%=mod; if(b<0) return 1; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
    ll x=0,f=1;char ch=getchar();
    while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//inv[1]=1;
//for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
int dp[N];
int main() {
    int n; cin>>n;
    dp[0] = 1;
    rep(i, 1, n + 1) {
        if(i >= 100) {
            if(dp[i-100]) dp[i] = 1;
        }
        if(i >= 101) {
            if(dp[i-101]) dp[i] = 1;
        }
        if(i >= 102) {
            if(dp[i-102]) dp[i] = 1;
        }
        if(i >= 103) {
            if(dp[i-103]) dp[i] = 1;
        }
        if(i >= 104) {
            if(dp[i-104]) dp[i] = 1;
        }
        if(i >= 105) {
            if(dp[i-105]) dp[i] = 1;
        }
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 640
package main

import (
    "fmt"
    // "sort"
)

func main() {
    var n int
    // fmt.Scan(&n, &x)
    // nums := make([]int,n);
    fmt.Scan(&n)

    ans := 0
    s := 0
    m := make(map[int]int)
    var d int
    m[0]=1

    for i := 0; i < n; i++ {
	    fmt.Scan(&d)
	    s+=d
	    if _, ok := m[s]; ok {
	    	ans += m[s]
	    	m[s] = m[s]+1
	    } else {
	    	m[s] = 1
	    }
    }


	fmt.Println(ans)
}

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

int main(){
  int min, max;
  cin >> min >> max;
  int num; //回文数となった数
  for(int i = min; i<=max; i++){
    int tmp = i;
    int num_5, num_4, num_3, num_2, num_1;//1~5桁目の数字
    num_5 = tmp / 10000;
    tmp = tmp  - num_5*10000;
    
    num_4 = tmp / 1000;
    tmp = tmp - num_4*1000;
    
    num_3 = tmp / 100;
    tmp = tmp - num_3*100;
    
    num_2 = tmp / 10;
    tmp = tmp - num_2*10;
    
    num_1 = tmp / 1 ;
    
    if(num_5 == num_1 && num_4 == num_2) num++;
  }
  
  cout << num << endl;
  return 0;
}
 

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

int main() {
    string a, b;
    cin >> a >> b;

    if (a.size() < b.size())
        cout << "LESS" << endl;
    else if (a.size() > b.size())
        cout << "GREATER" << endl;
    else
        if (a == b)
            cout << "EQUAL" << endl;
        else
            cout << (a < b ? "LESS" : "GREATER") << endl;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
int main () {
  int X;
  cin >> X;
  int count = 2;
  vector<int> data(1,1);
  int a, ans = 1;
  while(count*count <= 1000) {
    a = count;
    a *= count;
    while(a <= 1000) {
      if(ans < a && X >= a) ans = a;
      a *= count;
    }
    count++;
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n,x;
  cin >>n;
  cin >>x;
  vector<int> m(n);
  for (int i=0;i<n;i++){
    cin >> m[i];
  }
  int z=0;
  for (int i=0;i<n;i++){
    z=z+m[i];
  }
  int y=x-z;
  int min=10000000;
  for (int i=0;i<n;i++){
    if(min>m[i]){
      min=m[i];
    }
  }
  cout << n+y/min <<endl;
  return 0;
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(void) {
  int n;
  cin >> n;
  ll cnt[10][10];
  rep(i, 10) rep(j, 10) cnt[i][j] = 0;
  rep(i, n + 1) {
    if(i == 0)
      continue;
    int rd = i % 10;
    int ld = i;
    while(ld / 10)
      ld /= 10;
    ++cnt[rd][ld];
  }
  ll ans = 0;
  rep(i, 10) rep(j, 10) ans += cnt[i][j] * cnt[j][i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
#ABC110 D

import math
from collections import Counter
N,M = map(int,input().split())
mod = 10**9 + 7

def factorize(n):
    b = 2
    fct = []
    while b**2 <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    if n > 1:
        fct.append(n)
    return fct

def fast(x,n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        return fast(x**2 % mod,n//2) % mod
    elif n % 2:
        return x*fast(x**2 % mod,n//2) % mod
fact = [0]*(200001)
fact[0] = 1
for i in range(200000):
    fact[i+1] = fact[i]*(i+1)
    fact[i+1] %= mod

cnt = list(Counter(factorize(M)).items())
ans = 1
for i,j in cnt:
    ans *= fact[j+N-1]
    ans %= mod
    ans *= fast(fact[j],mod-2)
    ans %= mod
    ans *= fast(fact[N-1],mod-2)
    ans %= mod
print(ans)


Measured memory_bytes: 11252
n = int(input())
monsters = list(map(int, input().split()))
heroes = list(map(int, input().split()))
A = sum(monsters)
for i in range(len(heroes)):
  if monsters[i] <= heroes[i]:
    heroes[i] -= monsters[i]
    monsters[i] -= monsters[i]
    if heroes[i] > 0:
      if monsters[i+1] <= heroes[i]:
        heroes[i] -= monsters[i+1]
        monsters[i+1] -= monsters[i+1]
      else:
        monsters[i+1] -= heroes[i]
        heroes[i] = 0
  else:
    monsters[i] -= heroes[i]
    heroes[i] = 0
print(A - sum(monsters))

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

char a[100][100], b[102][102];
int main() {
  int h,w;
  cin >> h >> w;
  for (int i = 0; i < h; i++) scanf("%s",a[i]);
  for (int i = 0; i < h+2; i++) 
    for (int j = 0; j < w+2; j++) 
      b[i][j] = '#';
  for (int i = 0; i < h; i++) 
    for (int j = 0; j < w; j++) 
      b[i+1][j+1] = a[i][j];      
  for (int i = 0; i < h+2; i++) {
    for (int j = 0; j < w+2; j++)  cout << b[i][j];
    cout << endl;
  }
}

Measured memory_bytes: 3720
#include <bits/stdc++.h> 
#define ll long long
#define ld long double
#define vi vector<int>
#define vl vector<ll> 
#define vd vector<double>
#define vld vector<long double>
#define vp vector<pair<ll, ll>>
#define all(a) a.begin(), a.end()
#define pb push_back
#define pi pair<int, int>
#define pl pair<ll, ll>
#define mp make_pair
#define fi first
#define sc second
#define for0(i, n) for(ll i=0; i<n; i++) 
#define for1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ll mod = 1e9+7;

void solve(){
	ll x; cin>>x;
	if(x>=30)
		cout<<"Yes";
	else
		cout<<"No";
}

int main() {

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	ll test = 1;
	//cin>>test;
	while(test--)
		solve();

	return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<queue>
#include<map>
using namespace std;
struct data{
	string str;
	int cnt;
	data(){}
	data(string str,int cnt):str(str),cnt(cnt){}
};
string func(string str,int i) {
	int r,g,b;
	char change;
	if(str[i] == 'r') {
		if(str[i+1] == 'g') change='b';
		else if(str[i+1] == 'b') change = 'g';
		else return str;
	}
	else if(str[i] == 'g') {
		if(str[i+1] == 'r') change='b';
		else if(str[i+1] == 'b') change = 'r';
		else return str;
	}
	else {
		if(str[i+1] == 'g') change = 'r';
		else if(str[i+1] == 'r') change = 'g';
		else return str;
	}
	str[i] = change;
	str[i+1] = change;
	return str;
}
bool check(string str) {
	char c = str[0];
	for(int i = 1; i < str.size(); i++) {
		if(str[i] != c) return false;
	}
	return true;
}
int main() {
	string str;
	while(1) {
		cin >> str;
		if(str == "0") break;
		int ans = -1;
		map<string,bool> memo;
		queue<data> Q;
		Q.push(data(str,0));
		while(!Q.empty()) {
			data d = Q.front();Q.pop();
			if(memo[d.str]) continue;
			memo[d.str] = true;
			if(check(d.str)) {
				ans = d.cnt;
				break;
			}
			for(int i = 0; i < d.str.size() - 1; i++) {
				string nstr = func(d.str,i);
				if(nstr == d.str) continue;
				Q.push(data(nstr,d.cnt+1));
			}
		}
		if(ans == -1) puts("NA");
		else printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 3408
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

int main(){
	int n, l;
	cin >> n >> l;
	vi a(n+10),t(n+10);
	rep(i, 0, n){
		cin >> a[i];
	}
	int c = 0;
	while (1){
		rep(i, 0, n){
			if (t[i]) continue;
			if (i > 0 && a[i - 1] >= a[i]) continue;
			if (i < n - 1 && a[i] <= a[i + 1]) continue;
			int tep = 0;
			if (i>0) tep = max(tep, t[i - 1]);
			if (i < n - 1) tep = max(tep, t[i + 1]);
			t[i] = tep + l - a[i];
			a[i] = 0;
			c++;
		}
		if (c == n) break;
	}
	int ans = 0;
	rep(i, 0, n){
		ans = max(ans, t[i]);
	}
	o(ans);
}

Measured memory_bytes: 1796
/* 入力例https://paiza.io/ja/projects/new?language=cpp
4 3
180
160
170
190
2 100
3 120
4 250
→ 出力 480
*/
// IOI饅頭 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0599
#include <bits/stdc++.h>
using namespace std;

int M, N;
vector<int> manjus;
vector<pair<int, int>> boxes;
int mem[10001][501];

bool boxcmp(const pair<int, int> a, const pair<int, int> b) {
    if((a.second * b.first) == (b.second * a.first)) {
        return a.first > b.first;
    } else {
        return (a.second * b.first) < (b.second * a.first);
    }
}

int mouke(int m, int b) {
    if(mem[m][b] >= 0) return mem[m][b];
    if(m >= M || b >= N){
        return 0;
    }
    int manju_nokori = M - m;
    int box_size = boxes[b].first;
    int shushi = boxes[b].second * (-1);

    if(manju_nokori < box_size) {
        for(int i = m; i < M; i++) {
            shushi += manjus[i];
        }
        if(shushi > 0) {
            int result = max(mouke(m, b + 1), shushi);
            mem[m][b] = result;
            return result;
        } else {
            int result = mouke(m, b + 1);
            mem[m][b] = result;
            return result;
        }
    } else {
        for(int i = m; i - m < box_size; i++) {
            shushi += manjus[i];
        }
        if(shushi > 0) {
            int result = max(mouke(m, b + 1), shushi + mouke(m + box_size, b + 1));
            mem[m][b] = result;
            return result;
        } else {
            int result = max(mouke(m, b + 1), 0);
            mem[m][b] = result;
            return result;
        }
    }
}

int main() {
    for(int i = 0; i <= 10000; i++) {
        for(int j = 0; j <= 500; j++) {
            mem[i][j] = -1;
        }
    }
    cin >> M >> N;
    for(int i = 0; i < M; i++) {
        int Pi;
        cin >> Pi;
        manjus.push_back(Pi);
    }
    for(int i = 0; i < N; i++) {
        int Cj, Ej;
        cin >> Cj >> Ej;
        boxes.push_back(make_pair(Cj, Ej));
    }
    sort(manjus.begin(), manjus.end(), greater<int>());
    sort(boxes.begin(), boxes.end(), boxcmp);
    cout << mouke(0, 0) << endl;
    return 0;
}



Measured memory_bytes: 22860
#include <bits/stdc++.h>
#define npos std::string::npos
typedef long long ll;
using namespace std;
int main()
{
	int r, D, x;
  	cin >> r >> D >> x;
  	for (int i = 1; i <= 10; i++){
    	x = r * x - D;
      	cout << x << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string str,ans="keyence";
	int k;
	bool flag=0;
	cin>>str;
	for(int i=0;i<=7;++i){
		k=0;
		int j;
		for(j=0;j<i;++j){
			if(str[j]==ans[k])
				k++;
			else 
				break;
		}
		if(j!=i)
			continue;
		j=i+str.length()-7;
		for(;j<str.length();++j){
			if(str[j]==ans[k])
				k++;
			else 
				break;
		}
		if(j!=str.length())
			continue;
		else{
			flag=1;
			break;
		}
	}
	if(flag)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 256