akhauriyash/Code-Regression huggingface dataset:
n = int(input())
a = [0] + list(map(int,input().split())) + [0]
ans = 0
anslist = [0] * n
for j in range(1, n + 2):
    if j == 1:
        ans += abs(a[j])
    elif j == n + 1:
        ans += abs(a[n])
    else:
        ans += abs(a[j]-a[j - 1])

for i in range(1, n + 1):
    anslist[i - 1] = ans - abs(a[i - 1] - a[i]) - abs(a[i] - a[i + 1]) + abs(a[i - 1] - a[i + 1])
            
for k in anslist:
    print(k)

Measured memory_bytes: 20496
import java.util.Scanner;

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

        int n = sc.nextInt();

        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int cnt = 0;

        for (int i = 0; i < n; i++) {
            int index = i;
            for (int j = i; j < n; j++) {
                if (a[index] > a[j])
                    index = j;
            }
            if (index != i) {
                int min = a[index];
                a[index] = a[i];
                a[i] = min;
                cnt++;
            }
        }

        for (int i = 0; i < n-1; i++) {
            System.out.print(a[i] + " ");
        }
        System.out.println(a[n-1]);
        System.out.println(cnt);
    }
}



Measured memory_bytes: 26412
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
using namespace std;
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb(X) push_back(X)
#define x first
#define y second
#define all(x) (x).begin(), (x).end()
#define bbb 0;
#define INIT std::ios::sync_with_stdio(false);std::cin.tie(0);
typedef long long ll;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef pair <int,int> P;
typedef pair <int,P> PP;
typedef pair <P,int> P2;
//ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

const int MAXN = 100007;
ll Ans;
int _;
 
struct Deal
{
	int par[MAXN],rank[MAXN];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=1;
		}
	}
	int find(int x)
	{
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y])
		{
			par[x]=y;
		}
		else
		{
			par[y]=x;
			if(rank[x]==rank[y]) rank[x]++;
		}
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
};
Deal uf;
vector <PP> edge;
P2 p1[MAXN];
P2 p2[MAXN];
void Solve() {
		int n;
	cin>>n;
	rep (i,0,n)
	{
		int a, b;
		cin >> a >> b;
		p1[i]=P2(P(a,b),i);
		p2[i]=P2(P(b,a),i);
	}
	sort(p1,p1+n);
	sort(p2,p2+n);
	for(int i=0;i+1<n;i++)
	{
		P p=p1[i].first,q=p1[i+1].first;
		int ct=min(abs(p.first-q.first),abs(p.second-q.second));
		edge.push_back(PP(ct,P(p1[i].second,p1[i+1].second)));
	}
	for(int i=0;i+1<n;i++)
	{
		P p=p2[i].first,q=p2[i+1].first;
		int ct=min(abs(p.first-q.first),abs(p.second-q.second));
		edge.push_back(PP(ct,P(p2[i].second,p2[i+1].second)));
	}
	sort(edge.begin(),edge.end());
	uf.init(n+2);
	for(int i=0;i<edge.size();i++)
	{
		P p=edge[i].second;
		if(!uf.same(p.first,p.second))
		{
			uf.unite(p.first,p.second);
			Ans+=edge[i].first;
		}
	}
	cout<<Ans;
}

int main()
{
	INIT
	_ = 1;
	for (; _; --_) {
		Solve();
	}
	return bbb;
}


Measured memory_bytes: 7284
N = int(input())
A = [int(input()) for _ in range(N)]
AL = [0] * (N+1)
AR = [0] * (N+1) 
for i in range(N):
    AL[i+1] = max(AL[i], A[i])
for i in range(N)[::-1]:
    AR[i] = max(AR[i+1], A[i])
for i in range(N):
    print(max(AL[i], AR[i+1]))

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define erep(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef long long i64;

i64 power(i64 x, i64 n, i64 mod) {
  i64 ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}

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

  int n, m;
  cin >> n >> m;
  cout << power(n, m, mod) << endl;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define ALL(NAME) (NAME).begin(), (NAME).end()

#define cMOD 1000000007ULL
#define cINF ((1ull<<62)-1)
#define cINFINT ((1<<30)-1)


int main()
{
	ull n = 0;
	cin >> n;
	vector<ll> x( n, 0 ), y( n, 0 );
	REP(i, n) cin >> x[i] >> y[i];
	map<pair<ll,ll>,ll> mp;
	REP(i,n) REP(j,n) if( i != j )
	{
		pair<ll,ll> p{ x[i]-x[j], y[i]-y[j] };
		++mp[p];
	}

	ll maxx = 0;
	for( auto m : mp )
	{
		maxx = max( maxx, m.second );
	}
	
	ll ans = n - maxx;
	cout << max( ans, 1ll ) << endl;
	return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
	unsigned int n, m;
	unsigned int a[101][101];
	unsigned int b[101];

	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> a[i][j];
		}
	}
	for (int j = 0; j < m; ++j) {
		cin >> b[j];
	}

	for (int i = 0; i < n; ++i) {
		int ans = 0;
		for (int j = 0; j < m; ++j) {
			ans += a[i][j] * b[j];
		}
		cout << ans << endl;
	}
	return 0;
}



