akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)

int N;
map<int, int> m;

bool ok() {
  auto it = m.find(0);
  int n0 = (it == m.end() ? 0 : (*it).second);
  if(n0 == N) return true;
  if(N % 3) return false;
  if(m.size() == 2 && n0 == N / 3) return true;
  if(m.size() == 3) {
    int res = 0;
    for(auto& kv: m) {
      if(kv.second != N/3) return false;
      res ^= kv.first;
    }
    return res == 0;
  }
  return false;
}

int main () {
  cin >> N;

  rep(i,N) {
    int a;
    cin >> a;
    m[a] += 1;
  }

  cout << (ok() ? "Yes" : "No") << endl;
  return 0;
}


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

int x[128];
int y[128];


bool ok(const string &password) {
	int cx = x[password[0]];
	int cy = y[password[0]];

	for(int i = 1; i < static_cast<int>(password.size()); ++i) {
		int nx = x[password[i]];
		int ny = y[password[i]];

		if(abs(cx - nx) + abs(cy - ny) != 1) return false;
		cx = nx;
		cy = ny;
	}

	return true;
}

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

	for(int i = 0; i <= 9; ++i) {
		x['A' + i] = i % 3;
		y['A' + i] = i / 3;
	}

	for(int i = 0; i < 1000; ++i) {
		string password;
		cin >> password;

		if(ok(password)) {
			cout << password << endl;
		}
	}

	return EXIT_SUCCESS;
}

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

int main() {
    int r,c;
    scanf("%d%d", &r,&c);
    // 二次元配列
    vector<int> gyou(c+1,0);
    vector<vector<int>> hyou(r+1,gyou);

    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            scanf("%d", &hyou.at(i).at(j));
            hyou.at(i).at(c) += hyou.at(i).at(j);
            hyou.at(r).at(j) += hyou.at(i).at(j);
        }
        hyou.at(r).at(c) += hyou.at(i).at(c);
    }
    for (int i = 0; i < r+1; i++) {
        for (int j = 0; j < c+1; j++) {
            printf("%d", hyou.at(i).at(j));
            if (j != c) {
                printf(" ");
            } else {
                printf("\n");
            }
        }
    }
}


Measured memory_bytes: 3296
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long mod = 998244353;
long long N, S;
long long A[1 << 18];
long long dp[3009][3009];

int main() {
	cin >> N >> S;
	for (int i = 1; i <= N; i++) cin >> A[i];
	
	long long val = 1;
	for (int i = 1; i <= N; i++) { val *= 2LL; val %= mod; }

	dp[0][0] = val;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= S; j++) {
			if (dp[i - 1][j] == 0) continue;
			dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
			if (j + A[i] <= S) {
				long long f = dp[i - 1][j]; if (f % 2 == 1) f += mod;
				f /= 2LL;
				dp[i][j + A[i]] += f;
				dp[i][j + A[i]] %= mod;
			}
		}
	}

	cout << dp[N][S] << endl;
	return 0;
}

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

int selection(vector<int> &v) {
  int n = 0;
  for (int i = 0; i < v.size(); i++) {
    int mini = i;
    for (int j = i; j < v.size(); j++) {
      if (v[j] < v[mini]) {
        mini = j;
      }
    }
    if (i != mini) {
      swap(v[i], v[mini]);
      n++;
    }
  }
  return n;
}

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  int num = selection(v);
  for (int i = 0; i < N; i++) {
    cout << v.at(i);
    if (i != N-1) cout << " ";
  }
  cout << endl;
  cout << num << endl;
}


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

bool is_good(int x) {
    map<int,int> mp;
    while (x > 0) {
        int res = x % 10;
        x /= 10;
        mp[res]++;
    }
    if (mp[3] > 0 && mp[5] > 0 && mp[7] > 0 && mp.size() == 3) {
        return true;
    }  
    else return false;
    return 0;
}

int ans;
int n;
void dfs(int x) {
    if (x > n) return;
    if (is_good(x)) ans++;

    if (x < 1e8) {
        dfs(10*x+3);
        dfs(10*x+5);
        dfs(10*x+7);
    }
}

