akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main()
{
    int a,b;
    scanf("%d %d",&a,&b);
    if(a < b){
        printf("a < b");
    }else if(a > b){
        printf("a > b");
    }else if(a == b){
        printf("a == b");
    }
    printf("\n");
    return 0;
}

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

using namespace std;

int main (){

  int x;
  
  cin>>x;
  
  int d = x / 100;//個数
  int y = x % 100;//余り
  
  if (y <= 5*d) cout<<"1"<<endl;
  else cout<<"0"<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
     
#define int  long long
#define endl '\n'
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N = 1e6 + 10;

struct IOsetup{
  IOsetup(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
}IO;

int32_t main(){
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ret = "";
  for (int i = 0; i < n; i++){
    ret += s[i], ret += t[i];   
  }
  cout << ret << endl;
}


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

const MOD: i64 = 1000000007;

fn powmod(x: i64, n: i64) -> i64 {
    if n == 0 {
        1
    } else {
        let sq = powmod(x, n / 2);
        let sqsq = sq * sq % MOD;
        if n % 2 == 1 {
            sqsq * x % MOD
        } else {
            sqsq
        }
    }
}

fn main() {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    let s = buf.trim_right();
    let count = |ch| {
        s.chars().filter(|&c| c == ch).count() as i64
    };


    let ccount = count('C');
    let qcount = count('?');

    let mut preva = 0 as i64;
    let mut prevb = 0 as i64;
    let mut prevc = 0 as i64;
    let mut prevq = 0 as i64;

    let mut ans = 0 as i64;

    for ch in s.chars() {
        if ch == 'B' || ch == '?' {
            let afterc = ccount - prevc;
            let afterq = (qcount - prevq) - ((ch == '?') as i64);

            let freeq = prevq + afterq;
            ans += preva * afterc % MOD * powmod(3, freeq) % MOD;
            ans %= MOD;

            if prevq > 0 {
                ans += prevq * afterc % MOD * powmod(3, freeq - 1) % MOD;
                ans %= MOD;
            }
            if afterq > 0 {
                ans += preva * afterq % MOD * powmod(3, freeq - 1) % MOD;
                ans %= MOD;
            }
            if prevq > 0 && afterq > 0 {
                ans += prevq * afterq % MOD * powmod(3, freeq - 2) % MOD;
                ans %= MOD;
            }
        }
        let upd = if ch == 'A' {
            &mut preva
        } else if ch == 'B' {
            &mut prevb
        } else if ch == 'C' {
            &mut prevc
        } else {
            &mut prevq
        };
        *upd += 1;
    }

    println!("{}", ans)
}

Measured memory_bytes: 4352
a , b , c = map(int,input().split())
if a <= b <= c:
    print(a , b , c)
elif a <= c <= b:
    print(a , c , b)
elif b <= a <= c:
    print(b , a , c)
elif b <= c <= a:
    print(b , c , a)
elif c <= a <= b:
    print(c , a , b)
elif c <= b <= a:
    print(c , b , a)




Measured memory_bytes: 5596
#include<cstdio>
const int N=1e5+10;
int a[N],n,f[N],m;
int ab(int x){return x<0?-x:x;}
int mi(int a,int b){return a<b?a:b;}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		f[i]=1e9;
	}
	f[1]=0;
	f[2]=ab(a[2]-a[1]);
	for(int i=3;i<=n;i++)
		for(int j=1;j<=m&&i-j;j++)
			f[i]=mi(f[i],f[i-j]+ab(a[i]-a[i-j]));
	printf("%d",f[n]);
	return 0;
}


Measured memory_bytes: 896
//実装が重そうな問題はある程度考えてから書く
//初期化を忘れずに（特に二分探索とか）
//コーナーケースを考えて（特に場合分けとか）
//不可解すぎるバグは配列外参照（配列の長さ）を検討
#include <bits/stdc++.h>
#define YES "YES"
#define NO "NO"
#define YESNO OUT(three(solve(),YES,NO))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(a);i>=(LL)(b);i--)
#define REP(i,b) FOR(i,zero,b)
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,b,zero)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define int LL
#define zero 0LL
using namespace std;
template<typename T> inline void maximize(T &a,T b){a=max(a,b);}
template<typename T> inline void minimize(T &a,T b){a=min(a,b);}
template<typename T> inline bool middle(T a,T b,T c){return b<=a && a<=c;}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef priority_queue<pr,Vpr,greater<pr> > PQ;
inline void outputVI(VI x){REP(i,SI(x)){cout << three(i," ","") << x[i];}OUT("");}
const int SIZE1=5*1e5+1000;
const int SIZE2=5010;
const int SIZE3=400;
const int SIZE=6050;
const LL p=7+1e9;
const LL INF=1LL<<60;
const long double EPS=1e-7;
string s;
ut N,M,K,X,L,Y;
// ut A,B,C,D,E,F,G,H,I,J,O,P,Q,R,T,U;
VI edges[SIZE];
LL vals[SIZE],nums[SIZE],maps[SIZE2][SIZE2],answer=zero;

