akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#define INF 1000000000
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;

int main(){
  int N,X;
  int m[100];
  cin >> N >> X;
  int min=100000;
  LOOP(i,N){
    cin>>m[i];
    if(m[i]<min){
      min=m[i];
    }
    X-=m[i];
  }
  int ans = N + X/min;
  cout << ans << endl;
}


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

int N;
int main() {
	scanf("%d",&N);
	int odds=0;
	for(int i=0;i<N;i++){
		int a;
		scanf("%d",&a);
		odds+=a%2;
	}
	printf(odds%2?"NO\n":"YES\n");
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  
  if(n/100 == 9){
    cout << 1;
  }else{
    cout << 9;
  }
  
  if((n/10)%10 == 9){
    cout << 1;
  }else{
    cout << 9;
  }
  
  if(n%10 == 9){
    cout << 1 << endl;
  }else{
    cout << 9 << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

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

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

int main()
{
	int n;
	string s, t;
	cin >> n >> s >> t;

	string x;
	bool f = false;
	for (int i = 0; i < n; i++)
	{
		if (s.substr(i, n - i) == t.substr(0, n - i))
		{
			f = true;
			x = s.substr(0, i) + t;
			break;
		}
	}

	if (!f)
	{
		x = s + t;
	}

	cout << x.length() << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int min(int a, int b) {
	if (a > b) return b;
	else return a;
}

int main(void) {
	int n = 0;
	char S[51] = { 0 };
	int s[123] = { 0 }, ans[123] = { 0 }, i, j;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", S);
		int len_S = strlen(S);
		for (j = 0; j <len_S; j++) {
			int x = S[j];
			if (ans[x] >= 0) s[x]++;
		}
		for (j = 97; j <= 122; j++) {
			if (s[j] == 0) s[j] = -1;
		}
		for (j = 97; j <= 122; j++) {
			if (i == 0) ans[j] = s[j];
			else if ((i > 0) && (ans[j] > 0)) ans[j] = min(ans[j], s[j]);
			s[j] = 0;
		}
	}

	for (i = 97; i <= 122; i++) {
		if (ans[i] > 0) {
			for (j = 0; j < ans[i]; j++) printf("%c", i);
		}
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long 
typedef long long ll;
typedef pair<int,int>pi;
const int MAXH=15;
const int MAXW=1005;
const int MOD=1000000007;

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define DEC(i,a,b) for(int i=(a);i>=(b);i--)
#define fst first
#define snd second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define db(x) cerr<<#x<<" = "<<x<<"\n"
#define LOW(v,x) (lower_bound(all(v),(x))-(v).begin())
#define UP(v,x) (upper_bound(all(v),(x))-(v).begin())

char A[MAXH][MAXW];
int sum[MAXH][MAXW];
int rsq(int x1, int y1, int x2, int y2) { return sum[x2][y2] - sum[x2][y1-1] - sum[x1-1][y2] + sum[x1-1][y1-1]; }
int H,W,K; 
main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>H>>W>>K;
	FOR(i,1,H) FOR(j,1,W) cin >> A[i][j];
	FOR(i,1,H) FOR(j,1,W) sum[i][j] = sum[i][j-1] + sum[i-1][j] - sum[i-1][j-1] + (int) A[i][j] -'0';
	int ans=1e9;
	FOR(bitmask,0,(1<<(H-1))-1){
		//horizontal slice
		vector<pi> segments;
		int prev=1;
		int cuts=0;
		FOR(i,1,H-1){
			if (bitmask & (1<<(i-1))){
				segments.emplace_back(prev,i);
				prev=i+1;
				cuts++;
			}
		}
		segments.emplace_back(prev,H);
		//for(auto i:segments) cout<<i.first<<","<<i.second<<" ";
		//cout<<"\n";
		
		FOR(i,1,W){
			for(auto seg:segments){
				int white = rsq(seg.first,i,seg.second,i);
				if (white>K) cuts=1e9;
			}
		}
		if(cuts!=1e9){
			prev=1;
			FOR(i,1,W){
				int maxwhite=0;
				for(auto seg:segments){
					maxwhite=max(maxwhite, rsq(seg.first,prev,seg.second,i));
				}
				if (maxwhite>K){
					prev=i;
					cuts++;
				}
			}
		}
		ans=min(ans,cuts);
	}
	cout<<ans;
}


Measured memory_bytes: 384
// ░░░░░░░░( •̪●)░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░███████ ]▄▄▄▄▄▄▄▄▃░░░▃░░░░ ▃░
// ▂▄▅█████████▅▄▃▂░░░░░░░░░░░░░░░░░
// [███████████████████].░░░░░░░░░░░░░░
// ◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤...░░░░░░░░░░░░

//PointBlank's code (⌐■_■)

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
 
ll power(ll x, ll y); 
#define repp(I, A, B) for(int I = A; I <= B; I++)
#define rep(I, A, B) for(int I = A; I < B; I++)
#define rrep(I, B, A) for(int I = B; I >= A; I--)
#define pb emplace_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define mem(A, B) memset(A, B, sizeof(A));
#define mem0(A) memset(A, 0, sizeof(A));
#define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define debug(this) cerr<<"> "<<#this<<" : "<<this<<"\n"
#define bitcount(n) __builtin_popcountll(n)
#define in_edges(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B), v[B].pb(A);}
#define in_edges2(M) repp(I, 1, M){int A, B; cin >> A >> B; v[A].pb(B);}
#define in_edges3(M) repp(I, 1, M){int A, B, C; cin >> A >> B >> C; v[A].pb(B, C), v[B].pb(A, C);}
#define endl "\n"

const ll MOD = 1000000007;
 
int main() //PointBlank's code ¯\_(ツ)_/¯
{
    int n;
    cin >> n;

    multiset<int> st;
    int res = 0;
    int inp;

    rep(i, 0, n){
        cin >> inp;
        auto it = st.UB(-inp);
        if(it == st.end()){
            res++;
            st.insert(-inp);
        }else{
            st.erase(it);
            st.insert(-inp);
        }
    }

    cout << res;
}

ll power(ll x, ll y)
{ 
    ll res = 1; x %= MOD;
    while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 
    return res; 
}

Measured memory_bytes: 8332
#include <bits/stdc++.h>
#define inf 0x7f7f7f7f
using namespace std;
const int N = 100005, M = 200005;
int l, r, d, n, m, x[N];
int counter = 1;
int head[N], nxt[M * 2], to[M * 2], val[M * 2], cnt, dis[N], vis[N]; 
void add(int u, int v, int w) {
    to[cnt] = v;
    val[cnt] = w;
    nxt[cnt] = head[u];
    head[u] = cnt++;
}
bool spfa(int u) {
    queue<int> que;
    que.push(u); dis[u] = 0; vis[u] = 1;
    while(!que.empty()) {
        int now = que.front(); que.pop();
        for(int i = head[now]; ~i; i = nxt[i]) {
            int v = to[i];
            if(!vis[v]) {
                dis[v] = dis[now] + val[i];
                que.push(v); vis[v] = 1;    
            }else if(dis[v] != dis[now] + val[i]) {
                return false;
            }                      
        }
    }
    return true;
}
int main() {
    memset(head, -1, sizeof(head));
    memset(dis, 127, sizeof(dis));
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; ++i) {
        scanf("%d%d%d", &l, &r, &d);
        add(l, r, d); add(r, l, -d);
    }
    int flag = 0;
    for(int i = 1; i <= n; ++i) {
        if(!vis[i]) {
            if(!spfa(i)) flag = 1;
        }
    }
    if(flag) printf("No\n"); else printf("Yes\n");
    return 0;
}

Measured memory_bytes: 6784
#include <iostream>
#include <string>
#include <vector>
#define sz(a) (int)(a).size()

using namespace std;

typedef vector<int> vi;
typedef long long ll;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m;
	cin>>n>>m;
//	m=maxw+1;
	int w[n];
	int p[n];
	for(int i=0;i<n;i++)
		cin>>w[i]>>p[i];
	ll dp[n][m+1];
	for(int j=0;j<=m;j++){
		if(j>=w[0])
			dp[0][j]=p[0];
		else
			dp[0][j]=0;
	}
	for(int i=1;i<n;i++){
		for(int j=0;j<=m;j++){
			dp[i][j]=dp[i-1][j];
			if(j-w[i]>=0)
				dp[i][j]=max(dp[i-1][j-w[i]]+p[i],dp[i][j]);
		}
	}
	cout<<dp[n-1][m]<<"\n";
}


Measured memory_bytes: 78336
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            Integer[] list = Arrays.stream(sc.nextLine().split(" ")).map(Integer::parseInt).toArray(Integer[]::new);
            int count = 0;
            for (int i = 0; i < 10; i++) {
                if (list[0] - 1 != i && list[1] - 1 != i && list[2] - 1 != i && list[0] + list[1] + (i + 1) <= 20) {
                    count++;
                }
            }
            System.out.println(count > 3 ? "YES" : "NO");

        }
    }
}



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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