Measured memory_bytes: 3132
#include <iostream>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
using ll = long long;

using namespace std;



int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> res(n+1, vector<int>(2));
    rep(i,m) {
        int p;
        string s;
        cin >> p >> s;
        if(res[p][0]) continue;
        if(s == "AC") res[p][0] = 1;
        else res[p][1]++;
    }
    int ac = 0, wa = 0;
    rrep(i,n) {
        ac += res[i][0];
        if(res[i][0]) wa += res[i][1];
    }
    cout << ac << " " << wa << endl;

    return 0;
}


Measured memory_bytes: 8700
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int Cnt(int K, int score, char c, const string& T) {
  vector<char> use(T.size(), 0);

  int ret = 0;
  for (size_t i = 0; i < T.size(); ++i) {
    if (c == T[i]) {
      if (int(i) < K || !use[i - K]) {
        ret += score;
        use[i] = 1;
      }
    }
  }
  return ret;
}

int main(void) {
  int N, K;
  cin >> N >> K;
  int R, S, P;
  cin >> R >> S >> P;
  string T;
  cin >> T;

  int r = Cnt(K, P, 'r', T);
  int s = Cnt(K, R, 's', T);
  int p = Cnt(K, S, 'p', T);

  cout << r + s + p << endl;

  return 0;
}


Measured memory_bytes: 3328
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> table(M);
    for (int i = 0; i < M; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int s;
            cin >> s;
            s--;
            table[i].push_back(s);
        }
    }

    vector<int> P(M);
    for (int i = 0; i < M; i++) cin >> P[i];

    int ret = 0;

    for (int mask = 0; mask < (1 << N); mask++) {
        bool valid = true;

        for (int i = 0; i < M; i++) {
            int on_num = 0;

            for (int j = 0; j < table[i].size(); j++) {
                int sw = table[i][j];
                if ((1 << sw) & mask) on_num++;
            }

            if (on_num % 2 != P[i]) {
                valid = false;
                break;
            }
        }

        if (valid) ret++;
    }

    cout <<ret << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
a, b = int(s[:2]), int(s[2:])

if 1 <= a <= 12 and 1 <= b <= 12:
  print('AMBIGUOUS')
elif 1 <= a <= 12:
  print('MMYY')
elif 1 <= b <= 12:
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3060
//  main.cpp
//  solve
//
//  Created by Ahmed on 11/16/16.
//  Copyright © 2016 Abdellah. All rights reserved.
//


#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>



#define f first
#define s second
#define pb push_back
#define sz(a) (int)a.size()
#define lp(i,a,n) for(int (i)=(a);(i)<=(int)(n);(i)++)
#define lpd(i,n,a) for(ll (i)=(n);(i)>=(a);--(i))
#define mp make_pair
#define clr(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define mod 1000000007
#define eps 1e-6
#define infi 1000000002
#define infll 1000000000000000000ll
#define MX 1000000
#define X real()
#define Y imag()
#define polar(r,t) ((r)* exp(point(0,(t))))
#define length(a) hypot( (a).X , (a).Y )
#define angle(a) atan2( (a).Y , (a).X )
#define vec(a,b) ( (b) - (a) )
#define dot(a,b) (conj(a)*(b)).X
#define cross(a,b) (conj(a)*(b)).Y
#define lengthsqr(a) dot(a,a)
#define reflect(V,M) (conj((V)/(M)) * (M))
#define normalize(a)   ((a)/length(a))
#define ccw(a,b,c)   cross(vec(a,b) , vec(a,c)) > -eps
#define cosRule(a,b,c) (acos(((a)*(a)+(b)*(b)-(c)*(c))/(2*(a)*(b))))
#define cosDot(a,b) (acos(dot(a,b)/length(a)/length(b)))
#define EQ(a,b) (fabs((a) - (b)) <= eps) /* equal to */
#define NE(a,b) (fabs((a) - (b)) > eps)  /* not equal to */
#define LT(a,b) ((a) < (b) - eps)        /* less than */
#define GT(a,b) ((a) > (b) + eps)        /* greater than */
#define LE(a,b) ((a) <= (b) + eps)       /* less than or equal to */
#define GE(a,b) ((a) >= (b) - eps)       /* greater than or equal to */
#define mod1 100050001
#define mod2 100030001
#define base1 37
#define base2 31
#define que priority_queue<pair<int,int>, vector<pair<int,int>> , greater<pair<int,int> > >
#define rotate(v,t) ((v)*exp(point(0,t)))
#define rotateabout(v,t,a) (rotate(vec(a,v),t)+(a))
#define PI atan(1)*4

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef set<int> si;
typedef map<int, int> mii;
typedef complex<long double> point;
typedef pair<point, point> line;
typedef pair<double , point> Circle;