////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////
void init(){
	
}
map<pair<string,string>,LL> msl;
string s1,s2;

LL solve3(int now,string nows,string nowr){
	if(now==N){
		return msl[make_pair(nows,nowr)];
	}
	return solve3(now+1,nows+s2[now],nowr)+solve3(now+1,nows,nowr+s2[now]);
}
void solve2(int now,string nows,string nowr){
	if(now==N){
	//	cout << nows << endl;
		msl[make_pair(nows,nowr)]=msl[make_pair(nows,nowr)]+1;
		return;
	}
	solve2(now+1,nows+s1[now],nowr);
	solve2(now+1,nows,nowr+s1[now]);
}
LL solve(){
	cin >> N;
	string s;
	cin >> s;
	s1=s.substr(0,N);
	s2=s.substr(N,N);
	sort(ALL(s1));
	sort(ALL(s2));
	if(s1!=s2) return 0;
	s1=s.substr(0,N);
	s2=s.substr(N,N);
	reverse(ALL(s2));
//	cout << s1 <<" " <<s2 << endl;
	solve2(0,"","");
	return solve3(0,"","");
	 
}
signed main(){
	OUT(solve());
	return 0;
}

Measured memory_bytes: 87552
#include <iostream>

using namespace std;

int gcd(int a,int b){
  if(a < b) swap(a,b); 

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

int main(){
  int a,b;
  cin>>a>>b;
  cout<<gcd(a,b)<<endl;
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int n;
    Scd(n);
    int a;
    int ans = 0;
    Rep(i,n){
        Scd(a);
        ans |= a&1;
    }

    if( ans ) printf ("first\n");
    else printf("second\n");

    return 0;
}



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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int mod = 1e9 + 7;
int n, id;
const int N = 105;
ll cnt1[64], cnt2[64];
string m[64];
vector<int> e[64];
unordered_map<string, int> mp;
char a[4] = {'A', 'C', 'G', 'T'};
//  AGC, ACG, GAC
unordered_set <string> skip = {"AGC", "ACG", "GAC"};

void init() {
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 4; ++j) {
            for (int k = 0; k < 4; ++k) {
                string s;
                s.push_back(a[i]);
                s.push_back(a[j]);
                s.push_back(a[k]);
                if (!skip.count(s)) {
                    m[id] = s;
                    mp[s] = id;
                    ++id;
                }
            }
        }
    }
    for (int i = 0; i < id; ++i) {
        string s = m[i];
        for (int j = 0; j < 4; ++j) {
            string ns = s.substr(1, 2) + a[j];
            if (!skip.count(ns)) {
                if (s[0] == 'A' && s[2] == 'G' && a[j] == 'C') continue;
                if (s[0] == 'A' && s[1] == 'G' && a[j] == 'C') continue;
                int nid = mp[ns];
                e[i].push_back(nid);
            }
        }
    }
}


int main() {
    cin >> n;
    init();
    for (int i = 0; i < id; ++i) {
        cnt1[i] = 1;
    }
    for (int i = 3; i < n; ++i) {
        for (int j = 0; j < id; ++j) {
            for (int k : e[j]) {
                cnt2[k] = (cnt2[k] + cnt1[j]) % mod;
            }
        }
        for (int j = 0; j < id; ++j) {
            cnt1[j] = cnt2[j];
            cnt2[j] = 0;
        }
    }
    ll res = 0;
    for (int i = 0; i < id; ++i) {
        res = (res + cnt1[i]) % mod;
    }
    cout << res << endl;
    return 0;
}


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

const int N = 1e5 + 5;
int sum[N], n,q;
string s;


int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>q>>s;
    
    s = "#" + s;
    for (int i = 1; i <= n-1; i++){
        if(s[i] == 'A'&&s[i+1]=='C')sum[i+1] = 1;
    }
    for (int i = 1; i <= n; i++){
        sum[i] = sum[i] + sum[i-1];
    }
    
    int l,r;
    for (int i = 1; i <= q; i++){
        cin>>l>>r;
        cout<<sum[r]-(s[l]=='C'?sum[l]:sum[l-1])<<endl;
    }

    return 0;
}


Measured memory_bytes: 1388
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,A,B;
ll h[100010];
int main(){
    cin>>N>>A>>B;
    for(ll i=0;i<N;i++){
        cin>>h[i];
    }
    ll ok=1'000'000'000;
    ll ng=0;
    while(ok-ng>1){
        ll mid=(ok+ng)/2;
        ll cnt=0;
        for(ll i=0;i<N;i++){
            cnt+=(max(h[i]-mid*B,0LL)+(A-B-1)) / (A-B);
        }
        if(cnt>mid)ng=mid;
        else ok=mid;
    }
    cout<<ok<<endl;
    return 0;
}

