akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N; cin >> N;
    ll A[N]; F0R(i, N) cin >> A[i];
    F0R(i, N) {
        if (A[i] == 0) {
            cout << 0 << nl; return 0;
        }
    }
    ld L = 0;
    F0R(i, N) {
        L += log10(A[i]);
    }
    if (L > 18.1) {
        cout << -1 << nl; return 0;
    }
    ll ans = 1; F0R(i, N) ans *= A[i];
    if (ans > 1000000000000000000) {
        cout << -1 << nl; return 0;
    }
    cout << ans << nl;
	
	return 0;
}
 


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

int main(){
  int x, y;

  while(1){
    cin >> x >> y;
    if(max(x,y)==0){
      break;
    }
    else if(x < y){
      cout << x << " " << y << endl;
    }
    else{
      cout << y << " " << x << endl;
    }
  }
}





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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(24);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
/*	vll a[100];
	ll n,m,x,k;
	ll c[n+1];

	cin>>n>>m>>x;
	for(ll i=0;i<n;i++) {
		cin>>c[i];
		for(ll j=0;j<m;j++) {
			cin>>k;
			a[i].pb(k);
		}

	}

	for(ll j=0;j<n;j++) {
		ll sum = 0;
		for(ll i=0;i<n;i++) {
			sum+=a[i][j];
		}
		if(sum < x) {
			cout<<-1;
			return;
		}
	}
*/
	ll k;
	cin>>n>>k;
	vll a(n+2);
	vll ans;
	ll visit[n+1];
	mset(visit,-1);
	for(ll i=1;i<=n;i++) cin>>a[i];
	ans.pb(1);
	ll val = a[1];
	visit[1] = 0;
	while(visit[val]==-1) {
		visit[val] = ans.size();
		ans.pb(val);
		val = a[val];
	}
	ll start = visit[val];

	if(k < ans.size()) cout<<ans[k];
	else {
		k -= (start);
		//cout<<k<<" ";
		k%= (ans.size() - start );
		//cout<<ans.size() - start<<" "; 
		//cout<<start<< " "<<k<<" ";
		cout<<ans[k+start];
	}
	//DISP(ans);
	//cout<<ans[k];
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

using namespace std;

typedef long long ll;

int main() {
	
	ll n;
	cin>>n;
	
	vector<ll> ai(n);
	
	for(int i = 0; i < n; ++i){
		cin>>ai[i];
	}
	
	ll resp = 0;
	ll resto = 0;
	
	for(int i = 0; i < n; ++i){
		if(ai[i] > 0){
			ll cur = (ai[i] + resto) % 2;
			resp += (ai[i] + resto)/2;
			resto = cur;
		}
		else resto = 0;
	}
	
	
	cout<<resp<<'\n';
	
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
int n, C[maxn];
ll dp[maxn], sum[maxn];
int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> C[i];
    dp[0] = 1;
    sum[C[1]] = 1;
    for(int i = 1; i <= n; i++)
    {
        dp[i] = sum[C[i]];
        if(C[i + 1] != C[i])
            sum[C[i + 1]] = (sum[C[i + 1]] + dp[i]) % mod;
    }
    cout << dp[n] << endl;
    return 0;
}


Measured memory_bytes: 4224
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=2e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }


int n,k,a[N],vis[N];
	
void solve() {
    cin>>n>>k;
    
    rep1(i,1,n) {
		  cin>>a[i]; 
		}
    
    int c_ind=1,ct=1;
    while(k--) {
		   c_ind=a[c_ind];
		   if(vis[c_ind]) k%=(ct-vis[c_ind]);
		   vis[c_ind]=ct++;
		}
		
		//~ cout<<ct<<endl;
		cout<<c_ind<<endl;		
		 

 }

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

return 0;	   
}


Measured memory_bytes: 6756
S=list(input())
A=[]
B=[]
countA=0
countB=0
for i in range(0,len(S)):
  if i%2==0:
    A.append('1')
    B.append('0')
  else:
    A.append('0')
    B.append('1')
for i in range(0,len(S)):
  if S[i]!=A[i]:
    countA+=1
for i in range(0,len(S)):
  if S[i]!=B[i]:
    countB+=1
if countA>=countB:
  print(countB)
else:
  print(countA)

