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

inline void ioThings() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#define debug(x) cerr << #x << ": <" << (x) << ">\n"
#else
#define debug(x)
#endif
}

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp(x, y)  make_pair(x, y);
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second
#define mod       1000000007
#define pi        acos(-1.0)

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

int main() {
  ioThings();

  int x;
  cin >> x;
  si hon{2, 4, 5, 7, 9}, pon{0, 1, 6, 8};
  x %= 10;

  if (hon.count(x)) cout << "hon";
  else if (pon.count(x)) cout << "pon";
  else cout << "bon";

  return 0;
}


Measured memory_bytes: 3656
#include<cmath>
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cstring>
#include<stack>
#include<vector>
#include<string.h>
#include<string>
#include<iomanip>
#include <sstream>
#include<map>
#include<complex>
#include<set>
using namespace std;
#define rep(i,t,n)  for(ll i =(t);i<=(n);++i)
#define per(i,n,t)  for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define Decimal fixed<<setprecision(20)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0)
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2e5 + 5;
typedef double db;
const db pi = acos(-1.);
ll n, k;

ll a[maxn], f[maxn];
bool check(ll x) {
	ll sum = 0;
	rep(i, 1, n) { 
		if (a[i] * f[i] > x) {
			ll tmp = x / f[i];
			sum += a[i]-tmp;
		}
	}
	return sum <= k;
}

int main() {
	FAST_IO;

	cin >> n >> k;
	rep(i, 1, n)cin >> a[i];
	rep(i, 1, n)cin >> f[i];
	sort(a + 1, a + 1 + n);
	sort(f + 1, f + 1 + n);
	reverse(f + 1, f + 1 + n);
	ll l = 0, r = 1e12+1;
	while (l <= r) {
		ll mid = l + r >>1;
		if (check(mid)) r = mid - 1;
		else l = mid + 1;
	}
	cout << l << endl;
	cin >> n;
}         
/*
2
A 0 0 2
B 1 0 2


*/


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>
#include <set>
#include <queue>
using namespace std;

int main(){
	int n;
	cin >> n;
	int arr[n], m[n];
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	m[0] = arr[0];
	for(int i = 1; i < n; i++){
		m[i] = max(m[i-1], arr[i]);
	}
	long long ans = 0;
	for(int i = 0; i < n; i++){
		ans += (m[i] - arr[i]);
	}
	cout << ans << '\n';
}


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

#define fastIO \
ios_base::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define mp make_pair

int main(){
	int a;
	cin >> a;
	string s;
	cin >> s;
	if( a >= 3200)	cout << s <<endl;
	else cout<<"red"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
  ll a,v,b,w,t;
  cin >> a >> v >> b >> w >> t;
  if(a<b) cout << (a+v*t>=b+w*t?"YES":"NO") << endl;
  else cout << (a-v*t<=b-w*t?"YES":"NO") << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}


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

int main()
{
    /*A
    string s;
    cin>>s;
    if(s=="AAA" || s=="BBB")
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
    */
    ll n,a,b;
    cin>>n>>a>>b;
    ll count=0;
    if(a==0)
    {
       cout<<0<<endl;
       return 0;
    }
    else if(n%(a+b)==0)
    {
        count = (n/(a+b))*a;
        cout<<count<<endl;
        return 0;
    }
    else
    {
        if(n%(a+b)<=a)
        {
            count=(n/(a+b))*a+n%(a+b);
            cout<<count<<endl;
            return 0;
        }
        else
        {
            count =  (n/(a+b))*a+a;
            cout<<count<<endl;
            return 0;
        }
    }

    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
dp = []
key = []
for i in range(m):
    d = [10**15]*(2**n)
    d[0] = 0
    dp.append(d)
for i in range(m):
    cost,num = map(int,input().split())
    if num == 1:
        t = int(input())
        key.append([cost,2**(t-1)])
    else:
        p = list(map(int,input().split()))
        cur = 0
        for i in range(len(p)):
            cur += 2**(p[i]-1)
        key.append([cost,cur])
for i in range(m):
    for j in range(2**n):
        if i != 0:
            dp[i][j] = min(dp[i][j],dp[i-1][j])
        dp[i][j|key[i][1]] = min(dp[i][j|key[i][1]],dp[i][j]+key[i][0])
if dp[m-1][2**n-1] != 10**15:
    print(dp[m-1][2**n-1])
else:
    print(-1)


Measured memory_bytes: 79448
# coding: utf-8
from operator import add, sub, mul

op_dict = {'+': add, '-': sub, '*': mul}

def calcurate(list_):
    s = []
    for l in list_:
        if l.isdigit():
            s.append(int(l))
        elif l in ['+', '-', '*']:
            a = s.pop()
            b = s.pop()
            s.append(op_dict[l](b, a))
    return s[0]



def main():
    inputs = raw_input().split()
    print calcurate(inputs)


if __name__ == '__main__':
    main()

Measured memory_bytes: 4360
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	while(cin>>n>>m,n){
		vs in(n);
		rep(i,n)cin>>in[i];
		int out=0;
		if(n<m){
			int N=1<<n;
			rep(i,N){
				bool h=true;
				int co=0;
				rep(j,n)if(i&1<<j)co++;
				rep(j,m){
					int c=0;
					rep(k,n)if((i&1<<k)&&in[k][j]=='1')c++;
					if(c%2)h=false;
				}
				if(h)out=max(out,co);
			}
		}else{
			int N=1<<m;
			vi dp(N,-inf);
			dp[0]=0;
			rep(i,n){
				int t=0;
				rep(j,m)t*=2,t+=in[i][j]-'0';
				vi nd=dp;
				rep(j,N)if(dp[j]!=-inf)
					nd[j^t]=max(nd[j^t],dp[j]+1);
				dp=nd;
			}
			out=dp[0];
		}
		cout<<out<<endl;
	}
}








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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 30)
#define MOD 1000000007
int dy[4] = {-1,0,0,1};
int dx[4] = {0,1,-1,0};


