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

using namespace std;

long long s;

void Reverse(long long &x){
    int xx = x;
    x = 0;
    while(xx / 10){
        x = x * 10 + xx % 10;
        xx /= 10;
    }
}
int main(){
    cin >> s;
    if (s > 1e9){
        if (s % 1000000000 == 0){
            printf("0 0 0 1000000000 %d 0", s/1000000000);
            return 0;
        }
        long long x = 1;
        long long temp = s;
        while(temp && x <= 1e10){
            x = x * 10 + temp % 10;
            temp /= 10;
        }
        x /= 10;
        Reverse(x);
        x = 1e9 - x;
        long long x2 = x, y1 = 1;
        long long x1 = 1e9, y2 = (s + x) / 1e9;
        printf("0 0 %lld %lld %lld %lld\n", x1, y1, x2, y2);
    }
    else              
        cout << "0 0 0 " << s << " 1 0" << endl;
    return 0;
}


Measured memory_bytes: 3704
import itertools

l = [0,1,2,3,4,5,6,7,8,9]

while True:
    try:
        N = int(raw_input())
        res = 0
        for element in itertools.product(l,repeat=4):
            if sum(element) == N:
                res += 1
        print res
    except EOFError:
        break

Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<s.length()-2;i++)
    {
        if(s[i]=='A' && s[i+1]=='B' && s[i+2]=='C')
            c++;
    }
    cout<<c;
}


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

template<typename T>
int array_max(T array[],int n)
{
	int max;
	max=0;
	for(int i=1;i<n;i++)
	{
		if(array[i]>array[max]) max=i;
		
	}
	return max;
}

int main(){
	int mount[10];
	for(int i=0;i<10;i++){
		cin >> mount[i];
	}
	for(int i=0;i<3;i++)
	{
		int max=array_max(mount,10-i);
		cout << mount[max] << endl;
		swap(mount[max],mount[9-i]);
	}
   return 0;
}

Measured memory_bytes: 1164
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[100005],b[100005];
long long ans;
struct sd{int all,va,vb;bool operator < (const sd &fu) const {return all<fu.all;};}w[100005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {scanf("%d%d",&a[i],&b[i]);w[i]=(sd){a[i]+b[i],a[i],b[i]};}
	sort(w+1,w+1+n);
	for(int i=n;i;--i) {
		if(!((n-i)%2)) {
			ans+=(long long)w[i].va;
		}
		else ans-=(long long)w[i].vb;
	}
	printf("%lld",ans);
	return 0;
}

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

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

    return 0;
}

Measured memory_bytes: 3636
N,n = map(int,input().split())
fct = []
b, e = 2, 0
while b * b <= n:
    while n % b == 0:
        n = n // b
        e = e + 1
    if e > 0:
        fct.append([b, e])
    b, e = b + 1, 0
if n > 1:
    fct.append([n, 1])
num = []
ans = 1
for i in range(len(fct)):
    while(fct[i][1] >= N):
        ans *= fct[i][0]
        fct[i][1] -= N
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include<stdlib.h>

struct P{
  int key;
  struct P *prev,*next;
};
typedef struct P* node;
node F,L;

void insert(int x) {
  node z=F->next;
  node v=malloc(sizeof(struct P));
  v->key=x;
  F->next=v;
  v->prev=F;
  v->next=z;
  z->prev=v;
}

void delete(int x) {
  node z=F;
  while(z->key!=x && z!=L) z=z->next;
  node l=z->prev,r=z->next;
  l->next=r;
  r->prev=l;
}

void deleteF() {
  node z=F->next->next;
  F->next=z;
  z->prev=F;
}

void deleteL() {
  node z=L->prev->prev;
  L->prev=z;
  z->next=L;
}

int main() {
  int n;
  scanf("%d",&n);
  char c[10];
  int x;
  F=malloc(sizeof(struct P));
  L=malloc(sizeof(struct P));
  F->next=L;F->prev=F;
  L->prev=F;L->next=L;
  while(n--) {
    scanf("%s",c);
    if(c[0]=='i') {
      scanf("%d",&x);
      insert(x);
    } else if(c[6]=='F') deleteF();
    else if(c[6]=='L') deleteL();
    else {
      scanf("%d",&x);
      delete(x);
    }
  }
  node z=F->next;
  while(z!=L) {
    if(z!=F->next) printf(" ");
    printf("%d",z->key);
    z=z->next;
  }
  printf("\n");
  return 0;
}




  

 