Measured memory_bytes: 5544
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
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; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    string str;
    cin >> str;
    if(str[0]==str[2]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

// dp[i][j][k][l] :=  i: 上位 i 桁目まで決定，j: smallであるか,
//                    k: 数字を書き込んだか， l: {3,5,7} を選んだかのflag
//                    としたときの753数の数
int dp[11][2][2][8];

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

  string n;
  cin >> n;

  int len = n.size();
  dp[0][0][0][0] = 1;
  for (int i = 0; i < len; ++i)
  {
    for (int j = 0; j < 2; ++j)
    {
      for (int k = 0; k < 2; ++k)
      {
        for (int l = 0; l < 8; ++l)
        {
          if (!dp[i][j][k][l]) continue;

          if (j == 1)                  // [0, 9] から数字を選べる
          {
            if (k == 0)                // 数字をまだ書き込んでいない
              dp[i + 1][1][0][0] += dp[i][j][k][l];                // nothing

            dp[i + 1][1][1][l | 1] += dp[i][j][k][l];              // +3
            dp[i + 1][1][1][l | 2] += dp[i][j][k][l];              // +5
            dp[i + 1][1][1][l | 4] += dp[i][j][k][l];              // +7
          }
          else                         // [0, d] から数字を選べる
          {
            int d = (int)(n[i] - '0');

            if (k == 0)                // 数字をまだ書き込んでいない
              dp[i + 1][1][0][0] += dp[i][j][k][l];                // nothing

            if (d == 3) dp[i + 1][0][1][l | 1] += dp[i][j][k][l];  // +3
            if (3 < d)  dp[i + 1][1][1][l | 1] += dp[i][j][k][l];  // +3
            if (d == 5) dp[i + 1][0][1][l | 2] += dp[i][j][k][l];  // +5
            if (5 < d)  dp[i + 1][1][1][l | 2] += dp[i][j][k][l];  // +5
            if (d == 7) dp[i + 1][0][1][l | 4] += dp[i][j][k][l];  // +7
            if (7 < d)  dp[i + 1][1][1][l | 4] += dp[i][j][k][l];  // +7
          }
        }
      }
    }
  }

  int ans = dp[len][0][1][7] + dp[len][1][1][7];
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}



int main(){
    fast_io

    ll x,y;
    cin>>x>>y;
    if(x%y==0){
        cout<<-1<<endl;
    }else{
        cout<<x<<endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> n_dist(n, 0);
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			int dist = min({abs(i - j), abs(i - x) + 1 + abs(y - j), abs(i - y) + 1 + abs(x - j)});
			n_dist[dist]++;
		}
	}

	for (int i = 1; i < n; i++) {
		cout << n_dist[i] << endl;
	}
	return 0;
}


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

struct UnionFind{
    vector<int> par;
    vector<int> siz;

    UnionFind(int n): par(n), siz(n){
        for(int i=0; i<n; i++){
            par[i] = i;
            siz[i] = 1;
        }
    }

    int root(int x){
        if(par[x] == x) return x;
        else return par[x] = root(par[x]);
    }

    int size(int x){
        if(par[x] == x) return siz[x];
        else return siz[x] = size(par[x]);
    }

    void unite(int x, int y){
        int rx = root(x), ry = root(y);
        if(rx != ry){
            par[ry] = rx;
            siz[rx] += siz[ry];
        }
    }

    bool same(int x, int y){
        return root(x) == root(y);
    }

};


signed main(){
    // cout << fixed << setprecision(10) << flush;

    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    for(int i=0; i<m; i++){
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }

    int ans = 0;
    for(int i=0; i<m; i++){
        UnionFind uf(n);
        for(int j=0; j<m; j++){
            if(i == j) continue;
            uf.unite(a[j], b[j]);
        }
        ans += (uf.size(0) != n);
    }
    cout << ans << endl;

    return 0;
}

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