int main(){

  int n,k;
  cin >> n >> k;
  if((n%k) == 0)cout << 0 << endl;
  else cout << 1 << endl;




  

  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		for(int i=0; i<n; i++)
		{
			ArrayList<Integer> b = new ArrayList<>();
			ArrayList<Integer> c = new ArrayList<>();
			
			int b0=0, c0=0;
			boolean result = true;
			for(int j=0; j<10; j++)
			{
				int a = scanner.nextInt();
				if(j == 0)
				{
					b.add(a);
					b0 = a;
				}
				else {
					if(a > b0)
					{
						b.add(a);
						b0 = a;
					}
					else if(a > c0)
					{
						c.add(a);
						c0 = a;
					}
					else {
						result = false;
					}
				}
			}
			
			System.out.println(result ? "YES" : "NO");
		}
	}
}

Measured memory_bytes: 26340
#include<stdio.h>
int main(){
int nlist[10000];
int i=0;
while(1){
scanf("%d",&nlist[i]);

if(nlist[i]==0)
break;
i++;
}
for(int j=0;j<i;j++){
printf("Case %d: %d\n",(j+1),nlist[j]);
}
return 0;
}


Measured memory_bytes: 2048
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <memory>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int N; cin >> N;
	vector<int> p(N);
	rep(i, N) cin >> p[i], p[i]--;
	vector<int> a(N), b(N);
	rep(i, N) a[i] = i * N;
	rep(i, N) b[i] = (N - 1 - i) * N;
	rep(i, N) {
		int j = p[i];
		a[j] += i;
		b[j] += i;
	}
	rep(i, N) cout << a[i] + 1 << (i + 1 < N ? ' ' : '\n');
	rep(i, N) cout << b[i] + 1 << (i + 1 < N ? ' ' : '\n');
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define LL long long
using namespace std;

void solve(long long H, long long W, long long N, std::vector<long long> a) {
    vector<LL> tab;
    for (LL i = 0; i < N; i++)
        for (LL j = 0; j < a[i]; j++)
            tab.emplace_back(i + 1);

    vector<vector<LL>> res(H, vector<LL>(W));
    for (LL i = 0; i < H; i++) {
        for (LL j = 0; j < W; j++) {
            LL seek = i * W + j;
            if (i % 2 == 0)res[i][j] = tab[seek];
            else res[i][W - 1 - j] = tab[seek];
        }
    }

    for (LL i = 0; i < H; i++) {
        for (LL j = 0; j < W; j++) {
            cout << res[i][j] << " ";
        }
        cout << endl;
    }
}

int main(){
    long long H;
    scanf("%lld",&H);
    long long W;
    scanf("%lld",&W);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(H, W, N, std::move(a));
    return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int a[105],b[105]={0},n,cnt=0,s=0,m=0,i,j;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	while(cnt!=n)
	{
		m=0;
		cnt=0;
		for(i=0;i<n;i++)
		{
			if(a[i]==b[i])
			{
				cnt++;
				if(m==1)
				{
					s++;
					m=0;
				}
			}
			else
			{
				b[i]++;
				m=1;
			}
		}
		if(m==1)
		{
			s++;
		}
	}
	cout<<s<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
    }

    for(int i = a.size()-1; i >= 0; i-=2){
        cout << a[i] << ' ';
    }

    if(n%2 == 0){
        for(int i = 0; i < n; i+=2){
            cout << a[i] << ' ';
        }
    }
    else{
        for(int i = 1; i < n; i+=2){
            cout << a[i] << ' ';
        }
    }
    return 0;
}


Measured memory_bytes: 2944
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define MAX_C 1000000001


