akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(ll i=a;i<=b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define N 101000
#define ll long long
using namespace std;
ll sum,n,a[N],g1[N],g2[N];
ll gcd(ll x,ll y)
{
	if(x==-1||y==-1) return -x*y;
	return y==0?x:gcd(y,x%y);
}
ll dg(ll x)
{
	g1[1]=a[1];g2[n]=a[n];
	g1[0]=g2[n+1]=-1;
	fo(i,2,n) g1[i]=gcd(g1[i-1],a[i]);
	fd(i,n-1,1) g2[i]=gcd(g2[i+1],a[i]);
	ll gd=-1,k=0;
	fo(i,1,n)
	if(a[i]!=1)
	{
		gd=gcd(gcd(a[i]-1,g1[i-1]),g2[i+1]);
		k=i;
		if(((sum-1)/gd)%2==1) break;
		gd=-1;
	}
	if(gd!=-1)
	{
		fo(i,1,n) if(i!=k) a[i]=a[i]/gd;
		a[k]=(a[k]-1)/gd;
		sum=(sum-1)/(ll)gd;
		return 1-dg(x^1);
	}
	return 0;
}
int main()
{
	scanf("%lld",&n);
	fo(i,1,n) scanf("%lld",&a[i]),sum+=(ll)a[i];
	if(n%2==0)
	{
		if(sum%2==1) printf("First\n");
		else printf("Second\n");
		return 0;
	}
	if(sum%2==0) return printf("First\n"),0;
	if(dg(1)==1) printf("First\n");
	else printf("Second\n");
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b){ll res=1;a=a%mod; while(b){if(b&1)res=(res*a)%mod; a=(a*a)%mod;b/=2;}return res;}
ll invmod(ll a){return power(a,mod-2);}
int main(void)
{
	FIO	
	int n,m;
	cin>>n>>m;
	vector<int> arr(m);
	for(auto &j : arr) cin>>j;
	ll tot=0;
	for(auto j : arr) tot+=j;
	if(tot>n) cout<<"-1"<<"\n";
	else cout<<n-tot<<"\n";

	return 0;
}

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

int main(){
    int w,h,n;
    cin>>w>>h>>n;
    bool squ[w][h];
    bool xx[w],yy[h];
    for(int i=0;i<w;i++){
        xx[i]=false;
    }
    for(int i=0;i<h;i++){
        yy[i]=false;
    }
    int x=0,y=0;
    int tempx,tempy,tempa;
    for(int i=0;i<n;i++){
        cin >> tempx>>tempy>>tempa;
        if(tempa==1){
            for(int j=0;j<tempx;j++){
                if(xx[j]==false)x++;
                xx[j]=true;
            }
        }
        else if(tempa==2){
            for(int j=w;j>=tempx;j--){
                if(xx[j]==false)x++;
                xx[j]=true;
            }
        }
        else if(tempa==3){
            for(int j=0;j<tempy;j++){
                if(yy[j]==false)y++;
                yy[j]=true;
            }
        }
        else if(tempa==4){
            for(int j=h;j>=tempy;j--){
                if(yy[j]==false)y++;
                yy[j]=true;
            }
        }
    }
    x=0;y=0;
    for(int i=0;i<w;i++)
    if(xx[i]==false)x++;
    for(int i=0;i<h;i++)
    if(yy[i]==false)y++;
    int ans=x*y;
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>a>>b>>c;
  for(int i=1;i<=10;i++){
    c=a*c-b;
    cout<<c<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int main() {
	int x, y;
	cin >> x >> y;
	ll ans = inf;
	ll tmp1 = y - x;
	ll tmp2 = y - (-x) + 1;
	ll tmp3 = -y - x + 1;
	ll tmp4 = -y - (-x) + 2;
	if (y >= x) ans = min(tmp1, ans);
	if (y >= (-x)) ans = min(tmp2, ans);
	if (-y >= x) ans = min(tmp3, ans);
	if (-y >= (-x)) ans = min(tmp4, ans);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
typedef double db;
#define INF 1e8
#define EPS 1e-9
#define ALL(x) x.begin() , x.end()
#define ALLR(x) x.rbegin() , x.rend()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())
#define PI acos(-1.0) 
 
 
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  
  ll n,x;
  cin>>n;
  ll sec=n;
  n=(1<<n);
  vl c,d;
  multiset<ll> slimes;
  bool o=1;
  for(ll i=0;i<n;i++)
  {
    cin>>x;
    slimes.insert(x);
  }
  c.push_back(*slimes.rbegin());
  slimes.erase(prev(slimes.end()));
  multiset<ll>::iterator it;
  for (int s=0;s<sec;s++)
  {
    //cout<<c.size()<<endl;
    ll prevs=c.size();
    for(int i=0;i<prevs;i++)
    {
        
        it=slimes.lower_bound(c[i]);
        if(it==slimes.begin())
        {
            o=0;
            break;
        }
        c.push_back(*prev(it));
        //cout<<c[i]<<" "<<*prev(it)<<endl;
        slimes.erase(prev(it));
        
    }
    if(!o)break;
 
  }
  
  if(o)cout<<"Yes\n";
  else cout<<"No\n";
}

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

using namespace std;

const int mod = 2019;

int l, r;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> l >> r;
    int ans = mod * mod;
    if (r - l > mod + 5) {
        cout << 0 << endl;
        return 0;
    }
    for (int i = l; i < r; ++i) {
        for (int j = i + 1; j <= r; ++j) {
            ans = min(1LL * ans, (1LL * i * j) % mod);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
  ll N, A, B;
  cin >> N >> A >> B;
  
  ll c = N / (A+B);
  ll d = N % (A+B);
  if (d >= A) {
    cout << (A * c + A) << endl;
  } else {
    cout << (A * c + d) << endl;
  }

  return 0;
}

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

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double res;
    if(x > a*a*b/2){
        res = 180/M_PI*atan(2*(a*a*b-x)/(a*a*a));
    }
    else{
        res = 180/M_PI*atan(a*b*b/(2*x));
    }
    cout << setprecision(9) << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 101
using namespace std;
const int INF = 1LL<<55;
int n,d;
vector<int> A[N];
int Sum[N];

int getMax(){return *max_element(Sum,Sum+n);}
int getMin(){return *min_element(Sum,Sum+n);}

int getIdx(){
  int sa = INF;
  int res  = -1;
  for(int i=0;i<n;i++){
    if(A[i].empty()) continue;
    int sum = Sum[i] + A[i].back();
    Sum[i]+=A[i].back();
    int mn = getMin();
    Sum[i]-=A[i].back();
    if(sum - mn > d)continue;
    if(sum - mn < sa) sa = sum - mn, res = i;
  }
  return res;
}

bool clear(){
  for(int i=0;i<n;i++) if(A[i].size())return 0;
  return 1;
}

bool solve(){
  memset(Sum,0,sizeof(Sum));
  while(!clear()){
    int idx = getIdx();
    if(idx == -1) return 0;
    Sum[idx] += A[idx].back(); A[idx].pop_back();
  }
  return 1;
}

signed main(){
  while(1){
    cin>>n>>d;
    if(!n && !d) break;

    for(int i=0;i<n;i++){
      int k;
      cin>>k;
      A[i].resize(k);
      for(int j=0;j<k;j++)cin>>A[i][j];
      reverse(A[i].begin(),A[i].end());
    }
    cout<<(solve()?"Yes":"No")<<endl;
  }

  return 0;
}

Measured memory_bytes: 3156
#include <stdio.h>
int main(void){
	int minute1,second1,hour1;
	while(scanf("%d %d %d",&hour1,&minute1,&second1)){
		int hour2,minute2,second2,sum1,sum2;
		if(hour1==-1 && minute1==-1 && second1==-1) break;
		sum1=hour1*3600+minute1*60+second1;	//secondに変換
		sum1=7200-sum1;
		sum2=3*sum1;
		hour1=sum1/3600;
		hour2=sum2/3600;
		sum1%=3600;
		sum2%=3600;
		minute1=sum1/60;
		minute2=sum2/60;
		sum1%=60;
		sum2%=60;
		second1=sum1;
		second2=sum2;
		printf("%02d:%02d:%02d\n",hour1,minute1,second1);
		printf("%02d:%02d:%02d\n",hour2,minute2,second2);
	}
	return 0;
}

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

#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll,ll> Pll;
typedef vector<ll> vll;
const ll INF = LLONG_MAX/10;
const ll MOD = 1e6+3;


template <ll mod>
struct ModCombination{
    ll N;
    vector<ll> fact,inv,finv;

    ModCombination(ll n):N(n){
        fact.assign(n+1, 1);
        inv.assign(n+1, 1);
        finv.assign(n+1,1);
        for(int i=1;i<n;i++){
            fact[i+1] = fact[i]*(i+1)%mod;
            inv[i+1] = inv[mod%(i+1)]*(mod-mod/(i+1))%mod;
            finv[i+1] = finv[i]*inv[i+1]%mod;
        }
    }

    ll Comb(ll n,ll k){
        if(k<0||n<k)return 0;
        return (fact[n]*finv[k]%mod)*finv[n-k]%mod;
    }
};

ll mod_pow(ll x,ll e){
  return e? e&1? x*mod_pow(x,e-1)%MOD:mod_pow(x*x%MOD,e/2):1;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ModCombination<MOD> c(MOD-1);
  ll Q;cin>>Q;
  for(ll q=0;q<Q;q++){
    ll x,d,n;cin>>x>>d>>n;
    if(!x){
      cout<<0<<endl;
      continue;
    }
    if(!d){
      cout<<mod_pow(x,n)<<endl;
      continue;
    }
    ll e=x*mod_pow(d,MOD-2)%MOD;
    cout<<((e+n-1)>=MOD?0:mod_pow(d,n)*c.fact[e+n-1]%MOD*c.finv[e-1]%MOD)<<endl;
  }
  return 0;
}


Measured memory_bytes: 24320
//containing t test cases
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define mkp make_pair
#define fi first
#define se second
#define ll long long
#define scan(n) ll a[n]; for(ll i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define pi 3.1415926535897932384626433832795028841971
//#define int long long
using namespace std;
//typedef vector<int>vi ;
typedef vector<ll>vi ;
typedef vector<vector<ll> >vvl ; 
typedef pair<ll,ll> pll ;
typedef vector<pair<ll,ll> > vpll;
//cout<<fixed<<setprecision(15);
/*vi adj[200005];
ll vis[200005];
ll parent[200005];
ll level[200005];
ll arr[200005];
ll size[200005];*/
//endl mut bhool!!
void solve()
{
    /*ll a;
    double b;
    cin>>a>>b;
    ll x=(ll)b;
    if(x==b)
    {
    	ll a1=a*b;
    	cout<<a1<<endl;
	}
    //cout<<"x"<<x<<endl;
    double y=b-(double)x;
   // cout<<"y"<<y<<endl;
    ll prod=a*x;
  //  cout<<"prod"<<prod<<endl;
    long double frac=(double)a*y;
  //  cout<<"frac"<<frac<<endl;
    ll f=(ll)frac;
  //  cout<<"f"<<f<<endl;
    ll ans=prod+f;
    cout<<ans;*/
    long double a,b;
    cin>>a>>b;
    long double ans=a*b;
    ll a1=floor((long double)ans);
    cout<<a1;
}
int main()
{
    fast;
    ll test=1;
    //cin>>test;
    while(test--)
    {
        solve();
    }
    return 0;
}
/*
cout<<"YES"<<endl;
cout<<"NO"<<endl;
*/


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

using ll = long long;

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)

using namespace std;

//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);
 

void solve() {
    int a, b, c;
    cin >> a >> b >> c;
    if(a == b){
        cout << c << endl;
    }
    else if(a == c){
        cout << b << endl;
    }
    else{
        cout << a << endl;
    }
}
 
int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_N 114514
#define ll long long int
using namespace std;
ll bit[MAX_N+2];
ll n;
ll a[MAX_N];
ll A[MAX_N];
ll N;
void init(ll n_){
    n=n_;
    for(ll i=0;i<n+1;i++){
        bit[i]=0;
    }

}
ll sum(ll i){
    ll s=0;
    while(i>0){
        s+=bit[i];
        i-=i&-i;
    }
    return s;
}
void add(ll i,ll x){
    while(i<=n){
        bit[i]+=x;
        i += i & -i;
    }
}
ll invnum(vector<ll> t){
    n=t.size();
    init(n);
    ll ans=0;
    for(ll j=0;j<n;j++){
        ans+=j-sum(t[j]);
        add(t[j],1);
    }
   return ans;
}

ll solve(ll x){
    vector<ll> S(N+1);
    vector<tuple<ll,ll>> U(N+1);
    S[0]=0;
    for(ll i=0;i<N;i++){
        if(A[i]<x){
            S[i+1]=S[i]-1;
        }
        else{
            S[i+1]=S[i]+1;   
        }
    }
    for(ll i=0;i<N+1;i++){
        U[i]=make_tuple(S[i],i+1);
    }
    sort(U.begin(),U.end());
    vector<ll> T(N+1);
    for(ll i=0;i<N+1;i++){
        T[i]=get<1>(U[i]);
    }
    return invnum(T);
}
int main(void){
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    
    ll low=1;
    ll high=A[0];
    for(ll i=1;i<N;i++){
        if (high<A[i]){
            high=A[i];
        }
    }
    high++;
    ll M=(N*(N+1))/2;
    while(high-low>1){
        ll mid=(low+high)/2;
        if (solve(mid)*2<=M){
            low=mid;
        }
        else{
            high=mid;
        }
    }
    cout<<low<<endl;
}


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

#define MAX 100000
#define SENTINEL 1200000000

struct Card { char suit; int value; };

Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void Merge(Card C[], int left, int mid, int right)
{
    int i, j, k, n1, n2;
    n1 = mid - left;
    n2 = right - mid;
    for(i = 0; i < n1; i++){ L[i] = C[i + left]; }
    for(j = 0; j < n2; j++){ R[j] = C[j + mid]; }

    L[n1].value = SENTINEL;
    R[n2].value = SENTINEL;
    i = j = 0;

    for(k = left; k < right; k++){

        if(L[i].value <= R[j].value){ C[k] = L[i]; i++; }

        else{ C[k] = R[j]; j++; }
    }
}

void MergeSort(Card C[], int left, int right)
{
    int mid;
    if(left + 1 < right){
        mid = (left + right) / 2;
        MergeSort(C, left, mid);
        MergeSort(C, mid, right);
        Merge(C, left, mid, right);
    }
    return;
}

int partition(Card C[], int p, int r)
{
    int i, j;
    Card x = C[r];
    i = p - 1;
    for(j = p; j < r; j++){
        if(C[j].value <= x.value){ 
           i++; 
           swap(C[i].suit, C[j].suit); 
           swap(C[i].value, C[j].value); }
    }
    swap(C[i + 1].suit, C[r].suit);
    swap(C[i + 1].value, C[r].value);

    return i + 1;
}

void quicksort(Card C[], int p, int r)
{
    if(!(p < r)) return;
    int q;
    q = partition(C, p, r);
    quicksort(C, p, q - 1);
    quicksort(C, q + 1, r);
}

bool is_stable(Card C1[], Card C2[], int n)
{
    int i = 0;
    while(i < n){ if(C1[i].suit != C2[i].suit){ return false; } i++; };
    return true;
}

int main()
{
    Card C[MAX], D[MAX];
    int i, n;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> C[i].suit >> C[i].value;
        D[i] = C[i];
    }
    quicksort(C, 0, n - 1);
    MergeSort(D, 0, n);

    if(is_stable(C, D, n)){ cout << "Stable"; }else{ cout << "Not stable"; }
    cout << endl;

    for(i = 0; i < n; i++){
        cout << C[i].suit << " " << C[i].value << endl;
    }

    return 0;
}

Measured memory_bytes: 3508
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://arc083.contest.atcoder.jp/tasks/arc083_a>
 問題文============================================================
 すぬけ君はビーカーに砂糖水を作ろうとしています。
 最初ビーカーは空です。すぬけ君は以下の 4 種類の操作をそれぞれ何回でも行うことができます。
 一度も行わない操作があっても構いません。
 
 操作 1: ビーカーに水を 100A [g] 入れる。
 操作 2: ビーカーに水を 100B [g] 入れる。
 操作 3: ビーカーに砂糖を C [g] 入れる。
 操作 4: ビーカーに砂糖を D [g] 入れる。
 すぬけ君の実験環境下では、水 100 [g] あたり砂糖は E [g] 溶けます。
 
 すぬけ君はできるだけ濃度の高い砂糖水を作りたいと考えています。
 
 ビーカーに入れられる物質の質量 (水の質量と砂糖の質量の合計) が F [g] 以下であり、
 ビーカーの中に砂糖を溶け残らせてはいけないとき、 すぬけ君が作る砂糖水の質量と、
 それに溶けている砂糖の質量を求めてください。 答えが複数ある場合はどれを答えても構いません。
 
 水 a [g] と砂糖 b [g] を混ぜた砂糖水の濃度は  100b/a+b  [%]です。
 また、この問題では、砂糖が全く溶けていない水も濃度 0 [%] の砂糖水と考えることにします。
 
 
 =================================================================
 
 解説=============================================================
 
 A,B,C,Dをそれぞれ何回選んだのかでdfsする。
 余分な遷移を防ぐために、その回数でメモ化しておく
 
 ================================================================
 */

double noudo = -1;
int ans = 0;
int ans2 = 0;
ll A,B,C,D,E,F;
bool f[33][33][103][103];
void dfs(int a,int b,int c,int d){
    if(f[a][b][c][d] == true) return;
    f[a][b][c][d] = true;
    ll AA = a*A,BB = b*B, CC = c*C, DD = d*D;
    if(100*AA + 100*BB + CC + DD > F) return;
    if(CC+DD <= E*(AA+BB)){
        if(a|b|c|d != 0){
            double satousui = 100*AA+100*BB+CC+DD;
            double satou = CC + DD;
            double t_noudo = 100*satou/satousui;
            if(t_noudo > noudo){
                noudo = t_noudo;
                ans = satousui;
                ans2 = satou;
            }
        }
    }
    
    dfs(a+1,b,c,d);
    dfs(a,b+1,c,d);
    dfs(a,b,c+1,d);
    dfs(a,b,c,d+1);
}

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> A >> B >> C >> D >> E >> F;
    dfs(0,0,0,0);
    cout << ans << " " << ans2 << endl;
    return 0;
}


Measured memory_bytes: 4608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <cmath>
#include <iomanip>
#include <functional>

#define MOD (1000000007)

using namespace std;

typedef long long ll;
typedef pair<ll, ll> tup;
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];


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


// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<ll,ll> prime;//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap

//O(√n)
//整列済み(mapはkeyで自動で整列される)
void prime_factorize(ll n){
    if(n<=1) return;
    ll l=sqrt(n);
   for(ll i=2;i<=(ll)(l);i++) { //
        if(n%i==0){
        prime_factorize(i);prime_factorize(ll(n/i));return;
        }
    }
    //mapでは存在しないkeyの場合も自動で構築される
    prime[n]++;return;
}


int main() {
    ll A, V, B, W, T;

    cin >> A >> V;
    cin >> B >> W;
    cin >> T;

    ll dist = abs(B-A);
    ll diff_v = V-W;

    if(dist <= diff_v*T) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;    
}



Measured memory_bytes: 3684
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        List<Integer> X = new ArrayList<>();
        List<Integer> Y = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            X.add(sc.nextInt());
        }
        for (int i = 0; i < m; i++) {
            Y.add(sc.nextInt());
        }
        int xMax = Collections.max(X) + 1;
        int yMin = Collections.min(Y);
        if(!(xMax > x)) {
            System.out.println("War");
            return;
        }
        if(!(yMin <= y)) {
            System.out.println("War");
            return;
        }
        if(!(yMin - xMax >= 0)){
            System.out.println("War");
            return;
        }
        System.out.println("No War");
    }
}

