akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
int main(){
    int n;
    ll tmp,left,right;
    vector<ll> vec(0),mp(0);
    cin >> n;
    rep(i,n){
        cin >> tmp;
        vec.push_back(tmp);
        mp.push_back(tmp);
    }
    sort(vec.begin(),vec.end());
    right=vec.at(n/2);
    left=vec.at(n/2-1);
    rep(i,n){
        cout << ((mp.at(i)<=left)?right:left) << endl;
    }
}

Measured memory_bytes: 5476
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 20:57:47 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 2019

S = input()
l = len(S)
#S = int(S)

a, b = [],[0]
s = 0
xx = [0 for _ in range(2019)]
xx[0] += 1
for i in range(l):
    s += int(S[-i-1])*pow(10,i,mod)
    s %= mod
#    b.append(s % x)
    xx[s] += 1

ans = 0
#for i in range(len(b)):
#    xx[b[i]] += 1
def a(n):
    return n*(n+1)//2 

for i in range(len(xx)):
    if xx[i] > 1:
        ans += a(xx[i] - 1)

print(ans)


Measured memory_bytes: 68320
import java.util.Scanner; 
class Main{
  public static void main (String[] args){
    Scanner scanner =new Scanner(System.in);
    int a = scanner.nextInt();
    int b = scanner.nextInt();
    int c;
    
    if((a+b)%2==0)
      System.out.println((a+b)/2);
    else
      System.out.println((a+b)/2+1);
    scanner.close();
  }
}

Measured memory_bytes: 22868
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>

using namespace std;

struct edge{
    int to,cost;
};

int n;
vector<edge> G[30];
const int INF=1000000000;
bool passed[30];
bool passed2[30];

// ÊÉÄAµÄRXgðvZ
int rec(int s){
    passed[s]=true;
    int sumCost=0;
    bool f=false;
    for(int i = 0; i < G[s].size(); i++){
        edge e=G[s][i];
        if(passed[e.to])
            continue;
        f=true;
        int res=rec(e.to);
        if(res!=-1)
            sumCost+=res+e.cost*2;
    }
    if(!f)
        return -1;
    return sumCost;
}

int dfs(int s){
    passed2[s]=true;
    // e[gÅÄA
    int maxCost=0;
    int idx;
    int tc=0;
    int sumCost=0;
    vector<pair<pair<int,int>,int> > v;
    for(int i = 0; i < G[s].size(); i++){
        int to=G[s][i].to;
        int cost=G[s][i].cost;
        if(passed2[to])
            continue;
        memset(passed,0,sizeof(passed));
        passed[s]=true;
        int res=rec(to);
        int val=0;
        if(res!=-1){
            val=res+cost*2;
            sumCost+=val;
            v.push_back(make_pair(make_pair(val,cost),to));
        }
    }
    int minCost=INF;
    for(int i = 0; i < v.size(); i++){
        int to=v[i].second;
        int val=v[i].first.first;
        int cost=v[i].first.second;
        int res=dfs(to);
        // ±ÌæiÞKvª éê
        if(res!=-1){
            memset(passed,0,sizeof(passed));
            passed[s]=true;
            minCost=min(minCost,res+sumCost-val+cost);
        }
    }
    if(minCost==INF)return 0;
    // àÁÆàlªå«¢[gÖiÞ
    //return dfs(idx)+tc+sumCost;
    return minCost;
}

