akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];
    
    vector<long long> s(n+1, 0);
    
    for(int i = 0; i < n; ++i) s[i+1] = s[i] + a[i];
    sort(s.begin(), s.end());
    
    long long num = 1;
    long long res = 0;
    for(int i = 0; i < n; ++i) {
        if(s[i] == s[i+1]) ++num;
        else {
            res += num * (num - 1) / 2;
            num = 1;
        }
    }
    res += num * (num - 1) / 2;
    
    cout << res << endl;
}



Measured memory_bytes: 2560
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.nextLong()
    val b = sc.nextLong()
    val k = sc.nextLong()
    println(problem149b(a, b, k))
}

fun problem149b(a: Long, b: Long, k: Long): String {
    val takagi = a - k
    if (takagi < 0) {
        return "0 " + Math.max(0, b - (k - a))
    } else {
        return "${a - k} $b"
    }
}

Measured memory_bytes: 31396
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int a,b,x;
  cin >> a >> b >> x;
  long long int fb = (b-(b%x))/x + 1;
  long long int fa = (a-1-((a-1)%x))/x + 1;
  if(a == 0) fa = 0;
  cout << fb - fa << endl;
}


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

int main(){
  int64_t N,X,Y;
  cin >> N >> X >> Y ;
  vector<int64_t> Ans(N,0);
  for(int64_t i=1;i<N;i++){
    for(int64_t j=i+1;j<=N;j++){
      int64_t a;
      a=min(j-i,abs(X-i)+1+abs(Y-j));
      Ans.at(a)++;
    }
  }
  for(int64_t i=1;i<N;i++){
    cout << Ans.at(i) << endl;
  }
  
}
    
    

Measured memory_bytes: 256
#include <cstdio>

#define F(i, a, b) for (LL i = a; i <= b; i ++)
#define G(i, a, b) for (LL i = a; i >= b; i --)
#define pf printf

typedef long long LL;

const LL N = 1e7 + 10;
const LL M = 20;

using namespace std;

LL D, L, Ans, Sum, total, w[M];
LL ten[M], v[M], tot[M], TOT[M];

void Dfs(LL k, LL s, LL S) {
	if (s < 0) return;
	if (s + 10 * v[k] < D) return;
	if (s - 10 * v[k] > D) return;
	if (k > L) {
		if (s == D) {
			Sum += S;
//			printf("Yes\n");
		}
		return;
	}
	F(i, -9, 9)
		w[k] = i, Dfs(k + 1, s + v[k] * i, S * (k == 1 ? TOT[i + 9] : tot[i + 9]));
}

int main() {
	scanf("%lld", &D);
//	F(i, 1, N - 10) {
//		LL rev = 0;
//		for (LL x = i; x; rev = rev * 10 + (x % 10), x /= 10);
//		if (rev - i == D)
//			printf("%lld\n", i), total ++;
//	}

//	puts("");

	F(i, 0, 9)
		F(j, 0, 9)
			tot[i - j + 9] ++;
	F(i, 0, 9)
		F(j, 1, 9)
			TOT[i - j + 9] ++;

	ten[0] = 1;
	F(i, 1, 18)
		ten[i] = ten[i - 1] * 10LL;
	F(i, 2, 18) {
		L = i / 2, Sum = 0;
		F(j, 1, L)
			v[j] = ten[i - j] - ten[j - 1];
		Dfs(1, 0, 1);
		Ans += Sum * ((i & 1) ? 10 : 1);
//		pf("%d\n", i);
	}
	pf("%lld\n", Ans);
}

Measured memory_bytes: 128
main = do
  s <- getLine
  if ('W' `elem` s) && ('E' `notElem` s)
  then
    putStrLn "No"
  else if 'W' `notElem` s  && 'E' `elem` s
  then
    putStrLn "No"
  else if 'N' `elem` s && 'S' `notElem` s
  then
    putStrLn "No"
  else if 'N' `notElem` s && 'S' `elem` s
  then
    putStrLn "No"
  else
    putStrLn "Yes"

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, A[55];
int M, m;
vector <Pii> ans;