int main() {
    cin >> n;
    dfs(0);
    cout << ans << endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import io
import sys
import math

def main():
    s = input()
    
    ans = "A" if s.lower() != s else "a"
    print(ans)

### DEBUG I/O ###
_INPUT = """\
1
"""
_DEB = 0   # 1:ON / 0:OFF

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    main()

Measured memory_bytes: 9076
N,K = map(int,input().split())
list = [list(map(int,input().split())) for i in range(N)]
a = {}
for l in list:
  if l[0] not in a:
    a[l[0]] = l[1]
  else:
    a[l[0]] += l[1]
a = sorted(a.items(), key=lambda x:x[0])
c = 0
for b in a:
  c += b[1]
  ans = b[0]
  if c >= K: break
print(ans)

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/27  Problem: 072_arc_b / Link: https://abc059.contest.atcoder.jp/tasks/arc072_b?lang=en  ----- */
/* ------問題------

AliceとBrownはゲームをするのが好きです。今日は以下のゲームを思いつきました。
2つの山があり、はじめにX,Y個の石が置かれています。 AliceとBrownは毎ターン以下の操作を交互に行い、操作を行えなくなったプレイヤーは負けとなります。
片方の山から 2i 個の石を取り、そのうち i 個の石を捨て、残りの i 個の石をもう片方の山に置く。ここで、整数 i(1≦i) の値は山に十分な個数の石がある範囲で自由に選ぶことができる。
Aliceが先手で、二人とも最適にプレイすると仮定したとき、与えられた X,Y に対しどちらのプレイヤーが勝つか求めてください。

-----問題ここまで----- */
/* -----解説等-----

(0,0),(0,1),(1,0),(1,1)は負けの盤面
またそれ以外の任意の盤面は(a,a±1)みたいなところに移動できる。
したがってこれらは負け

----解説ここまで---- */

LL X,Y;

LL ans = 0LL;

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

	cin >> X>>Y;

	cout << (abs(X-Y)<2?"Brown":"Alice") << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
using namespace std;
#define MAX 200000

int main(int, char**)
{
    int n, k, c;
    string s;

    cin >> n >> k >> c;
    cin >> s;

    int l[MAX], r[MAX];
    int intvl, count;
    intvl = c;
    count = 0;
    for (int i = 0; count < k && i < n; i++) {
        if (s[i] == 'x' || intvl < c) intvl++;
        else {
            l[count] = i;
            intvl = 0;
            count++;
        }
    }
    intvl = c;
    count = 0;
    for (int i = n-1; count < k && i >= 0; i--) {
        if (s[i] == 'x' || intvl < c) intvl++;
        else {
            r[k-count-1] = i;
            intvl = 0;
            count++;
        }
    }
    for (int i = 0; i < k; i++) {
        if (l[i] == r[i]) cout << l[i] + 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3332
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

long digit(long n)
{
    int d = 0;
    while (n > 0) {
        ++d;
        n /= 10;
    }
    return d;
}

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

    int ans = digit(n);
    for (long a = 1; a*a <= n; ++a) {
        if (n % a == 0) {
            long c = n / a;
            int d = digit(c);
            if (d < ans) {
                ans = d;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=a*c;
    //ans=max(ans,a*c);
    ans=max(ans,b*c);
    ans=max(ans,a*d);
    ans=max(ans,b*d);
    cout<<ans;
}

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

typedef long long int llint;

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

  int mx = 0;

  mx = max(a + b, a - b);

  mx = max(mx, a * b);

  cout<< mx <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int prime[1000011];
memset(prime,0,sizeof(prime));
for(int i=2;i<=1000000;i++){
	if(prime[i]==0){ for(int j=i;j<=1000000;j = j+i){
    	if(prime[j]==0){prime[j] = i;}
    }}
}
int n=0,z=0,x=0,arr[1000011],q=1;
memset(arr,0,sizeof(arr));
cin >> n;
for(int i=0;i<n;i++){
cin >> z;
//if(z==1){continue;}
//else{
  	if(x==0){x = z;}
	else x = __gcd(x,z);
  	//if(x!=1){}
  	set<int> p;
  	while(z>1){
    	p.insert(prime[z]);
      	z /= prime[z];
    }
  	for(auto k : p){
    	if(arr[k]){q=0;}
      	arr[k] = 1;
    }
//}
}
if(q){cout <<"pairwise coprime"<<endl;}
else if(x==1){cout << "setwise coprime"<<endl;}
else cout <<"not coprime"<<endl;
}

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	string s;
	cin >> s;
	SORT(s);
	if(s=="abc"){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}


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

ll dp[200005][4];
ll INF = 1e+18;

int main(){
	ll n;
	cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a[i];
	ll k = 1 + n % 2 ;
	rep(i,n+1)rep(j,k+1) dp[i][j] = -INF;
	dp[0][0] = 0;
	rep(i,n){
		rep(j,k+1){
			dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]);
			ll now = dp[i][j];
			if((i+j)%2 == 0) now += a[i];
			dp[i+1][j] = max(dp[i+1][j], now);
		}
	}
	ll ans = dp[n][k];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11184
#diverta 2019 Programming Contest 2 -C Successive Subtraction
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))

lst1.sort()
lst2 = []
l,r = lst1[0],lst1[-1]
for i in range(1,n-1):
    mid = lst1[i]
    if mid < 0:
        lst2.append([r,mid])
        r -= mid
    else:
        lst2.append([l,mid])
        l -= mid
lst2.append([r,l])
print(r-l)
for i in lst2:
    print(*i)

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

int main() {
  string s;cin>>s;
  int cnt=0;
  rep(i,s.size()){
    if(s[i]=='2')cnt++;
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3628
fun main(arr:Array<String>) {
    val n = readLine()!!.toLong()
    var ans = n.toString().length
    for(i in (1..n)) {
        if(i*i>n) {
            break
        }
        if(n%i !=0L) {
            continue
        }
        ans = (n/i).toString().length
    }
    println(ans)
}


Measured memory_bytes: 31900
#include<stdio.h>
#include<string.h>
#define M 1046527
#define NIL (-1)
#define L 14
char H[M][L];
int getChar(char ch){
  if(ch=='A') return 1;
  else if(ch=='C') return 2;
  else if(ch=='G') return 3;
  else if(ch=='T') return 4;
  else return 0;
}
long long getKey(char str[]){
  long long sum=0,p=1,i;
  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }
  return sum;
}
int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}
int find(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0; ;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0) return 0;
  }
  return 0;
}
int insert(char str[]){
  long long key,i,h;
  key=getKey(str);
  for(i=0; ;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0) return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}