//π M_PI
//deg = rad*180/M_PI

bool is_prime (ll n) {
    switch(n){
        case 0:
        case 1: return false;
        case 2:
        case 3: return true;
    }

    if ( n%2 == 0 || n%3 == 0 ) {
        return false;
    }

    if( n%6 != 1 && n%6 != 5 ) {
        return false;
    }

    for(ll i = 5; i*i <= n ;i+=6 ) {
        if( n%i == 0 ) {
            return false;
        }
        if( n%(i+2) == 0 ) {
            return false;
        }
    }

    return true;
}

int main() {
    ll x;
    cin >> x;
    if ( x == 2 ) {
        cout << 2 << endl;
    } else if ( x == 3 ) {
        cout << 3 << endl;
    } else {
        while (1) {
            if ( x%6 == 1 || x%6 == 5 ) {
                if ( is_prime(x) ) {
                    break;
                }
            }
            x += 1;
        }
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        A = int(input())
        #A = list(map(int, input().split()))
    else:
        pass

    while True:
        a = int(round(np.sqrt(A)))
        for i in range(2,a+1):
            if A % i == 0:
                break
        else:
            print(A)
            exit()
        A += 1



if __name__ =='__main__':
    main()

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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; }

lli d[300][300];

void func(long long N, long long M, long long R, std::vector<long long> r, std::vector<long long> A, std::vector<long long> B, std::vector<long long> C){

    vector<lli> per(R);
    REP(i,0,R)per[i]=i;

    REP(k,0,N)REP(i,0,N)REP(j,0,N)chmin(d[i][j],d[i][k]+d[k][j]);

    lli ans = INF;

    do{
        lli sum = 0;
        REP(i,1,R){
            sum += d[r[per[i-1]]][r[per[i]]];
        }
        chmin(ans,sum);

    }while(next_permutation(per.begin(),per.end()));

    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);
    REP(i,0,300)REP(j,0,300)d[i][j]=INF;
    REP(i,0,300)d[i][i]=0;
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long R;
    scanf("%lld",&R);
    std::vector<long long> r(R);
    for(int i = 0 ; i < R ; i++){
        scanf("%lld",&r[i]);
        r[i]--;
    }
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    std::vector<long long> C(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
        scanf("%lld",&C[i]);
        A[i]--,B[i]--;
        d[A[i]][B[i]]=C[i];
        d[B[i]][A[i]]=C[i];
    }
    func(N, M, R, std::move(r), std::move(A), std::move(B), std::move(C));
    return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }
const ll MOD = 1000000007;

signed main() {
    SS(string,s);
	if(s=="ABC")p("ARC");
	else p("ABC");

}


Measured memory_bytes: 3652
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 1001000
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cin.sync_with_stdio(false);
    ll t;
    t=1;
//    cin>>t;
    while(t--)
    {
        cout<<std::fixed;
        cout<<setprecision(16);
        long double l;cin>>l;
        long double a=l/3.0;
        l-=a;
        long double b=l/2.0;
        long double c=l-b;
//        cout<<"a= "<<a<<" b= "<<b<<" c= "<<c<<endl;
        long double ans=a*b*c;
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long int gcd(long long int a, long long int b);
int main() {
	/*
	int n;
	cin >> n;
	int L[200];
	int i,j,c;
	for (i = 0; i < 2 * n; i++) {
		cin >> L[i];
	}
	//ソート
	for (i = 0; i < 2 * n - 1; i++) {
		for (j = 0; j < 2 * n -1 - i; j++) {
			if (L[j] < L[j + 1]) {
				c = L[j];
				L[j] = L[j + 1];
				L[j + 1] = c;
			}
		}
	}
	c = 0;
	for (i = 1; i < 2 * n; i = i + 2) {
		c = c + L[i];
	}
	cout << c;
	return 0;
	*/
	long long int n, x;
	cin >> n;
	cin >> x;

	cout << 3 * n - 3 * gcd(n, x);
	return 0;
}

long long int gcd(long long int a, long long int b) {

	long long int aa, bb,cc;
	if (a > b) {
		aa = a;
		bb = b;
	}
	else {
		aa = b;
		bb = a;
	}

	if (aa % bb == 0) {
		return bb;
	}
	else {
		return gcd(bb, aa % bb);
	}


}

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

using namespace std;

int elect(string div, int idx)
{
  if('0' <= div[idx+1] && div[idx+1] <= '9'){
    int v = 0;
    for(int i = idx+1; i < div.size(); i++){
      if('0' <= div[i] && div[i] <= '9') v = v*10 + (div[i] - '0');
      else break;
    }
    return v/2+1;
  } else {
    int stage = 0;
    vector<int> vote;
    for(int i = idx+1; i < div.size(); i++){
      if(div[i] == '['){
	stage++;
	if(stage == 1) vote.push_back(elect(div, i));
      } else if(div[i] == ']'){
	stage--;
	if(stage == -1) break;
      }
    }
    sort(vote.begin(), vote.end());
    int v = 0;
    for(int i = 0; i <= vote.size()/2; i++) v += vote[i];
    return v;
  }
}

int main()
{
  int n;
  cin >> n;
  while(n--){
    string div;
    cin >> div;
    cout << elect(div, 0) << endl;
  }
  return 0;
}

Measured memory_bytes: 1328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,T;cin >> n >> T;
    vector<ll> t(n);
    for(int i=0;i<n;i++){
        cin >> t[i];
    }
    ll ans=0;
    for(int i=1;i<n;i++){
        if(t[i]-t[i-1]<=T){
            ans+=t[i]-t[i-1];
        }
        else{
            ans+=T;
        }
    }
    cout << ans+T << endl;
}

Measured memory_bytes: 1792
// 参考 -> #4669082

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();

        String s = sc.next();
        int k = sc.nextInt();

        int cnt = 0;
        char target = 'a';
        while (cnt < k) {
            if (s.contains(sb.toString() + target)) {
                sb.append(target);
                cnt++;
                target = 'a';
                continue;
            }
            // ターゲットが見つからなかった場合
            if (target == 'z') {
                String tmp = sb.toString();
                target = tmp.charAt(tmp.length()-1);
                target++;
                sb.deleteCharAt(tmp.length()-1);
                continue;
            }
            target++;
        }

        System.out.println(sb.toString());
    }
}


