akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;
int main()
{
	int n,k,a=1;
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		if(a+k>=2*a)
		{
			a=2*a;
		}
		else
		{
			a=a+k;
		}
	}
	cout<<a;
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef pair<string,int> P;
int main()
{
  int n,i,j,k;
  string u;
  vector<P> s,t;
  cin >> n;
  t.emplace_back("a",1);
  for(i=2;i<=n;i++){
    s=t;
    t.clear();
    for(j=0;j<s.size();j++)
      for(k=0;k<=s[j].second;k++){
        u=s[j].first;
        u.append(1,'a'+k);
        t.emplace_back(u,max(k+1,s[j].second));
      }
  }
  for(j=0;j<t.size();j++)
    cout << t[j].first << endl;
  return 0;
}

Measured memory_bytes: 10352
#include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false); //cin.tie(NULL); cout.tie(NULL)
#define mp make_pair
#define pb push_back
#define fs first
#define sc second

using namespace std;
typedef long long ll;
typedef long double ld;


/* BIEN CUC BO BEGIN*/
	int a, b, A[100000+2];
/* BIEN CUC BO END*/

void solve(){	
	cin >> a;
	for (int i=1; i<=a; ++i){
		cin >> A[i];
	}
	
	for (int i=2; i<=a; ++i){
		A[i] = __gcd(A[i],A[i-1]);
	}
	
	cout << A[a];
}	

int main(){ FIO;
	solve();
return 0;}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
typedef long long LL;
using namespace std;
int n,ans,powe[100010],head[100010];

struct node{
	int nxt;
	int ed;
	int col;
}edge[200020];

char u;
void scan(int &x){
	int f=1;
    while(u = getchar(), u < '0' || u > '9'){if(u=='-') f=-1;};
    x = u-'0';
    while(u = getchar(), u >= '0' && u <= '9') x = x * 10 + u -'0';
    x*=f;
}

void dfs(int x,int y,int z){
	int j=1;
	for(int i=head[x]; i; i=edge[i].nxt){
		if(edge[i].ed!=y){
			if(j==z) j++;
			edge[i].col=j;
			dfs(edge[i].ed,x,j);
			j++;
		}
	}
}

void work(){
	dfs(1,0,0);
	for(int i=1; i<=(n-1)*2; i+=2){
		printf("%d\n",edge[i].col);
	}
	
}

int main(){
	scan(n);
	int tmp,tmd;
	int j=0;
	for(int i=1; i<=n-1;i++){
		scan(tmp);
		scan(tmd);
		edge[++j].ed=tmd;
		edge[j].nxt=head[tmp];
		head[tmp]=j;
		edge[++j].ed=tmp;
		edge[j].nxt=head[tmd];
		head[tmd]==j;
		powe[tmp]++;
		powe[tmd]++;
	}
	ans=0;
	for(int i=1; i<=n;i++){
		 if(powe[i]>ans) ans=powe[i];
	} 
	printf("%d\n",ans);
	work();
	return 0;
}

Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e12)
 
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} cout << a[a.size()-1] << endl;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
int main()
{   
    ll a, b, t, v, w;
    cin >> a >> v;
    cin >> b >> w;
    cin >> t;
    if(w >= v) {
        cout << "NO" << endl;
        return 0;
    }
    ll d = abs(b - a);
    ll rv = abs(v - w);

    if(rv*t >= d) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef double db;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

namespace Geometry{
	const db eps = 1e-9;
	struct point{
		db x,y;
		inline point operator + (const point &p){return (point){x+p.x,y+p.y};}
		inline point operator - (const point &p){return (point){x-p.x,y-p.y};}
		inline db operator * (const point &p){return x*p.x+y*p.y;}
		inline point operator / (const db &v){return (point){x/v,y/v};}
		inline point operator * (const db &v){return (point){x*v,y*v};}
	};
	typedef point vec;
	inline db dot(vec a,vec b){return a.x*b.x+a.y*b.y;}
	inline db sqr(db x){return x*x;}
	inline db dis(point a,point b){return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));}
	inline db dis2(point a,point b){return sqr(a.x-b.x)+sqr(a.y-b.y);}
	inline db cross(vec a,vec b){return a.x*b.y-a.y*b.x;}
	struct line{
		point a,b;
	};
	inline point projection(point A,line b){
		point B=b.a,C=b.b;
		vec BA=A-B,BC=C-B,BD=BC*(BA*BC/dis2(B,C));
		return B+BD;
	}
};
using namespace Geometry;

int main(){
	line a;scanf("%lf%lf%lf%lf",&a.a.x,&a.a.y,&a.b.x,&a.b.y);
	int T;scanf("%d",&T);
	while (T--){
		point b,c;scanf("%lf%lf",&b.x,&b.y);
		c=projection(b,a);
		printf("%.10lf %.10lf\n",c.x,c.y);
	}
}