Measured memory_bytes: 36060
#include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int m,f,r;
    while (cin>>m>>f>>r) {
        if (m == -1 && f == -1 && r == -1) {
            break;
        }

        if ((m == -1 || f == -1) || m+f < 30) {
            cout << "F\n";
        } else if (m+f >= 80) {
            cout << "A\n";
        } else if (m+f >= 65) {
            cout << "B\n";
        } else if ((m+f >= 50) || (m+f >= 30 && r >= 50)) {
            cout << "C\n";
        } else if (m+f >= 30) {
            cout << "D\n";
        }
    }

    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

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

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 INF = 1LL << 60;

int N;
long long a[100010][3];

long long dp[10010][3];

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

  for (int i = 0; i < N; ++i) {
    cin >> a[i][0] >> a[i][1] >> a[i][2];
  }


  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        if (j == k) continue;
        chmax(dp[i + 1][k], dp[i][j] + a[i][k]);
      }
    }
  }

  ll res = 0;
  for (int i = 0; i < 3; i++) chmax(res, dp[N][i]);

  cout << res << endl;
}

Measured memory_bytes: 2816
#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

int main()
{
    string s, t;
    cin >> s >> t;
    int c1 = 0;
    int c2 = 0;
    for(int i=0; i<s.length()+t.length(); i++){
        if(i%2==0){
            cout << s[c1];
            c1++;
        }
        else{
            cout << t[c2];
            c2++;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}
const long long MOD = 1000000007;

void solve() {
  // main coding
  ll h,w; cin>>h>>w;
  vector<string> grid(h+1);
  rep(i,h) {
    cin>>grid[i];
    grid[i]+="#";
  }
  grid[h]=string(w+1,'#');
  // dp
  vector<vector<ll>> dp(h,vector<ll>(w));
  dp[0][0]=1;
  rep(i,h) rep(j,w) {
    if(grid[i][j+1]=='.') {
      dp[i][j+1]+=dp[i][j];
      dp[i][j+1]%=MOD;
    }
    if(grid[i+1][j]=='.') {
      dp[i+1][j]+=dp[i][j];
      dp[i+1][j]%=MOD;
    }

  }
  cout<<dp[h-1][w-1]<<"\n";
}

int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 10112
#include <stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if((a==5&&b==5&&c==7)||a==5&&b==7&&c==5||a==7&&b==5&&c==5)
    {
        printf("YES");
    }
    else
            printf("NO");
    return 0;
}


Measured memory_bytes: 128
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#define endl "\n";
using namespace std;

const long long INF = 100100100100100100;
const int MOD = 1000000007;
const int inf = 1001001001;
typedef pair<long long,long long> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



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

    int H,W,N;cin >> H >> W >> N;
    vector<pair<int,int>> obstruct(N);
    for(int i = 0;i<N;i++){
        cin >> obstruct.at(i).first >> obstruct.at(i).second;
    }
    sort(obstruct.begin(),obstruct.end());
    int cannot_go_right = 0;
    int can_cover_right = 1;
    int prvH = 1;
    bool go_right = true;
    for(int i = 0;i<N;i++){
        int nh,nw;nh = obstruct.at(i).first,nw = obstruct.at(i).second;
        
        if(nw == nh-cannot_go_right){
            go_right = false;
            cannot_go_right++;
        }
        if(prvH != nh && go_right){
            can_cover_right = nh-prvH-cannot_go_right;
        }
        else if(prvH != nh && !go_right){
            go_right = true;
        }
        if(nw <= can_cover_right){
            //cout << nh << " " << nw << " " << can_cover_right << endl;
            cout << nh-1 << endl;
            return 0;
        }
        //cout << nh << " " << nw << " " << cannot_go_right << " " << can_cover_right << endl;
        
    }
    cout << H << endl;
}


