akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <time.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;
using std::next_permutation;
using std::lower_bound;

long long max(long long a, long long b)
{
    if (a > b)
        return a;
    return b;
}
long long min(long long a, long long b)
{
    if (a > b)
        return b;
    return a;
}
typedef long long ll;
typedef pair<long long, long long> pii;
typedef pair<ll, ll> pll;

namespace MySpace{

};

#define forn(i, n) for (long long (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define int long long
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
ll n, m;
ll a[500000];
ll b[500000];
ll ans = 0;
ll dp[2300][2300];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b[i];
    }
    dp[0][0] = 1;
    for (int i = 0; i <= n; i++)
        dp[i][0] = 1;
    for (int i = 0; i <= m; i++)
        dp[0][i] = 1;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (a[i - 1] == b[j - 1])
                dp[i][j] = dp[i][j - 1] + dp[i - 1][j];
            else
                dp[i][j] = dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1];
            dp[i][j] += MOD;
            dp[i][j] %= MOD;
        }
    }
    cout << dp[n][m] << endl;
}

Measured memory_bytes: 41216
#include <iostream>
using namespace std;
int main(void){
        int a,b;
        char op;
        cin>>a>>op>>b;
        while(true){
            if(op=='?') {
            break;
            }
         if(op=='+'){
            cout<<(a+b)<<endl;
         }
         else if(op=='-'){
            cout<<(a-b)<<endl;
         }
         else if(op=='*'){
            cout<<(a*b)<<endl;
         }
         else if(op=='/'){
            cout<<(a/b)<<endl;
         }
        cin>>a>>op>>b;
        }
    }




Measured memory_bytes: 3100
//https://atcoder.jp/contests/abc110/tasks/abc110_d
//D - Factorization
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
constexpr ll MOD=1e9+7;
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
template< typename T >
using Matrix = vector< vector< T > >;

//n=5000だと
//first{2,5} second{3,4} -> 5000=2^3*5^4
template< typename T >
std::pair<std::vector<T>, std::vector<T>> prime_factor_decomp(T n) {
    std::vector<T> p, e;
    T m = n;
    for (T i = 2; i * i <= n; i++) {
        if (m % i != 0) continue;
        T c = 0;
        while (m % i == 0) c++, m /= i;
        p.push_back(i);
        e.push_back(c);
    }
    if (m > 1) {
        p.push_back(m);
        e.push_back(1);
    }
    return std::make_pair(p, e); //直す?
}

int main() {
#if LOCAL&01
    std::ifstream in("./test/sample-2.in"); //input.txt
    std::cin.rdbuf(in.rdbuf());
#else
    cin.tie(0);
    ios::sync_with_stdio(false);
#endif
    ll N, M; cin>>N>>M;    
    auto pfd = prime_factor_decomp(M);
    ll ans=1;
    for(const auto& a:pfd.second){
        Matrix<ll>  dp(N+2,vector<ll>(a+2)); //dp[i][j],i番目にj個ある
        FOR(i,0,N+1){
            dp[i][0]=1;
        }
        REP(i,N){
            FOR(j,1,a+1){
                if (j-a-1>=0){
                    dp[i+1][j]=(dp[i][j]+dp[i+1][j-1]-dp[i][j-a-1]+MOD)%MOD;
                }else{
                    dp[i+1][j]=(dp[i][j]+dp[i+1][j-1])%MOD;
                }
            }
        }
        dump(dp[N][a]);
        ans = ans*dp[N][a]%MOD;
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> R;
  for(int i = 0; i < N; ++i){
    int x, l;
    cin >> x >> l;
    R.emplace_back(l+x,x-l);
  }
  sort(R.begin(), R.end());
  int ans = 1, r = R[0].first;
  for(int i = 1; i < N; ++i){
    if(R[i].second >= r){
      ++ans;
      r = R[i].first;
    }
  }
  cout << ans << endl;
}


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

bool kaibun(string s) {
  int flag = false;
  string s_left, s_right;
  if (s.size() % 2 != 0) {
    int half_length = s.size() / 2;
    int center_right = s.size() / 2 + 1;
    s_left = s.substr(0, half_length);
    s_right = s.substr(center_right, half_length);
  } else {
    int half_length = s.size() / 2;
    int center = s.size() / 2 - 1;
    s_left = s.substr(0, half_length);
    s_right = s.substr(center + 1, half_length);
  }
  reverse(s_right.begin(), s_right.end());
  if (s_left == s_right)
    flag = true;
  return flag;
}

int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  int n = s.size();

  string s_1 = s.substr(0, (n - 1) / 2);
  string s_2 = s.substr((n + 3) / 2 - 1, (n - 1) / 2);

  if (kaibun(s) && kaibun(s_1) && kaibun(s_2))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1000000000;

int main() {
    ll N, D; cin >> N >> D;
    ll ans = 0;
    for (int i=0; i<N; i++){
        ll x, y;
        cin >> x >> y;
        if (x*x + y*y <= D*D)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
/*ex4_2
ryo_1129*/
#include<stdio.h>
#include<math.h>
//プロトタイプ宣言
double distance(int length_hour,int length_minute,double rad);

int main(void){
    //変数宣言
    int length_hour,length_minute,hour,minute;
    double radhour,radminute,rad,length;
    //入力
    scanf("%d %d %d %d",&length_hour,&length_minute,&hour,&minute);
    //演習率πを決める。
    const double PI = 3.14159265358979;
    //時針、分針を求める。
    radminute = 2*PI*minute/60;
    radhour = 2*PI*(hour*60+minute)/720;
    //角度の差を求める。cos(θ)=cos(-θ)に注意
    rad = radhour - radminute;
    //長さを求める。関数の呼び出し
    length = distance(length_hour,length_minute,rad);
    //出力
    printf("%.9f\n",length);
    return 0;
}
//時針と分針の長さと角度から端点間の長さを求める。引数、時針の長さ、分針の長さ、それらのなす角度
double distance(int length_hour,int length_minute,double rad){
    double length;//変数宣言
    //余弦定理を用いて端点間の長さを求める
    length = sqrt(pow(length_hour,2)+pow(length_minute,2)-2*length_hour*length_minute*cos(rad));
    // 端点間の長さを返す
    return length;
}

Measured memory_bytes: 2488
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		int n=sc.nextInt();
		int []a=new int [n];
		TreeMap<Integer,Integer>map=new TreeMap();
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt()*-1;
			map.put(a[i],0);
		}
		int id=1;
		for(int x:map.keySet())
			map.put(x,id++);
		FenwickTree tree=new FenwickTree(n);
		int ans=0;
		for(int i=0;i<n;i++) {
			int curr=tree.query(map.get(a[i]))+1;
			ans=Math.max(ans, curr);
			tree.update(map.get(a[i]), curr);
		}
		out.println(ans);
		out.close();

	}
	static class FenwickTree{
		int []bit;
		FenwickTree(int n){
			bit=new int [n+1];
		}
		void update(int idx,int v) {
			while(idx<bit.length) {
				bit[idx]=Math.max(bit[idx], v);
				idx+=(idx&-idx);
			}
		}
		int query(int idx) {
			int ans=0;
			while(idx>0) {
				ans=Math.max(ans, bit[idx]);
				idx-=(idx&-idx);
			}
			return ans;
		}
	}
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

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

		String nextLine() throws IOException {
			return br.readLine();
		}

		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

}

