akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
//setprecision(12)
#include <cassert>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define Cout(x) cout << x << endl;
#define check(v) rep(i,v.size()) cout << v[i] << endl;
#define vint(x) vector<int> x
#define vll(x) vector<long long> x
#define vstr(x) vector<string> x
const long long LLINF = 1LL<<60;
const int INF = 1e9;
const long long MOD = 1000000007;
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; }
typedef long long ll;
#define pint pair<int,int>
#define pll pair<ll,ll>
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x; cin >> x;
    if(x<600) cout << 8 << endl;
    else if(x<800) cout << 7 << endl;
    else if(x<1000) cout << 6 << endl;
    else if(x<1200) cout << 5 << endl;
    else if(x<1400) cout << 4 << endl;
    else if(x<1600) cout << 3 << endl;
    else if(x<1800) cout << 2 << endl;
    else if(x<2000) cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#define IOS ios::sync_with_stdio(false),cin.tie(0)
using namespace std;
typedef long long ll;

vector<int> A;
int N;
ll ans;
string s;
int main() {
	cin >> N;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		int t;
		cin >> t;
		A.push_back(t);
		if (i) {
			if (A[i] == A[i - 1]) {
				A[i] += 100 + i;
				ans++;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MOD 1000000007
#define mp make_pair
#define ll long long
#define pb push_back
#define faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define debug cout<<"Debugging.."<<endl
using namespace std;
int main()
{
	faster;
	map<string,int> m;
	
	string a,b;
	cin>>a>>b;
	
	int c,d;
	cin>>c>>d;
	m[a]=c,m[b]=d;
	string p;
	cin>>p;
	if(m.find(p)!=m.end())
	m[p]--;
	
	cout<<m[a]<<" "<<m[b];	
}




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

using namespace std;

int main()
{
    int n , l;
    scanf("%d %d" , &n , &l) ;
    long long arr[n] ;
    for(int i = 0 ; i < n ; ++i)
        scanf("%lld" , &arr[i]) ;
    int MAX = *max_element(arr , arr + n) ;
    long long sum = 0ll ;
    vector<int>ans ;
    for(int i = 0 ; i < n ; ++i)
    {
        sum = arr[i] ;
        if(i == 0)
        {
            sum += arr[i+1] ;
            if(sum < l)
                continue;
            printf("Possible\n");
            for(int j = 1 ; j < n ; ++j)
                ans.push_back(j) ;
            reverse(ans.begin() , ans.end()) ;
            for(int j = 0 ; j < n-1 ; ++j)
                printf("%d\n" , ans[j]);
            return 0 ;
        }
        else if(i == n-1)
        {
            sum += arr[i-1] ;
            if(sum < l)
                continue;
            printf("Possible\n");
            for(int j = n-1 ; j >= 1 ; --j)
                ans.push_back(j) ;
            reverse(ans.begin() , ans.end()) ;
            for(int j = 0 ; j < n-1 ; ++j)
                printf("%d\n" , ans[j]);
            return 0 ;
        }
        else
        {
            sum += arr[i+1] ;
            if(sum >= l)
            {
                printf("Possible\n");
                for(int j = i+1 ; j < n ; ++j)
                    ans.push_back(j) ;
                for(int j = i ; j >= 1 ; --j)
                    ans.push_back(j) ;
                reverse(ans.begin() , ans.end()) ;
                for(int j = 0 ; j < n-1 ; ++j)
                    printf("%d\n" , ans[j]);
                return 0 ;
            }
            sum -= arr[i+1] ;
            sum += arr[i-1] ;
            if(sum >= l)
            {
                printf("Possible\n");
                for(int j = i ; j >= 1 ; --j)
                    ans.push_back(j) ;
                for(int j = i+1 ; j < n ; ++j)
                    ans.push_back(j) ;
                reverse(ans.begin() , ans.end()) ;
                for(int j = 0 ; j < n-1 ; ++j)
                    printf("%d\n" , ans[j]);
                return 0 ;
            }
        }
    }
    return printf("Impossible\n") , 0 ;
}


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

using namespace std;

int main() {
	int K;
	string S;

	cin >> K;
	cin >> S;

	if (K >= S.length()) {
		cout << S << endl;
	}
	else {
		S = S.erase(K);
		S = S + "...";
		cout << S << endl;
	}

	return 0;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
#define MOD (1000000007ll)

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	ll x,ans;
	cin >> x;
	ans = (x/11)*2;
	x %= 11;
	if(x){
		ans += (x>6)?2ll:1ll;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int main(){
	int n;
	while(scanf("%d",&n)!=EOF){
		bool flag=false;
		for(int i=0;i<=25;i++)
		   for(int j=0;j<=14;j++)
		      if(i*4+j*7==n){
		      	flag=true;
			  }
		if(flag)printf("Yes\n");
		else printf("No\n");
	}
}

Measured memory_bytes: 128
$n=<>;
@A=glob<>;
$_+=--$i for(@A);
@A=sort{$a<=>$b}@A;
$k=$n%2?$A[$#A/2]:($A[$n/2]+$A[$n/2-1])>>1;
$o+=abs($_-$k) for(@A);
print $o

Measured memory_bytes: 53292
#include <bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<b;i++)
#define f(i,n) for(int i=0;i<n;i++)
typedef unsigned long long ull;
typedef long long ll;
#define vint vector<int>
#define vll vector<long long int>
#define pb(a) push_back(a);
#define bug(x) cout<<#x<<" = "<<x<<"\n";
#define fastio ios_base::sync_with_stdio(false); cin.tie(0)

long long int dp[3002][3002];

// long long int func(int j,int i,vint a){
// 	// cout<<"called j="<<j<<" i="<<i<<"\n";
// 	if(i==j){return dp[j][i]=a[i];}
// 	else{
// 		// cout<<dp[j][i]<<" "<<INT_MIN<<"\n";
// 		if(dp[j][i]!=-1){return dp[j][i];}
// 		// cout<<"here\n";
// 		return dp[j][i] = max((long long int)a[j]-func(j-1,i,a),(long long int)a[i]-func(j,i+1,a));
// 	}
// 	return 0;
// }



int main(){
	fastio;
	int n; 
	cin>>n;
	vll a(n);
	f(i,n){cin>>a[i];}
	memset(dp,-1,sizeof(dp));
	

	// func(n-1,0,a);
	f(i,n){
		dp[i][i]=a[i];
	}
	for(int i=n-1;i>=0;i--){
		F(j,i,n){
			if(i==j){continue;}
			else{
				dp[i][j] = max(a[i]-dp[i+1][j],a[j] - dp[i][j-1]);
			}
		}
	}
	// cout<<dp[0][n-1]<<"\n";


	// for(int i=0;i<n;i++){
	// 	for(int j=0;j<n;j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	cout<<dp[0][n-1]<<"\n";
	return 0;
}

Measured memory_bytes: 74024
#include<bits/stdc++.h>
#define maxn 200010
#define ll long long
#define mod 1000000007
using namespace std;
char s[maxn];
int f[maxn], pre[maxn];
int main()
{
	int n, m, mx = 0, flag = 1;
	scanf("%d%d", &n, &m);
	scanf("%s", s + 1);
	for (int i = 2; i <= m; i++)
		if (s[i] != s[1]) flag = 0;
	if (flag == 0)
	{
		int st;
		for (int i = 1; i <= m; i++)
			if (s[i] != s[1])
			{
				st = i;
				mx = i - 1;
				if (mx % 2 == 0) mx++;
				break;
			}
		while (st <= m)
		{
			int cur = st;
			while (cur <= m && s[cur] == s[st]) cur++;
			if (cur != m + 1 && s[st] == s[1] && (cur - st) % 2) mx = min(mx, cur - st);
			st = cur;
		}
		if (n % 2) {puts("0"); return 0;}
		n /= 2;
		mx = (mx + 1) / 2;
	}
	else mx = n;
	f[0] = pre[0] = 1;
	for (int i = 1; i <= n; i++)
	{
		f[i] = pre[i - 1];
		if (i - mx - 1 >= 0) f[i] = (f[i] - pre[i - mx - 1] + mod) % mod;
		if (flag) f[i] = (f[i] - f[i - 1] + mod) % mod;
		pre[i] = (pre[i - 1] + f[i]) % mod;
	}
	int res = flag;
	for (int i = flag + 1; i <= mx; i++)
		res = (res + (ll)i * f[n - i] % mod) % mod;
	if (flag == 0) res = (ll)res * 2 % mod;
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 2048
#include<stdio.h>
#include<ctype.h>

inline int read(){
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x*=10;x+=(ch-'0');ch=getchar();
	}
	return x*f;
}

inline void write(int x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}

int main(){
	int n=read();
	int s=48;
	write(48-n);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2
int n,M[N][N];
int color[N],d[N],f[N],tt;
void dfs_visit(int u)
{
    int v;
    color[u]=GRAY;
    d[u]=++tt;
    for(v=0;v<n;v++)
    {
        if(M[u][v]==0)continue;
        if(color[v]==WHITE)
        dfs_visit(v);
    }
    color[u]=BLACK;
    f[u]=++tt;
}
void dfs()
{
    int u;
    for(u=0;u<n;u++) color[u]=WHITE;
    tt=0;
    for(u=0;u<n;u++)
    {
        if(color[u]==WHITE) dfs_visit(u);
    }
    for(u=0;u<n;u++)
    {
        printf("%d %d %d\n",u+1,d[u],f[u]);
    }
}
int main()
{
    int a,b,c;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d %d",&a,&b);
        a--;
        for(int i=0;i<b;i++)
        {
            scanf("%d",&c);
            c--;
            M[a][c]++;
        }
    }
    dfs();
    return 0;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
#define ll long long
#define N 200005
using namespace std;
inline int read(){
    int ans=0;
    char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
    return ans;
}
int n;
ll ans=1e18,X,x[N],sum[N];
int main(){
    n=read(),X=read();
    for(int i=1;i<=n;++i)sum[i]=(x[i]=read())+sum[i-1];
    for(int k=1;k<=n;++k){
        ll tmp=0;
        for(int j=1,l=0,r=n;r&&tmp+k*X<ans;++j,r=l-1){
            l=max(r-k+1,1);
            tmp+=(j==1?5:(j<<1)+1)*(sum[r]-sum[l-1]);
        }
        ans=min(ans,tmp+k*X);
    }
    printf("%lld",ans+n*X);
    return 0;
}


Measured memory_bytes: 3328
// AGC011_A
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N, capacity, K;
    cin >> N >> capacity >> K;
    vector<ll> vec(N);
    REP(i, N) cin >> vec[i];
    
    sort(vec.begin(), vec.end(), greater<>());  // int big -> small
    
    // calculation
    if (N == 2) {
        if (capacity == 1) {
            cout << 2 << "\n";
        } else if (vec[0] - vec[1] < K) {
            cout << 1 << "\n";
        } else {
            cout << 2 << "\n";
        }
    } else {
        if (capacity == 1) {
            cout << N << "\n";
        } else {
            ll bus = 1;
            ll first = vec[0], now = 1;
            for (ll i = 1; i < N; ++i) {
                if (first - vec[i] <= K) {
                    if (now < capacity) {
                        now++;
                    } else if (now == capacity){
                        bus++;
                        now = 1;
                        first = vec[i];
                    }
                } else {
                    // 時間が離れていたら
                    bus++;  // 今の乗客を載せてリセット
                    now = 1;
                    first = vec[i];
                }
            }
            cout << bus << "\n";
        }
    }
    return 0;
}


Measured memory_bytes: 1024
//https://atcoder.jp/contests/dp/tasks/dp_a
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

ll N;
vector<ll> cost(10*10000);
vector<ll> H;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return b/gcd(a,b)*b;}

void memo(ll n) {
  if (n == 0) cost[n]=0;
  else if (n == 1) cost[n]=abs(H[n]-H[n-1]);
  else {
    //printf("%lld -> %lld: %lld, %lld -> %lld: %lld\n", n-1, n, cost[n-1]+abs(H[n]-H[n-1]), n-2, n,cost[n-2]+abs(H[n]-H[n-2]));
    cost[n] = min(cost[n-1]+abs(H[n]-H[n-1]), cost[n-2]+abs(H[n]-H[n-2]));
  }
}

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

  cin >> N;
  H.resize(N);
  rep(i, N) cin >> H[i];
  rep(i, N) {
    memo(i);
  }
  //rep(i,N) {
  //  cout << cost[i] << endl;
  //}
  cout << cost[N-1] << endl;
  return 0;
}


Measured memory_bytes: 1792
h, w = map(int,input().split())
s = [["."]*(w+2)] + \
    [list("." + input() + ".") for _ in range(h)] + \
    [["."]*(w+2)]
flg = 0
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] == "#":
            if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == "." :
                flg = 1
                break
if flg == 0 : print("Yes")
else : print("No")

Measured memory_bytes: 3064
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

flag = 'Yay!'
antenas = [a, b, c, d, e]
for i in range(5):
    for j in range(i, 5):
        if abs(antenas[i] - antenas[j]) > k:
            flag = ':(' # can'5

print(flag)


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cmath>
using namespace std;
int main(){
    int d, g, p[11], c[11];
    cin>>d>>g;
    for(int i=1;i<=d;i++){
        cin>>p[i]>>c[i];
    }
    int tmp,tmps,i,j,bit;
    int ans=999999999;
    for(i=0;i<(1<<d);i++){
        bit=i;
        tmp=0;
        tmps=0;
        int use[20];
        for(j=1;j<=d;j++){
            if(bit&1==1){
                tmp+=100*j*p[j]+c[j];
                tmps+=p[j];
                use[j]=p[j];
            }
            else use[j]=0;
            bit=bit>>1;
        }
        while(g>tmp){
            j=d;
            while(use[j]==p[j])j--;
            tmp+=100*j;
            tmps++;
            use[j]++;
            if(use[j]==p[j])tmp+=c[j];
        }
        if(ans>tmps)ans=tmps;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()

prod=True
N=5
ANS="BRRBBRBRBR"

def ask(A): # A:list-like
    print("? {}".format(' '.join(map(str,A))))
    sys.stdout.flush()
    if(prod): return input()
    else:
        cnt=0
        for a in A:
            cnt+=ANS[a-1]=='R'
        return "Red" if(cnt>(N-cnt)) else "Blue"

def resolve():
    def make_list(i):
        assert 1<=i<=n+1
        return list(range(i,i+n))
        
    n=int(input()) if(prod) else N

    # 二分法でRとBの境目を一つ見つける
    l=1; r=n+1
    lcol=ask(make_list(1))
    rcol="Red" if(lcol=="Blue") else "Blue"
    while(r-l>1):
        h=(l+r)//2
        hcol=ask(make_list(h))
        if(lcol==hcol): l=h
        else: r=h

    res=[None]*(2*n+1) # 1-indexed
    idx=l
    res[idx]=lcol[0]
    res[idx+n]=rcol[0]

    for i in range(1,idx):
        A=[i]+list(range(idx+1,idx+n))
        res[i]=ask(A)[0]
    for i in range(idx+n+1,2*n+1):
        A=list(range(idx+1,idx+n))+[i]
        res[i]=ask(A)[0]
    for i in range(idx+1,idx+n):
        A=list(range(1,idx))+[i]+list(range(idx+n+1,2*n+1))
        res[i]=ask(A)[0]
    print("! {}".format(''.join(res[1:])))
resolve()

Measured memory_bytes: 41304
#include<iostream>
#include<math.h>
#include<string.h>
using namespace std;

int seiyaku_check(long i,long Min,long Max){
	if(Min <= i && i <= Max){
		return 1;
	}else{
		exit(1);
		//return 0;
	}
}

int main(){
	
	string s,t,u,v;
	int i,j,k,l;
	cin >> s;
	
	i=s[0];
	j=s[1];
	k=s[2];
	l=s[3];
	
	t=s[0];
	t += s[1];
	
	u=s[3];
	u += s[2];
	
	v=s[2];
	v += s[3];
	
	//cout << v << endl;
	
	if(s.length() != 4){
		cout << "No" << endl;
	}else if(i < 65 || 90 < i){
		cout << "No" << endl;
	}else if(j < 65 || 90 < j){
		cout << "No" << endl;	
	}else if(k < 65 || 90 < k){
		cout << "No" << endl;
	}else if (l < 65 || 90 < l){
		cout << "No" << endl;
	}else if((s[0] == s[1])&&(s[2] == s[3])){
		if(s[1] == s[2]){
			cout << "No" << endl;
		}else{
			cout << "Yes" << endl;
		}			
	}else if((t != u)&&(t != v)){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn=(1<<18)+5;
const int mod=1e9+7;
int H,n,p[maxn],dep[maxn];
ll inv[maxn],S[maxn],invS[maxn],w[maxn][2],ans,res;
vector<int> g[maxn];
#define ls (rt<<1)
#define rs (rt<<1|1)
void init(int rt,int l,int r)
{
//	cout<<rt<<' '<<S[rt]<<' '<<invS[rt]<<endl;
	if(l==r) return;
	int mid=(l+r)>>1;
	dep[ls]=dep[rs]=dep[rt]+1;
	S[ls]=S[rt]*ls%mod;
	invS[ls]=invS[rt]*inv[ls]%mod;
	S[rs]=S[rt]*rs%mod;
	invS[rs]=invS[rt]*inv[rs]%mod;
	init(ls,l,mid),init(rs,mid+1,r);
}
inline int LCA(int x,int y)
{
	if(dep[x]<dep[y]) swap(x,y);
	while(dep[x]>dep[y]) x>>=1;
	if(x==y) return x;
	while(x!=y) x>>=1,y>>=1;
	return x;
}
void clear(int x)
{
	for(auto y:g[x]) clear(y);
	w[x][0]=w[x][1]=0,g[x].clear();
}
void dfs(int x)
{
	ll val=0;
	for(auto y:g[x])
	{
		dfs(y);
		(val+=w[x][0]*w[y][1]+w[x][1]*w[y][0])%=mod;
		(w[x][0]+=w[y][0])%=mod,(w[x][1]+=w[y][1])%=mod;
	}
	(res+=val*invS[x]%mod*invS[x>>1])%=mod;
}
inline void addedge(int x,int y) { g[x].push_back(y); }
void solve(int rt,int l,int r)
{
	if(l==r) return;
	int mid=(l+r)>>1;
	solve(ls,l,mid),solve(rs,mid+1,r);
//	printf("solve %d %d %d %lld\n",rt,l,r,S[rt]);
	for(int i=l;i<=mid;i++) w[p[i]+n-1][0]=S[i+n-1]*S[p[i]+n-1]%mod;
	for(int i=mid+1;i<=r;i++) w[p[i]+n-1][1]=S[i+n-1]*S[p[i]+n-1]%mod;
	static int h[maxn],sta[maxn],top;
	for(int i=l;i<=r;i++) h[i-l+1]=p[i]+n-1;
	int len=r-l+1;
	sort(h+1,h+len+1);
	sta[top=1]=1;
	for(int i=1;i<=len;i++)
	{
		int lca=LCA(sta[top],h[i]);
		while(dep[lca]<dep[sta[top]])
		{
			if(dep[sta[top-1]]<=dep[lca])
			{
				addedge(lca,sta[top]);
				if(sta[--top]!=lca) sta[++top]=lca;
				break;
			}
			addedge(sta[top-1],sta[top]);top--;
		}
		if(sta[top]!=h[i]) sta[++top]=h[i];
	}
	while(--top) addedge(sta[top],sta[top+1]);
	res=0,dfs(1),(ans+=res*invS[rt]%mod*invS[rt>>1])%=mod,clear(1);
}
int main()
{
	inv[0]=inv[1]=1;
	for(int i=2;i<maxn;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	scanf("%d",&H); n=(1<<(H-1));
	for(int i=1;i<=n;i++) scanf("%d",&p[i]);
	dep[1]=1,S[0]=invS[0]=S[1]=invS[1]=1ll,init(1,1,n),solve(1,1,n);
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 26280
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;



void solve() {
	int a, b; cin >> a >> b;
	cout << a * b << "\n";
}


signed main() {
	solve();
	return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

int main() {
	ll n, a, b; cin >> n >> a >> b;
	ll cost = 0;
	ll x[100001] = {};
	rep(i, 0, n) cin >> x[i];
	rep(i, 1, n) {
		cost += min(((x[i] - x[i - 1])* a), b);
	}
	cout << cost << endl;

	return 0;
}

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

using namespace std;

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

  int a,b;
  cin >> a>>b;
  if ((a+b)%3 == 0 || a % 3 == 0 || b % 3 == 0) {
    cout << "Possible\n";
  } else {
    cout << "Impossible\n";
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int N;cin>>N;
    if(N==1){
        cout<<0<<endl;
    }
    else{
        vector<ll>Ans(N,0);
        Ans[0]=0;
        vector<ll>C(N-1);
        vector<ll>S(N-1);
        vector<ll>F(N-1);
        rep(i,N-1){
            cin>>C[i]>>S[i]>>F[i];
        }
        ll time=0;//開始からの時間
        Ans[N-1]=0;
        for(int i=0;i<N-1;i++){
            ll time=0;//スタート時
            for(int j=i;j<N-1;j++){//jは今いる駅
                if(time<=S[j]){
                    time=S[j];//スタートまでは待つ;
                    time=time+C[j];//次の駅に着くまでの時間
                }
                else{
                    ll T=time-S[j];//駅に着いた時点で最初の出発から何分?
                    if(T%F[j]==0){
                        time=time+C[j];//着いた瞬間電車出発
                    }
                    else{
                        time=time+F[j]-T%F[j]+C[j];
                    }
                }
            }
            Ans[i]=time;
        }
        rep(i,N){
            cout<<Ans[i]<<endl;
        }
    } 
}

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

const ll MOD = 1e9 + 7;
ll p[1001];

int main() {
  int N;
  cin >> N;
  for (int n=2; n<=N; n++) {
    int m = n;
    for (int i=2; i<sqrt((double)m)+0.5; i++) {
      while (m%i == 0) {
        p[i]++;
        m /= i;
      }
    }
    p[m]++;
  }
  ll ans = 1;
  for (int i=2; i<=1000; i++) {
    if (p[i] == 0)
      continue;
    ans *= p[i]+1;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
typedef pair<int, int>p;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
	vector< long long> ret;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}
struct LazySegmentTree {
private:
	int n;
	vector<int> node, lazy;
	vector<bool> lazyFlag;

public:
	LazySegmentTree(vector<int> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1, INT_MAX);
		lazyFlag.resize(2 * n - 1, false);

		for (int i = 0; i<sz; i++) node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}

	void lazyEvaluate(int k, int l, int r) {
		if (lazyFlag[k]) {
			node[k] = lazy[k];
			if (r - l > 1) {
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
			}
			lazyFlag[k] = false;
		}
	}

	void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] = x;
			lazyFlag[k] = true;
			lazyEvaluate(k, l, r);
		}
		else {
			update(a, b, x, 2 * k + 1, l, (l + r) / 2);
			update(a, b, x, 2 * k + 2, (l + r) / 2, r);
			node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	int find(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return INT_MAX;
		if (a <= l && r <= b) return node[k];
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};
long long mod = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int n, x;
	cin >> n >> x;
	int now = 0;
	int ans = 1;
	int tmp = 0;
	for (int i = 0; i < n; i++) {
		cin >> tmp;
		now += tmp;
		if (now <= x)ans += 1;
	}
	cout << ans;
}

Measured memory_bytes: 256
// ITP1_11_A
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i, n) for (int i = 0; i < int(n); i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
    o << "{";
    for (int i = 0; i < (int)v.size(); i++)
        o << (i > 0 ? ", " : "") << v[i];
    o << "}";
    return o;
}
namespace you
{
std::string to_string(char val)
{
    return std::string(1, val);
    // return std::string{val};
    // you::to_string(char)
}
} // namespace you
vector<int> di(6);
tuple<int, int, int, int> c_sn()
{
    return forward_as_tuple(di[0], di[1], di[4], di[5]);
}
tuple<int, int, int, int> c_we()
{
    return forward_as_tuple(di[0], di[2], di[3], di[5]);
}

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

    string order = "EEEENEEEENEEEENEEEEENEEEENNEEEE"; //全パターン
    for (int i = 0; i < 6; i++)
    {
        int s;
        cin >> s;
        di[i] = s;
    }
    vector<int> di2(6);
    for (int i = 0; i < 6; i++)
    {
        int s;
        cin >> s;
        di2[i] = s;
    }

    bool flag = false;
    for (int i = 0; i < order.size(); i++)
    {
        int a, b, c, d;
        if (order[i] == 'N')
        {
            tie(a, b, c, d) = c_sn();
            di[0] = b;
            di[1] = d;
            di[4] = a;
            di[5] = c;
        }
        else
        {
            tie(a, b, c, d) = c_we();
            di[0] = c;
            di[2] = a;
            di[3] = d;
            di[5] = b;
        }
        //cout<<di<<endl;
        //cout<<di2<<endl;
        bool flag_ = true;
        for (int j = 0; j < 5; j++)
        {
            if (di[j] != di2[j])
            {
                flag_ = false;
                break;
            }
        }
        if (flag_)
        {
            flag = true;
            break;
        }
    }
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
#define DEBUG 0
#define nl          '\n'
#if     DEBUG
#define trace(var)  {cerr << "Line " << __LINE__ << ": " << #var << "=" << var << nl;}
#else
#define trace(var)	{}
#endif
#define fori(n)			for(int i = 0; i < n; ++i) 
#define forj(n)			for(int j = 0; j < n; ++j)
#define fork(n)			for(int k = 0; k < n; ++k)
#define forl(n)			for(int l = 0; l < n; ++l)

typedef long long ll;typedef pair<int,int> pii;typedef vector<bool> vbool;typedef vector<int> vint;typedef vector<ll> vll;typedef long double ld;typedef vector<vector<int>> vvi;

const ll N = 10010;
const ll INF = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n,a,b;
	cin >> n >> a >> b;
	cout << min(a*n, b) << nl;
	
	#if DEBUG
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << " s" << nl;
	#endif
	return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;
  s[3] = '8';
  cout << s;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
int a[1001];

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int v=0,sum=0;
	while(1){
		int ma=a[v],mi=a[v];
		v=(v+1)%n;
		for(int i=1;i<m;i++){
			ma=max(ma,a[v]);
			mi=min(mi,a[v]);
			v=(v+1)%n;
		}
		sum+=ma-mi;
		if(v==0)break;
	}
	printf("%d\n",sum);
	return 0;
}

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

using namespace std;

long long int N;

int main(void) {

	cin >> N;

	long long int tmp = 26;
	long long int K = N;
	int I = 0;

	for (int i = 1;; i++) {
		I = i;
		if (K <= tmp) { break; }
		K -= tmp;
		tmp *= 26;
	}



	//cout << "K= " << K << endl;
	K--;

	string ans = "";

	for (int i = 1; i <= I; i++) {
		ans += 'a' + (K % 26);
		K /= 26;
	}


	reverse(ans.begin(), ans.end());


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

Measured memory_bytes: 3628
n = int(input())
s = map( int, input().split())

s =  [ i-(n+1) for n, i in enumerate(s)]

s.sort()

if n%2==0 :
  m = (s[n//2 - 1] + s[n//2]) // 2
else :
  m = s[n//2]

ans = 0
for i in s:
  ans+= abs(i -m)
  
print(ans)

Measured memory_bytes: 26180
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		sc.close();

		int x = 0;
		int max = 0;
		for(int i = 0;i < N;++i) {
			if(S.charAt(i) == 'I') {
				++x;
				if(x > max)
					max = x;
			} else {
				--x;
			}
		}
		System.out.println(max);
	}
}


Measured memory_bytes: 21588
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
c = Counter(A)
a, b = 0, 0
for key in sorted(c.keys(), reverse=True):
  if c[key] >= 4:
    a = max(a, key)
    b = max(b, key)
  elif c[key] >= 2:
    if a == 0:
      a = key
    elif a != 0 and b == 0:
      b = key
print(a*b)

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int p[maxn],co[maxn];
int a[maxn];

int ppow(int x,int y)
{
    if (y==0) return 1;
    int ret=ppow(x,y/2);
    ret=ret*ret%mod;
    if (y&1) ret=ret*x%mod;
    return ret;
}

int32_t main()
{
    IOS
    int n;
    cin>>n;
    p[0]=1;
    for (int i=1;i<=n;i++) p[i]=p[i-1]*i%mod;
    for (int i=1;i<=n-1;i++)
    {
        co[i]=p[n]*ppow(i+1,mod-2)%mod;
        co[i]=(co[i-1]+co[i])%mod;
    }

    int ans=0;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        ans=(ans+a[i]*p[n])%mod;
        ans=(ans+a[i]*co[i-1])%mod;
        ans=(ans+a[i]*co[n-i])%mod;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 5948
#include<stdio.h>
int H, W, K;
char cake[999][999];
int ans[999][999];
int main(int argc, char const *argv[]) {
  scanf("%d %d %d", &H, &W, &K);
  if (getchar() != '\n') return 1;
  for (int i = 0; i < H; i++) {
    fgets(cake[i], W+2, stdin); // W chars + newline + '\0'
  }
  int gen = 0, firstrow = 0, row = -1;
  for (int i = 0; i < H; i++) {
    int has = 0, firstcol = 0;
    for (int j = 0; j < W; j++) {
      if (cake[i][j] == '#') {
        if (has == 0) firstcol = j;
        has = ++gen;
      }
      ans[i][j] = has;
    }
    if (has != 0) {
      if (row == -1) firstrow = i;
      row = i;
      // fix first
      for (int j = 0; j < firstcol; j++) {
        ans[i][j] = ans[i][firstcol];
      }
    }
    else if (row != -1) {
      for (int j = 0; j < W; j++) {
        ans[i][j] = ans[row][j];
      }
    }
  }
  // first empty row
  for (int i = 0; i < firstrow; i++) {
    for (int j = 0; j < W; j++) {
      ans[i][j] = ans[firstrow][j];
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (j) putchar(' ');
      printf("%d", ans[i][j]);
    }
    putchar('\n');
  }
  return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
//No change above here

const ll maxi = 2 * 1e5 + 5;
ll mod = 5;
double pi = 3.141592653589793238;

//function for power
ll power(ll x, ll n) {
	ll res = 1;
	x %= mod;
	while (n) {
		if (n & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		n >>= 1;
	}
	return res;
}

ll sum_digits(ll n)
{
	ll ret = 0;
	while (n)
	{
		ret += n % 10;
		n /= 10;
	}
	return ret;
}

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

ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}

ll max_subarray(vector<int>& v)
{
	if (v.empty())
		return 0;
	ll glob = v[0], loc = v[0];
	for (int i = 1; i < v.size(); ++i)
	{
		loc = max(v[i] + 0LL, loc + v[i]);
		glob = max(loc, glob);
	}
	return glob;
}

long long num_digits(long long x)
{
	long long ans = 0;
	while (x)
	{
		++ans;
		x /= 10;
	}
	return ans == 0 ? 1 : ans;
}

vector<int> topological_sort(vector<vector<int>>& graph, int n, vector<int>& indegree)
{
	vector<int> ans;
	stack<int> s;
	for (int i = 0; i < n; ++i)
		if (indegree[i] == 0)
			s.push(i);
	while (!s.empty())
	{
		int x = s.top();
		s.pop();
		ans.push_back(x);
		for (auto& adj : graph[x])
			if (--indegree[adj] == 0)
				s.push(adj);
	}
	return ans;
}

ll dir[4][2] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} };

ll p, q;
bool valid(ll i, ll j) { return i >= 1 && i <= p && j >= 1 && j <= q; }


//declare needed things here


int main()
{
	IOS;
	int x;
	cin >> x;
	if (x >= 30)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
    unsigned long int n,num[200000]={0},i,value;
    cin>>n;
    for(i=1;i<n;i++){
        cin>>value;
        num[value-1]++;
    }
    for(i=0;i<n;i++){
        cout<<num[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 5220
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <list>
#include <map>
#include <string>
#include <functional>
#include <math.h>
#include <utility>
#define INF 100000000
using namespace std;
typedef pair<int,int> P;
typedef long long int ll;
ll dp[2][21],n;
int d;
int main()
{
	cin>>n>>d;n--;
	fill(dp[0],dp[0]+21,0);
	dp[0][d]=1;
	while(n--){
		fill(dp[1],dp[1]+21,0);
		cin>>d;
		for(int i=0;i<=20;i++){
			if(0<=i+d&&i+d<=20)dp[1][i+d]+=dp[0][i];
			if(0<=i-d&&i-d<=20)dp[1][i-d]+=dp[0][i];
		}
		for(int i=0;i<=20;i++)dp[0][i]=dp[1][i];
	}
	cout<<dp[1][0]<<endl;
}

Measured memory_bytes: 1164
r,c = map(int,input().split())
A = [0 for i in range(r+1)]
for i in range(r):
    A[i] = list(map(int,input().split()))
for i in range(r):
    A[i].append(sum(A[i]))
B = []
for i in range(c+1):
    x = 0
    for j in range(r):
        x += A[j][i]
    B.append(x)
A[r] = B    

for i in range(r+1):
    for j in range(c+1):
        print(A[i][j],end="")
        if j < c:
            print(" ",end="")
    print()


Measured memory_bytes: 6756
using System;
using System.Collections;
using System.Collections.Generic;

class Program {

    static void Main (string[] args) {
        var str1 = Console.ReadLine ();
        var str2 = Console.ReadLine ();
        if (str2.Substring (0, str2.Length - 1) == str1) {
            Console.WriteLine ("Yes");
        } else {
            Console.WriteLine ("No");
        }
    }
}

Measured memory_bytes: 25892
/*	
*  Sachin Mittal
*/
#include<bits/stdc++.h>
#define int long long
#define M 998244353
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define rep(i,j,n) for(int i=j;i<n;i++)
#define F first
#define S second
#define lb lower_bound
#define mem0(dp) memset(dp,0,sizeof(dp))
#define mem1(dp) memset(dp,-1,sizeof(dp))
#define pb push_back
#define sz(s) (int)(s.size())
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;

void solve()
{
	int n;cin>>n;
	vector<int> a(n);
	for(int i=0;i<n;i++)cin>>a[i];
	if(!n%2)
	{
		int sm1=0,sm2=0;
		rep(i,0,n){if(i%2)sm1+=a[i];else sm2+=a[i];}
		cout<<max(sm1,sm2);
	}
	else 
	{
		unordered_map<int,int> dp[n];
		dp[0][0]=0;
		dp[0][1]=a[0];
		dp[1][0]=0;
		dp[1][1]=a[1];
		int ans=-1e18;
		for(int i=2;i<n;i++)
		{
			for(auto j:dp[i-2])
				if(j.F+1>=(i-1)/2)
				dp[i][j.F+1]=j.S+a[i];
			if(i!=2)
			{
				for(auto j:dp[i-3])
				{
					if(j.F+1>=(i-1)/2)
					{if(dp[i].count(j.F+1))
											dp[i][j.F+1]=max(dp[i][j.F+1],j.S+a[i]);
										else dp[i][j.F+1]=j.S+a[i];}
				}
			}
			for(auto j:dp[i])
				if(j.F==n/2)ans=max(ans,j.S);
		}
		if(n==2)
			ans=max(a[0],a[1]);
		else if(n==3)
			ans=max(a[0],max(a[1],a[2]));
		cout<<ans;
	}
	
}

int32_t main(){

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


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

int N;
vector <int>s;

int main(){
  int inp;
  cin >> N;
  for(int i =0;i<N;i++){
    cin >> inp;
    s.push_back(inp);
  }

  sort(s.begin(),s.end());
  cout << s[N-1]-s[0] << endl;

  return 0;
}


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

char s[10 + 5];

int main() { // claudio van
  int a; scanf("%d", &a);
  scanf("%s", s);
  if (a < 3200) {
    printf("red\n");
  } else {
    printf("%s\n", s);
  }
  return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;

int main()
{
    _FastIO;
    cin >> a >> b;
    if(a % 2 && b % 2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3656
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int m,a;
while(true){
scanf("%d",&m);
if(m==0)return 0;
for(int i=0;i<9;i++){
scanf("%d",&a);
m-=a;
}
printf("%d\n",m);
}

}

Measured memory_bytes: 1188
import java.io.*;
import java.util.*;

class MyScanner {
    private final InputStream in = System.in;
    private final byte[] buf = new byte[1024];
    private int p = 0;
    private int len = 0;
    private boolean hasNextByte() {
        if (p >= len) {
            p = 0;
            try {
                len = in.read(buf);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return len >= 1;
    }
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buf[p])) p++;
        return hasNextByte();
    }
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        while (hasNextByte() && isPrintableChar(buf[p])) {
            sb.appendCodePoint(buf[p++]);
        }
        return sb.toString();
    }
}

public class Main {
    public static void main(String[] args){
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = Integer.parseInt(sc.next());
        long k = Long.parseLong(sc.next());
        Integer[][] a = new Integer[62][n + 1];
        int t = 1;
        for (int i = 1; i <= n; i++) a[0][i] = Integer.parseInt(sc.next());
        for (int i = 0; i < 61; i++) {
            for (int j = 1; j <= n; j++) {
                a[i + 1][j] = a[i][a[i][j]];
            }
            if ((k >> i & 1) == 1) t = a[i][t];
        }
        out.println(t);
        out.flush();
    }
}

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

using namespace std;

int main()
{
	const string eot = "-";
	string w;
	while (cin >> w) {
		if (w == eot)
			break;

		unsigned int n;
		cin >> n;
		unsigned int s = 0;
		for (unsigned int i = 0; i < n; ++i) {
		    unsigned int l;
			cin >> l;
			s += l;
		}

		s = s % w.length();
		string ans = w.substr(s, string::npos);
		if (s > 0)
			ans += w.substr(0, s);
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 3196
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


const long long MOD = 1000000007;

void solve(long long N, long long M, std::vector<long long> a){
    vector<ll> dp;
    rep(i, N+1) dp.push_back(0);
    vector<bool> broken(N);
    rep(i, N+1) broken.push_back(false);
    rep(i,M) broken[a[i]] = true;
    // rep(i,N+1) cout << dp[i] << endl;

    rep(i,N+1) {
        if(broken[i]) continue;
        if(i == 0) {
            dp[i] = 1;
            continue;
        }
        if (i == 1){
            dp[i] = dp[0];
            continue;
        }
        dp[i] = (dp[i-1] + dp[i-2]) % MOD;
        // dp[i] = dp[i-1] + dp[i-2];
    }
    // cout << "hello" << endl;
    // return dp[N];
    // rep(i,N+1) cout << dp[i] << endl;
    cout << dp[N] << endl;

}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&a[i]);
        // --a[i];
    }
    solve(N, M, std::move(a));
    // return 0;
}


Measured memory_bytes: 2168
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
const int MOD = 1000000007LL;
LL dp[41][1 << 16];
int main() {
	int N, X, Y, Z;
	cin >> N >> X >> Y >> Z;
	dp[0][0] = 1;
	int mask = (1 << (X + Y + Z - 1)) - 1;
	int xyz = (1 << (X + Y + Z - 1)) | (1 << (Y + Z - 1)) | (1 << (Z - 1));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < (1 << (X + Y + Z - 1)); j++) {
			for (int k = 1; k <= 10; k++) {
				int bit = (j << k) | (1 << (k - 1));
				if ((bit&xyz) == xyz)  continue;
				(dp[i + 1][bit&mask] += dp[i][j]) %= MOD;
			}
		}
	}
	LL ans = 1;
	for (int i = 0; i < N; i++) {
		(ans *= 10) %= MOD;
	}
	for (int i = 0; i < (1 << (X + Y + Z - 1)); i++) {
		ans = (ans - dp[N][i] + MOD) % MOD;
	}
	cout << ans << endl;
}

Measured memory_bytes: 20736
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define tr(c,i) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

double cross(double x1,double y1,double x2,double y2)
{
	return x1*y2-x2*y1;
}

int ccw(double x1,double y1,double x2,double y2,double x3,double y3)
{
	return cross(x2-x1,y2-y1,x3-x1,y3-y1)>0;
}

int main()
{
	float x,y,a,b,n,m,p,q;
	int i;
	for(;~scanf("%f%f%f%f%f%f%f%f",&x,&y,&a,&b,&n,&m,&p,&q);puts(i>2^!i?"YES":"NO"))
		i=((p-x)*(b-y)>(q-y)*(a-x))+((p-a)*(m-b)>(q-b)*(n-a))+((p-n)*(y-m)>(q-m)*(x-n));
	
	//puts("long");
	//for(double x,y,a,b,n,m,p,q;scanf("%lf%lf%lf%lf%lf%lf%lf%lf",x,y,x+1,y+1,x+2,y+2,&xp,&yp)==8;){
	//	int counter=0;
	//	rep(i,3)
	//		counter+=ccw(x[i],y[i],x[(i+1)%3],y[(i+1)%3],xp,yp);
	//	
	//	cout<<(counter%3==0?"YES":"NO")<<endl;
	//}
	
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<cstdio>
#define MN 100000
using namespace std;
inline int read()
{
	int 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;
}
int n,head[MN+5],cnt=0,f[MN+5];
struct edge{int to,next;}e[MN*2+5];
inline void ins(int f,int t)
{
	e[++cnt]=(edge){t,head[f]};head[f]=cnt;
	e[++cnt]=(edge){f,head[t]};head[t]=cnt;	
}
void dfs(int x,int fa)
{
	for(int i=head[x];i;i=e[i].next)
		if(e[i].to!=fa)
		{
			dfs(e[i].to,x);
			f[x]^=f[e[i].to]+1;			
		}
}
int main()
{
	n=read();
	for(int i=1;i<n;++i) ins(read(),read());
	dfs(1,0);
	puts(f[1]?"Alice":"Bob");
	return 0;
}

Measured memory_bytes: 7296
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>

using namespace std;


int main() {
    int h,w;
    cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w));

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }

    vector<bool> row(h, false);
    vector<bool> col(w,false);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') {
                row[i] = true;
                col[j] = true;  
            }
        }
    }
    for (int i = 0; i < h; i++) {
        if (row[i]) {
            for (int j = 0; j < w; j++) {
                if (col[j]) {
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }
}


Measured memory_bytes: 256
table = [[0 for i in range(13)] for i in range(4)]
suit = {'S': 0, 'H': 1, 'C': 2, 'D': 3}
inv_suit = {v: k for k, v in suit.items()}
n = int(input())

for i in range(n):
    line = input().split()
    s = line[0]
    n = int(line[1])
    table[suit[s]][n-1] = 1

for i in range(len(table)):
    for j in range(len(table[i])):
        if table[i][j] == 0:
            print('{} {}'.format(inv_suit[i], j+1))


Measured memory_bytes: 5608
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int l1 = s.replace("B", "").length();
    int l2 = n - l1;
    System.out.println(l1 > l2 ? "Yes" : "No");
  }
}

Measured memory_bytes: 21844
using System;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            // N
            int N = int.Parse(Console.ReadLine());

            int i = 1;
            long ans = 0;

            while (i < N+1)
            {
               if(i % 3 == 0 && i % 5 == 0)
                {
                    // FizzBuzz
                    i++;
                    continue;
                }

                if (i % 3 == 0)
                {
                    // Fizz
                    i++;
                    continue;
                }

                if (i % 5 == 0)
                {
                    // Buzz
                    i++;
                    continue;
                }

                

                ans += i;
                i++;
            }

            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 27548