akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
	int n = in();
	VI ls = in(n * 2);
	sort(ALL(ls));
	int ans = 0;
	rep(i, n) ans += ls[i * 2];
	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
# ARC079E
n = int(input())
a = list(map(int, input().split()))

def sub(n, a):
    # aを現時点で必要なだけ叩いて、その回数と終わったあとの状態
    c = 0
    nums = [0] * n
    for i,num in enumerate(a):
        if num> n-1:
            v = (num - (n-1)) // n + bool((num - (n-1)) % n)
            a[i] = num - v*n
            nums[i] -= v
            c += v
    return c, [c+num+num2 for num,num2 in zip(a, nums)]

count = 0
while max(a)>=n:
    c, a = sub(n, a)
    count += c
print(count)

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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])

int main() {
    int A[9];
    for(int i = 0; i < 9; i++){
        int n;
        cin >> n;
        A[i] = n;
    }
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int n;
        cin >> n;
        for(int j = 0; j < 9; j++){
            if(A[j] == n){
                A[j] = 0;
            }
        }
    }
    int r1 = A[0] + A[1] + A[2];
    int r2 = A[3] + A[4] + A[5];
    int r3 = A[6] + A[7] + A[8];
    int r4 = A[0] + A[3] + A[6];
    int r5 = A[1] + A[4] + A[7];
    int r6 = A[2] + A[5] + A[8];
    int r7 = A[0] + A[4] + A[8];
    int r8 = A[2] + A[4] + A[6];
    if(r1*r2*r3*r4*r5*r6*r7*r8){
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }
}

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

#define INF (1<<24)

int knapsack(int* a, int* c, int s, int l)
{
	int r[301];
	for(int i=0; i<=300; i++) r[i]=-1;
	r[0]=0;
	
	for(int i=0; i<=l; i++)
	{
		if(r[i]==-1) continue;
		for(int j=0; j<s; j++)
		{
			if(i+c[j] > l) continue;
			r[i+c[j]]=max(r[i+c[j]], r[i]+a[j]);
		}
	}
	
	int ret=0;
	for(int i=0; i<=l; i++)
		ret=max(ret, r[i]);
		
	return ret;
}

