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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N,W;
    Scd2(N,W);
    int w,v;
    ll dp[100002] = {};
    fill( dp+1, dp+100001, W+1 );

    Rep(i,N){
        Scd2(w,v);
        for (int vi = 100000-v; vi >= 0; vi-- ){
            if( dp[vi] + w <= W ){
                dp[vi+v] = min( dp[vi+v] , dp[vi] + w );
            }
        }
    }

    int V = 100001;
    while( dp[--V] > W ){}
    printf ("%d\n", V );

    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
#include <vector>

using namespace std;

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

int H, W;
string fi[110];
int dist[110][110];

int main()
{
  
  cin >> H >> W;
  int wnum = 0;
  for(int i = 0; i < H; i++){
    cin >> fi[i];
    for(int j = 0; j < W; j++){
      if (fi[i][j] == '.' ) wnum++;
    }
  }

  memset(dist, -1, sizeof(dist));
  dist[0][0] = 1;
  queue<pair<int, int> > que;
  que.push(make_pair(0,0));
  while (!que.empty()){
    pair<int, int> cur = que.front();
    que.pop();
    int x = cur.first;
    int y = cur.second;
    for(int dir = 0; dir < 4; dir++){
      int nx = x + dx[dir];
      int ny = y + dy[dir];
      if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
      if(fi[nx][ny] == '#') continue;
      if(dist[nx][ny] == -1) {
        dist[nx][ny] = dist[x][y] + 1;
        que.push(make_pair(nx, ny));
      } 
    }
  }
  if(dist[H-1][W-1] == -1) cout << -1 <<endl;
  else cout << wnum - dist[H-1][W-1] <<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int K,N,a[200001],maxi=0;

int main(){
    cin >> K >> N;
    for (int i=0;i<N;i++) cin >> a[i];
    
    a[N] = K + a[0];
    int prev_v = a[0],tmp_maxi;
    for(int i=0;i<N+1;i++){
        tmp_maxi = a[i] - prev_v;
        prev_v = a[i];

        if(tmp_maxi >= maxi) {
            maxi = tmp_maxi;
        }
    }
    cout << K - maxi << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG

int main() {
  int n;
  cin >> n;
  vector<pair<int,int>> a(n);
  vector<pair<int,int>> b(n);
  rep(i,n)
    cin >> a[i].second >> a[i].first;
  sort(a.rbegin(),a.rend());
  rep(i,n)
    cin >> b[i].first >> b[i].second;
  sort(b.begin(),b.end());
  
  int c=0;
  rep(i,n){
    rep(j,n){
      if((b[i].first>a[j].second)&&(b[i].second>a[j].first)){
        a[j]=make_pair(300,300);
        c++;
        break;
      }
    }
  }
  
  cout << c << endl;
}
      
    


Measured memory_bytes: 256
#include <iostream>

int main()
{
    std::string s;
    std::cin >> s;

    long long mod[2019] = {0};
    int T = 0;
    int ten = 1;
    mod[0] = 1;

    long long ans = 0;

    for (auto itr = s.rbegin(); itr < s.rend(); ++itr) {
        T = ((*itr - '0') * ten + T) % 2019;
        ten = (ten * 10) % 2019;
        ans += mod[T];
        mod[T]++;
    }
    std::cout << ans << std::endl;

    return 0;
}

Measured memory_bytes: 3740
n,m=map(int, input().split())
x=list(map(int, input().split()))
x=sorted(x)
y=[abs(i-j) for(i,j) in zip(x[1:],x[:-1])]
y=sorted(y)
z=sum(y[:m-n])
print(z if n<m else 0)


Measured memory_bytes: 13968
#include <stdio.h>

using namespace std;

int main(){
	int n,q,tmp,left,right,count = 0;
	scanf("%d",&n);
	int S[n];
	for(int i = 0; i < n; i++){
		scanf("%d",&S[i]);
	}
	scanf("%d",&q);
	for(int i = 0; i < q; i++){
		scanf("%d",&tmp);
		left = 0;
		right = n-1;
		if(tmp == S[right]){
			count++;
		}else if(tmp == S[left]){
			count++;
		}else{
			if(tmp < S[right] && tmp > S[left]){
				while(left+1 < right){
					if(S[(left+right)/2] == tmp){
						count++;
						break;
					}else if(S[(left+right)/2] > tmp){
						right = (left+right)/2;
					}else{
						left = (left+right)/2;
					}
				}
			}
		}
	}
	printf("%d\n",count);
}

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

using namespace std;
typedef long long ll;

int main(){
    ll h, w;
    cin >> h >> w;
    vector<string> map(h);
    for(int i = 0; i < h; ++i){
        cin >> map.at(i);
    }
    for(int i = 0; i < h; ++i){
        for(int j = 0; j < w; ++j){
            if(map.at(i).at(j) == '.'){ continue; }
            if(i > 0 && map.at(i - 1).at(j) == '#'){ continue; }
            if(j > 0 && map.at(i).at(j - 1) == '#'){ continue; }
            if(i < h - 1 && map.at(i + 1).at(j) == '#'){ continue; }
            if(j < w - 1 && map.at(i).at(j + 1) == '#'){ continue; }
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define CFS cin.tie(nullptr);ios::sync_with_stdio(false);
#define CST(x) cout<<fixed<<setprecision(x);
using namespace std;
constexpr int IINF = numeric_limits<int>::max();
constexpr long LINF = numeric_limits<long>::max();
constexpr int MOD = (int) 1e9 + 7;
// constexpr int MOD = 998244353;

int main(){
    string s;
    cin >> s;
    for (const auto& c : s) {
        if (c == '7') {
            cout << "Yes" << "\n";
            return 0;
        }
    }
    cout << "No" << "\n";
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(void){
  char s[3];
  int count = 0;
  scanf("%s", &s);
  if(s[0] == '1'){
    count += 1;
  }
  if(s[1] == '1'){
    count += 1;
  }
  if(s[2] == '1'){
    count += 1;
  }
  printf("%d", count);
  return 0;
}

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

typedef long double ld;
typedef long long ll;

const ld PI = 4 * atan(1);

ll N, L;
vector<ll> T;
ld x = 0, y = 0;
void add_weights(ll a, ll w){
    if(w == 0) return;
    ld arg = 2 * PI * a / L;
    x += (cos(arg) * w), y += (sin(arg) * w);
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> L; L *= 2;
    T.resize(N);
    for(int i = 0; i < N; i++) cin >> T[i], T[i] *= 2;
    sort(T.begin(), T.end());
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            ll a1 = T[i], a2 = T[j];
            ll m1 = (a1 + a2) / 2, m2 = (m1 + L / 2) % L;
            ll n1 = N - (j - i - 1 + 2), n2 = j - i - 1;
            ll sub = min(n1, n2);
            n1 -= sub, n2 -= sub;
            add_weights(m1, n1);
            add_weights(m2, n2);

        }
    }
    ll tot = N * (N - 1) * (N - 2) / 6;
    x /= tot; y /= tot;
    cout << fixed << setprecision(100);
    cout << x << " " << y << '\n';
    return 0;
}


Measured memory_bytes: 4136
N,Y = map(int,input().split())
a = Y//1000
z = None
for x in range(N+1):
    tmp = a-N-9*x
    if 0 <= tmp <= 4*N and tmp % 4 == 0:
        y = tmp // 4
        if N-x-y >= 0:
            z = N-x-y
            break
print("{} {} {}".format(x,y,z) if z != None else "-1 -1 -1")

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

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

    long x=1;
    for(; x*(x+1)<2*n; ++x);
    if (x*(x+1)!=2*n) {
        cout<<"No"<<endl;
        return 0;
    }

    auto y=x+1;
    vector<vector<int>> a(y, vector<int>(x));
    for(int r1=0, c1=0, r2=1, c2=0, i=1; i<=n; ++i) {
        a[r1][c1]=a[r2][c2]=i;
        c1++;
        if (c1==x) { r1++; c1=r1; }
        r2++;
        if (r2==y) { r2=r1+1; c2=c1; }
    }
    cout<<"Yes"<<endl;
    cout<<y<<endl;
    for(auto& v: a) {
        cout<<v.size();
        for(auto& e: v) cout<<' '<<e;
        cout<<endl;
    }
}


Measured memory_bytes: 2176
#include <stdio.h>
#define NDEBUG
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

// for DEBUG {{{
#ifdef NDEBUG
#define DEBUG_PRINT(fmt, ...) ((void)0)
#else
#define DEBUG_PRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#endif
#define ASSERT_RANGE(min,x,max) assert(((x)>=(min)) && ((x)<=(max)))
// }}}

int sort_int(int *a, int N) {// {{{
	int i;
	for (i = 0; i < N-1; i++) {
		int j;
		for (j = i + 1; j < N; j++) {
			if (a[i] > a[j]) {
				int tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
	return 0;
}// }}}
void merge_int(int *a, int *b, int lower, int sep, int upper) {// {{{
	int i_lower = lower;
	int i_upper = sep;
	int i_b = 0;
	while ((i_lower < sep) && (i_upper < upper)) {
		if (a[i_lower] < a[i_upper]) {
			b[i_b++] = a[i_lower++];
		} else {
			b[i_b++] = a[i_upper++];
		}
	}
	if (i_lower >= sep) {
		while (i_upper < upper) {
			b[i_b++] = a[i_upper++];
		}
	} else {
		while (i_lower < sep) {
			b[i_b++] = a[i_lower++];
		}
	}
	for (i_lower = 0; i_lower < i_b; i_lower++) {
		a[i_lower+lower] = b[i_lower];
	}
}// }}}
void merge_sort_int(int *a, int *b, int lower, int upper) {// {{{
	int sep;
	if ((lower == upper) || (lower + 1 == upper)) {
		return;
	}
	sep = (lower + upper) / 2;
	merge_sort_int(a,b,lower,sep);
	merge_sort_int(a,b,sep,upper);
	merge_int(a,b,lower,sep,upper);
}// }}}

#define S_MAX 30000
int main(int argc, char **argv) {
	long long t1, t2;
	long long a1, a2;
	long long b1, b2;
	fscanf(stdin,"%lld%lld",&t1,&t2) > 0;
	fscanf(stdin,"%lld%lld",&a1,&a2) > 0;
	fscanf(stdin,"%lld%lld",&b1,&b2) > 0;

	long long diff1 = (a1-b1)*t1;
	long long diff2 = (a2-b2)*t2;
	long long diff3 = diff1 + diff2;

	DEBUG_PRINT("%lld %lld %lld\n",diff1, diff2, diff3);
	if ((diff1 > 0) && (diff2 > 0)) {
		fprintf(stdout,"0\n");
		return 0;
	}
	if ((diff1 < 0) && (diff2 < 0)) {
		fprintf(stdout,"0\n");
		return 0;
	}
	if ((diff1 > 0) && (diff2 < 0)) {
		if (diff3 > 0) {
			fprintf(stdout,"0\n");
			return 0;
		}
		if (diff3 == 0) {
			fprintf(stdout,"infinity\n");
			return 0;
		}
		assert(diff3 < 0);
		long long  n = diff1 / llabs(diff3);
		if ((llabs(diff3) * n) == llabs(diff1)) {
			fprintf(stdout,"%lld\n",2*n);
		} else {
			fprintf(stdout,"%lld\n",1+2*n);
		}
		return 0;
	}
	if ((diff1 < 0) && (diff2 > 0)) {
		if (diff3 < 0) {
			fprintf(stdout,"0\n");
			return 0;
		}
		if (diff3 == 0) {
			fprintf(stdout,"infinity\n");
			return 0;
		}
		assert(diff3 > 0);
		long long n = llabs(diff1) / diff3;
		if ((llabs(diff3) * n) == llabs(diff1)) {
			fprintf(stdout,"%lld\n",2*n);
		} else {
			fprintf(stdout,"%lld\n",1+2*n);
		}
		//
		return 0;
	}
	return 0;
}



Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#include <iostream>
#include <sstream>
#include <fstream>
#include <iterator>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <utility>
#include <bitset>
#include <cstdio>

using namespace std;
using namespace std::placeholders;

// namespace { struct NoSync { NoSync() { cin.tie(0); ios::sync_with_stdio(false); } } nosync; }

using ll = long long;
#define float double

constexpr ll INF = 999999999LL;
constexpr ll MOD = 1e9 + 7;

#define y0 Y0
#define y1 Y1
#define j0 J0
#define j1 J1
#define prev PREV
#define next NEXT

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i##_len = (n), i = (i##_len) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define permutations(v) sort(all(v));for(bool v##p = true; v##p; v##p=next_permutation(all(v)))
#define UNIQUE(v) (v).erase(unique(all(v)), (v).end())
#define REMOVE(v) (v).erase(remove(all(v)), (v).end())
#define ROTATE(v, n) rotate((v).begin(), (v).begin() + (n), (v).end())
#define TO_SUMS(v) partial_sum(all(v), (v).begin())
#define SUMS(srcv, dstv) partial_sum(all(srcv), (dstv).begin())
#define nth_bit(n) (1LL<<(n))

template <typename T> T high()  { return numeric_limits<T>::max(); }
template <typename T> T high(T) { return numeric_limits<T>::max(); }
template <typename T> T low()   { return numeric_limits<T>::lowest(); }
template <typename T> T low(T)  { return numeric_limits<T>::lowest(); }

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

// f には functional のオブジェクトが便利 (lambda 式も   [](int a){ return a / 2 }   みたいな)
template<class C, class F> inline C mapped(const C& c, F f){// mapっていうSTLがあるから...
    // ex: mapped(v, bind(plus<ll>(), _1, 2))   [v の各要素について x + 2]
    C r; r.reserve(c.size()); transform(all(c), back_inserter(r), f); return r;
}
template<class C, class F> inline C filtered(const C& c, F f){
    // ex: filtered(v, bind(equal_to<ll>(), bind(modulus<ll>(), _1, 2), 0)   [x mod 2 == 0 な x を取ってくる]
    C r; copy_if(all(c), back_inserter(r), f); return r;
}
template<class C, class I, class F> inline typename C::value_type foldl(const C& c, I i, F f){
    // ex: foldl(v, 1, multiplies<int>())   [v の総乗]
    return accumulate(all(c), static_cast<typename C::value_type>(i), f);
}

// 出力
template<class T> ostream& operator << (ostream &s, vector<T> v){
    rep(i, v.size()) { if (i != 0) { s << " "; } s << v[i]; } return s;
}


int main(){
    vector<ll> v(10010);
    ll i = 0;
    while(cin >> v[i], v[i++] != 0);

    rep(j, i - 1){
        cout << "Case " << j + 1 << ": " << v[j] << endl;
    }

    return 0;
}



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  int n;
  cin >> n;
  int x[n],y[n],h[n];
  int hmax=0;
  rep(i,n){
    cin >> x[i] >> y[i] >> h[i];
    hmax=max(h[i],hmax);
  }
  int ansh,ansx,ansy;
  rep(xi,101){
    rep(yi,101){
      int flag=0;
      int ok=1;
      int hh,ht;
      rep(i,n){	
	if(flag==0 && h[i]!=0){
	  hh=abs(x[i]-xi)+abs(y[i]-yi)+h[i];
	  flag=1;
	}
	else if(flag==1 && h[i]!=0){
	  ht=abs(x[i]-xi)+abs(y[i]-yi)+h[i];
	  if(hh!=ht){
	    ok=0;
	    break;	    
	  }
	}	
      }
      if(ok){
	rep(i,n){
	  if(max(hh-abs(x[i]-xi)-abs(y[i]-yi),0)!=h[i]) ok=0;
	}
      }
      if(ok){
	ansh=hh;
	ansx=xi;
	ansy=yi;
	break;
      }
    }
  }
  cout << ansx << " " <<ansy << " " <<ansh << endl;
  return 0;

}


Measured memory_bytes: 256
import sys
 
 
N = int(sys.stdin.readline())
V = sys.stdin.readline().strip().split()
C = sys.stdin.readline().strip().split()


dif = []
for i in range(N):
    V_i = int(V[i])
    C_i = int(C[i])
    dif.append(V_i-C_i)
    
sum = 0
for s in dif:
    if(s>0):
        sum += s
print(sum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const int N = 2e5+10 , M = 5e5+10 ,  MOD = 1e9+7;
const ll OO = 0x3f3f3f3f;
const double EPS = 1e-3;
#define M_PI 3.14159265358979323846
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define pb push_back
#define F first
#define S second
#define all(v) ((v).begin()) , ((v).end())
#define sz(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 

int n;


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

    scanf("%d",&n);
    vector < int > v(n) ;
    for(auto &x : v)
        scanf("%d",&x);

    int mx = 0 , e = n-1;
    

    rloop(i,n-1){ 
        if(v[i] < v[i+1])
             e = i;
       // cout << e << "\n";
        mx = max(mx , e-i);
    }
    printf("%d\n",mx);
   
  
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){

int p[6];
int P=0;
bool f=true;
while(1){
scanf("%d",&p[0]);if(p[0]==0)break;
scanf("%d",&p[1]);if(p[1]==0)break;
scanf("%d",&p[2]);if(p[2]==0)break;
scanf("%d",&p[3]);if(p[3]==0)break;
scanf("%d",&p[4]);if(p[4]==0)break;
P=0;f=true;
for(int i=0;i<5;i++){
if(p[i]==1)f=false;
}
if(f==true){P=2;}

f=true;
for(int i=0;i<5;i++){
if(p[i]==2)f=false;
}
if(f==true){P=3;}

f=true;
for(int i=0;i<5;i++){
if(p[i]==3)f=false;
}
if(f==true){P=1;}
f=true;
for(int i=0;i<4;i++)
if(p[i]!=p[i+1])f=false;
if(f==true)P=0;

for(int i=0;i<5;i++)
{if(P!=0){if(p[i]==P)printf("1\n");else printf("2\n");}
else if(P==0)printf("3\n");
}
}
return 0;
}

Measured memory_bytes: 1012
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC061A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a,b,c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a <= c && c <= b) Console.WriteLine("Yes");
            else Console.WriteLine("No");
            
                Console.ReadKey();
            
        }
    }
}


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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define repl(n) for (int l = 0; l < (n); l++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
ll modpow(ll a, ll b, ll m) {
  ll re = 1, k = 1;
  while (k <= b) {
    if (b & k) {
      re *= a;
      re %= m;
    }
    k = k << 1;
    a *= a;
    a %= m;
  }
  return re;
}
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;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

int main() {
  int n;
  cin >> n;
  cout << n * n * n << endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
using lint = long long;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (int i = 0; i < (int)vec.size(); i++) {
		os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	}
	return os;
}

#ifdef _DEBUG
template <class Head>
void dump(const char* str, Head &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + 1, t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int x, a, b;
	cin >> x >> a >> b;

	if (abs(x - a) < abs(x - b)) cout << "A\n";
	else cout << "B\n";

	return 0;
}

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

int main(){
	int W, H, x, y, r;
	cin >> W >> H >> x >> y >> r;
	if (x >= r && x <= (W - r)){
		if (y >= r && y <= (H - r)){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    long long N;
    cin>>N;
   long long ans=1;
   for(int i=1;i<=N;i++){
       ans=ans*i;
       ans=ans%1000000007;
   }
   cout<<ans;
   return 0;
   
}



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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> vec(N);
  for (int i = 0; i < N; i++) cin >> vec.at(i);

  sort(vec.begin(), vec.end());

  string ans;

  for (int i = 0; i < N; i++) {
    ans += vec.at(i);
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
e=(1..gets.to_i).map{[]}
i=0
a=$<.map{|s|s.split.map{|v|e[v.to_i-1]+=[i]}
!i+=1}
e.map{|e|i=0
u={}
e.reject{|j|u[x=a[j]]=x}.map{|j|0while u[a[j]=i+=1]}}
p a.max,*a

Measured memory_bytes: 163580
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int h[n],i,c=0;
    for(i=0;i<n;i++)
    {
        cin>>h[i];
        if(h[i]>=k)
            c++;
    }

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

Measured memory_bytes: 640
#include <stdio.h>

#define MAX 1000

int read(int *d)
{
    int i,j;
    int n, x;
    int cnt = 0;

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

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

    for(i=1;i<x/3;i++) {
        for(j=i+1;j<x/2;j++) {
            if(x-i-j > j && x-i-j <= n)
                cnt++;
        }
    }
    *d = cnt;

    return 1;
}

int main(void)
{
    int i;
    int idx;
    int n,x;
    int data[MAX];

    while(read(&data[idx++]) != 0);

    for(i=0;i<idx-1;i++) {
        printf("%d\n", data[i]);
    }

    return 0;
}

Measured memory_bytes: 604
#include <stdio.h>

int main(void)
{
	int a, b, c;

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

	if (a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 2140
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  string s;cin>>s;
  n=s.length();


  int mj=s[n/2];
  int flag=0;
  REP(i,(n-1)/2){
    if (s[i]!=s[n-i-1]){
      flag=1;
      break;
    }
  }

  n=(n-1)/2;

  REP(i,(n)/2){
    if (s[i]!=s[n-i-1]){
      flag=1;
      break;
    }
  }
  
/*
  REP(i,((n-1)/2-1)/2){
    if (s[i]!=s[(n-1)/2-i-1]){
      flag=1;
      break;
    }
  }
  */

  if (flag==0){
    cout<<"Yes"<<endl;
    return 0;
  }else{
    cout<<"No"<<endl;
    return 0;
  }


  return 0;
}




/*

#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll l;

int main(){
  ll ans=0;
  cin >> l;


  vi a(n),b(n);
  REP(i,n) cin>>a[i];
  cout<<ans<<endl;
  return 0;
}
*/

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
   int a, b, c, d;
   long int s, t;
   scanf("%d%d%d%d", &a, &b, &c, &d);
   s = a*b;
   t = c*d;
   if(s >= t){
       printf("%ld\n", s);
   }
   else{
       printf("%ld\n", t);
   }
   return 0;
}

Measured memory_bytes: 1724
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int H,W;
  char S[100][100];
  cin>>H>>W;
  int count=0;
  for(int i=0;i<=H+1;i++){
    for(int k=0;k<=W+1;k++){
      S[i][k]='0';
    }
  }

  for(int i=1;i<=H;i++){
    for(int k=1;k<=W;k++){
      cin>>S[i][k];
    }
  }
  for(int i=1;i<=H-1;i++){
    for(int k=1;k<=W-1;k++){
      if(S[i][k]=='#'){
      if(S[i][k-1]=='#' || S[i][k+1]=='#' || S[i+1][k]=='#' || S[i-1][k]=='#' )
      {

      }else{
        count=1;
        break;
      }
     }
    }
  }
  if(count==0)
  {
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
N = int(input())
dic = {}
for _ in range(N):
    s = input()
    if s in dic: 
        dic[s] += 1
    else:
        dic[s] = 1

M = int(input())
for _ in range(M):
    t = input()
    if t in dic: 
        dic[t] -= 1
ans = max(dic.values())
if ans<0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 3064
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int t = 0;

  if (m2 >= m1) {
    t = 60 * (h2 - h1) + m2 - m1;
  } else {
    t = 60 * (h2 - h1) - (m1 - m2);
  }
  t -= k;
  cout << t;
  return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ull unsigned long long int
#define ll long long int
#define ld double
#define ui unsigned int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

#define fr(i,a,b) for (int i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (int i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (int i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (long long i = (n) - 1; i >= 0; i--)

#define PI 3.1415926535897932385
#define INF 1e18
#define EPS 1e-7
#define MAXN 1000000005
#define MOD 1000000007

void ayn(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

ll gcd(ll a, ll b)
{
    if (a == 0) return b;
    return gcd(b % a, a);
}
ll modpow(ll b, ll e, ll mod=MOD) {
    ll ans=1; for(;e;b=b*b%mod,e/=2) if(e&1) ans=ans*b%mod; return ans; }
ll mulmod(ll a, ll b, ll mod)
{
    ll res = 0;
    a = a % mod;
    while (b > 0)
    {
        if (b % 2 == 1) res = (res + a) % mod;
        a = (a * 2) % mod;
        b /= 2;
    }
    return res % mod;
}
int binCoeff(int n, int k)
{
    int C[n + 1][k + 1]; int i, j;
    for (i = 0; i <= n; i++)
    {
        for (j = 0; j <= min(i, k); j++)
        {
            if (j == 0 || j == i) C[i][j] = 1;
            else C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
        }
    }
    return C[n][k];
}

const int maxn = 100005;
int dfs(ll v, ll ans2, vector<bool>& visited, vector<vector<ll>>& vc){
    visited[v]=true;
    ans2++;
    for(auto z:vc[v])
    {
        if(!visited[z])
        {
           ans2+=dfs(z,0,visited,vc);
        }
    }
    return ans2;
}

ll conv(string n)
{
    string num = n;
    ll dec_value = 0;
    int base = 1;

    int len = num.length();
    for (int i=0; i<len; i++) {
        if (num[i] == '1') dec_value += base;
        base = base * 2;
    }
    return dec_value;
}

int main(){
    fastio;
    ayn();
    ll t; t=1;
    while(t--){
        ll n; cin>>n;
        ll a,b; cin>>a>>b;
        if(((a/n)==(b/n))&&a%n!=0&&b%n!=0) cout<<"NG";
        else cout<<"OK";
    }
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



i64 n, k, x[101010];
void solve(){
	cin >> n >> k;
	int pos = n;
	for(int i = 0; i < n; i++){
		cin >> x[i];
		if(pos == n && x[i] >= 0) pos = i;
	}
	i64 ans = LINF;
	for(int i = 0; i < n; i++){
		if(pos <= i){
			if(i-pos >= k) break;
			if(i < k-1) continue;
			if(i-pos == k-1) chmin(ans, x[i]);
			else chmin(ans, x[i]*2+abs(x[pos-(k-(i-pos+1))]));
		}
		else{
			if(pos != n && x[pos] == 0){
				if(pos-i >= k) continue;
				if(n-i < k) continue;
				if(pos-i == k-1) chmin(ans, abs(x[i]));
				else chmin(ans, abs(x[i])*2+x[pos+k-1-(pos-i)]);
			}
			else{
				if(pos-i > k) continue;
				if(n-i < k) continue;
				if(pos-i == k) chmin(ans, abs(x[i]));
				else chmin(ans, abs(x[i])*2+x[pos+k-1-(pos-i)]);
			}
		}
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 1024
def examC():
    N = LI(); N.sort()
    if N[0]==1:
        if N[1]==1:
            ans = 1
        else:
            ans = max(0,N[1]-2)
    else:
        ans = (N[1]-2)*(N[0]-2)
    print(ans)
    return

def examD():
    N, K = LI()
    ans = 0
    b = K+1
    while(b<=N):
        cur = N//b * (b-K) + max(0,N%b - K+1)
        if cur==N+1:
            cur = N
        ans += cur
        b += 1
#        print(ans)
    print(ans)
    return

def examE():
    N, A, B = LI()
    if N<A+B-1 or N>A*B:
        print(-1)
        return
    ans = []
    cur = N
    num = N
    rest = B - 1
    #print(rest)
    for i in range(B):
        cur -= A
        if cur<=rest:
            cur += A
            break
        for j in range(A):
            if num==rest:
                break
            ans.append(cur+1)
            cur += 1
            num -= 1
        cur -= A
        rest -= 1
    for i in range(rest,cur):
        ans.append(i+1)
    cur = rest
    for j in range(rest):
        ans.append(cur)
        cur -= 1
    print(" ".join(map(str,ans)))
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examE()

"""

"""

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    bool ans = true;
    if (n % 2 > 0)
        ans = false;
    else {
        rep (i, n / 2) {
            if (s[i] != s[i + n / 2]) ans = false;
        }
    }
    yn(ans);

    return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << 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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll n,k;cin>>n>>k;

  ll count=0;
  while(n){
    n/=k;
    count++;
  }

  out(count);


  return 0;
}


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

#define vec(v) vector<int>(v)
#define be(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define mapci(mp) map<char*,int>(mp)
#define mapcc(mp) map<char*,char*>(mp)
typedef long long ll;
using namespace std;

int main() {
    int n;
    string s,t,a,b;
    cin>>n>>s>>t;
    for(int i=0;i<n;i++){
        a=s.substr(i,n-i);
        b=t.substr(0,n-i);
        if(a==b){
            cout <<n+i<<endl;
            return 0;
        }
    }
    cout <<2*n<<endl;
    return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

int main() {
    int k, q;
    cin >> k >> q;

    vector<int> d(k);
    rep(i, k) cin >> d[i];

    while (q--) {
        int n, x, m;
        cin >> n >> x >> m;
        x %= m;

        int ans = n - 1;

        int L = n / k;
        ll add = 0;
        rep(i, k) {
            int ct = L;
            if (i == k - 1) {
                --ct;
                if ((n - 1) % k != k - 1) ++ct;
            } else {
                int r = (n - 1) % k;
                if (r != k - 1 && i < r) ++ct;
            }
            // printf(" %d : %d\n", i, ct);

            ll b = d[i] % m;
            if (b == 0) ans -= ct;
            add += b * ct;
        }
        ans -= (add + x) / m;

        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 3632
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		ArrayList<Integer> array = new ArrayList<Integer>();
 		for(int i = 0;i<t;i++){
//	 		String input1 = bf.readLine().trim();
//	 		String input2 = bf.readLine().trim();
	 		
	 		array.add(Integer.parseInt(st.nextToken()));
 		}
 		long max = array.get(0);
 		long sum = 0;
 		for(int j = 1;j<t;j++){
 			if (array.get(j) < max){
 				sum+=(long)((max-array.get(j)));
 			}
 			else{
 				max = array.get(j);
 			}
 		}
 		
 		
 		out.println(sum);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




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

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
using namespace std;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60; const ll MOD = 1000000007;
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; }

//---------------------------------------------------------------------------------------------------
void _main() {
    ll X; cin >> X;
    ll a ,b;

    a = 1;
    bool ok = false;
    while(true) {
        float now = pow(abs(pow(a,5) - X), 0.2);
        if (floor(now) == now) {
            ok = true;
            b = floor(now);
        }
        now = pow(abs(pow(-1 * a,5) - X), 0.2);
        if (floor(now) == now) {
            ok = true;
            a *= -1;
            b = floor(now);
        }

        if (ok) {
            if (pow(a,5) - pow(b, 5) == X) {
                cout << a << " " << b;
            }else if (pow(a,5) - pow(floor(-1 * b), 5) == X){
                cout << a << " -" << b;
            }else{
                cout << now << " -" << a;
            }
            break;
        }
        a += 1;
    }
}

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

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  char lpstr[ 128 ];

  while ( fgets ( lpstr, sizeof ( lpstr ), stdin ) != NULL )
  {
    double    zbuf[ 128 ];
    double  * zp = zbuf;
    char    * t;

    for ( t = strtok ( lpstr, " \n" ); t != NULL;
          t = strtok ( NULL,  " \n" ) )
    {
      if ( !strcmp ( t, "+" ) )
        { --zp; zp[ -1 ] = zp[ -1 ] + zp[ 0 ]; }
      else if ( !strcmp ( t, "-" ) )
        { --zp; zp[ -1 ] = zp[ -1 ] - zp[ 0 ]; }
      else if ( !strcmp ( t, "*" ) )
        { --zp; zp[ -1 ] = zp[ -1 ] * zp[ 0 ]; }
      else if ( !strcmp ( t, "/" ) )
        { --zp; zp[ -1 ] = zp[ -1 ] / zp[ 0 ]; }
      else
        { *( zp++ ) = atof ( t ); }
    }

    printf ( "%.5f\n", zp[ -1 ] );
  }

  return ( 0 );
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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 long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
struct runner { ld p, t, v; };
runner a[100];
ld pas[100][100];
void init() {
	rep(i, 100) {
		rep(j, 100) {
			if (i == 0 || j == 0)pas[i][j] = 1;
			else pas[i][j] = pas[i - 1][j] + pas[i][j - 1];
		}
	}
}
//i番目の人がj回休憩をとる確率
ld pr[100][51];
int main(){
	init();
	cout << fixed << setprecision(10);
	int n, m;ld L; cin >> n >> m >> L;
	rep(i, n) {
		ld p, t, v; cin >> p >> t >> v;
		p /= 100.0;
		a[i] = { p,t,v };
		rep(j, m + 1) {
			pr[i][j] = pas[m - j][j];
			rep(k, j) {
				pr[i][j] *= p;
			}
			rep(k, m-j) {
				pr[i][j] *= (1 - p);
			}
		}
	}
	rep(i, n) {
		ld out = 0;
		rep(j, m + 1) {
			ld sum = j * a[i].t + L / a[i].v;
			ld ssum = pr[i][j];
			rep(k, n) {
				if (i == k)continue;
				ld csum = 0;
				rep(l, m+1) {
					ld pp = l * a[k].t + L / a[k].v;
					if (pp > sum) {
						csum += pr[k][l];
					}
				}
				ssum *= csum;
			}
			out += ssum;
		}
		cout << out << endl;
	}
	return 0;
}


Measured memory_bytes: 3536
#include <iostream>
#include <queue>
using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  queue<pair<string, int> > queue;
  for(int i=0;i < n;i++){
    string name; int time;
    cin >> name >> time;
    queue.push(make_pair(name,time));
  }
  int now = 0;
  while(!queue.empty()){
    pair<string, int> que = queue.front(); queue.pop();
    if(que.second <= q){
      now += que.second;
      cout << que.first << " " << now << endl;
    }else{
      queue.push(make_pair(que.first, que.second-q));
      now += q;
    }
  }
	return 0;
}

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

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> q;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve(){
	llint a,b,c,d;
	cin >> a >> b >> c >> d;
	llint m1=a*b;
	llint m2=c*d;
	cout << max(m1,m2) << endl;
}

int main(int argc, char *argv[]) {
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define DEBUG
#define REP(i, nn ) for(int i = 0 ; i < (int) nn; i++)
#define deb(x) std::cout << #x << " " << x << endl;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
template<typename... T>
void read(T& ... a){
    ((cin >> a),...);
}
template<typename... T>
void write(T... a){
    ((cout << a << "\n"),...);
}

template<typename... T>
void write_space(T... a){
    ((cout << a << " "),...);
}

void solve(){
    ll x, k , d;
    read(x, k , d);
    if( x < 0 ) x = -x;
    if( k >= x / d){
        k -= x /d;
        x = x % d;
        if( k % 2 == 0){
            cout << x << "\n";
        }else{
            cout << d - x << "\n";
        }
    }else{
        x = x - k * d;
        cout << x << "\n";
    }
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/
    solve();
    return 0;
}



Measured memory_bytes: 3608
N, X, Y = map(int, input().split())

mind = [[N] * N for i in range(N)]
    
for i in range(N):
    for j in range(i+1, N):
        mind[i][j] = min(abs(j-i), abs((X-1)-i)+1+abs(j-(Y-1)), abs((Y-1)-i)+1+abs(j-(X-1)))

mindcnt = [0] * N
for i in range(N):
    for j in range(i+1, N):
        d = mind[i][j]
        mindcnt[d] += 1

for k in range(1, N):
    print(mindcnt[k])


Measured memory_bytes: 80092
def main():
    N = int(input())
    ans = 0
    for n in range(1, N + 1, 2):
        c = 0
        for i in range(1, N + 1):
            if c > 8:
                break
            if n % i != 0:
                continue
            c += 1
        if c == 8:
            ans += 1
    print(ans)


main()


Measured memory_bytes: 2940
#include <iostream>

using namespace std;

int main(){
    int N;
    long a[50];
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    long ans = 0;
    long cnt = 0;
    while(true){
        cnt = 0;
        for(int i = 0; i < N; i++){
            cnt += a[i]/N;
            a[i] = a[i] - (N+1)*(a[i]/N);
        }
        for(int i = 0; i < N; i++){
            a[i] += cnt;
            //cout << a[i] << ' ';
        }
        //cout << endl;
        if(cnt == 0) break;
        ans += cnt;
    }
    cout << ans << endl;
}

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

long long n, x, total=0, ans=-1;

int main(){
    cin >> n >> x;
    long long a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a, a+n);
    for(int i=0; i<n; i++){
        x-=a[i];
        if(x<0){
            ans=i;
            break;
        }
    }
    if(x==0){
        cout << n << endl;
    }
    else if(x>0){
        cout << n-1 << endl;
    }
    else{
        cout << ans << endl;
    }
}


Measured memory_bytes: 384
#include <cstdio>
#define REP(i,n) for(int i=0; i<(int)(n); i++)

#include <iostream>
#include <set>
using namespace std;

int main(){
  string s; cin >> s;
  const string a = "CODEFESTIVAL2016";
  int ans = 0;
  REP(i,a.size()) if(s[i] != a[i]) ans++;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
    int n;
    int a[1000];
    int i;
    float sum=0;
    
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    
    for(i=0;i<n;i++){
        sum += 1.0/a[i];
    }
    printf("%f\n",1.0/sum);
    
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

int main(){
  ll N; cin>>N;
  vector<ll> a(N);
  rep(i,N) cin>>a[i];

  ll sum = 0;
  rep(i,N) sum += a[i];

  ll b = (sum+1)/2;
  ll c = 0;
  ll d = 0;

  rep(i,N){
    c += a[i];
    if(c >= b){
      d = i;
      break;
    }
  }

  ll ans = 0;
  ll r=0, l=0;
  rep(i,d) r += a[i];
  l = sum - r;
  ans = abs(l-r);

  r =0;
  l =0;

  rep(i,d+1) r+= a[i];
  l = sum - r;
  ans = min(ans, abs(l-r));

  cout<<ans<<endl;
}


Measured memory_bytes: 1792