Measured memory_bytes: 36064
N, K = map(int, input().split())
p = list(map(int, input().split()))
s = [0] * N

for i in range(N):
    s[i] = (1 + p[i]) / 2

answer = sum(s[:K])
current = answer
for i in range(1, N - K + 1):
    current = current - s[i - 1] + s[i + K - 1]
    answer = max(answer, current)

print(answer)

Measured memory_bytes: 73352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    int n;
    long long k;
    cin >> n >> k;
    int a[n];
    rep(i,n){
        cin >> a[i];
    }
    long long p[n],q[n];
    long long tmp;
    rep(i,n){
        tmp = 0;
        rep(j,n){
            if(a[j]<a[i]) tmp++;
        }
        q[i]=tmp;
        tmp = 0;
        for(int j = i+1;j<n;j++){
            if(a[j]<a[i]) tmp++;
        }
        p[i]=tmp;
    }
    long long ans = 0;
    long long t = k*(k-1)/2;
    t%=MOD;
    rep(i,n){
        //cout << p[i] << q[i] << endl;
        ans+=(p[i]*k);
        ans%=MOD;
        ans+=((q[i]*t)%MOD);
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
int A;
int a;
int b;
int c;
int n;
int x=0;
scanf("%d%d%d",&a,&b,&c);
for(n=a;n<=b;n++){
A=c%n;
if(A==0){
x = x + 1;}}
printf("%d\n",x);}


Measured memory_bytes: 2140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main() {
    int n;
    string s;
    cin >> s;
    for (int i = 0; i < 3; i++) {
        if (s.at(i) == '1') n++;
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

	int N,K;
	scanf("%d %d",&N,&K);

	if(N > K){
		printf("0\n");
	}else{
		printf("1\n");
	}

	return 0;
}




Measured memory_bytes: 3140
program therefore

 implicit none
 character::n*3
 integer::m

 read*,n
 m=len_trim(n)

 if(n(m:m)=='0'.or.n(m:m)=='1'.or.n(m:m)=='6'.or.n(m:m)=='8') then
  print*,'pon'
 else if(n(m:m)=='3') then
  print*,'bon'
 else
  print*,'hon'
 end if

end program therefore
 

Measured memory_bytes: 2876
#include<stdio.h>
#include<string.h>
int main()
{
  char s[101];
  int i,n,m;
  scanf("%s",s);
  n=strlen(s);
  for(i=0,m=0;i<n/2;i++)
    if(s[i]!=s[n-i-1])
      m++;
  printf("%d",m);
  return 0;
}

Measured memory_bytes: 128
def maxvolume( s ): 
  
    # finding length 
    length = s / 3 
      
    s -= length 
      
    # finding breadth 
    breadth = s / 2
      
    # finding height 
    height = s - breadth 
      
    return (length * breadth * height) 
      
# Driven Program 
s = int(input())
print( maxvolume(s) ) 

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
#define ll long long


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

	ll s; cin >> s;
	ll p = sqrt(s); if (p*p != s)	p++;
	ll a, b, c, d;
	a = b = p;
	ll t = a*b - s;
	for (ll i = 1; i <= 1e9; i++){
		if (t%i == 0 && t / i <= 1e9){
			c = i;
			d = t / i;
			break;
		}
	}
	printf("0 0 %lld %lld %lld %lld\n", a, c, d, b);

	//system("pause");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
b = [int(i) for i in input().split()]
a = [b[0]]
if n == 2:
    print(a[0]*2)
else:
    for i in range(n-2):
        a.append(min(b[i], b[i+1]))
    a.append(b[-1])
    print(sum(a))

Measured memory_bytes: 3060
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            String S = in.next();
            List<Character> acgt = new ArrayList<>(Arrays.asList('A', 'C', 'G', 'T'));
            int ans = 0;
            int cnt = 0;
            for (int i = 0; i < S.length(); i++) {
                Character c = S.charAt(i);
                if (acgt.contains(c)) {
                    cnt++;
                } else {
                    ans = Math.max(ans, cnt);
                    cnt = 0;
                }
            }
            ans = Math.max(ans, cnt);
            out.println(ans);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21460
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

s = input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
    print("Bad")
else:
    print("Good")


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef pair<int,int> pii;
typedef long long LL;

int n;
vector<long long> a; 
vector<LL> neg;

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		long long u;
		cin >> u;
		if (u < 0) neg.push_back(u);
		else a.push_back(u);
	}
	sort(a.begin(), a.end());
	sort(neg.begin(), neg.end());
	vector<pii> cmd;
	LL ans;
	if (a.size()){
		if (neg.size()){
			while (a.size() > 1){
				cmd.push_back({neg.back(), a.back()});
				neg.back() -= a.back();
				a.pop_back();
			}
			while (neg.size()){
				cmd.push_back(make_pair(a.back(), neg.back()));
				a.back() -= neg.back();
				neg.pop_back();
			}
			ans = a[0];
		} else {
			for (int i = 2; i < a.size(); i++){
				cmd.emplace_back(a[0], a[i]);
				a[0] -= a[i];
			}
			cmd.emplace_back(a[1], a[0]);
			ans = a[1] - a[0];
		}
	} else {
		while (neg.size() > 1){
			LL u = neg.back(); neg.pop_back();
			LL v = neg.back(); neg.pop_back();
			cmd.push_back(make_pair(u, v));
			neg.push_back(u - v);
		}
		ans = neg.back();
	}
	cout << ans << '\n';
	for (int i = 0; i < cmd.size(); i++)
		cout << cmd[i].fi << ' ' << cmd[i].se << '\n';
	return 0;
}