Measured memory_bytes: 4756
n = int(input())

time = 0
now = [0, 0]
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - now[0]) + abs(y - now[1])
    if d <= t - time and d % 2 == (t - time) % 2:
        time = t
        now = x, y
        continue
    else:
        print("No")
        exit()
else:
    print("Yes")

Measured memory_bytes: 46952
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            //

            int X; int Y; int Z;
            Multi(out X, out Y, out Z);
            var ans = (X - Z) / (Y + Z);

            Console.WriteLine(ans);

            //
            Console.Out.Flush();
            Console.ReadKey();
        }

        static void Solve()
        {

        }

        static long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public char[] GetCharArray() { return Console.ReadLine().Split(' ').Select(char.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c, out V d)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<V>(ar[3]);
        }
    }
}

Measured memory_bytes: 13268
S = str(input())

RLcontinue = []

right = 1
now = S[0]
left = 0
for i in range(1, len(S)):
    if now == S[i]:
        if S[i] == 'R':
            right += 1
            if i == (len(S)-1):
                RLcontinue.append(right)
        elif S[i] == 'L':
            left += 1
            if i == (len(S)-1):
                RLcontinue.append(left)
    else:
        if S[i] == 'R':
            RLcontinue.append(left)
            left = 0
            right = 1
            if i == (len(S)-1):
                RLcontinue.append(right)
        elif S[i] == 'L':
            RLcontinue.append(right)
            right = 0
            left = 1
            if i == (len(S)-1):
                RLcontinue.append(left)

    now = S[i]
