akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  cin>>n>>m>>x;
  int ans=m;
  int left=0;
  vector<int> cell(n+1,0);
  for(int i=0;i<m;i++){
    int a;
    cin>>a;
    cell[a]=1;
  }
  for(int i=0;i<x;i++){
    left+=cell[i];
  }
  cout<<min(left,ans-left);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
string S; int p[100000]; int K;
int main() {
	cin >> S >> K;
	for (int i = 0; i < S.size(); i++) { p[i] = 'z' - S[i]; p[i]++; p[i] %= 26; }
	for (int i = 0; i < S.size(); i++) {
		if (K >= p[i]) { K -= p[i]; p[i] = 0; }
	}
	p[S.size() - 1] -= K; p[S.size() - 1] += 2080000000; p[S.size() - 1] %= 26;
	for (int i = 0; i < S.size(); i++) {
		p[i]--; if (p[i] < 0)p[i] += 26;
		cout << (char)('z' - p[i]);
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 896
import copy
N, M = map(int, input().split())
dp = [[float('inf')]*N for _ in range(N)]
ms = []
for i in range(N):
    dp[i][i] = 0

for i in range(M):
    a, b, c = map(int, input().split())
    dp[a-1][b-1] = c
    dp[b-1][a-1] = c
    ms.append([a-1, b-1, c])

g = copy.deepcopy(dp)

# ワーシャルフロイド
for k in range(N):
    for i in range(N):
        for j in range(N):
            dp[i][j] = min([dp[i][j], dp[i][k]+dp[k][j]])

# 全頂点でmが使われたかどうか
ans = M
for m in ms:
    a, b, c = m
    for n in range(N):
        if dp[n][b] == (dp[n][a]+c):
            ans -= 1
            break
print(ans)


Measured memory_bytes: 55772
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
#define fi first
#define se second
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define repn(i,n) for(ll i=0;i<=(ll)(n);i++)
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 10000000099;
//cin.tie(0);
//ios::sync_with_stdio(false);



signed main(){
    ll n,ans=0;cin>>n;
    vector<ll> a(n),b(n);
    rep(i,n){
        cin>>a[n-1-i]>>b[n-1-i];
    }//この段階で逆順にすると、あとで後ろから見ていることがわかりにくい

    for(int i=0;i < n;i++)
    {
        ans+=((-a[i]-ans)%b[i] +b[i])%b[i];
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <map>

struct say {
    int person;
    int truefalse;
};

int main(){

    int N;
    scanf("%d",&N);
    std::vector<int >A(N+5);
    std::vector<std::vector<say> > x(N+5);
    int temp1, temp2;
    for (int i=0; i<N; i++){
        scanf("%d",&A[i]);
        for (int j=0; j<A[i]; j++){
            scanf("%d %d",&temp1, &temp2);
            temp1--;
            x[i].push_back((say){temp1, temp2});
        }
    }

    int ans = 0;

    for (int i=0; i<(1<<N); i++){
        //printf("i=%d\n",i);
        std::vector<int > result(N+5, -1);
        bool resultflag = true;
        int count = 0;
        for (int j=0; j<N; j++){
            if ((i & (1<<j)) != 0){ // j番目の人が正直ものとする
                result[j] = 1; // 1:正直者
                //printf("result[%d]=%d\n",j,result[j]);
                count++;
            } else {
                result[j] = 0; // 0:偽物
                //printf("result[%d]=%d\n",j,result[j]);
            }
        }
        for (int j=0; j<N; j++){
            if ((i & (1<<j)) != 0){ // j番目の審議を検証
                for (int k=0; k<A[j]; k++){
                    if (result[x[j][k].person] != x[j][k].truefalse){
                        resultflag = false;
                        //printf("x[%d][%d].person (%d) of result = %d\n",j,k,x[j][k].person,result[x[j][k].person]);
                        //printf("break at result[%d] != %d\n",result[x[j][k].person], x[j][k].truefalse);
                        break;
                    }
                }
            }
            if (!resultflag){
                break;
            }
        } 
        //printf("resultflag=%d\n",resultflag);
        if (resultflag){
            ans = fmax(ans, count);
        }      
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 888
#include <iostream>

int main(){
    using namespace std;
    int n,max = 0,min = 0;
    int a[1000];
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        if(i == 0) {
            max = a[i];
            min = a[i]; 
        }
        else if (max < a[i]) max = a[i];
        else if (min > a[i]) min = a[i];
    } 

    cout << max - min;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using ll = long long;

int main(void){
	int n,m;
	ll k;
	cin >> n >> m >> k;
	
	vector<int> a(n,0),b(m,0);
	vector<ll> aa(n+1,0),bb(m+1,0);
	
	rep(i,n){
		cin >> a[i];
		aa[i+1] = a[i] + aa[i];
	}
	
	rep(i,m){
		cin >> b[i];
		bb[i+1] = b[i] + bb[i];
	}
	
	int j = m;
    int ans = 0;
	
	rep(i,n+1){
		while((bb[j] > (k-aa[i])) && (j>0)){
			j--;
		}
        if(bb[j] > (k-aa[i])) break;
      	ans = max(ans,(i+j));
	}

	cout << ans << endl;
}


Measured memory_bytes: 7960
#include <iostream>

int main(){
  int a[101], n;
  std::cin>>n;
  int na=0, cnt=1;
  int ans=0;
  for(int i=0;i<n;++i){
    std::cin>>a[i];
    //std::cout<<na<<" "<<cnt<<" "<<ans<<std::endl;
    if(i==0)na=a[i];
    else{
      if(na==a[i])cnt++;
      else{

        
        ans += cnt/2;
        cnt = 1;
        na=a[i];
      }
    }
  
  }
  ans += cnt/=2;
  std::cout<<ans<<std::endl;
  return 0;

}


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

#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<pair<int, int>> vii;
const int N = 2 * (1e5 + 1);
const int INF = 1e9 + 5;
const long long MOD = 1e9 + 7;

int32_t main() {
    FAST_IO;
    string s;
    cin >> s;
    string final;
    for (int i = 0; i < 5; i++) {
        final += s[i];
    }
    final += " ";
    for (int i = 6; i < 13; i++) {
        final += s[i];
    }
    final += " ";
    for (int i = 14; i < 19; i++) {
        final += s[i];
    }
    cout << final;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

struct Point{
  double x, y;
  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x+p.x, y+p.y); }
  Point operator - (Point p) { return Point(x-p.x, y-p.y); }
  Point operator * (double a) { return Point(x*a, y*a); }
  Point operator / (double a) { return Point(x/a, y/a); }

  double abs() { return sqrt(norm()); }
  double norm() { return x*x + y*y; }

  bool operator < (const Point &p) const{
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

typedef Point Vector;

struct Segment{
  Point p1, p2;
};

double dot(Vector a, Vector b){
  return a.x*b.x + a.y*b.y;
}

double cross(Vector a, Vector b){
  return a.x*b.y - a.y*b.x;
}

Point project(Segment s, Point p){
  Vector a = s.p2 - s.p1;
  Vector b = p - s.p1;
  return s.p1 + a * (dot(a, b)/a.norm());
}

int main(){
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  Point p1 = Point(x1, y1);
  Point p2 = Point(x2, y2);
  Segment s = {p1, p2};

  int q; cin >> q;
  rep(i, q){
    int x, y; cin >> x >> y;
    Point p = Point(x, y);
    Point ans = project(s, p);
    cout << fixed << setprecision(10);
    cout << ans.x << " " << ans.y << endl;
  }

  return 0;

}




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

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define INF 2000000000000000000LL
#define EPS 1e-9
#define debug(a) cerr<<#a<<"="<<(a)<<"\n"
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL);

typedef long long ll;
typedef unsigned long long ull;
typedef complex<double> cd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void printArray(const int *arr, int n);
void printArray(const vector<int> &arr);

const ll mod = 1e9+7;
const double PI = acos(-1);

int n,i,j,k,t;
int a[200];

int main(){
	scanf("%d", &n);
	vector<int> v, ans;
	for(int i=0;i<n;++i){
		scanf("%d", a+i);
		v.pb(a[i]);
	}
	while(v.size() > 0){
		bool ada = false;
		for(int i=v.size()-1;i>=0;--i){
			if(v[i] == i+1){
				v.erase(v.begin() + i);
				ada = true;
				ans.pb(i+1);
				break;
			}
		}
		// printArray(v);
		if(!ada)
			break;
	}
	reverse(ans.begin(), ans.end());
	if(ans.size() != n)
		puts("-1");
	else{
		for(int x : ans){
			printf("%d\n", x);
		}
	}
	return 0;
}

/* Template Function */
void printArray(int * a, int n){
	for(int i=0;i<n;++i){
		printf("%d ", a[i]);
	}
	puts("");
}

void printArray(const vector<int> &arr){
	for(int x : arr){
		printf("%d ", x);
	}
	puts("");
}

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

int a(char *p){return((*p<'a')||(*p>'z'));}
char *decode (char *inbuf, int s) {
  int p = 0;
  while (inbuf[p] != 0) {
    if ((inbuf[p] >= 'a')&&(inbuf[p]<='z')) {
      int t = inbuf[p] + s;
      //inbuf[p] = inbuf[p] + (char)s;
      if (t > 'z')      inbuf[p] = (char)(t - 26);
      else if (t < 'a') inbuf[p] = (char)(t + 26);
      else              inbuf[p] = (char)t;
    }
    p++;
  }
  return (inbuf);
}

int main(){
  char inbuf[82];
  while(fgets(inbuf,80,stdin)){
    int s;
    char *p=inbuf;
    while(*p){
      s = 0;
      if (((*p-*(p+1))==12)||((*p-*(p+1))==-14)) {
	/* the */
	if (((*p-*(p+2))==15)||((*p-*(p+2))==-11)) {
	  if(a(p+3))
	    //	  if((*(p+3)<'a')||(*(p+3)>'z'))
	    s = 't' - *p;
	}
	/* that */
	else if (((*p-*(p+2))==19)||((*p-*(p+2))==-7)) {
	  if (*p-*(p+3) == 0)
	  if(a(p+4))
	    //	    if((*(p+4)<'a')||(*(p+4)>'z'))
	      s = 't' - *p;
	}
	/* this */
	else if (((*p-*(p+2))==11)||((*p-*(p+2))==-15)) {
	  if (((*p-*(p+3))==1)||((*p-*(p+3))==-25))
	  if(a(p+4))
	    //if((*(p+4)<'a')||(*(p+4)>'z'))
	      s = 't' - *p;
	}
      }
      if (s) break;
      p++;
    }
    printf("%s",decode(inbuf, s));
  }
  return 0;
}

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

int main()
{
  	int n,b,f,r,v;
  	char ch;
  
 	cin >> n;
  
    int a[4][3][10] = {0};
  
  	for(int i = 0;i < n;i++){
      cin >> b >> f >> r >> v;
      
      a[b-1][f-1][r-1] += v;
    }
  
  	for(int i = 0;i < 4;i++){
      for(int j = 0;j < 3;j++){
        for(int k = 0;k < 10;k++){
          cout << " " << a[i][j][k];
        }
        cout << endl;
      }
      if(i < 3)
      	cout << "####################" << endl;
    }
  	
}


Measured memory_bytes: 3100
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;

int main()
{

	vector<int> prime;
	prime.push_back(2);
	prime.push_back(3);
	prime.push_back(5);

	for(int i=7;i<=60000;i+=2){
		bool ok=true;
		for(int j=0;prime[j]*prime[j]<=i && ok;j++){
			if(i%prime[j]==0) ok=false;
		}
		if(ok) prime.push_back(i);
//		if(ok) cout<<i<<endl;
	}

	int n;
	while(cin>>n){

		auto u=upper_bound(prime.begin(),prime.end(),n);
		auto l=u-1;

		if(*l==n) l--;

		cout<<*l<<" "<<*u<<endl;

	}


	return 0;
}

Measured memory_bytes: 1276
K,T = map(int,input().split())
A = list(map(int,input().split()))

mx = max(A)
if mx <= (K+1)//2:
    print(0)
    exit()

if K%2:
    print(2 *(mx - (K+1)//2))
else:
    print(2 * (mx - K//2) - 1)

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

using namespace std;

int n, m, ans, at[305], x[305][305], fre[305], ta;
bool rm[305], o;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)	
			scanf("%d", x[i] + j);
	for (int i = n; i; i--) {
		memset(at, 0, sizeof(at));
		memset(rm, 0, sizeof(rm));
		o = 1;
		while (1) {
			memset(fre, 0, sizeof(fre));
			for (int j = 0; j < n && o; j++) {
				while (at[j] < m && rm[x[j][at[j]]])
					at[j]++;
				if (at[j] == m)
					o = 0;
				else
					fre[x[j][at[j]]]++;
				//printf("! %d %d %d\n",j,at[j],x[j][at[j]]);
			}
			if (!o)
				break;
			ta = -1;
			for (int j = 1; j <= m; j++)
				if (fre[j] > i) {
					rm[j] = 1;
					ta = j;
					break;
				}
		//	printf("%d %d\n",i,ta);
			
		//	for (int j = 0; j < n; j++)
		//	printf("%d%c",at[j],j == n-1 ? '\n':' ' );
		//	for (int j = 1; j <= m; j++)
		//	printf("%d%c",fre[j],j == m ? '\n':' ' );
		//	for (int j = 1; j <= m; j++)
		//	printf("%d%c",rm[j],j == m ? '\n':' ' );
			if (ta == -1)
				break;
		}
		if (o)
			ans = i;
		else
			break;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 640
import math
A,B,H,M = map(int, input().split())
if H*30+M*0.5 <= M*6:
    k = M*6-H*30-M*0.5
else:
    k = H*30+M*0.5-M*6
ans = A**2 + B**2 -2*A*B*math.cos(math.radians(k))
print(math.sqrt(ans))

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

int main(){
    using namespace std;
    constexpr unsigned long MOD = 1000000007;
    unsigned long N;
    cin >> N;
    vector<unsigned long> c(60);
    for(unsigned long i{0}, A; i < N; ++i){
        cin >> A;
        for(unsigned long j{0}; j < 60; ++j)c[j] += A >> j & 1;
    }
    unsigned long ans{0};
    reverse(c.begin(), c.end());
    for(const auto& i : c)((ans *= 2) += i * (N - i)) %= MOD;
    cout << ans << endl;
    return 0;
}

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

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


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W, A, B;
    cin >> H >> W >> A >> B;
    vector<vector<int>> ans(H,vector<int>(W));
    for (int i=0;i<B;i++){
        for (int j=0;j<A;j++){
            ans[i][j] = 1;
        }
    }
    for (int i=B;i<H;i++){
        for (int j=A;j<W;j++){
            ans[i][j] = 1;
        }
    }
    for (int i=0;i<H;i++){
        for (int j=0;j<W;j++){
            cout << ans[i][j];
            if (j==W-1) cout << "\n";
        }
    }
}

Measured memory_bytes: 5248
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
double q;
main()
{
	while(cin>>q,q>0)
	{
		double x=q/2;
		while(abs(x*x*x-q)>=1e-5*q)x=x-(x*x*x-q)/3/x/x;
		cout<<fixed<<setprecision(16)<<x<<endl;
	}
}



Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=4e3+5;
char s[N];
int main() {
    int n;
    scanf("%d%s",&n,s);
    int a=0,b=0,c=0;
    for(int i=0;i<n;i++) {
        if(s[i]=='R') a++;
        if(s[i]=='G') b++;
        if(s[i]=='B') c++;
    }
    ll ans=1LL*a*b*c;
    for(int i=0;i<n;i++) {
        for(int j=i+1;j<n;j++) {
            if(s[i]==s[j]) continue;
            if(2*j-i<n&&s[i]!=s[2*j-i]&&s[j]!=s[2*j-i]) ans--;
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N ;
  //  int A[N],B[N];
  pair<int, int> p[N]; //b,a
  int a,b;
  rep(i, N){
    cin >> a >> b;
    p[i] = make_pair(b,a);
  }
  sort(p, p+N);
  ll sum=0;
  rep(i,N){
    sum += p[i].second;
    if(sum > p[i].first){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
    

}


Measured memory_bytes: 1792
n = int(input())
s = input()
rl = s.count('R')
gl = s.count('G')
bl = s.count('B')
rr = 0
gr = 0
br = 0
if s[0] == 'R':
    rl -= 1
    rr += 1
elif s[0] == 'G':
    gl -= 1
    gr += 1
else:
    bl -= 1
    br += 1

ans = 0
for i in range(1, n-1):
    for j in range(1, n//2+1):
        if i-j < 0 or i+j > n-1:
            break
        if s[i+j] != s[i-j] and s[i+j] != s[i] and s[i-j] != s[i]:
            ans -= 1
    if s[i] == 'R':
        ans += bl*gr + br*gl
        rl -= 1
        rr += 1
    elif s[i] == 'G':
        ans += rr*bl + rl*br
        gl -= 1
        gr += 1
    else:
        ans += gr*rl + gl*rr
        bl -= 1
        br += 1
print(ans)


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

using namespace std;
int n,k,a[10005],sum;
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=n-k+1;i<=n;i++)
		sum+=a[i];
	cout<<sum<<endl;
	return 0;
}


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

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

int main() {
	ll A;
	cin >> A;
	ll sum = 0;
	rep(i,1,A+1) {
		rep(j,1,A+1){
			rep(k,1,A+1){
				sum += gcd(gcd(i,j),k);
			}
		}
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3624
A, B, K = map(int, input().split())
if K > B-A+1:
    K = B-A+1
t = set()
for i in range(A, A+K):
    t.add(i)
for i in range(B-K+1, B+1):
    t.add(i)
ans = list(t)
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 3060
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();
		sc.close();
		int min = 0;
		int shoki = 0;
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) != '#') {
				shoki++;
			}
		}
		min = shoki;
		int prev = shoki;
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == '.') {
				prev--;
			} else {
				prev++;
			}
			if (prev < min)
				min = prev;
		}
		System.out.println(min);
	}
}


Measured memory_bytes: 27140
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll N;

int main() {
	cin >> N;
	cout << pow(N, 3) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  ll A, B, C, K;
  cin >> A >> B >> C >> K;
  if(K > A+B) {
    cout << A-(K-A-B) << endl;
  } else {
    cout << min(A, K) << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include<iostream>
using namespace std;
int d[100010]={0},n,q,a,b,c;
int main(){
	cin>>n>>q;
	while(q--){cin>>a>>b>>c;
		if(a){a=0,b--;
			while(b)a-=d[b],b-=b&-b;
			while(c)a+=d[c],c-=c&-c;
			cout<<a<<endl;
		}
		else while(b<=n)d[b]+=c,b+=b&-b;
	}
	return 0;
}

Measured memory_bytes: 3384
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define INF 1000000007
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2)*pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}

signed main() {
	int ans = 0;
	string s;
	cin >> s;
	rep(i, 3) {
		if (s[i] == 'o')ans++;
	}
	cout << 700 + ans * 100 << endl;
}


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

using namespace std;

int n, ans, p[250005], d[505][505], mx[] = {0, 1, 0, -1}, my[] = {1, 0, -1, 0}, vis[505][505];

int dis(int a, int b, int c, int d)
{
    return abs(a - c) + abs(b - d);
}

void dfs(int x, int y, int p, int q, int now)
{
    if (x < 1 || x > n || y < 1 || y > n) return ;
    if (d[x][y] <= d[p][q] + now) return ;
    d[x][y] = d[p][q] + now;
    now += 1 - vis[x][y];
    for (int i = 0; i < 4; i++)
        dfs(x + mx[i], y + my[i], p, q, now);
}

int main()
{
    cin >> n;
    for (int i = 1; i <= n * n; i++) cin >> p[i];
    for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) 
        d[i][j] = min(min(i - 1, n - i), min(j - 1, n - j));
    for (int i = 1; i <= n * n; i++)
    {
        int x = p[i] / n + 1;
        int y = p[i] % n;
        if (y == 0)
        {
            x--;
            y = n;
        }
        vis[x][y] = 1;
        ans += d[x][y];
        for (int j = 0; j < 4; j++) dfs(x + mx[j], y + my[j], x, y, 0);
    }
    cout << ans << endl;
    return 0;
}

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

void solve()
{
	string inp;
	cin>>inp;

	int digSum = 0;

	for(int i = 0; i < inp.length(); i++)
		digSum += (inp[i] - '0');

	if(digSum % 9)
		cout<<"No";
	else
		cout<<"Yes";
}

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

	solve();

	return 0;
}

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

typedef long long ll;

const int MOD=1e9+7;

int N;
ll arr[22][22];
ll dp[22][1<<22];

ll solve(ll i,ll mask)
{
    ll &ret=dp[i][mask];
    if(ret+1)return ret;
    if(i==N)return 1LL;
    ret=0;
    for(ll j=0;j<N;j++){
        if(!(mask&(1<<j))&&arr[i][j])
           ret+=solve(i+1,mask|(1<<j));
    }
    return ret=ret%MOD;


}

int main()
{
    cin>>N;
    for(int i=0;i<N;i++)
        for(int j=0;j<N;j++)
            cin>>arr[i][j];
    memset(dp,-1,sizeof(dp));
    cout<<solve(0,0);
}


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

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    int max_h=0;
    int count=0;
    for(int i=0; i<n; i++){
        max_h = max(max_h, h[i]);
        if(max_h == h[i]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1000000007;

int main(){
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;

    vector<ll> d(a);
    vector<ll> e(b);

    for(int i = 0;i < a;i++){
        ll p;
        cin >> p;
        d[i] = p;
    }

    for(int i = 0;i < b;i++){
        ll q;
        cin >> q;
        e[i] = q;
    }

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

    priority_queue<ll,vector<ll>,greater<ll>> q;
    for(int i = 0;i < x;i++)q.push(d[i]);

    for(int i = 0;i < y;i++)q.push(e[i]);

    for(int i = 0;i < c;i++){
        ll r;
        cin >> r;

        if(r > q.top()){
            q.pop();
            q.push(r);
        }
    }

    ll ans = 0;
    while(q.size()){
        ll now = q.top();
        q.pop();
        ans += now;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3956
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func check(s, t string) bool {
	for i := 0; i < len(s); i++ {
		if s[i] == '?' {
			continue
		}
		if s[i] != t[i] {
			return false
		}
	}
	return true
}

func main() {
	sc.Split(bufio.ScanWords)
	s := getString()
	t := getString()

	x := make([]string, 0)
	for i := len(s) - len(t); i >= 0; i-- {
		flg := check(s[i:i+len(t)], t)
		if flg {
			o := []byte(s[0:i] + t + s[i+len(t):])
			for j := 0; j < len(o); j++ {
				if o[j] == '?' {
					o[j] = 'a'
				}
			}
			x = append(x, string(o))
		}
	}

	sort.Strings(x)
	if len(x) > 0 {
		out(x[0])
	} else {
		out("UNRESTORABLE")
	}
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int f(LL a, LL b){
  int d1 = 0, d2 = 0;
  while(a > 0) a /= 10, ++d1;
  while(b > 0) b /= 10, ++d2;
  return max(d1, d2);
}

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

  LL N; cin >> N;
  int ans = 10000;
  for(LL i=1;i*i<=N;++i)
	if(N % i == 0)
	  mini(ans, f(i,N/i));

  cout << ans << endl;

  return 0;
}


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

#define int long long
#define endl '\n'
#define ll long long
#define ld long double
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vpi vector<pi>

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int MX = 3e5 + 5;
const ld PI = 4 * atan((ld)1);
int dp[MX][3],a[MX],b[MX],c[MX];
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i]>>c[i];
	for(int i=1;i<=n;i++){
		dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1]=b[i]+max(dp[i-1][2],dp[i-1][0]);
		dp[i][2]=c[i]+max(dp[i-1][0],dp[i-1][1]);
	}
	int mx=dp[n][0];
	for(int i=0;i<3;i++){
		mx=max(mx,dp[n][i]);
	}
	cout<<mx<<endl;
}

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


int main()
{
        vector<ll>v(3);
        cin>>v[0]>>v[1]>>v[2];
        sort(v.begin(),v.end());
        ll res=10*v[2]+v[1]+v[0];
        cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))

cnt = 0
for _ in range(N):
  A = list(map(int, input().split()))
  temp = C
  for i in range(M):
    temp += A[i]*B[i]
  if temp > 0:
    cnt += 1

print(cnt)

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

using namespace std;
#define X first
#define Y second
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define debug(x) cerr << #x << " = " << (x) << endl;
template<typename T>
ostream& operator<<(ostream& o, vector<T>& v) {
    for (auto& x : v) o << x << ' ';
    return o;
}

int main(){
    std::ios_base::sync_with_stdio(false); cin.tie(0);
    string str; cin >> str;
    int p = 0, g = 0;
    int score = 0;
    for (char c : str){
        if (c == 'g'){
            if (g > p) {
                p++;
                score++;
            } else {
                g++;
            }
        } else {
            if (g > p){
                p++;
            } else {
                g++;
                score--;
            }
        }
    }
    cout << score << endl;
}

Measured memory_bytes: 512
#include <iostream>

int main()
{
    char a, b;
    std::cin >> a >> b;
    if (a == 'H') {
        std::cout << b << std::endl;
    } else {
        std::cout << (b == 'H' ? 'D' : 'H') << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define Nmax 110

int main(){
    int N,i,j,same,count,flg=0;
    int A[Nmax],B[Nmax];

    scanf("%d",&N);
    for(i=0;i<N;i++)scanf("%d",&B[i]);

    for(i=0;i<N;i++)if(B[i]>i+1)flg=1;

    if(flg==1){
        printf("-1\n");
    }else{
        for(i=0;i<N;i++){
            same=1;
            count=1;
            for(j=0;j<N;j++){
                if(B[j]!=0){
                    if(B[j]==count){
                        same=j;
                    }
                    count++;
                }
            }

            A[i]=B[same];
            B[same]=0;
        }
        for(i=0;i<N;i++)printf("%d\n",A[N-i-1]);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
using namespace std;
int main(){
	int N, D;
	cin >> N >> D;
	int X[N][D];
	for(int i = 0; i < N; i++) for(int j = 0; j < D; j++) cin >> X[i][j];
	int res = 0;
	int d;
	for(int i = 0; i < N-1; i++){
		for(int j = i + 1; j < N; j++){
			d = 0;
			for(int k = 0; k < D; k++){
				d += (X[i][k] - X[j][k])*(X[i][k] - X[j][k]);
			}
			for(int n = 1; n <= sqrt(d); n++){
				if(n*n == d){
					res++;
					break;
				}
			}
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=3005;
ll a[maxn],val[maxn][maxn];
void fl()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
int main()
{
//    fl();
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++)
		val[i][i]=(n%2?a[i]:-a[i]);
	for(int len=2;len<=n;len++)
		for(int i=1;i+len-1<=n;i++)
		{
			int l=i,r=i+len-1;
			if(n%2!=len%2) 
				val[l][r]=min(val[l+1][r]-a[l],val[l][r-1]-a[r]);
			else val[l][r]=max(val[l+1][r]+a[l],val[l][r-1]+a[r]);
		}
	printf("%lld\n",val[1][n]);
	return 0;
}


Measured memory_bytes: 49940
N,T = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

dp1 = [[0]*T for _ in range(N+1)]
rev_AB = AB[::-1]
dp2 = [[0]*T for _ in range(N+1)]
for i,(ab,rev_ab) in enumerate(zip(AB,rev_AB),1):
  a = ab[0]
  rev_a = rev_ab[0]
  b = ab[1]
  rev_b = rev_ab[1]
  l_1 = dp1[i-1]
  l_2 = dp2[i-1]
  for t in range(1,T):
    if a>t:
      dp1[i][t]=l_1[t]
      
    else:
      dp1[i][t] = max(l_1[t],l_1[t-a]+b)
      
    if rev_a>t:
      dp2[i][t]=l_2[t]
    
    else:
      dp2[i][t] = max(l_2[t],l_2[t-rev_a]+rev_b)
      
      
    

      
lis = [0]*N
for i in range(1,N+1):
  l_1 = dp1[i-1]
  l_2 = dp2[N-i]
  b = AB[i-1][1]
  for t in range(T):
    lis[i-1] = max(l_1[t]+l_2[T-1-t]+b,lis[i-1])

    
print(max(lis))

Measured memory_bytes: 181764
let nm = stdin.ReadLine().Split() |> Array.map int
let (n, m) = (nm.[0], nm.[1])
let possibleMax = m / n;
[|1..(m |> double |> sqrt |> ceil |> int)|]
|> Array.collect (
    fun x ->
        if m % x = 0 then 
            [|x; m / x|]
        else
            [||] 
)
|> Array.filter (fun x -> x <= possibleMax)
|> Array.max
|> stdout.WriteLine

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

using namespace std;

int main() {
  vector<int> a(3);
  for (int i=0; i<3; i++) scanf("%d", &a[i]);
  int maxa = *max_element(a.begin(), a.end());
  int diff = 0;
  for (int i=0; i<3; i++) {
    diff += max(0, maxa - a[i]);
  }
  if (diff%2 == 0) {
    printf("%d\n", diff/2);
  } else {
    printf("%d\n", diff/2+2);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
    int n;
    cin>>n;
    cout<<((n+1)/2) * (n/2)<<endl;

    return 0;
}


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

const int INF = 1e9;
int dp[10000005][2];

int main(){
	string s;
  	cin >> s;
  	reverse(s.begin(), s.end());
  
  	s += '0';
  	int n = s.size();
  	rep(i, n+1)rep(j, 2) dp[i][j] = INF;
  	dp[0][0] = 0;
  	
  	rep(i, n)rep(j, 2){
    	int x = s[i] - '0';
      	x += j;
      	rep(a, 10){
        	int ni = i+1, nj = 0;
          	int b = a-x;
          	if( b < 0){
            	nj = 1;
              	b += 10;
            }
          	dp[ni][nj] = min(dp[ni][nj], dp[i][j]+a+b);
        }
    }
  
  	int ans = dp[n][0];
  	cout << ans << endl;
}

Measured memory_bytes: 12072
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	string a,b;
	cin>>a>>b;
	if(a.length()>b.length()) cout<<"GREATER";
	else if(b.length()>a.length()) cout<<"LESS";
	else
	{
		int flag = 0;
		auto itt = b.begin();
		for(auto it:a)
		{
			if(it>*itt){
				flag = 1;
				break;
			}
			else if(it<*itt)
			{
				flag = -1;
				break;
			}
			itt++;
		}
		if(flag == 0)
			cout<<"EQUAL";
		else if(flag==-1)
			cout<<"LESS";
		else cout<<"GREATER";
	}
	return 0;
}	

Measured memory_bytes: 256
import java.util.*;

class Main {
    enum Color {
        WHITE,
        GRAY,
        BLACK,
    }

    private static class Edge {
        int toV;
        int weight;

        public Edge(int toV, int weight) {
            this.toV = toV;
            this.weight = weight;
        }
    }

    private static class MinCost implements Comparable<MinCost> {
        int v;
        int cost;

        public MinCost(int v, int cost) {
            this.v = v;
            this.cost = cost;
        }

        @Override
        public int compareTo(MinCost p) {
            return this.cost - p.cost;
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());

        int[][] matrix = new int[n][n];
        List<List<Edge>> adjLists = new ArrayList<>(n);

        for (int i = 0; i < n; i++) {
            String[] line = scanner.nextLine().split(" ", -1);
            int fromV = Integer.parseInt(line[0]);
            int numVectors = Integer.parseInt(line[1]);

            List<Edge> adjList = new ArrayList<>(numVectors);
            for (int j = 0; j < numVectors; j++) {
                int toV = Integer.parseInt(line[2 + j * 2]);
                int weight = Integer.parseInt(line[2 + j * 2 + 1]);
                adjList.add(new Edge(toV, weight));
            }
            adjLists.add(adjList);
        }

        dijkstra(adjLists, n);
    }

    private static void dijkstra(List<List<Edge>> adjLists, int n) {
        PriorityQueue<MinCost> pq = new PriorityQueue<>();
        Color[] color = new Color[n];
        int[] dMin = new int[n];

        Arrays.fill(color, Color.WHITE);
        Arrays.fill(dMin, Integer.MAX_VALUE);

        pq.add(new MinCost(0, 0));
        dMin[0] = 0;
        color[0] = Color.GRAY;

        while (pq.size() > 0) {
            MinCost minCost = pq.poll();
            color[minCost.v] = Color.BLACK;

            if (dMin[minCost.v] < minCost.cost)
                continue; // extract min, but if it's not the shortest, ignore.

            for (Edge adj : adjLists.get(minCost.v)) {
                if (color[adj.toV] != Color.BLACK && dMin[minCost.v] + adj.weight < dMin[adj.toV]) {
                    dMin[adj.toV] = dMin[minCost.v] + adj.weight;
                    pq.add(new MinCost(adj.toV, dMin[adj.toV]));
                    color[adj.toV] = Color.GRAY;
                }
            }
        }

        for (int i = 0; i < n; i++) {
            System.out.printf("%d %d\n", i, dMin[i]);
        }
    }
}



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

using LL = long long;

#define ALL(a) begin((a)), end((a))
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define RFOR(i, a, b) for (int(i) = (a); (i) > (b); (i)--)
#define debug(x) cout << #x << " : " << x << '\n'

const int INF = 1e9;
const LL LINF = 1e16;

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

  string ans;
  string O, E;
  cin >> O >> E;

  int size = O.size() + E.size();

  FOR(i, 0, size) {
    if (i % 2) {
      int index = i / 2;
      ans.push_back(E[index]);
    } else {
      int index = i / 2;
      ans.push_back(O[index]);
    }
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
int main(){
  int n,r;
  cin >>n>>r;
  if (n>=10){
    cout << r;
  }else{
    cout << r+100*(10-n);
  }
}

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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int main(){
    int k,s;
    cin >> k >> s;
    ll ans=0;
    vector<ll> a(k+1);
    rep(i,k+1) a[i]=i;
    for(int i=0;i<=k;i++){
        for(int j=0;j<=k;j++){
            if(binary_search(a.begin(),a.end(),s-i-j)) ans++;
        }    
    }
    
    cout << ans << endl;

    return 0;
}











Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;


public class Main {
    private void solve() {
        String s  = next();

        for(int i = 0;i < s.length() - 1;i++) {
            if (s.charAt(i) == s.charAt(i + 1)) {
                out.println("Bad");
                return;
            }
        }
        out.println("Good");
    }

    public static void main(String[] args) {
        out.flush();
        new Main().solve();
        out.close();
    }

    /* Input */
    private static final InputStream in = System.in;
    private static final PrintWriter out = new PrintWriter(System.out);
    private final byte[] buffer = new byte[4096];
    private int p = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (p < buflen)
            return true;
        p = 0;
        try {
            buflen = in.read(buffer);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (buflen <= 0)
            return false;
        return true;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrint(buffer[p])) {
            p++;
        }
        return hasNextByte();
    }

    private boolean isPrint(int ch) {
        if (ch >= '!' && ch <= '~')
            return true;
        return false;
    }

    private int nextByte() {
        if (!hasNextByte())
            return -1;
        return buffer[p++];
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = -1;
        while (isPrint((b = nextByte()))) {
            sb.appendCodePoint(b);
        }
        return sb.toString();
    }

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

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;

#define ll long long

ll k,a,b;

int main() {
    scanf("%lld%lld%lld",&k,&a,&b);
    if(k < (a + 1)) {
        printf("%lld \n",k + 1);
        return 0;
    } else if(b <= (a + 2)) {
        printf("%lld \n",k + 1);
        return 0;
    } else {
        ll ans = 0;
        ans = b; 
        k = k - a - 1;
        ans += (k / 2) * (b - a);
        k %= 2;
        ans += k;
        printf("%lld \n",ans);
        return 0;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a,b,c,x,k;
k=0;
scanf("%d %d %d %d",&a,&b,&c,&x);
for(int s=0;s<=a&&s*500<=x;s++){
for(int t=0;t<=b&&s*500+t*100<=x;t++){
for(int r=0;r<=c&&s*500+t*100+r*50<=x;r++){
if(s*500+t*100+r*50==x)k++;

}}}
printf("%d",k);
return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second
const int INF = 1000000007;
const int MOD = (int)1e9+7;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
int dy[4] = {-1, 0, 1, 1};
int dx[4] = {0, 1, 0, 1};

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

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("in.txt", "r", stdin);
	ll a,b;
	cin >> a >> b;
	ll c = gcd(a,b);
	ll ret = 1;
	for(ll x = 2; x*x <= c; x++) {
		if(c%x == 0) {
			ret++;
			while(c%x == 0) {
				c /= x;
			}
		}
	}
	if(c > 1) ret++;
	cout << ret << '\n';
	return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys


input = sys.stdin.readline


def inpl(): return list(map(int, input().split()))


H, W, N = inpl()
L = [W] * H

# 各xにおける最もx軸に近い障害物の距離を求める
for i in range(N):
    x, y = inpl()
    x -= 1
    y -= 1
    L[x] = min(L[x], y)

k = 0  # y方向に移動できる距離
for x in range(1, H):
    if L[x] <= k:
        print(x)
        break
    if L[x] != k + 1:
        k += 1
else:
    print(H)


Measured memory_bytes: 10904
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;



int main()
{
    string s;
    long long k;
    cin>>s>>k;
    vector<string>v(0);
    {
        for(long long i=0;i<s.size();i++)
        for(long long j=0;j<k;j++)
        {
        if(i+j+1>s.size())continue;
        v.push_back(s.substr(i,j+1));
        }
    }
    sort(v.begin(),v.end());
    unique(v.begin(),v.end());
    cout<<v[k-1];
    //system("pause");
    return 0;
}   

Measured memory_bytes: 1660
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 1000000007
#define writeln(n) cout<<n<<endl
//setprecision(10);
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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;
}

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
        return b != 0 ? gcd(b, a % b) : a;
    }

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string ans="NO";
    int a[4];
    REP(i,4) cin>>a[i];
    int b[4];
    REP(i,4) b[i]=0;
    REP(i,4)
    {
        if(a[i]==1) ++b[0];
        else if(a[i]==4) ++b[1];
        else if(a[i]==7) ++b[2];
        else if(a[i]==9) ++b[3];
    }
    if(b[0]==1&&b[1]==1&&b[2]==1&&b[3]==1) ans="YES";
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256