int main(){
  cin >> N;
  for (int i = 1; i <= N; i++){
    cin >> A[i];

    if (A[i] >= A[M]) M = i;
    if (A[i] <= A[m]) m = i;
  }

  if (abs(A[M]) >= abs(A[m])){
    for (int i = 1; i <= N; i++){
      if (A[i] < 0) ans.push_back({M, i});
    }
    for (int i = 1; i < N; i++){
      ans.push_back({i, i+1});
    }
  }else{
    for (int i = 1; i <= N; i++){
      if (A[i] > 0) ans.push_back({m, i});
    }
    for (int i = N-1; i >= 1; i--){
      ans.push_back({i+1, i});
    }
  }

  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++){
    cout << ans[i].fi << " " << ans[i].se << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <algorithm>
 
using namespace std;
 
int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H == 0 && W == 0) break;
        for(int i = 0; i < W; i++) printf("#");
        printf("\n");
 
        for(int i = 1; i < H-1; i++){
            printf("#");
            for(int j = 1; j < W-1; j++) printf(".");
            printf("#\n");
        }
 
        if(H > 1){
            for(int i = 0; i < W; i++) printf("#");
            printf("\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2512
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

a,b,c,d = [int(i) for i in read().split()]

while True:
    c -= b
    if c <= 0:
        print("Yes")
        break
    a -= d
    if a <= 0:
        print("No")
        break

Measured memory_bytes: 9176
#include <iostream>
#include <boost/shared_ptr.hpp>

struct Node;
typedef boost::shared_ptr<Node> NodePtr;
struct Node {
	NodePtr left;
	NodePtr right;
};

void show_intersection_tree(NodePtr root1, NodePtr root2)
{
	std::cout << '(';
	if (root1->left && root2->left) {
		show_intersection_tree(root1->left, root2->left);
	}
	std::cout << ',';
	if (root1->right && root2->right) {
		show_intersection_tree(root1->right, root2->right);
	}
	std::cout << ')';
}

void show_union_tree(NodePtr root1, NodePtr root2)
{
	std::cout << '(';
	if ((root1 && root1->left) || (root2 && root2->left)) {
		show_union_tree(root1 ? root1->left : root1, root2 ? root2->left : root2);
	}
	std::cout << ',';
	if ((root1 && root1->right) || (root2 && root2->right)) {
		show_union_tree(root1 ? root1->right : root1, root2 ? root2->right : root2);
	}
	std::cout << ')';
}

char get_token()
{
	char c;
	while (std::cin >> c) {
		if (c == '(' || c == ',' || c == ')') {
			break;
		}
	}
	return c;
}

NodePtr make_node()
{
	NodePtr node;
	if (get_token() == '(') {
		node = NodePtr(new Node);
		if ((node->left = make_node())) {
			assert(get_token() == ',');
		}
		if ((node->right = make_node())) {
			assert(get_token() == ')');
		}
	}
	return node;
}

int main()
{
	char op;
	while (std::cin >> op) {
		NodePtr root1 = make_node();
		NodePtr root2 = make_node();
		if (op == 'i') {
			show_intersection_tree(root1, root2);
		}
		else if (op == 'u') {
			show_union_tree(root1, root2);
		}
		std::cout << std::endl;
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

namespace PastQuestions
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new Input(Console.In));
        }

        public void Solve(Input input)
        {
            var a = input.ReadLine;
            Console.WriteLine(a.Where(c => c == '1').Count());
        }
    }

    public class Input
    {
        private TextReader Stream { get; }
        private char Separator { get; }
        private Queue<string> InputStream { get; }

        public Input(TextReader stream, char separator = ' ')
        {
            Stream = stream;
            Separator = separator;
            InputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (InputStream.Count != 0) return InputStream.Dequeue();
                string[] tmp = Stream.ReadLine().Split(Separator);
                for (int i = 0; i < tmp.Length; ++i)
                    InputStream.Enqueue(tmp[i]);
                return InputStream.Dequeue();
            }
        }

        public string ReadLine => Stream.ReadLine();
        public int ReadInt => int.Parse(Read);
        public long ReadLong => long.Parse(Read);
        public double ReadDouble => double.Parse(Read);
    }
}


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

using namespace std;
typedef vector<long long> VI;
typedef vector<VI> VVI;
typedef long long LL;
typedef pair<int,int> PI; 
typedef pair<LL,LL> PLL;
typedef unsigned long long ULL;
typedef pair<double,double> PD;

#define FOR(x, b, e) for(int x = b; x<= (e); x++)
#define FORD(x, b, e) for(int x = b; x>= (e); x--)
#define REP(x, n) for(int x = 0; x<(n); ++x)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(x) ((int)(x).size())

#define PB push_back
#define IN insert
#define ST first
#define ND second
#define INF 2000000011
#define MOD 1000000007

#define MAX_S 

int n;
LL k;
VVI tab;

void u(LL &x,LL &y){
	x+=y;
	while(x>=MOD)
		x-=MOD;
}

VVI mult(VVI &t1,VVI &t2){
	VVI odp;
	
	REP(i,n){
		VI t;
		REP(j,n){
			LL val=0;
			REP(k,n){
				LL eh=(t1[i][k]*t2[k][j])%MOD;
				u(val,eh);
			}
			t.PB(val);
		}
		odp.PB(t);
	}
	return odp;
}

VVI pot(LL st){
	
	if(st==1)
		return tab;
	else{
		if(st%2==0){
			VVI t=pot(st/2);
			return mult(t,t);
		}
		else{
			VVI t=pot(st-1);
			return mult(t,tab);
		}
	}
}



int main(){
	
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n>>k;
	
	REP(i,n){
		VI t;
		REP(j,n){
			int t1;
			cin>>t1;
			t.PB(t1);
		}
		tab.PB(t);
	}
	
	VVI odp=pot(k);
	LL t_odp=0;
	REP(i,n){
		REP(j,n)
			u(t_odp,odp[i][j]);
	}
	
	cout<<t_odp%MOD;
	
	return 0;
}


Measured memory_bytes: 384
input = raw_input

from collections import Counter
n = int(input())

#ls = sorted(map(int, input().split(" ")))
c = Counter(map(int, input().split(" ")))
ls = c.keys()
n = len(ls)

out = 0
for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a, b, d = sorted([ls[i], ls[j], ls[k]])
            if a+b > d:
                out += c[ls[i]] * c[ls[j]] * c[ls[k]]

print(out)

Measured memory_bytes: 73524
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

ll ppow(ll a, ll b)
{
    a %= MOD;
    ll res = 1;
    while (b)
    {
        if (b & 1)
        {
            res = (res * a) % MOD;
        }
        a = (a * a) % MOD;
        b >>= 1;
    }
    return res;
}

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long long modinv(long long a, long long mod)
{
    return modpow(a, mod - 2, mod);
}

