akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
#define MAXN 200000
#define ll long long
#define Trav(p) for(rint u = first[p], v; ~u; u = e[u].nex)
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
#define BUF_SIZE 1000000
#define _END fwrite(_Ob,1,_O-_Ob,stdout), _O = _Ob
#define Outc(a) (*_O++ = a)
char _Ob[BUF_SIZE+5], *_O = _Ob, _Os[25], *_Ot;
template <typename T> inline void Out(T x)
{
	if(!x){Outc('0'); return;} if(x < 0) Outc('-'), x = -x;
	for(_Ot = _Os; x; *_Ot++ = x%10+'0', x /= 10);
	for(; _Ot != _Os; Outc(*--_Ot)); if(_O-_Ob >= BUF_SIZE-50) _END;
}
int first[MAXN+5], sz[MAXN+5], mx[MAXN+5], o[MAXN+5], fa[MAXN+5], X[MAXN+5], sum, tot, top, rt, n, m; ll d[MAXN+5], ans; bool book[MAXN+5];
struct Edge{int to,nex,w; Edge(){} Edge(int _to, int _nex, int _w){to=_to,nex=_nex,w=_w;}}e[(MAXN<<1)+5];
struct E{int u,v; ll w; E(){} E(int _u, int _v, ll _w){u=_u,v=_v,w=_w;}}ed[(MAXN<<5)+5]; inline bool operator < (E a, E b){return a.w < b.w;}
inline void Add(int a, int b, ll w){e[tot] = Edge(b,first[a],w), first[a] = tot++, e[tot] = Edge(a,first[b],w), first[b] = tot++;}
void DFS_sz(int p, int fa){sz[p] = 1, mx[p] = 0; Trav(p) if(!book[v=e[u].to] && v-fa) DFS_sz(v,p), sz[p] += sz[v], mx[p] = max(mx[p],sz[v]);}
void DFS_rt(int p, int fa){(mx[p]=max(mx[p],sum-sz[p]))<mx[rt]?rt=p:0; Trav(p) if(!book[v=e[u].to] && v-fa) DFS_rt(v,p);}
void DFS_d(int p, int fa){o[++top] = p; Trav(p) if(!book[v=e[u].to] && v-fa) d[v] = d[p]+e[u].w, DFS_d(v,p);}
void DCT(int p)
{
	DFS_sz(p,0), sum = sz[p], rt = p, DFS_rt(p,0), p = rt, book[p] = true, d[p] = top = 0, DFS_d(p,0);
	rt = p, d[p] += X[p]; for(rint i = 2; i <= top; (d[o[i]]+=X[o[i]])<d[rt] ? rt = o[i] : 0, i++);
	for(rint i = 1; i <= top; ed[++m] = E(rt,o[i],d[rt]+d[o[i]]), i++); Trav(p) if(!book[v=e[u].to]) DCT(v);
}
inline int getf(int x){return x-fa[x] ? fa[x] = getf(fa[x]) : x;} inline bool Union(int x, int y){return (x=getf(x))-(y=getf(y)) ? fa[x] = y, true : false;}
int main()
{
	n = read(), memset(first+1,-1,n<<2); for(rint i = 1; i <= n; fa[i] = i, X[i++] = read());
	for(rint i = 2, u, v; i <= n; u = read(), v = read(), Add(u,v,read()), i++); DCT(1), sort(ed+1,ed+m+1);
	for(rint i = 1, c = ~-n; i <= m && n; Union(ed[i].u,ed[i].v) ? --c, ans += ed[i].w : 0, i++);
	printf("%lld\n",ans); return 0;
}

Measured memory_bytes: 75776
from collections import deque

H, W = [int(x) for x in input().split()]

field = []
for i in range(H):
    field.append(input())

conn = [[[] for _ in range(W)] for _ in range(H)]
for i in range(H):
    for j in range(W):
        if field[i][j] == '.':
            for e in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
                h, w = i + e[0], j + e[1]
                if 0 <= h < H and 0 <= w < W and field[h][w] == '.':
                    conn[i][j].append([h, w])
d = 0
for i in range(H):
    for j in range(W):
        l = 0
        q = deque([[i, j]])
        dist = [[-1 for _ in range(W)] for _ in range(H)]
        dist[i][j] = 0
        while q:
            v = q.popleft()
            for w in conn[v[0]][v[1]]:
                if dist[w[0]][w[1]] == -1:
                    q.append(w)
                    dist[w[0]][w[1]] = dist[v[0]][v[1]] + 1
                    l = dist[w[0]][w[1]]

        d = max(d, l)

print(d)

Measured memory_bytes: 9584
package main

import "fmt"

func main() {
	var a int
	count5, count7 := 0, 0
	for i := 0; i < 3; i++ {
		//input
		fmt.Scan(&a)

		//process
		if a == 5 {
			count5++
		} else if a == 7 {
			count7++
		}
	}
	if count5 == 2 && count7 == 1 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


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

int main(int argc, char *argv[])
{
    int n, m, l;
    int A[100][100];
    int B[100][100];

    scanf("%d %d %d\n", &n, &m, &l);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            scanf("%d", &A[i][j]);
        }
    }
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < l; j++) {
            scanf("%d", &B[i][j]);
        }
    }
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < l; j++) {
            long long x = 0;
            for (int k = 0; k < m; k++) {
                x += A[i][k] * B[k][j];
            }
            printf("%s%lld", j == 0 ? "" : " ", x);
        }
        printf("\n");
    }


    return 0;
}



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