# print(RLcontinue)

ans = [0] * len(S)
# print(ans)

# print(RLcontinue)
target = 0
for i in range(len(RLcontinue)):
    if i % 2 == 0:  # R担当
        if RLcontinue[i] == 1:  # Rマスが1個だけ
            ans[target] += 1
            target += 1
            continue
        if RLcontinue[i] % 2 == 0:  # Rマスが偶数個あったら
            ans[target+RLcontinue[i]] += RLcontinue[i]//2
            ans[target+RLcontinue[i]-1] += RLcontinue[i]//2
        elif RLcontinue[i] % 2 == 1:  # Rマスが奇数あったら
            ans[target+RLcontinue[i]] += RLcontinue[i]//2
            ans[target+RLcontinue[i]-1] += RLcontinue[i]//2 + 1
        target += RLcontinue[i]
    elif i % 2 == 1:  # L担当
        if RLcontinue[i] == 1:  # Lマスが1個だけ
            ans[target] += 1
            target += 1
            continue
        if RLcontinue[i] % 2 == 0:  # Lマスが偶数個あったら
            ans[target] += RLcontinue[i]//2
            ans[target-1] += RLcontinue[i]//2
        elif RLcontinue[i] % 2 == 1:  # Lマスが奇数あったら
            ans[target-1] += RLcontinue[i]//2
            ans[target] += RLcontinue[i]//2 + 1
        target += RLcontinue[i]