Measured memory_bytes: 4340
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  int n = in(), m = in();
  priority_queue<int> q;
  rep(i,n) {
    int a;
    cin >> a;
    q.push(a);
  }
  rep(i,m) {
    int a = q.top(); q.pop();
    q.push(a/2);
  }
  ll ans = 0;
  rep(i,n) {
    ans += q.top(); q.pop();
  }
  cout << ans << endl;
  return 0;
}


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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int dp[2][101];
int A[2][101];
int N;

int solve(int y, int x) {
    int& res = dp[y][x];
    if (~res) return res;
    if (x >= N) {
        res = 0;
    }
    else {
        res = max(res, solve(y, x+1)+A[y][x]);
        if (y==0) res = max(res, solve(y+1, x+1)+A[y][x]+A[y+1][x]);
    }
    return res;
}

int main() {
    cin >> N;
    rep(y, 2) rep(i, N) cin >> A[y][i];
    fill(dp[0], dp[2], -1);
    cout << solve(0, 0) << endl;
    return 0;
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
    int N, Q, l[100000], r[100000];
    string S;
    cin >> N >> Q >> S;
    for(int i = 0; i < Q; ++i) {
        cin >> l[i] >> r[i];
    }
    int l_sum[100000] = {0};
    int r_sum[100000] = {0};
    int num = 0;
    for(int i = 1; i <= N; ++i){
        r_sum[i] = r_sum[i-1];
        if(S[i-1]=='A'&&S[i]=='C') {
            ++num;
            ++r_sum[i];
            ++l_sum[i];
        }
        l_sum[i+1] = l_sum[i];
//        cout << r_sum[i];
    }
//    cout << endl;
    for(int i = 0; i < Q; ++i) {
        cout << r_sum[r[i]-1] - r_sum[l[i]-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define iter(it,c) for(auto it = (c).begin(); it != (c).end(); ++it)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = ~(1<<31);
#define fs first
#define sc second
#define pb push_back

const double EPS = 1e-9;
const double pi = acos(-1);
typedef unsigned long long ull;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
template <class T> T smod(T a, T b) {
    return (a % b + b) % b;
}

string S,T;
int memo[3010][3010];
int dp(int s, int t) {
    if(s >= S.size() || t >= T.size()) return 0;
    if(memo[s][t] != -1) return memo[s][t];
    int mx = dp(s+1,t);
    mx = max(mx, dp(s,t+1));
    if(S[s] == T[t]) mx = max(mx, dp(s+1,t+1)+1);
    return memo[s][t] = mx;
}

string A = "";
void bt(int  s, int t, int val) {
    if(val == 0) return;
    if(s >= S.size() || t >= T.size()) return;
    if(dp(s+1,t) == val) {
        bt(s+1,t,val);
        return;
    }
    if(dp(s,t+1) == val) {
        bt(s,t+1,val);
        return;
    }
    A += S[s];
    bt(s+1,t+1,val-1);
}

int main() {
    cin.sync_with_stdio(false);
    memset(memo,-1,sizeof(memo));
    cin >> S >> T;
    bt(0,0,dp(0,0));
    cout << A << endl;

    return 0;
}


Measured memory_bytes: 36096
#include <iostream>
#include <vector>
#include <string>
using namespace std;

string temp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

char change(char c, int num)
{
	int cur;

	for (int i = 0; i < 52; i++) {
		if (temp[i] == c) {
			cur = i;
		}
	}

	cur -= num;

	if (cur < 0) {
		cur += 52;
	}

	return temp[cur];
}

string solve(string str, vector<int> k, int vec_size)
{
	unsigned int str_size = str.size();

	int cur = 0;
	for (unsigned int i = 0; i < str_size; i++) {
		str[i] = change(str[i], k[cur]);
		cur = (cur + 1) % vec_size;
	}

	return str;
}

int main()
{
	while (true) {
		int n;
		cin >> n;
		
		if (n == 0) {
			break;
		}

		vector<int> k(n);

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

		string str;
		cin >> str;

		cout << solve(str, k, n) << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
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; }
using namespace std;

int n;
vector<pair<int, int> > p;

int main() {
    cin >> n;
    rep(i, n) {
        int a; cin >> a;
        p.push_back(make_pair(a, i+1));
    }
    sort(p.begin(), p.end());
    rep(i, n) {
        cout << p[i].second;
        if (i != n-1) cout << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1780
<?php
    fscanf(STDIN,'%d %d',$n,$k);
    $man_array = array_fill(1,$n,0);
    for($index=0;$index<$k;++$index){
        fscanf(STDIN, '%d', $d);
        $hasSweets = explode(' ',trim(fgets(STDIN)));
        foreach($hasSweets as $hasSweet){
            $man_array[$hasSweet] = 1;
        }
    }
    $ans_array =array_count_values($man_array);
    if(array_key_exists(0,$ans_array)){
        echo $ans_array[0].PHP_EOL;
    }else{
        echo '0'. PHP_EOL;
    }
?>

Measured memory_bytes: 16040
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) ((a) < (b) ? (b) : (a))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define AAA (1000000007)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;



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

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



int main() {
	int i, j, k;
	//ll N, M, K;
	int N, M, K;
	cin >> N >> M;
	cout << N * (N - 1) / 2 + M * (M - 1) / 2;

	return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  char S[4];
  int flag[3]={0,0,0};
  int i;
  scanf("%s",S);
  
  for(i=0;S[i]!='\0';i++){
    if(S[i]=='a'&&flag[0]!=1)
      flag[0]=1;
    else if(S[i]=='b'&&flag[1]!=1)
      flag[1]=1;
    else if(S[i]=='c'&&flag[2]!=1)
      flag[2]=1;
  }

  for(i=0;i<3;i++)
    if(flag[i]==0){
      printf("No");
      return 0;
    }
  printf("Yes");
  return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<limits.h>
#include<utility>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(A) A.begin(),A.end()

int main() {
	long x;
	cin >> x;
	int c500 = x / 500;
	x = x % 500;
	int c5 = x / 5;
	cout << (1000 * c500 + 5 * c5) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  int i=0;
  char T[200001];
  scanf("%s",T);
  while(T[i]!='\0'){
    if(strncmp("?",&T[i],1)==0) T[i]='D';
    i++;
  }
  printf("%s",T);
  return 0;
}

Measured memory_bytes: 1880
/*
* @Author: Nguyen Quoc Cuong
* @Mail : 97quoccuong@gmail.com
* @Created at:   2018-10-24 14:39:59
* @Last Modified time: 2018-10-24 15:42:05
*/

#include <bits/stdc++.h>

#define mp make_pair
#define fi first
#define se second
#define pb push_back

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) x.size()

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define repd1(i, n) for (int i = (int)(n);i; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define ford(i, a, b) for (int i = (int)(a); i >= (int)(b); --i)

#define debug(a) cout << #a << " : " << a << endl
#define debuga(a,l,r) fore(i,l,r) cout << a[i] << ' ';cout << endl;
#define put(x) cout << (x) << endl;exit(0);

using namespace std;

typedef double ld;
typedef long long i64;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;

template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<class T> T min(T a, T b, T c) { return min(a,min(b,c)); }
template<class T> T max(T a, T b, T c) { return max(a,max(b,c)); }

const i64 linf = 2e17;
const int inf = 2e9;
void Fan_chipu();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  Fan_chipu();
}
/*====================================================== END ==============================================*/
const int maxn = 3e5 + 7;
int even[maxn],odd[maxn];
/*------------------------------------- */ void Fan_chipu() {
  int n; cin >> n;
  rep1(i,n) {
    int x;
    cin >> x;
    if(i & 1) ++odd[x];
    else ++even[x];
  }
  int maxEven = 0,maxOdd = 0;
  rep(i,maxn) {
    if(even[maxEven] < even[i]) maxEven = i;
  }
  rep(i,maxn) {
    if(i == maxEven) continue;
    if(odd[maxOdd] < odd[i]) maxOdd = i; 
  }
  int ans = n - even[maxEven] - odd[maxOdd];
  maxEven = 0,maxOdd = 0;
  rep(i,maxn) {
    if(odd[maxOdd] < odd[i]) maxOdd = i; 
  }
  rep(i,maxn) {
    if(i == maxOdd) continue;
    if(even[maxEven] < even[i]) maxEven = i;
  }
  umin(ans,n - odd[maxOdd] - even[maxEven]);
  cout << ans;
}

Measured memory_bytes: 1024
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n, c = map(int, input().split())
  recoders = numpy.zeros((c, 2*(10**5+1)), dtype=numpy.int)
  for _ in range(n):
    s, t, c = map(int, input().split())
    s = 2*s - 1
    t = 2*t
    c -= 1
    recoders[c][s:t] = 1
  
  print(max(numpy.sum(recoders, axis=0)))
    

if __name__=='__main__':
  main()



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

import sys

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

N,K=MAP()
S=input()

L=[]
cnt0=0
# 0始まりの時は番兵的に1の区間0を追加しておく
if S[0]=='0':
    L.append(0)
    cur=0
else:
    cur=1
cnt=0
# 1の区間の長さ、0の区間の長さ、1の区間の長さ...の配列Lを作る
for i in range(N):
    if cur==int(S[i]):
        cnt+=1
    else:
        L.append(cnt)
        if cur==0:
            cnt0+=1
        cnt=1
        # フラグの切り替え
        cur=1-cur
else:
    if cnt!=0:
        L.append(cnt)
        if cur==0:
            cnt0+=1
# 0終わりの時は番兵的に1の区間0を追加しておく
if S[-1]=='0':
    L.append(0)

if cnt0<K:
    # 0区間の数がKより少なかったら、それに合わせて区間和取る長さを短くする
    K=cnt0

# 尺取法
l=0
r=K*2+1
ans=sm=sum(L[:K*2+1])
while l<len(L) and r<len(L):
    for i in range(2):
        sm+=L[r]
        r+=1
        sm-=L[l]
        l+=1
    ans=max(ans, sm)
print(ans)


Measured memory_bytes: 4724
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

const int N = 100001;
s64 fac[N + 1], finv[N + 1];

s64 mypow(s64 x, s64 n)
{
    s64 ret = 1;
    while (n)
    {
        if (n & 1) ret = (ret * x) % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

void init()
{
    fac[0] = 1;
    for (s64 i = 1; i <= N; ++i)
    {
        fac[i] = (fac[i - 1] * i) % MOD;
    }
    finv[N] = mypow(fac[N], MOD - 2);
    for (s64 i = N; i > 0; --i)
    {
        finv[i - 1] = (finv[i] * i) % MOD;
    }
}

s64 com(int n, int r)
{
    if (n < r || n < 0 || r < 0) return 0;
    return fac[n] * finv[n - r] % MOD * finv[r] % MOD;
}

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

    init();

    int n;
    cin >> n;
    vs32 pos(n, -1);
    int l, r;
    int a;
    rep (i, n + 1)
    {
        cin >> a;
        --a;
        if (pos[a] >= 0)
        {
            l = pos[a];
            r = i;
        }
        else
        {
            pos[a] = i;
        }
    }

    for (int k = 1; k <= n + 1; ++k)
    {
        s64 ans = (com(n + 1, k) + (MOD - com(n - r + l, k - 1))) % MOD;
        cout << ans << "\n";
    }

    return 0;
}



Measured memory_bytes: 3200
from collections import Counter

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
    if c[i][1] == m:
        print(c[i][0])

Measured memory_bytes: 45084
#include <iostream>
#include <vector>

using namespace std;

int main() {

    int n;
    cin >> n;

    vector<int> a, b;

    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            if (i + j != n + !(n % 2)) {
                a.push_back(i);
                b.push_back(j);
            }
        }
    }

    cout << a.size() << endl;

    for (int i = 0; i < a.size(); ++i) {
        cout << a[i] << ' ' << b[i] << endl;
    }
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double

int ans=0;
int32_t main()
{
	IOS
	int n,m;cin>>n>>m;
	vector<pair<int,int>>A(n);
	for(int i=0;i<n;i++)cin>>A[i].first>>A[i].second;
	sort(A.begin(),A.end());
	for(int i=0;i<n;i++)
	{
		int c=min(m,A[i].second);
		m-=c;
		ans+=A[i].first*c;
	}
	cout<<ans<<endl;
	
}
			
	
	
	
	
	

	

	

	
		


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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int n = a * 100 + b * 10 + c;
  if(n % 4 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l;
    double a,b,c,d,e,f;
    double sum,x,y,x1,x2,y2,y1;
    while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF)
    {
       x1=(c*e)-(b*f);
       x2=(e*a)-(b*d);
       y1=(d*c)-(f*a);
        y2=(d*b)-(a*e);
       x=x1/x2;
       y=y1/y2;
       if(x==0)
       {
           x=0;
           printf("%.3lf %.3lf\n",x,y);
       }
       else
       {
             printf("%.3lf %.3lf\n",x,y);
       }
}
       return 0;
}



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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n),b(n),c(n-1);
  rep(i,n) cin>>a[i], a[i]--;
  rep(i,n) cin>>b[i];
  rep(i,n-1) cin>>c[i];
  
  ll ans=0;
  rep(i,n){
    ans+=b[a[i]];
    if(i!=n-1) if(a[i]+1==a[i+1]) ans+=c[a[i]];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  int n;
  scanf("%d\n",&n);
  int m,min,counter;
  min=100;
  while (scanf("%d",&m)!=EOF) {
    counter=0;
    while (m % 2 == 0) {
      m /=2;
      counter++;
    }
    if (min>counter){
      min=counter;
    }
    if(min==0){
      printf("0\n");
      return 0;
    }
  }
  printf("%d\n",min );
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int N, M;
    cin >> N >> M;
    int A[N];
    REP(i, N) cin >> A[i];

    int s = 0;
    REP(i, N) s += A[i];
    int c = 0;
    REP(i, N) {
        if (s <= 4 * M * A[i]) c++;
    }
    if (c >= M) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b;cin>>a>>b;
  cout<<a-1+(a<=b)<<endl;
  return 0;
}


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


int main(){
    string s,t;
    cin >> s >> t;
    for(int i=0;i<s.size();i++){
        if(s[i] == t[i]){
            if(i==s.size()-1){
                cout << "Yes" <<endl;
            }
        }
        else{
            cout << "No" <<endl;
            break;
        }
    }
}

Measured memory_bytes: 3628
<?php
fscanf(STDIN, "%d %d", $h, $n);
    //1行入力
$single_line_input = trim(fgets(STDIN));
//不要な改行コードを取り除く
$single_line_input = str_replace(array("\r\n","\r","\n"), '', $single_line_input);
//スペースで分解して配列に格納
$a = explode(" ", $single_line_input);
    $c=0;
    foreach($a as $b){
        $c += $b;
    }
    
    if($h <= $c){
        echo("Yes");
    }else{
        echo("No");
    }
?>

Measured memory_bytes: 12792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define inf 2,147,483,647 //int値の最大値
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cint(n) int n;cin>>n;
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 gcd(int a, int b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
    ll n;cin>>n;
    ll ans=0;
    rep(i,n){
        ll f=n/(i+1);
        ans+=(i+1)*f*(f+1)/2;
    }
    cout<<ans<<endl;
    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::string s;
  std::cin >> n >> s;

  int64_t ans = 0;
  for (int64_t i = 0; i < n - 2; i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 n;
  cin >> n;

  i64 ans = 0;
  rep(i,1,n+1){
    if(i%3!=0 and i%5!=0){
      ans += i;
    }
  }
  cout << ans << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  vector<string> ans({"First","Second"});
  if(n==1){
    cout<<ans[a[0]==1]<<endl;
    return 0;
  }
  while(1){
    Int odd=0;
    for(Int i=0;i<n;i++) odd+=a[i]&1;
    Int even=n-odd;
    if(even&1){
      cout<<ans[0]<<endl;
      return 0;
    }
    if(even+1!=n){
      cout<<ans[1]<<endl;
      return 0;
    }
    for(Int i=0;i<n;i++){
      if(a[i]%2==0) continue;
      if(a[i]==1){
	cout<<ans[1]<<endl;
	return 0;
      }
      a[i]--;
    }
    Int g=a[0];
    for(Int i=0;i<n;i++) g=__gcd(g,a[i]);
    for(Int i=0;i<n;i++) a[i]/=g;
    swap(ans[0],ans[1]);
  }
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <cmath>
#include <string.h>

using namespace std;

int f1[1000001];
int f2[1000001];

int main()
{
	int t_num[182];
	int t_num_odd[182];
	
	int k=0;
	for (int i=1;i<182;++i)
	{
		t_num[i-1] = i*(i+1)*(i+2)/6;
		if (t_num[i-1] % 2 == 1)
		{
			t_num_odd[k] = t_num[i-1];
			++k;
		}		
	}
	
	memset(f1,1000001,sizeof(f1));
	f1[0] = 0;
	for (int j=0;j<181;++j)
	{
		for (int i=t_num[j];i<=1000000;++i)
		{
			if (i>=t_num[j]) f1[i] = min(f1[i],f1[i-t_num[j]]+1);
		}
	}
	
	memset(f2,1000001,sizeof(f2));
	f2[0] = 0;
	for (int j=0;j<k;++j)
	{
		for (int i=t_num_odd[j];i<=1000000;++i)
		{
			if (i>=t_num_odd[j]) f2[i] = min(f2[i],f2[i-t_num_odd[j]]+1);
		}
	}
	
	int n;
	cin >> n;
	
	while (n)
	{
		
		cout << f1[n] << " ";
		cout << f2[n] << endl;
		cin >> n;
		
	}
	return 0;
	
}

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

int main(void) {
    int n; 
    cin >> n;
    long long x[100];
    x[0] = 2;
    x[1] = 1;
    for (int i = 2; i < 100; i++) {
        x[i] = x[i-1] + x[i-2];
    }
    cout << x[n] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(void){
  int a[3], d;
  cin >> a[0] >> a[1] >> a[2] >> d;
  if(abs(a[0]-a[2]) <= d){
    cout << "Yes" << endl;
  } else if(abs(a[0]-a[1]) <= d && abs(a[1]-a[2]) <= d){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
use std::io::Read;

fn main(){
    let mut buff = String::new();
    std::io::stdin().read_to_string(&mut buff).unwrap();
    let mut iter = buff.split_whitespace();
    let n :u64 = iter.next().unwrap().parse().unwrap();
    let d :u64 = iter.next().unwrap().parse().unwrap();
    let d = d*2+1;
    let mut ans :u64 = n/d;
    if ans*d!=n {
        ans+=1;
    }
    println!("{}",ans);
}

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

#define INF 100000000
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define de cout << "debug" << endl;

int main() {
  int N;
  cin >> N;
  string S[N];
  REP(i,N){
    cin >> S[i];
  }
  int ans = 0;
  int cnt = 0, Acnt = 0, Bcnt = 0, ABcnt = 0, sa = 0;
  REP(i,N){
    for(int j = 0; j+1 < S[i].size();j++){
      if(S[i].at(j) == 'A' && S[i].at(j+1) == 'B') cnt++;
    }
    if(S[i].at(0) == 'B' && S[i].at(S[i].size()-1) != 'A') Bcnt++;
    if(S[i].at(S[i].size()-1) == 'A' && S[i].at(0) != 'B') Acnt++;
    if(S[i].at(0) == 'B' && S[i].at(S[i].size()-1) == 'A') ABcnt++;
  }
  ans += cnt;

  if(Bcnt >= 1 && Acnt >= 1){
    ans += ABcnt + 1;
    ans += min(Acnt,Bcnt)-1;
  }
  else if(Acnt == 0 && Bcnt != 0){
    ans += ABcnt;
  }
  else if(Bcnt == 0 && Acnt != 0){
    ans += ABcnt;
  }
  else if(Acnt ==0 && Bcnt == 0 && ABcnt-1 >= 0){
    ans += ABcnt -1;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 768
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        int pre = Integer.valueOf(s.substring(0, 2));
        int post = Integer.valueOf(s.substring(2, 4));

        String ans;
        boolean b1 = 0 < pre && pre <= 12;
        boolean b2 = 0 < post && post <= 12;

        if (b1 && b2) {
            ans = "AMBIGUOUS";
        } else if (b1 && !b2) {
            ans = "MMYY";
        } else if (b2 && !b1) {
            ans = "YYMM";
        } else {
            ans = "NA";
        }

        System.out.println(ans);
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 21204
#include<iostream>
#include<cstdio>
#define N 1000000
int tl[N];

using namespace std;

void sort(int,int);
int syori(int,int);

int main(){
  int n,m,i,ans;
  while(1){
    for(i=0;i<N;i++){
      tl[i]=0;
    }
    


  cin >> n; 
  cin >> m;

  if(m==0 && n==0) break;

  for(i=1;i<=n;i++){
    cin >> tl[i];
  }

  for(i=n+1;i<=(m+n);i++){
    cin >> tl[i];
  }

  sort(m,n);


  ans=syori(n,m);

  cout << ans << endl;

  }
  return 0;
}


void sort(int m , int n){
  int i,j,max,hi;


  for(i=0;i<=(m+n);i++){
    max=i;
    for(j=i;j<=(m+n);j++){
      if(tl[j] < tl[max])max=j;
    }
    hi=tl[max];
    tl[max]=tl[i];
    tl[i]=hi;
  }


  //  for(i=0;i<=(m+n);i++){
  // cout << tl[i] << endl;;

  //}

}


int syori(int n, int m){
  int i,max=0;
  for(i=0;i<(m+n);i++){
    if(tl[i+1]-tl[i]>=max)max=tl[i+1]-tl[i];
  }

  return max;
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> P;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int val(vint x) {
    int res = x[0];
    for (int i = 1; i < x.size(); i++) (res *= 10) += x[i];
    return res;
}

signed main() {
    vint ans;
    char a;
    for (int i = 0; i <= 10; i++) ans.push_back(0);
    for (int i = 0; i < 1; i++) {
        cout << "? 10000000000" << endl;
        cin >> a;
        if (a == 'N') break;
        vint cmp;
        for (int j = 0; j < 10; j++) cmp.push_back(1);
        for (int j = 10; j > 0; j--) {
            cout << "? " << val(cmp) << endl;
            cin >> a;
            if (a == 'N') {
                ans[0] = 1;
                ans.resize(j + 1);
                cout << "! " << val(ans) << endl;
                return 0;
            }
            cmp.pop_back();
        }
        cout << "? 2" << endl;
        cin >> a;
        if (a == 'Y')
            cout << "! 1" << endl;
        else
            cout << "! 10" << endl;
        return 0;
    }
    for (int i = 0; i < ans.size() - 1; i++) {
        int lb = 0, ub = 10;
        while (ub - lb > 1) {
            int mid = (lb + ub) / 2;
            ans[i] = mid;
            cout << "? " << val(ans) << endl;
            cin >> a;
            if (a == 'Y') {
                ub = mid;
            } else {
                lb = mid;
            }
        }
        ans[i] = lb;
    }
    for (int i = ans.size() - 2; i >= 0; i--) {
        if (ans[i] == 9)
            ans[i] = 0;
        else {
            ans[i]++;
            break;
        }
    }
    vint cmp;
    cmp.push_back(1);
    for (int i = 1; i < ans.size(); i++) cmp.push_back(0);
    for (int i = ans.size(); i >= 0; i--) {
        cout << "? " << val(cmp) << endl;
        cin >> a;
        if (a == 'Y') {
            ans.resize(i);
            break;
        }
        cmp.pop_back();
    }
    cout << "! " << val(ans) << endl;
    return 0;
}

Measured memory_bytes: 596
#include <iostream>
using namespace std;
 
int main(){
string string_arr;
int q,i;
cin>>string_arr;
cin>>q;
for(i=0; i<string_arr.size(); i++){
    int val;
	val = 'z' - string_arr[i] + 1;
	if (val <= q && string_arr[i]!='a'){
		string_arr[i] = 'a';
		q = q-val;
	}
}
if (q!=0){
    q=q%26;
 	string_arr[string_arr.size()-1] = 'a' + (string_arr[string_arr.size()-1]+q)% int('a');
}
cout<<string_arr;
return 0;
}

Measured memory_bytes: 576
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }



int main() {
	
	vll a(3); ll k;
	cin >> a[0] >> a[1] >> a[2] >> k;
	sort(all(a), greater<ll>());
	a[0] *= pw(2, k);
	cout << accumulate(all(a), 0) << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n+1);
  vector<int> b(n);
  for (int i = 0;i < n+1;i++){
    cin >> a[i];
  }
  for (int i = 0;i < n;i++){
    cin >> b[i];
  }
  
  long long ans = 0;
  
  for (int i = 0;i < n;i++){
    if (b[i] >= a[i]){
      b[i] -= a[i];
      ans += a[i];
      a[i] = 0;
      if (b[i] >= a[i+1]){
        b[i] -= a[i+1];
        ans += a[i+1];
        a[i+1] = 0;
      }
      else{
        a[i+1] -= b[i];
        ans += b[i];
        b[i] = 0;
      }
    }
    else{
      a[i] -= b[i];
      ans += b[i];
      b[i] = 0;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3988