int main() {
  string s,t;
  cin >> s >> t;
  int n,m;
  m = t.size();
  n = s.size();
  vector<int> a(n),b(m);
  for(int i=0;i<n;i++){
    a.at(i) = s[i];
  }
  for(int i=0;i<m;i++){
    b.at(i) = t[i];
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  reverse(b.begin(), b.end());
  
  int h = min(n,m);
  int ans = 0;
  for(int i=0;i<h;i++){
    if(a.at(i) > b.at(i)){
      cout << "No" << endl;
      ans = -1;
      break;
    }
    else if(a.at(i) == b.at(i)){
      ans++;
    }
    else {
      cout << "Yes" << endl;
      ans = -1;
      break;
    }
  }
  
  if(ans == h){
    if(n<m) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
  
  return 0;
}


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

int solve(vector<string> const &vs, int &i, int &j){
  //cout << vs[i][j] << endl; // 0..9, +, or *
  if(isdigit(vs[i][j])){
    int res = vs[i][j] - '0';
    //cout << res << endl;
    return res;
  }else if(vs[i][j] == '+'){
    int res = 0;
    i++; j++;
    while(i < vs.size() and vs[i].size() == j+1){
      res += solve(vs, i, j);
      i++;
    }
    i--; j--;
    //cout << res << endl;
    return res;
  }else if(vs[i][j] == '*'){
    int res = 1;
    i++; j++;
    while(i < vs.size() and vs[i].size() == j+1){
      res *= solve(vs, i, j);
      i++;
    }
    i--; j--;
    //cout << res << endl;
    return res;
  }
  assert(false);
}

int main(void){
  while(1){
    int n;
    cin >> n;
    if(!n) break;

    vector<string> vs(n);
    rep(i, n)
      cin >> vs[i];

    int index = 0, depth = 0; // vs[index]の.の数 = depth
    cout << solve(vs, index, depth) << endl;
  }
}


Measured memory_bytes: 3164
#include<iostream>
#include<queue>
#include<map>
#include<cassert>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<cstdlib>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
template<class T> void vp(T &a,int p){rep(i,p)cout << a[i]<<" ";cout << endl;}  
typedef long long ll;
typedef pair<int,int> pii;
enum{IN=0,OUT,BOMB};
class st{
public:
  int x;
  int id;
  int type;
  bool operator<(const st & a)const{
    return x < a.x;
  }
};

const int N = 100000;
bool isodd[N];

ll solve(vector<st> &in,bool flag){
  ll ret=0;
  ll prev=!flag?0:1000000001;
  int cur=0;
  int cnt[2]={0};
  rep(i,in.size()){
    st &now = in[i];
    if (now.type == IN){
      cnt[cur]++;
      isodd[now.id]=cur;
      ret-=abs(now.x-prev);
    }else if (now.type == OUT){
      if (cur == isodd[now.id])ret+=abs(now.x-prev);
      cnt[isodd[now.id]]--;
    }else if (now.type == BOMB){
      ret+=abs(now.x-prev)*cnt[cur];
      prev=now.x;
      cur=1-cur;
    }
  }
  return ret;
}

main(){
  int n,m;
  while(cin>>n>>m){
    vector<pii> tmp(n),a,b;
    vector<int> c(m);
    vector<st> d(m),e;
    rep(i,n)cin>>tmp[i].first>>tmp[i].second;
    rep(i,m){
      cin>>c[i];
      d[i]=(st){c[i],-1,BOMB};
    }
    sort(c.begin(),c.end());
    sort(d.begin(),d.end());
    e=d;
    reverse(d.begin(),d.end());

    ll ans=0;
    rep(i,n){
      if (lower_bound(c.begin(),c.end(),tmp[i].first) == lower_bound(c.begin(),c.end(),tmp[i].second)){
	ans+=abs(tmp[i].first-tmp[i].second);
      }else if (tmp[i].first < tmp[i].second){
	d.push_back((st){tmp[i].first,i,IN});
	d.push_back((st){tmp[i].second,i,OUT});
      }else if (tmp[i].first > tmp[i].second){
	e.push_back((st){tmp[i].first,i,IN});
	e.push_back((st){tmp[i].second,i,OUT});
      }
    }
    sort(d.begin(),d.end());
    sort(e.begin(),e.end());
    reverse(e.begin(),e.end());
    ll ans1=solve(d,false),ans2=solve(e,true);
    cout << ans+ans1+ans2 << endl;
#ifdef DEBUG
    cout <<"end"<<endl;
#endif
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
  long long a = 0;
  long long sum_a = 0;
  long long sum = 0;
  int n = 0;
  
  scanf("%d",&n);
  
  scanf("%lld",&sum_a);
  
  while(--n){
    scanf("%lld",&a);
    sum = (sum + (sum_a * a) % 1000000007) % 1000000007;
    sum_a = (sum_a + a) % 1000000007;
  }
  
  printf("%lld\n",sum);
  
  return 0;
}


Measured memory_bytes: 1736
// #pragma GCC optimize("Ofast,unroll-all-loops")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define all(v) v.begin(), v.end()
#define len(v) ((int)(v).size())
#define pb push_back
#define kek pop_back
#define pii pair<int, int>
#define mp make_pair
#define int ll

#define debug(x) cout << #x << " = " << x << endl;

const int INF = (is_same<int, ll>::value ? 1e18 + 666 : 1e9 + 666);

// const int MEM_SIZE = 1e8;
// char mem[MEM_SIZE];
// int cur_mem_ptr = 0;

// void* operator new(size_t n) {
//     cur_mem_ptr += n;
//     return mem + cur_mem_ptr - n;
// }

// void operator delete(void*) noexcept {}
// void operator delete(void*, size_t) noexcept {}

template<class t1, class t2>
bool cmin(t1 &a, const t2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class t1, class t2>
bool cmax(t1 &a, const t2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifndef LOCAL
void UseFiles(const string &s) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
}
#else
void UseFiles(const string&) {}
#endif

void run();

signed main() {
    // UseFiles("squads");
    iostream::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    run();
}

void run() {
    int n;
    cin >> n;
    int sum = 100;
    int cur = 0;
    while (sum < n) {
        ++cur;
        sum += sum / 100;
    }
    cout << cur << endl;
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n;
    cin >> n;
    vector<i64> a(n), b(n);
    for (auto& e : a) cin >> e;
    for (auto& e : b) cin >> e;

    i64 ap = 0, bp = 0;
    for (i64 i = 0; i < n; i++) {
        if (a[i] == b[i]) continue;
        if (a[i] > b[i]) {
            bp += a[i] - b[i];
        } else {
            if ((b[i] - a[i]) % 2) {
                bp++;
                ap += (b[i] - a[i] + 1) / 2;
            } else {
                ap += (b[i] - a[i]) / 2;
            }
        }
    }

    cout << (bp <= ap ? "Yes" : "No") << endl;
}

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


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

constexpr ll mod = 998244353;
const double PI = acos(-1.0);

ll dp[4001][4001];

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

  string s; cin >> s;
  int n = s.size();
  int nn = 2*n;

  rep(i, 4001) {
    rep(j, 4001) {
      dp[i][j] = 0;
    }
  }

  vector<ll> red(n+1);
  vector<ll> blue(n+1);
  rep(i, n) {
    red[i+1] = red[i];
    blue[i+1] = blue[i];
    if (s[i] == '0') {
      red[i+1] += 2;
    } else if (s[i] == '1') {
      red[i+1]++; blue[i+1]++;
    } else {
      blue[i+1] += 2;
    }
  }

  dp[0][0] = 1;
  for(int i=1; i<=nn; i++) {
    for(int j=0; j<=i; j++) {
      int k = i-j;
      if (j==0 && k==0) continue;
      int tmp = min(n, i);
      //debug(tmp);debug(blue[tmp]);debugln(red[tmp]);
      if (j <= blue[tmp] && k <= red[tmp]) {
        if (j>0) dp[j][k] += dp[j-1][k];
        dp[j][k] %= mod;
        if (k>0) dp[j][k] += dp[j][k-1];
        dp[j][k] %= mod;
        //debug(j);debug(k);debugln(dp[j][k]);
      }
    }
  }

  ll ans = 0;
  for(int j=0; j<=nn; j++) {
    ans += dp[j][nn-j];
    ans %= mod;
  }
  cout << ans << endl;

}


Measured memory_bytes: 125312
import java.util.Scanner;

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

	void run() {
		for (;;) {
			int m = sc.nextInt();
			int n = sc.nextInt();
			if ((m | n) == 0) {
				return;
			}
			int book[] = new int[n];
			int right = 1500000;
			int left = 1;
			int min = Integer.MAX_VALUE;
			for (int i = 0; i < n; i++) {
				book[i] = sc.nextInt();
				left = Math.max(left, book[i]);
			}
			int width = 0;
			int step = 1;
			while (right - left > 1) {
				int mid = (right + left) / 2;
				width = 0;
				step = 1;
				for (int i = 0; i < n; i++) {
					if (width + book[i] <= mid) {
						width += book[i];
					} else {
						width = book[i];
						step++;
					}
				}
				if (step <= m) {
					min = Math.min(min, mid);
					right = mid;
				} else {
					left = mid;
				}
			}
			width = 0;
			step = 1;
			for (int i = 0; i < n; i++) {
				if (width + book[i] <= left) {
					width += book[i];
				} else {
					width = book[i];
					step++;
				}
			}
			if (step <= m) {
				min = Math.min(min, left);
			}
			System.out.println(min);
		}
	}

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

Measured memory_bytes: 20996
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<bitset>
using namespace std;
#define MAXN 300
#define MOD 998244353
int n,m;
bitset<MAXN+5> A[MAXN+5],B[MAXN+5];
int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f; 
}
int fst_pow(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=(1LL*res*a)%MOD;
		a=(1LL*a*a)%MOD;
		b>>=1;
	}
	return res;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		A[i][j]=(read()==1);
	int r=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
		if(A[i][j])
		{
			if(B[j][j])A[i]^=B[j];
			else
			{B[j]=A[i];r++;break;}
		}
	printf("%d",(fst_pow(2,n+m-1)-fst_pow(2,n-r+m-1)+MOD)%MOD);
}

Measured memory_bytes: 384
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意


s = input()+"R"

ans = [0]*(len(s)-1)

now = "L"
r = 0
l = 0
rnow = -1
lnow = -1
for i,c in enumerate(s):
    if now == "R":
        if c == "L":
            rnow = i-1
            lnow = i
            l += 1
        else:
            r += 1
    elif now == "L":
        if c == "R":
            ans[rnow] += (r+1)//2 + l//2
            ans[lnow] += (l+1)//2 + r//2
            r = 1
            l = 0
        else:
            l += 1
#    print(rnow,lnow,r,l)
    
    now = c    

    
    
print(*ans)






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

using namespace std;

int main() {
	int N;
	cin >> N;
	int ans=0;
	if (N / 1000 == 2) {
		ans++;
	}
	N = N % 1000;
	if (N / 100 == 2) {
		ans++;
	}
	N = N % 100;
	if (N / 10 == 2) {
		ans++;
	}
	N = N % 10;
	if (N / 1 == 2) {
		ans++;
	}
	cout << ans;
	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 a = sc.nextInt();
        int b = sc.nextInt();
        int area = a*b;
        int length = (a+b)*2;
        System.out.println(area+ " " +length);
        sc.close();
    }
}



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