print(" ".join(map(str, ans)))


Measured memory_bytes: 11252
import java.util.*;

public class Main {

	private static class SizedPriorityQueue<T> extends PriorityQueue<T> {
		int max;

		public SizedPriorityQueue(int max) {
			this.max = max;
		}

		@Override
		public boolean add(T t) {
			boolean a = super.add(t);
			if (super.size() > max) super.poll();
			return a;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		int k = sc.nextInt();

		long[] a = new long[x];
		long[] b = new long[y];
		long[] c = new long[z];
		for (int i = 0; i < a.length; i++) {
			a[i] = sc.nextLong();
		}
		for (int i = 0; i < b.length; i++) {
			b[i] = sc.nextLong();
		}
		for (int i = 0; i < c.length; i++) {
			c[i] = sc.nextLong();
		}

		PriorityQueue<Long> pq = new SizedPriorityQueue<>(k);
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < b.length; j++) {
				pq.add(a[i] + b[j]);
			}
		}

		PriorityQueue<Long> pq2 = new SizedPriorityQueue<>(k);
		for (long t : pq) {
			for (long i : c) {
				pq2.add(i + t);
			}
		}

		List<Long> answer = new ArrayList<>(pq2);
		Collections.sort(answer, Comparator.reverseOrder());
		for (long i : answer) System.out.println(i);
	}


}


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

int N, V;

