akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt( br.readLine() );
      int num;
      int result = 0;

      for (int i=0; i<n; i++) {
        num = Integer.parseInt(br.readLine());
        if (isPrime(num)) result++;
      }
      System.out.println(result);
    }
  }

  public static boolean isPrime(int num) {
    if( num == 2 ) return true;
    if( (num % 2) == 0 ) return false;

    for(int i=3; i*i <= num; i+=2 ) {
      if ( num % i == 0 ) return false;
    }
    return true;
  }
}


Measured memory_bytes: 30124
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int C=100005;

int n,c,w[105],v[105];
ll dp[C];

int main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>c;
	for (int i=1;i<=n;++i) cin>>w[i]>>v[i];
	for (int i=1;i<=n;++i)
	    for (ll j=c;j>=w[i];--j)
	        dp[j]=max(dp[j],dp[j-w[i]]+v[i]);
	cout<<dp[c]<<'\n';
}

Measured memory_bytes: 1024
# coding: utf-8

import math

N = int(input())

P = [int(x) for x in input().split()]
Q = [int(x) for x in input().split()]

n = list(range(1, N + 1))
a = 1
for i in range(len(P) - 1):
	a += math.factorial(N - i - 1) * (n.index(P[i]))
	n.remove(P[i])

n = list(range(1, N + 1))
b = 1
for i in range(len(Q) - 1):
	b += math.factorial(N - i - 1) * (n.index(Q[i]))
	n.remove(Q[i])

print(abs(a - b))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    
    int M = 2 * N;
    int sq = sqrt(M);
    if (sq * (sq + 1) == M) {
        cout << "Yes" << endl;
        int k = sq + 1;
        cout << k << endl;
        
        vector<vector<int>> S(k);
        int cnt = 1;
        REP(i, k) {
            REPF(j, i + 1, k) {
                S[i].pb(cnt);
                S[j].pb(cnt);
                cnt++;
            }
        }

        REP(i, k) {
            cout << SZ(S[i]);
            FORE(x, S[i]) cout << " " << x;
            cout << endl;
        }
    } else {
        cout << "No" << endl;
        return 0;
    }
    return (0^_^0);
}



Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X, N;
  cin >> X >> N;
  
  if (N == 0) {
    cout << X << endl;
  }
  
  else if (N != 0) {
  vector<int> vec(N);
  for (int i=0; i<N; i++) {
    cin >> vec.at(i);
  }

   for (int i=0; i<100; i++) {
     int minus = 0;
       int plus = 0;
     for (int j=0; j<N; j++) {
       if (X-i == vec.at(j)) {
         minus++;
       }
        if (X+i == vec.at(j)) {
          plus++;
        }
     }
     
     if (minus == 0 && plus == 0) {
       cout << X-i << endl;
       break;
     }
     
     else if (minus == 0 && plus == 1) {
       cout << X-i << endl;
       break;
     }
     
      else if (minus == 1 && plus == 0) {
       cout << X+i << endl;
       break;
     }
   }
  }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

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

    if (a * c <= b)
        cout << c << endl;
    else
        cout << b / a << endl;
}