Measured memory_bytes: 1024
a,b,c,d=input()
for i in range(2**3):
    op=["-"]*3
    for j in range(3):
        if (i>>j&1):
            op[j]="+"
    if eval(a+op[0]+b+op[1]+c+op[2]+d)==7:
        print(a+op[0]+b+op[1]+c+op[2]+d+"=7")
        break

Measured memory_bytes: 9116
#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))
//-------------------------------------------------------

int N;
int A[101010];
int L[101010];
int R[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	for(i=1;i<=N;i++) {
		cin>>A[i];
		L[i]=__gcd(A[i],L[i-1]);
	}
	
	for(i=N;i>=1;i--) {
		R[i]=__gcd(R[i+1],A[i]);
	}
	int ma=0;
	for(i=1;i<=N;i++) {
		ma=max(ma,__gcd(L[i-1],R[i+1]));
	}
	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: 1408
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll dp[2001][2001];
ll MOD=1e+9+7;
int main(){
	int N,M;
	int S[10001],T[10001];
	scan(N>>M);
	rep(i,N){
		scan(S[i]);
	}
	rep(i,M){
		scan(T[i]);
	}
	rep(x,N+1) dp[x][0]=1;
	rep(y,M+1) dp[0][y]=1;
	rep1(x,N){
		rep1(y,M){
			if(S[x-1]==T[y-1]){
				dp[x][y]=dp[x-1][y-1];
			}
			else dp[x][y]=0;
			dp[x][y]+=(dp[x-1][y]+dp[x][y-1]-dp[x-1][y-1]+MOD)%MOD;
			dp[x][y]%=MOD;
			//printf("x:%d y:%d dp:%lld\n",x,y,dp[x][y]);
		}
	}
	prin(dp[N][M]);
	return 0;
}


Measured memory_bytes: 31488
[x,y]=[int(i) for i in input().split(" ")]

d=[y-x]
c={-1:1,1:0}
for i in [-1,1]:
 for j in [-1,1]:
   d.append(y*i-x*j+c[i]+c[j])
c=min(i for i in d if i>0)
print(c)

Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define lowbit(x) (x)&(-x)
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=a;i>=b;i--)
#define maxd 1000000007
typedef long long ll;
const int N=100000;
const double pi=acos(-1.0);
int n,cnt1=0,cnt2=0;
char s[10010];

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