int main(){
	cin >> N >> V;
	
	int x, y, z;
	
	for(x = 0; x <=N; x++){
		for(y = 0; y<=N-x; y++){
			z = N-x-y;
			if (10000*x + 5000 * y + 1000 *z == V){
				cout << x << " " << y << " " << z << endl;
				return 0;
			}
		}
	}
	
	cout <<"-1 -1 -1" << endl;
}

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

using namespace std;

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

const int MAX_NM = 3003;

int dp[MAX_NM][MAX_NM];

int main()
{
	rep (i, MAX_NM) rep (j, MAX_NM) dp[i][j] = 0;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string s; cin >> s;
	string t; cin >> t;

	int n = (int)s.length();
	int m = (int)t.length();

	rep (i, n){
		rep (j, m){
			if (s[i] == t[j]){
				if (dp[i+1][j+1] < dp[i][j] + 1){
					dp[i+1][j+1] = dp[i][j] + 1;
				} // end if
			} // end if
			if (dp[i+1][j+1] < dp[i][j+1]){
				dp[i+1][j+1] = dp[i][j+1];
			} // end if
			if (dp[i+1][j+1] < dp[i+1][j]){
				dp[i+1][j+1] = dp[i+1][j];
			} // end if
		} // end rep
	} // end rep
/*
	rep (i, n+1){
		rep (j, m+1){
			cerr << setw(2) << dp[i][j];
		} // end rep
		cerr << endl;
	} // end rep
*/
	int i = n, j = m;
	string res = "";
	while(i > 0 || j > 0){
		int curr = dp[i][j];
		if ((i - 1 >= 0) && (j - 1 >= 0) && (dp[i-1][j-1] + 1 == curr) && (s[i-1] == t[j-1])){
			res += s[i-1];
			--i, --j;
		}else
		if ((i - 1 >= 0) && (j - 1 >= 0) && (dp[i][j-1] > dp[i-1][j])){
			--j;
		}else
		if ((i - 1 >= 0) && (j - 1 >= 0) && (dp[i][j-1] < dp[i-1][j])){
			--i;
		}else
		if (j - 1 >= 0){
			--j;
		}else
		if (i - 1 >= 0){
			--i;
		} // end if
//		cerr << "i: " << i << " j: " << j << " res: " << res << endl;
	} // end while

	if (!res.empty()){
		reverse(ALL(res));
	} // end if

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 35456
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    static int N;
    static int H;
    static int[] A;
    static int[] B;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        H = sc.nextInt();
        A = new int[N];
        B = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            B[i] = sc.nextInt();
        }

        System.out.println( solve() );
    }

    private static int solve() {
        Arrays.sort(A);
        Arrays.sort(B);

        int max_a = A[N-1];

        int hp = H;
        int ans = 0;
        for (int i = N-1; i >= 0; i--) {
            int b = B[i];
            if( b > max_a ) {
                hp -= b;
                ans++;
                if( hp <= 0 ) return ans;

            } else {
                break;
            }
        }

        int q = hp / max_a;
        int r = hp % max_a;

        ans += q;
        if( r > 0 ) ans +=1;

        return ans;
    }

    static class FastScanner {

        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

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

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 44348
#include <bits/stdc++.h>
using namespace std;
int i,n;
int a[100001],f[100001];
int main()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>a[i];
    f[0]=9999999999;
    for (i=2;i<=n;i++)
        f[i]=min(f[i-1]+abs(a[i]-a[i-1]),f[i-2]+abs(a[i]-a[i-2]));
    cout<<f[n];
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
   int N;
   scanf("%d",&N);
   char S[N];
   char ABC[3]={'A','B','C'};
   scanf("%s",S);
   int cnt;
   int cnt2=0;
   for(int i=0;i<N;i++){
      cnt=0;
      for(int j=0;j<3;j++){
         if(S[i+j]==ABC[j]){
            cnt++;
         }
      }
      if(cnt==3){
         cnt2++;
      }
   }
   printf("%d",cnt2);
   return 0;
}


Measured memory_bytes: 1680
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>

#define ll long long
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if ((b%a) != 0) {
		cout << b - a;
	}
	else {
		cout << b + a;
	}
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		int pie = 0;
		int eat = Integer.MAX_VALUE;
		Boolean eatPlus = true;
		for (int i = 0; i < N; i++) {
			pie += L + i;
			if (eat > Math.abs(L + i)) {
				eat = Math.abs(L + i);
				eatPlus = (L + i >= 0);
			}
		}
		if (eatPlus)
			pie -= eat;
		else
			pie += eat;

		System.out.println(pie);

	}
}

Measured memory_bytes: 22740
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n,t;
	cin >> n >>t;
	vector<ll> 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] + t > a[i+1]){
			ans += a[i+1] - a[i];
		}
		else{
			ans += t;
		}
	}
	ans += t;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
