akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt(),b=nxt(),c=nxt();
    cout<<max(0,c-(a-b))<<endl;
    
    
    return 0;   
}


 
 


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int b = 0, c = 0, d = 0;
        for(int i = 0; i < n; i++){
            switch(scanner.nextInt()){
                case 1 : b++;break;
                case 2 : c++;break;
                case 3 : d++;break;
                default:
                    break;
            }
        }

        Double[][][] dp = new Double[n+1][n+1][n+1];
        System.out.println(new Main().f(dp, b, c, d, n));
    }

    public double f(Double[][][] dp, int b, int c, int d, int n){
        if(b < 0 || c < 0 || d < 0){
            return 0;
        }
        if(dp[b][c][d] != null){
            return dp[b][c][d];
        }
        double sum = b + c + d;
        if(sum == 0)
            return 0;
        dp[b][c][d] = n / sum
                    + b / sum * f(dp, b-1,c,d,n)
                    + c / sum * f(dp, b+1,c-1,d,n)
                    + d / sum * f(dp, b,c+1,d-1,n);
        return dp[b][c][d];
    }
}


Measured memory_bytes: 292304
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define inp(arr,n) for(int i=0;i<n;i++) cin>>arr[i]
#define fr(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int T=1;
    while (T--) {
        fr(i,1,5){
            int a;
            cin>>a;
            if(a==0) {
                cout<<i<<endl;
                break;
            }
        }
    }
    return 0;
}

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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a < b) {
        for (int i = 0; i < b; i++) {
            cout << a;
        }

    } else {
        for (int i = 0; i < a; i++) {
            cout << b;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
 
 
int main()
{
	string S;
	
	cin >> S;
 
	if(S[2] == S[3] && S[4] == S[5]){
		cout << "Yes";
	}else{
		cout << "No";
	}

	
 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define MAX 100005
set<P> st;
set<P> t;

int H,W,N;
int y[MAX],x[MAX];

ll ans[11];

int main(){
  scanf("%d %d %d",&H,&W,&N);
  for(int i=0;i<N;i++){
    scanf("%d %d",&y[i],&x[i]);
    t.insert(P(y[i],x[i]));
    for(int dy=0;dy<3;dy++){
      for(int dx=0;dx<3;dx++){
        if(y[i]-dy>=1 && x[i]-dx>=1 )
          if(y[i]-dy+2<=H && x[i]-dx+2<=W)
            st.insert( P( y[i]-dy , x[i]-dx ) );
      }
    }
  }

  ans[0]=(ll)(H-2)*(ll)(W-2) - (ll)st.size();
  for(P p : st ){
    int py=p.first;
    int px=p.second;
    int cnt=0;
    for(int dy=0;dy<3;dy++){
      for(int dx=0;dx<3;dx++){
        cnt+= t.count( P(py+dy,px+dx) );
      }
    }
    ans[cnt]++;
  }

  for(int i=0;i<10;i++){
    printf("%lld\n",ans[i]);
  }
  
  return 0;
}


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

int main(){
	string str;
	int c[26] = {};
	
	while(cin>>str){
		for(int i = 0; i < (int)str.size(); i++){
			if(isupper(str[i])) str[i] = tolower(str[i]);
			c[str[i] - 'a']++;
		}
	}
	for(char ch = 'a'; ch <= 'z'; ch++){
		cout<<ch<<" : "<<c[ch - 'a']<<endl;
	}
	return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}

int main(){
	int n;
	cin >> n;
	int p[100];
	FOR(i,n){
		cin >> p[i];
	}
	int cnt=0;
	bool ans=0;
	int b[100];
	FOR(i,n){
		FOR(j,n){
			FOR(k,n){
				b[k]=p[k];
			}
			int tmp=b[i];
			b[i]=b[j];
			b[j]=tmp;
			cnt=0;
				FOR(k,n-1){
			if(b[k]>b[k+1]){
				cnt++;
			}
		}
		
			if(cnt==0){
				ans=1;
			}
		}
	}

	if(ans){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}


}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
 
int main(){
  int m,n;
  int a[1000000];
  int b[1000000];
  int left,right,mid;
  int key,cnt=0;

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

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



  
  for(int i=0; i<m; i++){
    key = b[i];
    left = 0;
    right = n;
     
    while(left < right){
      mid = (left + right)/2;
      if(a[mid] == key){
    cnt++;
    
    break;
      }else if( key < a[mid]){
	right=mid;

      }else{
	left=mid+1;
      }
      
    }
  }

  cout<<cnt << endl; 
   
  return 0;
}

Measured memory_bytes: 3592
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		string ans = "Yes";
		if(str.Substring(0,1)==str.Substring(1,1)){
			if(str.Substring(0,1)!= str.Substring(2,1) && str.Substring(2,1)==str.Substring(3,1)){
				ans = "Yes";
			} else {
				ans = "No";
			}
		} else {
			if(str.Substring(0,1)==str.Substring(2,1) && str.Substring(1,1)==str.Substring(3,1)){
				ans = "Yes";
			} else if(str.Substring(0,1)==str.Substring(3,1) && str.Substring(1,1)==str.Substring(2,1)){
				ans = "Yes";
			} else {
				ans = "No";
			}
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 11092
# https://atcoder.jp/contests/agc009/tasks/agc009_a

n = int(input())

A = []
B = []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

ans = 0
plus = 0
for i in range(n)[::-1]:
    a = A[i] + plus
    b = B[i]
    if a % b != 0:
        multi = a // b + 1
        t = b * multi - a
        ans += t
        plus += t
print(ans)

Measured memory_bytes: 56920
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n - 1; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define RFOR(i, start, end) for (int i = start - 1; 0 <= i; i--)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using namespace std;
constexpr int INF32       = 1'050'000'000;
constexpr long long INF64 = 4'000'000'000'000'000'000;
constexpr int MOD7        = 1'000'000'007;
constexpr int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

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

    vector<int> v(10);
    scan(v);
    RSORT(v);
    REP(i, 3) print(v[i]);

    return 0;
}


Measured memory_bytes: 3104
N = int(input())
S = list(input())

mae = S.count("(")
ushiro = N - mae

p_sum = [0] * N

if S[0] == "(":
	p_sum[0] = 1
else:
	p_sum[0] = -1

for i in range(1, N):
	if S[i] == "(":
		p_sum[i] = p_sum[i - 1] + 1
	else:
		p_sum[i] = p_sum[i - 1] - 1

def Good(x):
	if min(x) >= 0 and mae == ushiro:
		return True
	else:
		return False

if not Good(p_sum):
	S = ["("] * (- min(0, min(p_sum))) + S + [")"] * (mae - ushiro - min(0, min(p_sum)))

print("".join(S))

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;

int main(){
    int i;
    int a,b;
    cin >> a >> b;
    cout << a * b;
    return 0;
}

Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}


int main(){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  int n = s.size();

  const int DIV = 13, MOD = 1e9+7;
  // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj
  vector<vector<ll>> dp(n+1, vector<ll>(DIV, 0));
  dp[0][0] = 1;
  ll pow10_i = 1;
  for(int i=0; i<n; i++){
      for(int j=0; j<DIV; j++){
          for(int k=0; k<10; k++){
              if(s[i] == '?'){
                int c = (j + k*pow10_i) % DIV;
                dp[i+1][c] = (dp[i+1][c] + dp[i][j])%MOD;
                // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " dp[i+1][c]: " << dp[i+1][c]  << endl; 
              }
              else{
                k = (s[i]-'0');
                int c = (j + (s[i]-'0')*pow10_i) % DIV;
                dp[i+1][c] = (dp[i+1][c] + dp[i][j])%MOD;
                // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " dp[i+1][c]: " << dp[i+1][c]  << endl;
                break;
              }
          }

      }

      pow10_i = (pow10_i * 10) % DIV;
  }

  // cout << " dp: " << endl; print_vec2(dp);
  cout << dp[n][5] << endl;

}


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

int main() {
    long l, r, ans = LONG_MAX;
    cin >> l >> r;
    if(l / 2019 != r / 2019) {
        ans = 0;
    } else {
        for(long i = l; i <= r - 1; i++) {
            for(long j = i + 1; j <= r; j++) {
                ans = min(ans, i * j % 2019);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
     
    public class Main{
        public static void main (String[] args){
             Scanner input = new Scanner(System.in);
           
             while(input.hasNext()){
                  int a = input.nextInt();
                  int b = input.nextInt();
                  int towerID = b - a;
                  int bHeight = ((towerID + 1) * towerID) / 2;
                  int x = bHeight - b;
                  
                  System.out.println(x);
             }
        }
    }

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

int main(){
int buffer;
int pasta_min,juice_min;
std::vector<int> pasta;
std::vector<int> juice;

for(int i=0;i<3;i++){
  std::cin >> buffer;
  pasta.push_back(buffer);
}
for(int j=0;j<2;j++){
  std::cin >> buffer;
  juice.push_back(buffer);
}
pasta_min = *std::min_element(pasta.begin(), pasta.end());
juice_min = *std::min_element(juice.begin(), juice.end());
std::cout << pasta_min+juice_min-50 << std::endl;
}
  


Measured memory_bytes: 3160
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define eb          emplace_back
#define c(P)        cout<<P<<"\n"
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define F           first
#define S           second
#define mp(x,y)     make_pair(x,y) 
#define mem(a,val)  memset(a,val,sizeof(a))
#define fr(i,a,n)   for(ll i=a;i<n;i++)
#define frr(i,a,n)  for(ll i=n-1;i>=a;i--)


const ll N   =  500005;
const ll mod = 1e9 + 7;

using namespace std;


void solve()
{
 string s;
  ll n,a,b,c,d,k,x=0,y=0,ans;
  cin>>n>>a>>b>>c>>d>>s;
  if(c>d)
  {
  for (ll i = b-2; i+2 <d+1; ++i)
  {
    if(s[i]=='.' and s[i+1]=='.' and s[i+2]=='.')
    {
       x = 1;
        break;
    }
  }
  if(x==0)
  {
    cout<<"No";
    return;
  }
}
  for (ll i = b-1; i < d; ++i)
  {
      if(i==d-1)
        break;
      if(i+2<d and s[i+2] == '.')
      {
          i++;
          continue;
      }
      if(i+1<d and s[i+1]=='.')
          continue;

      cout<<"No";
      return;
  }

  
  for (ll i = a-1; i < c; ++i)
  {
        //c(i);    
      if(i==c-1)
        break;
    if(i+2<c and s[i+2] == '.')
      {
          i++;
          continue;
      }
      if(i+1<c and s[i+1]=='.')
          continue;
      cout<<"No";
      return; 
  }
  
  cout<<"Yes";
}

signed main(){
      
      ios_base::sync_with_stdio(false);   
      cin.tie(NULL);
      ll T=1;
      //cin>>T;
      while(T--)
      {
      solve();
      }
      return 0;
    }


Measured memory_bytes: 592
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const int INF = 10000000;

int main(){
    string n;
    cin >> n;
    vector<int> ans(4);
    rep(i, 4){
        ans[i] = n[i] - '0';
    }


    vector<char> ev(4);
    for(int bit = 0; bit < 8; ++bit){
        int res = ans[0];
        for(int i = 0; i < 3; ++i){
            if(bit & (1<<i)) {
                res += ans[i+1];
                ev[i] = '+';
            }else{
                res -= ans[i+1];
                ev[i] = '-';
            }
        }
        if(res == 7) break;
    }

    for(int i = 0; i < 4; ++i){
        cout << ans[i];
        if(i < 3)cout << ev[i];
    }
    cout << '=' << 7 << endl;

    return 0;
}


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

int main() {
    int n;
    cin >> n;
    int a = n/4;
    int b = n/7;
    int res = 0;
    rep(i, a+1){
      rep(j, b+1){
          if (n==4*i+7*j)res++;
      }
    }
    if (res==0)cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

struct UnionFind {
  int n;
  vector<int> rank, par;
  UnionFind() {}
  UnionFind(int n) : n(n), rank(n, 1), par(n) {
    iota(par.begin(), par.end(), 0);
  }
  int root(int x) {
    return par[x] == x ? x : par[x] = root(par[x]);
  }
  void merge(int x, int y) {
    if ((x = root(x)) == (y = root(y))) return;
    if (rank[x] < rank[y]) swap(x, y);
    rank[x] += rank[y];
    par[y] = x;
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return rank[root(x)];
  }
};

int N, K, L;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N >> K >> L;
  UnionFind uf1(N), uf2(N);
  for (int i = 0; i < K; i++) {
    int p, q;
    cin >> p >> q;
    p--, q--;
    uf1.merge(p, q);
  }
  for (int i = 0; i < L; i++) {
    int r, s;
    cin >> r >> s;
    r--, s--;
    uf2.merge(r, s);
  }
  map<pii, int> cnt;
  for (int i = 0; i < N; i++) {
    cnt[pii(uf1.root(i), uf2.root(i))]++;
  }
  for (int i = 0; i < N; i++) {
    cout << cnt[pii(uf1.root(i), uf2.root(i))] << " \n"[i + 1 == N];
  }

  return 0;
}

Measured memory_bytes: 15104
n, k = map(int, input().split())

li = [0]
li.extend(list(map(int, input().split())))
tuita = [0]*(n+1)
cnt = 0
town = 1

lastTown = 1
while True:
  town = li[town]
  cnt += 1
  if tuita[town] == 0:
    tuita[town] = cnt
  else:
    if k < tuita[town]:
      lastTown = 1
      times = k
    elif k == tuita[town]:
      lastTown = town
      times = 0
    else:
      lastTown = town
      times = (k - tuita[town]) % (cnt - tuita[town])
    break

town = lastTown
while times > 0:
  if times <= 0:
    break
  times -= 1
  town = li[town]
print(town)

Measured memory_bytes: 32240
N = int(input())
h = [i for i in map(int, input().split())]

"""
    dp値を書き込んでいく。
    dp値はこの場合、その足場にたどり着くまでの最小コストのことである。
"""
dp = [0] * N
# 0番目でのコストは0なので dp[0] = 0
# 1番目でのコストは0番目から1つ飛ぶ場合の一通り。0と1番目の高さの差を代入
dp[1] = abs(h[0] - h[1])
# 2番目以降は、1つ前と2つ前から飛ぶ場合があるのでイテレーションする
for i in range(2, N):
    dp[i] = min(
        dp[i - 2] + abs(h[i] - h[i - 2]),
        dp[i - 1] + abs(h[i] - h[i - 1]),
        )
print(dp[N - 1])


Measured memory_bytes: 13780
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
int main(){
  ll s=0,t=0;
  string b;cin>>b;
  rep(i,b.size()){
    if(b[i]=='T'){
      if(s==0)t++;
      else s--;
    }
    if(b[i]=='S')s++;
  }
  cout<<s+t;
  }


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c<=0){cout << "Yes" << endl;break;}
        a -= d;
        if(a<=0){cout << "No" << endl;break;}
    }
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

map<ll,ll> p;
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    if(a+b-1>n||a*b<n){
        cout<<-1<<endl;
        return 0;
    }
    int cnt=1;
    bool flag=false;
    rep(i,b){
        rep(j,a){
            if(n-cnt>=b-i-1){
                p[b*(j+1)-i]=cnt++;
            }
            else{
                flag=true;
                int q=-1;
                while(cnt<=n) p[q]=cnt++,--q;
                break;
            } 
        }
        if(flag) break;
    }
    for(auto it:p) cout<<it.second<<" ";
    cout<<endl;
    return 0;
}

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

using namespace std;
using ll = long long;

ll comb(int a, int b) {
  ll res = 1;
  for (int i = 0; i < b; i++)
    res = res * (a - i) / (i + 1);
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, P;
  cin >> N >> P;
  vector<int> A(N);
  vector<int> count(2, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    count[A[i] & 1]++;
  }
  ll res = 0;
  if (count[0] == N) {
    if (P == 0) {
      res = 1LL << N;
    } else {
      res = 0;
    }
  } else {
    for (int i = P; i <= count[1]; i += 2)
      res += comb(count[1], i);
    res *= 1LL << count[0];
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.algorithm, std.conv, std.typecons, std.numeric, std.math;
 
alias M = Tuple!(int, "a", int, "b", int, "c");
 
void main()
{
    immutable nm = readln.chomp.split(" ").map!(to!int).array;
    immutable n = nm[0];
    immutable ma = nm[1];
    immutable mb = nm[2];
 
    auto meds = new M[n];
    foreach(ref m; meds) {
        auto abc = readln.chomp.split(" ").map!(to!int).array;
        m = M(abc[0], abc[1], abc[2]);
    }
 
    auto memo = new int[500][500][41];
    int buy(int a, int b, size_t idx)
    {
        if (memo[idx][a][b])
            return memo[idx][a][b];

        if (idx >= n) {
            immutable div = gcd(a, b);
            if (div) {
                a /= div;
                b /= div;
            }
            return memo[idx][a][b] = ma == a && mb == b ? 1 : int.max;
        }

        auto head = meds[idx];

        auto a_ = a + head.a;
        auto b_ = b + head.b;
 
        auto ret1 = buy(a, b, idx+1);
        auto ret2 = buy(a_, b_, idx+1);
        ret2 = ret2 == int.max ? ret2 : ret2 + head.c;

        return memo[idx][a][b] = min(ret1,  ret2);
    }
 
    immutable min_c = buy(0, 0, 0);
    writeln(min_c == int.max ? -1 : min_c -1);
}

Measured memory_bytes: 42364
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;

using namespace std;

class Edge
{
	public:
	int cost;
	int next;

	Edge(int n,int c)
	{
		next=n;
		cost=c;
	}
};

vector<Edge> g[200000];
bool used[200000];

int main()
{
	int n,m;
	cin>>n>>m;
	bool f=false;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;
		b--;
		g[a].push_back(Edge(b,1));
		g[b].push_back(Edge(a,1));
	}
	fill(used,used+200000,false);
	for(int i=0;i<g[0].size();i++)
	{
		Edge e = g[0][i];
		for(int j=0;j<g[e.next].size();j++)
		{
			if(g[e.next][j].next==n-1)
			{
				f=true;
				break;
			}
		}
		if(f)
			break;
	}

	if(f)
		cout<<"POSSIBLE"<<endl;
	else
		cout<<"IMPOSSIBLE"<<endl;
	return 0;
}

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

int main(){
  ll N; cin>>N;
  vector<ll> T(N+2);
  ll sum=0;
  for(ll i=1; i<=N; i++) cin>>T[i];
  for(ll i=0; i<=N; i++){
    sum+=abs(T[i+1]-T[i]);
  }
  for(ll i=1; i<=N; i++){
    ll ans=sum+abs(T[i+1]-T[i-1])-abs(T[i+1]-T[i])-abs(T[i]-T[i-1]);
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 2048
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	int max_cnt = 0;
	map<int, int> m;
	int n;
	while(cin >> n){
		m[n]++;
		max_cnt = max(max_cnt, m[n]);
	}
	for(auto i:m){
		if(i.second == max_cnt)cout << i.first << '\n';
	}
	return 0;
}


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

#define f first
#define s second
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int N = (int)2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;

           
int n;
double a[N], ans;
int main()
{                   
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ans += 1.0 / a[i];
	}
	cout << fixed << setprecision(10) << 1.0 / ans;
	return 0;
}


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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
const int MAX_V = 1000000;
struct Edge{
  ll to;
  long long cost;
};
struct NODE{
  ll pos;
  long long cost;
};
bool operator < (const NODE &a,const NODE &b){
  return a.cost > b.cost;
}
//infで初期化
vector<vector<ll>> cost;
vector<Edge> g[100000],rg[100000];
ll mincost[MAX_V];
bool used[MAX_V];
ll V;

ll Prim(){
  ll res = 0;
  for(ll i = 0; i < V; ++i){
    mincost[i] = inf;
    used[i] = false;
  }
  priority_queue<NODE> q;
  q.push({0,0});
  while(q.size()){
    auto v = q.top();q.pop();
    if(mincost[v.pos] == inf){
      mincost[v.pos] = v.cost;
      res += v.cost;
      for(auto n : g[v.pos]){
        q.push({n.to,n.cost});
      }
    }
  }
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll x,y;
  int n;
  cin >> n;
  vector<pll> v;
  set<pll> s;
  int k ;
  rep(i,n){
    cin >> x >> y;
    s.insert(mp(x,y));
  }
  for(auto u : s){
    v.emplace_back(u);
  }
  n = v.size();
  auto vy = v;
  rep(i,n){
    v[i].se = i;
    swap(vy[i].fi,vy[i].se);
    vy[i].se = i;
  }
  sort(all(vy));
  V = n;
  rep(i,n){
    for(int j = max(0,i - 10); j < min(n,i + 10);++j){
      if(i == j) continue;
      g[v[i].se].push_back({v[j].se,abs(v[i].fi - v[j].fi)});
    }
  }
  rep(i,n){
    for(int j = max(0,i - 10); j < min(n,i + 10);++j){
      if(i == j) continue;
      g[vy[i].se].push_back({vy[j].se,abs(vy[i].fi - vy[j].fi)});
    }
  }
  /* rep(i,V){                                              */
  /*   debug(i);                                            */
  /*   rep(j,g[i].size()){                                  */
  /*     cout << g[i][j].to << ' ' << g[i][j].cost << endl; */
  /*   }                                                    */
  /* }                                                      */
  std::cout << Prim() << std::endl;
  return 0;
}


Measured memory_bytes: 191972
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
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; }
const long long MOD = 1000000007;
const long long INF = 10000000000;
using namespace std;
typedef long long ll;
map<int, int> mp;
using Graph = vector<vector<int>>; 
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	bool flag = true;
	for (int i = 0; i < s.size(); i++) {
		for (int j = 0; j < s.size(); j++) {
			if (s.at(i) != s.at(j)) {
				flag = false;
				break;
			}
		}
	}
	if (flag) {
		cout << 0 << endl;
		return 0;
	}
	char search;
	int now = 0;
	int tmp = 0;
	int ans = INF;
	for (int i = 0; i < s.size(); i++) {
		search = s.at(i);
		for (int j = 0; j < s.size(); j++) {
			if (s.at(j) == search) {
				tmp = max(tmp, now);
				now = 0;
			}
			else {
				now++;
			}
		}
		tmp = max(tmp, now);
		ans = min(ans, tmp);
		now = 0;
		tmp = 0;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int L;
vector < pair < pair < int, int >, int > > gr;

int main() {
	scanf("%d", &L);
	int lg = 0;
	while ((1 << (lg + 1)) <= L) lg++;
	for (int i = 1; i <= lg; i++) {
		gr.push_back({{i, i + 1}, (1 << (i - 1))});
		gr.push_back({{i, i + 1}, 0});
	}
	L -= (1 << lg);
	int cur = (1 << lg);
	for (int i = lg; i >= 1; i--) {
		if ((L >> (i - 1)) & 1) {
			gr.push_back({{i, lg + 1}, cur});
			cur += (1 << (i - 1));
		}
	}
	cout << lg + 1 << ' ' << (int)gr.size() << endl;
	for (int i = 0; i < (int)gr.size(); i++) {
		cout << gr[i].first.first << ' ' << gr[i].first.second << ' ' << gr[i].second << '\n';
	}
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n;
double a,b,ans;
int main(){
	cin>>n;
	rep(i,n){
		scanf("%lf:%lf",&a,&b);
		ans=min(abs(((a*60+b)*0.5 )-b*6),360-abs(((a*60+b)*0.5 )-b*6));
		if(0<=ans&&ans<30.0){cout<<"alert"<<endl;}
		else if(90.0<=ans&&ans<=180.0){cout<<"safe"<<endl;}
		else{cout<<"warning"<<endl;}
	}
}

Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#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,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a <= b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first; printf("\n"); }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first; printf(" "); put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first; printf("\n"); putn(rest...); }

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) {
		cin >> a[i];
	}
	double res = 0;
	REP(i, n) {
		res += (double)1 / a[i];
	}
	res = 1 / res;
	cout << setprecision(20) << res << endl;
	return 0;
}

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

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

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

    ll dif = 100000000000;
    ll count = 0;
    rep(i, n - 1){
        count += a[i];
        dif = min(ll(abs(double(sum) / 2.0 - count) * 2), dif);
    }

    cout << dif << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mod 1000000007
#define MAX  1e18
#define ss 1e15
#define pb push_back

lli gives(int n, int k){
    int val = n;
    for(int i=0;i<100000;i++){
        if(val >= k)return i;
        val = val * 2;
    }
}

int main() {
    double n,k;
    cin>>n>>k;
    double ans=0.0;
    for(int i=1;i<=n;i++){
        lli p = gives(i,k);
        lli pq = pow(2,p);
        ans = ans + double(1.0/pq);
    }
    ans = (1.0*ans)/n;
    cout<<fixed<<setprecision(15)<<ans<<"\n";    
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
# define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
//mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1000000007;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef map<int, int> mii;
typedef set<int> si;
typedef queue<int> qi;


const int N = 2e5 + 5;



void solve() {

	int n;
	cin >> n;
	vi a;
	for (int i = 2; i * i <= n; i++) {
		if (n % i)
			continue;
		int cnt = 0;
		while (n % i == 0)
			n /= i, cnt++;
		a.pb(cnt);
	}
	if (n > 1)
		a.pb(1);
	int ans = 0;
	trav(t, a) {
		int x = 1, cnt = 1;
		while (x + cnt + 1 <= t)
			x += cnt + 1, cnt++;
		ans += cnt;
	}
	cout << ans;

}


signed main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout << fixed << setprecision(15);
	int t = 1;
	//cin >> t;

	while (t--)
		solve();
#ifdef aa
	cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


int norm(int a) {
	while (a >= mod) a -= mod;
	while (a < 0) a += mod;
	return a;
}

int powm(int a, int b) {
	int res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}


int divide(int a, int b) {
	return (a % mod) * powm(b, mod - 2) % mod;
}


Measured memory_bytes: 3576
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll a,b,x;
	scanf("%lld%lld%lld",&a,&b,&x);
	puts(a<=x&&x<=a+b?"YES":"NO");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vi=vector<int>;

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

//pow(llpow,modpow)
template<class T> ll llpow(T x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
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;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int main(){
    ll n,a,b;
    cin>>n>>a>>b;
    ll sum=a+b;
    cout<<n/sum*a+((n%sum>=a)?a:(n%sum))<<endl;
    return 0;
}




Measured memory_bytes: 384
#include<iostream>
#include<stdio.h>
#include<string>
#include <algorithm>
#include<cstring>
using namespace std;

//substrやreplaceはa番目からbつ分みたいな感じで表記する
//問題文はa個目からb個目までという表記だから関数に合わせて書き換える

int main()
{
  string str;
  int q;
  cin>>str;
  cin>>q;
  string order;
  int a,b;
  string ans;

  for(int i=0;i<q;i++){
    cin>>order>>a>>b;
    if(order=="print"){
      ans=str.substr(a,b-a+1);
      cout<<ans<<endl;
    }
    if(order=="reverse"){
      string re=str.substr(a,b-a+1);
      reverse(re.begin(),re.end());
      str.replace(a,b-a+1,re);
    }
    if(order=="replace"){
      string moji;
      cin>>moji;
      str.replace(a,b-a+1,moji);
        }
    //cout<<str<<endl;
  }
  return 0;
}      



Measured memory_bytes: 3172
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private static final int INF = Integer.MAX_VALUE / 2;

    private int A, B, C, D, E, F;

    private void solve(Scanner sc) {
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        D = sc.nextInt();
        E = sc.nextInt();
        F = sc.nextInt();

        Set<Integer> water = new HashSet<>();
        for (int i = 0; 100 * i * A <= F; ++i) {
            for (int j = 0; 100 * j * B <= F; ++j) {
                if (100 * i * A + 100 * j * B <= F) {
                    water.add(100 * i * A + 100 * j * B);
                }
            }
        }
        Set<Integer> sugar = new HashSet<>();
        for (int i = 0; i * C <= F; ++i) {
            for (int j = 0; j * D <= F; ++j) {
                if (i * C + j * D <= F) {
                    sugar.add(i * C + j * D);
                }
            }
        }
        int ans1 = 0, ans2 = 0;
        for (int w : water) {
            for (int s : sugar) {
                if (w + s <= F && 100 * s <= w * E && (ans1 + ans2) * s >= ans2 * (w + s)) {
                    ans1 = w;
                    ans2 = s;
                }
            }
        }

        _out.println((ans1 + ans2) + " " + ans2);
    }
    private boolean okW(int a, int A, int B) {
        for (int i = 0; 100 * A * i <= a; ++i) {
            for (int j = 0; 100 * B * j <= a; ++j) {
                if (a == 100 * A * i + 100 * B * j) {
                    return true;
                }
            }
        }
        return false;
    }
    private boolean okS(int b, int C, int D) {
        for (int i = 0; C * i <= b; ++i) {
            for (int j = 0; D * j <= b; ++j) {
                if (b == C * i + D * j) {
                    return true;
                }
            }
        }
        return false;
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23492
n = int(input())
a,b = map(int,input().split())
l = list(map(int,input().split()))

x,y,z=0,0,0
for i in l:
    if i<=a: x+=1
    elif i >=b+1: z+=1
    else: y+=1

print(min(x,y,z))

Measured memory_bytes: 8928
def show(nums):
    print(" ".join(list(map(str, nums))))


def insertion_sort(nums):
    show(nums)
    for i in range(1, len(nums)):
        v = nums[i]
        j = i - 1
        while j >= 0 and nums[j] > v:
            nums[j + 1] = nums[j]
            j -= 1
        nums[j + 1] = v
        show(nums)


N = int(input())
A = list(map(int, input().split()))
insertion_sort(A)



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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

using ll = long long;
using P = pair<int, int>;

int q;
vector<int> a, b, c, d;
ll res = INT_MIN;

void dfs(vector<int> &A, int n, int m) {
  if (A.size() == n) {
    ll sum = 0;
    rep(i, q) {
      if (A[b[i]] - A[a[i]] == c[i]) {
        sum += d[i];
      }
    }
    res = max(res, sum);
    return;
  }
  int last = A.empty() ? 1 : A[A.size() - 1];
  for (int i = last; i <= m; i++) {
    A.push_back(i);
    dfs(A, n, m);
    A.pop_back();
  }
}

int main() {
  int n, m;
  cin >> n >> m >> q;
  a = vector<int>(q), b = vector<int>(q), c = vector<int>(q), d = vector<int>(q);
  rep(i, q) {
    int aa, bb, cc, dd;
    cin >> aa >> bb >> cc >> dd;
    aa--;
    bb--;
    a.at(i) = aa;
    b.at(i) = bb;
    c.at(i) = cc;
    d.at(i) = dd;
  }
  vector<int> v = vector<int>();
  dfs(v, n, m);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

bool comp(char x, char y) {
  if (x > y) return true;
  else return false;
}
int main() {
  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), comp);

  bool ok = true;
  int index = 0;
  while (index < s.size()) {
    if (s[index] == t[index]) {
      ++index;
      continue;
    }
    if (s[index] > t[index]) ok = false;
    break;
  }

  if (index == s.size() && s.size() >= t.size()) {
    ok = false;
  }

  if (ok) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }


  return 0;
}


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


int main(void){
  int N, M;
  cin >> N >> M;
  vector<int> a(M*2);
  for(int i=0; i<M*2; i++) cin >> a[i];
  
  int j = 0;
  sort((a).begin(), (a).end());
  for(int i=1; i<=N; i++){
    int count = 0;
    while(a[j] == i){
      count++;
      j++;
    }//while
    cout << count << "\n";
  }//for
 
}


Measured memory_bytes: 3604
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,ans=1,a[100001],before[100001],after[100001];
int main(){
	scanf("%d",&n);
	for(register int i=1;i<=n;i++)scanf("%d",&a[i]);
	before[1]=a[1];
	after[n]=a[n];
	for(register int i=2;i<=n;i++)before[i]=__gcd(before[i-1],a[i]);
	for(register int i=n-1;i;i--)after[i]=__gcd(after[i+1],a[i]);
	for(register int i=2;i<n;i++)ans=max(__gcd(before[i-1],after[i+1]),ans);
	printf("%d",max(ans,max(after[2],before[n-1])));
}

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

int main()
{
	int A, B, C;
	int Times = 0;
	cin >> A >> B >> C;
	for(int i = 0; i < C; ++i)
	{
			if(B >= A)
			{
				B -= A;
				Times += 1;
			}
	}
	cout << Times << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  string S;
  cin >> S;
  if (S == "SUN") {
    COUT(7);
  }
  if (S == "MON") {
    COUT(6);
  }
  if (S == "TUE") {
    COUT(5);
  }
  if (S == "WED") {
    COUT(4);
  }
  if (S == "THU") {
    COUT(3);
  }
  if (S == "FRI") {
    COUT(2);
  }
  if (S == "SAT") {
    COUT(1);
  }
  return 0;
}

Measured memory_bytes: 256
S = input()[::-1]
n = len(S)
count = 0
flag = True

while count<n:
    if S[count:count+5] == "dream"[::-1]:
        count += 5
    elif S[count:count+7] == "dreamer"[::-1]:
        count += 7
    elif S[count:count+5] == "erase"[::-1]:
        count += 5
    elif S[count:count+6] == "eraser"[::-1]:
        count += 6
    else:
        flag = False
        break

print("YES") if flag else print("NO")

Measured memory_bytes: 40432
//32
#include<iostream>
#include<cmath>

using namespace std;

double mem[100001];

int main(){
  for(int i=1;i<=100000;i++){
    double p=1,cmp=0,cp=1;
    for(int j=0;j<min(i,1000);j++){
      mem[i]+=p;
      if(i-j-1>0){
	mem[i]+=cmp*mem[i-j-1];
      }
      cp/=2;
      cmp=p*(1-cp);
      p*=cp;
    }
  }
  for(int n;cin>>n,n;){
    cout<<fixed<<mem[n]<<endl;
  }
  return 0;
}
  

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

int main(){
    int n;
    cin>>n;
    vector<int> a(7);
    a[6] = 1;
    a[5] = 2;
    a[4] = 4;
    a[3] = 8;
    a[2] = 16;
    a[1] = 32;
    a[0] = 64;
    for(int i=0; i<7; i++) {
        if(n>=a[i]) {
            cout<<a[i];
            break;
        }
    }
}

Measured memory_bytes: 256