int main()
{
	int N,M;
	while(cin >> N >> M)
	{
		int c[300],v[300],d[300],l[300];
		for(int i=0; i<N; i++)
		{
			string s;
			cin.ignore();
			getline(cin, s);
			cin >>  c[i] >> v[i] >> d[i] >> l[i]; 
		}
		
		int ret=0;
		ret=max(ret, knapsack(v,c,N,M));
		ret=max(ret, knapsack(d,c,N,M));
		ret=max(ret, knapsack(l,c,N,M));
		
		cout << ret << endl;
	}
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long

int main() {
    fastio;
    int n;cin >> n;
    if (n == 1) cout << 1;
    else {
        n++;
        vector<ll> v(n);
        v[0] = 2;
        v[1] = 1;
        for (int i = 2; i < n; ++i) v[i] = v[i - 1] + v[i - 2];
        cout << v[n-1];
    }
    return 0;
}

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

const double PI= 3.141592653589793238462643383279502884197169399375105820974944592307816406286;

int main()
{
	int a, b, h, m;
	cin >> a >> b >> h >> m;
	long double delta=(((long double)h * 360/ 12+(long double)m*(30)/60) - (long double)m * 360 / 60);
    long double c = sqrt((long double)(a * a + b * b) - (long double)(2 * a*b*cos(delta * PI/180)));
    cout.precision(15);
    cout <<std::fixed<< c;
    return 0;
}



Measured memory_bytes: 4160
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>

using ll = long long;
ll n;


int main(){
    std::cin >> n;
    ll offset = 0;
    if(n % 2 == 1) offset = n / 2;
    else offset = n / 2 - 1;
    std::vector<ll> a(n), b(n), sorter_a(n), sorter_b(n);
    for(int i = 0; i < n; i++){
        std::cin >> a[i] >> b[i];
        sorter_a[i] = a[i];
        sorter_b[i] = b[i];
    }

    std::sort(sorter_a.begin(), sorter_a.end());
    std::sort(sorter_b.begin(), sorter_b.end());
    ll a_left = sorter_a[offset]; // 最速でoffset個積む
    ll a_next = sorter_a[offset + 1];
    ll b_next = sorter_b[n - 2 - offset];
    ll b_right = sorter_b[n - 1- offset]; // 最遅でoffset個積む

    if(n % 2 == 1){
        std::cout << b_right - a_left + 1 << std::endl;
    }else{
        long double left, right;
        left = (a_next + a_left) / 2.0;
        right = (b_right + b_next) / 2.0;
        ll ans = (right - left) * 2 + 1;
        std::cout << ans << std::endl;
    }

    return 0;
}


Measured memory_bytes: 9592
h, w, k  = map(int, input().split())

puyo_orig = [[0]*w for _ in range(h+1)]
for i in range(1,h+1):
    puyo_orig[i] = list(map(int, list(input())))

import copy
mx = 0
for i1 in range(2,h+1):
    for i2 in range(w):
        puyo = copy.deepcopy(puyo_orig)
        for l in range(i1,0,-1):
            puyo[l][i2] = puyo[l-1][i2]
        p = 0
        fin = 0
        turn = 0
        while fin==0:
            fin = 1
            for i in range(2,h+1):
                cnt = 1
                for j in range(1,w):
                    if puyo[i][j-1] == puyo[i][j] and puyo[i][j]>0:
                        cnt += 1
                    else:
                        if cnt>=k:
                            p += cnt * puyo[i][j-1] * 2**turn
                            for l in range(i,0,-1):
                                puyo[l][j-cnt:j] = puyo[l-1][j-cnt:j]
                            fin = 0
                        cnt = 1
                    if j==w-1:
                        if cnt>=k:
                            p += cnt * puyo[i][j-1] * 2**turn
                            for l in range(i,0,-1):
                                puyo[l][j-cnt+1:j+1] = puyo[l-1][j-cnt+1:j+1]
                            fin = 0
            turn += 1
        if p>mx:
            mx=p
            
print(mx)

Measured memory_bytes: 57180
# include "iostream"
# include "cstdio"

using namespace std;

int A,B,C,Ans;

int main(){
	scanf("%d%d%d",&A,&B,&C);
	if(A>B) swap(A,B);Ans+=A;
	if(B>C) swap(B,C);Ans+=B;
	printf("%d",Ans);
	return 0;
}

Measured memory_bytes: 256
from collections import deque

def main():
  N, Q = map(int, input().split())
  visited = [False] * (N+1)
  graph = {i:deque() for i in range(N+1)}

  for i in range(N-1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

  visited[1] = True

  c = [0] * (N+1)
  for i in range(Q):
    p, x = map(int, input().split())
    c[p] += x
    
  q = [1]
  while q:
    per = q.pop()
    for child in graph[per]:
      if not visited[child]:
        visited[child] = True
        c[child] += c[per]
        q.append(child)

  for i in range(1, N+1):
    print(c[i], '', end='')

if __name__ == '__main__':
  main()

Measured memory_bytes: 172316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	string str;
	ll k;
	while(cin >> str >> k){
	int n = str.size();
	bool f = false;
	for(int i = 0; i < n - 1; i++){
		if(str[i] != str[i+1]){
			f = true;
			break;
		}
	}
	ll ans = 0;
	if(!f){		//如果全一样 
		ans = k * n / 2;
		printf("%lld\n",ans);
	}
	else{
		//找出一个串里面的连续，和两个串里面的，加减一下
		ll ans2 = 0;
		int m = 1;
		for(int i = 0; i < n; i++){	//直接找出有几个连续的	
			if(str[i] == str[i+1])
				m++;	
			else if(i != 0 && str[i] == str[i-1]){
				ans += m / 2;
				m = 1;
			}
		}
		n += n;  str += str;  m = 1;
		for(int i = 0; i < n; i++){	//直接找出有几个连续的	
			if(str[i] == str[i+1])
				m++;	
			else if(i != 0 && str[i] == str[i-1]){
				ans2 += m / 2;
				m = 1;
			}
		}
//		printf("%d %d\n",i,j);			
//		printf("%d %d\n",sum1,sum2);
		//要加上两个连一起的，中间的，还有开头的和结尾的 如aabbaa
		ans =  ans + (ans2 - ans) * (k - 1);
		printf("%lld\n",ans);
	}
	
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    vector<vector<pair<int,int> > >p;
    int x,y;
    vector<pair<int,int> >tmpp;
    int i,j,k;
    for(i=0;i<n;i++){
      tmpp.clear();
      cin >> a[i];
      for(j=0;j<a[i];j++){
        cin >> x >> y;
        tmpp.push_back(make_pair(x,y));
      }
      p.push_back(tmpp);
    }
    int ans = 0;
    int chk = 0;
    int tmpa = 0;
    for(i=0;i<1<<n;i++){
      chk = 1;
      tmpa = 0;
      for(j=0;j<n;j++){
        if(i & 1<<j){
          for(k=0;k<a[j];k++){
            if(p[j][k].second==1){
              if(!(i & 1<<(p[j][k].first-1)))chk = 0;
            }else{
              if(i%(1<<p[j][k].first)>=1<<(p[j][k].first-1))chk=0;
            }
          }
        }
      }
      if (chk==1){
        for(j=0;j<n;j++){
          if(i & 1<<j)tmpa ++;
        }
        if(tmpa>ans)ans=tmpa;
      }
    }
    cout << ans << endl;
}


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

struct Card {char suit, value;};

void bubble(struct Card A[], int N){
    for(int i=0; i<N; i++){
        for(int j=N-1; j>=i; j--){
            if(A[j].value < A[j-1].value){
                Card t = A[j]; A[j] = A[j-1]; A[j-1] = t;
            }
        }
    }
}

void selection(struct Card A[], int N){
    //int i, j, t, sw = 0, mini;
    for(int i=0; i<N; i++){
        int minj = i;
        for(int j=i; j<N; j++){
            if(A[j].value < A[minj].value) minj = j;
        }
        Card t = A[i]; A[i] = A[minj]; A[minj] = t;
    }
}

void print(struct Card A[], int N){
    for(int i=0; i<N; i++){
        if(i>0) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << "\n";
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for(int i=0; i<N; i++){
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main(void){
    Card C1[100], C2[100];
    int N;
    char ch;
    
    cin >> N;
    for(int i=0; i<N; i++){
      cin >> C1[i].suit >> C1[i].value;  
    } 
    
    for(int i=0; i<N; i++) C2[i] = C1[i];

    bubble(C1, N);
    selection(C2, N);
    
    print(C1, N);
    cout << "Stable\n";
    
    print(C2, N);
    if(isStable(C1, C2, N)){
        cout << "Stable\n";
    }else{
        cout << "Not stable\n";
    }

    return 0;    
}


Measured memory_bytes: 3088
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
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;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

struct edge{
  int to;
  int id;
};

int n;
vector<edge> g[100005];
vector<int> color;
int k = 0;

void dfs(int now,int p,int eid = 0){
  int to_c = 0;
  for(auto e:g[now]){
    if(e.to == p) continue;
    if((now != 0)&&(to_c == color[eid])) to_c++;
    color[e.id] = to_c;
    chmax(k,to_c);
    dfs(e.to,now,e.id);
    to_c++;
  }
}

int main(){
  cin >> n;
  color.resize(n-1,-1);
  
  rep(i,n-1){
    int a,b; cin >> a >> b;
    a--,b--;
    edge ea,eb;
    ea.to = b; ea.id = i;
    eb.to = a; eb.id = i;
    g[a].push_back(ea);
    g[b].push_back(eb);
  }

  dfs(0,-1,0);

  cout << k+1 << endl;
  rep(i,n-1){
    cout << color[i]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 8448
#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
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

void p(ld ans)
{
	cout << fixed << setprecision(12) << ans << '\n';
}

ll x[100001];
int r[100001];
ll d[100001];
vi perm;
const int LG = 61;
int st[LG][100001];

int getval(int x, ll k)
{
	int pos = x;
	for(int i = 0; i < LG; i++)
	{
		if(k&(1LL<<i))
		{
			pos = st[i][pos];
		}	
	}
	return pos;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	for(int i = 0; i < n; i++) cin >> x[i];
	ll m, k; cin >> m >> k;
	for(int i = 0; i < m; i++) 
	{
		cin >> r[i];
		r[i]--;
	}
	d[0] = 0;
	for(int i = 1; i < n; i++)
	{
		d[i] = x[i] - x[i-1];
	}
	for(int i = 0; i < n; i++) perm.pb(i);
	for(int i = 0; i < m; i++)
	{
		swap(perm[r[i]], perm[r[i]+1]); //check
	}
	vi perm2(n);
	for(int i = 0; i < n; i++)
	{
		perm2[perm[i]] = i;
	}
	for(int i = 0; i < n; i++)
	{
		st[0][i] = perm2[i];
	}
	for(int i = 1; i < LG; i++)
	{
		for(int j = 0; j < n; j++)
		{
			st[i][j] = st[i-1][st[i-1][j]];
		}
	}
	for(int i = 0; i < n; i++)
	{
		int pos = getval(i, k);
		perm2[pos] = i;
	}
	ld sum = ld(x[0]);
	for(int i = 0; i < n; i++)
	{
		sum += ld(d[perm2[i]]);
		p(ld(sum));
	}
}


Measured memory_bytes: 29304
#include <cstdio>
#include <utility>
#include <vector>
#include <complex>
#include <cmath>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;

using Point=complex<double>;
using Plane=vector<Point>;

bool operator<(const Point &a, const Point &b) {
    return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

struct Line: public vector<Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        push_back(a);
        push_back(b);
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

int ccwise(Point a, Point b, Point c) {
    b -= a; c -= a;

    if (cross_prod(b, c) > 0) {
        // conter clockwise
        return 1;
    } else if (cross_prod(b, c) < 0) {
        // clockwise
        return -1;
    } else if (dot_prod(b, c) < 0) {
        // online back
        return 2;
    } else if (norm(b) < norm(c)) {
        // online front
        return -2;
    } else {
        // on segment
        return 0;
    }
}

int main() {
    double x, y;
    scanf("%lf %lf", &x, &y);
    Point p0(x, y);

    scanf("%lf %lf", &x, &y);
    Point p1(x, y);

    size_t q;
    scanf("%zu", &q);
    for (size_t i=0; i<q; ++i) {
        double x, y;
        scanf("%lf %lf", &x, &y);
        Point p2(x, y);

        int state=ccwise(p0, p1, p2);
        if (state == -2) {
            printf("ONLINE_FRONT\n");
        } else if (state == -1) {
            printf("CLOCKWISE\n");
        } else if (state == 0) {
            printf("ON_SEGMENT\n");
        } else if (state == 1) {
            printf("COUNTER_CLOCKWISE\n");
        } else if (state == 2) {
            printf("ONLINE_BACK\n");
        }
    }

    return 0;
}

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

#define int ll

#define pb push_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second

typedef long long ll;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

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

vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifdef LOCAL
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

double get_time() {
	return 1.0 * clock() / CLOCKS_PER_SEC;
}

const int MAXN = 1E5 + 10, MAXD = 111, MOD = 1E9 + 7;
string k;
int d, dp[MAXN][MAXD][2];
char c[MAXN];

int solve(int pos, int need, int flag) {
	if(pos == sz(k))
		return need == 0;
	if(dp[pos][need][flag] > -1)
		return dp[pos][need][flag];
	int dig = k[pos] - '0';
	int ret = 0;
	for(int i = 0; i <= 9; i++) {
		if(!flag && i > dig)
			break;
		c[pos] = char('0' + i);
		ret = (ret + solve(pos + 1, (need - i + d) % d, (flag | i < dig))) % MOD;
	}
	return dp[pos][need][flag] = ret;
}	

int32_t main() {
	memset(dp, -1 , sizeof(dp));
	cin >> k >> d;
	cout << (solve(0, d, 0) - 1 + MOD) % MOD << '\n';
}


Measured memory_bytes: 174592
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int n, k;
	scanf("%d%d", &n, &k);

	if (k > (n-1) * (n-2) / 2) {
		puts("-1");
		return 0;
	}

	vii edges;
	for (int i = 2; i <= n; i++) edges.emplace_back(1, i);
	int u = 2, v = 3;
	for (int i = (n-1) * (n-2) / 2; i > k; i--) {
		edges.emplace_back(u, v);
		if (++v > n) {
			++u;
			v = u+1;
		}
	}

	printf("%lu\n", edges.size());
	for (auto e : edges) printf("%d %d\n", e.first, e.second);
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
using namespace std;
 
int main() {
	string s;
	cin >> s;
	for (int i=1; i<4; i++){
		if (s[i]==s[i-1]){
			cout << "Bad";
			return 0;
		}
	}
	cout << "Good";
	return 0;
}

Measured memory_bytes: 256
n = int(input())
# n, k = list(map(int, input().split()))
#a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
march = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for i in range(n):
    s = input()
    if s[0] in "MARCH":
        march[s[0]] += 1

total = 0
total += march["M"]*march["R"]*march["A"]
total += march["M"]*march["A"]*march["C"]
total += march["M"]*march["A"]*march["H"]
total += march["M"]*march["R"]*march["C"]
total += march["M"]*march["R"]*march["H"]
total += march["A"]*march["R"]*march["C"]
total += march["A"]*march["C"]*march["H"]
total += march["R"]*march["C"]*march["H"]
total += march["C"]*march["H"]*march["M"]
total += march["A"]*march["R"]*march["H"]

print(total)


Measured memory_bytes: 43496
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    d=int(readline())
    c=list(map(int, readline().rstrip().split()))
    s=[0]*d
    for i in range(d):
        s[i]=list(map(int, readline().rstrip().split()))
    last=[-1]*26
    score=0
    for i in range(d):
        t=int(readline())-1
        last[t]=i
        score+=s[i][t]
        for j in range(26):
            score-=(i-last[j])*c[j]
        print(score)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 16524
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    x, y, a, b, c = map(int, input().split())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    r = list(map(int, input().split()))
    p = sorted(p)[::-1][:x]
    q = sorted(q)[::-1][:y]
    A = p + q + r
    A.sort(reverse=True)
    print(sum(A[:x+y]))
if __name__ == "__main__":
    main() #endline===============================================

Measured memory_bytes: 31316
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define T pair<int, int>
#define ordered_set tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
signed main(){
    fast();
    string s;
    cin >> s;
    int n = s.length();
    int p1= 0, p2 = n-1;
    while(p2 > p1){
        if(s[p1++] != s[p2--]){
            puts("No");
            return 0;
        }
    }
    p1 = 0; p2 = n/2-1;
    // bool f  = false;
    while(p2 > p1){
        if(s[p1++] != s[p2--]){
            puts("No");
            return 0;
        }
    }
    p1 = n/2+1; p2 = n-1;
    while(p2 > p1){
        if(s[p1++] != s[p2--]){
            puts("No");
            return 0;            
        }
    }
    puts("Yes");
}

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

int main() {
  string n;
  cin >> n;
  int t = (int)n.size() - 1;
  if(n.at(t) == '0' || n.at(t) == '1' || n.at(t) == '6' || n.at(t) == '8') {
    cout << "pon" << endl;
    return 0;
  }
  else if(n.at(t) == '3') {
    cout << "bon" << endl;
    return 0;
  }
  else {
    cout << "hon" << endl;
    return 0;
  }
}

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

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

using namespace std;

int main() {
  int N, ac = 0, tle = 0, wa = 0, re = 0;
  std::cin >> N;
  REP(i, N) {
    string s;
    std::cin >> s;
    if (s == "AC") {
      ac++;
    } else if (s == "WA") {
      wa++;
    } else if (s == "TLE") {
      tle++;
    } else {
      re++;
    }
  }

  std::cout << "AC "
            << "x " << ac << std::endl;
  std::cout << "WA "
            << "x " << wa << std::endl;
  std::cout << "TLE "
            << "x " << tle << std::endl;
  std::cout << "RE "
            << "x " << re << std::endl;

  return 0;
}


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

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
  static InputReader in;
  static PrintWriter out;

  static class Solution {
    void solve() throws IOException {
      while (true) {
        int H = in.nextInt();
        int W = in.nextInt();
        if (H == 0 && W == 0) break;
        
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
              out.print("#");
            }
            out.print("\n");
        }
        
        out.print("\n");
      }
    }
}

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }

    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }

    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken());
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }

    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }

  }

}