#define int long long 
#define pb push_back
#define ff first
#define ss second


int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int k, n;
    cin>>k>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        a[i]=a[i]%k;
    }
     sort(a,a+n);
    
    int ans=INT_MIN;
    for(int i=1;i<n;i++)
        ans=max(ans,(a[i]-a[i-1]));
    ans=max(ans,k+a[0]-a[n-1]);
    
    if(ans==INT_MIN)
        cout<<0;
    else
    cout<<k-ans;
}

Measured memory_bytes: 1792
import fractions

f = lambda n, m : n / m
lcm = lambda a, b : a * b / fractions.gcd(a, b)

a, b, c, d = map(int, raw_input().split())
l = lcm(c, d)

a -= 1
a1 = f(a, c) + f(a, d) - f(a, l)
a2 = f(b, c) + f(b, d) - f(b, l)

print (b - a) - (a2 - a1)


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

int main(){
    int n,x,count;
    while(1){
        count=0;
        scanf("%d %d",&n,&x);
        if((n==0)&&(x==0))break;
        for(int i = 1;i<=n;i++){
            for(int j = i+1;j<=n;j++){
                for(int k = j+1;k<=n;k++){
                    if((i+j+k)==x){
                        count+=1;
                    }
                }
            }
        }
        printf("%d\n",count);
    }
    return 0;
}