int main() {
  int n;
  cin >> n;
  ll s = 0;
  for (int i = 1; i <= n; i++) {
    if ((i % 3) * (i % 5) != 0) s += i;
  }

  cout << s << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(15);

    int a;
    cin>>a;
    cout<<a*a*a+a*a+a<<endl;
    return 0;
}

Measured memory_bytes: 3652
def erat(n):
    l = [0, 0] + [1 for _ in range(n - 1)]
    i = 2
    while (i < n + 1):
        if l[i] == 1:
            for j in range(i**2, n + 1, i):
                l[j] = 0
        i += 1

    return l


n_max = 10**5
is_prime = erat(n_max)
is_2017 = [0 for _ in range(n_max + 1)]
for i in range(2, n_max + 1):
    if is_prime[i] and is_prime[(i + 1) // 2]:
        is_2017[i] = 1

s = [0]
for i in range(1, n_max + 1):
    s.append(s[i - 1] + is_2017[i])

q = int(input())
for _ in range(q):
    li, ri = map(int, input().split())
    print(s[ri] - s[li - 1])

Measured memory_bytes: 7944
s=input()
n=len(s)
if n==1:print(1);exit()
d=[0]*n
e=[0]*n
d[0]=1
e[1]=1
if s[0]!=s[1]:d[1]=2
for i in range(2,n):
    d[i]=e[i-1]+1
    e[i]=d[i-2]+1
    if s[i-1]!=s[i]:
        d[i]=max(d[i],d[i-1]+1)
    if s[i-3:i-1]!=s[i-1:i+1]:
        e[i]=max(e[i],e[i-2]+1)
print(max(d[-1],e[-1]))

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

int n,x[100005],y[100005],t[100005];
int dis,tim;
bool f;

int abs(int a,int b) {
	return a>b?a-b:b-a;
}

int main() {
//	freopen("c.in","r",stdin);
//	freopen("c.out","w",stdout);
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d%d",&t[i],&x[i],&y[i]);
	x[0]=0; y[0]=0; t[0]=0;
	int j=1; f=true;
	while (f && j<=n) {
		dis=abs(x[j],x[j-1])+abs(y[j],y[j-1]);
		tim=t[j]-t[j-1];
		if (dis>tim) f=false;
		if ((abs(dis,tim))%2!=0) f=false;
		j++;
	}
	if (f) printf("Yes\n"); else printf("No\n");
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 1408
import java.util.*;
 
public class Main{
 
	public static void main(String[] args){
 
		Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String[] row = new String[N];
        int[] count = new int[N];
      
        for(int i = 0; i < N; i++){
          row[i] =sc.next();
        }
      
        Arrays.sort(row);
        int Max = 0;
        for(int i = 0; i < N; i++){
          for(int j = i+1; j < N; j++){
            if(row[i].equals(row[j])){
              count[i] +=1;
            }else{
              break;
            }
          }
          
          if(Max < count[i]){
            Max = count[i];
          }
          i += count[i];
        }
    
      for(int i = 0; i < N; i++){
          if(Max == count[i]){
            System.out.println(row[i]);
          }
        }
      
	}
}

Measured memory_bytes: 72836
#include<iostream>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

typedef pair<int,int> P;

int main(void){

  int n,q,cnt[1000001];
  priority_queue<P>que;
  que.push(P(0,-1));
  fill(cnt,cnt+1000001,0);

  cin >> n >> q;
  while(q--){
    int a,v;
    cin >> a >> v;
    cnt[a]+=v;
    que.push(P(cnt[a],-a));
    while(true){
      P res=que.top();
      if(res.first==cnt[-res.second]){
	cout << -res.second << " " << res.first << endl;
	break;
      }
      que.pop();
    }
  }
  return 0;
}

Measured memory_bytes: 6008
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
 
using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;



int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  if (n == 2) {
    cout<<-1<<endl;
  } else if (n == 3) {
    cout<<"..a\n..a\naa." << endl;
  } else if (n == 7) {
    cout << "aab...b\nb.b...b\nbaa...a\n...aaba\n...b.bc\n...baac\nbbaabb." << endl;
  } else {
    int four = n / 4;
    int rem = n % 4;
    int five = 0;
    int six = 0;
    if (rem % 2) {
      ++five;
      --four;
    }
    if (rem / 2) {
      ++six;
      --four;
    }
    vector<string> t4 = {
      "aacd",
      "bbcd",
      "cdaa",
      "cdbb"
    };
    for (int j:irange(0,four)) {
      for (int r:irange(0,4)) {
        for(int k:irange(0,j)) {
          cout<<"....";
        }
        cout<<t4[r];
        for(int k:irange(4*(j+1),n)) {
          cout<<'.';
        }
        cout<<'\n';
      }
    }
    int offset = 4*four;
    if (five) {
      vector<string> t5 = {
        "..abc",
        "..abc",
        "aabaa",
        "ccb.b",
        "bbaab"
      };
      for(int r:irange(0,5)) {
        for(int k:irange(0,offset)) {
          cout<<'.';
        }
        cout<<t5[r];
        if(six) cout<<"......";
        cout<<'\n';
      }
      offset += 5;
    }
    if (six) {
      vector<string> t6 = {
        "..abbc",
        "..ac.c",
        "aa.cbb",
        "bba..a",
        "a.a..a",
        "abbaa."
      };
      for(int r:irange(0,6)) {
        for(int k:irange(0,offset)) {
          cout<<'.';
        }
        cout<<t6[r]<<'\n';
      }
    }
    cout<<flush;
  }
  return 0;
}


Measured memory_bytes: 1280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		char op = sc.next().charAt(0);
		int B = sc.nextInt();
		sc.close();

		int answer = 0;

		switch (op) {
		case '+':
			answer = A + B;
			break;
		case '-':
			answer = A - B;
			break;
		}

		System.out.println(answer);
	}

}