Measured memory_bytes: 3244
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
vector<char>cc;
int main()
{
	char a[55],b[55];
	scanf("%s",a);
	scanf("%s",b);
	int n=strlen(a)+strlen(b);
	int s=0,t=0;
	for(int i=0;i<n;i++)
	{
		int j=i+1;
		if(j&1)
			cout<<a[s++];
		else
			cout<<b[t++];
			
	}
	cout<<endl;
	return 0;
 } 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
// ミント
const int mod = 998244353;

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

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//昆布
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
}   ;
 
 mint dp[3005][3005] ;//個数　和
int main(){
  int n,s ;cin>>n>>s ;
  vector<ll> A(n) ; rep(i,n) cin>>A[i] ;
  rep(i,s+5) dp[0][i]= 0;
  dp[0][0]=1 ; 
  mint ni=2 ;
  rep(i,n){
   
   rep2(j,-1,s){
     
     dp[i+1][j+1]=ni*dp[i][j+1] ;
     if(j+1>=A[i]) dp[i+1][j+1]+=dp[i][j+1-A[i]] ;
   }
  }
  cout<<dp[n][s]<<endl ;
    return 0;
  }

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

int main()
{
  ll N;
  scanf("%lld",&N);
  vector<ll> T(N);
  vector<ll> A(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&T[i]);
    scanf("%lld",&A[i]);
  }

  ll x = 1, y = 1;
  for (int i=0; i<N; i++) {
    ll v = max((x+T[i]-1)/T[i], (y+A[i]-1)/A[i]);
    x = v * T[i];
    y = v * A[i];
  }
  cout << x + y << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int goal[30] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3};
 
int from[4][11] = {{  7,  8,  9, 13, 22, 23, 24, 18, 10, 11, 12},
                   {  1,  2,  3, 15, 28, 29, 30, 16, 19, 20, 21},
                   {  1,  4,  7, 10, 24, 27, 30, 21, 16, 17, 18},
                   {  3,  6,  9, 12, 22, 25, 28, 19, 13, 14, 15}};
 
int   to[4][11] = {{ 22, 23, 24, 18,  7,  8,  9, 13, 12, 11, 10},
                   { 28, 29, 30, 16,  1,  2,  3, 15, 21, 20, 19},
                   { 24, 27, 30, 21,  1,  4,  7, 10, 18, 17, 16},
                   { 22, 25, 28, 19,  3,  6,  9, 12, 15, 14, 13}};
 
int main()
{
    int n;
 
    scanf("%d", &n);
 
    for (int t = 0; t < n; t++){
        vector<int> stat(30);
        for (int i = 0; i < 30; i++){
            scanf("%d", &stat[i]);
        }
 
        queue<vector<int> > q;
        map<vector<int>, int> mp;
        mp[stat] = 0;
        for (q.push(stat); q.size(); q.pop()){
            vector<int> x = q.front();
            bool ok = true;
 
            for (int i = 0; i < 30; i++){
                if (x[i] != goal[i]) ok = false;
            }
            if (ok){
                printf("%d\n", mp[x]);
                break;
            }
 
            int nt = mp[x] + 1;
 
            for (int i = 0; i < 4; i++){
                vector<int> y = x;
                for (int j = 0; j < 11; j++){
                    y[to[i][j] - 1] = x[from[i][j] - 1];
                }
                if (mp.count(y) == 0){
                    mp[y] = nt;
                    q.push(y);
                }
            }
        }
    }
 
    return (0);
}

Measured memory_bytes: 1272
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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

int dp[110000];