Measured memory_bytes: 3196
#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
const int maxn = 1000010;
const int mod = 1e9 + 7;
const int INF = 999999999;
double eps = 1e-8;
typedef long long LL;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1

int n;
int a[maxn];

void solve() {
    for(int i = 1;i <= n;i++) {
        scanf("%d", &a[i]);
    }
    int ans = 0;
    int maxx = n * 2;
    for(int i = 2;i <= n;i++) {
        if(a[i] == a[i - 1]) {
            ans++;
            a[i] = maxx++;
        }
    }
    cout << ans << endl;
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--) { 
        while(cin >> n)
            solve();
    }
    int mark_EOF;
    if(scanf("%d", &mark_EOF) == EOF) return 0;
    return 0;
}

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

#define range 100005
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

int A,B,C;

int E,F,G;
int H;
int main(int argc, char const *argv[])
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("test.txt","r",stdin);
	cin>>A>>B>>C;
	E = A + B;
	F = A - B;
	G = A*B;
	H = max(E,F);
	H = max(H,G);
	cout<<H<<endl;
	return 0;
}

Measured memory_bytes: 256
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n,x = iim()
A = sorted(iil())
count = 0
for i in A:
    x -= i
    count += 1
    if x < 0:
        print(count-1)
        exit()
    elif x == 0:
        print(count)
        exit()