int main()
{
    ll h, w;
    cin >> h >> w;
    vector<string> board(h);
    vector<string> ans(h, string(w, '#'));
    REP(i, h) cin >> board.at(i);
    REP(i, h) {
        REP(j, w) {
            if (board.at(i).at(j) == '#') continue;
            ll counter = 0;
            for (ll k = max((ll)0, i-1); k <= min(h-1, i+1); k++) {
                for (ll l = max((ll)0, j-1); l <= min(w-1, j+1); l++) {
                    if (board.at(k).at(l) == '#') counter++;
                }
            }
            ans.at(i).at(j) = '0' + counter;
        }
    }
    for (auto elem : ans) {
        cout << elem << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

void solve(){
    ll n; cin>>n;

    vector<ll> v;
    FOR(i,0,n-1){
        ll x; cin>>x; v.push_back(x);
    }

    sort(all(v));

    if(v[0] == v.back()){
        if(v[0] == n-1 || v[0]*2 <= n){
            cout<<"Yes\n";
        }else {
            cout<<"No\n";
        }
        return;
    }

    if(v[n-1] - v[0] > 1){
        cout<<"No\n";
        return;
    }

    ll cnt = 0;
    FOR(i,0,v.size()-1) if(v[i] == v[0]) cnt++;
    if(cnt + 1 <= v[n-1] && 2*v[n-1] <= 2*cnt + (n-cnt)){
        cout<<"Yes\n";
    }else {
        cout<<"No\n";
    }
}

signed main(){

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif
 
    FastRead;    

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


Measured memory_bytes: 1400
#include<stdio.h>
#include<algorithm>
using namespace std; 
bool cmp(int a,int b)
{
	return a>b;
}
int main(){
	int m,n,w;
	double t,x;
	double a[200],sum;
	while(~scanf("%d%d",&n,&m))
	{
		sum=0;
		for(int i=0;i<n;i++)
		{
			scanf("%lf",&a[i]);
			sum+=a[i];
			}
			sort(a,a+n,cmp);
			x=1.0/(4*m);
			w=1;
			for(int i=0;i<m;i++)
			{
				t=a[i]/sum;
				if(t<x)
				w=0;
			}
			if(!w)
			printf("No\n");
			else
			printf("Yes\n");
			}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <queue>

typedef long long ll;
const ll LL_MAX (1LL<<60);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

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

    ll d;
    cin >>d;

    string e;
    if (d==24)
        e="Eve";
    else if (d==23)
        e="Eve Eve";
    else if (d==22)
        e="Eve Eve Eve";

    cout << "Christmas " + e << endl;

    return 0;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc147/tasks/abc147_d

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 3*1e5;
const int MOD = 1e9+7;

int N;
ll A[N_MAX];
ll acc[N_MAX + 1];

void solve() {
  ll ans = 0;
  ll mul = 1;
  REP(k, 60) {
    ll add = 0;
    REP(i, N) acc[i + 1] = acc[i] + (A[i] >> k & 1);
    REP(i, N - 1) {
      add = acc[N] - acc[i + 1];
      if (A[i] >> k & 1) add = N - (i + 1) - add;
      ans = (ans + add * mul % MOD) % MOD;
    }
    mul = mul * 2 % MOD;
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d", &N);
  REP(i, N) scanf("%lld", A + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 4992
// Your code here!
use std::io::*;
use std::str::FromStr;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}
 
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn string_list(input: String) -> Vec<char> {
    let mut normal = vec![];
    for c in input.chars().into_iter(){
        normal.push(c);
    }
    
    return normal
}


fn main () {
    let l:Vec<i32> = read_vec();

    if l[1]>=l[0] {
        println!("unsafe");
    } else {
        println!("safe");
    }

}


Measured memory_bytes: 2160
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;


int main(){
    cout << fixed << setprecision(20);
    int n; cin >> n;
    vi a(n);
    int all = 0;
    rep(i,n){
        cin >> a[i];
        all ^= a[i];
    }
    rep(i,n){
        int x = a[i] ^ all;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 3892
#5.3
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

findCount = 0

for t in T:
    left = 0
    right = n
    center = right // 2
    preCenter= 0
    while left < right:
        if S[center] == t:
            findCount += 1
            break
        
        if S[center] > t:
            right = center
        else:
            left = center + 1
        
        center = (left + right) // 2

print(findCount)

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

#define BR "\n"
#define SP " "
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] SP; } cout BR;
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout BR;

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

  ll b = 0;
  priority_queue<ll> qL;
  priority_queue<ll, vector<ll>, greater<ll>> qR;
  ll sumL = 0, sumR = 0;

  for (int i = 0; i < Q; i++) {
    int temp;
    cin >> temp;

    if (temp == 1) {

      ll tempA, tempB;
      cin >> tempA >> tempB;

      b += tempB;

      if ( qL.size() == 0 ) {
        qL.push(tempA);
        sumL += tempA;

      } else if ( qL.size() == qR.size() ) {
        ll topR = qR.top();
        if (tempA <= topR) {
          qL.push(tempA);
          sumL += tempA;
        } else {
          qR.pop();
          qL.push(topR);
          sumL += topR;
          qR.push(tempA);
          sumR = sumR - topR + tempA;
        }
      } else {
        ll topL = qL.top();
        if (topL <= tempA) {
          qR.push(tempA);
          sumR += tempA;
        } else {
          qL.pop();
          qR.push(topL);
          sumR += topL;
          qL.push(tempA);
          sumL = sumL - topL + tempA;
        }
      }

    } else {
      ll s = qL.size() + qR.size();
      ll ans1 = qL.top();
      ll ans2 = ans1 * (s % 2) - sumL + sumR + b;

      cout << ans1 << SP << ans2 << BR;
    }
  }

  return 0;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#define ll long long
#define R register
#define mp make_pair 
using namespace std;
const int N = 25;
template <class Ruby> inline void read(Ruby &x)
{
	x=0;
	char ch=getchar(), w=0;
	while(!isdigit(ch))w=(ch=='-'), ch=getchar();
	while(isdigit(ch))x=(x<<1)+(x<<3)+(ch^48), ch=getchar();
	x=w?-x:x;
}
char s[N][N];
int n, m, dis[N][N], ans;
int xa[4]={0, 0, 1, -1}, ya[4]={1, -1, 0, 0};
queue < pair <int, int> >q;
int main()
{
	read(n), read(m);
	for(R int i=1; i<=n; i++)
	{
		scanf("%s", s[i]+1);
	}
	for(R int i=1; i<=n; i++)
	{
		for(R int j=1; j<=m; j++)
		{
			if(s[i][j]=='.')
			{
				memset(dis, 0, sizeof(dis));
				dis[i][j]=1; q.push(make_pair(i, j));
				while(q.size())
				{
					int x=q.front().first, y=q.front().second;
					ans=max(ans, dis[x][y]);
					q.pop();
					for(R int i=0; i<4; i++)
					{
						int xx=x+xa[i], yy=y+ya[i];
						if(xx<1 || xx>n || yy<1 || yy>m || s[xx][yy]=='#')continue;
						if(!dis[xx][yy])
						{
							dis[xx][yy]=dis[x][y]+1;
							q.push(mp(xx, yy));
						}
					}
				}
			}
		}
	}
	cout<<ans-1;
	return 0;
}

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

int main() {
  int N, count=1;
  cin >> N;
  vector<int> d_i(N);
  
  for (int i=0;i<N;i++)
    cin >> d_i.at(i);
  sort(d_i.begin(),d_i.end());
  int minimum = d_i.at(0);
  
  for (int i=1;i<N;i++){
    if ( d_i.at(i) > d_i.at(i-1) )
      count++;
  }
  
  cout << count << endl;
}     

Measured memory_bytes: 3656
n = gets.to_i
a = (1..n).map{gets.to_i}
dp = (1..n).map{[]}

n.times{|i|
  dp[i][i]       = a[i]
  dp[i][(i+1)%n] = [a[i],a[(i+1)%n]].max
}

(n%2==0?3:2).step(n-1,2){|i|
  n.times{|l|
    r = (l+i)%n
    dp[l][r] = [[l,(l+1)%n,r],[r,l,(r+n-1)%n]].map{|x,nextl,nextr|
      if a[nextl] > a[nextr]
        nextl = (nextl+1)%n
      else
        nextr = (nextr+n-1)%n
      end
      a[x] + dp[nextl][nextr]
    }.max
  }
}

p n.times.map{|i|dp[(i+1)%n][i]}.max

Measured memory_bytes: 50392
n, m = gets.split.map(&:to_i)
S = gets.chomp
T = gets.chomp
c = n.lcm(m)
y_n = c / n
y_m = c / m
a = [0]
(1..n - 1).each { |j| a << j * y_n }
b = [0]
(1..m - 1).each { |j| b << j * y_m }
(a & b).each do |j|
  a_i = a.index(j)
  b_i = b.index(j)
  if S[a_i] != T[b_i]
    c = -1
    break
  end
end
puts c


Measured memory_bytes: 19180
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    
    int X_500 = X / 500;
    if (X%500 > 0){
      int X_5 = (X - X_500*500)/5;
      System.out.println(X_500*1000+X_5*5);
    }
    else
      System.out.println(X_500*1000);
    
  }
}

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

int main()
{
    int r;

    cin >> r;
    float l = 2 * 3.1415 * r;
    cout << l;
    return 0;
}


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

#define st first
#define nd second
#define pb push_back
#define mp make_pair
typedef pair< int ,int > pii;
typedef vector< pii > vii;
typedef long long ll;
typedef map<int,int> mii;
typedef set<pii> sii;
typedef set<int> si;
typedef vector< int > vi;

const ll MOD = 119 << 23 | 1;

ll gcd(ll x, ll y){
    if(!y)
        return x;
    return gcd(y,x%y);
}

ll inv(ll x) {
    ll r = 1ll, t = x, k = MOD - 2ll;
    while (k) {
        if (k & 1ll) r = (long long) r * t % MOD;
        t = (long long) t * t % MOD;
        k >>= 1;
    }
    return r;
}

const int nax = 2e5+13;

void read(){

}

void solve(){
    vector<pair<ll,int>>s;
    int x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    ll z;
    for(int i=0; i<a; i++){
        cin >> z;
        s.pb({z,0});
    }
    for(int i=0; i<b; i++){
        cin >> z;
        s.pb({z,1});
    }
    for(int i=0; i<c; i++){
        cin >> z;
        s.pb({z,2});
    }
    sort(s.begin(),s.end());
    ll res=0ll;
    int r=0,tx=0,ty=0;
    for(int i=a+b+c-1; i>=0 && r<x+y; i--){
        auto el=s[i];
        //cout << el.st << ' '<<el.nd<<endl;
        if(el.nd==0 && tx<x){
            r++;
            tx++;
            res+=el.st;
        }else if(el.nd==1 && ty<y){
            r++;
            ty++;
            res+=el.st;
        }else if(el.nd==2 && r<x+y){
            r++;
            res+=el.st;
        }
    }
    cout << res<<endl;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    int t=1;
    //cin >> t;
    while(t--){
        read();
        solve();
    }

    return 0;
}


Measured memory_bytes: 9964
#include<iostream>
#include<string>
#include<string.h>
#include<stdlib.h>
using namespace std;

int main()
{
	int q,i,pos1,pos2,pos3,a,b,j,k;
	string str,s1,s2,s,command,rep,temp,t1,t2;

	getline(cin,str);
	cin>>q;
	cin.ignore();
	for(i=0;i<q;i++){
		getline(cin,s);
		pos1 = s.find(" ",0);
		command = s.substr(0,pos1);
		if(command == "replace"){
			pos2 = s.find(" ",pos1+1);pos3 = s.find(" ",pos2+1);
			t1 = s.substr(pos1+1,pos2-pos1-1);t2 = s.substr(pos2+1,pos3-pos2-1);rep = s.substr(pos3+1,s.size()-pos3-1);
			a = atoi(t1.c_str());b = atoi(t2.c_str());
			for(j=a;j<=b;j++){
				str[j] = rep[j-a];
			}
		}
		else if(command == "reverse"){
			pos2 = s.find(" ",pos1+1);
			t1 = s.substr(pos1+1,pos2-pos1-1);t2 = s.substr(pos2+1,s.size()-pos2-1);
			a = atoi(t1.c_str());b = atoi(t2.c_str());
			temp = str.substr(a,b-a+1);
			k=b-a;
			for(j=a;j<=b;j++){
				str[j] = temp[k--];
			}
		}
		else if(command == "print"){
			pos2 = s.find(" ",pos1+1);
			t1 = s.substr(pos1+1,pos2-pos1-1);t2 = s.substr(pos2+1,s.size()-pos2-1);
			a = atoi(t1.c_str());b = atoi(t2.c_str());
			temp = str.substr(a,b-a+1);
			cout<<temp<<endl;
		}
	}
	return 0; 
}



Measured memory_bytes: 3212
#!/usr/bin/env python3
import sys
import itertools

def solve(N: int, M: int, x: "List[int]", y: "List[int]", z: "List[int]"):

    sign = list(itertools.product([1, -1], repeat=3))
    cand = []
    for sx, sy, sz in sign:
        sub_c = [sx*x+sy*y+sz*z for x, y, z in zip(x,y,z)]
        sub_c.sort(reverse=True)
        cand.append(sum(sub_c[:M]))
    print(max(cand))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]"
    y = [int()] * (N)  # type: "List[int]"
    z = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        z[i] = int(next(tokens))
    solve(N, M, x, y, z)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) throws Exception {
    try (final var stdin = new InputStreamReader(System.in);
         final var br = new BufferedReader(stdin)) {
      final var line = Arrays.stream(br.readLine().split(" "))
        .mapToInt(Integer::parseInt)
        .boxed()
        .collect(Collectors.toSet());

      System.out.println(line.size());
    }
  }
}


Measured memory_bytes: 34296
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<iostream>
#include<numeric>
using namespace std;

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

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

typedef struct _Node
{
    int key;
    struct _Node *next, *prev;
} Node;

Node *nil;

Node *listSearch(int key)
{
    Node *cur = nil->next;
    while (cur != nil && cur->key != key)
    {
        cur = cur->next;
    }
    return cur;
}

void init(void)
{
    nil = (Node *)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

void printList(void)
{
    Node *cur = nil->next;
    int isf = 0;
    while (1)
    {
        if (cur == nil)
            break;
        if (isf++ > 0)
            printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t)
{
    if (t == nil)
        return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst(void)
{
    deleteNode(nil->next);
}

void deleteLast(void)
{
    deleteNode(nil->prev);
}

void deleteKey(int key)
{
    deleteNode(listSearch(key));
}

void insert(int key)
{
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main(void)
{
    int key, n, i;
    int size = 0;
    int np = 0, nd = 0;
    char com[20];
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++)
    {
        scanf("%s%d", com, &key);
        if (com[0] == 'i')
        {
            insert(key);
            np++;
            size++;
        }
        else if (com[0] == 'd')
        {
            if (strlen(com) > 6)
            {
                if (com[6] == 'F')
                    deleteFirst();
                else if (com[6] == 'L')
                    deleteLast();
            }
            else
            {
                deleteKey(key);
                nd++;
            }
            size--;
        }
    }
    printList();
    return 0;
}


Measured memory_bytes: 32964
#include<stdio.h>
int main(void)
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a==5&&b==5&&c==7){
	printf("YES\n");
	}
	else if(a==5&&b==7&&c==5){
	printf("YES\n");
	}
	else if(a==7&&b==5&&c==5){
	printf("YES\n");
	}
	else{
	printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

constexpr ll modPow(ll a, ll b, ll c) {
	return (b&1) ? (a * modPow(a, b-1, c) % c)
		: (b ? modPow(a*a % c, b/2, c) : 1);
}

// Struct for precalculating factorials, inverse factorials and nCr in O(n) precalculation and O(1) queries
// For large nCr's with small modulo: https://en.wikipedia.org/wiki/Lucas%27s_theorem
template<int P>
struct FactPrecalc {
	private:
		vector<int> fact;
		vector<int> inv_fact;
	public:
		FactPrecalc(int n) : fact(n+1, 1), inv_fact(n+1, 1) {
			for (int i = 2; i <= n; ++i) fact[i] = (ll)fact[i-1] * i % P;
			inv_fact[n] = modPow(fact[n], P-2, P);
			for (int i = n-1; i >= 0; --i) inv_fact[i] = (ll)inv_fact[i+1] * (i+1) % P;
		}
		const ll operator()(int a, int b) const {
			if (a < b) return 0;
			ll div = (ll)inv_fact[a-b] * inv_fact[b] % P;
			return fact[a] * div % P;
		}
		const ll operator[](int i) const { return fact[i]; }
		ll inv(int i) const { return inv_fact[i]; }
};

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

	int n;
	cin >> n;

	vector<int> xs(n);
	for (int& x : xs) cin >> x;

	FactPrecalc<MOD> fp(n);

	// How many times do we pay for interval [a, a+1]?
	// In how many permutations do all of [2, ..., m] get picked before 1?
	// -> (m-1)! (n-m)! (n choose m)
	// ANS = \sum_{m = 1}^{n} (m-1)! (n-m)! (n choose m)

	ll res = 0;
	for (int m = 1; m < n; ++m) {
		ll mult = (fp[m-1] * fp[n-m-1]) % MOD * fp(n-1, m) % MOD;
		ll dist = xs[n-1] - xs[m-1];
		res = (res + mult * dist) % MOD;
	}
	cout << res << '\n';
}


Measured memory_bytes: 1408
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char alpha;
  char beta = 'Z';
  cin >> alpha;
  if(alpha <= beta){
    cout << "A" << endl;
  }else{
    cout << "a" << endl;
  }
}

Measured memory_bytes: 3584
#include <stdio.h>
#include <limits.h>


int main(){
  int n, G[100][100], d[100], p[100], color[100];
  int i, j, u, k, v, c, mincost, sum = 0;

  scanf("%d", &n);

  for(i = 0; i < n; i++) for(j = 0; j < n; j++) G[i][j] = -1;

  for(i = 0; i < n; i++){
    d[i] = INT_MAX;


    p[i] = 0;
    color[i] = 0;
    scanf("%d%d", &u, &k);

    for(j = 0; j < k; j++){
      scanf("%d%d", &v, &c);
      G[u][v] = c;
    }
  }

  d[0] = 0;





  while(1){
    mincost = INT_MAX;
    for(i = 0; i < n; i++){
      if(color[i] != 1 && d[i] < mincost){
    mincost = d[i];
    u = i;
      }
    }
    if(mincost == INT_MAX) break;



    color[u] = 1;
    for(i = 0; i < n; i++){
      if(G[u][i] != -1 && color[i] != 1 && d[u] + G[u][i] < d[i]){
    p[i] = u;

    d[i] = G[u][i];
    d[i] += d[p[i]];
      }
    }
  }




  for(i = 0; i < n; i++) printf("%d %d\n", i, d[i]);

  return 0;
}



Measured memory_bytes: 2056
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

vector<int> fact;
vector<int> ifact;
vector<int> inv;
vector<int> pow2;
vector<int> ipow2;
const int MOD = (1e9 + 7);
int add(int a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}
int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}
int modpow(int a, int b)
{
	int r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}
int choose(int a, int b)
{
	if(a<b) return 0;
	if(b==0) return 1;
	if(a==b) return 1;
	return mult(fact[a],mult(ifact[b],ifact[a-b]));
}
int inverse(int a)
{
	return modpow(a,MOD-2);
}
void init(int _n)
{
	fact.clear(); ifact.clear(); inv.clear(); pow2.clear();
	fact.resize(_n+1);
	ifact.resize(_n+1);
	ipow2.resize(_n+1);
	inv.resize(_n+1);
	pow2.resize(_n+1);
	pow2[0]=1; ipow2[0]=1;
	ifact[0]=1;
	fact[0]=1;
	int INV = inverse(2);
	for(int i=1;i<=_n;i++)
	{
		pow2[i]=add(pow2[i-1],pow2[i-1]);
		ipow2[i]=mult(ipow2[i-1],INV);
		fact[i]=mult(fact[i-1],i);
		//ifact[i]=mult(ifact[i-1],inv[i]);
	}
	ifact[_n] = inverse(fact[_n]);
	for(int i=_n-1;i>=1;i--)
	{
		ifact[i] = mult(ifact[i + 1], i + 1);
	}
	for(int i=1;i<=_n;i++)
	{
		inv[i] = mult(fact[i-1],ifact[i]);
	}
}

const int N = 611;
int match[N];
int dp[N][N];
int dp2[N][N];
int n,k; 
int F[N];
int active;
int cnt[N][N];

int solve(int l, int r)
{
	if(dp[l][r]!=-1) return dp[l][r];
	if((r-l)%2==0) return 0;
	int ans=0;
	cnt[l][r]=r-l+1;
	for(int i=l;i<=r;i++)
	{
		if(match[i]!=-1)
		{
			int v=match[i];
			if(v>=l&&v<=r)
			{
				cnt[l][r]--;
			}
			else {return dp[l][r]=0;}
		}
	}
	assert(cnt[l][r]%2==0);
	ans=F[cnt[l][r]];
	return (dp[l][r] = ans);
}

int solve2(int l, int r)
{
	if(dp2[l][r]!=-1) return dp2[l][r];
	if((r-l)%2==0) return 0;
	int ans=solve(l,r);
	for(int i=l;i<r;i++)
	{
		ans=add(ans,MOD-mult(solve2(l,i),solve(i+1,r)));
	}
	return (dp2[l][r]=ans);
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	memset(dp,-1,sizeof(dp)); memset(match,-1,sizeof(match)); memset(dp2,-1,sizeof(dp2));
	init(N);
	cin>>n>>k; n*=2; active=n;
	for(int i=0;i<k;i++)
	{
		int x,y; cin>>x>>y; x--; y--; active-=2;
		match[x]=y; match[y]=x;
	}
	F[0]=1;
	for(int i=2;i<N;i+=2)
	{
		F[i] = mult(fact[i], mult(ipow2[i/2], ifact[i/2]));
	}
	int ans=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if((j+i)%2==0) continue;
			//if((i==(j+1)%n)&&(i!=0)) continue;
			//cerr<<i<<' '<<j<<' '<<solve(i,j)<<' '<<solve2(i,j);
			//cerr<<' '<<cnt[i][j]<<' '<<F[active-cnt[i][j]]<<' '<<mult(solve2(i,j),F[active-cnt[i][j]])<<'\n';
			solve(i,j);
			long long x = mult(solve2(i,j),F[active-cnt[i][j]]);
			// cout << i << " " << j << " " << x << " here\n";
			ans=add(ans, x);
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 4608
n, k = map(int, input().split())
a = list(map(int, input().split()))

hi = 10 ** 9
lo = 0
while hi - lo > 1:
    mid = (hi + lo) // 2

    cnt = 0
    for v in a:
        cnt += (v + mid - 1) // mid - 1

    if cnt <= k:
        hi = mid
    else:
        lo = mid

print(hi)

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

int main() {
    int H, A;
    cin >> H >> A;
    int ans = 0;
    if(H%A==0) {
        ans = H/A;
    }
    else {
        ans = H/A + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3564
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans = 0
maxwalk = b//a
for i in range(n-1):
  if x[i+1]-x[i]>maxwalk:
    ans+=b
  else:
    ans+=(x[i+1]-x[i])*a
print(ans)

Measured memory_bytes: 14252
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ConsoleApp
{
    class Program
    {

        static void Main(string[] args)
        {
            var ar = ReadLine().Split().Select(int.Parse).ToArray();

            if(ar[0] >= 10)
                WriteLine(ar[1]);
            else
                WriteLine(ar[1] + 100 * (10 - ar[0]));

        }



    }

}


Measured memory_bytes: 13268
/*
 *    author:  Gary Shih
 *    created: 2020-05-05 13:17:49
 */
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

// Mod Integer {{{
// {{{
template <int _MOD>
class ModInt {
 public:
  static const auto MOD = _MOD;
  template <class T>
  using integral_only = typename enable_if<is_integral<T>::value>::type;

  int x;
  constexpr ModInt() : x() {}
  template <class T, integral_only<T>* = nullptr>
  ModInt(T _x) {
    x = _x % MOD;
    if (x < 0) x += MOD;
  }
  ModInt operator-() const { return {x == 0 ? 0 : MOD - x}; }
  ModInt& operator+=(ModInt rhs) {
    x += rhs.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }
  ModInt& operator-=(ModInt rhs) {
    x -= rhs.x;
    if (x < 0) x += MOD;
    return *this;
  }
  ModInt& operator*=(ModInt rhs) {
    x = (long long)x * rhs.x % MOD;
    return *this;
  }
  ModInt& operator/=(ModInt rhs) { return *this *= rhs.inv(); }
  ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
  ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
  ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
  ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
  ModInt inv() const {
    // should work for non-prime MOD if gcd(x, MOD) = 1
    int a = x, b = MOD, u = 1, v = 0;
    while (b != 0) {
      int t = a / b;
      a -= t * b, u -= t * v;
      swap(a, b), swap(u, v);
    }
    return u;
  }
  template <class T, integral_only<T>* = nullptr>
  ModInt pow(T e) {
    ModInt r = 1, p = *this;
    while (e) {
      if (e & 1) r *= p;
      p *= p, e >>= 1;
    }
    return r;
  }
  bool operator==(ModInt rhs) const { return x == rhs.x; }
  bool operator!=(ModInt rhs) const { return x != rhs.x; }
  bool operator<(ModInt rhs) const { return x < rhs.x; }
  bool operator<=(ModInt rhs) const { return x <= rhs.x; }
  bool operator>(ModInt rhs) const { return x > rhs.x; }
  bool operator>=(ModInt rhs) const { return x >= rhs.x; }
  friend string to_string(ModInt i) { return to_string(i.x); }
  friend ostream& operator<<(ostream& os, ModInt o) { return os << o.x; }
  friend istream& operator>>(istream& is, ModInt& i) {
    long long foo;
    is >> foo;
    foo %= MOD;
    if (foo < 0) foo += MOD;
    i.x = foo;
    return is;
  }
};
// }}}
const int MOD = 1e9 + 7;
using mint = ModInt<MOD>;
// }}}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.setf(ios::fixed), cout.precision(9);
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) cin >> a[i][j];

  vector<mint> dp(1 << n);
  dp[0] = 1;
  for (int i = 1; i < (1 << n); ++i) {
    int k = __builtin_popcount(i);
    for (int j = 0; j < n; ++j)
      if (i & (1 << j)) {
        dp[i] += dp[i - (1 << j)] * a[k - 1][j];
      }
  }
  cout << dp.back() << '\n';
}


Measured memory_bytes: 8448
#include <stdio.h>
#include <vector>
#include <queue>


using namespace std;

int main()
{
  int n,q,c,t,x;
  vector<priority_queue<int, vector<int>>> a;

  scanf("%d", &n);
  scanf("%d", &q);


  for (int i = 0; i < n; i++) {
    a.emplace_back();
  }


  for (int i = 0; i < q; i++) {
    scanf("%d", &c);
    scanf("%d", &t);
    if (c == 0){
      scanf("%d", &x);
      a[t].push(x);
    }else if (c == 1){
      if (a[t].empty()==0){ //空：１　
        printf("%d\n",a[t].top());
      }
    }else if (c == 2){
      if (a[t].empty()==0){ //空：１　
        a[t].pop();
      }
    }

  }
  return 0;
}



Measured memory_bytes: 3508
use std::vec::Vec;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Clone>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0].clone(), v[1].clone())
}