Measured memory_bytes: 26824
#include<iostream>
using namespace std;
int n,arr[53];
int main() {
	cin>>n;
	for(int i =1; i<=n; i++) {
		int t;
		char c;
		cin>>c>>t;
		if(c=='S')
			arr[t]++;
		else if(c=='H')
			arr[t+13]++;
		else if(c=='C')
			arr[t+26]++;
		else
			arr[t+39]++;
	}
	for(int i=1; i<=52; i++) {
		if(arr[i]==0) {
			if(i<=13)
				cout<<"S "<<i<<endl;
			else if(i<=26)
				cout<<"H "<<i-13<<endl;
			else if(i<=39)
				cout<<"C "<<i-26<<endl;
			else
				cout<<"D "<<i-39<<endl;
		}
	}
	return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        solve();
    }
    static Scanner cin;
    static int N;
    static int[] a;

    static void input()
    {
        cin = new Scanner();
        N = cin.nextInt();
        a = cin.ArrayInt(N);
    }
    static void solve()
    {
        input();
        long[] sum = new long[N];
        sum[0] = a[0];
        for (int i = 1; i < N; i++)
        {
            sum[i] = sum[i - 1] + a[i];
        }
        long min = long.MaxValue;
        for (int i = 0; i < N - 1; i++)
        {
            long v = Abs(sum[N - 1] - 2 * sum[i]);
            if (v < min)
                min = v;
        }
        WriteLine(min);
    }
    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }
        
        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for(int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }

        public double[] ArrayDounble(int N, int add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 32220
#include<stdio.h>
int gcd(int a,int b){
  int tmp;
  int r;
  
  if(a < b){
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  
  while(r != 0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main(void){
  int a,b,c;
  int input;
  unsigned int sum = 0;
  scanf("%d",&input);
  for(a = 1;a <= input;a++){
    for(b = 1;b <= input;b++){
      for(c = 1;c <= input;c++){
        sum += gcd(gcd(a,b),c);
      }
    }
  }
  printf("%u",sum);
  return 0;
}
    


Measured memory_bytes: 1728
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

using namespace std;
 
int main(){
    int A,B,C,D;
    cin >> A >> B >> C >> D;

    if(abs(C-A) <= D){
        cout << "Yes" << endl;
    }
    else if(abs(C-B) <= D && abs(A-B) <= D){
        cout << "Yes" << endl;        
    }
    else cout << "No" << endl;


}

Measured memory_bytes: 3624
#include <iostream>
#include<map>
using namespace std;
typedef long long ll;
ll n,s[26],d[365][26],t[365],ans,u[26],q,a,b,c,MAX=-10000000,L,A[365],M,MM,ok;
int main(void){
  	cin.tie(0);
	ios::sync_with_stdio(false);	
    cin>>n;
    for(int i=0;i<26;i++){
        cin>>s[i];
    }
    for(int i=0;i<n;i++){
        M=0;
        for(int j=0;j<26;j++){
            cin>>d[i][j];
            if(M<d[i][j]){MM=j;M=d[i][j];}
        }
        t[i]=MM+1;
    }
    
    
    //for(int i=0;i<n;i++){
    //        t[i]=rand()%26+1;
    ///    }
        
        
    q=275000;
    while(q--){
        a=rand()%n;
        b=rand()%26;
        ans=0;
        for(int i=0;i<26;i++)u[i]=0;
        
        c=t[a];
        t[a]=b+1;
        
        for(int i=0;i<n;i++){
            ans+=d[i][t[i]-1];
            u[t[i]-1]=i+1;
            for(int j=0;j<26;j++){
                ans-=s[j]*(i+1-u[j]);
            }
        }
        if(ok==0){MAX=ans;ok=1;}
        if(MAX<ans){
            MAX=ans;
        }
        else t[a]=c;
    }
    
    for(int i=0;i<n;i++){
        cout<<t[i]<<endl;
    }
    //cout<<MAX<<endl;
}


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

int f(vector<pair<int, int>> v1, vector<pair<int, int>> v2, int n)
{
    int ans = 0;
    ans += (n / 2 - v1[0].first);

    if (v1[0].second != v2[0].second) {
        ans += (n / 2 - v2[0].first);
    } else {
        if (v2.size() > 1) {
            ans += (n / 2 - v2[1].first);
        } else {
            ans += (n / 2);
        }
    }

    return ans;
}

int main() {
    // TODO: WIP

    unordered_map<int, int> m1;
    unordered_map<int, int> m2;

    int n;
    cin >> n;

    int v[n];

    for (int i = 0; i < n; i++) {
        int _v;
        cin >> _v;

        if (i % 2) {
            if (m1.find(_v) == m1.end()) {
                m1[_v] = 1;
            } else {
                m1[_v]++;
            }
        } else {
            if (m2.find(_v) == m2.end()) {
                m2[_v] = 1;
            } else {
                m2[_v]++;
            }
        }
    }

    vector<pair<int, int>> v1;
    vector<pair<int, int>> v2;
    for (auto m : m1) {
        v1.push_back({m.second, m.first});
    }
    for (auto m : m2) {
        v2.push_back({m.second, m.first});
    }

    sort(v1.begin(), v1.end(), greater<pair<int, int>>());
    sort(v2.begin(), v2.end(), greater<pair<int, int>>());

    int ans = 0;
    if (v1[0].first > v2[0].first) {
        ans += f(v1, v2, n);
    } else if (v1[0].first < v2[0].first) {
        ans += f(v2, v1, n);
    } else {
        int a = f(v1, v2, n);
        int b = f(v2, v1, n);
        ans += min(a, b);
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    string S,s1,s2,s3;
    cin >>S;
    bool ans=true;
    s1=S;
    reverse(s1.begin(),s1.end());

    if(S.size()%2==0){
        ans = false;
    }
    if(S.substr(0,S.size()/2)!=s1.substr(0,S.size()/2)){
        ans = false;
    }
    if(S.substr(0,S.size()/4)!=s1.substr(s1.size()/2+1,s1.size()/4)){
        ans = false;
    }
    if(S.substr(S.size()/2+1,s1.size()/4)!=s1.substr(0,s1.size()/4)){
        ans = false;
        }

  if(ans==true){
      cout <<"Yes"<<endl;
  }
  else if(ans == false){
      cout <<"No"<<endl;
  }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,k;
  scanf("%lld %lld",&n,&k);
  if(n<=k)
  cout<<min(n,abs(n-k));
  else
  {
      if(n%k==0)
      cout<<0;
      else
      cout<<min(k,k-n%k);
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);
const ll inf=1000000000000000000;
int main(){
	ll n,m,l;
	cin>>n>>m>>l;
	ll a[n][n];
	ll old[n][n];
	fo(i,n){
		fo(j,n){
			if(i==j) a[i][j]=0;
			else a[i][j]=inf;
			if(i==j) old[i][j]=0;
			else old[i][j]=inf;
		}
	}
	ll aa,bb,cc;

	fo(i,m){
		cin>>aa>>bb>>cc;
		aa--;
		bb--;
		a[aa][bb]=cc;
		a[bb][aa]=cc;
		old[aa][bb]=cc;
		old[bb][aa]=cc;



	}
	fo(k,n){
		fo(i,n){
			fo(j,n){
				a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
				old[i][j]=min(old[i][j],old[i][k]+old[k][j]);

			}
		}
	}
	
	fo(i,n){
		fo(j,n){
			if(i==j) a[i][j]=0;
			else{
				if(old[i][j]<=l) a[i][j]=1;
				else a[i][j]=inf;
			}
		}
	}

	fo(k,n){
		fo(i,n){
			fo(j,n){
				a[i][j]=min(a[i][j],a[i][k]+a[k][j]);

			}
		}
	}
	ll q;
	cin>>q;
	ll tmp;
	while(q--){
		cin>>aa>>bb;
		aa--;
		bb--;
		tmp=a[aa][bb];
		if(tmp>=inf) cout<<-1<<endl;
		else{
			cout<<(tmp-1)<<endl;
		}
	}



	
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

int main() {
  int n, x;
  cin >> n >> x;
  if (x == 1 || x == 2 * n - 1)
    cout << "No" << endl;
  else {
    // vector<int> v;
    cout << "Yes" << endl;
    int cnt = 1;
    rep(i, 2 * n - 1) {
      if (cnt == x - 1) cnt += 3;
      int res;
      if (i == n)
        res = x - 1;
      else if (i == n - 1)
        res = x;
      else if (i == n - 2)
        res = x + 1;
      else
        res = cnt++;
      cout << res << endl;
      // v.eb(res);
    }

    // while (v.size() > 1) {
    //   vector<int> tmp;
    //   rep(i, v.size() - 2) {
    //     vector<int> _t;
    //     rep(j, 3) _t.eb(v[i + j]);
    //     sort(all(_t));
    //     tmp.eb(_t[1]);
    //   }
    //   v = tmp;
    // }

    // cout << v[0] << endl;
  }
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#include<cmath>
#include<cstring>
#include<climits>
#define int long long
#define umitr unordered_map <int,int> :: iterator
#define usitr unordered_set <int> :: iterator
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define asc(a,n) sort(a,a+n);
#define dsc(a,n) sort(a,a+n,comp);
#define fo(i,x,y) for(int i=x;i<y;i++)
#define inarr(x) int n; cin>>n; int x[n]; fo(i,0,n){cin>>x[i];}
#define test int t; cin>>t; while(t--)
using namespace std;

int basic(){freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);return 0;}
bool comp(int a,int b){return a>b;}



int32_t main()
{ //basic(); 
  fast; 
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if((a+b)>=k){cout<<min(a,k);}
  else{cout<<a-(k-a-b);}
  return 0;
}










Measured memory_bytes: 3656
from heapq import *
N,K=map(int,input().split())
A=list(map(int,input().split()))
Q=[]
heapify(Q)
for i in range(N):
  heappush(Q,(-A[i],1))
x=0
if K==0:
  print(max(A))
  exit()
L,R,M=1,max(A),0
while R!=L:
  M=(L+R)//2
  x=0
  for i in range(N):
    x+=(A[i]-1)//M
  if x>K:
    L=max(L+1,M)
  else:
    R=M
print(L)


Measured memory_bytes: 97696
package main
 
import(
  "fmt"
	"bufio"
	"os"
	"strings"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func Rr() []string {
  sc.Scan()
  slice := strings.Split(sc.Text(), " ")
  return slice
}
 
func abc147a(a int, b int,c int){
	A := a+b+c
	if A >= 22{
		fmt.Println("bust")
	}else{
		fmt.Println("win")
	}
}
 
func main(){
	a := 0
	b := 0
	c := 0
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	abc147a(a,b,c)
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x&&x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS*max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x*x + y*y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;


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



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

	vector <int> b;
	for (int i = N-1; i >= 0; i-=2)
	{
		b.push_back(a[i]);
	}

	for (int i = N%2; i < N; i += 2)
	{
		b.push_back(a[i]);
	}

	for (int i = 0; i < N; ++i)
	{
		printf("%d ",b[i]);
	}
	printf("\n");

	return 0;
}


Measured memory_bytes: 3828
import std.stdio, std.string, std.conv;

void main() {
	auto n = readln.chomp.to!int;
	string[] result;
	foreach (i; 0..n) {
		result ~= readln.chomp.replace("Hoshino", "Hoshina");
	}
	foreach (r; result) r.writeln;
}

Measured memory_bytes: 2404
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define maxn 100005
using namespace std;
int p[maxn];
int vis[maxn];
int sum[maxn];
int t;
int main()
{
	
	int i,j,q,l,r;
	memset(sum,0,sizeof(sum));
	for(i=2;i<=100000;i++)
	{
		if(!vis[i]) p[++t]=i;
		for(j=1;j<=t&&i*p[j]<=100000;j++)
		{
			vis[i*p[j]]=1;
			if(i%p[j]==0) break;
			
		}
	}
	scanf("%d",&q);
	sum[1]=0;sum[2]=0;
	for(i=3;i<=100000;i=i+2)
	{
		if(vis[i]==0&&vis[(i+1)/2]==0)
		{
			sum[i]++;
		}
		sum[i]=sum[i]+sum[i-1];
		sum[i+1]=sum[i];
		//printf("%d %d\n",i,sum[i]);
	}
	for(i=1;i<=q;i++)
	{
		scanf("%d%d",&l,&r);
		printf("%d\n",sum[r]-sum[l-1]);
	}
	return 0;
}

Measured memory_bytes: 1408
#include<stdio.h>

int main(void){
    int W,H,x,y,r;
    scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
    if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 2104
n=int(input())
s={}
l=[]
for i in range(n):
  a=input()
  if a in s:
    s[a]+=1
  else:
    s[a]=1
    
cou=max(s.values())

for k,v in s.items():
  if v==cou:
    l.append(k)
    
ans=sorted(l)

for i in ans:
  print(i)

Measured memory_bytes: 35624
#include<iostream>
#include<algorithm>
#include<vector>
int N, M;
int E[100010];
std::vector<int> G[100010];
std::vector<int> oddnum;
int main() {
	std::cin >> N >> M;
	for (int i = 0; i < M; i++) {
		int a, b;
		std::cin >> a >> b;
		G[a].emplace_back(b);
		G[b].emplace_back(a);
		E[a]++;
		E[b]++;
	}
	for (int i = 2; i <= N; i++) {
		if (E[i] % 2)oddnum.emplace_back(i);
	}
	if (oddnum.size()) {
		std::cout << "NO" << std::endl;
		return 0;
	}
	std::cout << "YES" << std::endl;
	return 0;
}

Measured memory_bytes: 6144
#include <stdio.h>
int main()
{
     
     long long int A,B,z,x,y;
     scanf("%lld %lld",&A,&B);
     z=A+B ;
     x=A-B ;
     y=A*B ;
     if (y>x && y>z)
    {
    
        printf("%lld\n",y);
     }
     else if(x>z && x>y)
    {
        printf("%lld\n",x);
     }
     else {
        printf("%lld\n",z);
     }
     
     return 0;
}
    
    

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

int main() {
    int N;

    //Nをまず受け取る
    cin >> N;

    //N要素の配列のメモリを確保
    vector<int> A(N);
    for(int i = 0; i < N; ++i) {
        cin >> A[i];
    }

    //配列をソート O(NlogN)
    sort(A.begin(),A.end());

    //横同士を確認 O(N)
    for(int i = 0; i + 1 < N; ++i) {
        //同じ要素がある場合アウト
        if(A[i] == A[i+1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    
    //ここまで来たら重複はない
    cout << "YES" << endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ull unsigned long long
#define pi acos(-1)
using namespace std;
typedef long long ll;
const ll inf = 0x3f3f3f3f;
const ll maxn = 1e7+5;
const ll mod = 1e9+7;

int main(){
	int k,x;
	cin>>k>>x;
	if(k*500>=x) cout<<"Yes\n";
	else cout<<"No\n"; 
	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int main() {
	bool b1, b2, b3;
	cin >> b1 >> b2 >> b3;
	if ((b1 && b2 && !b3) || (!b1 && !b2 && b3)) cout << "Open" << endl;
	else cout << "Close" << endl;
	return 0;
}

Measured memory_bytes: 1156
from fractions import gcd

n=int(input())
A=list(map(int,input().split()))

L=[0]*n
R=[0]*n
L[0]=A[0]
R[n-1]=A[n-1]
res=0

for i in range(1,n):
	L[i]=gcd(L[i-1],A[i])
for i in range(0,n-1):
	R[n-i-2]=gcd(R[n-i-1],A[n-i-2])

for i in range(1,n-1):
	res=max(res,gcd(L[i-1],R[i+1]))
	
print(max(res,L[n-2],R[1]))

Measured memory_bytes: 16124
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
const char newl = '\n';
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL<<60;

const int D = 60;
const int MAX_N = 200005;

int to[D][MAX_N];
int main(){
    int n;
    Int k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i,n){
        cin >> to[0][i];
        to[0][i]--;
    }
    rep(i,D-1){
        rep(j,n){
            to[i+1][j] = to[i][to[i][j]];
        }
    }
    int v = 0;
    for(int i=D-1;i>=0;--i){
        Int l = (Int)1<<i;
        if(l<=k){
            v = to[i][v];
            k-=l;
        }
    }
    cout << v+1 << endl;
}

Measured memory_bytes: 51044
<?php
$N = (int)fgets(STDIN);
$count = -1;
foreach (range(1,$N) as $num){
    $factor_count = 0;
    foreach (range(1,$num) as $small_num){
        if($num % $small_num == 0 and $num %2 == 1){
            $factor_count += 1;
        }
    }
    if($factor_count == 8){
        $count += 1;
    }
}
echo $count+=1;


Measured memory_bytes: 4728
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
"""
#solution:
#潜 影 蛇 手 ! !
N,K=pin()
A=list(pin())
b=[0]*N#for backet
for i in range(N):
    b[A[i]-1]+=1
b.sort()
ans=0
x=N
for j in range(N):
    if b[j]==0:
        x-=1
    else:
        if x>K:
            x-=1
            ans+=b[j]
print(ans)

Measured memory_bytes: 76496