while True:
    n, k = map(int, input().split())
    if n == 0 and k == 0: break
    a = [int(input()) for _ in range(n)]
    s = sum(a[0:k])
    ss = [s]
    for i in range(k, n):
        s = s + a[i] - a[i-k]
        ss.append(s)
    print(max(ss))


Measured memory_bytes: 11700
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=2;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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 INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  int b=1;
  rep1(i,100){
    int j=i*i;
    while(j<=a){
      if(b<j)
        b=j;
      j=j*i;
    }
  }
  out(b);
}


Measured memory_bytes: 256
s = input()
t = input()
ans = len(t)

def judge(s0, s1):
    ret = 0
    for i in range(len(s0)):
        if s0[i] != s1[i]:
            ret += 1
    return ret

for i in range(len(s) - len(t) + 1):
    ans = min(ans, judge(s[i:i + len(t)], t))

print(ans)


Measured memory_bytes: 9116
#include <algorithm>
#include <cassert>
#include <functional>
#include <iostream>
#include <map>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

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

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

template <class T> inline void chadd(T &a, const T &b) { a += b, a %= MOD; }

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}


int main() {
  // Input
  int N;
  int K;
  std::cin >> N >> K;
  assert(1 <= N and N <= 1.0e+5);
  assert(1 <= K and K <= 1.0e+5);
  std::string S;
  std::cin >> S;
  assert(S.size() == (size_t)N);

  // Online の境界を求める
  std::vector<int> left;
  std::vector<int> right;
  {
    if (S[0] == '0') {
      left.push_back(0);
      right.push_back(0);
    }

    bool on = false;
    auto isOK = [&S](int i) { return S[i] == '1'; };
    for (int i = 0; i < N; ++i) {
      if (not on and isOK(i)) {
        // Startup
        left.push_back(i);
        on = true;
      } else if (on and not isOK(i)) {
        // Shutdown
        right.push_back(i);
        on = false;
      }
    }
    if (isOK(N - 1))
      right.push_back(N);
    else {
      left.push_back(N);
      right.push_back(N);
    }
  }
  int numOnline = left.size();
  assert(numOnline == (int)right.size());

  // 各 online-offline の個数を求める
  std::vector<int> count;
  count.push_back(right[0] - left[0]);
  for (int i = 1; i < numOnline; ++i) {
    count.push_back(left[i] - right[i - 1]);
    count.push_back(right[i] - left[i]);
  }

  // 累積和を求める
  int numBlock = count.size();
  std::vector<int> sum(numBlock + 1, 0);
  for (int i = 0; i < numBlock; ++i) {
    sum[i + 1] = sum[i] + count[i];
  }

  // 最大値を求める
  int res = -1;
  for (int i = 0; i < numBlock; i += 2) {
    int left = i;
    int right = i + 2 * K + 1;
    chmin(right, numBlock);
    chmax(res, sum[right] - sum[left]);
  }

  // Output
  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 1720
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

N,K=mint()
ans=pow(N//K,3)
if K%2==0:
    ans+=pow(max(0,(N-K//2)//K+1),3)
print(ans)

Measured memory_bytes: 69252
#include<algorithm>
#include<iostream>
#include<map>


using namespace std;



int main()
{
	map<int , int>data;

	for (int i = 0; i < 28; i++)
	{
		int input;
		cin >> input;

		data[input]++;
	}

	for (int i = 1; i <= 30; i++)
	{
		if (data[i] == 0)
		{
			cout << i << endl;
		}
	}

	return 0;
}

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

int N;
bool hasYellow = false;
int main()
{
  cin >> N;
  for (int i = 0; i < N; i++)
  {
    char a;
    cin >> a;
    if (a == 'Y')
    {
      hasYellow = true;
    }
  }
  if (hasYellow)
  {
    cout << "Four" << endl;
  }
  else
  {
    cout << "Three" << endl;
  };
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    ll cnt=0;
    vector<ll> a(N),b(N);
    REP(i,N) cin>>a[i];
    REP(i,N) cin>>b[i];
    REP(i,N){
        if(a[i]<b[i]) cnt+= (b[i]-a[i])/2;
        else cnt-= a[i]-b[i];
    }
    if(cnt>=0) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 384
A=list(input())
A=list(map(int,A))
ansA=0
ansB=0
for i in range(len(A)):
    if i%2==0:
        if A[i]==0:
            pass
        else:
            ansA+=1
    else:
        if A[i]==1:
            pass
        else:
            ansA+=1
for i in range(len(A)):
    if i%2==1:
        if A[i]==0:
            pass
        else:
            ansB+=1
    else:
        if A[i]==1:
            pass
        else:
            ansB+=1
print(min(ansA,ansB))

Measured memory_bytes: 4652