fn main() {
    let n: usize = read();
    let (s, t) = read_touple::<String>();
    let s: Vec<char> = s.chars().collect();
    let t: Vec<char> = t.chars().collect();

    let mut ans = Vec::new();

    for i in 0..2*n {
      let indx = i / 2;
      if i % 2 == 0 {
        ans.push(s[indx]);
      } else {
        ans.push(t[indx]);
      }
    }
    let ans: String = ans.into_iter().collect();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

signed main() {
	int k; string s;
	
	cin >> k >> s;
	if (s.length() <= k) cout << s << endl;
	else {
		for (int i = 0; i < k; i++) cout << s[i];
		cout << "..." << endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>

using namespace std;

int main(){
    long long int n, a, b, ans,temp;
    cin >> n >> a >> b;
    temp = (a + b);
    ans = 0;
    ans += (n / temp) * a;
    ans += min(n % temp, a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define mod1 998244353
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
void bfs(vector<li>v[],li visit[],li s,li dist[])
{
  int i;
  deque<li>q;
  visit[s]=1;
q.push_back(s);
  while(!q.empty())
  {
    int x=q.front();
    q.pop_front();
    //cout<<x<<" ";
    for(auto i=v[x].begin();i!=v[x].end();i++)
    {
      if(!visit[*i])
      {q.push_back(*i);
        visit[*i]=1;
        dist[*i]=dist[x]+1;
      }
    }
  }
}
int main()
{
fast_io
li x,y,a,b,c,i;
cin>>x>>y>>a>>b>>c;
li r[a],g[b],co[c];
for(i=0;i<a;i++)
cin>>r[i];
for(i=0;i<b;i++)
cin>>g[i];
for(i=0;i<c;i++)
cin>>co[i];
vector<li>v;
sort(r,r+a,greater<li>());
sort(g,g+b,greater<li>());
sort(co,co+c);
for(i=0;i<x;i++)
v.push_back(r[i]);
for(i=0;i<y;i++)
v.push_back(g[i]);
sort(v.rbegin(),v.rend());
i=v.size()-1;
li j=c-1;
while(i>=0&&j>=0)
{
  if(v[i]<co[j])
  {
    v[i]=co[j];
    j--;
    i--;
  }
  else
  break;
}
li ans=0;
for(i=0;i<v.size();i++)
ans+=v[i];
cout<<ans;
return 0;
}


Measured memory_bytes: 4852
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
typedef long long ll;
const int MOD = 1000000007;
#define PI 3.1415
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	int sum = 0;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		sum += a[i];
	}
	cout << max(-1, n - sum) << endl;
	return 0;
}


Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <complex>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;

struct Edge{
	int src,dst,flow,capacity,next;
	Edge(){}
	Edge(int s,int d,int f,int c,int n):src(s),dst(d),flow(f),capacity(c),next(n){}
};

void AddEdge(vector<Edge>& es,vi& head,int src,int dst,int flow,int capacity){
	es.push_back(Edge(src,dst,flow,capacity,head[src]));
	head[src]=es.size()-1;
}

vi BFS(const vector<Edge>& es,const vi& head,int begin)
{
	int size=head.size();
	vi label(size,size);
	queue<pii> q;
	q.push(mp(begin,0));
	while(q.size()){
		pii cur=q.front(); q.pop();
		if(label[cur.first]<=cur.second)
			continue;
		label[cur.first]=cur.second;
		for(int i=head[cur.first];i!=-1;i=es[i].next)
			if(es[i].capacity-es[i].flow>0)
				q.push(mp(es[i].dst,cur.second+1));
	}
	return label;
}

int DFS(vector<Edge>& es,vi& head,int v,int end,const vi& label,int f)
{
	if(v==end)
		return f;
	for(int& i=head[v];i!=-1;i=es[i].next){
		Edge& e=es[i];
		if(label[e.src]>=label[e.dst])
			continue;
		int residue=e.capacity-e.flow;
		if(residue<=0)
			continue;
		int augment=DFS(es,head,e.dst,end,label,min(residue,f));
		if(augment>0){
			e.flow+=augment;
			es[i^1].flow-=augment;
			return augment;
		}
	}
	return 0;
}

int Dinic(vector<Edge>& es,const vi& head,int begin,int end)
{
	int size=head.size();
	for(;;){
		vi label=BFS(es,head,begin);
		if(label[end]==size)
			break;
		vi temp=head;
		while(DFS(es,temp,begin,end,label,INFTY))
			;
	}
	int res=0;
	for(int i=head[begin];i!=-1;i=es[i].next)
		res+=es[i].flow;
	return res;
}

int main()
{
	for(int n,m;~scanf("%d%d",&n,&m);){
		vector<Edge> es; es.reserve(m*2);
		vi head(n,-1);
		rep(i,m){
			int s,d; scanf("%d%d",&s,&d); s--; d--;
			AddEdge(es,head,s,d,0,1);
			AddEdge(es,head,d,s,0,1);
		}
		int s,t; scanf("%d%d",&s,&t); s--; t--;
		
		int f=Dinic(es,head,s,t);
		vi rs;
		rep(i,m) if(es[i*2+1].flow==1)
			rs.push_back(i);
		
		printf("%d\n%d\n",f,rs.size());
		rep(i,rs.size())
			printf("%d\n",rs[i]+1);
	}
	
	return 0;
}

Measured memory_bytes: 0
n, m = map(int, input().split())
list_H = list(map(int, input().split()))
list_AB = [ list(map(int,input().split(" "))) for i in range(m)]
list_ANS = [1]*n

for i, j in list_AB:
    if list_H[i-1] > list_H[j-1]:
        list_ANS[j-1] = 0
    elif list_H[j-1] > list_H[i-1]:
        list_ANS[i-1] = 0
    else:
        list_ANS[i-1] = 0
        list_ANS[j-1] = 0

print(sum(list_ANS))

Measured memory_bytes: 32032
x,y=map(int,input().split())
if x==2 and y==2:
  ans = 'Yes'
elif x in [4,6,9,11] and y in [4,6,9,11]:
  ans = 'Yes'
elif x in [1,3,5,7,8,10,12] and y in [1,3,5,7,8,10,12]:
  ans = 'Yes'
else:
  ans = 'No'
print(ans)

Measured memory_bytes: 3316
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
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 array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;
void y(bool c) { if (c)print("Yes"); else print("No"); };


int cnt[200020];
void solve() {
	int N; cin >> N;
	vector<int>A(N);
	REP(i, N-1) {
		cin >> A[i];
		A[i]--;
		cnt[A[i]]++;
	}
	REP(i, N)print(cnt[i]);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}




Measured memory_bytes: 6336
#include <bits/stdc++.h>
using namespace std;
#define deb(x)  cout << #x << ' ' << x << endl;
#define mod 1000000007
#define all(n)      (n).begin(), (n).end()
#define ll long long
#define ull unsigned long long 
void solve() {
    int n; cin >> n;
    if(n){
        cout << "0\n";
    }else{
        cout << "1\n";
    }
    
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //Starts here , 
    // Chaaliya Be! Tamam Dekhun!	
                
    int T = 1; 
    // cin >> T;	
    while(T--){
        solve();
    }
    return 0;
            
}

Measured memory_bytes: 3648
def bubbleSort(A, N):
    flag = True
    count = 0
    while flag:
        flag = 0
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                tmp = A[j]
                A[j] = A[j-1]
                A[j-1] = tmp
                flag = 1
                count += 1
    print(*A)
    print(count)


arr_length = int(input())
arr_num = [int(i) for i in input().split(" ")]

bubbleSort(arr_num, arr_length)

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

int main() {
    int n,m;
    string s;
    
    cin>>n>>m;
    int ans=(n*(n-1))/2+(m*(m-1))/2;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int a, b;
  cin >> a >> b;
  cout << max(0, a-b*2) << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a=Integer.parseInt(sc.next());
int b=Integer.parseInt(sc.next());
int c=0;
int[] d=new int[5]; 
for(int i=a;i<=b;i++){
d[0]=i-i/10*10;
d[1]=(i/10*10-i/100*100)/10;
d[2]=(i/100*100-i/1000*1000)/100;
d[3]=(i/1000*1000-i/10000*10000)/1000;
d[4]=i/10000;
if(i==d[0]*10000+d[1]*1000+d[2]*100+d[3]*10+d[4]){c++;}
}
System.out.println(c);
}}

Measured memory_bytes: 21588
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

while True:
    S = raw_input()
    if S == '0':
        break
    m = [1] + [0 for i in range(10)]
    diff = 0
    even = 1
    S = reversed(S)
    ans = 0
    for c in S:
        num = int(c)
        diff += num * even
        diff %= 11
        if num != 0:
            ans += m[diff]
        m[diff] += 1
        even *= -1
    print ans


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

int array[50][50]={{0}};

bool check(int n,int key){
  for(int i=0;i<50;i++){
    if(array[n][i]==key)
      return true;
  }
  return false;
}

int main(){

  int N,K,R,m;
  int cnt=0;
  set<int> s;
  set<int>::iterator iti;
  cin>>N>>K;
  for(int i=0;i<K;i++){
    cin>>m;
    for(int j=0;j<m;j++){
      cin>>array[i][j];
    }
  }

  cin>>R;
  int p,q;
  for(int i=0;i<R;i++){
    cin>>p>>q;
    for(int j=0;j<N;j++){
      if(check(j,p)==true && check(j,q)==true){
	s.insert(p);
	s.insert(q);
      }
    }
  }
  cout<<s.size()<<endl;
  return 0;
}

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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if ((i + 1) % 2 == 0) continue;
    if (A.at(i) % 2 == 0) continue;
    ans++;
  }
  cout << ans << endl;
}

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

int main() {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    int ans = std::min(a, c);
    c -= std::min(a, c);
    ans += std::min(b, c) + b;
    if (c > b) {
        ++ans;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256