ll nCk(ll nn, ll k)
{
    ll bunshi = 1;
    ll bunbo = 1;
    for (ll i = 0; i <= k - 1; i++)
    {
        bunshi *= nn - i;
        bunshi %= MOD;
        bunbo *= (i + 1);
        bunbo %= MOD;
    }
    ll res = bunshi * modinv(bunbo, MOD) % MOD;
    return res;
}

ll n, a, b;

int main()
{
    cin >> n >> a >> b;
    ll ans = (MOD + ppow(2, n) - 1) % MOD;
    ans = (ans + MOD - nCk(n, a)) % MOD;
    ans = (ans + MOD - nCk(n, b)) % MOD;
    cout << ans << endl;
}

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

using namespace std;
const int N=2e5+5,INF=2e9;
#define ll long long
pair<ll,ll> a[N];
ll cum[N];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n,D,A;
    cin>>n>>D>>A;
    for(int i=0;i<n;i++)
        cin>>a[i].first>>a[i].second;
    sort(a,a+n);
    ll cur=0,ans=0;
    for(int i=0;i<n;i++)
    {
        cur+=cum[i];
        ll H=a[i].second-cur;
        ll need=max(0ll,(H+A-1)/A);
        cur+=need*A;
        ans+=need;
        pair<ll,ll> p={a[i].first+2*D,(ll)INF};
        int idx=upper_bound(a,a+n,p)-a;
        cum[idx]-=need*A;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;


ll pow_ (ll x, ll n){
    if (x <= 0) return 0;
    ll u = 1;
    if(n > 0){
        u = pow_(x, n/2);
        if (n % 2 == 0) u = (u*u);
        else u = (((u * u)) * x);
    }
    return u;
};

int main() {
    ll n, k;

    cin >> n >> k;
    ll ans = pow_(n/k, 3);
    if(k%2 == 0) ans += pow_((n+k/2)/k, 3);
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include<math.h>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; ++i)
using namespace std;
 
int main(){
		double a;scanf("%lf",&a);
		int b=(int)(a*1000+0.5);
		double ret=0;
		for(int i=0;i<=b;i++){
			int c=(int)(sqrt(0.5+b*b-i*i));
	//		if(c*c+i*i==b*b){
				//printf("%d %d\n",c,i);
				if(i%1000==0&&c<1000){
					ret=max(ret,i+1000.0);
				}
				if(c%1000==0&&i<1000){
					ret=max(ret,c+1000.0);
				}
				ret=max(ret,(double)i+c);
			}
		
		if(sqrt((int)(a+(1e-9)))<a){
			ret=max(ret,1000.0+(int)(a+(1e-9))*1000);
		}
		ret=max(ret,sqrt(2)*b);
		printf("%.12f\n",ret/1000);
}

Measured memory_bytes: 1236
A, B, C, D = map(int, input().split())

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

def lcm(a, b):
    return (a * b) // gcd(a, b)

ca = (A-1) // C
cb = B // C
c = cb - ca

da = (A-1) // D
db = B // D
d = db - da

lcm_cd = lcm(min(C,D), max(C,D))
cda = (A-1) // lcm_cd
cdb = B // lcm_cd
cd = cdb - cda

print(B-A+1-c-d + cd)

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main(){
	int N, i, ans = 0;
	scanf("%d", &N);
	char *A = (char *)malloc(sizeof(char) * (N + 1));
	char *B = (char *)malloc(sizeof(char) * (N + 1));
	char *C = (char *)malloc(sizeof(char) * (N + 1));
	scanf("%s", A);
	scanf("%s", B);
	scanf("%s", C);
	for(i = 0; i < N; i++){
		if(A[i] == B[i] && B[i] == C[i] && C[i] == A[i]){
			continue;
		}
		else if(A[i] == B[i] || B[i] == C[i] || C[i] == A[i]){
			ans++;
		}
		else{
			ans += 2;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	int n;
	cin>>n;
	cout<<(n-2)*180;
}

Measured memory_bytes: 256
data = input()
data_list = [c for c in data]
# print(data_list)
count = 1
delete_count = 0
number_of_one = data_list.count('1')
number_of_zero = data_list.count('0')

min_num = min(number_of_zero, number_of_one)
print(min_num * 2)

Measured memory_bytes: 3956
#include <cstdio>
#include <utility>

#include <vector>
#include <string>
using namespace std;

#define gcu getchar_unlocked
#define ii inline int in
#define is inline bool scan
ii(int c) {
	int n = 0;
	bool minus = false; if (c == '-') minus = true, c = gcu();
	do {n = 10 * n + (c - '0'), c = gcu();} while (c >= '0');
	//return n; }
	return minus ? -n : n; }
ii() {return in(gcu());}
is(int &n) {int c=gcu();return c==EOF?false:(n=in(c),true);}
is(char &c){c=gcu();gcu();return c!=EOF;}
is(string &s) {int c;for(;;){c=gcu();if(c=='\n'||c==' ')return true;s+=c;}}
#undef ii
#define pcu putchar_unlocked
template <typename T>
void out(T n) {
	static char buf[20];
	char *p = buf;
	if(n < 0) pcu('-'), n *= -1;
	if (!n) *p++ = '0';
	else while (n) *p++ = n % 10 + '0', n /= 10;
	while (p != buf) pcu(*--p); }
void out(const char *s){while(*s)pcu(*s++);}
void out(char c){pcu(c);}
void out(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail>
void out(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T>
//void out(vector<T> &v){for(T &x:v)out(' '),out(x);out('\n');}
//void out(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef svo

typedef vector<string> map;

bool divide(map &m, char c, int x, int y) {
	if (x < 0 || x >= (int) m[0].size() || y < 0 || y >= (int) m.size() ||
		c == '.' || m[y][x] != c)
		return false;
	m[y][x] = '.';
	static const int nx[4] = {1, 0, -1, 0}, ny[4] = {0, 1, 0, -1};
	for (int i = 0; i < 4; i++)
		divide(m, c, x + nx[i], y + ny[i]);
	return true;
}

int main() {
	int H, W;
	while (H = in(), W = in(), H || W) {
		int sections = 0;
		map m = map(H);
		for (string &s : m)
			scan(s);

		for (int i = 0; i < H; i++)
			for (int j = 0; j < W; j++)
				if (divide(m, m[i][j], j, i))
					sections++;

		out(sections, '\n');
		/*
		for (string s : m)
			out(s, '\n');
		*/
	}
}


Measured memory_bytes: 3308
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;


void solve(long long A, long long B){
    cout << max(A - 2 * B, 0LL) << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


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

#define ld long double
#define eps 1e-9

bool cmp(ld A , ld B){return A + eps > B && A - eps < B;}

struct vec{
	ld x , y;
	vec(ld _x = 0 , ld _y = 0) : x(_x) , y(_y){}
	friend vec operator +(vec A , vec B){return vec(A.x + B.x , A.y + B.y);}
	friend vec operator -(vec A , vec B){return vec(A.x - B.x , A.y - B.y);}
	friend ld operator *(vec A , vec B){return A.x * B.x + A.y * B.y;}
	friend ld operator %(vec A , vec B){return A.x * B.y - A.y * B.x;}
	friend vec operator *(vec A , ld B){return vec(A.x * B , A.y * B);}
	ld len(){return sqrt(x * x + y * y);}
	ld len2(){return x * x + y * y;}
	ld angle(){return atan2(y , x);}
};
vec getvec(){ld x , y; cin >> x >> y; return vec(x , y);}

struct segment{
	vec st , ed , dir;
	segment(vec _a = vec() , vec _b = vec()) : st(_a) , ed(_b) , dir(_b - _a){}
	friend bool havesect(segment A , segment B){
		ld P = A.st.x , Q = A.ed.x , X = B.st.x , Y = B.ed.x;
		if(Q < P) swap(P , Q);
		if(Y < X) swap(X , Y);
		if(X - eps > Q || P - eps > Y) return 0;
		P = A.st.y , Q = A.ed.y , X = B.st.y , Y = B.ed.y;
		if(Q < P) swap(P , Q);
		if(Y < X) swap(X , Y);
		if(X - eps > Q || P - eps > Y) return 0;
		return
			((B.st - A.st) % A.dir) * (A.dir % (B.ed - A.st)) > -eps &&
			((B.st - A.ed) % A.dir) * (A.dir % (B.ed - A.ed)) > -eps &&
			((A.st - B.st) % B.dir) * (B.dir % (A.ed - B.st)) > -eps &&
			((A.st - B.ed) % B.dir) * (B.dir % (A.ed - B.ed)) > -eps;
	}
	friend vec getsect(segment A , segment B){
		ld t = ((A.st - B.st) % B.dir) / (B.dir % A.dir);
		return A.st + (A.dir * t);
	}
	ld len(){return dir.len();}
	ld len2(){return dir.len2();}
};
segment getseg(){vec A = getvec() , B = getvec(); return segment(A , B);}

ld dist(vec P , segment seg){//minimum dist from a point to a segment
	ld T = ((P - seg.st) * seg.dir) / seg.len2();
	if(T < 0) return (seg.st - P).len();
	else if(T > 1) return (seg.ed - P).len();
	else return (seg.st + (seg.dir * T) - P).len();
}

struct polygon{//counter-clockwise
	vector < vec > point; int sz;
	void input(){
		cin >> sz; for(int i = 1 ; i <= sz ; ++i) point.push_back(getvec());
		point.push_back(point[0]);
	}
	ld area(){
		ld sum = 0;
		for(int i = 0 ; i + 1 < point.size() ; ++i) sum += point[i] % point[i + 1];
		return sum / 2;
	}
};

int main(){
	polygon T; T.input(); cout << fixed << setprecision(1) << T.area() << endl;
	return 0;
}



Measured memory_bytes: 3276
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    K,N=MI()
    A=LI()
    diff=[0]*N
    for i in range(N-1):
        diff[i]=A[i+1]-A[i]
        
    diff[-1]=A[0]+(K-A[-1])
    print(K-max(diff))

main()


Measured memory_bytes: 71884
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7;

int main() {
  string s; cin >> s;
  int n = s.size();
  int dp[n+5];
  dp[0] = 1;
  rep(i, n-1) {
    if(s[i] == s[i+1]) {
      dp[i+1] = dp[i];
      dp[i+2] = dp[i] + 1;
      dp[i+3] = dp[i] + 2;
      i += 2;
    }
    else dp[i+1] = dp[i] + 1;
  }
  cout << dp[n-1] << endl;
}


Measured memory_bytes: 1412
n,k = map(int,input().split())
t = [0]*(n+1)
for i in range(k):
    d = int(input())
    l = list(map(int,input().split()))
    for j in range(d):
        t[l[j]] += 1
p = 0
for i in range(1,n+1):
    if(t[i] == 0):
        p += 1
print(p)

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

ab = [list(map(int,input().split())) for _ in range(n)]

ab.sort()

if n % 2 == 1:
    m = (n-1) // 2
    l = ab[m][0]

    ab.sort(key = lambda x: x[1], reverse = True)

    m = (n-1) // 2
    r = ab[m][1]
    print(r - l + 1)
else:

    m = n // 2
    l1 = ab[m-1][0]
    l2 = ab[m][0]

    ab.sort(key = lambda x: x[1], reverse = True)

    m = n // 2
    r1 = ab[m][1]
    r2 = ab[m-1][1]
    print((r1+r2)-(l1+l2)+1)


Measured memory_bytes: 48956
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N,count=0;
  string S;
  cin>>N>>S;
  for(int i=0;i<N-2;i++)
  {
    if(S.at(i)=='A'&&S.at(i+1)=='B'&&S.at(i+2)=='C') count++;
  }
  cout<<count<<endl;
}

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

int main() {
  int n;
  int counter = 0;
  cin >> n;
  string tmp[n];
  map<string, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> tmp[i];
    if (mp.count(tmp[i])) {
      counter++;
    } else {
      mp.insert(make_pair(tmp[i], 0));
    }
  }
  cout << n - counter << endl;
  return 0;
}

Measured memory_bytes: 25364
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
const ll INF = 10e16;
const int maxN = 200010;
const int maxD = 15;
const int maxH = 100; 
const int MOD = 1000000007;

int a[32] = {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}; 
int main()
{


	int k;
	scanf("%d",&k);
	cout<<a[k-1]<<endl; 
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

var = raw_input().split()

var = map(int, var)

if 0 > var[2] - var[4] or 0 > var[3] - var[4]:
	print "No"
elif var[0] < var[2] + var[4] or var[1] < var[3] + var[4]:
	print "No"
else:
	print "Yes"

Measured memory_bytes: 6408
N = int(input())
s_list = [input() for i in range(N)]
M = int(input())
t_list = [input() for i in range(M)]
X = 0
for i in range(N):
	X = max(X, s_list.count(s_list[i]) - t_list.count(s_list[i]))
print(X)

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC097B()
{
	int X;
	cin >> X;
	int c = 0;
	for (int i = 1; i*i <= X; ++i)
	{
		for (int j = 2; j < 11; ++j)
		{
			int y = pow(i, j);
			if (y > X)
				break;
			c = max(y, c);
		}
	}
	cout << c << endl;
}
int main()
{
	ABC097B();
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
using ll=long long int;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define RANGE(i,a,b) for(int i=(a);i<=(b);i++)
#define RANGER(i,a,b) for(int i=(b);i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

#define EVALe 1

#ifdef EVAL
#define LOG(i) 0
#else
#define LOG(i) cerr<<#i<<": "<<i
#endif

void solve(){
	int H,A;
	cin>>H>>A;
	cout<<(H+A-1)/A<<endl;
}
int main(){
	solve();
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		int result= a + b;
		result = (result < (a - b)) ? (a - b) : result;

		System.out.println((result < (a * b)) ? (a * b) : result);
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
 
	int n;
  cin>>n;
  vector<string> v(n);
  for(auto& x :v)
    cin>>x;
  int a=0,b=0,c=0,d=0;
  for (auto x : v){
  if(x=="AC")
    a++;
    else if(x=="WA")
      b++;
    else if(x=="TLE")
      c++;
    else 
      d++;
  }
  cout<<"AC x "<<a<<endl;
  cout<<"WA x "<<b<<endl;
  cout<<"TLE x "<<c<<endl;
  cout<<"RE x "<<d<<endl;
 
	return 0;
}

Measured memory_bytes: 6404
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, k;
	cin >> n >> k;
	vi v(n);
	REP(i, n)cin >> v[i];
	int ans = -INF;
	for (int i = 0; i <= n; ++i)for (int j = n; j >= i; --j) {
		vi tmp;
		for (int k = 0; k < i; ++k)tmp.push_back(v[k]);
		for (int k = n - 1; k >= j; --k)tmp.push_back(v[k]);
		sort(ALL(tmp));
		int cnt = k - i - (n - j);
		REP(a, tmp.size()) {
			if (cnt > 0 && tmp[a] < 0) {
				tmp[a] = 0;
				cnt--;
			}
		}
		int sum = 0;
		REP(a, tmp.size())sum += tmp[a];
		if (cnt >= 0)chmax(ans, sum);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

public class Program
{
	public static void Main(String[] args)
	{
		Int64 a = Convert.ToInt64(Console.ReadLine());
		var lst = new List<char>();
		for (int i = 1; i < 99; ++i)
		{
			if (a <= (long)Math.Pow(26, i))
			{
				a -= 1;
				for (int j = 0; j < i; ++j)
				{
					lst.Add((char)((int)'a' + (a % 26)));
					a /= 26;
				}

				break;
			}
			else
			{
				a -= (long)Math.Pow(26, i);
			}
		}
		// Console.WriteLine(a);
		lst.Reverse();
		foreach (var item in lst)
		{
			Console.Write(item);
		}

		Console.WriteLine();
	}
}

Measured memory_bytes: 28172
import java.util.Scanner;

public class Main {
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] A = new int[n+1];
		
		for(int i=0; i<n; i++){
			A[i] = sc.nextInt();
		}
		A[n] = 0;
		
		mergeSort(A, n, 0, n);
		
		System.out.print(A[0]);
		for(int i=1; i<n-1; i++){
			System.out.print(" " + A[i]);
		}
		System.out.println(" " + A[n-1]);
		System.out.println(A[n]);
		
	}
	public static void merge(int[] A, int n, int left, int mid, int right){
		int n1 = mid - left;
		int n2 = right - mid;
		int[] L = new int[n1+1];
		int[] R = new int[n2+1];
		for(int i=0; i<n1; i++){
			L[i] = A[left+i];
		}
		for(int i=0; i<n2; i++){
			R[i] = A[mid + i];
		}
		L[n1] = 2000000000;
		R[n2] = 2000000000;
		int i = 0;
		int j = 0;
		for(int k=left; k<right; k++){
			A[n]++;
			if(L[i] <= R[j]){
				A[k] = L[i];
				i = i + 1;
			}else {
				A[k] = R[j];
				j = j + 1;
			}
		}
	}
	
	public static void mergeSort(int[] A, int n,int left, int right){
		if (left+1 < right){
			int mid = (left + right)/2;
			mergeSort(A, n,left, mid);
			mergeSort(A, n, mid, right);
			merge(A, n, left, mid, right);
		}
	}

}


Measured memory_bytes: 169284
n,x,m = gets.split.map(&:to_i)

a = Array.new(m)
index = Array.new(m,-1)

a[0] = x
index[x] = 0

sum = x

for i in 1...n
  t = (a[i-1] * a[i-1]) % m
  if index[t] == -1
    a[i] = t
    sum += t
    index[t] = i
  else
    loop_start = index[t]
    loop_end = i-1
    loop_sum = 0
    for j in loop_start..loop_end
      loop_sum += a[j]
      if j - loop_start + 1 == (n-i) % (loop_end-loop_start+1)
        sum += loop_sum
      end
    end
    sum += loop_sum * ((n-i) / (loop_end-loop_start+1))
    break
  end
end

puts sum 

Measured memory_bytes: 15836
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Leaf{
public:
	// その葉(節点)の番号
	int x;
	// 親
	int parent;
	// 親+子のリスト
	vector<int> pc;
	// 訪問された？
	bool visit;
	// 1からの距離
	int fromone;
	// nからの距離
	int fromn;

	Leaf(int x){
		this->x = x;
		visit = false;
		parent = -1;
	}
};

vector<Leaf> depthFirstSerch(vector<Leaf> v, int x){
	vector<int> stack;
	int p = x - 1;
	v[p].visit = true;
	// 根だけは例外処理
	// 自身の親を自身にし、距離を-1に(のちのループで0になる)
	v[p].parent = p;
	if (x == 1) {
		v[p].fromone = -1;
	} else {
		v[p].fromn = -1;
	}
	// スタック
	stack.push_back(v[p].x);

	while (!stack.empty()) {
		p = stack[stack.size()-1];
		stack.pop_back();
		// 処理
		if (x == 1) {
			v[p].fromone = v[v[p].parent].fromone + 1;
		} else {
			v[p].fromn = v[v[p].parent].fromn + 1;
		}
		// pに接続している接点
		for (size_t i = 0; i < v[p].pc.size(); i++) {
			// 訪問されてなかったら
			if (!v[v[p].pc[i]].visit) {
				// 親の設定
				v[v[p].pc[i]].parent = p;
				// 訪問済みにする
				v[v[p].pc[i]].visit = true;
				// スタックに積む
				stack.push_back(v[p].pc[i]);
			}
		}
	}

	return v;
}

int main(int argc, char const *argv[]) {
	int n,temp1,temp2;
	cin >> n;
	vector<Leaf> v;
	for (size_t i = 0; i < n; i++) {
		v.push_back(Leaf(i));
	}
	for (size_t i = 0; i < n-1; i++) {
		cin >> temp1 >> temp2;
		temp1--;
		temp2--;
		v[temp1].pc.push_back(temp2);
		v[temp2].pc.push_back(temp1);
	}

	// 1から深さ優先探索
	v = depthFirstSerch(v, 1);
	// 親と訪問済みを初期化
	for (size_t i = 0; i < n; i++) {
		v[i].parent = -1;
		v[i].visit = false;
	}
	// nから深さ優先探索
	v = depthFirstSerch(v, n);

	int white,black;
	white = black = 0;
	for (size_t i = 0; i < n; i++) {
		if (v[i].fromone <= v[i].fromn) {
			black++;
		}
		else {
			white++;
		}
	}
	if (black > white) {
		cout << "Fennec" << '\n';
	}
	else {
		cout << "Snuke" << '\n';
	}
	return 0;
}


Measured memory_bytes: 17260
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } 
int main(){
  int a;
  cin >> a;
  bool ans = false;
  rep1(i,10){
    rep1(j,10){
      if(a == i * j)ans = true;
    }
  }
  if(ans)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
n, m, x = map(int, input().split())
li = list(map(int, input().split()))
count_b = 0
count_s = 0

for i in li:
    if x<=i: count_b += 1 
    else: count_s += 1

if count_b < count_s: last_count = count_b
else: last_count = count_s 

print(last_count)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long double ld;
typedef long long ll;
template <typename... Args> void dbg(Args &&... args) {
  using expander = int[];
  (void)expander{
      0,
      (static_cast<void>(void(cout << std::forward<Args>(args) << " ")), 0)...};
  cout << endl;
}
void gen() {
  exit(0);
}

const int N = 103;
int n, x;
int a[N];

void input() {
  scanf("%d %d", &n, &x);
  forn(i, 0, n) {
    scanf(" %d", &a[i]);
  }
}

void solve() {
  sort(a, a + n);
  int c = x;
  int i = 0;
  for (; i < n; i++) {
    if (i == n - 1 && c != a[i])
      break;
    else if (c < a[i])
      break;
    c -= a[i];
  }
  printf("%d\n", i);
}

void clean() {
  scanf(" ");
}

int main() {
#ifdef DEBUG
  freopen("input", "r", stdin);
  // freopen("output", "w", stdout);
  // gen();
  while (!feof(stdin)) {
#endif
    input();
    solve();
#ifdef DEBUG
    clean();
  }
#endif
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 5;
const int INF = 1<<30;

string ss;
int dp[1<<26], ans[N];

int main(){
	cin>>ss;
	int n = ss.size(), cur = 0;
	fill(dp, dp+(1<<26), INF);
	dp[cur] = 0;
	for(int i=0;i<n;i++){
		cur ^= (1<<(ss[i]-'a'));
		ans[i] = dp[cur]+1;
		for(int j=0;j<26;j++) ans[i] = min(ans[i], dp[cur ^ (1<<j)]+1);
		dp[cur] = min(dp[cur], ans[i]);
	}
	cout<<ans[n-1]<<'\n';
	return 0;
}

Measured memory_bytes: 263556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
ll is_visit[2010][2010] = {};
ll imos[2010][2010] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll W,H;
    while(cin >> W >> H){
        if(H == 0 && W == 0) return 0;
        ll N;
        memset(is_visit, 0, sizeof(is_visit));
        memset(imos, 0, sizeof(imos));

        cin >> N;
        vector<ll> X,Y;
        ll x1[1010],y1[1010],x2[1010],y2[1010];
        rep(i,0,N){
            cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
            X.push_back(x1[i]);
            X.push_back(x2[i]);
            Y.push_back(y1[i]);
            Y.push_back(y2[i]);
        }
        X.push_back(0);
        X.push_back(W);
        Y.push_back(0);
        Y.push_back(H);
        sort(X.begin(), X.end());
        sort(Y.begin(), Y.end());
        X.erase(unique(X.begin(), X.end()), X.end());
        Y.erase(unique(Y.begin(), Y.end()), Y.end());
        // printa(X, X.size());
        // printa(Y, Y.size());

        rep(i,0,N){
            ll x_1 = lower_bound(X.begin(), X.end(), x1[i]) - X.begin();
            ll x_2 = lower_bound(X.begin(), X.end(), x2[i]) - X.begin();
            ll y_1 = lower_bound(Y.begin(), Y.end(), y1[i]) - Y.begin();
            ll y_2 = lower_bound(Y.begin(), Y.end(), y2[i]) - Y.begin();

            imos[y_1][x_1]++;
            imos[y_2][x_2]++;
            imos[y_2][x_1]--;
            imos[y_1][x_2]--;
        }
        rep(i,0,Y.size()){
            rep(j,1,X.size()){
                imos[i][j] += imos[i][j-1];
            }
        }
        rep(j,0,X.size()){
            rep(i,1,Y.size()){
                imos[i][j] += imos[i-1][j];
            }
        }
        ll ans = 0;
        ll dx[4] = {0,0,1,-1};
        ll dy[4] = {1,-1,0,0};
        rep(i,0,(ll)Y.size()-1){
            rep(j,0,(ll)X.size()-1){
                if(is_visit[i][j] || imos[i][j] != 0) continue;
                ans++;
                queue<lpair> qq;
                qq.push(make_pair(i,j));
                while(!qq.empty()){
                    lpair q1 = qq.front();
                    qq.pop();
                    if(is_visit[q1.first][q1.second] == 1) continue;
                    is_visit[q1.first][q1.second] = 1;
                    rep(k,0,4){
                        ll yy = q1.first + dy[k];
                        ll xx = q1.second + dx[k];
                        if(yy >= 0 && yy < (ll)Y.size()-1 && xx >= 0 && xx < (ll)X.size()-1){
                            if(is_visit[yy][xx] == 0 && imos[yy][xx] == 0){
                                qq.push(make_pair(yy,xx));
                            }
                        }
                    }
                }
            }
        }
        print(ans);   
    }
}


Measured memory_bytes: 66312
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 16;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

ll in[300050];

ll ans[300050];
int main() {
	ll N, A, B, i, j;
	scanf("%lld %lld %lld", &N, &A, &B);

	if (A + B - 1 <= N && N <= A*B);
	else return !printf("-1\n");

	N -= A + B - 1;
	ans[1] = B;
	for (i = 2; i <= A; i++) ans[i] = 1;

	for (i = 2; i <= A; i++) {
		ans[i] += min(N, B - 1);
		N -= min(N, B - 1);
	}

	ll cur = 0;
	for (i = 1; i <= A; i++) {
		ll st = cur + 1, en = cur + ans[i];
		for (j = en; j >= st; j--) printf("%lld ", j);
		cur += ans[i];
	}
	return !printf("\n");
}

Measured memory_bytes: 6016
N,Y = map(int, input().split())
"""多分n**2で間に合う"""
f = False
for i in range(N+1):
    for j in range(N+1-i):
        if (Y-(10000*i + 5000*j))//1000 ==N-(i+j) and (Y-(10000*i + 5000*j))>=0:
            f = True
            anls = [i,j,N-(i+j)]

if f:
    print(anls[0],anls[1],anls[2])
else:
    print(-1,-1,-1)



Measured memory_bytes: 3060
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
p=list(map(int,input().split()))
uf=UnionFind(n+1)
for i in range(m):
  x,y=map(int,input().split())
  uf.union(p[x-1],p[y-1])
ans=0
for i in range(1,n+1):
  if uf.same(i,p[i-1]):
    ans+=1
print(ans)
  


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  map<char,int> m;
  rep(i,n){
    char a; cin>>a;
    m[a]=1;
  }
  ll cnt=0;
  for(auto e: m){
    cnt++;
  }
  if(cnt<=3) cout<<"Three"<<endl;
  else cout<<"Four"<<endl;
}

Measured memory_bytes: 256
use std::io::{self, Read};
use std::str::FromStr;
pub struct Scanner<R: Read> {
    reader: R,
}
impl<R: Read> Scanner<R> {
    pub fn new(reader: R) -> Scanner<R> {
        Scanner { reader: reader }
    }
    pub fn read<T: FromStr>(&mut self) -> T {
        let s = self
            .reader
            .by_ref()
            .bytes()
            .map(|c| c.expect("failed to read char") as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        s.parse::<T>().ok().expect("failed to parse token")
    }
}

struct SegmentTree {
    n: usize,
    vals: Vec<i64>, // 0-index
}

impl SegmentTree {
    fn new(size: usize) -> SegmentTree {
        // nをsizeを超える最小の2の累乗値とする
        let mut n = 1;
        while n < size {
            n *= 2;
        }

        SegmentTree {
            n: n,
            vals: vec![0; 2*n-1],   // Sumなので0初期化
        }
    }

    // idx番目の値にvalを加える
    fn add(&mut self, idx: usize, val: i64) {
        let mut idx = idx + self.n - 1;
        self.vals[idx] += val;
        while idx > 0 {
            idx = (idx-1)/2;    // parent's index
            let lid = idx*2 + 1;
            let rid = lid + 1;
            self.vals[idx] = self.vals[lid] + self.vals[rid];
        }
    }

    // 閉区間[a,b]の総和を求める
    fn get_sum(&self, a: usize, b: usize) -> i64 {
        self.query(a, b+1, 0, 0, self.n)    // 閉区間→半開区間に変更
    }

    // 半開区間[l,r)を保持するノードkに対して半開区間[a,b)の総和を求める
    fn query(&self, a: usize, b: usize, k: usize, l: usize, r: usize) -> i64 {
        if self.vals.len() <= k || r <= a || b <= l {   // ノードkが完全に区間[a,b)の外
            0
        } else if a <= l && r <= b {   // ノードkが完全に区間[a,b)に含まれる
            self.vals[k]
        } else {    // 子に区間を分割して問合せ
            let vl = self.query(a, b, k*2+1, l, (r+l)/2);
            let vr = self.query(a, b, k*2+2, (r+l)/2, r);
            vl + vr
        }
    }
}

fn main() {
    let sin = io::stdin();
    let sin = sin.lock();
    let mut sc = Scanner::new(sin);

    let n: usize = sc.read();
    let q: usize = sc.read();

    let mut st = SegmentTree::new(n);

    for _ in 0..q {
        let com: u32 = sc.read();
        let i: usize = sc.read();

        match com {
            0 => {  // add
                let v: i64 = sc.read();
                st.add(i-1, v);
            },
            1 => {  // sum
                let j: usize = sc.read();
                let sum = st.get_sum(i-1,j-1);
                println!("{}", sum);
            },
            _ => {
                panic!("irregular command");
            }
        }
    }

}



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

int main(void) {
    int a, b, c;
    bool flg = false;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> a >> b >> c;
    for (int i = a; i <= a * b; i += a) {
        if (i % b == c) {
            flg = true;
            break;
        }
    }

    cout << (flg? "YES": "NO") << "\n";
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int a = sc.nextInt();
        int b = sc.nextInt();

        int array[] = {1, 1, 1};

        array[a-1] = 0;
        array[b-1] = 0;

        for (int i = 0; i < array.length; i++) {
            if (array[i] == 1) {
                System.out.println(i+1);
            }
        }
    }
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  Int n;
  cin>>n;
  Int f[n][10];
  for(Int i=0;i<n;i++)
    for(Int j=0;j<10;j++)
      cin>>f[i][j];
  Int p[n][11];
  for(Int i=0;i<n;i++)
    for(Int j=0;j<11;j++)
      cin>>p[i][j];

  Int ans=-(1LL<<55);
  vector<Int> v;
  for(Int b=1;b<(1<<10);b++){
    Int tmp=0;
    for(Int i=0;i<n;i++){
      Int k=0;
      for(Int j=0;j<10;j++)
	if((b>>j)&1) if(f[i][j]) k++;
      tmp+=p[i][k];
    }
    //cout<<bitset<10>(b)<<":"<<tmp<<endl;
    ans=max(ans,tmp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{  int a , b ;
   
   cin >> a >> b ;
   if( a > b ) {
       cout << "a > b" << endl;
   }
   else if( a < b ){
       cout << "a < b" << endl;
   }
   else if( a = b ){
       cout << "a == b" << endl; 
   }
   return 0;
}


Measured memory_bytes: 3120