Measured memory_bytes: 21840
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class Main{
    public static void main(String[] args){
 
        Scanner sc = new Scanner(System.in);

        System.out.println(sc.nextInt()*sc.nextInt());

    }
}

Measured memory_bytes: 35960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <cmath>
#include <numeric>
#include <functional>
#include <stack>
#include <iomanip>
#include <map>
#include <cstdio>

int main() {
	int a, b, c;

	std::cin >> a >> b >> c;

	if (a == b && a != c) {
		std::cout << "Yes" << std::endl;
	}
	else if (a == c && a != b) {
		std::cout << "Yes" << std::endl;
	}
	else if (b == c && a != b) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}

	return 0;
}


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

using namespace std;

int N, a[200009];

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d", &N);
for (int i=1; i<=N; i++)
    scanf ("%d", &a[i]);
if (N & 1)
{
    for (int i=N; i>=1; i-=2)
        printf ("%d ", a[i]);
    for (int i=2; i<=N; i+=2)
        printf ("%d ", a[i]);
}
else
{
    for (int i=N; i>=1; i-=2)
        printf ("%d ", a[i]);
    for (int i=1; i<=N; i+=2)
        printf ("%d ", a[i]);
}
printf ("\n");
return 0;
}


Measured memory_bytes: 2944
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int ans = a <= 5 ? 0 : a <= 12 ? b / 2 : b;
		System.out.println(ans);

	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
 
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
 
/* vector<int> A(N); 
    vector<pair<int, int> > tasks; ＃ソートした場合、１つ目でソート
　tie(b, a) = p.at(i); #pairを分割
    tasks.emplace_back(b, a)  ＃配列tasksの最後に(b,a)を追加
　xの二乗:  pow(x, 2.0) 
    小さい順: sort(v.begin(), v.end());
    大きい順: reverse(v.begin(), v.end());
    int: -2,147,483,648 ～ 2,147,483,647
    ll: -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807
    // int型の2次元配列(3×4要素の)の宣言
    vector<vector<int>> data(3, vector<int>(4));
*/
 
int main() {
  
  int A, B, C, count=0, ans=0;
  string D, E;
  cin >> D;
  
  rep(i,3){
    if(D.at(i)=='7')count++;
  }
  if(count==0)cout << "No" << endl;
  else cout << "Yes" << endl;
  
}
 

Measured memory_bytes: 3608
k=int(input())
dp=[0]*1000001
val=0
cnt=0
flag=1
for i in range(0,1000000):
    cnt+=1;
    val=val*10+7
    if(val%k==0):
        break
    val=val%k
    if(dp[val]==1):
        flag=0;
        break;
    else:
        dp[val]=1
if flag==0:
    print(-1)
else:
    print(cnt)



# 7
# 77
# 7*10 + 7
# 7*100+7*10+7

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

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

    int ans = 0;
    if(n > 1) ans += n*(n-1)/2;
    if(m > 1) ans += m*(m-1)/2;
    cout << ans << endl;
    return 0;
}


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

int main(){
	int n;
	cin>>n;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		int j=a[i];
		if(a[j]==i)ans++;
	}
	cout<<ans/2<<endl;
	return 0;
}

Measured memory_bytes: 640
#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;
int max_cou, ans = 1;

int myLog(int num)
{
	int res = 0;
	while (num % 2 == 0)
	{
		++res;
		num /= 2;
	}
	return res;
}