Measured memory_bytes: 46864
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++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 ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

ll lcm(ll a, ll b)
{
   return a / gcd(a, b) * b;
}

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

    int x = 0, y = 0;

    rep(i,n){
        if(a[i] % 4 == 0) y++;
        else if(a[i] % 2 == 0) x++;
    }

    if(n <= x + 2*y) cout << "Yes" << endl;
    else if(n == 2*y + 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=3005,INF=1<<29;
typedef string::const_iterator State;
vector<string> S(MAX);

int expr(int &when,int depth){
    
    if(S[when][depth]=='+'){
        int ret=0;
        for(;;){
            when++;
            if(when==S.size()||S[when].size()<=depth+1){
                when--;
                break;
            }
            ret+=expr(when,depth+1);
        }
        
        return ret;
    }else if(S[when][depth]=='*'){
        int ret=1;
        for(;;){
            when++;
            if(when==S.size()||S[when].size()<=depth+1){
                when--;
                break;
            }
            ret*=expr(when,depth+1);
        }
        
        return ret;
    }else{
        return int(S[when][depth]-'0');
    }
}

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
        S.resize(N);
        for(int i=0;i<N;i++){
            cin>>S[i];
        }
        int a=0;
        cout<<expr(a,0)<<endl;
    }
}



Measured memory_bytes: 3248
#include<bits/stdc++.h>
using namespace std;
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define PB push_back
#define F first
#define S second


int n,m;
int l[200000],r[200000];

signed main(){
  cin>>n>>m;
  vector<P> v(m);
  rep(i,m){
    int x,y;
    cin>>x>>y;
    y--;
    v[i]=P(x,y);
  }

  rep(i,n){
    l[i]=i;
    r[i]=i;
  }

  sort(all(v));

  rep(i,m){
    int x=v[i].S;
    r[x]=r[x+1];
    l[x+1]=l[x];
  }

  rep(i,n){
    if(i) cout<<' ';
    cout<<r[i]-l[i]+1;
  }
  cout<<endl;

}



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

int triangle(int a, int b, int c){
  int max;
  if(a<b) max = b;
  else max = a;
  if(max<c) max = c;
  if(max >= a + b + c - max) return 0;
  int sqsum = a*a + b*b + c*c, sqmax = max*max;
  if(sqmax == sqsum - sqmax){
    return 1;
  }else if(sqmax < sqsum - sqmax){
    return 2;
  }
  return 3;
}

int main(){
  int tri[3]={};
  while(1){
    int a, b, c, ans;
    cin>>a>>b>>c;
    ans = triangle(a, b, c);
    if(!ans) break;
    tri[ans-1]++;
  }
  cout<<tri[0]+tri[1]+tri[2]<<" "<<tri[0]<<" "<<tri[1]<<" "<<tri[2]<<endl;
  return 0;
}



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