Measured memory_bytes: 23636
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;

int main() {
    int N; cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int& ai : a) cin >> ai;
    for (int& bi : b) cin >> bi;
    for (int& ci : c) cin >> ci;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    ll ans = 0;
	int it1 = 0, it3 = 0;
	for (int i = 0; i < N; i++) {
		while (it1 < N && a[it1] < b[i]) it1++;
		while (it3 < N && c[it3] <= b[i]) it3++;
		ans += (ll)it1 * (N - it3);
	}
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long
#define endl '\n'
#define pb push_back
#define debug(x) cout<<#x<<" "<<x<<endl;
const int mod = 1e9+7;
const double pi = 3.141592653589793238460;
using namespace std;

bool is_pal (string s){
return equal(s.begin(), s.begin() + s.size()/2, s.rbegin()) ? 1 : 0;
}

int power (int x , int y){
if(y==0) return 1;
if(y&1) return x*power(x,y/2)%mod*power(x,y/2)%mod;
return power(x,y/2)%mod*power(x,y/2)%mod;
}

int modInv (int x){
return power(x,mod-2);
}

int fact (int n){
    int mul =1;
    for(int i=0;i<n;i++)
    mul=(mul*(i+1))%mod;
    return mul;
}

bool prime[200005]; 

int minn (int x, int y)
{
	if(x<y)
	return x;
	else
	return y;
}

int maxx (int x, int y)
{
	if(x>y)
	return x;
	else
	return y;
}
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    }  
}

void solve(void){
	int a,b;
	cin>>a>>b;
	if(a>b) cout<<"safe";
	else
	cout<<"unsafe";
}	
signed main() {
fio;
int t = 1;
// cin>>t;
	while(t--)
	solve();

	return 0;
}


Measured memory_bytes: 3616
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int total = scanner.nextInt();
    
    int sum = 0;
    for (int ix = 1; ix <= total; ix++) {
      sum += ix;
    }
    
    System.out.println(sum);
  }
}

Measured memory_bytes: 21844
#include <iostream>

using namespace std;

typedef long long int lli;

lli mod = 1e9 + 7;

lli solve(lli x, lli n){

	if( n == 0 )
		return 1;

	if( n % 2 == 0){		// ??¶??°
		return solve( (x * x) % mod , n / 2);
	}else{					// ?\???°
		return solve( (x * x) % mod , n / 2) * x % mod;
	}

}