int main()
{
	in >> N;

	for (int i = 1; i <= N; ++i)
	{
		if (max_cou < myLog(i))
		{
			max_cou = myLog(i);
			ans = i;
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<cstdio>
#include<vector>
#include<utility>
#include<queue>

typedef vector<pair<int, int> > adj;

struct current_cost
{
    int index, cost;
    bool operator < (const current_cost &cur) const
    {
        return cost > cur.cost;
    }
};

current_cost init(int i, int c)
{
    current_cost cur;
    cur.index = i, cur.cost = c;
    return cur;
}

int main()
{
    int i, j, k, n, m, next, cost;
    scanf("%d", &n);
    adj *adlist;
    adlist = new adj [n];

    for(k = 0; k < n; k++){
        scanf("%d %d", &i, &m);
        for(j = 0; j < m; j++){
            scanf("%d %d", &next, &cost);
            adlist[i].push_back(make_pair(next, cost));
        }
    }

    int *d;
    d = new int [n];
    for(i = 1; i < n; i++){ d[i] = 200000; }
	d[0] = 0;

    priority_queue<current_cost> C;
    current_cost cur = init(0, 0);
    C.push(cur);

    int size;
    bool *check;
    check = new bool [n];
    for(i = 0; i < n; i++){ check[i] = false; }
	int rest = n;

    while(!C.empty())
    {
        cur = C.top(); C.pop();
		i = cur.index;
        if(check[i]) continue;
        check[i] = true; rest--;
 
        size = adlist[i].size();
        for(j = 0; j < size; j++){
            k = adlist[i][j].first;
            if(d[i] + adlist[i][j].second < d[k]){
                d[k] = d[i] + adlist[i][j].second;
                C.push(init(k, d[k]));
            }
        }
		if(rest == 0) break;
    };
    for(i = 0; i < n; i++){ printf("%d %d\n", i, d[i]); }

    return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    REP(i, H) cin >> S[i];

    int ans = 0;
    // (i, j) からいける場所の最短経路の最長距離を求める
    REP(i, H){
        REP(j, W){
            if(S[i][j] == '#') continue;

            vector<vector<int>> dist(H, vector<int>(W, 1e+3));
            dist[i][j] = 0;

            queue<pair<int,int>> q;
            q.push({i, j});

            while(!q.empty()){
                auto tmp = q.front();
                q.pop();
                int x = tmp.first;
                int y = tmp.second;
                vector<pair<int,int>> next = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
                for(auto n: next){
                    int nx = x+n.first;
                    int ny = y+n.second;
                    if(0 <= nx and nx < H and 0 <= ny and ny < W and S[nx][ny] == '.'){
                        if(dist[nx][ny] > dist[x][y]+1){
                            dist[nx][ny] = dist[x][y]+1;
                            q.push({nx, ny});
                        }
                    }
                }
            }
            REP(k, H){
                REP(l, W){
                    if(dist[k][l] != 1e+3) ans = max(ans, dist[k][l]);
                }
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, a, n) for ( i = a; i < (n); i++)
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define x first
#define y second
#define mp make_pair
#define pb push_back
using namespace std;

int main(){
	fast;
	ll i,j,k,tc,q,n,flag;	
	cin>>n;
	ll dp[3]={0};
	ll a[n][3];
	rep(i,0,n){
		cin>>a[i][0]>>a[i][1]>>a[i][2];
	}
	
	rep(k,0,n){
		ll dp1[3]={0};
		
		rep(i,0,3){
			rep(j,0,3){
				if(i!=j){
					dp1[j] = max(dp1[j],dp[i]+a[k][j]);
				}
			}
		}
		dp[0]=dp1[0];
		dp[1]=dp1[1];
		dp[2]=dp1[2];
		
	}

	// for(auto i : dp)
	// 	cout<<i<<" ";
	// cout<<endl;

	cout<<max(dp[0],max(dp[1],dp[2]))<<endl;


	return 0;
}


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

int main()
{
	int t, n;

	for(int i=0; i<4; i++)
	{
		cin >> t >> n;

		switch(t){
			case 1:	
				cout << n*6000 << endl;
				break;
			case 2:
				cout << n*4000 << endl;
				break;
			case 3:
				cout << n*3000 << endl;
				break;
			case 4:
				cout << n*2000 << endl;
				break;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  string s;cin>>s;
  int x;
  x=s.length();
  int cnt=0;
  rep(i,x){
    if(s[i]=='o') cnt++;
  }
  cnt+=15-x;
  if(cnt>=8) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}


Measured memory_bytes: 256
nums = list(map(int, input().split()))
matrix0, matrix1 = [], []
for n in range(nums[0]):
    matrix0.append(list(map(int, input().split())))    
for m in range(nums[1]):
    matrix1.append(int(input()))
for n in range(nums[0]):
    v = 0
    for m in range(nums[1]):
        v += matrix0[n][m] * matrix1[m]
    print(v)


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

int main(){
  int N;
  cin >> N;
  ll p=1;
  ll a=(pow(10,9)+7);
  
  for(ll i=1;i<=N;i++){
    p=p*i;
    p=p%a;
  }
  
  cout << p <<endl;
}

    

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59
using ld = long double;

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //cout << fixed << setprecision(5);

    int N;
    string s;
    cin >> N >> s;

    int S = 0, D = 0;
    for (int i = 0; i < N; ++i)
    {
        if (s[i] == '.')
            D++;
    }
    int ans = 20000000;

    for (int i = 0; i < N; ++i)
    {
        if (s[i] == '.')
        {
            D--;
            ans = min(ans, D + S);
        }
        else
        {

            ans = min(ans, D + S);
            S++;
        }
    }

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

Measured memory_bytes: 720
#include <iostream>
#include <string>
#include <set>
#include <algorithm>

using namespace std;
typedef long long ll;
#define all(x) begin(x), end(x)

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

    if (s == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;

    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <string.h>

#define MAX_LEN  100

int main()
{
  char str[MAX_LEN + 1];
  int len;
  scanf("%s", str);
  len = strlen(str);
  printf("%c%d%c\n", str[0], len - 2, str[len - 1]);
  return 0;
}


Measured memory_bytes: 128
import bisect as bi

li6 = [6 ** i for i in range(7)]
li9 = [9 ** i for i in range(6)]

def s69(n):
  if n < 6:
    return n
  else:
    s6 = li6[bi.bisect(li6, n)-1]
    s9 = li9[bi.bisect(li9, n)-1]
    return min(n // s6 + s69(n % s6), 1 + s69(n-s9), n // s9 + s69(n % s9))
  
print (s69(int(input())))

Measured memory_bytes: 3064
s = input()
min = 0
flg = 0
max = 0
for i in range(len(s)):
    if s[i] == 'A':
        if flg == 0:
            min = i
            flg = 1
    
    if s[i] == 'Z':
        max = i

ans = max - min + 1
print(ans)

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, x;
    int A[10001]={0};
    cin>>n;
    for(int i=0; i<n; i++) {
        cin>>x;
        A[x]++;
    }
    bool s=false;
    for(int i=0; i<=10000; i++) {
        for(int j=0; j<A[i]; j++) {
            if(s) cout<<' ';
            else s=true;
            cout<<i;
        }
    }
    cout<<'\n';
    return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i =(a); i <(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const bool debug = 0;

int N, Q;
int s[1123456];
multiset<int> lp;
int cn;
vector<int> cx;
vector<int> cnt, sum;

int solve(int R) {
	int c = 0;
	
	for (multiset<int>::iterator it = lp.begin(); it != lp.end(); ++it) {
		int idx = lower_bound(ALL(cx), *it) - cx.begin();
		int dnum = *it - R; // [dnum, *it]
		
		multiset<int>::iterator nex = it;
		if (it != lp.begin()) {
			--nex;
			if (*nex == *it) continue;
			chmax(dnum, *nex + 1);
		}
		c += sum[idx + 1] - sum[lower_bound(ALL(cx), dnum) - cx.begin()];
	}
	return N - c;
}

int main() {
	cin >> N >> Q;
	REP(i, N) scanf("%d", s + i);
	
	REP(i, N) cx.push_back(s[i]);
	sort(ALL(cx));
	cx.erase(unique(ALL(cx)), cx.end());
	
	cn = cx.size();
	cnt.resize(cn, 0);
	REP(i, N) cnt[lower_bound(ALL(cx), s[i]) - cx.begin()]++;
	
	sum.resize(cn + 1, 0);
	REP(i, cn) sum[i + 1] = sum[i] + cnt[i];
	
	while (Q--) {
		string qs; int x;
		cin >> qs >> x;
		if (qs == "ADD") {
			lp.insert(s[x - 1]);
		}
		else if (qs == "REMOVE") {
			lp.erase(lp.find(s[x - 1]));
		}
		else {
			// ????????¢?´¢?????????
			int l = -1, r = 1000000001;
			
			while (r - l > 1) {
				int m = (l + r) / 2;
				if (solve(m) <= x) r = m;
				else l = m;
			}
			
			if (r == 1000000001) puts("NA");
			else cout << r << endl;
		}
	}
	
	return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

string s;
string c[] = { "SUN","MON","TUE","WED","THU","FRI","SAT" };
void solve() {
    cin >> s;

    auto n = sz(s);
    rep(i, 7)
        if (s == c[i]) { cout << 7 - i << endn; return; }

}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout << flush;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/


const int N = 1000001;
bool prime[N + 1];
vector<int> primes;

void hurui()
{
	memset(prime, true, sizeof(prime));
	prime[0] = prime[1] = false;
	for (int i = 2; i*i < N; i++)
	{
		if (!prime[i]) continue;
		for (int j = i; i*j < N; j++)
		{
			prime[i*j] = false;
		}
	}
	REP(i, N + 1)
	{
		if (prime[i]) primes.push_back(i);
	}
}

vector<vector<bool>> fld(1500, vector<bool>(1500));
vector<vi> id(1500, vi(1500));
vector<pii> place(1111111);

void init()
{
	hurui();
	int x = 700, y = 700, tmp = 1;
	for (int i = 1;; i++)
	{
		REP(j, i * 2 - 1)
		{
			if (tmp == 1111110) break;
			id[x][y] = tmp;
			place[tmp] = pii(x, y);
			tmp++;
			y++;
		}
		REP(j, i * 2 - 1)
		{
			if (tmp == 1111110) break;
			id[x][y] = tmp;
			place[tmp] = pii(x, y);
			tmp++;
			x--;
		}
		REP(j, i * 2)
		{
			if (tmp == 1111110) break;
			id[x][y] = tmp;
			place[tmp] = pii(x, y);
			tmp++;
			y--;
		}
		REP(j, i * 2)
		{
			if (tmp == 1111110) break;
			id[x][y] = tmp;
			place[tmp] = pii(x, y);
			tmp++;
			x++;
		}			
		if (tmp == 1111110) break;
	}
	REP(i, primes.size()) fld[place[primes[i]].first][place[primes[i]].second] = true;
}

int m, n;
pii dp[1500][1500];

pii solve(int x, int y)
{
	if (x == 1500) return pii(0, 0);
	if (dp[x][y].first >= 0) return dp[x][y];
	pii res(0, 0);
	if (y > 0) chmax(res, solve(x + 1, y - 1));
	chmax(res, solve(x + 1, y));
	if (y < 1499) chmax(res, solve(x + 1, y + 1));
	if (fld[x][y] && id[x][y] <= m)
	{
		res.first++;
		if (res.second == 0) res.second = id[x][y];
	}
	return dp[x][y] = res;
}


int main()
{
	cin.sync_with_stdio(false);

	init();
	while (cin >> m >> n, m)
	{
		REP(i, 1500)REP(j, 1500) dp[i][j] = pii(-1, -1);
		int x = place[n].first, y = place[n].second;
		pii ans = solve(x, y);
		cout << ans.first << " " << ans.second << endl;
	}
	return 0;
}

Measured memory_bytes: 39972
using System;
using System.Linq;
using System.Collections.Generic;

class Bmondai
{
    static void Main()
    {
        var line=Console.ReadLine().Split(' ').Select(x=>Int32.Parse(x)).ToArray();
        for (int i=1;i<=line[2];++i)
        {
            if (i % 2 == 1)
            {
                if (line[0] % 2 != 0) line[0]--;
                line[0] /= 2;
                line[1] += line[0];
            }
            else
            {
                if (line[1] % 2 != 0) line[1]--;
                line[1] /= 2; ;
                line[0] += line[1];
            }
        }
        Console.WriteLine($"{line[0]} {line[1]}");
    }
}

Measured memory_bytes: 13396
#include <iostream>

long long destroy(long long health) {
	if (health == 1) {
		return 1;
	}
	long long sum = 2 * destroy(health / 2) + 1;
	return sum;
}

int main(void) {
	long long monster_health = 0;
	std::cin >> monster_health;
	std::cout << destroy(monster_health) << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<iomanip>
#include<stack>
#include<string.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define sz(a) (int)a.size()
using namespace std;

int main() {
	int n;
	cin >> n;
	int ans = 0;
	int cnt = 1;
	rep(i, n) {
		int ai;
		cin >> ai;
		if (cnt % 2 == 1 && ai % 2 == 1) ans++;
		cnt++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 3592
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner scan = new Scanner(is);
        String S = scan.next();
        if(S.charAt(2) == S.charAt(3) && S.charAt(4) == S.charAt(5))
            os.println("Yes");
        else
            os.println("No");
    }
}

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

int main(){
  int n, v[50], c[50], sum = 0;
  cin >> n;
  for(int i = 0;i < n;i++){
    cin >> v[i];
  }
  for(int j = 0;j < n;j++){
    cin >> c[j];
  }
  for(int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      if(i == j){
      if(v[i] > c[j]){
        sum += (v[i] - c[i]);
      }
     }
    }
  }
    cout << sum;
  }

Measured memory_bytes: 3508
#include<iostream>
#include<vector>
#include<set>
using namespace std;

int main(){
    string s = "abcdefghijklmnopqrstuvwxyz";
    string str;
    cin >> str;
    set<char> st;

    for(int i=0;i<s.size();i++){
        st.insert(s[i]);
    }

    for(int i=0;i<str.size();i++){
      st.erase(str[i]);
    }

    if(st.size()==0){
        cout << "None" << endl;
    }else{
        cout << (*st.begin()) << endl; 
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//ワーシャルフロイト法のテンプレ.graphに最短経路が格納される.
//負の重みがある場合inf + const = inf に気を付けること.
//graphは隣接行列.
void WF(vector<vector<int>> &graph){
	int n = graph.size();
	for (int k = 0; k < n; k++){
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j]);
			}
		}
	}
}

//素因数分解をする関数.
map<long long int, int> prime_factorization(long long int a)
{
	map<long long int, int>ans;
	for (long long i = 2; i*i <= a; ++i) {
		while (a%i == 0) {
			ans[i]++;
			a /= i;
		}
	}
	if (a != 1)ans[a]++;
	return ans;
}

int main()
{
	string s, t;
	cin >> s >> t;
	int n = s.size();
	int m = t.size();
	int ans = inf;

	rep(i, n-m+1)
	{
		int temp = 0;
		rep(j,m){
			if(s[i+j] != t[j]){
				temp++;
			}
		}
		ans = min(temp, ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3640
/* template.cpp {{{ */
#include <bits/stdc++.h>
using namespace std;
#define get_macro(a, b, c, d, name, ...) name
#define rep(...) get_macro(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(...) get_macro(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define rep1(n) rep2(i_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define rep4(i, a, b, s) for (ll i = (a); i < (ll)(b); i += (ll)(s))
#define rrep1(n) rrep2(i_, n)
#define rrep2(i, n) rrep3(i, 0, n)
#define rrep3(i, a, b) rrep4(i, a, b, 1)
#define rrep4(i, a, b, s) for (ll i = (ll)(b) - 1; i >= (ll)(a); i -= (ll)(s))
#define each(x, c) for (auto &&x : c)
#define fs first
#define sc second
#define all(c) begin(c), end(c)
using ui = unsigned;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int inf = 1e9 + 10;
const ll inf_ll = 1e18 + 10;
const ll mod = 1e9 + 7;
const ll mod9 = 1e9 + 9;
const int dx[]{-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[]{0, -1, 0, 1, -1, -1, 1, 1};
template<class T, class U> void chmin(T &x, const U &y){ x = min<T>(x, y); }
template<class T, class U> void chmax(T &x, const U &y){ x = max<T>(x, y); }
struct prepare_ { prepare_(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(12); } } prepare__;
/* }}} */

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a * b, c * d) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 100
#define INFTY 100000000
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[MAX][MAX];

void Dijkstra(void);

int main()
{
  int i, j;
  int u, k, v, c;
  
  scanf("%d", &n);
  
  for( i = 0 ; i < n ; i++ )
    for( j = 0 ; j < n ; j++ )
      M[i][j] = INFTY;
  
  for( i = 0 ; i < n ; i++ ){
    scanf("%d%d", &u, &k);
    for( j = 0 ; j < k ; j++ ){
      scanf("%d%d", &v, &c);
      M[u][v] = c;
    }
  }

  Dijkstra();

  return 0;
}

void Dijkstra()
{
  int i, u, v, min;
  int color[MAX], d[MAX];

  for( i = 0 ; i < n ; i++ ){
    color[i] = WHITE;
    d[i] = INFTY;
  }
  
  d[0] = 0;
  color[0] = GRAY;
  
  while( 1 ){
    min = INFTY;
    u = -1;
    for( i = 0 ; i < n ; i++ ){
      if( color[i] != BLACK && min > d[i] ){
	u = i;
	min = d[i];
      }
    }
    if( min == INFTY ) break;
    color[u] = BLACK;
    for( v = 0 ; v < n ; v++ ){
      if( color[v] != BLACK && M[u][v] != INFTY ){
	if( d[v] > (d[u] + M[u][v]) ){
	  d[v] = d[u] + M[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }

  for( i = 0 ; i < n ; i++ ){
    printf("%d ", i);
    if( d[i] == INFTY ) printf("-1\n");
    else printf("%d\n", d[i]);
  }
  
}

Measured memory_bytes: 636
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <sstream>

#define DEBUG 1
#define fi first
#define se second
#define pb push_back
#define fore(i, a, b) for (int i = (a), _b = (b); i < (_b); ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= (_b); ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= (_b); --i)

using namespace std;

typedef long long LL;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1e9 + 3;
const int MOD = 1e9 + 7;
                                        
int main() {
#ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(false); cin.tie(0);
#endif                                  
	string s; cin >> s;
	sort(s.begin(), s.end());
	cout << ((s[0] == s[1] && s[2] == s[3] && s[0] != s[3]) ? "Yes\n" : "No\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fi first
#define se second
#define pb push_back
#define mk make_pair

using namespace std;
typedef long long ll;
ll mod = 998244353;
int main() {
	fastio;
	ll n;
	cin>>n;
	vector<ll> a(n,0),b;
	for(ll i=0;i<n;i++){
		cin>>a[i];
	}
	b = a;
	sort(b.begin(),b.end());
	
	ll ind1 = n/2-1, ind2 = n/2;
	for(ll i=0;i<n;i++){
		if(a[i]<=b[ind1]){
			cout<<b[ind2]<<"\n";
		}
		else{
			cout<<b[ind1]<<"\n";
		}
	}
	
	
	
	
}






Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for(int i=0;i<(n); ++i)
using namespace std;
typedef long long ll;


int main()
{
	ll a, b;
	cin >> a >> b;
	cout << ceil((double)(b-1)/(double)(a-1)) << endl;
}

Measured memory_bytes: 256