print(count-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
using P = pair<int, int>;
const ll inf =1e9;
const ll mod = 1e9+7;

struct edge{
    int to;
    int cost;
};
using graph = vector<vector<edge>>;

ll binary_tree(ll num){
    ll ans = 0;
    for(int i=0; i<=num; i++){
        ans += pow(2, i);
    }
    return ans;
}

int main(){
    ll h; cin >> h;
    bool divide_ok;
    if(h != 1){
        divide_ok = true;
    }else{
        divide_ok = false;
    }
    ll howmany_div = 1;
    while(divide_ok){
        h = h/2;
        howmany_div += 1;
        if(h == 1){
            divide_ok = false;
        }
    }
    cout << binary_tree(howmany_div-1) << endl;
    return 0;
}

Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

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

ll a[100005];

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ll n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(!a[i])
		{
			cout<<"0"<<endl;
			return 0;
		}
	}
	ll ans=1;
	for(int i=0;i<n;i++)
	{
		if(1000000000000000000/ans>=a[i])
		{
			ans*=a[i];
		}
		else
		{
			cout<<"-1"<<endl;
			return 0;		
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    string str;
    cin >> str;
    long long ans = 0;
    int n = str.size();

    for(int a = 0; a < (1<<n-1); a++){
        string s = "";
        for(int i = 0; i < n; i++){
            s += str[i];
            if(a >> i&1){
                ans += stoll(s);
                s = "";
            }
        }
        ans += stoll(s);
        s = ";";
    }
    cout << ans << endl;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;
typedef tuple<ll,ll,ll,ll> T;


ll i,j,k;


int main(){
   string s,t;
   cin>>s>>t;
   if(s.length()==t.length()-1){
       bool jud=true;
       rep(i,s.length())if(s[i]!=t[i])jud=false;
       if(jud)cout<<"Yes";
       else cout<<"No";

   }
   else cout<<"No";
   cout<<endl;

   
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string S;
    cin>>S;
    vector<bool> ok(3,true);
    int N=S.size();
    int N1=(N-1)/2;
    int N2=(N+3)/2;
    string S1=S.substr(0,N1);
    string S2=S.substr(N2-1);
    rep(i,N) {
        if(S.at(i)!=S.at(N-1-i)) ok.at(0)=false;
    }
    rep(i,N1) {
        if(S1.at(i)!=S1.at(N1-1-i)) ok.at(1)=false;
    }
    rep(i,S2.size()) {
        if(S2.at(i)!=S2.at(S2.size()-1-i)) ok.at(2)=false;
    }
    if(ok.at(0)==true&&ok.at(1)==true&&ok.at(2)==true) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (void) {
    int N = 0;
    int ans = 0;

    scanf("%d", &N);

    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            ans = i * j;
            if ( ans == N ) {
                printf("Yes\n");
                return 0;
            }
        }
    }

    printf("No\n");

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
ll a[200010],cnt=0;
int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>a[i];
	}
	for(int i=1;i<=n;i++) {
		if(a[i]<a[i-1]) {
			cnt-=a[i]-a[i-1];
			a[i]=a[i-1];
		}
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 5192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int H,W,i,j;
  cin >> H >> W;
  vector<char> pix(W + 2);
  for(i = 0; i < W + 2; i++){
  	cout << "#";
  }
  for(i = 0; i < H; i++){
    cout << endl << "#";
    for(j = 0; j < W; j++){
      cin >> pix.at(j);
      cout << pix.at(j);
      
    }
    cout << "#";  
  } 
  cout << endl;
  for(i = 0; i < W + 2; i++){
  	cout << "#";
  }
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
     
     
#define fs first
#define sc second
     
using namespace std;
     
typedef long long ll;
typedef pair<ll, ll> P;
     
     
int main(){
  ll n, m;

  cin >> n >> m;

#ifdef DEBUG
  cout << n << ", " << m << endl;
#endif

  ll a[100100], b[100100], c[100100];

  vector<P> lst;

  for(int i = 0; i < n; ++i){
    cin >> a[i];
    lst.emplace_back(P(a[i], 1));
  }

  for(int i = 0; i < m; ++i){
    cin >> b[i] >> c[i];
    lst.emplace_back(c[i], b[i]);
  }

  sort(lst.begin(), lst.end());
  reverse(lst.begin(), lst.end());

  ll res = 0;
  for(auto y: lst){
    if(n == 0) break;
    //cout << y.fs << ". " << y.sc << endl;
    if(n >= y.sc){
      res += y.fs * y.sc;
      n -= y.sc;
    } else {
      res += y.fs * n;
      n = 0;
    }
  }

  cout << res << endl;
  
  return 0;
}


Measured memory_bytes: 8432
#include<bits/stdc++.h>
using namespace std;
long long a;
int main()
{
	cin>>a;
	if(a<=111)puts("111");
	else if(a<=222)puts("222");
	else if(a<=333)puts("333");
	else if(a<=444)puts("444");
	else if(a<=555)puts("555");
	else if(a<=666)puts("666");
	else if(a<=777)puts("777");
	else if(a<=888)puts("888");
	else if(a<=999)puts("999");
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

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

void solution() {
  int n;
  cin >> n;
  vector<vector<int> > dist(n, vector<int>(n));
  vector<vector<int> > mat(n, vector<int>(n));
  ii pos[n * n];
  int val = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      mat[i][j] = val;
      pos[val++] = ii(i, j);
      dist[i][j] = min(i, n - 1 - i);
      dist[i][j] = min(dist[i][j], min(j, n - 1 - j));
    }
  }

  function<bool(int&, int&)> valid = [&](int& a, int& b) {
    return a >= 0 && b >= 0 && a < n && b < n;
  };

  function<void(ii)> update = [&](const ii x) {
    int dx[] = {1, 0, -1, 0};
    int dy[] = {0, 1, 0, -1};

    for (int i = 0; i < 4; i++) {
      int nx = x.ff + dx[i];
      int ny = x.ss + dy[i];
      if (!valid(nx, ny)) continue;
      if (dist[x.ff][x.ss] + (mat[x.ff][x.ss] != -1) < dist[nx][ny]) {
        dist[nx][ny] = dist[x.ff][x.ss] + (mat[x.ff][x.ss] != -1);
        update(ii(nx, ny));
      }
    }
  };

  int ans = 0;
  for (int i = 0; i < n * n; i++) {
    int x;
    cin >> x;
    x--;
    ans += dist[pos[x].ff][pos[x].ss];
    mat[pos[x].ff][pos[x].ss] = -1;
    update(pos[x]);
  }
  cout << ans << endl;
}

int32_t main() {
  DESYNC;
  solution();
}


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


long long A[10];

int main(){
	int n;
	string s;
	cin >> n;
	for(int i=0;i<n;i++){
		cin >> s;
		if(s[0]=='M') A[0]++;
		if(s[0]=='A') A[1]++;
		if(s[0]=='R') A[2]++;
		if(s[0]=='C') A[3]++;
		if(s[0]=='H') A[4]++;
	}
	
	long long sum=0;
	for(int i=0;i<5;i++){
		for(int j=i+1;j<5;j++){
			for(int k=j+1;k<5;k++){
				sum+=A[i]*A[j]*A[k];
			}
		}
	}
	
	cout << sum << endl;
	return 0;
}

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

int main () {
  int n;
  string s;
  cin>>n;
  cin >>s;
  bool cnt =true;
  if(n%2==0){
    for(int i=0;i<(n/2);i++){
      if(s[i] !=s[i+(n/2)]) {
        cnt =false;
        break;
      }
    }
  }else{
    cout<<"No"<<endl;
    return 0;
  }
  if(cnt ==true) {
    cout<<"Yes"<<endl;
  } else if(cnt ==false){
    cout<<"No"<<endl;
  }
}





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


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

using namespace std;

int main() {
	// your code goes here
	
	int n;
	cin>>n;
	
	string s[n];
	
	for(int i=0;i<n;i++){
		
		cin>>s[i];
		
		sort( s[i].begin(),s[i].end() );
	}	
	map<string,long>m;
	
	for(int i=0;i<n;i++)
		m[s[i]]++;
		
	long long ans=0;	
	for(auto x:m){
		ans+=(x.second * (x.second-1) ) /2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 18176
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);
            int c = int.Parse(s[2]);
            if ((a < b) & (a < c) & (b < c))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 8964
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n, x;
  cin >> n >> x;
  
  vector<int> v(n);
  for(int i; i < n; i++){
    cin >> v.at(i);
  }
  
  int k = 0;
  int l = 0;
  
  while((k <= x) && (l < n)){
    k += v.at(l);
    l++;
  }
  
  if(k <= x)
    l++;
  
  cout << l << endl;
        
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(long long i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "line : " << __LINE__ << " debug" << endl;
#define pb push_back
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 main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N,M;
    cin >> N >> M;
    int A[N],B[N];
    vector<vector<int>> V(M+1);
    priority_queue<int> Q;
    REP(i,N){
        cin >> A[i] >> B[i];
        if(A[i] > M) continue;
        V[A[i]].pb(B[i]);
    }
    ll ans = 0;
    REPP(i,1,M+1){
        REP(j,V[i].size()){
            Q.push(V[i][j]);
        }
        if(!Q.empty()){
            ans += Q.top();
            Q.pop();
        }
    }
    cout <<ans << endl;
}

Measured memory_bytes: 6400
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	ll N, M, ans;

	cin >> N >> M;

	if (N == 1 && M == 1)ans = 1;//cout << 1 << endl;
	else if (N == 1)ans = M - 2;// cout << M - 2 << endl;
	else if (M == 1)ans = N - 2;// cout << N - 2 << endl;
	else ans = (N - 2)*(M - 2);// cout << (N - 2)*(M - 2) << endl;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mst(a,b)    memset((a),(b), sizeof a)
#define lowbit(a)   ((a)&(-a))
#define IOS         ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int maxn=2e3+5;
int n,k,g;
int use[maxn][maxn];
int x[100050],y[100050],bl[100050];
char s[10];
void u3(int x1,int x2,int y1,int y2,int v){
    use[x1][y1]+=v;use[x2+1][y1]-=v;
    use[x1][y2+1]-=v;use[x2+1][y2+1]+=v;
}
void u2(int x1,int x2,int y1,int y2,int v){
    if(y1>=g) u2(x1,x2,y1%g,y2%g,v);
    else if(y1<0||y2>=g){
        u2(x1,x2,(y1+g)%g,g-1,v);
        u2(x1,x2,0,y2%g,v);
    }else{
        u3(x1,x2,y1,y2,v);
    }
}
void u1(int x1,int x2,int y1,int y2,int v){
    if(x1>=g) u1(x1%g,x2%g,y1,y2,v);
    else if(x1<0||x2>=g){
        u1((x1+g)%g,g-1,y1,y2,v);
        u1(0,x2%g,y1,y2,v);
    }else u2(x1,x2,y1,y2,v);
}
void cal(){
    for(int i=0;i<g;++i){
        for(int j=1;j<g;++j)use[i][j]+=use[i][j-1];
    }
    for(int j=0;j<g;++j){
        for(int i=1;i<g;++i)use[i][j]+=use[i-1][j];
    }
}
int main(){
#ifdef local
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
    scanf("%d%d",&n,&k);
    g=k*2;
    for(int i=1;i<=n;++i){
        scanf("%d%d",&x[i],&y[i]);
        x[i]=(x[i]%g+g)%g;y[i]=(y[i]%g+g)%g;
        scanf("%s",s);
        bl[i]=(s[0]=='B'?1:-1);
    }
    for(int i=1;i<=n;++i){
        if(bl[i]!=1)u3(0,g-1,0,g-1,1);
        int x1=x[i]-k+1,x2=x[i],y1=y[i]-k+1,y2=y[i];
        u1(x1,x2,y1,y2,bl[i]);
        x1+=k,x2+=k,y1+=k,y2+=k;
        u1(x1,x2,y1,y2,bl[i]);
    }
    cal();
    int ans=0;
    for(int i=0;i<g;++i)for(int j=0;j<g;++j)ans=max(ans,use[i][j]);
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 17152
/*why so serious?*/
#include<bits/stdc++.h>
using namespace std;
#define   int      long long
#define   fast()   ios_base::sync_with_stdio(0);cin.tie(0)
#define   all(x)   x.begin(),x.end()
#define   pb       push_back
#define   F        first
#define   S        second

int f(int n)
{int a[]={n,1,n+1,0};
 return a[n%4];
}

int32_t main()
{int a,b;
 cin>>a>>b;
 if(a==0)
 cout<<f(b);
 else
 cout<<((f(b))^(f(a-1)));
 return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	priority_queue<double , vector<double> , greater<double> >pt;
	double a,b,sum=0;
	for(int i=0;i<n;i++){
		scanf("%lf",&a);
		pt.push(a);
	}
	while(pt.size()>1){
		a=pt.top();
		pt.pop();
		b=pt.top();
		pt.pop();
		sum=(a+b)/2.0;
		pt.push(sum);
	}
	printf("%lf\n",sum);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
//    int a = sc.nextInt();  // input Integer
    String a = sc.next();  // input String
    if (a.equals("A")){
      System.out.println("T");
    } else if (a.equals("T")){
      System.out.println("A");
    } else if (a.equals("C")){
      System.out.println("G");
    } else {
      System.out.println("C");
    }
  }
}

Measured memory_bytes: 20564
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

k = inp()
res = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        xx = gcd(i,j)
        for l in range(1,k+1):
            res += gcd(xx,l)
print(res)

Measured memory_bytes: 10500
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>

#define pai 3.1415926535

int main(void) {
	int N;
	scanf("%d", &N);
	int H[100000];
	for (int i = 0; i < N; i++) {
		scanf("%d", &H[i]);
	}
	int count = 0;
	int max = 0;
	for (int i = 0; i < N-1; i++) {
		if (H[i] >= H[i + 1]) {
			count++;
		}
		else {
			count = 0;
		}

		if (count > max) {
			max = count;
		}
	//	printf("%d\n", count);
		
	}
	printf("%d\n", max);


	return 0;
}

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <math.h>
#include <time.h>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include <iterator>
#include <algorithm>

using namespace std;

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

#define PI M_PI
#define INF 1000000000
#define MOD 1000000007;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<bool>> vvb;



int main()
{
	ll N, Z, W;
	cin >> N >> Z >> W;
	vll a(N);
	rep(i, N) cin >> a[i];
	int ans;

	if (N == 1)
	{
		ans = abs(a[0] - W);
	}
	else
	{
		ans = max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1]));
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void){
    int N;
    string ans = "APPROVED";
    cin >> N;
    
    int A[N];
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }

    for(int i = 0; i < N; i++){
        if(A[i]%2 == 0){
            if(A[i]%3 != 0 && A[i]%5 != 0){
                ans = "DENIED";
            }
        }
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
	int a, b;
	cin >> a;
	cin >> b;

	int sum = a + b;

	if (sum % 2 == 0)
	{
		int k = sum / 2;
		cout << k;
	}
	else
	{
		cout << "IMPOSSIBLE";
	}


	return 0;
}

Measured memory_bytes: 256