int main(){
    int N; cin >> N;
    rep(i, 110000) dp[i] = N;
    dp[0] = 0;
    rep(i, N){
        for(int pow6 = 1; i + pow6 <= N; pow6 *= 6){
            dp[i + pow6] = min(dp[i + pow6], dp[i] + 1);
        }
        for(int pow9 = 1; i + pow9 <= N; pow9 *= 9){
            dp[i + pow9] = min(dp[i + pow9], dp[i] + 1);
        }
    }
    COUT(dp[N]);
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
using namespace std;
int main(){
  int n,k,c;string s;cin>>n>>k>>c>>s;
  int* a=new int[k]{};
  int* b=new int[k]{};
  int ad=0;
  int bd=n-1;
  for(int i=0;i<k;i++){
    while(s[ad]!='o')ad++; a[i]=ad;ad+=c+1;
    while(s[bd]!='o')bd--; b[k-1-i]=bd;bd-=c+1;
  }
  for(int i=0;i<k;i++){
    if(a[i]==b[i]) cout<<a[i]+1<<endl;
  }
  return 0;
}


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

int main(){

    string S;
    cin >> S;

    int year, month, day;
    year = stoi(S.substr(0, 4));
    month = stoi(S.substr(5, 2));
    day = stoi(S.substr(8, 2));

    if(year <= 2019 && month <= 4 && day <= 30) cout << "Heisei" << endl;
    else cout << "TBD" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int i,j,k,n,m;
ll s,a,b,x,y;
int main(){
	cin>>s;
	a=1;
	b=  1000000000
	 -(s-1)%1000000000-1;
	s+=a*b;
	x=s/1000000000;
	  y=1000000000;
	a=x-a;
	b=y-b;
	cout<<"0 "<<y-b<<' '<<x<<" 0 "<<a<<' '<<y<<endl;
	return 0;
}


Measured memory_bytes: 256
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from collections import Counter

n = I()
v = III()

if v==[v[0]]*len(v):
    print(len(v)//2)
    exit()

x = [v[i] for i in range(0,n,2)]
y = [v[i] for i in range(1,n,2)]

xc = Counter(x)
yc = Counter(y)
xval = xc.most_common(1)[0][0]
yval = yc.most_common(1)[0][0]
xnum = xc.most_common(1)[0][1]
ynum = yc.most_common(1)[0][1]

if xval!=yval:
    print(len(x)-xnum+len(y)-ynum)
else:
    if xnum==len(x):
        print(min(len(x)+len(y)-ynum, len(x)-xnum+len(y)-yc.most_common(2)[1][1]))
    elif ynum==len(y):
        print(min(len(x)-xnum+len(y), len(x)-xc.most_common(2)[1][1]+len(y)-ynum))
    else:
        print(min(len(x)-xc.most_common(2)[1][1]+len(y)-ynum, len(x)-xnum+len(y)-yc.most_common(2)[1][1]))

Measured memory_bytes: 63620
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint

#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori


def main():
    kazu = [0]
    for i in range(1, 14):
        kazu.append(26 ** i + kazu[i - 1])
    #    print(kazu)
    n = int(input())

    def hante(a):
        b = 0
        for i in range(len(kazu)):
            if a <= kazu[i]:
                b = i
                break
        return b

    keta = hante(n)
    ans = []
    i = keta - 1
    n -= kazu[keta - 1]+1
    ans.append(n%26+1)
    n//=26
    while i > 0:
        temp = n % 26
        ans.append(temp+1)
        n//=26

        i -= 1
    ko = list("abcdefghijklmnopqrstuvwxyz")
    ans2 = []
    for i in ans:
        ans2.append(ko[i - 1])
    ans2.reverse()
    print("".join(ans2))


if __name__ == "__main__":

    main()

Measured memory_bytes: 72592
N, M = map(int, input().split())

step_route = [-1] * (N+1)

step_route[0] = 1
step_route[1] = 1

for i in range(M):
    tmp = int(input())
    step_route[tmp] = 0

for j in range(2,N+1):  
    if step_route[j] == -1:
        step_route[j] = step_route[j-1] + step_route[j-2]
    
print(step_route[N] % 1000000007)

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<class V,int NV> class SegTree_1 {
public:
	vector<V> val;
	static V const def=-1LL<<60;
	V comp(V l,V r){ return max(l,r);};
	
	SegTree_1(){val=vector<V>(NV*2,def);};
	V getval(int x,int y,int l=0,int r=NV,int k=1) { // x<=i<y
		if(r<=x || y<=l) return def;
		if(x<=l && r<=y) return val[k];
		return comp(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1));
	}
	void update(int entry, V v) {
		entry += NV;
		val[entry]=v;
		while(entry>1) entry>>=1, val[entry]=comp(val[entry*2],val[entry*2+1]);
	}
};

int N;
ll X[202020],S[202020];
ll V[202020];
SegTree_1<ll,1<<20> st;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	ll TC=0;
	FOR(i,N) {
		cin>>X[i]>>S[i];
		TC+=S[i];
		V[i]=TC-X[i];
		st.update(i,V[i]);
	}
	ll ma=0;
	FOR(i,N) {
		ma=max(ma,st.getval(i,N)-V[i]+S[i]);
	}
	cout<<ma<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 21376
//Author - Rahil Malhotra
#include "bits/stdc++.h"
using namespace std;
 
template <typename T> void print(T t) { cout<<t<<endl; }
template<typename T, typename... Args> void print(T t, Args... args) { cout<<t<<" "; print(args...); }
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl '\n'
#define int long long
#define double long double

int32_t main()
{
    IOS;
    string s;
    cin>>s;
    cout<<s;
    if(s[s.size()-1]=='s')
        cout<<"es";
    else
        cout<<"s";
}   


Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

const int S = 100010;
char buf[S];

int main() {
    scanf("%s", buf);
    int N = strlen(buf), ans = N;
    for(int i=1; i<N; i++) {
        if(buf[i-1] != buf[i]) {
            ans = min(ans, max(i, N-i));
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    if(n == 1){
        printf("Hello World\n");
    }else{
        int a, b;
        scanf("%d %d", &a, &b);
        printf("%d\n", (a+b));
    }
    return 0;
}


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


int main()	
{
	int n,t,a,b;
	vector<int>v;
	cin>>n>>t;
	for(int i=0;i<n;i++)
	{
		cin>>a>>b;
		if(b<=t)v.push_back(a);
	}
	if(v.size()==0)cout<<"TLE"<<endl;
	else
	{
		sort(v.begin(),v.end());
		cout<<v[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll N;
	cin>>N;
	ll ans = INF;
	for(ll i = 1; i<= sqrt(N); ++i){
		if(N%i!=0)continue;
		ll tmp = (i-1) + (N/i)-1;
		ans = min(tmp,ans);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

int main(){
  int n,k; cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];

  sort(p.begin(), p.end());
  int ans = 0;
  rep(i,k) ans += p[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<stdio.h>

main(void){
  
  int s[10000],n,t[500],q,i,count=0,j,temp;
  int left,mid,right,value;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
    
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t[i]);
  }
  
  for(i=0;i<n-1;i++){
    for(j=n-1;j>i;j--){
      if(s[j]<s[j-1]){
	temp=s[j];
	s[j]=s[j-1];
	s[j-1]=temp;
      }
    }
  }
    
  
  for(i=0;i<q;i++){
    right=n;
    left=0;
    value=t[i];
   
    while(left<=right){
      mid=(left+right)/2;

      if(s[mid]==value){
	count=count+1;
	break;
      }

      else if(s[mid]<value)left=mid+1;

      else right=mid-1;

    }
  }
  
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <functional>
#include <utility>
#include <unordered_map>
#include <map>
#include <set>
#include <array>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int p, q;
	p = *max_element(a.begin(), a.end());
	a.erase(max_element(a.begin(), a.end()));
	if (p % 2 == 0) {
		int tmp = p / 2;
		int r = INF;
		for (int i = 0; i < a.size(); i++) {
			if (r > abs(a[i] - tmp)) {
				r = abs(a[i] - tmp);
				q = a[i];
			}
		}
	}
	else {
		int tmp[2] = { p / 2, p / 2 + 1 };
		int r = INF;
		for (int i = 0; i < a.size(); i++) {
			if (r > abs(a[i] - tmp[0])) {
				r = abs(a[i] - tmp[0]);
				q = a[i];
			}
			if (r > abs(a[i] - tmp[1])) {
				r = abs(a[i] - tmp[1]);
				q = a[i];
			}
		}
	}
	cout << p << " " << q << endl;
	return 0;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}





int main(){
    std::string S, T; std::cin >> S >> T;
    std::cout << ((T.substr(0, S.length()) == S) ?
                  "Yes" : "No") << std::endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n,x;
	cin >> n >> x;
	vector<int> a(n);
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
	}
	ll ans=0;
	for(int i=0;i<n-1;i++)
	{
		if(a[i]+a[i+1]>x)
		{
			ans+=a[i]+a[i+1]-x;
			if(a[i]>=x)
			{
				a[i+1]=0;
			}
			else
			{
				a[i+1]=x-a[i];
			}
		}
	}
	cout << ans;
	return 0;
}

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


ll n;
ll dp[(1<<16)+1];
ll sums[(1<<17)-1];

ll compute(ll mask,vector<vector<ll > >&score)
{
	ll sum=0;
	ll i,j;
	for(i=0;i<n;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(mask&(1<<i) && mask&(1<<j))
			{
				sum+=score[i][j];
			}
		}
	}
	return(sum);
}
void precompute(vector<vector<ll > >&score)
{
	ll i;
	for(i=1;i<(1<<n);i++)
	{
		sums[i]=compute(i,score);
	}
}

ll solve(ll mask,vector<vector<ll > >&score)
{
	ll i,j;
	if(mask==0)
	{
		return(0);
	}
	if(dp[mask]!=-1)
	{
		return(dp[mask]);
	}
	ll ans=INT_MIN;
	ll submask;
	for(submask=mask;submask!=0;submask=(submask-1)&mask)
	{
		ans=max(ans,sums[submask]+solve(mask^submask,score));
	}
	return(dp[mask]=ans);
}

int main()
{
	cin>>n;
	ll i,j;
	vector<vector<ll > >score(n,vector<ll>(n));
	memset(dp,-1,sizeof(dp));
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			cin>>score[i][j];
		}
	}
	precompute(score);
	cout<<solve((1<<n)-1,score);
}

Measured memory_bytes: 4628
#include<iostream>
using namespace std;
int main()
{
int h,b,i,j;
cin>>h>>b;
char a[h][b];
for(i=0;i<h;i++)
{
    for(j=0;j<b;j++)
    cin>>a[i][j];
}
for(i=0;i<=b+1;i++)
cout<<"#";
cout<<endl;
for(i=0;i<h;i++)
{ cout<<"#";
    for(j=0;j<b;j++)
    {
        cout<<a[i][j];
    }
    cout<<"#"<<endl;
}
for(i=0;i<=b+1;i++)
cout<<"#";
}



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

int main(void) {
    int N,tmp;
    int a[100000];
    int ans=1;
    cin >> N;
    for (int i=0; i<N; i++) a[i] = 0;
    for (int i=0; i<N; i++) {
        cin >> tmp;
        a[tmp]++;
    }
    for (int i=0; i<N-2; i++) ans = max(ans, a[i]+a[i+1]+a[i+2]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[100],b[100],c[100],d[100], ans[100];

int main(){
    int n,m;
    cin >> n >> m;
    for(int i = 0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    for(int i = 0;i<m;i++){
        cin >> c[i] >> d[i];
    }
    for (int i = 0; i < n; i++)
    {
        ll tmp = 1e18, index = -1;
        for (int j = 0; j < m; j++)
        {
            if(tmp > abs(a[i]-c[j])+abs(b[i]-d[j])){
                tmp = abs(a[i]-c[j])+abs(b[i]-d[j]);
                index = j+1;
            }
        }
        cout << index << endl;
    }
}

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

int main() {
    int d;
    string S;
    cin >> S;

    if(S == "SUN")
        d = 7;
    else if(S == "MON")
        d = 6;
    else if(S == "TUE")
        d = 5;
    else if(S == "WED")
        d = 4;
    else if(S == "THU")
        d = 3;
    else if(S == "FRI")
        d = 2;
    else
        d = 1;

    cout << d << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

long long f(string s) {
	int N = s.size();
	long long sum = 0;
	for (long long i = 0, j = 0; i < N; i = j) {
		while (j < N && s[i] == s[j])j++;
		sum += (j - i) / 2;
	}
	return sum;
}

int main() {

	string S;
	cin >> S;

	long long N = S.size();

	long long K;
	cin >> K;

	bool same = true;
	for (int i = 0; i < N; i++) if (S[0] != S[i]) same = false;
	if (same) {
		cout << (N * K) / 2 << endl;
		return 0;
	}

	long long d1 = f(S);
	long long d2 = f(S + S);

	long long a = d1;
	long long d = d2 - d1;

	cout << a + (K - 1) * d << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll N, A, B, C, D; cin >> N >> A >> B >> C >> D;;
	--A, --B, --C, --D;
	string S; cin >> S;

	for (ll i = min(A, B)+1; i < (max(C, D)-1); ++i)
	{
		if ((S[i] == S[i+1]) && (S[i] == '#'))
		{
			std::cout << "No"<< std::endl;
			return 0;
		}
	}

	if (C < D)
	{
		std::cout << "Yes" << std::endl;
		return 0;
	}
	else
	{
		for (ll i = B-1; i < D+2-3+1; ++i )
		{
			if (S[i] == '.' && S[i+1] == '.' && S[i+2] == '.')
			{
				std::cout << "Yes"<< std::endl;
				return 0;
			}
		}
		std::cout << "No"<< std::endl;
	}
}


Measured memory_bytes: 640
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

alias AB = Tuple!(long, "a", long, "b");
AB[10000] ABS;

void main()
{
    auto N = readln.chomp.to!int;
    auto AS = readln.split.to!(long[]);
    auto BS = readln.split.to!(long[]);

    foreach (i; 0..N) {
        ABS[i] = AB(AS[i], BS[i]);
    }
    sort!"a.a - a.b < b.a - b.b"(ABS[0..N]);
    int j = N-1;
    foreach (i; 0..N) {
        if (ABS[i].a >= ABS[i].b) break;
        auto d = (ABS[i].b - ABS[i].a) / 2;
        ABS[i].a = ABS[i].b;
        while (d) {
            if (ABS[j].a <= ABS[j].b) {
                ABS[j].b += d;
                d = 0;
            } else if (ABS[j].a - ABS[j].b < d) {
                d -= ABS[j].a - ABS[j].b;
                ABS[j].b = ABS[j].a;
                --j;
            } else {
                ABS[j].b += d;
                d = 0;
            }
        }
    }
    foreach (ab; ABS[0..N]) {
        if (ab.a > ab.b) {
            writeln("No");
            return;
        }
    }
    writeln("Yes");
}

Measured memory_bytes: 3324
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0

for i in range(1,n+1):
    c=a[-i]-b[-i]
    if c>=0:
        ans+=b[-i]
    else:
        ans+=a[-i]
        if a[-i-1]+c<=0:
            ans+=a[-i-1]
            a[-i-1]=0
        else:
            ans-=c
            a[-i-1]=a[-i-1]+c

print(ans)

Measured memory_bytes: 19156
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, counter1=0, counter2=0;
  cin >> N;
  for(int i=1; i<=N; i+=2){
    counter1 = 0;
    for(int j=1; j<=i; j++){
      if(i%j == 0){
        counter1++;
      }
    }
    if(counter1 == 8){
      counter2++;
    }
  }
  cout << counter2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define vi vector<int>
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}
ll table[100001][3],a[100001],b[100001],c[100001];

ll dp(int x,int p){
	if(table[x][p]!=-1){
		return table[x][p];
	}
	if(x<0){
		return -1*LLMAX;
	}
	if(p==0){
		return table[x][0] = max(dp(x-1,1),dp(x-1,2)) + a[x];
	}
	if(p==1){
		return table[x][1] = max(dp(x-1,0),dp(x-1,2)) + b[x];
	}
	else{
		return table[x][2] = max(dp(x-1,1),dp(x-1,0)) + c[x];
	}
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,x;
    MSET(table,-1);
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    table[0][0]=a[0];
    table[0][1]=b[0];
    table[0][2]=c[0];

    cout<<max(max(dp(n-1,0),dp(n-1,1)),dp(n-1,2));

    return 0;
}




Measured memory_bytes: 9600
A,B,N = map(int, input().split())
if B == 1 or A == 1:
    print(0)
    exit()
if B > N or N == 1:
    res = int(A*N/B)-A*int(N/B)
else:
    N = N - N%B - 1
    res = int(A*N/B)-A*int(N/B)
print(res)

Measured memory_bytes: 61752
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define ll           long long
#define all(v)       (v).begin() , (v).end()
#define vi           vector <ll>
#define vii          vector <pair<ll,ll>>
#define ii           pair<ll,ll>
#define sz(v)	     ((int)((v).size()))
#define lp(i,a,b)    for(int i=a;i<b;i++)
#define pb           push_back
#define pf           push_front
#define F            first
#define S            second
#define endl         "\n"
#define IOS          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const double PI = 3.14159265358979323846;
const ll inf=2e9,MOD=998244353,MAX=1e7+2;
vector<ll>v;


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    IOS;
    ll n;
    cin>>n;
    map<ll,ll>mp;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0)
            n/=i,mp[i]++;
    }
    if(n>1)
        mp[n]++;
    for(auto i:mp)
        v.pb(i.second);
    ll res=0;
    lp(i,0,sz(v)){
        ll x=1,y=0;
        while(x*(x-1)/2<=v[i])
            x++,y++;
        res+=y-1;
    }
    cout<<res;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < 3; ++i) {
        if (n % 10 == 7){
            cout << "Yes" << endl;
            return 0;
        }
        n /= 10;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3616
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long 
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

bool isPowerOfTwo(int x){
   return x&&(!(x&(x-1)));
}

int takemod(int x){ 
    return (x%mod + mod) % mod; 
}

int lcm(int x,int y) {
    return (x/gcd(x,y)) * y;
}

int fpow(int base,int power,int MOD) {
    int result = 1;
    base=base%MOD;
    while(power){
        if(power&1) 
            result = (result*base) % MOD;
        base = (base*base) % MOD;
        power = power>>1;
    }
    return result;
}

int modinv(int x){return fpow(x,mod-2,mod);}

void fastIO(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int dp[100005]; int a[1005];

int solve(int k,int n){  
    if(dp[k]!=-1) return dp[k];
    if(k==0) return dp[k]=0;
    int ans=0;
    loopf(i,0,n-1){
        if(k>=a[i]){
            if(solve(k-a[i],n)==0){ ans=1; break; }
        }
        else break;
    }
    return dp[k]=ans;
}

int32_t main(){
    
    fastIO();
    int n,k; cin>>n>>k; loopf(i,0,100005) dp[i]=-1; loopf(i,0,n-1) cin>>a[i];
    //tc(t){
    if(solve(k,n)) cout<<"First";
    else cout<<"Second";    
    //}

    return 0;
}

Measured memory_bytes: 4224
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int T[] = new int[N];
        int total = 0;
        for(int i = 0;i < N;i++){
            T[i] = sc.nextInt();
            total += T[i];
        }
        
        int M = sc.nextInt();
        for(int i = 0; i < M;i++){
           int p = sc.nextInt();
           int x = sc.nextInt();
           
           System.out.println(total - (T[p - 1] - x));
        }
        
    }
}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <algorithm>

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

  size_t n = 0;
  std::cin >> n;

  std::vector<size_t> iv;

  size_t t;
  for(size_t i=0; i<n*2; ++i) {
    std::cin >> t;
    iv.push_back(t);
  }

  std::sort(iv.begin(), iv.end());

  int sum = 0;

  for(size_t i=0; i<n; ++i) {
    sum += std::min(iv[i * 2], iv[(i * 2) + 1]);
  }

  std::cout << sum << std::endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		long a=scan.nextLong();
		long ans=0;
		long b=scan.nextLong();
		long jn=(long) Math.sqrt(b);
		if(a==1) {ans=b;}
		else {
		for(;;) {
			long waru=(long) Math.pow(jn,a);
			if(jn==1) {ans=1;break;}
			if(waru<=b&&b%waru==0) {ans=jn;break;}
			jn--;
		}
		}
		
		System.out.println(ans);
    }
}

Measured memory_bytes: 22996
#include<cstdio>
    #include<algorithm>
    using namespace std;
     
    int main(void){
    	int A, B, C, D, E, F, i, j, k, l, sl, sg, bestsl = 1, bestsg = 0;
    	scanf("%d %d %d %d %d %d", &A, &B, &C, &D, &E, &F);
    	A *= 100;
    	B *= 100;
    	for(i = 0;i <= F / B;i++){
    		for(j = 0;j <= (F - i * B) / A;j++){
    			if(i >0 || j >0){
    				k = 0;
    				while(k <= (F - i * B - j * A) / D && k * D * 100 <= E * (i * B + j * A)){
    					l = 0;
    					while(l + 1 <= (F - i * B - j * A - k * D) / C && (k * D + (l + 1) * C) * 100 <= E * (i * B + j * A))
    						l++;
    					sl = i * B + j * A + k * D + l * C;
    					sg = k * D + l * C;
    					if(sg * bestsl >= bestsg * sl){
    						bestsl = sl;
    						bestsg = sg;
    					}
    					k++;
    				}
    			}
    		}
    	}
    	printf("%d %d\n", bestsl, bestsg);
    	return 0;
    }

Measured memory_bytes: 128
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	int a, b;
	cin >> a >> b;
	if(a<b) cout << 0 << endl;
	else  cout << 10 << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <cstdio>
#define rint register int
using namespace std;
const int MOD = 1000000007;
const int N = 3001;
int n,cur;
long long dp[2][N];
char ch;
inline void adj(long long &x) {if(x>=MOD)x-=MOD;}
int main()
{
    scanf("%d\n",&n);
    dp[0][1]=1LL;
    for (rint i=2;i<=n;i++,cur^=1)
    {
        scanf("%c",&ch);
        if (ch=='<')
        {
            dp[cur^1][1]=0LL;
            for (rint j=2;j<=i;j++) 
            {
                dp[cur^1][j]=dp[cur^1][j-1]+dp[cur][j-1];
                adj(dp[cur^1][j]);
            }
        }
        else 
        {
            dp[cur^1][i]=0LL;
            for (rint j=i-1;j>=1;j--) 
            {
                dp[cur^1][j]=dp[cur^1][j+1]+dp[cur][j];
                adj(dp[cur^1][j]);
            }
        }
    }
    for (rint i=1;i<n;i++) dp[cur][n]+=dp[cur][i];
    printf("%lld\n",dp[cur][n]%MOD);
    return 0;
}


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

int main() {
    ll n,ans=0;
    cin >> n;
    ans = n/11;
    ans*=2;
    if(n%11<=6&&n%11>=1) ans++;
    else if(n%11>6) ans+=2; 
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
function Main(input) {
    const a = parseInt(input, 10);
    
    const ans = a + a*a + a*a*a;
    
    console.log(ans);

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30596
N = int(input())
A_list = list(input().split())

count = 1
for i in range(len(A_list)):
  a = int(A_list[i])
  if a == count:
    count += 1
if count == 1:
  output = -1
else:
  output = N - count + 1
print(output)
 

Measured memory_bytes: 18216
import std.algorithm,
       std.string,
       std.range,
       std.stdio,
       std.conv;

void main() {
  long[][51][51] dp;
  foreach (ref e1; dp)
    foreach (ref e2; e1)
      e2.length = 50^^2 + 1;
  int[2] input = readln.chomp.split.to!(int[2]);
  int N = input[0],
      A = input[1];
  int[] x = readln.chomp.split.to!(int[]);
  dp[0][0][0] = 1;

  foreach (i; N.iota) {
    foreach (j; N.iota) {
      foreach (k; (50^^2 + 1).iota) {
        dp[i + 1][j][k] += dp[i][j][k];
        if (k + x[i] >= 50^^2 + 1) continue;
        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
      }
    }
  }

  long ans;

  foreach (i; 1.iota(N+1)) {
    ans += dp[N][i][i * A];
  }

  writeln(ans);
}

Measured memory_bytes: 52476
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<i64>();
    let mut ans = 0;
    for a in 1..n {
        let b_min = 1;
        let b_max = (n - 1) / a;
        if b_max >= b_min {
            ans += b_max - b_min + 1
        }
        if n <= 10 {
            debug!(a, b_max);
        }
    }
    println!("{}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 2148
#include <algorithm>
#include <bitset>
#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
#include<iomanip>
namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
using lll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
template <typename T>
T gcd(T m, T n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
         r %= 1000000007;
         rr %= 1000000007;
    }
    r /= rr;
     r %= 1000000007;
    return r;
}
#define rep(a,b,c) for(ll a = b; a < c; ++i)
ll mod = 1000000007;
//---------------------------------------------------------------------------------------------------
ll f[101010];
void init() {
    f[0] = 1;
    rep(i, 1, 101010) f[i] = (f[i - 1] * i) % mod;
}
//---------------------------------------------------------------------------------------------------
ll inv(ll x) {
    ll res = 1;
    ll k = mod - 2;
    ll y = x;
    while (k) {
        if (k & 1) res = (res * y) % mod;
        y = (y * y) % mod;
        k /= 2;
    }
    return res;
}
//---------------------------------------------------------------------------------------------------
ll C(int n, int k) {
    ll a = f[n]; // = n!
    ll b = f[n-k]; // = (n-k)!
    ll c = f[k]; // = k!

    ll bc = (b * c) % mod;

    return (a * inv(bc)) % mod;
}
ll pow2_(ll n){
  
  ll div = 1000000007ll;
  ll ans = 0,k=2;
  {
    bitset<48> b(n);
    FOR(i,32){
      ans+=b[i]*k%div;
      ans%=div;
      k*=k;
      k%=div;
    }
  }
  return ans;
}
int main(){
  ll X,Y,A,B,C;
  cin>>X>>Y>>A>>B>>C;
  vector<pair<ll,ll>> vec;
  FOR(i,A){
    ll p;
    cin>>p;
    vec.push_back({p,0});
  }
  FOR(i,B){
    ll p;
    cin>>p;
    vec.push_back({p,1});
  }
  FOR(i,C){
    ll p;
    cin>>p;
    vec.push_back({p,2});
  }
  ll suml =0;
  ll sumv=0;
  ll sumx=0;
  ll sumy=0;
  sort(vec.begin(),vec.end(),[](auto a,auto b){return a.first>b.first;});
  FOR(i,A+B+C){
    if(suml>=X+Y)break;
    if(vec[i].second==0){
      if(sumx>=X)continue;
      sumx++;
      suml++;
      sumv+=vec[i].first;
    }else if(vec[i].second==1){
      if(sumy>=Y)continue;
      sumy++;
      suml++;
      sumv+=vec[i].first;
    }else if(vec[i].second==2){
      suml++;
      sumv+=vec[i].first;
    }
  }
  cout<<sumv<<endl;
    
}

Measured memory_bytes: 10604
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
int main() {
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    int a[N],b[M];
    for (int i = 0;i<N;i++){
        cin >> a[i];
    }
    for (int i = 0;i < M ;i++){
        cin >> b[i];
    }
    int c,d;
    sort(a,a+N);
    c = a[N -1];
    sort(b,b+M);
    d = b[0];
    if (c < d && c < Y && d > X){
        cout << "No War" << endl;
    }
    else{
        cout << "War" << endl;
    }

}

Measured memory_bytes: 384
#include<iostream>

int main()
{
  int a, b, c;
  std::cin >> a >> b >> c;
  
  if (a == 5 ) {
    if ((b == 5 && c == 7) || (b == 7 && c == 5)) {
      std::cout << "YES" << std::endl;
    } else {
      std::cout << "NO" << std::endl;
    }
  } else if (a == 7) {
    if (b ==5 && c == 5) {
      std::cout << "YES" << std::endl;
    } else {
      std::cout << "NO" << std::endl;
    }
  } else {
    std::cout << "NO" << std::endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, m;
    cin>>n>>m;
    char c[n][m];
    for(int i=0; i<n; ++i){
        for(int j=0; j<m; ++j)
            cin>>c[i][j];
    }
    
    int h[n]={0}, w[m]={0};
    
    for(int i=0; i<n; ++i){
        int j=0;
        while(c[i][j]=='.' and j<m) j++;
        if(j==m) h[i]=1;
    }
    
    for(int i=0; i<m; ++i){
        int j=0; 
        while(c[j][i]=='.' and j<n) j++;
        if(j==n) w[i]=1;
    }
    
    for(int i=0; i<n; ++i){
        bool check=true;
        for(int j=0; j<m; ++j){
            if(!h[i] and !w[j]){
                cout<<c[i][j];
                check=false;
            }
        }
        if(!check)
            cout<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256