const int N = 100005;
int n,a[N],rep[N];


int main()
{
    scanf("%d",&n);
    lp(i, 1, n) scanf("%d",&a[i]) , ++rep[a[i]] ;
    sort(a+1, a+n+1);
    
    int ans = 0 , two = 0;
    
    lp(i, 0, N-4) ans += rep[i]&1 , two += rep[i] && !(rep[i]&1);
    
    
    if(two&1) --two;
    printf("%d\n",ans + two);
    return 0;
}
/*
 
 */
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
//ios::sync_with_stdio(0);cin.tie(0);



Measured memory_bytes: 1024
n = int(input())

mapper = [
    'pon', # 0
    'pon', # 1
    'hon', # 2
    'bon', # 3
    'hon', # 4
    'hon', # 5
    'pon', # 6
    'hon', # 7
    'pon', # 8
    'hon', # 9
]

print(mapper[n % 10])

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

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

            var res = (int)(ha[0] / ha[1]);

            var mod = ha[0] % ha[1];

            var ans = res + (mod == 0 ? 0 : 1);

            Console.WriteLine(ans);


        }
    }
}


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

int main() {
  long long a;
  string b;
  cin>>a>>b;
  long long one=b[0]-'0';
  long long two=b[2]-'0';
  long long three=b[3]-'0';
  long long ans=three*a+two*a*10+one*a*100;
  ans/=100;
  cout<<ans<<endl;
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int q = Integer.parseInt(sc.next());
        String s = sc.next();
        int[] ans = new int[n];
        for (int i = 1; i < n; i++) {
            ans[i] = ans[i - 1];
            if (s.charAt(i - 1) == 'A' && s.charAt(i) == 'C') {
                ans[i]++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < q; i++) {
            int l = Integer.parseInt(sc.next());
            int r = Integer.parseInt(sc.next());
            sb.append(ans[r - 1] - ans[l - 1]);
            sb.append("\n");
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 52060
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

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

ll a[55], b[55];
signed main(void)
{
  ll n;
  cin >> n;
  REP(i, n) cin >> a[i];

  ll ret = 0;
  while(true) {
    ll tmp = 0;
    REP(i, n) {
      b[i] = 0;
      if(a[i] > 7*n) {
        b[i] = (a[i] - 6*n) / n;
        tmp += (a[i] - 6*n) / n;
        a[i] -= (a[i] - 6*n) / n * n;
      }
    }
    if(tmp == 0) break;
    REP(i, n) a[i] += tmp - b[i];
    ret += tmp;
  }

  while(true) {
    ll tmp = 0;
    REP(i, n) {
      b[i] = 0;
      if(a[i] >= n) {
        b[i] = (a[i]) / n;
        tmp += (a[i]) / n;
        a[i] -= (a[i]) / n * n;
      }
    }
    if(tmp == 0) break;
    REP(i, n) a[i] += tmp - b[i];
    ret += tmp;
  }
  // REP(i, n) cout << a[i] << " "; cout << endl;
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func allAtoi(num []string) []int {
	conv := make([]int, len(num))
	for i, item := range num {
		conv[i], _ = strconv.Atoi(item)
	}
	return conv
}

func main() {
	nm := allAtoi(strings.Split(nextLine(), " "))
	coins := allAtoi(strings.Split(nextLine(), " "))
	ans := solve(nm[0], nm[1], coins)
	fmt.Println(ans)
}

func solve(n, m int, coins []int) int {
	dp := make([]int, n+1, n+1)
	for j := 0; j < m; j++ {
		coin := coins[j]
		for i := 1; i <= n; i++ {
			rest := i - coin
			if rest >= 0 {
				if dp[i] == 0 || dp[rest]+1 < dp[i] {
					dp[i] = dp[rest] + 1
				}
			}
		}
	}
	return dp[n]
}



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

ll x, ans;

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	x = read();
	ans += x / 500 * 1000;
	x %= 500;
	ans += x / 5 * 5;
	x %= 5;
	printf("%lld\n", ans);
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    char s, c;
    int answer = 0; 
    scanf("%c", &s);
    while(scanf("%c", &c) == 1){
        if(c != 'B' && c != 'W') break;
        if(c != s){
            answer++;
            s = c;
        }
    }
    printf("%d\n", answer);
    return 0;
}


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

int main(){
    long long D,T,S;

    cin >> D >> T >> S;

    if(D <= T*S){
        cout << "Yes" << endl;
    }else if(D > T*S){
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <cstdint>
#include <numeric>
#define INF 1000000000
#define LLINF 2000000000000000
#define MOD 1000000007
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define LOOP(i,N) for(int i=0;i<N;i++)
#define LOOP1(i,N) for(int i=1;i<=N;i++)
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
// #define int long long

signed main(){
  int n,k;
  cin >> n >> k;
  int a[n];
  LOOP(i,n){
    cin >> a[i];
  }
  sort(a,a+n);
  int ans = 0;
  LOOP(i,k){
    ans += a[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
N = int(input())
A = list(map(int, input().split()))

if N == 1:
    if A[0] == 1:
        print(1)
        print(1)
        exit()

ans = [0 for _ in range(N // 2 + 1)] + A[N // 2:]

for i in range(N // 2, 1, -1):
    count = 0
    n = i
    j = 2
    while n * j <= N:
        count += ans[n * j]
        j += 1
    ans[i] = (count + A[i - 1]) % 2

sans = sum(ans)

ans[1] = (sans + A[0]) % 2

sans += ans[1]

print(sans)
p = ''
for i in range(1, N + 1):
    if ans[i] == 1:
        p += str(i) + ' '

print(p)


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    LL K;
    cin >> N >> K;
    vector<LL> a(N), f(N);
    for(int i = 0; i < N; ++i) cin >> a[i]; sort(all(a));
    for(int j = 0; j < N; ++j) cin >> f[j]; sort(all(f), greater<LL>());

    LL mx = 0;
    for(int i = 0; i < N; ++i) {
        mx = max(mx, a[i] * f[i]);

    }

    LL l = -1, r = mx;
    while(r - l > 1) {
        LL m = (l + r) / 2;
        LL tk = K;
        for(int i = 0; i < N; ++i) {
            tk -= max(0ll, a[i] - m / f[i]);

        }

        if(tk >= 0) r = m;
        else l = m;
    }
    cout << r << endl;
    return 0;
}



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

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

    int ans = n / 2 + n % 2;

    cout << ans << endl;
}


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

int main() {

  int H, W;
  string S, ss, n;
  n = "012345678";
  cin >> H >> W;
  
  for (int i = 0; i < W + 2; i++) {
    ss += ".";
  }
  
  for (int i = 0; i < H; i++) {
    cin >> S;
    ss += ".";
    ss += S;
    ss += ".";
  }
  
  for (int i = 0; i < W + 2; i++) {
    ss += ".";
  }
  
  for (int i = W + 3; i < (W + 2) * (H + 1) - 1; i++) {
    int cnt;
    if (ss.at(i) == '.') {
      cnt = (ss.at(i - W - 3) == '#')
        + (ss.at(i - W - 2) == '#')
        + (ss.at(i - W - 1) == '#')
        + (ss.at(i - 1) == '#')
        + (ss.at(i + 1) == '#')
        + (ss.at(i + W + 1) == '#')
        + (ss.at(i + W + 2) == '#')
        + (ss.at(i + W + 3) == '#');
      ss.at(i) = n.at(cnt);
    }
  }
        
  for (int i = W + 3; i < (W + 2) * (H + 1) ; i += W + 2) {
    for (int j = 0; j < W; j++) {
      cout << ss.at(i + j);
    }
    cout << endl;
  }

}


Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int H = sc.nextInt();
		int A = sc.nextInt();

		sc.close();

		out.println((H + A - 1) / A);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


Measured memory_bytes: 24404
#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 long long ll;

const int mod=1e9+7;
const int inf=-1;
const int sz=2e5;

#define pi acos(-1)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define gap ' '
#define lb lower_bound
#define ub upper_bound
#define clr(x) memset(x,0,sizeof(x))
#define all(x) sort(x.begin(),x.end())
#define rall(x) reverse(x.begin(),x.end())
#define dbg puts("finding wrong")
#define case(x,y) printf("Case %lld: %lld\n",++x,y)
#define fastio ios::sync_with_stdio(false);cin.tie(0)



int ar[sz];

int main()
{
  fastio;
  ll n, i, cnt=0, mx=0;
  string s;
  cin>>n>>s;
  
  for(i=0; i<n; i++)
  {
      if(s[i]=='I')cnt++;
      else cnt--;
      mx=max(mx,cnt);
  }
  cout<<mx<<endl;
  
}


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

using namespace std;

char to_num(char c)
{
    if (c <= 'c') return '2';
    if (c <= 'f') return '3';
    if (c <= 'i') return '4';
    if (c <= 'l') return '5';
    if (c <= 'o') return '6';
    if (c <= 's') return '7';
    if (c <= 'v') return '8';
    return '9';
}

vector<string> w, v;

void dfs(string &seq, int idx, vector<string> words)
{
    int size = seq.size();
    if (idx == size) {
        for (int i = 0; i < (int)words.size(); i++) {
            if (i > 0) cout << " ";
            cout << words[i];
        }
        cout << "." << endl;
        return;
    }

    for (int i = 0; i < (int)v.size(); i++) {
        int len = v[i].size();
        if (idx + len <= size) {
            bool ok = 1;
            for (int j = 0; j < len; j++) {
                if (seq[idx + j] != v[i][j]) {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                words.push_back(w[i]);
                dfs(seq, idx + len, words);
                words.pop_back();
            }
        }
    }
}

void init()
{
    w.clear();
    v.clear();
}

int main()
{
    int N;
    while (cin >> N, N) {
        init();
        string s, seq;
        for (int i = 0; i < N; i++) {
            cin >> s;
            string t;
            for (int j = 0; j < (int)s.size(); j++) {
                t += to_num(s[j]);
            }
            w.push_back(s);
            v.push_back(t);
        }
        cin >> seq;
        dfs(seq, 0, vector<string>());
        cout << "--" << endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  vector<int> ans(100000);
  for(int x = 1; x * x < n; x++){
    for(int y = 1; y * y < n; y++){
      for(int z = 1; z * z < n; z++){
        int k = x * x + y * y + z * z + x * y + y * z + z * x;
        ans.at(k)++;
      }
    }
  }
  
  for(int i = 0; i < n; i++) cout << ans.at(i+1) << endl;
}

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

typedef long long ll;
typedef long double ld;

#define test(t) int t;cin>>t;while(t--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
const int MOD = 1e9+7,MAX = 1e5+5;
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            	is_prime[j] = false;
    	}
	}
}
ll modInv(ll a)
{
	return powN(a,MOD-2);
}


int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int i;
	int cnt=0;
	forn(i,s.length())
	{
		if(i==0) cnt++;
		else
		{
			if(s[i]==s[i-1]) continue;
			else cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 512
s1 = raw_input()
s2 = raw_input()

lst = [[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)]

for i in range(1, len(s1)+1):
  lst[i][0] = i
for i in range(1, len(s2)+1):
  lst[0][i] = i

for i in range(1, len(s1)+1):
  for j in range(1, len(s2)+1):
    if s1[i-1] == s2[j-1]:
      lst[i][j] = lst[i-1][j-1]
    else:
      lst[i][j] = min(lst[i-1][j], lst[i][j-1], lst[i-1][j-1]) + 1

print lst[len(s1)][len(s2)]

Measured memory_bytes: 36676
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>


using namespace std;

#define Max INT_MAX
#define Inf (INT_MAX/2)


#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
// s <= x < g ?
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
// 0 <= x < w && 0 <= y < h ?
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))

typedef pair<int, int> P;


#define MaxN 1000

#define MaxE 1000
//struct edge es[MaxE];




//その時点で考えてる頂点集合の中での
//i->jの最短路
int dp[10][10];

int main()
{
    int E;
    while ( cin >> E ){
        if( E == 0 ) { break; }
        int a,b,c;
        rep(i,10){
            rep(j,10){
                if( i==j ){
                    dp[i][j] = 0;
                } else {
                    dp[i][j] = Inf;
                }
            }
        }

        rep(i,E){
            cin >> a >> b >> c;
            dp[a][b] = c;
            dp[b][a] = c;
        }
        rep(k,10){
            rep(i,10){
                rep(j,10){
                    dp[i][j] = min( dp[i][j], dp[i][k] + dp[k][j] );
                }
            }
        }

        int min = Inf;
        int minI;
        rep(i,10){
            int sum = 0;

            rep(j,10){
                if( dp[i][j] >= Inf ) { continue; }
                else if( i == j){ continue; } 
                else{
                    sum += dp[i][j];
                }
            }

            //cout << "sum " << sum << endl;
            //
            if ( sum < min && sum){
                //cout << "i: " << i << endl;
                //cout << "min: " << min << endl;
                min = sum;
                minI = i;
            }
        }

        cout << minI << " " << min << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
//Bi-smi llāh

#include<bits/stdc++.h>
using namespace std;
#define nn '\n'
#define watch(x) cout << (#x) <<" is "<<(x)<<endl;
#define pb push_back
#define F(i, n) for(int i = 0; i < n; ++i)
#define Fe(i, n) for(auto i: n)
#define  ll long long int



int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	while(n){
			if(n % 10 == 7){
					cout << "Yes" << nn;
					return 0;
				}
			n /= 10;
		}
	cout << "No" << nn;
	return 0;
	}


Measured memory_bytes: 3616
#include<iostream>

using namespace std;

int main() {

	int n, x;
	int a, b, c;
	int count = 0;

	while (1) {
		cin >> n >> x;

		if (n == 0 && x == 0) break;

		for (int i = 1; i <= n; i++) {
			a = i;
			for (int j = 1; j <= n; j++) {
				if (a == j) continue;
				 b = j;

				c = x - (a + b);

				if (c >= 1 && c <= n && c != a && c != b) count++;
			}
		}

		count /= 6;

		cout << count << endl;
		count = 0;
	}

	return 0;
}

Measured memory_bytes: 3100
def partition(A,p,r):
    x = A[r]
    i = p 
    j = p+1
    while i < r:
        if A[i] <= x:
            i += 1
            if i == j:
                j += 1
        else:
            while j <= r:
                if A[j] <= x:
                    if j == r:
                        temp = A[j]
                        A[j] = A[i]
                        A[i] = "[{}]".format(temp)
                        i += 1
                        break 
                    temp = A[j]
                    A[j] = A[i]
                    A[i] = temp
                    i += 1
                    break
                else:
                    j += 1
            else:
                i+=1
                break
    return A
    
    
n = int(input())
A = list(map(int,input().split()))
print(*partition(A,0,n-1))

Measured memory_bytes: 18400
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl
typedef pair<int,int> Pp;


signed main(){
    int N,D,X;
    int A[102];
    cin >> N >> D >> X;
    REP(i,N){cin >> A[i];}
    REP(i,N){
        REP(j,D){
            if((j%A[i])==0){
                X++;
            }
        }
    }
    cout << X << endl;
    return 0;
}   


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C_fix
# CreatedDate:  2020-09-03 20:30:23 +0900
# LastModified: 2020-09-03 21:14:03 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def gcd(a, b):
    while a % b != 0:
        r = a % b
        a = b
        b = r
    return b


def main():
    a, b, c, d = map(int, input().split())
    if (a/c).is_integer():
        c_cnt = b//c - a//c + 1
#        print(b//c, a//c)
    else:
        c_cnt = b//c - a//c
#        print(b//c, a//c)
    if (a/d).is_integer():
        d_cnt = b//d - a//d + 1
#        print(b//d, a//d)
    else:
        d_cnt = b//d - a//d
#        print(b//d, a//d)

    lcm = c * d // gcd(max(c, d), min(c, d))
    if (a/lcm).is_integer():
        lcm_cnt = b//lcm - a//lcm + 1
    else:
        lcm_cnt = b//lcm - a//lcm
#    print(c_cnt, d_cnt, lcm_cnt)
    print(b-a+1-c_cnt-d_cnt+lcm_cnt)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9044
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define xx first
#define yy second
#define sci(n) scanf("%d",&n)
#define scii(n,m) scanf("%d%d",&n,&m)
#define sciii(n,m,w) scanf("%d%d%d",&n,&m,&w)
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld%lld",&n,&m)
#define sclll(n,m,w) scanf("%lld%lld%lld",&n,&m,&w)
#define pf(a)   printf("%d\n",a)
#define CASE(a) printf("Case %d:\n",a)
#define dbg(i) printf("yo %lld\n", i)
#define endl '\n'
#define READ  freopen("input.txt","r",stdin)
#define WRITE freopen("output.txt","w",stdout);
#define pi acos(-1)
#define mem(a,b) memset(a,b,sizeof(a))
#define SQR(a) (a)*(a)
#define all(v) v.begin(),v.end()
#define pb push_back
#define pri priority_queue<int>
#define rev_pri priority_queue<int,vector<int>,greater<int> >
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define inf INT_MAX
#define eps 1e-9

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

using namespace __gnu_pbds;
using namespace std;

#define mxn 100005


//bool vis[1LL << 19];
const ll nax=100005;
ll ar[3002][3002];
void solve()
{
    ll a,b,n,w,k=0,c,i,q=0,j,l,m,mx=-1;
    string s,t,ox="";
    cin>>s>>t;
    FORd(i,0,s.size()) FORd(j,0,t.size()){
        if(s[i]==t[j]) ar[i][j]=1+ar[i+1][j+1];
        else ar[i][j]=max(ar[i][j+1],ar[i+1][j]);
    }
    for(i=0,j=0;i<s.size()&&j<t.size();){
        if(s[i]==t[j]){ox+=s[i];i++;j++;continue;}
        if(ar[i+1][j]>ar[i][j+1]){i++;}
        else j++;
    }
    cout<<ox<<endl;
}
int main()
{
    //IOS;
    double start_time = clock();
    ll t=1,mex=1;
   //cin>>t;
    while(t--){
        solve();
    }
    double end_time = clock();
    //fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
    return 0;
}


Measured memory_bytes: 70656
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
const int MAX = 200005;
int parent[MAX];

void parinit(void){
    rep(i,MAX){parent[i]=i;}
}

int root(int a){
    if(parent[a]==a){return a;}
    return parent[a] = root(parent[a]);
}

void unite(int a, int b){
   parent[root(a)] = root(b); 
}

int main(void) {
    int n,m;
    cin>>n>>m;
    parinit();
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        unite(x,y);
    }
    set<int> roots;
    for(int i=1;i<=n;i++){
        roots.insert(root(i));
    }
    cout << roots.size() << endl;
    return 0;
}


Measured memory_bytes: 5760
#include<stdio.h>
 
#define MAX 100005
#define NIL -1
 
typedef struct node{int p,l,r;}Node;
Node T[MAX];
int D[MAX];
 
void print(int u )
{
    int i,c;
    printf("node %d: parent = %d, depth = %d, ",u,T[u].p,D[u]);
    if(T[u].p==NIL)printf("root, ");
    else if(T[u].l==NIL)printf("leaf, ");
    else printf("internal node, ");
    printf("[");
    for(i=0,c=T[u].l;c!=NIL;c=T[c].r,i++)
    {
        if(i)printf(", ");
        printf("%d",c);
    }
    printf("]\n");
}
 
void rec(int u,int p)
{
    D[u]=p;
    if(T[u].l != NIL)rec(T[u].l,p+1);
    if(T[u].r != NIL)rec(T[u].r,p);
}
 
int main()
{
    int n,l,root;
    scanf("%d",&n);
    for(int i=0;i<n;i++)T[i].p=T[i].l=T[i].r=NIL;
 
    for(int i=0;i<n;i++)
    {
        int v,d;
        scanf("%d%d",&v,&d);
        for(int j=0;j<d;j++)
        {
            int c;
            scanf("%d",&c);
            if(j==0)T[v].l=c;
            else T[l].r=c;
            l=c;
            T[c].p=v;
        }
    }
    for(int i=0;i<n;i++)
    {
        if(T[i].p==NIL)root=i;
    }
    rec(root,0);
    for(int i=0;i<n;i++)print(i);
return 0;
}


Measured memory_bytes: 3264
//
// Created on 2020/05/31.
//


#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
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    int n;
    cin>>n;
    vector<pair<ll,ll>>v(n);
    vector<pair<ll,ll>>rv(n);
    ll ans;
    for (int i = 0; i < n; ++i) {
        int a,b;
        cin>>a>>b;
        v[i] = {a,b};
        rv[i] = {b,a};
    }
    sort(all(v));
    sort(all(rv));
    if(n % 2 == 0){
        ll r_1 =rv[n/2].first;
        ll r_2 = rv[n/2-1].first;
        ll l_1 = v[n/2 -1].first;
        ll l_2 = v[n/2].first;
        ans = (r_1 + r_2)  - (l_2 + l_1 - 1);
    }else{
        ll r = rv[n/2].first;
        ans = r - (v[n/2].first - 1);
    }
    cout<<ans<<endl;
    return 0;
}


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

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

    int N, M;
    vector<string> s, t;

    cin >> N;
    s.resize(N, "");
    for(int i = 0; i < N; i++){
        cin >> s[i];
    }
    sort(s.begin(), s.end());

    cin >> M;
    t.resize(M, "");
    for(int i = 0; i < M; i++){
        cin >> t[i];
    }
    sort(t.begin(), t.end());

    vector<int> score;
    int i = 0;
    int j = 0;
    while(j < N){
        score.push_back(0);
        score[i] += count(s.begin(), s.end(), s[j]);
        int num = score[i];
        score[i] -= count(t.begin(), t.end(), s[j]);
        if(score[i] < 0){
            score[i] = 0;
        }
        j += num;
        i++;
    }
    sort(score.begin(), score.end());

    cout << score[score.size() - 1] << "\n";

    return 0;
}


Measured memory_bytes: 256
N=int(input())                                          # 1行1列
List=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(List[N-1])




Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
char s[1000];
int main()
{
	int i,j,k;
	scanf("%s",s);
	bool ok=s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I';
	printf("%s",ok?"Yes":"No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
#include <bitset>
#include <cmath>
#include <set>

#define INF 1000000000000
#define MOD 1000000007 //10^9+7:合同式の法

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    bool fla = true;

    for(int i = 0;i < N;i++)
        cin >> A.at(i);

    for(int i = 0;i < N;i++){
        if(A.at(i) % 2 == 0){
            if(A.at(i) % 3 != 0 and A.at(i) % 5 != 0)
                fla = false;
        }
    }

    if(fla)
        cout << "APPROVED" << endl;
    else
    {
        cout << "DENIED" << endl;
    }
    
}

Measured memory_bytes: 3640
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

int n, a, b; 

void solve() {
	cin >> n >> a >> b;
	if(a + b - 1 > n || n > a * b) {
		cout << -1 << endl;
		return;
	}
	if(b == 1) {
		rep(i, n) {
			cout << i + 1 << " ";
		}
		return;
	}
	for(int i = n - a + 1; i <= n; ++ i) {
		cout << i << " ";
	}
	int x = (n - a) / (b - 1);
	int y = n - a - x * (b - 1);
	int cur = n - a + 1;
	rep(i, y) {
		cur -= (x + 1);
		rep(j, x + 1) {
			cout << cur + j << " ";
		}
	}
	rep(i, b - 1 - y) {
		cur -= x;
		rep(j, x) {
			cout << cur + j << " ";
		}
	}
	cout << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 3688
n=int(input())
w=[]
sum=0
c=1
for i in range(n):
    w.append(list(map(int,input().split())))
w.sort(key=lambda x: x[1])
for i in range(n):
    sum+=w[i][0]
    if sum>w[i][1]:
        c=0
        break
print("Yes" if c==1 else "No")

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

const int INF = 1 << 30;
int n;
vector<int> r, c;
vector<vector<int>> dp;

int dfs(int a, int b) {
    if (dp[a][b] != INF) return dp[a][b];
    if (a + 1 == b) return dp[a][b] = 0;
    int res = INF;
    for (int k = a + 1; k < b; ++k) {
        res = min(res, dfs(a, k) + dfs(k, b) + r[a] * r[k] * c[b - 1]);
    }
    return dp[a][b] = res;
}

int main() {
    cin >> n;
    r.resize(n);
    c.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> r[i] >> c[i];
    }
    dp.resize(n + 1, vector<int>(n + 1, INF));
    cout << dfs(0, n) << endl;
}


Measured memory_bytes: 3164
using System;

public class Program{
    public static void Main(){
        string input1=Console.ReadLine();
        int N=int.Parse(input1);
        string[] input2=Console.ReadLine().Split(' ');
        int[] NumArr=new int[N];
        for(int i=0;i<N;i++) {
            NumArr[i]=int.Parse(input2[i]);
        }
        int[] NewNum=SortAlgo(N, NumArr);
        int Bob=0;
        int Alice=0;
        
        for(int i=0;i<N;i++) {
            if(i%2==0) {
                Alice+=NewNum[i];
            } else if(i%2==1) {
                Bob+=NewNum[i];
            }
        }
        
        Console.WriteLine(Alice-Bob);
        

    }
    
    public static int[] SortAlgo(int N, int[] NumArr) {
        for(int j=N-1;j>0;j--) {
                for(int i=0;i<j;i++) {
                    if(NumArr[i]<NumArr[i+1]) {
                        int bin=NumArr[i+1];
                        NumArr[i+1]=NumArr[i];
                        NumArr[i]=bin;
                    }
                }
            }
        return NumArr;
    }
    
}


Measured memory_bytes: 11092
#include <iostream>

using namespace std;

int main()
{
    int l,r,d;
    cin>>l>>r>>d;
    int count=0;
    for(int i=1;;i++)
    {
        if(i*d>r)
            break;
        if(i*d>=l && i*d<=r)
        {
            count++;
        }

    }
    cout<<count<<endl;
}


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

int gcd(int a, int b){
    int r = a % b;
    while(r > 0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int main(){
    int a,b;
    cin >> a >> b;
    ll ans = ((ll)a * b) / gcd(a,b);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <iomanip>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

/*
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
*/

// 解説AC
// https://img.atcoder.jp/abc057/editorial.pdf

// nCrよりパスカルの三角形のほうが良い?

// Combination Table
ll C[51][51]; // C[n][k] -> nCk

void comb_table(int N){
  for(int i=0;i<=N;++i){
    for(int j=0;j<=i;++j){
      if(j==0 or j==i){
	C[i][j]=1LL;
      }else{
	C[i][j]=(C[i-1][j-1]+C[i-1][j]);
      }
    }
  }
}

ll v[52];

int
main(void){  
  ios_base::sync_with_stdio(false);

  int n, a, b;
  cin >> n >> a >> b;
  REP(i,n) cin >> v[i];
  sort(v, v+n, greater<ll>());
  ll max_v = v[0];
  
  double ave = 0LL;
  REP(i,a) ave += v[i];
  cout << fixed;
  cout << setprecision(20);
  cout << (double)ave/a << endl;

  comb_table(n);

  ll num = 0, pos = 0;
  REP(i,n){
    if(v[i] == v[a-1]){
      num++;
      if(i < a) pos++;
    }
  }

  ll ans = 0LL;
  if(pos == a) for(;pos<b+1;pos++) ans += C[num][pos];  
  else ans += C[num][pos];
  cout << ans << endl;
  return 0;
}


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

int main () {
    int n, k;
    int r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;
    vector<char> tchar(n); //保存用かぶりを別で記録
    int ans = 0;
    for (int i = 0; i < t.size(); i++) {
        if(i < k) {
            if (t.at(i) == 'r') {
                tchar.at(i) = t.at(i);
                ans+=p;
            }                    
            if (t.at(i) == 's') {
                tchar.at(i) = t.at(i);
                ans+=r;
            }                
            if (t.at(i) == 'p') {
                tchar.at(i) = t.at(i);
                ans+=s;
            }                    
        }
        else {
            // cout << tchar.at(i-k) << t.at(i) <<  endl;
            if (t.at(i) == 'r') {
                if (t.at(i) == tchar.at(i-k)) { //tcharと比較してなかった
                    tchar.at(i) = 'n';
                }
                else {
                    tchar.at(i) = t.at(i);
                    ans+=p;
                }
            }                    
            if (t.at(i) == 's') {
                if (t.at(i) == tchar.at(i-k)) {
                    tchar.at(i) = 'n';
                }
                else {
                    tchar.at(i) = t.at(i);
                    ans+=r;
                }
            }                
            if (t.at(i) == 'p') {
                if (t.at(i) == tchar.at(i-k)) {
                    tchar.at(i) = 'n';
                }
                else {
                    tchar.at(i) = t.at(i);
                    ans+=s;
                }
            }                    
        }
            //   cout << ans  << " " << t.at(i) << i  << endl;
    }
    cout << ans << endl;
}

Measured memory_bytes: 512