int main(){
    while(cin>>n&&n!=0){
        memset(passed2,0,sizeof(passed2));
        for(int i = 0; i < n; i++)
            G[i].clear();
        for(int i = 0; i < n-1; i++){
            edge e;
            int from,to;
            cin>>from>>to>>e.cost;
            from--;to--;
            e.to=to;
            G[from].push_back(e);
            e.to=from;
            G[to].push_back(e);
        }
        int res=dfs(0);
        cout<<res<<endl;
    }
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#define REP(i,N) for(auto i = 0; i<N; i++)
#include <climits>

const long long INF = (1LL << 40);


#include <cmath>
using namespace std;

int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

long long longin(){
    long long temp;
    scanf("%lld",&temp);
    return temp;
}


long long f(long long b, long long n){
    if (n < b) return n;
    return f(b, n/b) + (n % b);
}

int main() {
    
    long long n = longin();
    long long s = longin();
    
    long long temp;
    
    
    if (n < s){
        cout << -1 << endl;
        return 0;
    }
    
    if (n == s){
        cout << n+1 << endl;
        return 0;
    }
    
    

    for(auto b = 2; b <= (long long)sqrt(n) ; b++){
        
        temp = f(b,n);
        if (temp == s){
            cout << b << endl;
            return 0;
        }
    }
    
    long long b;
    long long min = INF;
    
    
    
    
    for(auto p = 1; p <= (long long)sqrt(n) * 2 ; p++){
        if ( (n - s) %p != 0) continue; /// n-sの約数のみ見る
        
        b = (n-s)/p + 1;
        
        if (b < sqrt(n))break;

        if (f(b,n)== s){
            if (min > b) min = b;
        }
    }
    
    if (min == INF){
        cout << -1 << endl;
    }else{
        cout << min << endl;
    }
    
    return 0;
    
}



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

void print(void);
void reverse(void);
void replace(void);

char str[1000];
int a, b;

int main(){
	int i, q;
	char tmp[20];
	scanf("%s%d", str, &q);
	for(i=0; i<q; i++){
		scanf("%s%d%d", tmp, &a, &b);
		if(!strcmp(tmp, "print")) print();
		else if(!strcmp(tmp, "reverse")) reverse();
		else if(!strcmp(tmp, "replace")) replace();
	}	
	return 0;
}

void print(void){
	int i;
	for(i=a; i<=b; i++) printf("%c", str[i]);
	printf("\n");
}

void reverse(void){
	int i, j;
	char c;
	for(i=a, j=b; i<j; i++, j--){
		c = str[i];
		str[i] = str[j];
		str[j] = c;
	}
}

void replace(void){
	int i;
	char c;
	for(i=a; i<=b; i++){
		scanf(" %c", &c);
		str[i] = c;
	}
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
#define int long long
int unx(){int x=0,n=0; char c=getchar(); for(;!isdigit(c);c=getchar()) n=(c=='-'); for(;isdigit(c);c=getchar())x=x*10+c-'0'; return (n)?-x:x;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r){}
#define in unx()
#define fasty ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define forinc(a,b,c) for(int a=b, _c=c; a<=_c; ++a)
#define fordec(a,b,c) for(int a=b, _c=c; a>=_c; --a)
#define forv(a,b) for(auto &a:b)
#define ii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define reset(f, x) memset(f, x, sizeof(f))
#define mt make_tuple
#define bit(x,i) (x>>(i-1)&1ll)
#define onbit(x,i) (x|(1ll<<(i-1)))
#define offbit(x,i) (x&~(1ll<<(i-1)))

main(){
  fasty;
  string s;
  cin>>s;
  if(s=="ABC") cout<<"ARC";
  else cout<<"ABC";
}


Measured memory_bytes: 3568
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int num[]=new int[4];
      for(int i=0;i<4;i++){
      	num[i]=sc.nextInt();
      }
      int x=num[2]-num[0];
      int y=num[3]-num[1];
        System.out.print((num[2]-y)+" "+(num[3]+x)+" ");
      System.out.println((num[0]-y)+" "+(num[1]+x));
    }
}

Measured memory_bytes: 23124
#include <functional>
#include <vector>
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    vector<int> adj[n];
    if (m % 2) { cout << "-1\n"; return 0; }
    pair<int, int> es[m];
    int deg[n] = {};
    for (int i = 0; i < m; i++) {
        int u, v; cin >> u >> v;
        u--; v--;
        es[i] = {u, v};
        adj[u].push_back(i);
        adj[v].push_back(i);
        deg[u]++;
    }
    vector<pair<int, int> > ans;
    bool st[m] = {}, conn[n] = {};
    function<void(int)> mkst = [&](int i) {
        conn[i] = true;
        for (int e : adj[i]) {
            int j = i^es[e].first^es[e].second;
            if (!conn[j]) { st[e] = true; mkst(j); }
        }
    };
    mkst(0);
    function<void(int, int)> dfs = [&](int i, int p) {
        for (int e : adj[i]) {
            int j = i^es[e].first^es[e].second;
            if (j != p && st[e]) {
                dfs(j, i);
                if (deg[j]&1) {
                    swap(es[e].first, es[e].second);
                    deg[j]++; deg[i]++;
                }
            }
        }
    };
    dfs(0, -1);
    for (auto e : es) cout << e.first+1 << ' ' << e.second+1 << endl;
}


Measured memory_bytes: 17664
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N, M;
    cin >> N >> M;
    map<ll, ll> MAP;
    rep (i, N) {
        ll A, B;
        cin >> A >> B;
        MAP[A] += B;
    }

    ll sum = 0;
    for (auto i : MAP) {
        if (i.second > M) i.second = M;
        sum += i.first * i.second;
        M -= i.second;
        if (M <= 0) break;
    }
    cout << sum << endl;
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int64 N, Q;
  cin >> N >> Q;
  fenwick_tree<int64> ft(N);
  REP(i, N) {
    int64 a;
    cin >> a;
    ft.add(i, a);
  }
  REP(i, Q) {
    int64 t, a, b;
    cin >> t >> a >> b;
    if (t == 0) {
      ft.add(a, b);
    } else {
      cout << ft.sum(a, b) << endl;
    }
  }
}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main() {
    size_t K;
    string S;
    cin >> K >> S;
    if (S.length() > K) {
        S = S.substr(0,K);
        S += "...";
    }
    cout << S << endl;
    return 0;
}


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

int main()
{
	int h, w;
	while (cin >> h >> w, h || w) {
		int i = h + 1, j;
		for (int l = h*h + w*w;; l++) {
			for (; i < 150; i++) {
				if (i * i + i > l)
					break;
				for (j = i + 1; j < 150; j++) {
					if (i*i + j*j < l) {
					}
					else if (i*i + j*j == l) {
						goto res;
					}
					else {
						break;
					}
				}
			}
			i = 1;
		}
	res:
		cout << i << " " << j << endl;
	}
	return 0;
}

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

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}