int main(){
  int i,n,h;
  char str[L],com[9];
  for(i=0;i<M;i++) H[i][0]='\0';
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s %s",com,str);
    if(com[0]=='i') insert(str);
    else{
      if(find(str)) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

Measured memory_bytes: 14916
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    int ans = 0, p = 1;
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        if(a == p){
            p++;
        }else{
            ans++;
        }
    }
    cout << (p > 1 ? ans : -1) << endl;
}

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


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

struct edge {int to, cost; };

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

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

ll LCM(ll a, ll b){
  if(a<b) swap(a,b);
  return a/GCD(a,b)*b;
}

int par[200005];
int rank_[200005];
void init(int n){
  for(int i=0; i<n; i++){
    par[i] = i;
    rank_[i] = 1;
  }
}

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

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x==y) return;
  if(rank_[x]<rank_[y]){
    par[x]=y;
    rank_[y] += rank_[x];
    rank_[x] = rank_[y];
  }else{
    par[y]=x;
    rank_[x] += rank_[y];
    rank_[y] = rank_[x];
  }
}

int main(){
  string s;
  cin >> s;
  if(s[s.size()-1]=='s') s += "es";
  else s += "s";
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n; ll mat[100001][3]; ll dp[100001][3];
int main() {
    int i,j,sum;
	cin>>n;
	for(i=1;i<=n;i++){
	    cin>>mat[i][0]>>mat[i][1]>>mat[i][2];
	    dp[i][0]=mat[i][0]+max(dp[i-1][1],dp[i-1][2]);
	    dp[i][1]=mat[i][1]+max(dp[i-1][0],dp[i-1][2]);
	    dp[i][2]=mat[i][2]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
}


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

int main() {
	long long	 a, b;
	long long	 tmp, r;
	cin >> a >> b;
long long	x = a * b;

	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	cout << x/b << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
//#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.1415926535
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;

//根から全頂点への距離
void distfroot(vvl &edges,vl &dist,ll now,ll depth){
    if(dist[now] != -1) return;
    dist[now] = depth;
    for(ll next:edges[now]){
        distfroot(edges,dist,next,depth+1);
    }
}

//頂点からtargetへの道
bool mitifroot(vvl &edges,vl &miti,ll now,ll prev,ll target){
    cout<<now<<" "<<prev<<endl;
    if(now == target) {
        miti.push_back(now);
        return true;
    }
    for(ll next:edges[now]){
        if(next == now) continue;
        if(mitifroot(edges,miti,next,now,target) == true){
            miti.push_back(now);
            return true;
        }
    }
    return false;
}

ll comb(ll a,ll b){
    if(a<b) return 0;
    if(a == b) return 1;
    ll ue = 1,sita = 1;
    rep(i,b){
        sita *= (i+1);
        ue *= a--;
        if(ue%sita == 0){
            ue /= sita;
            sita = 1;
        }
    }
    return ue/sita;
}

int main(void){
    ll n,a,b;
    cin>>n>>a>>b;
    vl v(n);
    rep(i,n) cin>>v[i];
    sort(all(v));
    reverse(all(v));
    ll sum = 0;
    rep(i,a) sum += v[i];
    ll allkosu = count(all(v),v[a-1]);
    ll nakakosu = 0;
    ll ans = 0;
    rep(i,a) if(v[i] == v[a-1]) nakakosu++;
    if(v[a-1] == v[0]){
        rep(i,min(b-a+1,allkosu-nakakosu+1)){
            ans += comb(allkosu,nakakosu+i);
        }
    }
    else{
        ans = comb(allkosu,nakakosu);
    }
    cout<<(double)sum/a<<endl;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[])
{
    int a = 0, b = 0, k = 0, res = 0, count = 0, div = 0;

    scanf("%d %d %d", &a, &b, &k);

    if (a % b == 0) {
        for (int i = b; i >= 1; i--) {
            if (count == k) {
                break;
            }
            if ((a % i) == 0 && (b % i) == 0) {
                count++;
                res = i;
            }
        }
        printf("%d\n", res);
    } else if (b % a == 0) {
        for (int i = a; i >= 1; i--) {
            if (count == k) {
                break;
            }
            if ((a % i) == 0 && (b % i) == 0) {
                count++;
                res = i;
            }
        }
        printf("%d\n", res);
    } else {
        for (int i = 100; i >= 1; i--) {
            if (count == k) {
                break;
            }
            if ((a % i) == 0 && (b % i) == 0) {
                count++;
                res = i;
            }
        }
        printf("%d\n", res);
    }
    return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector <ll> a(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> a[ii];
	}
	vector <ll> b(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> b[ii];
	}

	ll opNumA = 0;
	ll opNumB = 0;
	for (int ii = 0; ii < N; ++ii){
		if (a[ii] <= b[ii]){
			opNumA += (b[ii] - a[ii]) / 2;
		} else {
			opNumB += a[ii] - b[ii];
		}
	}

	if (opNumA >= opNumB){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;		
	}


	return 0;
}


Measured memory_bytes: 384
def solve(h, str)
  pics = []
  h.times do |i|
    pics << str[i]
    pics << str[i]
  end
  pics
end

if $PROGRAM_NAME == __FILE__
  str = []
  h, w = gets.chomp.split(' ').map(&:to_i)
  h.times { str << gets.chomp }
  picture = solve(h * 2, str)
  (h * 2).times { |i| puts picture[i] }
end

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

int main(){
    int n,m;
    cin>>n>>m;
    int a[n];
    for(i=0;i<n;i++)cin>>a[i];
    int total=0;
    for(i=0;i<n;i++)total+=a[i];
    int s=0;
    for(i=0;i<n;i++){
    	if(a[i]>=total/4.0/m)s++;
	}
	if(s>=m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

typedef long long ll;
using namespace std;
const ll INF = 1e12L + 5;

int main()
{
    ll n,w,sum_val=0,ans=0;
    scanf("%lld %lld",&n,&w);
    ll val[n],wgt[n];
    
    for(int i=0;i<n;i++)
    {
        scanf("%lld %lld",wgt+i,val+i);
        sum_val += val[i];
    }

    vector <ll> dp(sum_val+1,INF);
    dp[0] = 0;

    for(int i=0;i<n;i++)
    {
        for(int j=sum_val-val[i];j>=0;j--)
        {
            dp[j+val[i]] = min(dp[j+val[i]],dp[j]+wgt[i]);
        }
    }
    for(int i=0;i<=sum_val;i++)
    {
        if(dp[i]<=w)
            ans = max(ans, (ll)i);
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 1024
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let s = read_as_string().chars().collect::<Vec<char>>();

    let mut i = 0;
    if s.len()%2 != 0{
        println!("No");
        return;
    }

    while i + 1 < s.len(){
        if s[i] != 'h' || s[i+1] != 'i'{
            println!("No");
            return;
        }
        i += 2;
    }

    println!("Yes");
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int BinarySearch(int A[], int n, int key){
    int left = 0;
    int right = n;
    while(left < right){
        int mid = (left+right) / 2;
        if(A[mid] == key) 
            return 1;
        if(A[mid] > key) 
            right = mid;
        else if(A[mid] < key)
            left = mid + 1;
    }
    return 0;
}
int main(){
    int n, q, key, cnt;
    cin >> n;
    int S[n];
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
    cin >> q;
    for(int j = 0; j < q; j++){
        cin >> key;
        if( BinarySearch(S, n, key) ) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3492
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000;

using namespace std;

int main(void) {
	long long int h, w;
	long long int s1, s2, s3;
	long long int hc, wc;
	long long int maxi = 0, mini = 10000000000000;
	long long int smin = 10000000000000;
	cin >> h >> w;
	if ((h % 3 == 0) || (w % 3 == 0)) {
		smin = 0;
	}
	else if ((h == 2) || (w == 2)) {
		smin = 1;
	}
	
	else {
		wc = w / 2;
		FOR(i, 1, h - 1) {
			maxi = 0, mini = 1000000000000;
			s1 = wc*i;
			s2 = (w - wc)*i;
			s3 = w*(h - i);
			//cout << s1 << " " << s2 << " " << s3 << endl;
			maxi = max(maxi, s1);
			maxi = max(maxi, s2);
			maxi = max(maxi, s3);
			mini = min(mini, s1);
			mini = min(mini, s2);
			mini = min(mini, s3);
			smin = min(smin, maxi - mini);
			//cout << smin << endl;
		}
		hc = h / 2;
		FOR(i, 1, w - 1) {
			maxi = 0, mini = 1000000000000;
			s1 = h*i;
			s2 = (w - i)*hc;
			s3 = (w - i)*(h - hc);
			//cout << s1 << " " << s2 << " " << s3 << endl;
			maxi = max(maxi, s1);
			maxi = max(maxi, s2);
			maxi = max(maxi, s3);
			mini = min(mini, s1);
			mini = min(mini, s2);
			mini = min(mini, s3);
			smin = min(smin, maxi - mini);
			//cout << smin << endl;
		}
		FOR(i, w/3-1, w/2) {
			FOR(t, i+1, w*2/3+1) {
				maxi = 0, mini = 1000000000000;
				s1 = h*i;
				s2 = (t - i)*h;
				s3 = (w - t)*h;
				//cout << s1 << " " << s2 << " " << s3 << endl;
				maxi = max(maxi, s1);
				maxi = max(maxi, s2);
				maxi = max(maxi, s3);
				mini = min(mini, s1);
				mini = min(mini, s2);
				mini = min(mini, s3);
				smin = min(smin, maxi - mini);
				//cout << smin << endl;
			}
		}
		FOR(i, h/3-1, h/2) {
			FOR(t, i + 1, h*2/3+1) {
				maxi = 0, mini = 1000000000000;
				s1 = w*i;
				s2 = (t - i)*w;
				s3 = (h - t)*w;
				//cout << s1 << " " << s2 << " " << s3 << endl;
				maxi = max(maxi, s1);
				maxi = max(maxi, s2);
				maxi = max(maxi, s3);
				mini = min(mini, s1);
				mini = min(mini, s2);
				mini = min(mini, s3);
				smin = min(smin, maxi - mini);
				//cout << smin << endl;
			}
		}
	}
	cout << smin << endl;
	return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let xs: Vec<usize> = (0..n).map(|_| sc.cin()).collect();

    use std::collections::BinaryHeap;
    let mut a = BinaryHeap::from(xs.clone());
    let top1 = a.pop().unwrap();
    let top2 = a.pop().unwrap();

    for i in 0..n {
        put!(if xs[i] == top1 {
            top2
        } else {
            top1
        });
    }
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


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

int main()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;

    transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
    transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
    transform(s3.begin(), s3.end(), s3.begin(), ::toupper);
    cout << s1[0] << s2[0] << s3[0] << endl;

    return 0;
}


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

int main()
{
    std::string S;
    std::cin >> S;

    for (int i = 0; i < 4; i++){
        int count = 0;
        for (int j = 0; j < 4; j++){
            if (S[i] == S[j]){ count++; }
        }

        if(count != 2){
            std::cout << "No" << std::endl;
            return 0;            
        }
    }

    std::cout << "Yes" << std::endl;

    return 0;
}

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


void solve(long long N, std::vector<long long> A){
    sort(A.begin(),A.end(),greater<int>());
    long long ans = 0;
    int cnt = 1;
    int now = 0;
    for(int i=1;i<N;++i)
    {
        ans += A[now];
        cnt++;
        if(cnt == 2)
        {
            now++;
            cnt = 0;
        }
    }
    cout<<ans<<endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4796
S = input()

s_1 = [S[i] for i in range(len(S)) if i % 2 == 0]
s_2 = [S[i] for i in range(len(S)) if i % 2 == 1]

ct_s1_0 = s_1.count('0')
ct_s1_1 = s_1.count('1')
ct_s2_0 = s_2.count('0')
ct_s2_1 = s_2.count('1')

count_1 = ct_s1_0 + ct_s2_1
count_2 = ct_s1_1 + ct_s2_0

print(min(count_1, count_2))


Measured memory_bytes: 3956
#!/usr/bin/env python3
from itertools import product
n, m, x = map(int, input().split())
c = []
a = []
for o in range(n):
    _ = list(map(int, input().split()))
    c.append(_[0])
    a.append(_[1:])
ans = 10**100
for p in product([0, 1], repeat=n):
    skill = [0] * m
    cost = 0
    for i in range(n):
        if p[i]:
            for j in range(m):
                skill[j] += a[i][j]
            cost += c[i]
    if min(skill) >= x:
        ans = min(ans, cost)
if ans == 10**100:
    print(-1)
else:
    print(ans)


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

int main()
{
  int a, b,c,d;
  cin >> a >> b >> c >> d;
  
  if(abs(a-c)<=d || (abs(a-b)<=d && abs(b-c) <= d))
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
    
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int main(){
    int n;
    cin >> n;
    map<int, int> m;
    vi a(n);
    rep(i, n-1){
        cin >> a[i+1];
        m[a[i+1]]++;
    }
    rep(i, n){
      cout << m[i+1] << endl;
    }
    return 0;
}

Measured memory_bytes: 13564
#include<bits/stdc++.h>
using namespace  std;
int main ()
{
	int n,m;
	cin>>n>>m;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(i+j==n && i*2+j*4==m)
			{
				cout<<"Yes";
				return 0;
			}
		}
	}
	cout<<"No";
	return 0;
} 

Measured memory_bytes: 3572
#include<iostream>

using namespace std;


int main(){

	long long N,Y,a,b,c,temp;

	bool flag=0;

	cin >> N >> Y;

	for(int k=0; k<=N; k++){

		for(int j=0; j<=N-k; j++){

			for(int i=0; i<=N-k-j; i++){

				//cout<< k <<" " << j <<" " <<i << " " << k*10000+j*5000+i*1000 << " " <<k+j+i<<endl;

				if(i*10000+j*5000+k*1000 == Y && k+j+i == N){
					
					flag=1;

					a=k;
					b=j;
					c=i;
					break;
				}

			}
		}
	}

	if(flag==1) cout<< c <<" " << b <<" " <<a <<endl;

	else cout <<-1 <<" " <<-1 << " " <<-1 << endl;




}

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

using namespace std;

typedef pair<int,int> pii;
typedef vector<int> vi;

int main () {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    bool taka_turn = true;
    while (a > 0 && c > 0) {
        if (taka_turn) {
            c -= b;
            taka_turn = false;
        } else {
            a -= d;
            taka_turn = true; 
        }
    }
    if (a > 0) {
        cout << "Yes" << endl;
    } else {
       cout << "No" << endl; 
    }
    return 0;
}

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

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

	bool yes = false;
	for (int i = 1; i < 10; ++i) {
		for (int j = 1; j < 10; ++j) {
			if (n == i * j) {
				yes = true;
			}
		}
	}

	if (yes) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,c,k;
  cin >> n >> c >> k;
  vector<int> t(n);
  for(int i=0;i<n;i++)cin>>t[i];
  sort(t.begin(),t.end());
  int tmp=t[0],ans=0,cnt=0;
  for(int i=0;i<n;i++){
    cnt++;
    if(t[i]>tmp+k){
      ans++;
      cnt=1;
      tmp=t[i];
    }
    if(cnt==c){
      ans++;
      cnt=0;
      if(i<n-1)tmp=t[i+1];
    }
  }
  if(cnt)ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
n = gets.to_i
a = gets.split.map(&:to_i)
ans = 10**15 
sums = Array.new(n+1,0)
for i in 0..n-1
	sums[i+1] = sums[i]+a[i]
end
x = 1
y = 3
p = a[0]
q = 0
r = a[2]+a[1]
s = sums[n]-sums[3]
for c in 2..n-1
	r -= a[c-1]
	q += a[c-1]
	while (p-q).abs > (p-q+a[x]*2).abs
		p += a[x]
		q -= a[x]
		x += 1
	end
	while (s-r).abs > (s-r-a[y]*2).abs
		r += a[y]
		s -= a[y]
		y += 1
	end
	t = [p,q,r,s].sort
	ans = t[3]-t[0] if ans > t[3]-t[0]
end
puts ans

Measured memory_bytes: 24596
def f(e):
 a=[list(map(int,input().split()))for _ in[0]*int(e)]
 b=[list(map(int,input().split()))for _ in[0]*int(input())]
 for s,t in b:
  u,v=a[0]
  x,y=s-u,t-v
  for u,v in a:
   if[u+x,v+y]not in b:break
  else:return print(x,y)
for e in iter(input,'0'):f(e)


Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    vector <long long int> cards (N);
    long long int sum = 0;
    long long int ans = LONG_MAX;
    for(int i = 0; i < N; i++){
        long long int z;
        cin >> z;
        if(i==0){
            cards[i] = z;
        }else{
            cards[i] = (z+cards[i-1]);
        }
        sum = cards[i];
    }
//    cout << sum << "\n";
    for(int i = 0; i < N-1; i++){
        long long int a = cards[i];
        long long int b = sum-a;
  //      cout << a << " " << b << "\n";
        ans = min(ans, abs(a-b));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1792
n = gets.chomp.to_i
n.times do 
    input_data = gets.chomp.split(" ")
    y = input_data[0].to_i
    m = input_data[1].to_i
    d = input_data[2].to_i
    
    x = 1000 - y
    totalY = x * 20 * 10
    # p totalY
    
    count = 0
    (y..1000).each do |i|
        if i % 3 == 0
            count += 1
        end
    end
    # p count
    subY = 1000 - y -count
    subY = subY * 5
    # p subY
    
    x = 0
    if y % 3 != 0
        (1..m - 1).each do |i|
            if i % 2 == 0
                x += 1
            end
        end
    end
    # p x
    
    subM = ((1 - m) * 20) + x
    # p subM
    
    subD = 1 - d
    # p subD
    
    sum = totalY - subY + subM + subD
    p sum
end


Measured memory_bytes: 6868
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void){
    string s;
    int ans = 753;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    REP(i, s.length() - 2) {
        ans = min(ans, abs(753 - stoi(s.substr(i, 3))));
    }
    
    cout << ans << "\n";
    return 0;
}


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

using namespace std;
int a[100];
int main() {
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0 ) {
                cout << "DENIED\n";
                return 0;
        }
    }
    cout << "APPROVED\n";
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement
N, M, Q = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
for pattern in combinations_with_replacement(range(1, M + 1), N):
    tmp_ans = 0
    pattern = list(pattern)
    for a, b, c, d in X:
        if pattern[b - 1] - pattern[a - 1] == c:
            tmp_ans += d
    ans = max(ans, tmp_ans)

print(ans)

Measured memory_bytes: 9096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	while (k && (a >= b)) {
		b *= 2;
		k--;
	}
	while (k && (b >= c)) {
		c *= 2;
		k--;
	}
	if (a < b && b < c) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
typedef long long int LLI;
int main()
{
  	string a, b, c;
  	cin >> a >> b >> c;
  	if( a[a.size()-1] == b[0] and b[b.size()-1] == c[0] )
      cout << "YES";
  	else
      cout << "NO";
	return 0;
}

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

#define fastio                  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define input_output            freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 

#define ll                      long long
#define read1(x)                 cin>>x
#define read2(x,y)               cin>>x>>y
#define print(x)				cout<<x<<endl
#define pii                     pair<int, int>
#define pli                     pair<ll, int>
#define pil                     pair<int, ll>
#define pll                     pair<ll, ll>
#define vi                      vector<int>
#define vll                     vector<ll>
#define vb                      vector<bool>
#define vd                      vector<double>
#define vs                      vector<string>
#define ff                      first
#define ss                      second
#define pb                      push_back
#define ppb                     pop_back
#define pf                      push_front
#define ppf                     pop_front
#define vpii                    vector<pii>
#define umap                    unordered_map
#define uset                    unordered_set
#define clr(a,b)                memset(a,b,sizeof a)
#define all(ds)                 ds.begin(), ds.end()
#define rev(ds)                 ds.rbegin(), ds.rend()
#define asc(A)                  sort(A.begin(), A.end())
#define dsc(A)                  sort(A.begin(), A.end(), greater<int>())
#define gcd(x,y)                __gcd(x,y)
#define clr(a,b)                memset(a,b,sizeof a)
#define fr(i, n)                for(int i=0; i<n;++i)
#define fr1(i, n)               for(int i=1; i<=n; ++i)
#define rfr(i, n)               for(int i=n-1; i>=0; --i)
#define printVector(v)          for(int i= 0;i<v.size();i++) {cout<<v[i]<<" ";} cout<<endl;
#define precise(x)              cout<<fixed<<setprecision(x)
#define inf                     10000000000000

 

ll lcm(ll a, ll b) {return (a*b)/__gcd(a, b); }
ll power(ll x, ll y, ll m) { if(!y) return 1; ll p=power(x, y>>1, m)%m; p=p*p%m; return (y&1)?(x*p)%m:p;}
ll modInverse(ll a, ll m){ return power(a, m-2, m); }
bool isPrime(ll num){bool flag=true;for(ll i =2;i<=num/2;i++){if(num%i==0) {flag=false; break;} }return flag;}
ll sumofdigits(ll n){ll c=0;while(n>0){c++;n/=10;}return c;}
bool sortinrev(const pair<int,int>&a,const pair<int,int>&b) {return a.first > b.first; }
bool sortbysec(const pair<int,int> &a, const pair<int,int> &b) {return a.second < b.second; }

//const double PI= 2*acos(0.0);
const long long MOD= 1000000007;



void solve(){
    int n; cin>>n;
    vi v(n);
    fr(i,n){
    	cin>>v[i];
    }
    ll ans = 0;
    for(int i = 1; i < n; ++i){
    	if(v[i-1] > v[i]){
    		int diff = v[i-1]-v[i];
    		v[i] = v[i] + diff;
    		ans += diff;
    	}
    }
    cout<<ans<<endl;


}
int main()
{
#ifndef ONLINE_JUDGE  
    input_output  
#else   
    fastio
#endif

    int t =1 ;
    // cin>>t;
    while(t--){
        solve();
    }

    return 0;
}

Measured memory_bytes: 3992
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	cout<<(s.at(2)==s.at(3)&&s.at(4)==s.at(5)?"Yes":"No")<<endl;
}

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

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


int main() {

long long x,t;
cin >>x >>t;

long long ans = x-t;

if(ans<0)cout << 0 <<endl;
else cout << ans << endl;

    
    return 0;

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

string solve(const string& s)
{
    int n = s.size();
    vector<int> len(n+1, 0);
    vector<bitset<26> > check(n+1);

    int curr = 0;
    for(int i=n-1; i>=0; --i){
        if(!check[curr][s[i]-'a']){
            check[curr][s[i]-'a'] = true;
            if(check[curr].all())
                ++ curr;
        }
        len[i] = curr;
    }

    int i = 0;
    string ans;
    while(curr >= 0){
        for(char c='a'; ; ++c){
            int j = s.find(c, i);
            if(j == string::npos || len[j+1] < curr){
                i = j + 1;
                ans += c;
                break;
            }
        }
        -- curr;
    }
    return ans;
}

int main()
{
    string s;
    cin >> s;
    cout << solve(s) << endl;
    return 0;
}


Measured memory_bytes: 2948
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[100001][3];
ll n,a[100001][3];

ll helper(ll day, ll chose)
{
    if(day == n) return 0;

    if(dp[day][chose] != -1) return dp[day][chose];

    ll maxi = 0;
    if(chose == 0)
    {
        maxi = max(maxi, a[day][1]+ helper(day+1, 1));
        maxi = max(maxi, a[day][2]+ helper(day+1, 2));
        maxi = max(maxi, a[day][3]+ helper(day+1, 3));
    }
    else if(chose == 1)
    {
        maxi = max(maxi, a[day][2] + helper(day+1, 2));  
        maxi = max(maxi, a[day][3] + helper(day+1, 3));
    }
    else if(chose == 1)
    {
        maxi = max(maxi, a[day][2]+ helper(day+1, 2));  
        maxi = max(maxi, a[day][3]+ helper(day+1, 3));
    }
    else if(chose == 2)
    {
        maxi = max(maxi, a[day][1]+ helper(day+1, 1));  
        maxi = max(maxi, a[day][3]+ helper(day+1, 3));
    }
    else 
    {
        maxi = max(maxi, a[day][2]+ helper(day+1, 2));  
        maxi = max(maxi, a[day][1]+ helper(day+1, 1));
    }
    return dp[day][chose] = maxi;
}
int main() {

    cin >> n;
    memset(dp, -1, sizeof dp);

    for(int i=0; i<n; i++)
        for(int j=1; j<=3; j++)
            cin >> a[i][j];

    cout<<helper(0,0);
}

Measured memory_bytes: 16112
n = int(input())
t = [int(x) for x in input().split()]

m = int(input())

drink = []
for i in range(m):
    effect = [int(x) for x in input().split()]
    effect[0] -= 1
    drink.append(effect)

for i in range(m):
    score = sum(t) - t[drink[i][0]] + drink[i][1]
    print(score)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int (i)=(a);(i)<(int)(b);(i)++)
#define RREP(i,a,b) for(int (i)=(a);(i)>=(int)(b);(i)--)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;



int main(){
    int n;
    cin >> n;
    deque<int> que;
    int sign = n % 2;
    REP(i,1, n + 1){
        int a;
        cin >> a;
        if (i % 2 == sign) que.push_front(a);
        else que.push_back(a);
    }

    REP(i,0,n){
        if (i != 0) cout << " ";
        cout << que[i];
    }

    cout << endl;
    
    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int result = 700;
  if (s.at(0) == 'o') result += 100;
  if (s.at(1) == 'o') result += 100;
  if (s.at(2) == 'o') result += 100;
  cout << result << endl;
}


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

using namespace std;

typedef long long ll;

ll a, b, c, d;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    cin >> a >> b >> c >> d;
    while (true)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes";
            break;
        }
        else
        {
            a -= d;
            if (a <= 0)
            {
                cout << "No";
                break;
            }
        }
        
    }
}

Measured memory_bytes: 3656
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
using namespace std;

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

const int maxn = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

#define dbg(x1) cout<<#x1<<" = "<<(x1)<<endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<(x1)<<" "<<#x2<<" = "<<(x2)<<" "<<#x3<<" = "<<(x3)<<endl

ll a[maxn];

int main() {
    //freopen(".in", "r", stdin);
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    ll prefix = a[1];
    ll ans = 0;
    ll ans1 = 0, ans2 = 0;
    ans1 = (prefix > 0) ? 0 : (1 - prefix);
    ll prefix1 = (prefix > 0) ? prefix : 1;
    for (int i = 2; i <= n; i++) {
        if (prefix1 > 0) {
            prefix1 += a[i];
            if (prefix1 >= 0) {
                ans1 += (prefix1 - (-1));
                prefix1 = -1;
            }
        } else if (prefix1 < 0) {
            prefix1 += a[i];
            if (prefix1 <= 0) {
                ans1 += (1 - prefix1);
                prefix1 = 1;
            }
        }
    }
    ans2 = (prefix < 0) ? 0 : (prefix - (-1));
    prefix1 = (prefix < 0) ? prefix : -1;
    for (int i = 2; i <= n; i++) {
        if (prefix1 > 0) {
            prefix1 += a[i];
            if (prefix1 >= 0) {
                ans2 += (prefix1 - (-1));
                prefix1 = -1;
            }
        } else if (prefix1 < 0) {
            prefix1 += a[i];
            if (prefix1 <= 0) {
                ans2 += (1 - prefix1);
                prefix1 = 1;
            }
        }
    }
    ans = min(ans1, ans2);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAXN = 2e5 + 100;
VI e[MAXN];
int d1[MAXN], d2[MAXN];

void DFS(int x, int par, int dep, int *dis) {
  dis[x] = dep;
  //for (int u : e[x]) {
  for (size_t i = 0; i < e[x].size(); i++) {
    int u = e[x][i];
    if (u == par)
      continue;
    DFS(u, x, dep + 1, dis);
  }
}

int main() {
  int N;
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    e[a].PB(b);
    e[b].PB(a);
  }

  DFS(1, 0, 0, d1);
  int p = 1;
  for (int i = 2; i <= N; i++)
    if (d1[i] > d1[p])
      p = i;

  DFS(p, 0, 0, d2);

  int len = 0;
  for (int i = 1; i <= N; i++)
    len = max(len, d2[i]);

  debug("%d\n", len);

  if (len % 3 == 1)
    puts("Second");
  else
    puts("First");
  return 0;
}


Measured memory_bytes: 25216