int main(void){

	int x, n;
	cin >> x >> n;

	cout << solve(x, n)<< endl;

	return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<map>
using namespace std;
#define ll long long
int main(){
    int N;
    cin >> N;
    int ans;
    if(N>=105)ans++;
    if(N>=135)ans++;
    if(N>=165)ans++;
    if(N>=189)ans++;
    if(N>=195)ans++;
  	cout <<ans;
    return 0;
}

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

using namespace std;

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

string s;
int P, Q, R;

int neg(int a) { return (a==0? 2:(a==1?1:0)); }
int mul(int a, int b) { return min(a, b); }
int add(int a, int b) { return max(a, b); }

int dfs(int l, int r) {
    if(s[l]=='-') return neg(dfs(l+1, r));
    if(s[l]=='(' && s[r-1]==')') {
        int m, cnt = 0;
        for(m=l+1; m<r-1; m++) {
            if(cnt == 0 && (s[m]=='*' ||  s[m]=='+')) break;
            if(s[m]=='(') cnt++;
            if(s[m]==')') cnt--;
        };
        if(s[m]=='*') return mul(dfs(l+1, m), dfs(m+1, r-1));
        if(s[m]=='+') return add(dfs(l+1, m), dfs(m+1, r-1));
    }
    
    if(isdigit(s[l])) return s[l]-'0';
    return (s[l]=='P'? P:(s[l]=='Q'? Q:R));
}

int main() {
    while(cin>>s, s!=".") {
        int ans = 0;
        for(P=0; P<3; P++) for(Q=0; Q<3; Q++) for(R=0; R<3; R++)
            if(dfs(0, s.size()) == 2) ans++;
        cout << ans << endl;
    }
}



Measured memory_bytes: 3188
#include <iostream>
#include <cmath>

using namespace std; 

int main () {
	int n;
	cin >> n;
	int skok[n];
	int dp[n];
	
	for (int i=0; i<n; i++){
		cin >> skok[i];
	}
	
	dp[1] = abs(skok[1]-skok[0]);
	dp[0] = 0;
	
	for (int i=2; i<n; i++){
		dp[i] = min(abs(skok[i]-skok[i-1])+dp[i-1], abs(skok[i]-skok[i-2])+dp[i-2]);
	}
	
	cout << dp[n-1];
return 0;
}



Measured memory_bytes: 1024
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
c = int(input())
ans = num2alpha(c).lower()
print(ans)
            

Measured memory_bytes: 9188
#include<stdio.h>


int A[10000000];
int ans[10000000];
int c[10000000];



int main(){

  
  int number;


  
  scanf("%d",&number);


  


  int i;

  for(i=0;i<=number;i++){
    c[i]=0;
  }

  
  

  
  for(i=0;i<number;i++){
    scanf("%d",&A[i+1]);

    c[A[i+1]]++;

    
  }


  for(i=1;i<1000000;i++){
    c[i]=c[i]+c[i-1];

  }

  for(i=1;i<number+1;i++){
    ans[c[A[i]]]=A[i];
    c[A[i]]--;


   
  }
  
  
  for(i=1;i<=number;i++){
    if(i==number){printf("%d",ans[i]);}
    else{printf("%d ",ans[i]);}
  }

  printf("\n");

  
  return 0;
}





Measured memory_bytes: 25168
def solve():
    A, B, C = map(int, input().split())
    if A == B == C and A % 2 == 0:
        return -1

    cnt = 0
    while True:
        if A % 2 or B % 2 or C % 2:
            return cnt
        A, B, C = (B + C) // 2, (C + A) // 2, (A + B) // 2
        cnt += 1


print(solve())

Measured memory_bytes: 3060
//   _/                _/                 _/_/_/   _/
//_/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
// _/     _/    _/   _/     _/    _/  _/_/_/     _/
//_/     _/    _/   _/     _/    _/  _/    _/   _/
// _/_/   _/_/       _/_/   _/_/      _/_/     _/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=5e18;
typedef pair<int,int> P;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int n,a[20]={},x[20][20]={},y[20][20]={},ans=0,f;
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a[i];
    for(int j=0; j<a[i]; j++) {
      cin >> x[i][j] >> y[i][j];
    }
  }
  for(int i=0; i<(1<<n); i++) {
    f=1;
    for(int j=0; j<n; j++) {
      if(i&(1<<j)) {
        for(int k=0; k<a[j]; k++) {
          if(y[j][k]&&!(i&(1<<x[j][k]-1))) {
            f=0;
          }
          if(!y[j][k]&&i&(1<<x[j][k]-1)) {
            f=0;
          }
        }
      }
    }
    if(f) {
      ans=max(ans,__builtin_popcount(i));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

ans = 0
a_1 = 0
a_2 = 0
a_3 = 0
a_4 = 0
a_5 = 0
a_6 = 0
a_7 = 0
a_8 = 0
add = 0
for i in range(n):
    if a[i]  < 400 and a_1 == 0:
        a_1 = 1
        ans +=1
    elif a[i]  < 800 and a[i] >= 400 and a_2 == 0:
        a_2 = 1
        ans +=1
    elif a[i]  < 1200 and a[i] >= 800 and a_3 == 0:
        a_3 = 1
        ans +=1
    elif a[i]  < 1600 and a[i] >= 1200 and a_4 == 0:
        a_4 = 1
        ans +=1
    elif a[i]  < 2000 and a[i] >= 1600 and a_5 == 0:
        a_5 = 1
        ans +=1
    elif a[i]  < 2400 and a[i] >= 2000 and a_6 == 0:
        a_6 = 1
        ans +=1
    elif a[i]  < 2800 and a[i] >= 2400 and a_7 == 0:
        a_7 = 1
        ans +=1
    elif a[i]  < 3200 and a[i] >= 2800 and a_8 == 0:
        a_8 = 1
        ans +=1
    elif a[i] >= 3200:
        add +=1

#if ans == 8:
#    print('8 8')
if ans == 0 and add >=8:
    print('1 8')
elif ans == 0:
    print('1 '+str(add))
#elif ans + add >= 8:
#    print(str(ans)+' 8')
else:
    print(str(ans)+' '+str(ans+add))

Measured memory_bytes: 3064
s = [int(input()) for i in range(4)]
A = s[0]
B = s[1]
C = s[2]
X = s[3]
res = 0
total = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      total = 500*a + 100*b + 50*c
#      print("A:"+str(a)+" B:"+str(b)+" C:"+str(c) + "total:"+str(total))
      if(total == X):res = res +1
print(res)

Measured memory_bytes: 9028
#include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	string S1,S2;
  int sw = 0;
  cin >> S1 >> S2;
  if(S1.length() < S2.length()){
	cout << "UNRESTORABLE" << endl;
    return 0;
  }
  int count = 0;
  for(int i = S1.length() - S2.length();i >= 0;i--){
    sw = 0;
    string s = S1.substr(i,S2.length());
    for(int j = 0;j < S2.length();j++){
      if(!(s[j] == '?' || s[j] == S2[j])){
		sw = 1;
        break;
      }
    }
    if(sw == 0){
      for(int j = 0;j < S2.length();j++){
        S1[i + j] = S2[j];
      }
      break;
    }
      
  }
  if(sw == 1){
	cout << "UNRESTORABLE" << endl;
    return 0;
  }
  froop1(0,S1.length()){
	if(S1[i] == '?'){
		S1[i] = 'a';
    }
  }
  cout << S1 << endl;
      
    
}

Measured memory_bytes: 3612
package main

import (
	"fmt"
	"bufio"
	"os"
	"strconv"
	"bytes"
)

type disjointSet struct {
	rank []int
	p []int
}

func NewDisjointSet(N int) * disjointSet{
	s := disjointSet{}
	s.rank = make([]int, N)
	s.p = make([]int, N)
	for i:=0; i<N; i++ {
		s.p[i] = i
	}
	return &s
}

func (s * disjointSet) findSet(x int) int{
	if x != s.p[x] {
		s.p[x] = s.findSet(s.p[x])
	}
	return s.p[x]
} 

func (s * disjointSet) link(x, y int) {
	if s.rank[x] > s.rank[y] {
		s.p[y] = x
	} else {
		s.p[x] = y
		if s.rank[x] == s.rank[y] {
			s.rank[y] ++
		}
	}
}

func (s * disjointSet) Unite(x, y int) {
	s.link(s.findSet(x), s.findSet(y))
}

func (s * disjointSet) Same(x, y int) bool {
	return s.findSet(x) == s.findSet(y)
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	N := nextInt(scanner)
	ds := NewDisjointSet(N)
	q := nextInt(scanner)
	outBuffer := bytes.Buffer{}
	for i:=0; i<q; i++ {
		c := nextInt(scanner)
		x := nextInt(scanner)
		y := nextInt(scanner)
		if c == 0 {
			ds.Unite(x, y)
		} else {
			if ds.Same(x, y) {
				outBuffer.WriteString("1\n")
			} else {
				outBuffer.WriteString("0\n")
			}
		}
	}
	fmt.Printf("%s", outBuffer.String())
}


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

typedef long long ll;

class dice
{
    public:
        int men[6];
        void N();
        void S();
        void W();
        void E();
        void circle();
};

void dice::N()
{
    int tmp;
    tmp = men[0];
    men[0] = men[1];
    men[1] = men[5];
    men[5] = men[4];
    men[4] = tmp;
}

void dice::S()
{
    int tmp;
    tmp = men[0];
    men[0] = men[4];
    men[4] = men[5];
    men[5] = men[1];
    men[1] = tmp;
}
void dice::W()
{
    int tmp;
    tmp = men[0];
    men[0] = men[2];
    men[2] = men[5];
    men[5] = men[3];
    men[3] = tmp;
}

void dice::E()
{
    int tmp;
    tmp = men[0];
    men[0] = men[3];
    men[3] = men[5];
    men[5] = men[2];
    men[2] = tmp;
}

void dice::circle()
{
    int tmp;
    tmp = men[1];
    men[1] = men[2];
    men[2] = men[4];
    men[4] = men[3];
    men[3] = tmp;
}

bool dice_judge(dice dice_first,dice dice_second)
{
    int i,j,k;
    for(i = 0;i < 4;++i){
        for(j = 0;j < 4;++j){
            bool flag = true;
            for(k = 0;k < 6;++k){
                if(dice_first.men[k] != dice_second.men[k]){
                    flag = false;
                    break;
                }
            }
            if(flag){
                return true;
            }
            dice_first.circle();
        }
        dice_first.S();
    }
    dice_first.W();
    for(i = 0;i < 4;++i){
        bool flag = true;
        for(k = 0;k < 6;++k){
            if(dice_first.men[k] != dice_second.men[k]){
                flag = false;
                break;
            }
        }
        if(flag){
            return true;
        }
        dice_first.circle();
    }
    dice_first.E();
    dice_first.E();
    for(i = 0;i < 4;++i){
        bool flag = true;
        for(k = 0;k < 6;++k){
            if(dice_first.men[k] != dice_second.men[k]){
                flag = false;
                break;
            }
        }
        if(flag){
            return true;
        }
        dice_first.circle();
    }
    return false;
}

int main()
{
    int n;
    int i,j,k;
    cin >> n;
    vector<dice> multi_dice(n);
    for(i = 0;i < n;++i){
        for(j = 0;j < 6;++j){
            cin >> multi_dice.at(i).men[j];
        }
    }
    for(i = 0;i < n-1;++i){
        for(j = i+1;j < n;++j){
            if(dice_judge(multi_dice.at(i),multi_dice.at(j))){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    int d=a+b+1;
    if(d<c){
    	c=d;
    	cout <<b+c<<endl; 
    }
    else{
    	cout<<b+c<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*

 */
int a,b,c;
int main(){
  cin>>a>>b>>c;
  cout<<(a*b)/2<<endl;

  return 0;
}


Measured memory_bytes: 256
def d p,q,r,m,root
    station=Array.new(m,(m+1)*(1000))
    station[q]=0
    bStation=[]
    m.times{|t|bStation.push t}
    
    while bStation.length>0
      min=(m+1)*1001
      minStation=3001
      bStation.each{|e|
        if station[e]<min
          minStation=e
          min=station[e]
        end
      }
      root[minStation].each{|e|
        station[e[0]]=e[1+r]+station[minStation] if station[e[0]]>e[1+r]+station[minStation]
      }
      bStation.delete minStation
    end
  p station[p]
end

while true
  n,m=gets.split(" ").map{|e|e.to_i}
  break if n==0 && m==0
  root=Array.new m
  root.length.times{|t|
    root[t]=[]
  }
  n.times{
    a,b,c,t = gets.split(" ").map{|e|e.to_i}
    root[a-1].push [b-1,c,t]
    root[b-1].push [a-1,c,t]
  }


  gets.to_i.times{
    p,q,r=gets.split(" ").map{|e|e.to_i}
    d p-1,q-1,r,m,root
  }
end

Measured memory_bytes: 6248
c1=list(map(int,input().split()))
c2=list(map(int,input().split()))
c3=list(map(int,input().split()))
if c2[0]-c1[0]==c2[1]-c1[1] and c2[1]-c1[1]==c2[2]-c1[2] and c3[0]-c1[0]==c3[1]-c1[1] and c3[1]-c1[1]==c3[2]-c1[2] :
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
typedef long long ll;
const int INF=1001001001;
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int pre =-999;
  rep(i,n){
    if (pre<=a[i]-1){
      pre=a[i]-1;
    }else if (pre<=a[i]){
      pre=a[i];
    }else{
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


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

using namespace std;

using ll = long long;

int main(){
  ll h, n;
  cin >> h >> n;
  cin.ignore();
  vector <ll> a;
  ll tmp;
  ll sum = 0;
  for(int i = 0; i < n; i++){
    cin >> tmp;
    a.push_back(tmp);
    sum += tmp;
  }
  cin.ignore();
  
  if(h <= sum){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 1400
n,k=map(int,input().split())
kaisu=[]
for i in range(1,n+1):
    if i >=k:
        kaisu.append(1)
    else:
        for j in range(1,100):
            if pow(2,j)>=(k/i):
                kaisu.append(1/2**j)
                break
ans=sum(kaisu)/n
print(ans)

Measured memory_bytes: 3864
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ll long long
#define int long long
#define mod 1000000007
#define DEBUG cout<<"Hello1\n";
#define all(v) (v).begin(),(v).end()
#define clr(x) memset(x,0,sizeof(x))
#define deb(...) debug(#__VA_ARGS__, __VA_ARGS__);
const int N = 1e6 + 5;
const ll inf = LLONG_MAX;
using namespace std;

template<typename T> void debug(string s, T x) {cout << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cout << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}
template<class T>
void print_container(T &container) {
	for (auto &t : container) {
		cout << t << " ";
	}
	cout << endl;
}

string s;
int n;
void solve() {
	cin >> n;
	map<string, int> m;
	while (n--) {
		cin >> s;
		m[s]++;
	}

	cout << "AC x " << m["AC"] << endl;
	cout << "WA x " << m["WA"] << endl;
	cout << "TLE x " << m["TLE"] << endl;
	cout << "RE x " << m["RE"] << endl;
}

int32_t main() {
	IOS;



	solve();
}



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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
	ll n;cin>>n;
	vi a(n);
	rep(i,n)cin>>a[i];
	sort(all(a));
	reverse(all(a));
	ll GCD=a[0];
	rep(i,n){
		GCD=gcd(GCD,a[i]);
	}
	cout<<GCD<<endl;
}

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

int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  int bothmax = min(a , b);
  int bothmin = max((a + b) - n, 0);
  cout << bothmax << " " << bothmin << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();
        int[] A = new int[N];
        int[] B = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = in.i();
            B[i] = in.i();
        }
        Arrays.sort(A);
        Arrays.sort(B);
        int ans;
        if (N % 2 == 1) {
            ans = B[B.length / 2] - A[A.length / 2] + 1;
        } else {
            ans = B[B.length / 2 - 1] + B[B.length / 2] - A[A.length / 2 - 1] - A[A.length / 2] + 1;
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 40056
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String s =sc.next();
    String x[]=s.split("",0);
    if(x[2].equals(x[3])){
      if(x[4].equals(x[5])){System.out.println("Yes");}
      else{System.out.println("No");}}
    else{System.out.println("No");}
  }
}


Measured memory_bytes: 23764
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n;
	int w[105];
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>w[i];
	}
	int cnt=9999;
	for(int i=0;i<n;i++)
	{
		int ans1=0,ans2=0;
		for(int j=0;j<=i;j++){
			ans1+=w[j];
		}
		for(int k=i+1;k<n;k++){
			ans2+=w[k];
		}
		if(ans1>=ans2){
			if(ans1-ans2<cnt){
				cnt=ans1-ans2;
			}
		}else{
			if(ans2-ans1<cnt){
				cnt=ans2-ans1;
			}
		}
	}
	cout<<cnt;
	return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())

def solve(n, y):
    for a in range(min(y // 10000, n) + 1):
        for b in range(min(y // 5000, n) + 1):
            if a + b > n or 10000 * a + 5000 * b > y:
                continue

            c = n - a - b
            if 10000 * a + 5000 * b + 1000 * c == y:
                print(a, b, c)
                return

    print("-1 -1 -1")

solve(n, y)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
	int n, k, q, a[100000], a1[100000] = { 0 };
	cin >> n >> k >> q;
	for (int i = 0; i < q; i++) {
		cin >> a[i];
		a1[a[i]-1]++;
	}
	for (int j = 0; j < n; j++) {
		if (k - q + a1[j] <= 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <stdio.h>
static const int MAX = 200000;

using namespace std;

void trace(int a[], int n){
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << a[i];
  }
  cout << endl;
}

int sort(int a[], int n){
  int sw = 0;
  for(int i=0; i < n; i++){
    int mini = i;
    for(int j=i+1; j < n; j++){
      if(a[mini] > a[j]){
        mini = j;
      }
    }
    if(mini != i){
      swap(a[mini], a[i]);
      sw++;
    }
  }
  
  return sw;
}

int main(int argc, const char * argv[]) {
  int n, a[MAX], sw;
  cin >> n;
  for(int i = 0; i < n; i++) cin >> a[i];
  sw = sort(a, n);
  trace(a, n);
  cout << sw << endl;
  return 0;
}


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

using namespace std;
using ll = long long;


int main()
{
    int n, c; cin >> n >> c;
    n++;
    vector<int> a(c);
    for(int i = 0; i < c; i++)cin >> a[i];
    int sum = accumulate(a.begin(), a.end(), 0);
    cout << sum / n + (sum % n != 0) << endl;
}


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

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    if(c<=a+b){
        cout << "No" << endl;
    }
    else{
        if(4ll*a*b<(c-a-b)*(c-a-b)){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; i++) cin >> A[i];
    priority_queue<long long> q;
    sort(A.begin(), A.end());
    q.push(A[N - 1]);
    long long ans = 0;
    for(int i = 0; i < N - 1; i++){
        long long temp = q.top();
        q.pop();
        long long t = min(temp, A[N - 2 - i]);
        q.push(t);
        q.push(t);
        ans += temp;
    }
    cout << ans << endl;

}

Measured memory_bytes: 6936
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)n; ++i)
#define all(obj) (obj).begin(), (obj).end()
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
ll N, x;

signed main()
{
    cin >> N >> x;
    vector<ll> a(N), b(N);

    ll ans = 0;
    rep(i, N)
    {
        cin >> a[i];
        b[i] = a[i];
        ans += a[i];
    }

    rep(k, N) // 魔法を唱える数(固定)
    {
        ll cost = k * x;
        rep(i, N)
        {
            b[i] = min(b[i], a[(i - k + N) % N]);
        }
        rep(i, N)
        {
            cost += b[i];
        }
        ans = min(ans, cost);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*ex3_3
  moriai ryo 19B30920*/

#include <stdio.h>

int main(void){
  int intger,base;/*integer=整数　n_base=N進数*/
  scanf("%d",&intger);
  scanf("%d",&base);
  int ans=0;
  while(intger>0){
    ans=ans+1;
    intger=intger/base; /*baseで何回割れるか*/
  }
  printf("%d\n",ans);
  return 0;
}

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

int n, m, a, b;
vector<vector<char>> ans(1010, vector<char>(1010, '.'));

void answer() {
  if (a + b) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cout << ans[i][j];
      }
      cout << endl;
    }
  }
}

bool puta(int y, int x) {
  if (ans[y][x] != '.' || ans[y][x + 1] != '.') return false;
  if (!a) return false;
  ans[y][x] = '<';
  ans[y][x + 1] = '>';
  a--;
  return true;
}

bool putb(int y, int x) {
  if (ans[y][x] != '.' || ans[y + 1][x] != '.') return false;
  if (!b) return false;
  ans[y][x] = '^';
  ans[y + 1][x] = 'v';
  b--;
  return true;
}

int main() {
  cin >> n >> m >> a >> b;
  if (n == 1 && m == 1) {
    answer();
    return 0;
  }

  int N = n - (n & 1), M = m - (m & 1);

  if (n * m & 1) {
    for (int j = 0; j < m - 3; j += 2) {
      puta(n - 1, j);
    }
    for (int i = 0; i < n - 3; i += 2) {
      putb(i, m - 1);
    }

    puta(n - 1, m - 2);
    putb(n - 3, m - 1);
    if (a * b & 1) {
      puta(n - 3, m - 3);
      putb(n - 2, m - 3);
    }
  } else {

    if (n & 1) {
      for (int j = 0; a && j < M; j += 2) {
        puta(N, j);
      }
    }
    if (m & 1) {
      for (int i = 0; b && i < N; i += 2) {
        putb(i, M);
      }
    }
  }

  for (int i = 0; i < N; i += 2) {
    for (int j = 0; j < M; j += 2) {
      if (a) {
        puta(i, j);
        if (a) puta(i + 1, j);
      } else if (b) {
        putb(i, j);
        if (b) putb(i, j + 1);
      }
    }
  }

  answer();
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
template <typename T>
using V = std::vector<T>;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  V<int> B(N);
  REP(i, N) { cin >> B[i]; }

  V<int> ans(N, -1);
  REP(i, N) {
    for (int j = B.size() - 1; j >= 0; --j) {
      int x = B[j];
      int ins = x - 1;
      if (j < ins) {
        cout << -1 << endl;
        return 0;
      }
      if (j == ins) {
        ans[N - 1 - i] = x;
        B.erase(B.begin() + j);
        break;
      }
    }
  }
  REP(i, N) { cout << ans[i] << '\n'; }
}


Measured memory_bytes: 3600