using namespace std;

const int N = 1e5 + 10;

int n, m;
char s[N], t[N];
map<long long, char> Map;

int main()
{
	scanf("%d%d", &n, &m);
	scanf("%s", s + 1);
	scanf("%s", t + 1);
	if(s[1] != t[1])
	{
		puts("-1");
		return 0;
	}
	if(n % m == 0)
	{
		int flag = 1;
		for(int i = 1; i <= m; i++)
			if(t[i] != s[1ll * (i - 1) * n / m + 1])flag = 0;
		if(!flag)
		{
			puts("-1");
		}
		else printf("%d\n", n);
		return 0;
	}
	if(m % n == 0)
	{
		int flag = 1;
		for(int i = 1; i <= n; i++)
			if(s[i] != t[1ll * (i - 1) * m / n + 1])flag = 0;
		if(!flag) 	
		{
			puts("-1");
		}
		else printf("%d\n", m);
		return 0;
	}
	long long nowans = 1ll * n * m / __gcd(n, m);
	for(int i = 1; i <= n; i++)
		Map[1ll * (i - 1) * (nowans / n) + 1] = s[i];
	for(int i = 1; i <= m; i++)
	{
		long long nowx = 1ll * (i - 1) * (nowans / m) + 1;
		if(Map.find(nowx) != Map.end())
		{
			if(t[i] != Map[nowx])
			{
				puts("-1");
				return 0;
			}
		}
	}
	printf("%lld\n", nowans);
}

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


int main(void) {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(i, h) {
    cin >> a[i];
  }

  rep(i, w + 2) cout << '#';
  cout << endl;

  rep(i, h) {
    cout << '#' << a[i] << '#' << endl;
  }


  rep(i, w + 2) cout << '#';
  cout << endl;

  return 0;
}

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

int comp(const void *a, const void *b){
	return *(int*)b - *(int*)a;
}

int main(void){
	int n, k;
	int *h;
	scanf("%d %d", &n, &k);
	h = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++)
		scanf("%d", h + i);
	qsort(h, n, sizeof(int), comp);
	int min = h[0];
	for(int i = 0; i < n - k + 1; i++)
		if(min > h[i] - h[i + k - 1])min = h[i] - h[i + k- 1];
	printf("%d\n", min);
	return 0;
}


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

