akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define PI (acos(-1))

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;

template <class T>
T mult(T n,T m){
	if(m==0) return 1;
	if(m==1){
		return n%mod;
	}else if(m%2==0){
		T t=mult(n,m/2);
		return (t*t)%mod;
	}else{
		T t=mult(n,m-1);
		return (t*n)%mod;
	}
}

template <class T>
T comb_mod(T n,T k){
	if(n<k) return 0;
	T ans=1;
	T r=min(k,n-k);
	FOR(i,n-r+1,n+1){
		ans*=(i%mod);
		ans%=mod;
	}
	FOR(i,1,r+1){
		ans*=mult(i,mod-2);
		ans%=mod;
	}
	return ans;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x,y;
  cin>>x>>y;
  if((x+y)%3!=0){
	  cout<<0<<endl;
	  return 0;
  }
  ll n=x+y;
  n/=3;
  if(y-n<0){
	  cout<<0<<endl;
	  return 0;
  }
  cout<<comb_mod(n,y-n)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int w,h,x,y,r;
    cin>>w>>h>>x>>y>>r;
    if(0<=x-r&&0<=y-r && w>=x+r && h>=y+r){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 1156
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main(){
    double l; cin>>l;
    double ans=pow(l/3,3);
    printf("%.10f\n",ans);
    return 0;
}


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

int		main(void){
	int	k, n;
	cin >> k >> n;
	vector<int> a(n);
	int i = 0;
	while (i < n)
		scanf("%d", &a[i++]);
	vector<int> mid(n);
	i = 1;
	mid[0] = a[0] + k - a[n - 1];
	while (i < n){
		mid[i] = a[i] - a[i - 1];
		i++;
	}
	int max = 0;
	i = 0;
	while (i < n){
		if (mid[i] > max)
			max = mid[i];
		i++;
	}
	cout << k - max << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

//DPL_1-A Coin Changing Problem

const int INF = 1e8;

signed main(){
	int n, m;
	cin >> n >> m;
	int c[21];
	rep(i, 0, m) {
		cin >> c[i];
	}

	int dp[50010];
	rep(i, 0, 50010) {
		dp[i] = INF;
	}
	dp[0] = 0;

	rep(i, 0, m) {
		rep(j, 0, 50010) {
			if (j - c[i] >= 0) dp[j] = min(dp[j], dp[j - c[i]] + 1);
			//????????£?????§????????????
			//if (j + c[i] < 50010) dp[j + c[i]] = min(dp[j + c[i]], dp[j] + 1);
		}
	}
	cout << dp[n] << endl;
}

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

int parse(string str) {
	int rtn = 0;
	int tmp = 1;
	for (int i=0; i<str.size(); i++) {
		if (str[i] >= '2' && str[i] <= '9') {
			tmp = (int) str[i] - (int) '0';
		} else {
			switch (str[i]) {
				case 'm':
					rtn += tmp * 1000;
					break;
				case 'c':
					rtn += tmp * 100;
					break;
				case 'x':
					rtn += tmp * 10;
					break;
				default:
					rtn += tmp;
			}
			tmp = 1;
		}
	}
	return rtn;
}

string conv(int num) {
	const char c[4] = { 'm', 'c', 'x', 'i' };
	string res = "";
	int div = 1000;
	for (int i=0; i<4; i++) {
		if (num / div) {
			if (num/div != 1)
				res += (char) (num/div + (int) '0');;
			res += c[i];
			num -= (num/div*div);
		}
		div /= 10;
	}
	return res;
}

int main() {
	int N;
	cin >> N;
	while (N--) {
		string d1, d2;
		cin >> d1 >> d2;
		cout << conv(parse(d1)+parse(d2)) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include<cstdio>
#include<stdio.h>
using namespace std;

int main() {
	int n, m, l;
	cin >> n >> m >> l;

	long long A[100][100], B[100][100], C[100][100] = {};

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

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < l; j++) {
			cin >> B[i][j];
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			for (int k = 0; k < m; k++) {
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < l; j++) {
			cout << C[i][j];
			if (j != l-1) cout << " ";
		}
		cout << endl;
	}
		

	return 0;
}




Measured memory_bytes: 3332
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=205,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int n,m,R,cnt;
ll d[N][N];
int r[N],h[N],vis[N];
struct edge{
	int to,nt,w;
}e[N*N];
void add(int u,int v,int w){
	e[++cnt]={v,h[u],w},h[u]=cnt;
	e[++cnt]={u,h[v],w},h[v]=cnt;
}
void spfa(int st){
	queue<int>q;
	mst(vis,0);
	for(int  i=1;i<=n;i++) d[st][i]=1e15;
	q.push(st),vis[st]=1,d[st][st]=0;
	while(!q.empty()){
		int u=q.front();q.pop();vis[u]=0;
		for(int i=h[u];i;i=e[i].nt){
			int v=e[i].to,w=e[i].w;
			if(d[st][v]>d[st][u]+w){
				d[st][v]=d[st][u]+w;
				if(!vis[v]) q.push(v),vis[v]=1;
			}
		}
	}
}
int main(){
	cin>>n>>m>>R;
	for(int i=1;i<=R;i++) cin>>r[i];
	for(int i=1;i<=m;i++){
		int u,v,w;
		cin>>u>>v>>w;
		add(u,v,w);
	}
	for(int i=1;i<=R;i++) spfa(r[i]);
	ll ans=1e15;
	sort(r+1,r+R+1);
	do{
		ll tmp=0;
		for(int i=2;i<=R;i++){
			tmp+=d[r[i]][r[i-1]];
		}
		ans=min(ans,tmp);
	}while(next_permutation(r+1,r+R+1));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4028
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

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

static const ll INF = 1e+18;

int main()
{
    ll A;
    long double B;

    cin >> A >> B;

    ll ans = A * B;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3176
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    ll n;
    cin >> n;
    ll total = 0;
    ll nnn,remi;
    FOR(i,1,n+1){
        total += i;
        if(total >= n){
            remi = i;
            break;
        }
    }
    nnn = total-n;
    FOR(i,1,remi+1){
        if(i==nnn)continue;
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
var
    n,x,a,b,i:longint;
function gcd(a,b:longint):longint;
begin
    if b=0 then exit(a);
    exit(gcd(b,a mod b));
end;
begin
    readln(n,x);
    read(a);b:=abs(a-x);
    for i:=2 to n do
        begin
            read(a);
            b:=gcd(abs(a-x),b);
        end;
    writeln(b);
end.

Measured memory_bytes: 128
//28
#include<iostream>
#include<string>

using namespace std;

int main(){
  for(string s;cin>>s,s!="#";){
    int p=-1;
    int c=0;
    for(int i=0;i<s.size();i++){
      string rh="yuiophjklnm";
      int n=rh.find(s[i])==string::npos;
      c+=p!=n;
      p=n;
    }
    cout<<c-1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  ll x;
  cin >> x;
  int year = 0;
  ll money = 100;
  while(money < x) {
    money += money / 100;
    year++;
  }
  cout << year;
}


Measured memory_bytes: 3572
#include <iostream>
#include <vector>
using namespace std;
vector <int> a[100];
int w,h,result,d1[4]={-1,0,1,0},d2[4]={0,1,0,-1};
void dfs(int y,int x,int amo){

  /* a[0][0]=-1;
     return; */
  
  int i;

  amo++;
  result=max(amo,result);
  a[y][x]=0;
  for(i=0;i<4;i++){
    if(0<=x+d1[i] && x+d1[i]<w && 0<=y+d2[i] && y+d2[i]<h)
      if(a[y+d2[i]][x+d1[i]]==1) dfs(y+d2[i],x+d1[i],amo);
  }
  a[y][x]=1;
}
  
int main(){

  int i,j,tmp;

  while(cin>>w>>h,w){

    result=0;
    
    for(i=0;i<h;i++){
      a[i].clear();
      for(j=0;j<w;j++){
        cin>>tmp;
        a[i].push_back(tmp);
      }
    }
    for(i=0;i<h;i++) for(j=0;j<w;j++) if(a[i][j]==1) dfs(i,j,0);
    //cout<<moto[0][0]<<endl;
    
    cout<<result<<endl;
    
  }
  
  return 0;

}

Measured memory_bytes: 3176
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long ll;
const int maxn = 100005;
 
int X,Y,Z;
int n;
struct P {
    ll x,y,z;
    bool operator<(const P&a)const {
        return x+a.y>y+a.x;
    }
} p[maxn];
 
struct cmp1 {
    bool operator()(int x,int y) {
        return p[x].x+p[y].z>p[y].x+p[x].z;
    }
};
struct cmp2 {
    bool operator()(int x,int y) {
        return p[x].y+p[y].z<p[x].z+p[y].y;
    }
};
 
bool in_silver[maxn];
int main() {
   // freopen("in.cpp","r",stdin);
    cin>>X>>Y>>Z;
    n=X+Y+Z;
    for(int i=0; i<n; i++)cin>>p[i].x>>p[i].y>>p[i].z;
    sort(p,p+n);
    ll ret=0;
    priority_queue<int,vector<int>,cmp1>left_gold;
    priority_queue<int,vector<int>,cmp2>right_bronze;
    for(int i=0; i<X; i++) {
        ret+=p[i].x;
        left_gold.push(i);
    }
    for(int i=n-1; i>=X; i--) {
        ret+=p[i].z;
        right_bronze.push(i);
        if(right_bronze.size()>Z) {
            int tt=right_bronze.top();
            right_bronze.pop();
            ret-=p[tt].z;
            ret+=p[tt].y;
            in_silver[tt]=true;
        }
    }
    ll cur=ret;
    for(int i=X; i<X+Z; i++) {
        ll tmp=cur;
        tmp+=p[i].x;
        left_gold.push(i);
        int tt=left_gold.top();
        left_gold.pop();
        tmp-=p[tt].x;
        tmp+=p[tt].z;
        if(in_silver[i]) {
            tmp-=p[i].y;
            while(!right_bronze.empty()) {
                int tt=right_bronze.top();
                if(tt<=i) {
                    right_bronze.pop();
                } else {
                    right_bronze.pop();
                    in_silver[tt]=true;
                    tmp-=p[tt].z;
                    tmp+=p[tt].y;
                    break;
                }
            }
        } else {
            tmp-=p[i].z;
        }
        ret=max(ret,tmp);
        cur=tmp;
    }
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,k;
vi a;

int main(){
	cin>>n>>k;
	a=vi(n+1);
	int mx=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		a[i]+=a[i-1];
		if(i>=k) mx=max(mx,a[i]-a[i-k]);
	}
	cout<<syosu(9)<<(double)mx/2+0.5*k<<endl;
}

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

int A[3];

int main()
{
	for(int i=0; i<3; i++) cin>>A[i];
	
	sort(A, A+3);
	
	cout<<(A[2]-A[1])+(A[1]-A[0])<<'\n';
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
typedef long long integer;
//////////////////////////////////////////////////
int main(){
	int N;
	SCD(N);

	vector<int> S;

	FOR(i,0,33){
		if (N % 2 == 0){
			S.PB(0);
		}else{
			if (i % 2 == 0){
				N--;
				S.PB(1);
			}else{
				N++;
				S.PB(1);
			}
		}
		N = N / 2;
		
		if (N==0) break;
	}

	for (auto i = S.rbegin(), e = S.rend(); i != e; ++i) {
  		printf("%d", *i);
	}
	printf("\n");


}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
typedef pair<int, int> P;
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    P p[100010];
    rep(i, N) {
        cin >> p[i].first >> p[i].second;
    }
    sort(p, p + N);
    rep(i, N) {
        K -= p[i].second;
        if(K <= 0) {
            cout << p[i].first << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 5188
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;

int main() 
{
	//FASTIO
	int n;
	int arr[110000];
	long long dp[110000];
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>arr[i];
	fill(dp,dp+n,INF);
	dp[0]=0;
	for(int i=1;i<n;++i)
	{
		dp[i]=min(dp[i],dp[i-1]+abs(arr[i]-arr[i-1]));
		if(i>1)
		dp[i]=min(dp[i],dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout<<dp[n-1]<<endl;
	return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pi pair<ll,ll>
#define pii vector<pair<ll,ll> >
#define v vector
#define vi vector<ll>
#define f(a,i,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define MAX 1000001
#define all(x) x.begin(),x.end()
const ll inf=(ll) 1e18;
 
ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
ll spf[MAX+1];
  void sieve()//complexity = approx 3*10^6
    {
        f(1,i,MAX) {spf[i]=i;} 
        for(ll i=2;i<MAX;i+=2){spf[i]=2;}
        for(ll i=3;i<MAX;i+=2)
        {
            if(spf[i]==i) //if i is prime mark its multiples with spf as i
            {
                for(ll j=i*i;j<MAX;j+=i)
                {
                    spf[j]=min(i,(ll)spf[j]);
                }
            }
        }
    }
int main()
{
    ll n;
    cin >> n;
    vi a(n);
    f(0, i, n) cin >> a[i];
    vi dp(n, INT_MAX);
    dp[0] = 0;
    f(0, i, n) {
        if(i - 1 >= 0) {
            dp[i] = min(dp[i], dp[i - 1] + abs(a[i] - a[i - 1]));
        } 

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

Measured memory_bytes: 4768
#include <stdio.h>


int main(){
	int W,H,x,y,r;

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if((x >= r && x <= W-r) && (y >= r && y <= H-r))
		printf("Yes\n");
	else{
		printf("No\n");
	}
}


Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, x, y;
    cin >> n >> x >> y;
    x--, y--;

    vector<vector<ll>> g(n);
    REP(i, n-1) {
        g[i].push_back(i+1);
        g[i+1].push_back(i);
    }
    g[x].push_back(y);
    g[y].push_back(x);

    vector<ll> cnt(n+1);
    REP(s, n) {
        vector<ll> dist(n, INF);
        dist[s] = 0;
        queue<ll> que;
        que.push(s);
        while(que.size()) {
            ll v = que.front(); que.pop();
            for(auto to: g[v]) {
                if(dist[to] == INF) {
                    dist[to] = dist[v] + 1;
                    que.push(to);
                }
            }
        }
        REP(i, n) cnt[dist[i]]++;
    }

    FOR(i, 1, n) cout << cnt[i]/2 << "\n";

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main(){
	string a ,b ,c;
	cin>>a>>b>>c;
	for(int i=0;i<100;i++)
		if(65<=(int)b[i]<=90){
			cout<<"A"<<b[0]<<"C";
			break;
		}
	
	
}

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

const int MAX_N = 100000;

struct Node
{
int iP;
int iRank;
};

Node nd[ MAX_N + 5 ];

int Find( const int A )
{
int i;

	i = A;
	while( i != nd[ i ].iP ) i = nd[ i ].iP;

	return i;
}

void Unite( const int A, const int B )
{
int iGa;
int iGb;
int iRa;
int iRb;

	iGa = Find( A );
	iGb = Find( B );
	if( iGa == iGb ) return;

	iRa = nd[ iGa ].iRank;
	iRb = nd[ iGb ].iRank;
	if( iRa > iRb )
		nd[ iGb ].iP = iGa;
	else if( iRa < iRb )
		nd[ iGa ].iP = iGb;
	else
	{
		nd[ iGb ].iP = iGa;
		nd[ iGa ].iRank++;
	}
}

bool Same( const int A, const int B )
{
	return ( Find( A ) == Find( B ) );
}

int p[ 100010 ];

int main()
{
int i;
int N;
int M;
int x;
int y;
int iCnt;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> N;
	cin >> M;

	for( i = 1; i <= N; i++ )
	{
		nd[ i ].iP = i;

		cin >> p[ i ];
	}

	for( i = 0; i < M; i++ )
	{
		cin >> x;
		cin >> y;

		Unite( x, y );
	}

	iCnt = 0;
	for( i = 1; i <= N; i++ )
	{
		if( Same( i, p[ i ] ) ) iCnt++;
	}

	cout << iCnt << endl;

	return 0;
}


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

using namespace std;

int main(){
  vector<int> science;
  vector<int> society;

  for(int i = 0;i < 4;++i){
    int s;
    cin>>s;
    science.push_back(s);
  }
  sort(science.begin(),science.end());
  reverse(science.begin(),science.end());

  for(int i = 0;i < 2;++i){
    int s;
    cin>>s;
    society.push_back(s);
  }
  sort(society.begin(),society.end());
  reverse(society.begin(),society.end());

  int a = science.at(0) + science.at(1) + science.at(2);
  int b = society.at(0);

  int ans = a + b;

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 3164
// 2020-08-24 18:56:04
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

const int V = 105;
const int inf = 1e9;
int E[V][V], D[V][V];
void answer() {
  int n, m;
  cin >> n >> m;
  rep(i, n) rep(j, n) {
    E[i][j] = D[i][j] = inf;
    if(i == j) E[i][j] = D[i][j] = 0;
  }
  rep(i, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    E[a][b] = D[a][b] = E[b][a] = D[b][a] = c;
  }
  rep(k, n) {
    rep(i, n) {
      rep(j, n) {
        chmin(D[i][j], D[i][k] + D[k][j]);
      }
    }
  }
  int ans = 0;
  rep(i, n) {
    rep(j, n) {
      if(i < j && E[i][j] != inf && D[i][j] < E[i][j]) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3696
package main

import "fmt"

func main(){
	var N int;
	fmt.Scan(&N);

	A := make([]int, N);
	B := make([]int, N);
	var ans int;

	for i := 0 ; i < N ; i++{
		fmt.Scan(&A[i]);
	}

	for i:= 0; i < N ; i++{
		if A[i] % 2 == 0 {
			B[i] = 1;
			ans++;
		}
	}
	for i:=0;i < N ; i++{
		if B[i] == 1{
			if A[i] % 3 == 0 || A[i] % 5 == 0{
				ans--;
			}
		}
	}
	if ans == 0{
		fmt.Println("APPROVED");
	}else {
		fmt.Println("DENIED");
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int a,b;
	cin>>a>>b;
	if(a>=13)cout<<b;
	else if(a<=12&&a>=6)cout<<b/2;
	else cout<<0;
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {
	static Scanner sc =  new java.util.Scanner(System.in);

	public static void main(String[] args) {
		
		while ( sc.hasNext() ){
		
		int a = sc.nextInt();
		int b = sc.nextInt();

		int s = a + b ;
		String str = Integer.toString( s );
		
		System.out.println( str.length() );
	
		}

	}

}

Measured memory_bytes: 26428
#include <bits/stdc++.h>
using namespace std;
inline int read(){
	register int x=0;
	register bool f=0;
	register char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-') f=1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+c-48;
		c=getchar();
	}
	return f?-x:x;
}
char cr[200];int tt;
inline void print(register int x,register char k='\n') {
    if(!x) putchar('0');
    if(x < 0) putchar('-'),x=-x;
    while(x) cr[++tt]=x%10+'0',x/=10;
    while(tt) putchar(cr[tt--]);
    putchar(k);
}
int n,m,a[114514],cnt,sum;
int main(){
	n=read();m=read();
	for(int i=1;i<=n;i++){
		a[i]=read();sum+=a[i];	
	}
	for(int i=1;i<=n;i++)if(a[i]>=1.0*sum/(4.0*m)) cnt++;
	if(cnt>=m) puts("Yes");
	else puts("No");
}

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

int main()
{
  string s;
  cin >> s;
  int i, ans;
  ans = 0;
  for(i = 0; i < 4; i++)
  {
    if(s.at(i) == '+')
    {
      ans++;
    }
  }
  cout << ans * 2 - 4 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)    for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define rrep(i, n)   for(int i=(n-1); i>=0; --i)
#define all(v)       v.begin(), v.end()
#define rall(v)      v.rbegin(), v.rend()
#define int          long long
template<typename T>
using vv  = vector<vector<T>>;
using vi  = vector<int>;
using vvi = vector<vector<int>>;
using P   = pair<int, int>;
using ll  = long long;
constexpr ll INF = 1LL << 60;

signed main(){

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n){
        cin >> a[i];
    }

    int res = a[0];
    REP(i, 1, n){
        res ^= a[i];
    }

    rep(i, n){
        cout << (res ^ a[i]) << endl;
    }

    return 0;
}



Measured memory_bytes: 4748
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  string s;
  stringstream ss;
  int numw = 0;
  long sum = 0;
  cin >> s;
  for(int i=0;i<s.length();i++){
    char c = s[i];
    if(c != 'W') continue;
    int diff = i - numw;
    sum += diff;
    numw ++;
  }
  cout << sum << endl;
  return 0;
}


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

vector<int> h,w;
vector<int> Sh,Sw;

void init(){
  h.resize(0);
  w.resize(0);
  Sh.resize(0);
  Sw.resize(0);
}

bool input(){
  int n,m;
  cin>>n>>m;
  if(n==0 && m==0){
    return false;
  }
  for(int i=0;i<n;i++){
    int tmp;
    cin>>tmp;
    h.push_back(tmp);
  }
  for(int i=0;i<m;i++){
    int tmp;
    cin>>tmp;
    w.push_back(tmp);
  }
  return true;
}

int ans(){
  int res=0;
  for(int i=0;i<h.size();i++){
    int tmp=0;
    for(int j=i;j<h.size();j++){
      tmp+=h[j];
      Sh.push_back(tmp);
    }
  }
  for(int i=0;i<w.size();i++){
    int tmp=0;
    for(int j=i;j<w.size();j++){
      tmp+=w[j];
      Sw.push_back(tmp);
    }
  }

  sort(Sw.begin(),Sw.end());
  sort(Sh.begin(),Sh.end());

  int i=0,j=0;

  while(i<Sw.size() && j<Sh.size()){
    if(Sw[i]<Sh[j]){
      i++;
      continue;
    }else if(Sw[i]>Sh[j]){
      j++;
      continue;
    }
    int s_w=1,s_h=1;
    
    while(Sw[i]==Sw[i+1]){
      s_w++;
      i++;
    }
    while(Sh[j]==Sh[j+1]){
      s_h++;
      j++;
    }
    res += s_w*s_h;
    i++;
    j++;
  }
  return res;
}

int main(){
  while(init(),input()){
    int a=ans();
    cout<<a<<endl;
  }
}

Measured memory_bytes: 15388
#include <iostream>

using namespace std;

int n,ans,a;

int main(int argc,char ** argv)
{
    ios::sync_with_stdio(false);
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a,ans+=a;
    cout<<ans-n<<endl;
    return 0;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
    	h: chars,
    }
    println!("{}", ((h[0] as u8)+1) as char);
}

fn calc(h:usize, a:usize) -> usize {
	if h%a>0 { h/a+1 } else { h/a}
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define mod 1000000000+7;
typedef long long ll;
using namespace std;

const int N = 1e7+5;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	ll n; cin >> n;
    if(n==n-n%1000) cout << 0 << "\n";
    else cout << 1000-n%1000 << "\n";
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define MN 5000
using namespace std;
inline 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 n,K,mxlen,ans=0,Len;
char s[MN*2+5],A='z';
void Try(int x)
{
 //   cout<<"Try"<<x<<endl;
    if(!ans) return (void)(ans=x);
    for(int i=0;i<n-Len;++i)
    {
        if(s[ans-i]<s[x-i]) return;
        if(s[x-i]<s[ans-i]) {ans=x;return;}
    }
}
int main()
{
    n=read();K=read();scanf("%s",s+1);
    for(int i=1;i<=n;++i) A=min(A,s[i]);
  //  cout<<A<<endl;
    for(int j,i=1;i<=n;++i) if(s[i]==A)
    {
        for(j=i;j<n&&s[j+1]==A;++j);
        mxlen=max(mxlen,(j-i+1)*(j==n?2:1));
        i=j;
    }
    if(K>20||(mxlen<<K-1)>=n) {for(int i=1;i<=n;++i) putchar(A);return 0;}
    Len=mxlen<<K-1;
    for(int i=1;i<=n;++i) s[2*n+1-i]=s[i];
    for(int i=1,j;i<=n;++i) if(s[i]==A)
    {
        for(j=i;j<n&&s[j+1]==A;++j);
        int actlen=(j-i+1)*(j==n?2:1);
        if(actlen==mxlen) j==n?Try(i-1):Try(2*n-j);
    }
 //   cout<<"ans="<<ans<<endl;
    for(int i=1;i<=Len;++i) putchar(A);
    for(int i=0;i<n-Len;++i) putchar(s[ans-i]);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<int>>;


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

int main() {
    ll h,w,k;
    cin >> h >> w >> k;
    vector<vector<int>> m(h, vector<int>(w, 0));
    REP(i, h){
        REP(j, w){
            char in;
            cin >> in;
            if(in == '#'){
                m[i][j] = 1;
            }
        }
    }
    ll ANS = 0;
    REP(i, pow(2, h)){
        vector<int> bi_i(h);
        int ctp_i = i;
        REP(i_x, h){
            bi_i[i_x] = ctp_i % 2;
            //cout << ctp_i % 2 ;
            ctp_i /= 2;
        }
        // REP(p, h){
        //     cout << bi_i[p];
        // }
        // cout << endl;
        vector<int> bi_j(w);
        REP(j, pow(2, w)){
            
            int ctp_j = j;
            REP(j_x, w){
                bi_j[j_x] = ctp_j % 2;
                //cout << ctp_j % 2 ;
                ctp_j /= 2;
            }
            // REP(p, w){
            //     cout << bi_j[p];
            // }
            
            ll ans = 0;
            REP(s, h){
                REP(t, w){
                    // cout << "s = " << s <<  " t = " << t << endl;
                    // cout << "bi_i[s] = " << bi_i[s] <<  " bi_j[t] = " << bi_j[t] << endl;
                    if(m[s][t] == 1 && bi_i[s] == 0 && bi_j[t] == 0){
                        //cout << "hoge" << endl;
                        ans += 1;
                    }
                }
            }
            if(ans == k){
                ANS += 1;
            }
        }
    }
    cout << ANS << endl;

}



Measured memory_bytes: 4092
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <vector>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;
#define mk make_pair

using namespace std;
int const N = 200001;
int a[N], arr[N];


int main()
{
    string s;
    cin >> s;
    string begin = "", end = "";
    bool isInv = false;

    int q; cin >> q;
    for (int i = 0; i < q; i++) {
        int t; cin >> t;
        if (t == 1) isInv = !isInv;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1)
                if (isInv) end += c;
                else begin += c;
            else 
                if (isInv) begin += c;
                else end += c;
        }
    }

    if (isInv) {
        reverse(end.begin(), end.end());
        reverse(s.begin(), s.end());
        cout << end << s << begin;
    }
    else {
        reverse(begin.begin(), begin.end());
        cout << begin << s << end;
    }
    

}

Measured memory_bytes: 1088
#include<bits/stdc++.h>
#define maxD 12
using namespace std;
int p[maxD], c[maxD];
bool v[maxD];
int main(){
	int D, G;
	scanf("%d %d", &D, &G);
	for(int i = 1; i <= D; i += 1){
		scanf("%d %d", p + i, c + i);
		c[i] = p[i] * i  + c[i] / 100; 
	}
	int ans = 1000;
	for(int i = 0; i < (1 << D); i += 1){
		int pG = G / 100, pans = 0, k = 0;
		fill(v + 1, v + D + 1, false);
		for(int j = 1; j <= D; j += 1) if(i & (1 << j - 1)){
			v[j] = true;
			pG -= c[j];
			pans += p[j];
		}
		else k = j;
		for(int j = 1; j <= p[k] - 1 && pG > 0; j += 1){
			pG -= k;
			pans += 1;
		}
		if(pG <= 0) ans = min(ans, pans);
	}
	printf("%d", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void init(){
   cin.tie(0);
   cin.sync_with_stdio(0);
     }

 int main(){
      init();
      long long x;
      cin>>x;
      for(int i=0;i<=120;i++){
        long long w=pow(i,5);
        for(int j=0;j<=120;j++){
            long long t=pow(j,5);
                if(x == w - t){
                cout << i << " " << j << endl;
                return 0;
            }
            if(x == w + t){
                cout << i << " " << j * -1 << endl;
                return 0;
            }
            if(x == (w * -1) - t){
                cout << i * -1 << " " << j << endl;
                return 0;
            }
            if(x == (w * -1) + t){
                cout << i * -1 << " " << j * -1 << endl;
                return 0;
        }
      } }
      return 0;}

Measured memory_bytes: 4112
#include<iostream>
#include<set>
using namespace std;
string s, t;
set<string> ss;
int main(){
    cin >> s >> t;
    int lens = s.size();
    int lent = t.size();
    for(int i = 0; i < lens; i++){
        if(s[i] == '?' || s[i] == t[0]){
            string tmp = s;
            for(int j = 0; j < i; j++) if(tmp[j] == '?') tmp[j] ='a';
            bool can = false;
            for(int j = 0; j < lent; j++){
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j]) break;
                tmp[i+j] = t[j];
                if(j == lent - 1) can = true;
            }
            if(can){
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';
                ss.insert(tmp);
            }
        }
    }
    if(ss.size() == 0) cout << "UNRESTORABLE" << endl;
    else cout << *ss.begin() << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

#define T 1000000002

int main(void){
	string s, t; cin >> s >> t;
	vector<int> sv(s.size()+1, 0), tv(t.size()+1, 0);
	sv[0] = tv[0] = 0;
	rep(i, s.size()) sv[i+1] = sv[i] + (s[i]=='A'?1:-1);
	rep(i, t.size()) tv[i+1] = tv[i] + (t[i]=='A'?1:-1);
	
	int q; cin >> q;
	rep(i, q){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int ss = (sv[b] - sv[a-1] + T)%3;
		int tt = (tv[d] - tv[c-1] + T)%3;
		if(ss == tt) cout << "YES" << endl;
		else cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1664
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=abs(score//50)
etemp=1
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(5)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[day-i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    #print(score)
for i in solution:
  print(i+1)
#print(sco)


Measured memory_bytes: 10376
#include <stdio.h>

int main(void) {
	int h,m,s;
	
	scanf("%d",&s);
	h=s/3600;
	m=(s-h*3600)/60;
	s=s-h*3600-m*60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

Measured memory_bytes: 592
n = int(input())
h = list(map(int,input().split()))
for i in range(n-1, 0, -1):
    if h[i] >= h[i-1]:
        continue
    elif h[i] - h[i-1] < -1:
        print('No')
        break
    else:
        h[i-1] -= 1
else:
    print('Yes')


Measured memory_bytes: 14396
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int N, K;
	cin >> N >> K;

	if(N%K == 0)
		cout << 0 << endl;
	else
		cout << 1 << endl;

	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

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

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

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

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

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

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

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

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

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

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int s = sc.nextInt();
    int[] result = new int[n];
    for (int i = 0; i < k; i++) {
      result[i] = s;
    }
    if (s < 1000000000) {
      for (int i = 0; i < n - k; i++) {
        result[i + k] = s + 1;
      }
    } else {
      for (int i = 0; i < n - k; i++) {
        result[i + k] = s != 1 ? 1 : 2;
      }
    }
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < n; i++) {
      if (i > 0) sb.append(" ");
      sb.append(result[i]);
    }
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 29204
use std::cmp;

fn main() {
    let mut sc = Scanner::new();
    let a: Vec<usize> = sc.read_vec(7);
    let mut ans = 0;
    ans += a[1];

    if a[3] > 0 && a[4] > 0 && a[0] > 0 {
        ans += cmp::max(
            a[3] / 2 * 2 + a[4] / 2 * 2 + a[0] / 2 * 2,
            (a[3] - 1) / 2 * 2 + (a[4] - 1) / 2 * 2 + (a[0] - 1) / 2 * 2 + 3,
        );
    } else {
        ans += a[3] / 2 * 2;
        ans += a[4] / 2 * 2;
        ans += a[0] / 2 * 2;
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 4352
import itertools
import collections
INF = 10 ** 9

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    p = collections.defaultdict(int)
    q = collections.defaultdict(list)
    for i, v in enumerate(itertools.permutations(range(8))):
        p[v] = i
        q[i] = list(v)

    dist = [INF] * (40325)
    dist[0] = 0
    que = collections.deque()
    que.append(0)

    def change(i, j, l):
        d = dist[p[tuple(l)]]
        l[i], l[j] = l[j], l[i]
        if dist[p[tuple(l)]] == INF:
            dist[p[tuple(l)]] = d + 1
            que.append(p[tuple(l)])
        l[i], l[j] = l[j], l[i]
        return

    while que:
        v = que.popleft()
        ll = q[v]
        i = ll.index(0)

        if i in {0, 4}: change(i, i+1, ll)
        elif i in {3, 7}: change(i-1, i, ll)
        else:
            change(i, i+1, ll)
            change(i-1, i, ll)
        change(i, (i+4)%8, ll)

    while True:
        try:
            A = ZZ()
            print(dist[p[tuple(A)]])
        except:
            break

    return

if __name__ == '__main__':
    main()



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

int main() {
	// your code goes here
	int inputS,h,m,s;
	cin >> inputS;
	s = inputS % 60;
	m = inputS % (60 * 60) / 60;
	h = inputS % (24 * 60 * 60) / (60*60);
	
	cout << h <<":"<<m<<":"<<s <<endl;
	return 0;
}

Measured memory_bytes: 1164
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    x, y, z = [0], [0], [0]
    for i in range(n):
        if a[i] == 0:
            if x[-1] == 0:
                x.append(1)
                y.append(y[-1])
                z.append(z[-1])
            elif y[-1] == 0:
                x.append(x[-1])
                y.append(1)
                z.append(z[-1])
            else:
                x.append(x[-1])
                y.append(y[-1])
                z.append(1)
        else:
            if x[-1] == a[i]:
                x.append(x[-1] + 1)
                y.append(y[-1])
                z.append(z[-1])
            elif y[-1] == a[i]:
                x.append(x[-1])
                y.append(y[-1] + 1)
                z.append(z[-1])
            else:
                x.append(x[-1])
                y.append(y[-1])
                z.append(z[-1] + 1)

    ans = 1
    for i in range(n):
        ans *= [x[i], y[i], z[i]].count(a[i])
        ans %= (10 ** 9 + 7)

    print(ans)


Measured memory_bytes: 14308
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#define all(x) (x).begin(),(x).end()
typedef long long ll;

using namespace std;

int main()
{
    int L,R,d,ans;  cin >> L >> R >> d;
    ans = 0;
    for(int i=L;i<=R;i++){
        if(i%d==0)  ans++;
    }
    cout << ans;

}

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

typedef long long int ll;
typedef long double ld;

#define Pb push_back
#define Mp make_pair

#define ff first
#define ss second

#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

#define ll ld

ll dp[301][301][301];

ll sol(int one,int two,int three,int &n)
{
	if(one < 0 || two < 0 || three < 0)
	{
		return 0;
	}
	if(three == 0 && two == 0 && one == 0)
	{
		return 0;
	}
	if(dp[one][two][three] > 0)
	{
		return dp[one][two][three];
	}
	int rem = one + two + three;
	ll ex_val = n + one * sol(one-1,two,three,n) +  two * sol(one+1,two-1,three,n) +  three* sol(one,two+1,three-1,n);
	return dp[one][two][three] = ex_val/rem;
}

void solve()
{
	int n;
	cin >> n;
	vector<int> cnt(4,0);
	for(int i=0,x;i<n;i++)
	{
		cin >> x;
		cnt[x]++;
	}
	memset(dp,-1,sizeof(dp));
	cout << fixed << setprecision(12) << sol(cnt[1],cnt[2],cnt[3],n);
}

signed main()
{
   IOS;
   int t = 1;
   //cin >> t;
   while(t--)
   {
      solve();
   }
   return 0;
}


/*==============================================================================================================================================================*/


Measured memory_bytes: 426496
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int, int>;
using ll = long long;
int f, s, nw = 0;
ll ans;
string S;
vector<P> ps;
int main(){
	cin >> S;
	for(char c: S){
		if(c == '<'){
			nw = 1;
			s++;
		}else if(nw){
			if(!ps.empty()){
				if(ps.back().second < f) ps.back().second--;
				else f--;
			}
			ps.push_back(P(f,s));
			f = 1; s = 0; nw = 0;
		}else f++;
	}
	if(!ps.empty()){
		if(ps.back().second < f) ps.back().second--;
		else f--;
	}
	ps.push_back(P(f,s));
	for(P p: ps){
		tie(f,s) = p;
		ans += (ll)f*(f+1)/2 + (ll)s*(s+1)/2;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 2048