Measured memory_bytes: 256
//* AuThOr GaRyMr *//
//Codeforces ID: GaryMr
//Atcoder ID: Gary
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define niv vector<int>
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
LL n,p;
LL check(LL x)
{
	LL now=1;
	if(p/now<x) return 0;
	rb(i,1,n){
		now*=x;
		if(p/now<x&&i!=n) return 0;
	}
	return now;
}
int main(){
	cin>>n>>p;
	if(n==1) cout<<p<<endl;
	else {
		LL res=1;
		LL is=2;
		while(1){
			if(check(is)){
				if(p%check(is)==0) res=is;
			}
			else break;
			is++;
		}
		printf("%lld\n",res);
	}
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [input().split() for _ in range(N)]

if N ==1:
  n = int(A[0][0])
  move = int(A[0][1]) + int(A[0][2]) 
  if move > n or move%2 != n%2:
    print("No")
  else:
    print("Yes")
  
for i in range(1,N):
  H = abs(int(A[i][1]) - int(A[i -1][1]))
  V = abs(int(A[i][2]) - int(A[i -1][2]))
  move = H + V
  n = int(A[i][0]) - int(A[i -1][0])
  if move > n or move%2 != n%2:
    print("No")
    break
  elif i == N -1:
    print("Yes")
	  

Measured memory_bytes: 32148
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int main() {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    int ans = 0;
    while (x <= y) {
        ans++;
        x *= 2;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
public class Main {
	
	
	 
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        char[] s = sc.next().toCharArray();
        String[] ans = new String[n];
        int rem = a+b;
        int remb = b;
        for(int i = 0; i < n; i++) {
        	if(s[i]=='a'&&rem>0) {
        		rem--;
        		ans[i]="Yes";
        	}
        	else if(s[i]=='b'&&rem>0&&remb>0) {
        		rem--;
        		remb--;
        		ans[i]="Yes";
        	}
        	else {
        		ans[i]="No";
        	}
        }
        for(int i = 0; i < n; i++) {
        	System.out.println(ans[i]);
        }
	}
}

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

using namespace std;

int dfs(int now,int a[],int b[],int node_num,int edge_num, bool node[]);
int main(void)
{
	int n,m; cin>>n>>m;
	int a[m],b[m]; for(int i = 0; i < m; i++) cin>>a[i]>>b[i];
	bool node[n]; for(int i = 0; i < n; i++) node[i] = false;
	int ans = dfs(1,a,b,n,m,node);
	
	cout<<ans<<endl;
	return 0;
}

int dfs(int now,int a[],int b[],int node_num,int edge_num,bool node[]){
	//cout<<"now = "<<now<<endl;
	node[now-1] = true;
	/*
	for(int i = 0; i < node_num; i++){
		cout<<"i = "<<i;
		if(node[i] == true) cout<<", node[i] = true"<<endl;
		else cout<<", node[i] = false"<<endl;
	}
	*/
	int kk = 0;
	for(int i = 0; i < node_num; i++){
		if(node[i] == true) kk++;
	}
	if(kk == node_num) return 1;
	int re = 0;
	for(int i = 0; i < edge_num; i++){
		if(a[i] == now && node[b[i]-1] == false){
			bool n_node[node_num]; for(int i = 0; i < node_num; i++) n_node[i] = node[i];
			re += dfs(b[i],a,b,node_num,edge_num,n_node);
		}
		else if(b[i] == now && node[a[i]-1] == false){
			bool n_node[node_num]; for(int i = 0; i < node_num; i++) n_node[i] = node[i];
			re += dfs(a[i],a,b,node_num,edge_num,n_node);
		}
	}
	return re;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
const int mod=1000000007;
int inv[101010],f[101010];
int a[101010];
int h[101010];
int n;
int calc(int l)
{
	return (long long)f[n]*inv[l]%mod;
}
int main()
{
	int sum=0,ans=0,x;
	scanf("%d",&n);
	inv[0]=inv[1]=1;
	for(int i=2;i<=n;i++)
		inv[i]=(long long)(mod-mod/i)*inv[mod%i]%mod;
	for(int i=2;i<=n;i++)
		inv[i]=(long long)inv[i-1]*inv[i]%mod;
	f[0]=1;
	for(int i=1;i<=n;i++)
		f[i]=(long long)f[i-1]*i%mod;
	h[0]=0;
	for(int i=1;i<=n;i++)
	{
		h[i]=((long long)sum*f[i-1]+f[i])%mod;
		sum=((long long)h[i]*inv[i]+sum)%mod;
	}
	for(int i=1;i<=n;i++)
		(h[i]+=mod-f[i])%=mod;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&x);
		ans=((long long)x*((long long)h[i]*calc(i)%mod+(long long)h[n-i+1]*calc(n-i+1)%mod)+ans)%mod;
		ans=((long long)x*f[n]+ans)%mod;
	}
	printf("%d",(ans+mod)%mod);
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
ll f(ll x){
    if(x%2==0)return x/2;
    else return 3*x+1;
}
int main(void){
    // Your code here!
    ll s;
    cin>>s;
    if(s==1 || s==2 || s==4){
        cout<<4;
        return 0;
    }
    bool t=false;
    rep(0,i,(ll)1e7){
        s=f(s);
        if(!t&&s==4)t=true;
        else if(t&&s==4){
            cout<<i+2;
            return 0;
        }
    }
}

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

main()
{
    int A[3];
    cin >> A[0] >> A[1] >> A[2];
    sort(A,A+3);
    cout << A[0] << " " << A[1] << " " << A[2] <<endl;

    return 0;
}

Measured memory_bytes: 1180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  vector<ll> a(n), b(m);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  ll ans = 0;

  vector<ll> sumA(n+1), sumB(m);
  sumA[0] = 0; sumB[0] = b[0];
  reps1(i, n+1) sumA[i] = sumA[i-1] + a[i-1];
  reps1(i, m) sumB[i] = sumB[i-1] + b[i];

  rep(i, n+1) {
    ll count = sumA[i];
    if (count > k) break;

    // cout << i << " " << k << " " << " " << count << " " << ans << endl;

    ll pos = upper_bound(sumB.begin(), sumB.end(), k-count) - sumB.begin();
    /*
    ll pos = 0;
    rep(j, m) {
      count += b[j];
      pos++;
      if (count > k) {
        pos--;
        break;
      }
    }
    */
    chmax(ans, i+pos);
    // cout << i << " " << k << " " << pos << " " << count << " " << ans << endl;
  }

  cout << ans << endl;

/*
  stack<ll> stackA;
  stack<ll> stackB;
  ll count;

  rep(i, n) {
    ll a;
    cin >> a;
    count += a;
    stackA.push(a);
  }

  rep(i, m) {
    ll b;
    cin >> b;
    count += b;
    stackB.push(b);
  }

  ll ans = n + m;

  while(count > k) {
    ll a = stackA.top();
    ll b = stackB.top();
    cout << a << " " << b << " " << " " << count << " " << ans << endl;

    if (a >= b) {
      stackA.pop();
      count -= a;
    }
    else {
      stackB.pop();
      count -= b;
    }

    ans--;
  }
  */

  // cout << ans << endl;











  return 0;
}


Measured memory_bytes: 9448
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <bitset>

using namespace std;
using ll = long long;
using ld = long double;
const ll mod =  1000000007;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP_FROM(i, j, n) for (ll i = (j); i < (n); ++i)
#define all(x) (x).begin(),(x).end()

ll power(ll base, ll exponent, ll module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ ll root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
ll inverse(ll x){ return power(x, mod - 2, mod);}
ll gcd(ll a, ll b) {if(a < b) gcd(b, a);ll r;while(r=a%b) {a=b;b=r;}return b;}
struct combination{ vector<ll> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } ll C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int bsearch(const vector<ll>& a, ll x){
  int lft = 0;
  int rgt = a.size();
  while (rgt - lft > 1) {
    int mid = (lft + rgt) / 2;
    if(a[mid] < x) {
      lft = mid;
    }
    else {
      rgt = mid;
    }
  }
  return lft;
}

signed main() {
  ios::sync_with_stdio(false);
  int a, b, q;
  cin >> a >> b >> q;
  vector<ll> s(a);
  vector<ll> t(b);
  REP(i, a) cin >> s[i];
  REP(i, b) cin >> t[i];
  sort(all(s));
  sort(all(t));
  REP(i, q) {
    ll x;
    cin >> x;
    ll ans = 2e10;
    int j = bsearch(s, x);
    int k = bsearch(t, x);
    ll tmp = 0;
    ans = min({ans, abs(x-s[j]) + abs(s[j] - t[k]), abs(x-t[k]) + abs(s[j] - t[k])});
    if(j+1 < s.size()) {
      ans = min({ans, abs(x-s[j+1]) + abs(s[j+1] - t[k]), abs(x-t[k]) + abs(s[j+1] - t[k])});
    }
    if(k+1 < t.size()) {
      ans = min({ans, abs(x-s[j]) + abs(s[j] - t[k+1]), abs(x-t[k+1]) + abs(s[j] - t[k+1])});
    }
    if(j+1 < s.size() && k+1 < t.size()) {
      ans = min({ans, abs(x-s[j+1]) + abs(s[j+1] - t[k+1]), abs(x-t[k+1]) + abs(s[j+1] - t[k+1])});
    }
    cout << ans << endl;
  }
  return 0;
}


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

int V, E;
vector<bool> visited;
vector<int> depth, lowlink, pars;

void dfs(vector<vector<int>> &G, int p, int u, int d){
    visited[u] = true;
    pars[u] = p;
    depth[u] = lowlink[u] = d;
    
    for(auto v: G[u]) if(v != p){
        if(!visited[v]){
            dfs(G, u, v, d+1);
            lowlink[u] = min(lowlink[u], lowlink[v]);
        }else{
            lowlink[u] = min(lowlink[u], depth[v]);
        }
    }
}

int main(){
    cin >> V >> E;
    
    vector<vector<int>> G(V);
    for(int i=0; i<E; i++){
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    depth.assign(V, -1), lowlink.assign(V, -1);
    visited.assign(V, false);
    pars.assign(V, -1);
    dfs(G, -1, 0, 0);
    
    vector<vector<int>> tree(V);
    for(int i=0; i<V; i++){
        int p = pars[i];
        if(p != -1)
            tree[p].push_back(i);
    }
    
    if(tree[0].size() > 1)
        cout << 0 << endl;
    for(int s=1; s<V; s++){
        bool art = false;
        for(auto v: tree[s]){
            art |= depth[s] <= lowlink[v];
        }
        if(art)
            cout << s << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4892
#include<stdio.h>
int main(){

	int a,b;
	for(;;){
	scanf("%d%d",&a,&b);
	if(a==0&&b==0){
		break;
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			if((i+j)%2==1){
				printf(".");
		}else{
		printf("#");
	}
		}printf("\n");
	}
	printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1000
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{     
    public Program()
    {
      int[] inputs = Console.ReadLine().Split().Select(int.Parse).ToArray();
      int n = inputs[0];
      int m = inputs[1];
      int result = 
        Enumerable.Range(1, (int)Math.Sqrt(m) + 1)
        .Where(x => m % x == 0)
        .SelectMany(x => new int[]{x, m / x })
        .Where(x => x <= m / n)
        .Max();
      Console.WriteLine(result);
    }
    static void Main(string[] args)
    {
        var p = new Program();
    }
}


Measured memory_bytes: 13524
//#include<bits/stdc++.h>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<stdio.h>
#include <cstdio>
#include <cstring>
#include <string>


using namespace std;

#define ld long double
#define ll long long
#define ff first
#define ss second
#define sz(a) (int)a.size()
#define mem(a, b) memset((a), (b), sizeof(a))
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define pii pair<int ,int >
#define pll pair<ll ,ll >
#define mp make_pair
#define vi vector<int >
#define vii vector<pii>
#define vvi vector < vi >
#define vll vector < ll >
#define vllll vector < pll >
#define vvll vector < vll >
#define forn(i,n) for(int i=0;i<(n);i++)
#define fori(i,s,e) for(int i=s,i<n;i++)
#define qi  queue <int >
#define qll  queue <ll >
#define in_r(x,y,n,m) (x>=0 && x<n && y>=0 && y<m)
#define maxn 1000009


void fast(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}


const ll MOD = 1e9 + 9;
const double EPS = (1e-8);
const int OO = (int) 1e9 + 7;
const ll OOO = (ll) 1e18 + 7;
//double const PI = 3.1415926535897932384626433832795;
const int mxn = 200007;
char c1, c2, c3, c4;
string s, s1, s2, s3;
int   n, m, k, t = 1, q, a, b, c, d, e, x, y, z; ll sol = 0;





void pre(){}
void solve(){
	
	cin >> s;
	cout << s[0] << s[1] << s[2];

}


int main(){
	fast();
	

	pre();
	//cin >> t; 
	while (t--){

		solve();

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

Measured memory_bytes: 3640
def main():
    s = input().strip()
    if len(s) == 26:
        if s == "zyxwvutsrqponmlkjihgfedcba":
            print(-1)
            return
        s = s[::-1]
        pre = ord(s[0]) - ord("a")
        nums = [pre]
        for i in range(1, len(s)):
            tmp = ord(s[i]) - ord("a")
            if tmp < pre:
                min_ = pre
                for num in nums:
                    if num > tmp:
                        min_ = min(min_, num)
                s = s[i+1:]
                # print(nums, ">", tmp, min_)
                print(s[::-1]+chr(min_+ord("a")))
                return
            nums.append(tmp)
            pre = tmp
    else:
        check = [False] * 26
        for i in range(len(s)):
            check[ord(s[i]) - ord("a")] = True
        for i in range(26):
            if not check[i]:
                print(s+chr(ord("a")+i))
                return

if __name__ == "__main__":
    main()


Measured memory_bytes: 3192
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;


using ll = long long;

#define int ll


const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 1e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-4;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


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


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, a, b;
int mult(int a, int b) {
    a%=mod;
    b%=mod;
    a*=b;
    a%=mod;
    return a;
}
int binpow (int a, int n) {
	int res = 1;
	while (n) {
		if (n & 1)
			res *= a,res%=mod;
		a *= a;
		a%=mod;
		n >>= 1;
	}
	return res;
}
int power(int a, int b) {
    int res=1;
    while (b) {
        if (b & 1) {
            res = mult(res, a);
        }
        a = mult(a,a);
        b>>=1;
    }
    return res;
}
int c(int n, int k) {
    int res=1;
    fo(i,1,k,1) res = mult(res, mult(n-k+i, binpow(i, mod-2)));
    return res;
}
int subtr(int a, int b) {
    a%=mod;
    b%=mod;
    a-=b;
    a+=mod;
    a%=mod;
    return a;
}
main() {
    file("threesum");
    ios;
    cin>>n>>a>>b;
    int ans=subtr(binpow(2,n),1);
    ans%=mod;
    ans=subtr(ans,c(n,a));
    ans=subtr(ans,c(n,b));
    cout<<ans;
    cerr << "\nTime elapsed: " << (clock() + 0.0) / CLOCKS_PER_SEC;
    return 0;
}
/**

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int i,j,k,n,m;
void read(int &x){
	char c;x=0;int b=1;do{c=getchar();if(c==45)b=-1;}while(c>57||c<48);
	do x=x*10+c-48,c=getchar();while(c<=57&&c>=48);x*=b;
}
void read(ll &x){
	char c;x=0;int b=1;do{c=getchar();if(c==45)b=-1;}while(c>57||c<48);
	do x=x*10+c-48,c=getchar();while(c<=57&&c>=48);x*=b;
}
int a[10010];
int main() {
	for(i=1;i<=9;i++)
		for(j=1;j<=9;j++)
			a[i*j]=1;
	cin>>n;
	if(a[n])cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	//cerr << 1.0*clock()/CLOCKS_PER_SEC << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[1000001];
int b[1000001];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		char c;
		cin>>c;
		if(c=='L')
			a[i]=0;
		else
			a[i]=1;
	}
	int cnt=1;
	for(int i=2;i<=n;i++)
		if(a[i]==a[i-1])
			b[cnt]++;
		else
			b[++cnt]=1;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==0)
		{
			if(i!=1&&a[i-1]==0)
				ans++;
		}
		else
			if(i!=n&&a[i+1]==1)
				ans++;
	}
	printf("%d",ans+min(cnt-1,k*2));
	return 0;
}
/*
RRRRRLLRRRRLLL
*/

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
int n = 0, hav[maxn], fir[maxn], nxt[maxn << 1], to[maxn << 1];
int fa[maxn], son[maxn], bro[maxn], rez[maxn];
int dis[maxn], root = 0;
void dfstree(int x)
{
	for(int l = fir[x]; l; l = nxt[l])
	{
		int y = to[l];
		if(y == fa[x]) continue;
		fa[y] = x, bro[y] = son[x], son[x] = y;
		dfstree(y);
	}
}
bool sol(int x)
{
	if(dis[x] == 1)
	{
		rez[x] = hav[x];
		return true;
	}
	int s = 0, w = 0;
	for(int y = son[x]; y; y = bro[y])
	{
		if(not sol(y)) return false;
		s += rez[y], w = max(w, rez[y]);
	}
	if(s < hav[x]) return false;
	if(w <= s - w)
	{
		if((s >> 1) + (s & 1) > hav[x]) return false;
		rez[x] = (hav[x] << 1) - s; return true;
	}
	else
	{
		if(w > hav[x]) return false;
		rez[x] = (hav[x] << 1) - s; return true;
	}
}
signed main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++) scanf("%d", hav + i);
	if(n == 2)
	{
		puts(hav[1] == hav[2]? "YES": "NO");
		return 0;
	}
	for(int i = 1, j = 0; i < n; i++)
	{
		int a = 0, b = 0;
		scanf("%d%d", &a, &b);
		j++, nxt[j] = fir[a], fir[a] = j, to[j] = b;
		j++, nxt[j] = fir[b], fir[b] = j, to[j] = a;
		dis[a]++, dis[b]++;
	}
	for(int i = 1; i <= n; i++)
		if(dis[i] > 1) { root = i; break; }
	dfstree(root);
	puts(sol(root) && rez[root] == 0? "YES": "NO");
	return 0;
}

Measured memory_bytes: 8576
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;


int main(void){
    ll n,k;
    cin >> n >> k;
    ll h[110000];
    REP(i,n) cin >> h[i];
    ll dp[110000];
    REP(i,110000) dp[i]=INF;
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=1;j<=k;j++){
            chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef int64_t Int;
const double pi = M_PI;

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

    long max = -100000000, min = 100000000, sum = 0, a[n];
    for (Int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    for (Int i = 0; i < n; i++)
    {
        if (a[i] < min)
        {
            min = a[i];
        }

        if (max < a[i])
        {
            max = a[i];
        }

        sum += a[i];
    }

    cout << min << ' ' << max << ' ' << sum << endl;
}



Measured memory_bytes: 3164
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <fstream>
#include <cstdio>
#include <stdio.h>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
long long minArr(const T * arr, int s, int fn) {
    ll res = 1e16 + 1;
    for (int i = s; i <= fn; ++ i) {
        res = min(res, arr[i]);
    }
    return res;
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

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

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

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

pair <int, int> p[N];

int main () {
    to_pray();
    
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; ++ i) {
    	int x;
    	cin >> x;
    	p[i].F = x;
    	p[i].S = i;
    }
    
    sort(p + 1, p + 1 + n);
    
    for (int i = 1; i <= n; ++ i) {
    	cout << p[i].S << " ";
    }
    
    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int64_t> Lucas = { 2, 1, };
  for (int i = 0; i < N; i++) {
    int64_t x = Lucas.at(i) + Lucas.at(i+1);
    Lucas.push_back(x);
  }
  cout << Lucas.at(N) << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N;
	static double T;
	static double[] S, P, Q, TH;

	public static void main(String[] args) {
		while (sc.hasNext()) {
			N = sc.nextInt();
			if (N == 0) break;
			T = sc.nextDouble();
			S = new double[N];
			P = new double[N];
			Q = new double[N];
			TH = new double[N];
			for (int i = 0; i < N; ++i) {
				S[i] = Double.parseDouble(sc.next());
				P[i] = Double.parseDouble(sc.next());
				Q[i] = Double.parseDouble(sc.next());
				TH[i] = Double.parseDouble(sc.next());
			}
			System.out.printf("%.8f\n", solve());
		}
	}

	static double solve() {
		double lo = 0;
		double hi = 10000000;
		for (int i = 0; i < 200; ++i) {
			double m1 = (lo * 2 + hi) / 3;
			double m2 = (lo + hi * 2) / 3;
			double v1 = calc(m1);
			double v2 = calc(m2);
			if (v1 < v2) {
				hi = m2;
			} else {
				lo = m1;
			}
		}
		return calc((lo + hi) / 2);
	}

	static double calc(double a) {
		double ret = a * T;
		for (int i = 0; i < N; ++i) {
			double rest = TH[i] - S[i] * a;
			if (rest > 0) ret += rest / Q[i] * P[i];
		}
		return ret;
	}

}

Measured memory_bytes: 641608
#include<stdio.h>
int main(void)
{
	int a, b, c, d, e;

	
	scanf("%d%d%d", &a, &b, &c);
	d = a - b;
	e = c - d;


	if (e > 0)
		printf("%d", e);
	else
		printf("0");

	return 0;


}

Measured memory_bytes: 128
import { isRegExp } from "util";

class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let s = o.s()
  let a = o.s()
  if(a.slice(0, a.length-1) == s) {
    o.Yes()
  }else{
    o.No()
  }
}
m();

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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	map<char, int> ch;
	
	string w;
	cin >> w;
	for(int i=0; i<w.size(); i++){
		if(ch.find(w[i]) == ch.end()){
			ch[w[i]] = 1;
		}else{
			ch[w[i]]++;
		}
	}

	for(auto it = ch.begin(); it != ch.end(); it++){
		if(it->second % 2 != 0){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	
	return 0;
}


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

int main(void)
{
	int a, b, c, d, e, f;
	cin >> a >> b >> c >> d >> e >> f;

	double check_conc = (double)e / (100+e);

	double max_conc = 0.0;
	int max_conc_w = a*100, max_conc_s = 0;

	for (int i = 0; i*100*a <= f; i++) {
		for (int j = 0; (i*100*a + j*100*b) <= f; j++) {
			if (i == 0 && j == 0)
				continue;
			int water = i*100*a + j*100*b;
			for (int k = 0; water + k*c <= f; k++) {
				for (int l = 0; (water + k*c+l*d) <= f; l++) {
					int sugar = k*c+l*d;
					double conc = (double)sugar/(double)(water+sugar);
					if (conc <= check_conc && conc > max_conc) {
						max_conc = conc;
						max_conc_w = water;
						max_conc_s = sugar;
					}
				}
			}
		}
	}



	cout << max_conc_w+max_conc_s << " " << max_conc_s << endl;
	return 0;
}


Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//

    x:i64,
        }

    let mut ans = 0;
    ans = 8 - (x - 400) / 200;
    println!("{}", ans);
}


Measured memory_bytes: 2200
/* ファイル名：ITP1_6_C.c	*/
/* 内容：Ａ大学の１フロア１０部屋、３階建ての公舎４棟の管理	*/
/* 		公舎の入居・退去の情報を読み込み、各部屋の入居者数を出力する	*/

/* include	*/
#include <stdio.h>

/* 外部変数宣言	*/

/* プロトタイプ宣言	*/

/* 関数名:main	*/
/* 処理内容:Ａ大学の１フロア１０部屋、３階建ての公舎４棟の管理	*/
int main( void )
{
	/* 内部変数定義	*/
	/* 入力	*/
	int b;	/* 棟	*/
	int f;	/* 階数	*/
	int r;	/* 部屋番号	*/
	int v;	/* 入居者数	*/
	int n;	/* 与えられる情報の数	*/
	
	/* 処理	*/
	int room[4][3][10];	/* 公舎の各部屋の入居者数	*/
	int i;	/* ループ用変数1	*/
	int j;	/* ループ用変数2	*/
	int k;	/* ループ用変数3	*/
	
	/* 公舎の各部屋の入居者数の初期化	*/
	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
			for(k = 0; k < 10; k++){
				room[i][j][k] = 0;	/* 入居者数を0にする	*/
			}
		}
	}
	
	scanf("%d",&n);	/* 与えられる情報の数を取得	*/
	
	/* 情報を入力	*/
	for(i = 0; i < n; i++){
		/* 情報を取得	*/
		scanf("%d %d %d %d",&b,&f,&r,&v);
		
		/* 該当する部屋に入居者(退去者)の人数を入れる	*/
		room[b - 1][f - 1][r - 1] += v;
	}
	
	/* 結果を出力	*/
	
	for(i = 0; i < 4; i++){
		for(j = 0; j < 3; j++){
			for(k = 0; k < 10; k++){
				printf(" %d",room[i][j][k]);	/*入居者の人数を空白付きで出力	*/
			}
			
			printf("\n");	/* 階ごとに改行	*/
		}
		
		/* 最後の棟ではない場合*/
		if(i < 3){
			printf("####################\n");/* 棟ごとに区切り	*/
		}
		/* 最後の棟の場合*/
		else{
			/* 棟ごとの区切りなし	*/
		}
	}
	
	return 0;
}



Measured memory_bytes: 2056
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define li long
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define pb push_back
#define fori(i,k,n) for(int i = k;i<n; i++)
#define rfori(i,k,n) for(int i = k; i>=n; i--)
#define cd complex<double>
const int N = 100000;
vector<int> bit(N+2,0);
int next(int x)
{
    return x+(x&(-x));
}
int par(int x)
{
    return x-(x&(-x));
}
void update(int x,int val,int n)
{
    while(x<n)
    {
        bit[x]+=val;
        x = next(x);
    }
}
void bitify(vector<int> &a,int n)
{
    for(int i = 1; i<=n; i++)
    {
        update(i,a[i-1],n);
    }
}

int getsum(int x)
{
    int sum = 0;
    while(x>0)
    {
        sum+=bit[x];
        x = par(x);
    }
    return sum;
}
int rsum(int a,int b)
{
    return getsum(b)-getsum(a-1);
}
void optimize()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
int power(int x, int y)
{
   int res = 1;

    //x = x % p;

    while (y > 0)
    {

        if (y & 1)
            res = (res*x) ;


        y = y>>1;
        x = (x*x) ;
    }
    return res;
}

//const int N = 10000000;
int lp[N+1];
unordered_set<int> st;
vector<int> pr;
void solve(){
for (int i=2; i<=N; ++i) {
    if (lp[i] == 0) {
        lp[i] = i;
        st.insert(i);
        pr.push_back(i);
    }
    for (int j=0; j<(int)pr.size() && pr[j]<=lp[i] && i*pr[j]<=N; ++j)
        lp[i * pr[j]] = pr[j];
}
}
class TrieNode
{
public:

    TrieNode* left;
    TrieNode* right;
    TrieNode()
    {
        left = NULL;
        right = NULL;
    }
};
void insert(TrieNode* head,int x)
{
    TrieNode* curr = head;
    for(int i = 31; i>=0; i--)
    {
        int b = (x>>i)&1;
        if(b == 0)
        {
            if(!curr->left)curr->left = new TrieNode();
            curr = curr->left;
        }
        else
        {
            if(!curr->right)curr->right = new TrieNode();
            curr = curr->right;
        }
    }
}
int maxXorVal(TrieNode* head,vector<int> &arr,int n)
{
    int max_xor = INT_MIN;
    for(int i = 0; i<n; i++)
    {
        int val = arr[i];
        TrieNode* curr = head;
        int curr_xor = 0;
        for(int j = 31; j>=0; j--)
        {
            int b = (val>>j)&1;
            if(b == 0)
            {
                if(curr->right)curr = curr->right,curr_xor+=power(2,j);
                else curr = curr->left;
            }
            else
            {
                if(curr->left)curr = curr->left,curr_xor += power(2,j);
                else curr = curr->right;
            }
        }
        max_xor = max(max_xor,curr_xor);
    }
    return max_xor;
}

void test_case()
{

    ll a,b,k;
    cin>>a>>b>>k;
    if(a>=k)cout<<a-k<<" "<<b;
    else cout<<0<<" "<<(b-k+a>=0?b-k+a:0);
}

int main()
{
	optimize();
	test_case();
}



Measured memory_bytes: 640
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
vector<int> fri[100000];
vector<int> blo[100000];
int frindex[100000];
int frindexcounter[100000];
int blocounter, fricounter[100000];
int main() {
	
	//C
	int n, m;
	int s[3] = { -1,-1,-1 };
	int a, b;
	int i;
	cin >> n >> m;
	for (i = 0; i < m; i++) {
		cin >> a >> b;
		if (s[a - 1] == -1) {
			s[a - 1] = b;
		}
		else {
			if (s[a - 1] != b) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	if (n == 3) {
		if (s[0] == 0) {
			cout << -1 << endl;
			return 0;
		}
		else if (s[0] == -1) {
			a = 100;
		}
		else {
			a = s[0] * 100;
		}
		if (s[1] == -1) {
			
		}
		else {
			a = a + s[1] * 10;
		}
		if (s[2] == -1) {

		}
		else {
			a = a + s[2];
		}
	}
	else if (n == 2) {
		if (s[0] == 0) {
			cout << -1 << endl;
			return 0;

		}
		else if (s[0] == -1) {
			a = 10;
		}
		else {
			a = s[0] * 10;
		}
		if (s[1] == -1) {

		}
		else {
			a = a + s[1] * 1;
		}
	}
	else {
		if (s[0] == -1) {
			a = 0;
		}
		else {
			a = s[0];
		}
	}
	cout << a << endl;
	return 0;
	//D
	/*int n, m, k;
	cin >> n >> m >> k;

	int i, j, a, b;
	for (i = 0; i < m; i++) {
		cin >> a >> b;
		fri[a - 1].push_back(b - 1);
		fri[b - 1].push_back(a - 1);
	}
	for (i = 0; i < k; i++) {
		cin >> a >> b;
		blo[a - 1].push_back(b - 1);
		blo[b - 1].push_back(a - 1);
	}

	for (i = 0; i < n; i++) {
		frindex[i] = -1;
		frindexcounter[i] = 0;
	}
	queue<int> que;
	int index = 0;
	for (i = 0; i < n; i++) {
		if (frindex[i] == -1) {
			frindex[i] = index;
			que.push(i);
			while (que.size()) {
				j = que.front(); que.pop();
				for (a = 0; a < fri[j].size(); a++) {
					if (frindex[fri[j][a]] == -1) {
						que.push(fri[j][a]);
						frindexcounter[index]++;
						frindex[fri[j][a]] = index;
					}
				}
			}
			index++;
		}
	}

	for (i = 0; i < n; i++) {
		blocounter = 0;
		for (j = 0; j < blo[i].size(); j++) {
			if (frindex[blo[i][j]] ==frindex[i]) {
				blocounter++;
			}
		}
		fricounter[i] = frindexcounter[frindex[i]] - fri[i].size() - blocounter;
		
	}
	for (i = 0; i < n; i++) {
		cout << fricounter[i] << ' ';
	}
	return 0;*/

}

Measured memory_bytes: 8288
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
using vb = vector<bool>;
using vb2 = vector<vector<bool>>;
using vc = vector<char>;
using vc2 = vector<vector<char>>;
using vs = vector<string>;
using si = set<int>;
using vs2 = vector<vector<string>>;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9+1;
const ll LINF = 1e18+1;
const long double PI = acos(-1.0);

#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)
#define sz(x) (int)(x).size()
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
 
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SORT(v) sort(ALL(v));
#define RSORT(v) sort(RALL(v));
#define IN(type,a) type a;cin >> a;
#define VIN(type,a,n) vector<type> a(n);cin >> a;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define COUT(x) cout << (x) << endl;
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;
#define ENDL cout << endl;
#define DB(s,x) cout << (s) << " : " << x << endl;
 
#define HOGE COUT("HOGE")
 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}
 
template<typename T> bool chmax(T& a, const T& b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T& a, const T& b){if(a>b){a=b;return true;}return false;}
template<typename T> T gcd(T a,T b){if(b==0){return a;}else{return gcd(b, a%b);}}
template<typename T> T lcm(T a,T b){return a*b/gcd(a, b);}


const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
 
int main() {
    IN(int, n);
    VIN(int, a, n);
    a.push_back(INF);
    int s = 0;
    int e = 0;
    int ans = 0;
    while (e < n) {
        if (a[e]>=a[e+1]) {
            e++;
        }else{
            chmax(ans, e-s);
            e++;
            s=e;
        }
    }
    COUT(ans);
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N,M,E,S,T,R,a[8],b[8],c[8],inf=1e9;
vector<int> G[100];
int d[100][101][1<<8];
int main(){
	cin>>N>>M>>E>>S>>T>>R;
	rep(i,M){
		int a,b;
		cin>>a>>b;
		G[a].pb(b),G[b].pb(a);
	}
	rep(i,E) cin>>a[i]>>b[i]>>c[i];
	rep(i,N) rep(j,R+1) rep(k,1<<E) d[i][j][k]=inf;
	deque<int> ps,rs,bs;
	ps.pb(S),rs.pb(0),bs.pb(0);
	d[S][0][0]=0;
	while(!ps.empty()){
		hoge:
		int v=ps.front(),r=rs.front(),bt=bs.front();
		ps.pop_front();rs.pop_front();bs.pop_front();
//		cout<<v<<" "<<r<<" "<<bt<<"  d="<<d[v][r][bt]<<endl;
		if(v==T){
			cout<<d[v][r][bt]<<endl;
			return 0;
		}
		rep(i,E){
			if(c[i]==v&& ((bt>>i)&1)==0 ){
				int nbt=bt+(1<<i);
				if(d[v][r][nbt]==inf){
					ps.push_front(v);
					rs.push_front(r);
					bs.push_front(nbt);
					d[v][r][nbt]=d[v][r][bt];
					goto hoge;
				}
			}
		}
		if(r<R){
			for(int u:G[v]){
				if(d[u][r+1][bt]==inf){
					ps.pb(u);
					rs.pb(r+1);
					bs.pb(bt);
					d[u][r+1][bt]=d[v][r][bt]+1;
				}
			}
			rep(i,E){
				if((bt>>i)&1){
					if(a[i]==v) swap(b[i],a[i]);
					if(b[i]==v){
						int u=a[i];
						if(d[u][r+1][bt]==inf){
							ps.pb(u);
							rs.pb(r+1);
							bs.pb(bt);
//							if(u==5){
//								cout<<"   "<<v<<" "<<r<<" "<<bt<<endl;
//							}
							d[u][r+1][bt]=d[v][r][bt]+1;
						}
					}
				}
			}
		}
		if(d[S][0][bt]==inf){
			ps.pb(S);
			rs.pb(0);
			bs.pb(bt);
			d[S][0][bt]=d[v][r][bt]+1;
		}
	}
	puts("-1");
}

Measured memory_bytes: 9368
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	int K;
	cin >> K;
	if (K % 2 == 0)cout << (K / 2)*(K / 2) << endl;
	else cout << (K / 2 + 1)*(K / 2) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long res;

        long max=1;
        for(int i=1; i<Math.sqrt(N)+1; i++){
            if(N%i==0){

                max = i;

            }
        }
        res = max+N/max-2;
        System.out.println(res);
	}
}

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

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


int main(){
  int N,M;
  cin >> N;
  vector <int> D(N);
  rep(i,N)
    cin >> D.at(i);
  
  cin >> M;
  vector <int> T(M);
  rep(i,M)
    cin >> T.at(i);
  
  if(M>N){
    cout << "NO" << endl;
    return 0;
  }
  
  int tmp=0;
  sort(D.begin(),D.end());
  sort(T.begin(),T.end());
  
  rep(i,M){
    for(int j=tmp;j<N;j++){
      if(T.at(i)==D.at(j)){
        tmp=j+1;
        D.at(j)=0;
          break;
      }
      else if(T.at(i)<D.at(j)){
        //cout << i << j << endl;
        cout << "NO" << endl;
        return 0;
      }
 	 }	
  	}
  cout << "YES" << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int n;
char str[110];

int main(){
    scanf("%d%s", &n, str);
    if(n & 1) printf("No\n");
    else{
        int m = n / 2;
        for(int i = 0; i < m; i++){
            if(str[i] != str[i + m]){
                printf("No\n");
                return 0;
            }
        }
        printf("Yes\n");
        return 0;
    }
    return 0;
}

Measured memory_bytes: 128