int main()
{
	n=read();
	scanf("%s",s);
	rep(i,0,n-1)
	{
		if (s[i]=='R') cnt1++;else cnt2++;
	}
	if (cnt1>cnt2) cout << "Yes"; else cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long;
#define dbg(x) cout<<#x<<"--------------"<<x<<endl;
#define dl cout<<"LINE"<<__LINE__<<endl;
using namespace std;
int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	long long N,ans=0;
	cin>>N;
	for(int i=1;i<=N;i++){
		if(i%3!=0&&i%5!=0)ans+=i;
	}
	cout<<ans<<endl;
	
	
		
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,d;
ll x[30],y[30];
vector<pair<ll,ll>> s[2];
void dfs(int id,int now,int end,ll a,ll b){//半分全列挙
	if(now==end){
		s[id].push_back(make_pair(a,b));
		return;
	}
	dfs(id,now+1,end,a+x[now],b+y[now]);
	dfs(id,now+1,end,a-x[now],b-y[now]);
	dfs(id,now+1,end,a,b);
}

int main(){
	cin>>n>>d;
	for(int i=0;i<n;i++)	cin>>x[i]>>y[i];
	dfs(0,0,n/2,0,0);	dfs(1,n/2,n,0,0);
	sort(s[0].begin(),s[0].end());	sort(s[1].begin(),s[1].end());
	//+はA君が盗った。-はB君が盗った
	ll ans=0;
	int cnt=0;
	deque<pair<ll,ll>> dq;
	for(int i=0;i<(int)s[0].size();i++){
		while(cnt<(int)s[1].size()&&s[1][cnt].first<=s[0][i].first+d){
			while(!dq.empty()&&dq.back().second>s[1][cnt].second)	dq.pop_back();	
			dq.push_back(s[1][cnt]);
			cnt++;
		}
		while(!dq.empty()&&dq.front().first<s[0][i].first-d)	dq.pop_front();
		if(!dq.empty())	ans=max(ans,s[0][i].second-dq.front().second);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 489100
import Data.Vector.Unboxed (Vector, (!))
import qualified Data.Vector.Unboxed as V

main = do
  [a,b,q] <- map read . words <$> getLine
  input   <- V.fromList . map read . lines <$> getContents :: IO (Vector Int)
  let
    (ss, left ) = V.splitAt a input
    (ts, left') = V.splitAt b left
    xs = V.toList left'
  putStr . unlines . map show $ solve ss ts xs

solve ss ts = map (inner ss ts)
  where
  inner ss ts x =
    minimum [ abs (p2 - p1) + abs (p1 - x)
            | (first, second) <- [(fst, snd), (snd, fst)]
            , let nx = ( nears x ss, nears x ts ); ps1 = first nx; ps2 = second nx
            , p1 <- [fst ps1, snd ps1], p2 <- [fst ps2, snd ps2] ]

nears x ps
  | x < V.head ps = (-10000000000,V.head ps)
  | x < V.last ps = ( ps!i, ps!(i+1) )
  | otherwise     = (V.last ps, 20000000000)
  where i = borderl (<=x) ps

borderl f v = inner 0 (V.length v - 1)
  where
  inner i j
    | i == j    = i
    | otherwise = if f (v!m) then inner m j else inner i (m-1)
    where m = div (i+j+1) 2


Measured memory_bytes: 14588
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

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

  ll N;
  std::cin >> N;
  std::vector< std::string > vs(N, "");
  for (ll i = 0; i < N; i++) {
    std::cin >> vs[i];
  }

  std::string judge = "Yes";
  std::map< std::string, ll > mcnt;
  for (auto s : vs) {
    mcnt[s]++;
    if (mcnt[s] > 1) judge = "No";
  }

  char e = vs[0][vs[0].size()-1];
  for (ll i = 1; i < N; i++) {
    char s = vs[i][0];
    if (e != s) {
      judge = "No";
    }
    e = vs[i][vs[i].size()-1];
  }

  std::cout << judge << std::endl;
  return 0;
}


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

int main()
{
    ll n,i;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll dp[n]={0};
    dp[0]=0;
    for(i=1;i<n;i++)
    {
        if(i>1)
        {
          dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
        }
        else
        {
          dp[i]=abs(a[i]-a[i-1])+dp[i-1];
        }
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n, h;
    cin >> n >> h;
    int maxi = 0;
    int ith = -1;
    vii d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i].first >> d[i].second;
        if(maxi < d[i].first){
            maxi = d[i].first;
            ith = i;
        }
    }
    vi mx;
    mx.push_back(d[ith].second);
    for (int i = 0; i < n; i++) {
        if(i != ith && d[i].second > maxi)
            mx.push_back(d[i].second);
    }
    sort(mx.begin() , mx.end() , greater<int>() );
    for(int i = 1 ; i < mx.size() ; i++){
        mx[i] += mx[i-1];
    }
    auto it = lower_bound(mx.begin() , mx.end() , h);
    if(it != mx.end()){
        cout<<(it - mx.begin()) + 1;
    }else {
        int attacks = mx.size();
        h -= mx[mx.size() - 1];
        attacks += h / maxi + (h % maxi == 0 ? 0 : 1);
        cout<<attacks<<endl;
    }

}


int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 2936
/*Bismillahir Rahmanir Rahim.*/
#include <stdio.h>
#include<string.h>
int main()
{
    int a;
    scanf("%d",&a);
    if(a==0)
    {
        printf("1\n");
    }
    else
    {
        printf("0\n");
    }
    return 0;
}


Measured memory_bytes: 1644
defmodule Main do
  def main do
    [_n, d] = IO.gets("")
             |> String.trim()
             |> String.split()
             |> Enum.map(&String.to_integer/1)

    input()
    |> Enum.reduce(0, fn [x, y], acc -> dist(x, y) |> calc(d) |> Kernel.+(acc) end)
    |> IO.puts()
  end

  def input do
    IO.read(:all)
    |> String.split()
    |> Stream.map(&String.to_integer/1)
    |> Stream.chunk_every(2)
  end

  defguard eval(dist, d) when dist <= d

  def dist(x, y) do
    :math.sqrt(x*x+y*y)
  end

  def calc(dist, d) when eval(dist, d), do: 1
  def calc(_, _), do: 0
end


Measured memory_bytes: 98300
#include "bits/stdc++.h"
using namespace std;

#define fi first
#define se second
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()

using LL = long long;
using LD = long double;
using pii = pair<int, int>;
using vii = vector<pii>;

const int INF = 1e18;
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;

int32_t main() {
    //ios::sync_with_stdio(false); cin.tie(nullptr);

	int a, p;
	cin >> a >> p;
	cout << (a * 3 + p) / 2 << "\n";

    return 0;
}


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

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

    double sum = 0;
    for (int i = 0; i < n; ++i) {
        double x; string u;
        cin >> x >> u;
        if (u == "BTC") x = x * 380000.0;
        sum += x;
    }

    cout << sum;

    return 0;
}


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

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	int cnt = 0;
	for(int i = 0; i < s.size() - 1; ++i) {
		if( (s[i] == 'B' && s[i + 1] == 'W') || (s[i] == 'W' && s[i + 1] == 'B') ) cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 664
n = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
t.sort( )

cnt = 0
for ti in t:
	low = 0
	high = n - 1
	while low <= high:
		m = ( low+high )//2
		if ti < s[m]:
			high = m - 1
		elif s[m] < ti:
			low = m + 1
		else:
			cnt += 1
			break

print( cnt )

Measured memory_bytes: 13160
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

ll l, r, d;

int main() {
  cin >> l >> r >> d;
  cout << r / d - (l - 1) / d << endl;
}

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

using namespace std;


void solve() {
    int n; cin >> n;
    vector<int> out(n);
    for (int i = 1; i < n; i++) {
        int x; cin >> x;
        --x;
        out[x]++;
    }
    for (auto& x: out) {
        cout << x << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3992
H,W,N = map(int,input().split())
sr, sc = map(int,input().split())
S = input()
T = input()
L = sc-1
R = W-sc
U = sr-1
D = H-sr
for s, t in zip(S,T):
    if s == 'L':
        L -= 1
    elif s == 'R':
        R -= 1
    elif s == 'U':
        U -= 1
    elif s == 'D':
        D -= 1
    if min(L,R,U,D) < 0:
        print('NO')
        quit()
    if t == 'L' and R < W-1:
        R += 1
    elif t == 'R' and L < W-1:
        L += 1
    elif t == 'U' and D < H-1:
        D += 1
    elif t == 'D' and U < H-1:
        U += 1
print('YES')

Measured memory_bytes: 3768
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll (i) = 0; (i) < (n); (i)++)
#define REPI(i, a, b) for (ll (i) = (a); (i) < (b); (i)++)
#define int long long
using namespace std;
using P = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;

int N, M;
string s;
VVI edge;

VI visited;
VI reach;

void dfs1(int v) {
  if (visited[v]) { return; }
  visited[v] = 1;
  int a = 0; int b = 0;
  for (int vv: edge[v]) {
    if (!reach[vv]) { continue; }
    if (s[vv] == 'A') { a = 1; }
    if (s[vv] == 'B') { b = 1; }
    dfs1(vv);
  }
  if (!a || !b) {
    reach[v] = 0;
    for (int vv: edge[v]) {
      if (!reach[vv]) { continue; }
      visited[vv] = 0;
      dfs1(vv);
    }
  }
}
// bool dfs2(int v) {
//   if (visited[v]) { return false; }
//   visited[v] = 1;
//   for (int vv: edge[v]) {
//     if ((reach[v] == 1 && reach[vv] == -1) || (reach[v] == -1 && reach[vv] == 1)) {
//       return true;
//     }
//     if (dfs2(vv)) { return true; }
//   }
//   return false;
// }
signed main() {
  cin >> N >> M >> s;
  edge = VVI(N);
  REP (i, M) {
    int a, b;
    cin >> a >> b; a--; b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  visited = VI(N, 0);
  reach = VI(N, 1);
  REP (i, N) {
    if (!visited[i]) { dfs1(i); }
  }
  REP (i, N) {
    if (reach[i]) {
      cout << "Yes" << endl; return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 198400
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

int euq(int a, int b) {return b ? euq(b, a%b) : a;}

const int MOD = 1000000007;


int mmul(int a, int b) {
    return ((a%MOD)*(b%MOD))%MOD;
}

int mpow(int a, int b) {
    int res = 1;
    while(b) {
        if(b & 1) res = (res*a) % MOD;
        b >>= 1;
        a = (a*a) % MOD;
    }
    return res;
}

int mdiv(int a, int b) {
    return (a * mpow(b, MOD-2)) % MOD;
}

map<int, int> mxp;

void soinsu(int n) {
    int d = 2;
    while(d*d <= n) {
        if(n%d) {
            d++;
            continue;
        }
        int cnt = 0;
        while(n%d==0) {
            cnt++;
            n /= d;
        }
        mxp[d] = max(mxp[d], cnt);
        d++;
    }
    if(n > 1) mxp[n] = max(mxp[n], 1);
}


signed main() {  
    int n;
    cin >> n;
    vi a(n);

    rep(i, n) {
        cin >> a[i];
        soinsu(a[i]);
    }

    int lc = 1;
    for(auto &p : mxp) {
        lc = mmul(lc, mpow(p.fi, p.se));
    }

    int res = 0;
    rep(i, n) {
        res = ((res%MOD) + (mdiv(lc, a[i])))%MOD;
    }
    
    cout << res << endl;

    return 0;
}

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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    int n , m , c;

    cin >> n >> m >> c;

    int a[m+1];




    for(int i=0; i<m; i++)
        cin >> a[i];


    int count = 0;

    for(int i=0; i<n; i++)
    {

        int  sum = 0;

        for(int j=0; j<m; j++)
        {

            int b;
            cin >> b;
            //sum += b;
            sum += (a[j]*b);
        }

        if((sum+c)>0)
        {
            count++;
        }
    }


    cout << count << endl;





    return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# モジュールのインポート
import math


def get_input() -> tuple:
    """
    標準入力の取得.

    Returns:\n
        tuple: 標準入力
    """
    A, B, H, M = list(map(int, input().split()))

    return A, B, H, M


def main(A: int, B: int, H: int, M: int) -> None:
    """
    求解処理.

    Args:
        A (int): 時針の長さ（1 <= A <= 1000）
        B (int): 分針の長さ（1 <= B <= 1000）
        H (int): 何時（0 <= H <= 11）
        M (int): 何分（0 <= M <= 59）
    """
    """
    余弦定理により、距離を求める.
    """
    PI = math.pi
    angle_A = PI * H / 6 + PI * M / 360
    angle_B = PI * M / 30
    angle = max(angle_A, angle_B) - min(angle_A, angle_B)
    result = math.sqrt(A**2 + B**2 - 2*A*B*math.cos(angle))

    # 結果出力
    print(result)


if __name__ == "__main__":
    A, B, H, M = get_input()
    main(A, B, H, M)


Measured memory_bytes: 9484
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <string>
#include <stack> // s.top()
#include <bitset>
#include <queue> // s.front()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


ll N;

int main() {
	cin >> N;
	ll A, B;
	ll tmp;
	for (int i = sqrt(N) + 1; i >= 1; i--) {
		if (N%i == 0) {
			tmp = i;
			break;
		}
	}
	A = tmp; B = N / tmp;
	int a_cnt=0, b_cnt=0;
	while (A > 0) {
		A /= 10;
		a_cnt++;
	}
	while (B > 0) {
		B /= 10;
		b_cnt++;
	}
	cout << max(a_cnt, b_cnt) << endl;







	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, M;
  while(cin>>N>>M,N||M) {
    vector<ll> P(N+1);
    FOR(i,0,N) cin >> P[i];
    P[N] = 0;
    // ????????¨??????
    vector<ll> v1;
    FOR(i,0,N+1) {
      FOR(j,0,N+1) {
        v1.push_back(P[i] + P[j]);
      }
    }
    sort(v1.begin(), v1.end());
    ll ans = 0;
    FOR(i,0,N+1) {
      FOR(j,0,N+1) {
        int a = lower_bound(v1.begin(), v1.end(), M - P[i] - P[j]) - v1.begin();
        FOR(k,-1,2) {
          if(a + k >= 0 && a + k < (N + 1) * (N + 1) && P[i] + P[j] + v1[a + k] <= M) {
            ans = max(ans, P[i] + P[j] + v1[a + k]);
          }
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 18956
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
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;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int main(void){
    ll n, K;
    cin >> n >> K;
    vector<ll> x(n);
    vector<ll> y(n);
    vector<pair<ll,ll>> vec(n);

    rep(i, n){
        cin >> x[i] >> y[i];
        vec[i] = {x[i], y[i]};
    }

    sort(all(x));
    sort(all(y));
    ll ans = INF;
    for(int x1 = 0; x1 < n; x1++){
        for(int x2 = x1 + 1; x2 < n; x2++){
            for(int y1 = 0; y1 < n; y1++){
                for(int y2 = y1 + 1; y2 < n; y2++){
                    int cnt = 0;
                    for(int i = 0; i < n; i++){
                        if(vec[i].first >= x[x1] && vec[i].first <= x[x2]){
                            if(vec[i].second >= y[y1] && vec[i].second <= y[y2]){
                                cnt++;
                            }
                        }
                    }

                    if(cnt >= K){
                        ans = min(ans, abs(x[x1] - x[x2]) * abs(y[y1] - y[y2]));
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

typedef long long ll;
typedef unsigned long long ull;

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

int main(){
    ll N,X;
    cin >> N >> X;

    ll Xs[100001];
    Xs[0]=X;
    ll mn=X;
    for(int i=1;i<=N;i++){
        cin >> Xs[i];
        mn=min(mn,Xs[i]);
    }
    ll ans=Xs[0]-mn;
    for(int i=1;i<=N;i++){
        if(ans<=0) ans=Xs[i]-mn;
        else if(Xs[i]-mn>0) ans=gcd(ans,Xs[i]-mn);
    }

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

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<ll> &s, ll a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;


int main() {

    map<ll, int> m;
    int n;
    cin >> n;
    rep(i, n) {
        ll a;
        cin >> a;
        m[a]++;
    }

    ll ans = 0;
    for (auto e : m) {
        if (e.first == e.second) continue;
        if (e.first < e.second) ans += e.second - e.first;
        if (e.first > e.second) ans += e.second;
    }
    cout << ans << endl;
}



Measured memory_bytes: 6272
#include <string>
#include <iostream>
using namespace std;
int main() {
	string str;
	cin >> str;
	for (char c : str) {
		if (c == '1') {
			cout << '9';
		}
		else {
			cout << '1';
		}
	}
	cout << endl;
	return 0;
}

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

int main() {
    int64_t h, n;
    cin >> h >> n;

    vector<int64_t> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];

    vector<int64_t> dp(h + 1, 1e9);
    dp[0] = 0;
    for(int i = 1; i <= h; i++) {
        for(int j = 0; j < n; j++) {
            if(i - a[j] >= 0) {
                dp[i] = min(dp[i], dp[i - a[j]] + b[j]);
            } else {
                dp[i] = min(dp[i], b[j]);
            }
        }
    }

    cout << dp[h] << endl;
    return 0;
}

Measured memory_bytes: 384
k, s = map(int, input().split())

def count(k, s):
	x = 0
	res = 0
	for x in range(k+1):
		s_ = s - x
		if s_ < 0:
			return res
		for y in range(k+1):
			s__ = s_ - y
			if 0<= s__ <= k:
				res += 1
	return res

print(count(k, s))

Measured memory_bytes: 3064
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

k = I()
s = S()
if(len(s) <= k):
    print(s)
else:
    ss = s[0:k] + "..."
    print(ss)

Measured memory_bytes: 9192
#include<stdio.h>
int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0)break;
    for(i=0;i<H;i++){
      for(j=0;j<W;j++){
	    printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2112
#include <stdio.h>

int main()
{
	int a,b,c,d,e,f;
	while(scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f)!=EOF){
	
	double x = (double)(c*e-b*f)/(a*e-b*d);
	double y = (double)(c*d-f*a)/(b*d-a*e);
	
	
    if(x == -0.000){
      x = 0.000;
    }
    if(y == -0.000){
      y = 0.000;
    }
	
	printf("%.3lf %.3lf\n",x,y);
	
	}
	
	return 0;
}

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

int main() {
    ll N;
    cin >> N;
    vector<ll> a(N - 1), b(N - 1);
    rep(i, N - 1) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    };
    vector<unordered_set<ll>> used(N);
    vector<set<ll>> edge(N);
    ll mx = 0;
    map<pair<ll, ll>, ll> ans;
    rep(i, N - 1) { edge[a[i]].insert(b[i]); }
    rep(i, N) {
        ll k = 1;
        for (ll e : edge[i]) {
            while (1) {
                if (used[i].count(k) == 0) {
                    used[i].insert(k);
                    used[e].insert(k);
                    ans[make_pair(ll(i), e)] = k;
                    mx = max(k, mx);
                    k++;
                    break;
                }
                k++;
            }
        }
    }
    cout << mx << "\n";
    rep(i, N - 1) { cout << ans[make_pair(a[i], b[i])] << "\n"; }
    cout << flush;
    return 0;
}


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

int main() {
    int a,b;
    cin >> a >> b;
    int ans = 0;
    rep(i,2) {
        if(a >= b) {
            ans += a;
            a--;
        } else {
            ans += b;
            b--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;

int main()
{
	string s,t;
	cin>>s>>t;
	cout<<t+s<<endl;
}


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

int main(){
    int n,m,c;
    cin >> n >> m >> c;
    int b[m];
    for(int i=0;i<m;i++) cin >> b[i];
    int ans = 0;
    for(int i=0;i<n;i++){
        int a = 0,sum = 0;
        for(int j=0;j<m;j++){
            cin >> a;
            sum += a*b[j];
        }
        if(sum+c > 0){
            ans++;
        }
    }
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n,m;
	cin>>n>>m;

	vector<vector<lli>> v(n);

	REP(i,0,m){
		lli a,b;
		cin>>a>>b;
		a--,b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	deque<lli> d;
	bool visited[100000]={};
	for(lli i=0;i<n;i++){
		if(!v[i].empty()){
			d.push_back(i);
			visited[i]=true;
			break;
		}
	}
	while(true){
		bool update=false;
		lli a = d.back();
		for(lli i=0;i<v[a].size();i++){
			lli b=v[a][i];
			if(!visited[b]){
				d.push_back(b);
				visited[b]=true;
				update=true;
				break;
			}
		}
		if(!update)break;
	}
	while(true){
		bool update=false;
		lli a = d.front();
		for(lli i=0;i<v[a].size();i++){
			lli b=v[a][i];
			if(!visited[b]){
				d.push_front(b);
				visited[b]=true;
				update=true;
				break;
			}
		}
		if(!update)break;
	}
	cout<<d.size()<<endl;
	for(auto e:d){
		cout<<e+1<<" ";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 7168
#include <stdio.h>

int main() {
	
	long long int i = 0, count = 0, N, A, B, C, D, E, max = 0;
	long long int n = 0, a = 0, b = 0, c = 0, d = 0, e = 0;

	scanf("%lld %lld %lld %lld %lld %lld", &N, &A, &B, &C, &D, &E);

	if ((N - 1) / A > max) max = (N - 1) / A;
	if ((N - 1) / B > max) max = (N - 1) / B;
	if ((N - 1) / C > max) max = (N - 1) / C;
	if ((N - 1) / D > max) max = (N - 1) / D;
	if ((N - 1) / E > max) max = (N - 1) / E;
	
	printf("%lld\n", max + 5);
  
  	return 0;
}

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

int main()
{
    std::vector<std::pair<int, int>> DISH;
    int ans = 0;
    int d;
    for (int i = 0; i < 5; i++) {
        std::cin >> d;
        int w = (d%10==0)?0:10-(d%10);
        DISH.push_back(std::make_pair(w, d));
    }

    std::sort(std::begin(DISH), std::end(DISH));

    for (int i = 0; i < 5; i++) {
        ans += DISH[i].second;
        if (i != 4) {
            ans += DISH[i].first;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 256
var
	f:array[-1100..1100000] of boolean;
	s,i:longint;
begin
	read(s);
	i:=1;
	fillchar(f,sizeof(f),false);
	while f[s]=false do
	begin
		f[s]:=true;
		inc(i);
		if s mod 2=0 then s:=s div 2
		else s:=s*3+1;
	end;
	writeln(i);
end.

Measured memory_bytes: 1152
//#include<bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>
#include <utility>
#include <cstring>
using namespace std;
#define ll long long
#define clr(a,b) memset(a,b,sizeof(a))
long long power(ll n, ll k){
    if(k==0) return 1;
    ll sq=(power(n,k/2));
    sq=(sq*sq);
    if(k%2==1)
        sq=(sq*n);
    return sq;
}
ll nCr(ll n, ll r) {
    if(r > n - r) r = n - r;
    ll ans = 1;
    for(int i = 1; i <= r; i++)
        ans *= (n - r + i)/i;
    return ans;
}
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
// int dx[]={1,-1,0,0,1,-1,1,-1};
// int dy[]={0,0,1,-1,1,1,-1,-1};
// freopen("input.txt" ,"r",stdin );
// freopen("output.txt","w",stdout);
ll arr[100000+5];
ll dp[100000+5];
ll n,k;
ll maxSum(int i){
    if(dp[i]!=-1) return dp[i];
    ll mn=1e18;
    for(int j=i+1;j<=i+k && j<n;j++){
        mn=min(mn,maxSum(j)+abs(arr[j]-arr[i]));
    }
    if(mn==1e18) return 0;

    return dp[i]=mn;
}
int main()
{
    fast();
    cin>>n>>k;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++) cin>>arr[i];
    cout<<maxSum(0);
    return 0;
}
/// Big Integer Library Implementation



Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		if(s.indexOf("C") != -1 && s.indexOf("C") < s.lastIndexOf("F")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21972
#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main() {
  int n;
  long long a, b;
  scanf("%d %lld %lld", &n, &a, &b);
  vector<long long> x(n);
  for (int i = 0; i < n; ++i) scanf("%lld", &x[i]);

  long long ans = 0;
  for (int i = 1; i < n; ++i) {
    ans += min(a * (x[i] - x[i - 1]), b);
  }

  printf("%lld\n", ans);
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
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 long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);

int main(){
    string n;
    int ans=5;

    cin >>n;
    if(n[2]!=n[3]){
        ans=0;
    }
    if (n[4] != n[5])
    {
        ans = 0;
    }
    cout<<solve(ans)<<endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
MOD = pow(10,9)+7
if n < k:print(0)
else:
    n = n-k
    dp = [[0]*(n+1) for _ in range(k+1)]
    dp[0][0] = 1
    for i in range(1,k+1):
        for j in range(n+1):
            if j-i >= 0:
                dp[i][j] = (dp[i-1][j] + dp[i][j-i]) % MOD
            else:
                dp[i][j] = dp[i-1][j]
    print(dp[k][n])


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

int main() {
  int a,b;
  cin>>a>>b;
  cout<<max({a+b,a-b,a*b})<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main (void){
  int a[10000];
  int i = 0;

  while(1){
    scanf("%d", &a[i]);
    if(a[i] == 0) {
      break;
    }
    i++;
  }

  for(i = 0; a[i] != 0; i++){
    printf("Case %d: %d\n", i + 1, a[i]);
  }

  return 0;
}

Measured memory_bytes: 1768
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=998244353;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s; 
    int cnt=0,bcnt=0;
    rep(i,n) {
        bool flag=0;
        if (s[i]=='a') {
            if (cnt<a+b) {
                flag=1;
                ++cnt;
            }
        } else if (s[i]=='b') {
            if (cnt<a+b && bcnt<b) {
                flag=1;
                ++cnt;
                ++bcnt;
            }
        }
        if (flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
     
    return 0;   
}

Measured memory_bytes: 3704