int gcd(int a,int b){
    int r;
    if(a<b) swap(a,b);
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int atcoder(){
    double n,m,d;
    cin>>n>>m>>d;
    if(d==0) cout << fixed << setprecision(10) << (m-1)/n << ENT;
    else cout << fixed << setprecision(10) << 2*(m-1)*(n-d)/n/n << ENT;
    return 0;
}


signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Measured memory_bytes: 256
/*
  AOJ 1062
  Title:
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int denp[3][2];
char timezone[3][9]={"lunch","dinner","midnight"};
void output()
{
  int i;
  for(i=0;i<3;i++)
    {
      printf("%s ",&timezone[i][0]);
      if(denp[i][0]==0)
	printf("no guest\n");
      else
	printf("%d\n",denp[i][1]*100/denp[i][0]);
    }
}


main()
{
  int N;
  int i,ret,hh,mm,MM,z,d;

  while(scanf("%d",&N)  && (N   ))
    {
      memset(denp,0,sizeof(denp));
      for(i=0;i<N;i++)
	{
	  scanf("%d:%d %d",&hh,&mm,&MM);
	  if(hh>=11 && hh<=14)
	    z=0;
	  else if(hh>=18 && hh<=20)
	    z=1;
	  else if(hh>=21 || hh <2)
	    z=2;
	  else
	    z=-1;
	  if(z>=0)
	    {
	      d=MM-mm;
	      if(d<0)
		d+=60;
	      denp[z][0]++;
	      if(d<=8)
		denp[z][1]++;
	    }
	}
      output();
    }
  return(0);
}

Measured memory_bytes: 612
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <cmath>
#include <cassert>

using namespace std;

map<long,long> primediv(long n)
{
    assert(n > 1);

    long d = 2;
    long ulimit = sqrt(n);
    map<long,long> res;

    while (d <= ulimit) {
        if (n % d == 0) {
            res[d]++;
            n /= d;
            ulimit = sqrt(n);
        } else
            d += 1;
    }
    if (n != 1)
        res[n]++;
    return res;
}

template<typename It, typename Fun>
void factors(It it, It end, long acc, Fun f)
{
    if (it == end) {
        f(acc);
        return;
    }
    auto next = it;
    next++;
    for (long i = 0; i <= it->second; i++) {
        factors(next, end, acc * pow(it->first, i), f);
    }
}

int main()
{
    long n;
    cin >> n;
    long ans = LONG_MAX;

    if (n == 1) {
        ans = 1;
    } else {
        auto m = primediv(n);

        factors(m.begin(),
                m.end(),
                1,
                [&](long f) {
                    ans = min(
                        (long)
                        floor(
                            max(log10(f),
                                log10(n/f)))
                        + 1,
                        ans);
                });
    }

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

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

vector<vector<int>> G;
vector<int> dp;

int solve(int u){
    //cout<< "solve(" << u << ")" << endl;
    if(dp[u] == -1){
        dp[u] = 0;
        for(int v : G[u]){
            dp[u] = max(solve(v)+1, dp[u]);
        }
    }
    //cout<< "return : " << dp[u] << endl;
    return dp[u];
}

int main(){
    int N, M;
    cin>> N >> M;

    dp.resize(N, -1);
    G.resize(N);

    for(int i=0; i<M; i++){
        int x, y;
        cin>> x >> y;
        x--;
        y--;
        G[x].push_back(y);
    }

    int ans = -1;
    for(int i=0; i<N; i++){
        ans = max(solve(i), ans);
    }

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

Measured memory_bytes: 10908
#pragma region template

#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#pragma region random

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> T randint(T a, T b) {
    return uniform_int_distribution<T>(a, b)(rng);
}

#pragma endregion

#pragma region debug
string to_string(string s) { return '"' + s + '"'; }

string to_string(const char *s) { return to_string((string)s); }

string to_string(bool b) { return (b ? "true" : "false"); }

template <typename A, typename B> string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A> string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first)
            res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

#pragma endregion

#pragma endregion

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b;
    cin>>a>>b;
    if(a<10&&b<10&&a>0&&b>0)
    cout<<a*b;
    else
    cout<<-1;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int c(char *p,int d){return ((26+*p-*(p+1))%26==d);}
int a(char *p){return((*p<'a')||(*p>'z'));}

char *decode (char *inbuf, int s) {
  int p = 0;
  while (inbuf[p]){
    if(!a(&inbuf[p])) {
      int t = inbuf[p] + s;

      if (t > 'z')      inbuf[p] = (char)(t - 26);
      else if (t < 'a') inbuf[p] = (char)(t + 26);
      else              inbuf[p] = (char)t;
    }
    p++;
  }
  return (inbuf);
}

int main(s){
  char inbuf[82];
  while(fgets(inbuf,80,stdin)){
    char *p=inbuf-1;
    while(*++p){
      if((c(p,12))&&((c(p+1,3)&&a(p+3))||(c(p+1,7)&&c(p+2,7)&&a(p+4))||(c(p+1,2\
5)&&c(p+2,16)&&a(p+4)))){s='t'-*p;p+=3;break;}
      //            p++;
    }
    printf("%s",decode(inbuf, s));
  }
  return 0;
}

Measured memory_bytes: 520
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;


int main(){
    string s,t,u;
    int a,b;
    cin>>s>>t>>a>>b>>u;
    if(u==s) a -= 1;
    else b -= 1;
    cout<<a<<" "<<b<<endl;
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
#define repM1(i, n) for(ll i = (ll)(n - 1); i > 0; i--)
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main()
{
	cout << fixed << setprecision(18);

	ll n;
	cin >> n;
	vector<ll> a(n);
	ll sum = 0;
	rep(i, n) {
		cin >> a[i];
		sum ^= a[i];
	}

	rep(i, n) {
		cout << (sum ^ a[i]);
		if (i != n - 1)
			cout << " ";
	}

	return 0;
}

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

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define eof !cin.eof()
#define pb push_back
#define pf push_front
#define pof pop_front
#define pob pop_back
#define ull unsigned long long
#define ll long long
#define ld long double
#define sz(a) a.size()
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()
#define x first
#define y second
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ii pair <int, int>
#define iii pair <int, ii>
#define EPS 1e-10
#define INF 1000000000
#define mod 1000000007
#define reset(a, nilai) memset(a, nilai, sizeof(a))
#define minof min_element
#define maxof max_element
using namespace std;

int a, b;
int main () {
	IOS;

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


Measured memory_bytes: 256
// B.

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>

using namespace std;

typedef pair<int, int> II;
typedef vector<int> IntVec;
typedef map<int, IntVec> IntVecMap;

int main(int argc, char *argv[])
{
	int n, m;
	cin >> n >> m;
	vector<int> a[300];
	IntVecMap g;
	int d[300] = {};
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			int x;
			cin >> x;
			a[i].push_back(x-1);
		}
		g[a[i][0]].push_back(i);
	}

	int ans = n;
	for (int i = 0; i < m-1; ++i) {
		int mi = -1;
		int mx = 0;
		for (auto &kv : g) {
			if (kv.second.size() > mx) {
				mi = kv.first;
				mx = kv.second.size();
			}
		}
		ans = min(ans, mx);

		IntVec v = g[mi];
		g.erase(mi);
		d[mi] = 1;
		for (int x : v) {
			for (int y : a[x]) {
				if (!d[y]) {
					g[y].push_back(x);
					break;
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 896
using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            var st = Console.ReadLine().Split().ToArray();
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var u = Console.ReadLine();

            if (u == st[0])
            {
                ab[0]--;
            }
            else
            {
                ab[1]--;
            }

            Console.WriteLine($"{ab[0]} {ab[1]}");
        }
    }
}


Measured memory_bytes: 13396
#abc085d

N,H=map(int,raw_input().split())
a=[]
b=[]
for i in xrange(N):
 x,y=map(int,raw_input().split())
 a.append(x)
 b.append(y)
b=sorted(b,reverse=True)
amax=max(a)
cnt=0
i=0
while H>0 and i<len(b) and b[i]>amax:
 H=H-b[i]
 cnt+=1
 i+=1
if H>0:
 cnt+=(H+amax-1)/amax
print cnt


Measured memory_bytes: 10176
// ProblemURL : https://atcoder.jp/contests/abc115/tasks/abc115_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var d int
	fmt.Scan(&d)
	ans := "Christmas"
	for i := 0; i < 25-d; i++ {
		ans += " Eve"
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    int n;

    cin  >> n;

    if(n==0){
        cout << 0 << endl;
        return 0;
    }

    vector<int> ans;

    while(n!=0){
        //cout << n << endl;
        if(abs(n)%2==1){
            ans.pb(1);
            //cout << 1;
            n--;
            n/=(-2);
        }
        else{
            ans.pb(0);
            //cout << 0;
            n/=(-2);
        }
    }

    for(int i=ans.size()-1;i>=0;i--){
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

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

int main(){
  string s;
  cin >>s;
  while(s.size()>7){
   if(s.substr(0,7)=="dreamer" && s.at(7) !='a'){
    s = s.substr(7);
   }
    else if(s.substr(0,5)=="dream"){
    s = s.substr(5);
  }
   else if(s.substr(0,5)=="erase"&&s.at(5)!='r'){
    s = s.substr(5);
   }
   else if(s.substr(0,6)=="eraser"){
    s = s.substr(6);
   }
  else{
    cout << "NO" << endl;
    return 0;
  }
  }
  if(s=="dreamer"||s=="dream"||s=="erase"||s=="eraser"){
  cout << "YES" << endl;
  }
  else{
    cout << "NO" <<endl;
  }
}

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

int n,W;
int w[105];
int v[105];
long long f[105][100005];

int main()
{
    cin>>n>>W;
    for (int i=1;i<=n;i++) cin>>w[i]>>v[i];
    for (int i=1;i<=n;i++)
    {
        for (int j=0;j<=W;j++)
        if (j<w[i]) f[i][j]=f[i-1][j];
        else f[i][j]=max(f[i-1][j],f[i-1][j-w[i]]+v[i]);
    }
    long long ans=0;
    for (int i=0;i<=W;i++) ans=max(ans,f[n][i]);
    cout<<ans;
    return 0;
}


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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = copy(x);cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

constexpr lli MOD = (lli)1e9 + 7;
constexpr lli LIMIT = 1000000000000000000 * 5;

int main() {
	lli N;
	cin >> N;
	lli ans = 0;
	for (lli i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3624
package main

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

const rsize = 1000000
var reader = bufio.NewReaderSize(os.Stdin,rsize)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func NextInts() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}

var par,rank,size []int
func main() {
  var n,m int = NextInts()
  initialize(n)
  var a,b []int
  var c []int64
  a = make([]int,m)
  b = make([]int,m)
  c = make([]int64,m)
  for i:=m-1;i>-1;i-- {
    a[i],b[i] = NextInts()
    a[i]--
    b[i]--
  }
  c[0] = (int64(n)*int64(n-1))/2
  for i:=0;i<m-1;i++ {
    if same(a[i],b[i]) {
      c[i+1] = c[i]
    } else {
      c[i+1] = c[i] - int64(get(a[i]))*int64(get(b[i]))
    }
    unite(a[i],b[i])
  }
  for i:=m-1;i>-1;i-- {
    fmt.Println(c[i])
  }
}
func initialize(n int) {
  par = make([]int,n)
  rank = make([]int,n)
  size = make([]int,n)
  for i:=0;i<n;i++ {
    par[i] = i
    size[i] = 1
  }
}
func root(i int) int {
  if par[i] == i { return i }
  par[i] = root(par[i])
  return par[i]
}
func same(i,j int) bool {
  return root(i) == root(j)
}
func unite(i,j int) {
  i = root(i)
  j = root(j)
  if i == j { return }
  if rank[i] < rank[j] {
    par[i] = j
    size[j] += size[i]
  } else {
    par[j] = i
    size[i] += size[j]
    if rank[i] == rank[j] { rank[i]++ }
  }
}
func get(i int) int {
  return size[root(i)]
}

Measured memory_bytes: 13184
#include <bits/stdc++.h>
#define X first
#define Y second

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

const ll INF = 2e18;
const int inf = 1e9+10;
const int maxN = 2e4+10;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 998244353;

int a[maxN];
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n);
	int ans = 0;
	for(int i=1;i<=k;i++)
	{
		ans += a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3764
n, m = [int(i) for i in input().split()]
a=[]
b=[]
for i in range(m):
    x1, y1 = [int(i) for i in input().split()]
    a.append(x1)
    b.append(y1)

c = zip(b,a)
c = sorted(c)
b,a = zip(*c)

#print(a,b)
ans = 0
point=0

for i in range(m):
    if a[i]<point<b[i]:
        continue
    else:
        ans += 1
        point=b[i]-0.5

print(ans)

Measured memory_bytes: 75992
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>

using namespace std;

const int MAX = 101;
int n;
int a[MAX];


void solve() {
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int mi = i;
        for (int j = i + 1; j < n; j++) {
            if (a[j] < a[mi]) mi = j;
        }
        if (mi != i) {
            swap(a[mi], a[i]);
            ans++;
        }
    }
    for (int i = 0; i < n; i++) {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
    printf("%d\n", ans);
}


int main() {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    solve();
    return 0;
}

Measured memory_bytes: 3204
from collections import Counter
S = input()
T = input()

import numpy as np
S_num = dict(Counter(S)).values()
T_num = dict(Counter(T)).values()
Ss = np.array([s for s in S_num])
Ts = np.array([s for s in T_num])

if len(Ss) != len(Ts):
    print("No")
else:
    if all(np.sort(Ss)==np.sort(Ts)):
        print("Yes")
    else:
        print("No")

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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    for(int i = 1; i <= 1009; i++){
        if(a == int(i * 0.08) && b == int(i * 0.1)){
            cout << i <<endl;
            return 0;
    }
    }
    cout << -1 << endl;
    return 0;
}


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


int main() {
  int N;
  cin >> N;
  
  string s;
  map<string, int> S;
  for (int i=0; i<N; i++) {
    cin >> s;
    if (S.count(s)) S.at(s) += 1;
    else S[s] = 1;
  }
  
  int M;
  cin >> M;
  for (int i=0; i<M; i++) {
    cin >> s;
    if (S.count(s)) S.at(s) -= 1;
  }
  
  using pis = pair<int, string>;
  priority_queue<pis> cnt;
  for (auto x : S) {  // 要素はキーと値のpair
    cnt.push(pair(x.second, x.first));
  }
  
  if (cnt.top().first < 0) cout << 0 << endl;
  else cout << cnt.top().first << endl;
  
  return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int saiki(int start, int goal, vector<int> &h);
int main(){
  int n;
  cin >> n;

  vector<int> h(n);
  rep(i,n) cin >> h.at(i);

  int ans = saiki(0, n-1, h);
  cout << ans;
}

int saiki(int start, int goal, vector<int> &h){
  if(start==goal) return h.at(start);
  
  int min=200;
  int minhana;
  for(int i=start; i<=goal; i++){
    if(h.at(i)<=min){
      min=h.at(i);
      minhana = i;
    }
  }
  for(int i=start; i<=goal; i++){
    h.at(i)-=min;
  }

  int x = minhana-1;
  int y = minhana+1;
  if(minhana==start) x=start;
  if(minhana==goal) y=goal;
  
  return saiki(start, x, h) + saiki(y, goal, h) + min;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define sc(n) scanf("%d",&n)
#define scl(n) scanf("%lld",&n)
#define pr(n) printf("%d",n)
#define prl(n) printf("%lld",n)
#define nl printf("\n")
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
ll pow1(ll a, ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
		{
			ans=ans*a;
		}
		a=a*a;
		b=b>>1;
	}
	return ans;
}
int main()
{
	int n,i,j,x;
	cin>>n;
	map<int,int> v;
	int f = 0;
	for(i=0;i<n;i++)
	{
		cin>>x;
		if(x != 0)
			f = 1;
		v[x]++;
	}
	if(!f)
	{
		cout<<"Yes"<<endl;
		return 0;
	}
	if(n%3 != 0)
	{
		cout<<"No"<<endl;
		return 0;
	}
	if(v.size() == 2 && v.find(0) != v.end())
	{
		map<int,int>::iterator it = v.begin();
		for(;it!=v.end();it++)
		{
			if((it->f) != 0 && (it->s) == (2*n)/3 && v[0] == (n/3))
			{
				cout<<"Yes"<<endl;
				return 0;
			}
		}
		cout<<"No"<<endl;
		// return 0;
	}
	else if(v.size() == 3)
	{
		int cnt = 0;
		x = 0;
		// cout<<"hi"<<endl;
		map<int,int>::iterator it = v.begin();
		for(;it!=v.end();it++)
		{
			if((it->s) != 0 && (it->s) == (n/3))
			{
				x ^= (it->f);
				cnt++;
				// cout<<(it->f)<<" "<<(it->s)<<endl;
				// cout<<"No"<<endl;
				// return 0;
			}
		}
		if(cnt == 3 && v.size() == 3 && x == 0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n; cin >> n;
	vector<int> hash(n);
	ll j = 0;
	for(auto &x: hash){
		cin >> x;
		j^=x;
	}
	vector<int> ans;
	for(auto x : hash)
		ans.push_back(x^j);
	for(auto x:ans)
		cout<<x<<" ";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 5072
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
x = []
if N >= M:
    ans = 0
else:
    for i in range(M - 1):
        x += [X[i + 1] - X[i]]
    x.sort()
    ans = sum(x[:M-N])
print(ans)

Measured memory_bytes: 13968
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

n,m = m()

a = []

for i in range(m):
	a.append(l())

p = l()

su = 0
kk = []
for i in range(2**n):
	kk = []
	for j in range(m):
		co = 0
		for k in range(a[j][0]):
			if (i >> (n -(a[j][k+1])) & 1):
				co += 1
		kk.append(co)
	if all(kk[i] % 2 == p[i] for i in range(m)):
		su += 1
print(su)

Measured memory_bytes: 43756
#include<iostream>
#include<stdio.h>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
using namespace std;

int main(){
    int N;
    string str[101];
    cin >> N;
    for(int i=0; i<N; ++i){
        cin >> str[i];
        if(i == 0) continue;
        if(str[i][0] != str[i-1][str[i-1].length()-1]){
            cout << "No" << endl;
            return 0;
        }
        for(int j=0; j<i; ++j){
            if(str[i] == str[j]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
N,T = map(int,input().split(" "))
C = 10**9
for i in range(N):
  c,t = map(int,input().split(" "))
  if t>T:
    continue
  else:
    if c<C:
      C=c
if C==10**9:
  print("TLE")
else:
  print(C)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2100000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;

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

void mod(ll &val, ll M) {
    val = val % M;
    if(val < 0) {
        val += M;
    }
}

template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<P> vec(N);
    for(int i = 0;i < N;i++) {
        ll x,y;
        cin >> x >> y;
        vec.at(i) = P(x - y,x + y);
    }
    ll minx = INF;
    ll maxx = -INF;
    ll miny = INF;
    ll maxy = -INF;
    for(int i = 0;i < N;i++) {
        chmin(minx,vec.at(i).first);
        chmax(maxx,vec.at(i).first);
        chmin(miny,vec.at(i).second);
        chmax(maxy,vec.at(i).second);
    }
    cout << max(maxx - minx,maxy - miny) << endl;
}

Measured memory_bytes: 6428
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);


    string S;
    cin >> S;
    int k;
    cin >> k;

    int p = -1;
    REP(i, S.size()) {
        if (S[i] != '1') break;
        p = i;
    }

    if (k-1 <= p) {
        cout << 1 << endl;
    } else {
        cout << S[p+1] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N,A,B,C,D = map(int,input().split())
flag = D * (N - 1)
B -= A
if D - C == 0:
	if A == B:
		print("YES")
	else:
		print("NO")
elif N % 2 == 1:
	if (B % (C + D) <= (N - 1) * (D - C) / 2 or abs(B % (C + D) - (C + D)) <= (N - 1) * (D - C) / 2) and B <= flag and B >= -flag:
		print("YES")
	else:
		print("NO")
else:
	if abs(B % (C + D) - (D + C) / 2) <= (N - 1) * (D - C) / 2 and B <= flag and B >= -flag:
		print("YES")
	else:
		print("NO")

Measured memory_bytes: 3064
line_data = input()                                               
H1, M1, H2, M2, K = map(lambda x: int(x), line_data.split(' '))   
                                                                  
miniutes = (H2 - H1) * 60 + (M2 - M1)                             
                                                                  
print(miniutes - K)                                               


Measured memory_bytes: 9100
#include <stdio.h>

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

int main(void){
    int N,M,K;
    long long NA[200001];
    long long MB[200001];
    int ans = 0;
    
    scanf("%d%d%d",&N,&M,&K);
    
    NA[0] = 0;
    for(int i = 1; i < N + 1; i++){
        int tmp;
        scanf("%d",&tmp);
        NA[i] = tmp + NA[i-1];
    }
    
    MB[0] = 0;
    for(int i = 1; i < M + 1; i++){
        int tmp;
        scanf("%d",&tmp);
        MB[i] = tmp + MB[i-1];
    }
    
    int best = M;
    for(int i = 0; i < N+1; i++){
        if(NA[i] > K){
            break;
        }
        for(int j = best; j >= 0; j--){
            if(MB[j] <= K - NA[i]){
                best = j;
                break;
            }
        }
        
        ans = max(ans,i+best);
    }
    
    printf("%d\n",ans);
}


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

int main()
{
    int a, b;
    string s;
    int f = 0, cnt = 0;
    cin >> a >> b >> s;
   if(s.size() != a+b+1) {cout << "Yes" << endl; return 0;}
   for(int i = 0; i < s.size(); i++)
   {
       if(s[i] == '-') cnt++;
       if(!(s[i]>='0' || s[i]<= '9' || s[i]=='-'))
        { f = 1; break; }
   }
   if(f) {cout << "No" << endl; return 0;}
    if (s[a] != '-') {cout << "No" << endl; return 0;}
    if(cnt > 1) {cout << "No" << endl; return 0;}
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main() {
    int r, c;
    cin >> r >> c;
 
    int numbers[r + 1][c + 1];
    for (int j = 0; j <= c; j++) {
        numbers[r][j] = 0;
    }
 
    for (int i = 0; i < r; i++) {
        numbers[i][c] = 0;
        for (int j = 0; j < c; j++) {
            cin >> numbers[i][j];
            numbers[i][c] += numbers[i][j];
            numbers[r][j] += numbers[i][j];
            numbers[r][c] += numbers[i][j];
        }
    }
 
    for (int i = 0; i <= r; i++) {
        for (int j = 0; j < c; j++) {
            cout << numbers[i][j] << " ";
        }
        cout << numbers[i][c] << endl;
    }
 
    return 0;
}

Measured memory_bytes: 3100
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	int n;
	cin >> n;
	vi a(n);
	rep(i, n) cin >> a[i];
	reverse(all(a));
	deque<int> f;
	deque<int> s;
	rep(i, n){
		if(i & 1) f.pb(a[i]);
		else s.push_front(a[i]);
	}
	reverse(all(f));
	reverse(all(s));
	for(int x : s) cout << x <<  " ";
	for(int x : f) cout << x <<  " ";
	cout << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

// input
int N, Q;
vector<int> V, W;
vector<P> query;

int k, n;
vv dp;

const int MAX = 1e5 + 1;


void input() {
    cin >> N;
    V = W = vector<int>(N);
    rep(i, N) cin >> V[i] >> W[i];
    cin >> Q;
    query = vector<P>(Q);
    rep(i, Q) cin >> query[i].first >> query[i].second;
}


void create_dp() {
    dp = vv(n, vector<ll>(MAX, 0));
    for (int i = 1; i < n; i++) {
        int p = i >> 1;
        for (int j = 1; j < MAX; j++) {
            dp[i][j] = max(dp[i][j - 1], dp[p][j]);
            if (j >= W[i - 1]) {
                dp[i][j] = max(dp[i][j], dp[p][j - W[i - 1]] + V[i - 1]);
            }
        }
    }
}


ll solve(int u, ll v, int l) {
    if (l < 0) return 0;
    if (l == 0) return v;
    if (u < n) return dp[u][l] + v;
    ll x = solve(u >> 1, v + V[u - 1], l - W[u - 1]);
    ll y = solve(u >> 1, v, l);
    return max(x, y);
}


int main() {
    input();
    k = log2(N) + 1;
    n = 1 << (k >> 1);
    create_dp();
    for (P p : query) {
        cout << solve(p.first, 0, p.second) << endl;
    }
}


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

int main(){
    int n, k, h, i, count;
    cin >> n >> k;
    count = 0;
    for(i = 0; i < n; i++){
        cin >> h;
        if(h >= k) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define SUM(v) accumulate(v.begin(),v.end(),lli(0))
#define rev(n,d) for(int i=n;i>=d;i--)
#define FOR0(n) for(int i=0;i<n;i++)
#define FOR(a,n) for(int i=a;i<n;i++)
#define FORQ(a,n) for(int i=a;i<=n;i++)
#define inf 1000000009
#define inff 0x3f3f3f3f
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define mem(ar,x) memset(ar,x,sizeof ar)
#define present(container, element) (container.find(element) != container.end())
#define max3(a,b,c) return (lli(a)>lli(b)?(lli(a)>lli(c)?a:c):(lli(b)>lli(c)?b:c))
#define max4(a,b,c,d) return (max3(a,b,c)>lli(d)?(max3(a,b,c)):d)
#define min3(a,b,c) return (lli(a)<lli(b)?(lli(a)<lli(c)?a:c):(lli(b)<lli(c)?b:c))
#define min4(a,b,c,d) return (max3(a,b,c)<lli(d)?(max3(a,b,c)):d)
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<int,pii>ppii;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<pii>vpii;
const int N=100005;
int dr8[]={0,0,1,-1,1,1,-1,-1};
int dc8[]={1,-1,0,0,-1,1,-1,1};
int dr4[]={0,1,-1,0};
int dc4[]={1,0,0,-1};
int main(){
	fast
	int n,w;
	cin>>n>>w;
	lli v[n+1],wt[n+1];
	FOR0(n) cin>>wt[i+1]>>v[i+1];
	lli dp[n+5][w+5];
	mem(dp,0);
	for(int i=1;i<=n;i++){
		for(int j=0;j<=w;j++){
			dp[i][j]=dp[i-1][j];
			if((j-wt[i])>=0){
				dp[i][j-wt[i]]=max(dp[i-1][j-wt[i]],dp[i-1][j]+v[i]);
			}
		}
	}
	lli ans=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=w;j++){
			ans=max(ans,dp[i][j]);
		}
	}
	cout<<ans;
}



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

using namespace std;
using ll = long long;

const ll mod = 998244353;
const ll x = 716070898;

vector <int> G[101010];
vector <ll> V[3];
set <int> S1, S2;
ll C[101010], ans;
int n;

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

	int m, u, v, i, j, k;
	ll t, s;

	cin >> n;

	for(i = 1, t = x; i <= n; i ++){
		C[i] = t; t = t * x % mod;
	}

	for(i = 0; i < 3; i ++){
		for(j = 1; j <= n; j ++){
			G[j].clear();
			S1.insert(j);
		}
		cin >> m;
		for(; m --; ){
			cin >> u >> v;
			G[u].push_back(v);
			G[v].push_back(u);
		}
		for(; !S1.empty(); ){
			for(s = 0; !S1.empty(); ){
				u = *prev(S1.end()); S1.erase(u);
				s = (s + C[u]) % mod;
				for(int &t: G[u]){
					if(S1.find(t) != S1.end()){
						S1.erase(t);
						S2.insert(t);
					}
				}
			}
			V[i].push_back(s);
			swap(S1, S2);
		}
	}

	for(i = 0; i < V[0].size(); i ++){
		for(j = 0; j < V[1].size(); j ++){
			k = i ^ j;
			if(k < V[2].size()){
				ans = (ans + V[0][i] * V[1][j] % mod * V[2][k]) % mod;
			}
		}
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 11648
/**
 * @author torith
 * @date 2018-11-01
 */

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;

    // A → B
    for (int i = 0; i < abs(sy - ty); ++i) {
        cout << "U";
    }

    for (int i = 0; i < abs(sx - tx); ++i) {
        cout << "R";
    }

    // B → A
    for (int i = 0; i < abs(sy - ty); ++i) {
        cout << "D";
    }

    for (int i = 0; i < abs(sx - tx); ++i) {
        cout << "L";
    }

    // A → B
    cout << "L" ;
    for (int i = 0; i < abs(sy - (ty + 1)); ++i) {
        cout << "U";
    }

    for (int i = 0; i < abs(sx - 1 - tx); ++i) {
        cout << "R";
    }
    cout << "D" ;

    // B → A
    cout << "R" ;
    for (int i = 0; i < abs(ty - (sy - 1)); ++i) {
        cout << "D";
    }

    for (int i = 0; i < abs(tx + 1 - sx); ++i) {
        cout << "L";
    }
    cout << "U" ;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	string s;
	string t;
	cin >> s >> t;
	cout << (t.find(s) == 0 && s.length() + 1 == t.length()?"Yes":"No") << '\n';
}


Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>

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

	int a[ n ];
	for( int i = 0; i < n; i++ ) {
		std::cin >> a[ i ];
	}

	std::sort( a, a + n );
	int dist = 0;
	for( int i = 1; i < n; i++ ) {
		dist += abs( a[ i - 1 ] - a[ i ] );
	}

	std::cout << dist << std::endl;
	return 0;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define sort(a) sort((a).begin(),(a).end())
#define rev(a) reverse((a).begin(),(a).end())
using db = double;
using namespace std;
typedef long long ll;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int ans;
  if (b > a*c) ans = c;
  else ans = b/a;
  cout << ans << endl;
}

Measured memory_bytes: 256