int main() {
	string n;
	cin >> n;
	if (n[0] == '7' || n[1] == '7' || n[2] == '7'){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
		
	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int N, K;
    cin >> N >> K;
    int64_t sum = 0;
    for (int i=0; i<N; i++) {
        int x;
        cin >> x;
        sum += min(2 * x, abs(K-x) * 2);
    }

    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
/*****************
D - Lunlun Number
****************/

#include <iostream>
#include <string>
#include <queue>
using namespace std;
string bfs(int k);

int main()
{
	int k;
	while(cin >> k)
		cout << bfs(k) << endl;
	return 0;
}

string bfs(int k)
{
	string ans = "";
	if(k < 10){
		char ch = k + '0';
		ans = ans + string(1,ch);
		return ans;
	}	
	queue<string> q;	
	for(int i = 1;i <= 9;i++){
		char ch = i + '0';
		q.push(string(1,ch));		
	} 
	int tot = 9; 
	while(!q.empty()){
		string s = q.front();
		q.pop();
		int ng = s[s.length() - 1] - '0';	
		int a[] = {-1,0,1}; 
		for(int i = 0;i < 3;i++){
			int t = ng + a[i];
			if(t < 0 || t > 9)
				continue;
			ans = s + string(1,t + '0');
			tot++;
			if(tot == k)
				return ans;
			q.push(ans);	
		}
	}
	return ans;
}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;

int main()
{
	ll n,sum=0,ans=1,k=1;
	cin>>n;
	while(n!=1)
	{
		n/=2;
		sum++;
	}
	for(ll i=0;i<sum;i++)
	{
		k*=2;
		ans+=k;
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	char s[n+1];
	cin >> s;
	int count = 0;
	for(int i = 0; s[i] != '\0'; i++){
		if(s[i] == 'R'){
			count++;
		}
	}
	if(count > (n - count)){
			cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

struct TWO{
    long long int a,b;
};

bool cmp(TWO x,TWO y){
    if(x.a!=y.a){
        return x.a<y.a;
    }else{
        return x.b<y.b;
    }
}

int main() {
    const long long int mod = 1000000007,INF=50000000000000;
    typedef pair<long long int,long long int>P;
	map<long long int, long long int>mp;
    priority_queue<P,vector<P>,greater<P> >mazuisushi;
    
    priority_queue<P>umaisushi;
	cout << fixed << setprecision(10);
    string str;
    long long int h,w,n;
    long long int a[100003],b[100003],tmp=0,fin[10]={};
    TWO num[999999];
    cin>>h>>w>>n;
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        for(int j=-1;j<=1;j++){
            for(int k=-1;k<=1;k++){
                if(2<=a[i]+k&&a[i]+k<=h-1&&2<=b[i]+j&&b[i]+j<=w-1){
                num[tmp].a=a[i]+k;
                num[tmp].b=b[i]+j;
                tmp++;
                }
            }
        }
    }
    sort(num,num+tmp,cmp);
    long long int count=1;
    for(int i=1;i<tmp;i++){
        if(num[i].a==num[i-1].a&&num[i].b==num[i-1].b){
            count++;
        }else{
            fin[count]++;
            count=1;
        }
    }
    if(tmp>0)fin[count]++;
    fin[0]=(h-2)*(w-2);
    for(int i=1;i<=9;i++){
        fin[0]-=fin[i];
    }
    cout<<fin[0]<<endl;
    for(int i=1;i<=9;i++){
        cout<<fin[i]<<endl;
    }
} 


Measured memory_bytes: 17280
a,b,c,x,y=map(int,input().split())

c *= 2

MIN=10**9

tmp = a*x + b*y
if tmp < MIN: MIN=tmp
  
if x <= y:
  tmp = c*x + (y-x)*b
  if tmp < MIN: MIN=tmp

else:
  tmp = c*y + (x - y)*a
  if tmp < MIN: MIN=tmp

tmp = c*max(x,y)
if tmp < MIN: MIN=tmp
  
print(MIN)

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  string S;
  cin >> N;
  cin >> S;
  string A = "abcdefghijklmnopqrstuvwxyz";
  int B[A.size()] = {0};

  for(int i=0; i<N; i++){
    for(int j=0; j<A.size(); j++){
      if(S[i] == A[j]){
        B[j]++;
      }
    }
  }
  long long count=1;
  int mod = 1e9 + 7;
  for(int i=0; i<A.size(); i++){
    if(B[i] > 0){
      count *= ((long long)B[i] + 1);
      count %= mod;
    }
  }
  int ans;
  
  ans = count-1;
  ans %= mod;
  cout << ans << endl;
  return 0;
}

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

int main() {
    
    int A, B, C, D;
    
    cin >> A;
    cin >> B;
    cin >> C;
    cin >> D;
    
    cout << ( ( A*B >= C*D ) ? A*B : C*D ) << endl;
    
    return 0;
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m = M) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int exp(int n, int k) {
  if (k == 0) return 1;
  if (k == 1) return n;
  int ax = exp(n, k / 2);
  ax = mod(ax * ax);
  if (k % 2) ax = mod(ax * n);
  return ax;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
//#define MULTIPLE_TEST_CASE
void solution() {
  int a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--) solution();
}


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

#define N 100
#define min(a,b) (a>b?b:a)
#define INF 100000000

int main() {
	int n, m, s, g1, g2, b1, b2, c, ans;
	static int cost[N+1][N+1][N+1];
	while(1) {
		cin >> n >> m >> s >> g1 >> g2;
		if(!n&&!m&&!s&&!g1&&!g2) break;
		for(int i=1; i<=n; ++i) for(int j=1; j<=n; ++j) {
			for(int k=0; k<=n; ++k) cost[i][j][k] = (i==j?0:INF);
		}
		for(int i=0; i<m; ++i) {
			cin >> b1 >> b2 >> c;
			cost[b1][b2][0] = c;
		}
		for(int k=1; k<=n; ++k) {
			for(int i=1; i<=n; ++i) {
				for(int j=1; j<=n; ++j) {
					cost[i][j][k]= min(cost[i][j][k-1], cost[i][k][k-1]+cost[k][j][k-1]);
				}
			}
		}
		ans = INF;
		for(int i=1; i<=n; ++i) {
			ans = min(cost[s][i][n]+cost[i][g1][n]+cost[i][g2][n], ans);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 5148
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

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

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

    int m, d; cin>>m>>d;
    if(1 <= d && d <= 9){
        cout << 0 << endl;
        return 0;
    }

    int ans = 0;
    for(int i=1; i<=m; i++){
        for(int j=10; j<=d; j++){
            int d1 = (j % 10);
            int d10 = (j / 10) % 10;

            if(d1 >= 2 && d10 >= 2 && d1 * d10 == i) ans++;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

struct edge{int u,v,cost;};

int par[100000],rank[100000],V,E,n,m,a,b,d;
edge es[100000];

void init(int n){for(int i=0;i<n;i++){par[i]=i;rank[i]=0;}}
int find(int x){if(par[x]==x)return x;else return find(par[x]);}
void unite(int x,int y){x=find(x);y=find(y);if(x==y)return;if(rank[x]<rank[y])par[x]=y;else{par[y]=x;if(rank[x]==rank[y])rank[x]++;}}
bool same(int x,int y){return find(x)==find(y);}

bool comp(const edge e1,const edge e2){return e1.cost<e2.cost;}

int kruskal(){
	sort(es,es+E,comp);
	init(V);
	int res=0;
	for(int i=0;i<E;i++){
		edge e=es[i];
		if(!same(e.u,e.v)){
			unite(e.u,e.v);
			res+=e.cost;
		}
	}
	return res;
}

int main(){
	while(cin>>n>>m){
		char com;
		for(int i=0;i<m;i++){
			cin>>a>>com>>b>>com>>d;
			es[i].u=a;es[i].v=b;es[i].cost=d/100-1;
		}
		V=n;
		E=m;
		cout<<kruskal()<<endl;
	}
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
 
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a,ans,j,k,q,c;
    cin>>a;
    if(a<30) cout<<"No";
    else cout<<"Yes";
}

Measured memory_bytes: 3648
//Achen
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<vector>
#include<queue>
#include<cmath>
#define For(i,a,b) for(int i=(a);i<=(b);i++)
#define Rep(i,a,b) for(int i=(a);i>=(b);i--)
const int N=2e5+7; 
typedef long long LL;
using namespace std;
int n,m,ans;

template<typename T> void read(T &x) {
	T f=1; x=0; char ch=getchar();
	while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
	if(ch=='-') f=-1,ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0'; x*=f;
}

struct node {
	int l,r;
	friend bool operator <(const node&A,const node&B) {
		return A.r>B.r||(A.r==B.r&&A.l<B.l);
	}
}p[N];

#define lc x<<1
#define rc (x<<1|1)
#define mid ((l+r)>>1)
int sg[N<<2],lz[N<<2];
void build(int x,int l,int r) {
	if(l==r) { sg[x]=-l; return; }
	build(lc,l,mid); build(rc,mid+1,r);
	sg[x]=max(sg[lc],sg[rc]); 
}

void down(int x,int l_len,int r_len) {
	if(l_len) sg[lc]+=lz[x],lz[lc]+=lz[x];
	if(r_len) sg[rc]+=lz[x],lz[rc]+=lz[x];
	lz[x]=0;
}

int qry(int x,int l,int r,int ql,int qr) {
	if(ql>qr) return 0;
	if(l>=ql&&r<=qr) return sg[x];
	down(x,mid-l+1,r-mid);
	if(qr<=mid) return qry(lc,l,mid,ql,qr);
	if(ql>mid) return qry(rc,mid+1,r,ql,qr);
	return max(qry(lc,l,mid,ql,qr),qry(rc,mid+1,r,ql,qr)); 
}

void update(int x,int l,int r,int ql,int qr,int v) {
	if(l>=ql&&r<=qr) {
		sg[x]+=v; lz[x]+=v; return;
	} 
	down(x,mid-l+1,r-mid);
	if(ql<=mid) update(lc,l,mid,ql,qr,v);
	if(qr>mid) update(rc,mid+1,r,ql,qr,v);
	sg[x]=max(sg[lc],sg[rc]); 
}

int main() {
#ifdef DEBUG
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif
	read(n); read(m); int pp=0;
	For(i,1,n) {
		read(p[i].l); read(p[i].r);
		if(p[i].l==0&&p[i].r>m) pp++,i--,n--;
	}
	sort(p+1,p+n+1);
	build(1,1,m+1); 
	For(i,1,n) {
		update(1,1,m+1,p[i].l+1,m+1,1);
		ans=max(ans,sg[1]+1-(m-p[i].r+1));
	}
	ans=max(n-m,ans)+pp;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 7936
#include <iostream>
#include <cmath>

int main()
{
    int a, b;
    std::cin >> a >> b;

    bool possible = false;
    int original_price;
    int minimum_possible_price = 1;
    for (int i = 0; i < 1000 && !possible; ++i) {
        if (static_cast<int>((minimum_possible_price + i) * 0.08) == a &&
            static_cast<int>((minimum_possible_price + i) * 0.1) == b) {
            original_price = minimum_possible_price + i;
            possible = true;
        }
    }
    if (!possible) original_price = -1;
    std::cout << original_price << std::endl;

    return 0;
}

Measured memory_bytes: 384
// #include <bits/stdc++.h>
#include <map>
#include <set>
#include <ctime>
#include <cstring>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
 
#define mod 1000000007
#define INF 1000000000

#define pb push_back
#define mp make_pair
#define all(x) begin(x), end(x)
#define len(x) ((int)(x).size())
#define contains(a, x) (a.find(x) != end(a))
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define F(i,a,b) for(int i = (int)(a); i < (int)(b); ++i)
#define RF(i,a,b)for(int i = (int)(a); i >= (int)(b); --i)

typedef double dbl;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

#define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define log(x) cout << (x) << endl;


int pd[1001] = {0};
int b[1001] = {0};
void sieve() {
	pd[1] = 1;
	for (int i=2; i<=1000; ++i) if(!b[i]){
		pd[i] = i;
		for (int j=i*i; j<=1000; j+=i) {
			b[j] = 1;
			pd[j] = i;
		}
	}
}


int main() {
	fast();
	sieve();

	int n,x;
	cin>>n;
	map<int,int> p;

	F(i, 2, n+1) {
		x = i;
		while (x > 1) {
			p[pd[x]]++;
			x /= pd[x];
		}
	}

	ll r = 1;
	for (auto c: p) {
		r = ((r%mod) * (c.second+1)%mod) % mod;
	}

	log(r);

	return 0;
}




Measured memory_bytes: 256
w,h,n = map(int,input().split())

x1 = 0
x2 = w
y1 = 0
y2 = h

for _ in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        x1 = max(x1, x)
    elif a == 2:
        x2 = min(x2, x)
    elif a == 3:
        y1 = max(y1, y)
    else:
        y2 = min(y2, y)

if x2 - x1 > 0 and y2 - y1 > 0:
    print((x2-x1) * (y2-y1))
else:
    print(0)


Measured memory_bytes: 9000
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();
            int d = in.nextInt();
            int e = in.nextInt();
            int k = in.nextInt();

            System.out.println((e - a) > k ? ":(" : "Yay!");
        }
    }
}


Measured memory_bytes: 21972
#include<stdio.h>

int main()
{
	int A,B,K,num;
	scanf("%d %d %d",&A,&B,&K);
	if ( A > B ){
		num = B;
	} else {
		num = A;
	}

	while(1) {
		if ( ( A % num == 0 ) && ( B % num == 0 ) ) {
			K--;
		}
		if ( K == 0 ) break;
		num--;
	}

	printf("%d\n",num);
	return 0;
}

Measured memory_bytes: 128
import itertools

n, m = map(int, input().split())
ab = [list(map(lambda x:int(x)-1, input().split())) for _ in range(m)]

nodes = [i for i in range(n)]
ls = list(itertools.permutations(nodes))

ans = 0
for root in ls:
    if root[0] != 0:
        continue
    ok = 1
    for i in range(n-1):
        if list(root[i:i+2]) not in ab and list(reversed(list(root[i:i+2]))) not in ab:
            ok = 0
    if ok:
        ans += 1

print(ans)

Measured memory_bytes: 80468
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define Bit_check(val,pos)     (bool)(val & (1ll<<pos))
ll ar[500009],br[500009],cr[500009];
map<ll,ll>mp;
vector<ll>v;
int main()
{
    ll a,b,c,i,j,k=0,x=0,y,z,f;
    string s,d;
    cin>>a>>b>>c;
    ar[a]++;
    ar[b]++;
    ar[c]++;
    for(i=0;i<=10;i++)
    {
        if(ar[i]==2)
        {
            k=1;
            cout<<"Yes"<<endl;
            break;
        }
    }
    if(k==0)
    {
        cout<<"No"<<endl;
    }
}


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

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

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

template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typename T> bool chkmin(T &x,T y){return x>y?x=y,true:false;}

int readint(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int n,m,k;
int l[200005],r[200005],p[400005],c[400005];

void add(int x,int g){for(;x<=k;x+=(x&(-x))) c[x]+=g;}
int ask(int x){int ret=0; for(;x;x-=(x&(-x))) ret+=c[x]; return ret;}

int main(){
	n=readint(); m=readint();
	for(int i=1;i<=n;i++) l[i]=readint(),r[i]=readint(),p[2*i-1]=l[i],p[2*i]=r[i]+1;
	sort(p+1,p+n+n+1);
	k=unique(p+1,p+n+n+1)-p-1;
	for(int i=1;i<=n;i++) add(lower_bound(p+1,p+k+1,l[i])-p,1),add(lower_bound(p+1,p+k+1,r[i]+1)-p,-1);
	int lf=0,rg=0,maxa=0;
	for(int i=1;i<=k;i++){
		int tmp=ask(i);
		if(chkmax(maxa,tmp)) lf=p[i],rg=p[i+1]-1;
		else if(maxa==tmp) rg=p[i+1]-1;
	}
	if(maxa&1) printf("%lld\n",1ll*m*(maxa-1)+rg);
	else printf("%lld\n",1ll*m*(maxa-1)+m-lf);
	return 0;
}


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

using namespace std;

#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define pb emplace_back
#define ll long long
#define ld long double

const int INF = 2e9 + 1;
const ll INFLL = 1e18 + 1;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ld l;
    cin >> l;
    cout << fixed << setprecision(15) << (l / 3) * (l / 3) * (l / 3);
    return 0;
}


Measured memory_bytes: 3776
N = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)

d = N.times.map { -1 }

(a.size - 1).downto(0).each do |i|
  k = 2
  s = 0
  while (((i + 1) * k -1) < N)
    s += d[(i + 1) * k - 1]
    k += 1
  end
  
  if (s % 2 == a[i])
    d[i] = 0
  else
    d[i] = 1
  end
end

r = []
d.each.with_index do |dd, i|
  if dd == 1
    r << i + 1
  end
end
p r.size
if r.size > 0
  print r.join(" ")
end

Measured memory_bytes: 22468
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        List<int> x = Console.ReadLine().Split().Select(i => int.Parse(i)).ToList();
        List<int> y = new List<int>(x);
        y.Sort();

        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        for (int i = 0; i < x.Count; i++)
        {
            int ans = y[y.Count / 2 - 1];
            if (ans < x[i]) Console.WriteLine(ans);
            else Console.WriteLine(y[y.Count / 2]);
        }
        Console.Out.Flush();
    }
}

Measured memory_bytes: 34140
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
#define def 0
template<class V, int NV> struct SegTree { //[l,r)
    V comp(V& l, V& r) { return max(l, r); };
 
    vector<V> val; SegTree() { val = vector<V>(NV * 2, def); }
    V get(int x, int y, int l = 0, int r = NV, int k = 1) {
        if (r <= x || y <= l)return def; if (x <= l && r <= y)return val[k];
        auto a = get(x, y, l, (l + r) / 2, k * 2); 
        auto b = get(x, y, (l + r) / 2, r, k * 2 + 1);
        return comp(a, b);
    }
    void update(int i, V v) {
        i += NV; val[i] = v;
        while (i>1) i >>= 1, val[i] = comp(val[i * 2], val[i * 2 + 1]);
    }
    void add(int i, V v) { update(i, val[i + NV] + v); }
    V operator[](int x) { return get(x, x + 1); }
};
 
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 
 
 
 
 
 
 
 
 
 
int N, H[201010], A[201010];
SegTree<ll, 1 << 18> dp;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> H[i];
    rep(i, 0, N) cin >> A[i];
 
    rep(i, 0, N) {
        ll opt = dp.get(0, H[i]) + A[i];
        dp.update(H[i], opt);
    }
 
    cout << dp.get(0, 1<<18) << endl;
}

Measured memory_bytes: 5888
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
  
	var a = parseInt(tmp[0], 10);
	var b = parseInt(tmp[1], 10);

  	if(b >= a) console.log("unsafe")
  else console.log("safe");
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29552
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int a,z;
  a=0;
  z=0;
  bool flag = false;
  for(int i=0; i<s.size(); i++){
    if(s.at(i) == 'A' && !flag){
      flag = true;
      a = i;
    }
    if(s.at(i) == 'Z'){
      z = i;
    }
    //cout << ma << endl;
  }
  cout << z-a+1 << endl;
}

Measured memory_bytes: 640
from collections import deque
N,M=map(int,input().split())
ab=[[] for i in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  ab[a].append(b)
  ab[b].append(a)
ans=[-1]*(N+1)
que=deque([1])
while que:
  q=que.popleft()
  for i in ab[q]:
    if ans[i]==-1:
      que.append(i)
      ans[i]=q
print('Yes')
for i in range(2,N+1):
  print(ans[i])

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int N;
  ll T;
  cin >> N >> T;
  vector<ll> A(N);
  rep(i, N) cin >> A[i];

  ll max_val = -1;

  ll cnt = 0;
  ll max_gain = 0;

  for(int i = N-1; i >= 0; i--){
    if(A[i] > max_val){
      max_val = A[i];
    }else if(max_val - A[i] < max_gain){
      continue;
    }else if(max_val - A[i] == max_gain){
      cnt++;
    }else{
      max_gain = max_val - A[i];
      cnt = 1;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#define mod 1000000007
#define pb push_back
using namespace std;
typedef pair<int,int> pii;

typedef long long ll;
ll factx[22222];
ll factxx[22222];
ll xxcal(ll n, ll x){
  if(x==0) return 1;
  return x%2==0?xxcal((n*n)%mod,x/2):(n*xxcal(n,x-1)%mod);
}
ll ncr(ll n,ll r){
  if(n<r) return 0;
  ll a=factx[n];
  a*=factxx[r];   a%=mod;
  a*=factxx[n-r]; a%=mod;
  return a;
}

int main(){
  factx[0]=1;
  factxx[0]=xxcal(factx[0],mod-2);
  for(ll i=1;i<=2222;i++){
    factx[i]=i*factx[i-1]%mod;
    factxx[i]=xxcal(factx[i],mod-2);
  }

  long long int n,k;
 
  cin>>n>>k;
  
  for(int i=0;i<k;i++){
    cout<<(ncr(k-1,i)*ncr(n-k+1,i+1))%mod<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

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; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

ll dp[111][2][4];
string N;
int K;

ll rec(int k=0, bool tight=true, int non_zero = 0){
    if(non_zero > K) return 0;
    if(k == N.size()){
        return non_zero == K;
    }
    int x = N[k] - '0';
    int r = (tight ? x : 9);
    ll &res = dp[k][tight][non_zero];
    if(!tight && ~res) return res;
    res = 0;
    REP(i,r+1){
        res += rec(k+1, tight && i == r, (i != 0 ? non_zero + 1 : non_zero));
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    memset(dp, -1, sizeof(dp));
    cout << rec() << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    string S; cin >> S;
    cout << (S=="ABC" ? "ARC" : "ABC") << ln;
}

Measured memory_bytes: 3640
#include<cstdio>
unsigned answer[101] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 3, 8, 8, 11, 11, 11, 11, 14, 14, 32, 32, 35, 35, 35, 35, 42, 42, 42, 42, 49, 49, 49, 49, 49, 49, 75, 75, 86, 86, 86, 86, 86, 86, 123, 123, 131, 131, 131, 131, 148, 148, 153, 153, 170, 170, 170, 170, 170, 170, 227, 227, 227, 227, 227, 227, 250, 250, 323, 323, 324, 324, 324, 324, 354, 354, 354, 354, 384, 384, 384, 384, 384, 391, 491, 491, 529, 529, 529, 529, 529, 529, 543};

int main(){
    unsigned N;
    scanf("%u", &N);
    printf("%u\n", answer[N]);
    return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <queue>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> que;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    que.push(a);
  }

  for (int i = 0; i < m; ++i) {
    int v = que.top();
    que.pop();
    que.push(v/2);
  }

  long long ans = 0;
  while (!que.empty()) {
    ans += que.top();
    que.pop();
  }

  cout << ans << endl;
}

Measured memory_bytes: 3876
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,z;
    char ca,cb,cc;
    cin>>a>>b;
    if(b%a==0) cout<<a+b;
    else cout<<b-a;

    

    return 0;
}


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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> d(10,0);
    for(int i=0;i<k;i++){
        int t;
        cin>>t;
        d[t]++;
    }

    for(int i=n;;i++){
        int j=i;
        bool flag=true;
        while(j>0){
            int r=j%10;
            j/=10;
            if(d[r]){
                flag=false;
                break;
            }
        }
        if(flag){
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;

struct DSU
{
	int S;
	
	struct node
	{
		int p; ll sum;
	};
	vector<node> dsu;
	
	DSU(int n)
	{
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i; tmp.sum = 1;
			dsu.pb(tmp);
		}
	}
	
	void reset(int n)
	{
		dsu.clear();
		S = n;
		for(int i = 0; i < n; i++)
		{
			node tmp;
			tmp.p = i; tmp.sum = 1;
			dsu.pb(tmp);
		}
	}
	
	int rt(int u)
	{
		if(dsu[u].p == u) return u;
		dsu[u].p = rt(dsu[u].p);
		return dsu[u].p;
	}
	
	void merge(int u, int v)
	{
		u = rt(u); v = rt(v);
		if(u == v) return ;
		if(rand()&1) swap(u, v);
		dsu[v].p = u;
		dsu[u].sum += dsu[v].sum;
	}
	
	bool sameset(int u, int v)
	{
		if(rt(u) == rt(v)) return true;
		return false;
	}
	
	ll getstat(int u)
	{
		return dsu[rt(u)].sum;
	}
};
bool used[111111];
ll a[111111];
int cnt[111111];
vector<ii> V[111111];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	vector<ii> vec;
	for(int i=0;i<n;i++)
	{
		ll x; cin>>x; a[i]=x;
		vec.pb(mp(x,i));
	}
	DSU dsu(n);
	int cc = n;
	for(int i=0;i<m;i++)
	{
		int u,v; cin>>u>>v; 
		if(!dsu.sameset(u,v)) cc--;
		dsu.merge(u,v);
	}
	if(cc==1){cout<<0<<'\n'; return 0;}
	sort(vec.begin(),vec.end());
	int needed = (cc - 1)*2; ll ans = 0;
	for(int i=0;i<n;i++)
	{
		V[dsu.rt(i)].pb(mp(a[i],i));
	}
	for(int i=0;i<n;i++)
	{
		sort(V[i].begin(),V[i].end());
		if(!V[i].empty())
		{
			cnt[i]++; needed--;
			ans+=V[i][0].fi; used[V[i][0].se]=1;
		}
	}
	for(int z=0;z<n;z++)
	{
		int u=vec[z].se; if(used[u]) continue;
		int rt = dsu.rt(u);
		if(cnt[rt]+1>=cc) continue; if(needed==0) break;
		cnt[rt]++; ans+=a[u]; needed--;
	}
	if(needed>0) {cout<<"Impossible\n"; return 0;}
	cout<<ans<<'\n';
}


Measured memory_bytes: 11376
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int h,n;
  cin >> h >> n;
  int a[1000],b[1000];
  for (int i = 0; i < n; ++i)
  {
    cin >> a[i] >> b[i];
  }
  int dp[10001];
  memset(dp,0x3F,sizeof(dp));
  dp[0]=0;
  for (int i = 0; i < n; ++i)
  {
    for(int j=0;j<h;j++) {
      dp[min(a[i]+j,h)] = min(dp[min(a[i]+j,h)], dp[j]+b[i]);
    }
  }
  cout << dp[h];
}


Measured memory_bytes: 256
for v in range(5):
    n, k = map(int, input().split())
    if n == 0 and k == 0:
        break
    a = [int(input()) for i in range(n)]
    sum = []
    s = [0] * n

    for i in range(n-1):
        s[i+1] = s[i] + a[i]

    for i in range(n-k):
        sum.append(s[i+k] - s[i])

    print(max(sum))
    


Measured memory_bytes: 15356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int maxn = 2000 + 5;
int arr[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n; ll k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i)
		cin >> arr[i];
	ll res = 0;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (i == j)
				continue;
			if (arr[j] > arr[i]) {
				if (j < i)
					res = (res + (k * (k + 1) / 2) % mod) % mod;
				else
					res = (res + (k * (k - 1) / 2) % mod) % mod;
			}
		}
	}
	cout << res << '\n';
	return 0;
}

Measured memory_bytes: 256