akhauriyash/Code-Regression huggingface dataset:
// aribon4-4_d
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    vector<ll> X(N);
    REP(i, N) cin >> X[i];

    ll L;
    cin >> L;

    int tmp = 0;
    int log_n = (int)log2(N) + 1;
    vector<vector<int>> next(log_n+1, vector<int>(N+1, 0));
    REP(i, N){
        while (tmp < N-1 && X[tmp+1] - X[i] <= L) tmp++;
        next[0][i] = tmp;
    }
    next[0][N-1] = N;
    next[0][N] = N;

    REP(k, log_n){
        REP(i, N+1){
            next[k+1][i] = next[k][next[k][i]];
        }
    }

//    REP(k, log_n) print(1 << k, next[k]);

    int Q;
    cin >> Q;
    REP(i, Q){
        int a, b;
        cin >> a >> b; a--; b--;
        if (a > b) swap(a, b);

        int j = a;
        int ans = 0;
        REP_REV(k, log_n+1){
            if (next[k][j] <= b){
                j = next[k][j];
                ans += 1 << k;
            }
        }
        if (j < b) ans++;
        print(ans);
    }


    return 0;
}


Measured memory_bytes: 8696
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,d,x[10][10];
	cin>>n>>d;
	for(int i=0;i<n;i++)
		for(int j=0;j<d;j++)
			cin>>x[i][j];
	int ans=0;
	for(int i=1;i<n;i++){
		for(int j=0;j<i;j++){
			int sum=0;
			for(int k=0;k<d;k++)
				sum+=pow(x[i][k]-x[j][k],2);
			if(pow(int(sqrt(sum)),2)==sum)
				ans++;
		}
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 256
// Problem : A - We Love Golf
// Contest : AtCoder - AtCoder Beginner Contest 165
// URL : https://atcoder.jp/contests/abc165/tasks/abc165_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
ordered_set;	

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> para;
const ll inf = 1e18 + 7;
const ll maxN = 1e6 + 5;
const ll MOD = 1e9 + 7;

// sprawdz MODULO!
int main() {
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int k, a, b;
	cin >> k;
	cin >> a >> b;
	FOR(i, a, b) {
		if (i % k == 0) {
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
	return 0;
}
 


Measured memory_bytes: 3548
import itertools,sys
def S(): return sys.stdin.readline().rstrip()
A,B,C,D = [x for x in S()]
for op1,op2,op3 in itertools.product(['+','-'],repeat=3):
    ans = A+op1+B+op2+C+op3+D
    if eval(ans)==7:
        print(*[ans,'=7'],sep='')
        break


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;

int main(void){
    // Your code here!
    string s;
    cin>>s;
    ll dp[s.length()+5][4];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    
    for(ll i=0;i<s.length();i++){
        for(ll j=0;j<4;j++){
            if(s[i]!='?')dp[i+1][j] = (dp[i][j]+dp[i+1][j])%MOD;
            else dp[i+1][j] = (dp[i+1][j]+dp[i][j]*3)%MOD;
        }
        if(s[i]=='A'||s[i]=='?')dp[i+1][1] = (dp[i+1][1]+dp[i][0])%MOD;
        if(s[i]=='B'||s[i]=='?')dp[i+1][2] = (dp[i+1][2]+dp[i][1])%MOD;
        if(s[i]=='C'||s[i]=='?')dp[i+1][3] = (dp[i+1][3]+dp[i][2])%MOD;
    }
    cout<<dp[s.length()][3];
}


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

int main(){
    int n;
    string answer;
    cin >> n;
    map<int, int> mp;
    vector<int> num(0);
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(mp[a] == 0)num.push_back(a);
        mp[a]++;
    }
    
    if(num.size() == 3){
        if(mp[num.at(0)] != mp[num.at(1)] || mp[num.at(1)] != mp[num.at(2)]){
            answer = "No";
        }else if(num.at(0) != (num.at(1) ^ num.at(2))){
            answer = "No";
        }else{
            answer = "Yes";
        }
    }else if(num.size() == 2){
        if(num.at(0) == 0){
            if(mp[0] * 2 == mp[num.at(1)]){
                answer = "Yes";
            }else{
                answer = "No";
            }
        }else if(num.at(1) == 0){
            if(mp[num.at(0)] == mp[0] * 2){
                answer = "Yes";
            }else{
                answer = "No";
            }
        }else answer = "No";
    }else if(num.size() == 1){
        if(num.at(0) == 0)answer = "Yes";
        else answer = "No";
    }else{
        answer = "No";
    }
    
    cout << answer << endl;
    
}

Measured memory_bytes: 4216
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
   int n;
  scanf("%d",&n);
  int a[n],i;
  for(i=0;i<n;++i)
      scanf("%d",&a[i]);
  
  int cnt=0;
  for(i=1;i<n-1;++i)
  {
    if(a[i]>a[i-1] && a[i]<a[i+1])
        cnt++;
    
    else if(a[i]>a[i+1] && a[i]<a[i-1])
        cnt++;
  }
  
  printf("%d",cnt);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
  int a, b, c;
  int tmp;
  scanf("%d %d %d",&a, &b, &c);
  if ( b > a ) {
    tmp = a;
    a = b;
    b = tmp;
  }
  if ( c <= a && c >= b) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>                                                                                               
using namespace std;
 
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define int long long
#define mk_p(a,b)   make_pair((a),(b))
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;

vector<pair<double,int> > a;
signed main(){
    int n;
    cin >> n;
    double avg = 0,x;
    rep(i,n){
        cin >> x;
        avg += x;
        a.push_back(mk_p(x,i));
    }   
    avg /= n;
    rep(i,n){
        a[i].first = abs(avg - a[i].first);
    }   
    sort(all(a));
    cout << a[0].second << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long a,b,c,d,cd,nc,nd,ncd;
long long gcd(long long x,long long y){return y?gcd(y,x%y):x;}
long long lcm(long long x,long long y){return x*y/gcd(x,y);}
int main(){
    cin>>a>>b>>c>>d;
    nc=b/c-(a-1)/c;
    nd=b/d-(a-1)/d;
    cd=lcm(c,d);
    ncd=b/cd-(a-1)/cd;
    cout<<b-a+1-nc-nd+ncd<<endl;
    return 0;
}

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

int main(){
  int n,ans=0,cnt=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin >> a[i];
  for(int i=0;i<n-1;i++){
    if(a[i]>=a[i+1])cnt++;
    else{
      ans=max(ans,cnt);
      cnt=0;
    }
  }  
  ans=max(ans,cnt);
  cout << ans << endl;
}


Measured memory_bytes: 3684
#include <stdio.h>
int main(void)
{
int a, b;
char x;

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

if(x != '?'){
while(x != '?'){
if(x == '+')
printf("%d\n",a + b);
if(x == '-')
printf("%d\n",a - b);
if(x == '*')
printf("%d\n",a * b);
if(x == '/')
printf("%d\n",a / b);

scanf("%d %c %d",&a,&x,&b);
}
}
return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	long long n, w, ans = 0;
	cin >> n >> w;
	vector<vector<long long>> a(4, vector<long long>(1));
	long long x, y, w1;
	cin >> w1 >> y;
	a[0].push_back(y);
	for(int i = 1; i < n; i++){
		cin >> x >> y;
		a[x - w1].push_back(y);
	}
	for(int i = 0; i < 4; i++){
		sort(a[i].begin() + 1, a[i].end(), greater<long long>());
	}
	for(int i = 0; i < 4; i++){
		for(int j = 1; j < a[i].size(); j++){
			a[i][j] = a[i][j] + a[i][j - 1];
		}
	}
	for(int i = 0; i < a[0].size(); i++){
		long long w2 = w - i * w1;
		if(w2 < 0) break;
		for(int j = 0; j < a[1].size(); j++){
			long long w3 = w2 - j * (w1 + 1);
			if(w3 < 0) break;
			for(int k = 0; k < a[2].size(); k++){
				long long w4 = w3 - k * (w1 + 2);
				if(w4 < 0) break;
				ans = max(ans, a[0][i] + a[1][j] + a[2][k] + a[3][min(w4 / (w1 + 3), (long long)(a[3].size() - 1))]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cstring>
#include<algorithm>
#include<cmath>


using namespace std;
int main(void){
    
    
    int a,b;
    
    cin>>a>>b;
    string aa,bb;
    
    for(int i=0;i<b;i++){
        char t='0'+a;
        aa=aa+t;
    }
    for(int i=0;i<a;i++){
        char t='0'+b;
        bb=bb+t;
    }
    if(aa<=bb)cout<<aa<<endl;
    else cout<<bb<<endl;
    
    return 0;
    
}


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

int n[6];
int main() {
  while(cin>>n[0]>>n[1]>>n[2]>>n[3]>>n[4]>>n[5]
	&&  (n[0]||n[1]||n[2]||n[3]||n[4]||n[5])) {
    for(int i = 0; i < 3; ++i) n[i] += n[i+3];
    int ans = 0;
    for(int t = 0; t < 3; ++t) {
      if(min(min(n[0],n[1]),n[2]) < t) break;
      ans = max(ans, t + (n[0]-t)/3 + (n[1]-t)/3 + (n[2]-t)/3);
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<tuple>
#include<map>
#include<set>
#include<algorithm>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{int from, to; ll cost;};

signed main(){
	int n;
	string s;
	cin >> n >> s;
	bool sb[n];
	rep(n){
		sb[i] = (s[i] == 'o');
	}
	bool sheep[n], flag = false;
	rep(4){
		sheep[0] = (i >= 2);
		sheep[1] = (i % 2 == 0);
		reppp(j, 1, n-1){
			int jj = (j+1 >= n) ? 0 : j+1;
			if(s[j] == 'o'){
				if(sheep[j]) sheep[jj] = sheep[j-1];
				else sheep[jj] = sheep[j-1] ^ true;
			}else{
				if(sheep[j]) sheep[jj] = sheep[j-1] ^ true;
				else sheep[jj] = sheep[j-1];
			}
		}
		if(((s[0] == 'x' ^ sheep[0]) ^ (sheep[n-1] != sheep[1])) && sheep[0] == (i>=2)){
			flag = true;
			break;
		}
	}
	
	if(flag){
		string ans;
		rep(n){
			if(sheep[i]) ans += 'S';
			else ans += 'W';
		}
		cout << ans;
	}else{
		cout << -1;
	}
}


Measured memory_bytes: 896
s = input()
if int(s[0:4]) < 2019:
    print("Heisei")
elif int(s[0:4]) == 2019 and int(s[5:7]) < 4:
    print("Heisei")
elif int(s[0:4]) == 2019 and int(s[5:7]) == 4 and int(s[8:10]) <= 30:
    print("Heisei")
else:
    print("TBD")

Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val h = sc.nextInt()
    val w = sc.nextInt()
    val a = (0 until h).map { sc.next() }
    println(problem049b(h, w, a))
}

fun problem049b(h: Int, w: Int, a: List<String>): String {
    var ans = ""
    for (i in 0 until h) {
        ans += a[i] + "\n" + a[i] + "\n"
    }
    return ans
}

Measured memory_bytes: 36384
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

struct UnionFind{
private:
    vector<int> par;
    vector<int> siz;
public:
    void init(int N){
        par.resize(N);
        siz.resize(N);
        for(int i=0; i<N; i++) par[i] = i;
        for(int i=0; i<N; i++) siz[i] = 1;
    }
    void unite(int a, int b){
        int rootA = root(a);
        int rootB = root(b);
        if(rootA == rootB) return;
        if(siz[rootA] < siz[rootB]) swap(rootA, rootB);
        par[rootB] = rootA;
        siz[rootA] += siz[rootB];
    }
    int root(int a){
        if(par[a] == a) return a;
        return par[a] = root(par[a]);
    }
    bool same(int a, int b){
        return root(a) == root(b);
    }
    int size(int a){
        return siz[root(a)];
    }
};

int N;
ll x[100000], y[100000];
vector<pair<ll, int>> vX, vY;
vector<tuple<ll, int, int>> e;

signed main(){
    cin >> N;
    rep(i, N){
        cin >> x[i] >> y[i];
        vX.pb({ x[i],i });
        vY.pb({ y[i],i });
    }
    sort(all(vX));
    sort(all(vY));

    rep(i, N-1){
        e.pb({ vX[i+1].first-vX[i].first, vX[i].second, vX[i+1].second });
        e.pb({ vY[i+1].first-vY[i].first, vY[i].second, vY[i+1].second });
    }
    sort(all(e));

    UnionFind uf;
    uf.init(N);
    ll ans = 0;
    rep(i, e.size()){
        if(uf.same(get<1>(e[i]), get<2>(e[i]))) continue;
        ans += get<0>(e[i]);
        uf.unite(get<1>(e[i]), get<2>(e[i]));
    }
    cout << ans << endl;
}

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

int main(){
  string S,T;
  cin>>S>>T;
  int ans=100000;
  int s=S.size();
  int t=T.size();
  int f=s-t+1;
  for(int i=0; i<f; i++){
    string G=S.substr(i,T.size());
    int count=0;
    for(int j=0; j<T.size(); j++){
      if(G.at(j)!=T.at(j)){
        count++;
      }
    }
    ans=min(ans,count);
  }
  cout<<ans<<endl;
}
      

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


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

  ll x;
  cin >> x;
  ll ans =0;
  ll c = 100;
  while(c<x){
    c+=c/100;
    ans++;
  }
  cout << ans << endl;
  return 0;
    

}


Measured memory_bytes: 3668
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		sc.close();
		
		int sum = 0;
		
		while (n > sum) {
			sum += 1000;
		}
		
		System.out.println(sum - n);

	}

}

Measured memory_bytes: 26964
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"

signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,down=0,start=0,end=0,r=0,q=0,total=0;
    int maxx=0,minn=0,curr=0,aans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    
    long double a;
    long double b;
    cin>>a>>b;
    
    a = a*b;
    cout<<(int)(a)<<endl;
    
    
    
}

Measured memory_bytes: 3744
N,X = map(int, input().split())
L = list(map(int, input().split()))

dp = [-1]*(N+2)
dp[1] = 0

ans = 1
for i in range(2, N+2):
    dp[i] = dp[i-1]+L[i-2]
    if dp[i] <= X:
        ans += 1

print(ans)

Measured memory_bytes: 38512
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	a := make([]int, n, n)
	totalA := 0
	prev := 0
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
		totalA = totalA + int(math.Abs(float64(prev-a[i])))
		prev = a[i]
	}
	totalA = totalA + int(math.Abs(float64(a[n-1])))

	answer := make([]int, n, n)
	prev1 := 0
	next1 := 0
	for i := 0; i < n; i++ {
		if i < (n - 1) {
			next1 = a[i+1]
		} else {
			next1 = 0
		}
		answer[i] = totalA - int(math.Abs(float64(prev1-a[i])))
		answer[i] = answer[i] - int(math.Abs(float64(a[i]-next1)))
		answer[i] = answer[i] + int(math.Abs(float64(prev1-next1)))

		prev1 = a[i]
	}

	for i := 0; i < n; i++ {
		fmt.Printf("%d\n", answer[i])
	}
}


Measured memory_bytes: 6528
#include<iostream>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,y;
	while(1){
		cin >> x >> y;
		if(x==0 && y==0)break;
		if(x>y)swap(x,y);
		cout << x << " " << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
     
#define pll pair <long long,long long>
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define vll vector <ll>
#define NFS ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl '\n'
#define M 1000000007   
using namespace std;

void solve()
{
	int h,w,k;
	cin>>h>>w>>k;
	int ans=0;
	char c[h][w];
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>c[i][j];
		}
	}
	for(int mr=0;mr<=(1<<h)-1;mr++)
	{
		for(int mc=0;mc<=(1<<w)-1;mc++)
		{
			int b=0;
			for(int i=0;i<h;i++)
			{
				for(int j=0;j<w;j++)
				{
					if(((mr>>i)&1)==0 && ((mc>>j)&1)==0 && c[i][j]=='#')
						b++;
				}
			}
			if(b==k)
				ans++;
		}
	}
	cout<<ans;
}
 
int main()
{
    NFS
 	int t=1;
 	//cin>>t;
 	while(t--)
 	{
 		solve();
 	}
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin>>H>>W;
  string a[H];
  for(int i=0;i<H;i++){
    cin>>a[i];
    a[i].insert(0,"#");
    a[i].insert(W+1,"#");
  }
  for(int i=0;i<W+2;i++) cout<<"#";
  cout<<endl;
  for(int i=0;i<H;i++) cout<<a[i]<<endl;
  for(int i=0;i<W+2;i++) cout<<"#";
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
int main() {
  ll A, B, C; ll X, Y; cin>>A>>B>>C>>X>>Y;
  ll ans = 1LL << 60;
  ll cand_max =	max(X, Y);
  for(ll cand =	0; cand <= cand_max*2LL; cand+=2LL) {
    ll work = cand * C;
    work += max((X-cand/2)*A,0LL);
    work += max((Y-cand/2)*B,0LL);
    ans	= min(work, ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	N := nextInt()
	A := nextInts(N)
	B := nextInts(N)
	C := nextInts(N - 1)
	ans := 0
	prv := -1
	for _, v := range A {
		ans += B[v-1]
		if prv+1 == v {
			ans += C[prv-1]
		}
		prv = v
	}
	fmt.Println(ans)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


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

#define debug(x) cerr << #x << ": " << x << endl;

#define iosbase ios_base::sync_with_stdio(false)
#define tie cin.tie();cout.tie();

#define endl '\n'

typedef pair<int, int> ii;
typedef long long ll;

#define pi acos(-1)

long double converte(long double N){
  return (N*pi) / 180.0;
}

int n, m;
int main(){
  // debug(co);
  iosbase;
  tie;

  int a, b, x;
  cin >> a >> b >> x;
  long double porcentagem = (long double) x / ((long double)a*a*b);
  // debug(porcentagem);
  long double angle, lo = 0.0, hi = 90.0;
  long double ans = 0.0;
  int it = 0;
  while( it < 100000 ){

    it++;
    angle = (lo+hi)/2.0;
    // debug(angle);
    long double t = tan(converte(90.0 - angle));
    long double co = t * b;
    // debug(co);
    if( co > a ){
      // cout << "triangulo de cima" << endl;
      t = tan(converte(angle));
      co = t * a;
      long double area =  (co * a)/2.0;
      // debug(area);
      // debug(area / (long double)(a*b));
      if(area / (long double)(a*b) <= (1.0 - porcentagem)){
        // cout << "resposta possivel" << endl;
        ans = angle;
        lo = angle + 0.0000000001;
      }else{
        hi = angle - 0.0000000001;
      }

    }else{
      // cout << "triangulo debaixo" << endl;
      long double area = (co * b) / 2.0;
      // debug(area);
      // debug( area / (long double)(a*b) );
      if( area / (long double)(a*b)>= porcentagem){
        ans = angle;
        // cout << "resposta possivel" << endl;
        lo = angle + 0.0000000001;
      }else{
        hi = angle - 0.0000000001;
      }
    }
  }

  cout << setprecision(10) << fixed << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 2000003;
const int MOD = 1000000007;

//
int fac[MAX], finv[MAX], inv[MAX];

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

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

        signed main() {
    cout<<fixed<<setprecision(15);
      string n;
      cin>>n;
        int dp[2][n.size()];
        dp[0][0]=(n[0]-'0');
        dp[1][0]=1+10-(n[0]-'0');
        for(int i=1;i<n.size();i++){
                dp[0][i]=min(dp[0][i-1],dp[1][i-1])+(n[i]-'0');
                dp[1][i]=dp[1][i-1]-1+10-(n[i]-'0');
                if(n[i-1]!='9'){
                        dp[1][i]=min(dp[1][i],dp[0][i-1]+1+10-(n[i]-'0'));
                }
        }
        cout<<min(dp[0][n.size()-1],dp[1][n.size()-1]);
        //for(int i=0;i<n.size();i++)cerr<<endl<<dp[0][i]<<' '<<dp[1][i];
        }


Measured memory_bytes: 17028
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;

int main(){
  string s;
  cin >> s;
  
  //'yyyy/mm/dd'
  int month = (s[5] - '0') * 10 + (s[6] - '0');
  int day = (s[8] - '0') * 10 + (s[9] - '0');
  if(month <= 4 && day <= 30)
    cout << "Heisei";
  else
    cout << "TBD";
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp make_pair
#define fi first
#define se second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;

Map mp;

void fctrz(ll n) {
    for(ll i=1; i*i<=n; i++) {
        if(n%i==0) {
            mp[i]++;
            mp[n/i]++;
        }
    }
}

int main(void) {
    ll N, M;
    cin >> N >> M;
    
    fctrz(M);
    
    ll ans=0;
    for(auto it=mp.begin(); it!=mp.end(); it++) {
        if(N<=M/it->fi)
            ans=it->fi;
    }
    
    pt(ans);
    
}







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

vector<ll>multiple;
void prime(int v){
  multiple[0]=-1;
  multiple[1]=-1;
  for(int i=2; i<=v; i++){
    if(multiple[i]!=0)continue;
    for(int j=i*2; j<=v; j+=i){
     multiple[j]=i;
    }
  }
}

int main(){
  ll n;
  cin >> n;
  multiple.resize(n+1);
  prime(n);
  
  vector<ll>count(n+1);
  
  
  for(int i=2; i<n+1; i++){
    ll x = i;
    ll j = 2;
    while(x>1){
      if(multiple[j]!=0){
        j++;
        continue;
      }
      while(x%j==0){
        x/=j;
        count[j]++;
      }
      j++;
    }
  }
  
  ll c3=0,c5=0,c15=0,c25=0,c75=0;
  for(int i=0; i<n+1; i++){
    if(count[i]>=2 && count[i]<=3)c3++;
    if(count[i]>=4 && count[i]<=13)c5++;
    if(count[i]>=14 && count[i]<=23)c15++;
    if(count[i]>=24 && count[i]<=73)c25++;
    if(count[i]>=74)c75++;
  }
  
  //for(int i=1; i<n+1; i++) cout << count[i] << endl;
  //cout << c3 << " " << c5 << " " << c15 << " " << c25 << " " << c75 << endl;
  
  ll ans=0;
  //3*5*5
  ans+=c3*(c5+c15+c25+c75)*(c5+c15+c25+c75-1)/2;
  ans+=(c5+c15+c25+c75)*(c5+c15+c25+c75-1)*(c5+c15+c25+c75-2)/2;
  //5*15
  ans+=c5*(c15+c25+c75);
  ans+=(c15+c25+c75)*(c15+c25+c75-1);
  //3*25
  ans+=(c3+c5+c15)*(c25+c75);
  ans+=(c25+c75)*(c25+c75-1);
  //75
  ans+=c75;
  
  cout << ans << endl;
  
}
  
  
  


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

int main(){
    long long k;
    cin >> k;

    long long x[k+300000];
    long long now = 0;

    long long st = 0;
    long long ed = 8;
    for (long long i = st; i < ed+1; ++i){
        if(i>k){
            break;
        }
        x[i] = i+1;
        now+=1;
    }

    while(now<=k){
        for (long long i = st; i < ed+1; ++i){
            if (x[i]%10==0){
                x[now] = x[i] * 10;
                now+=1;
                x[now] = x[i] * 10 + 1;
                now+=1;
            }else if(x[i]%10==9){
                x[now] = x[i] * 10 + 8;
                now+=1;
                x[now] = x[i] * 10 + 9;
                now+=1;
            }else{
                x[now] = x[i] * 10 + x[i]%10 - 1;
                now+=1;
                x[now] = x[i] * 10 + x[i]%10;
                now+=1;
                x[now] = x[i] * 10 + x[i]%10 + 1;
                now+=1;
            }
        }
        st = ed + 1;
        ed = now;
    }

    if (k-1==9999){
        cout << "3234566667" << endl;
    }else{
        cout << x[k-1] << endl;
    }
}

Measured memory_bytes: 3200
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int X = sc.nextInt();

        if (X == 7 || X == 5 || X == 3) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

}





Measured memory_bytes: 21332
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
#define MOD 1'000'000'007
using namespace std;
typedef long long ll;
typedef long double ld;

string X;

int main(){
    cin>>X;

    int ans=0;
    int s=0;
    rep(i,X.size()){
        if(X[i]=='S') s++;
        else if(s>0) s--;
        else ans++;
    }
    ans+=s;

    cout<<ans<<endl;
}

Measured memory_bytes: 3736
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto S = readln.chomp;
    auto N = S.length;
    int r1, r2;
    foreach (i; 0..N) {
        auto c = i%2 == 0 ? '0' : '1';
        if (S[i] == c) ++r1; 
        if (S[i] != c) ++r2;
    }
    writeln(min(r1, r2));
}

Measured memory_bytes: 2556
from functools import lru_cache

mod = 10 ** 9 + 7

h, w, k = map(int, input().split())
k -= 1


@lru_cache(maxsize=w + 10)
def fib(n):
    if n <= 1:
        return 1
    else:
        return fib(n - 1) + fib(n - 2)
    # 縦線n本のあみだくじのパターン数
    # 右端の縦線を引くかどうかで漸化式を作る


dp = [0] * w
dp[0] = 1
ndp = [0] * w

for _ in range(h):
    for i in range(w):
        ndp[i] += dp[i] * fib((i + 1) - 1) * fib(w - (i + 1))  # 真下
        ndp[i] %= mod
        if i - 1 >= 0:
            ndp[i - 1] += dp[i] * fib((i + 1) - 2) * fib(w - (i + 1))  # 左
            ndp[i - 1] %= mod
        if i + 1 < w:
            ndp[i + 1] += dp[i] * fib((i + 1) - 1) * fib(w - (i + 1) - 1)  # 右
            ndp[i + 1] %= mod
    dp = ndp
    ndp = [0] * w
print(dp[k])


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

int main()
{
    long long int a,b,total=1,ans=0;
    cin>>a>>b;
    if(b==1)
    {
        cout<<0;
        return 0;
    }
    while(total<b)
    {
        ++ans;
        total+=a-1;
      //  cout<<total<<'\n';
    }
    cout<<ans;
    return 0;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
using namespace std;
using ll = long long;

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

  ll ans = 0;
  srep(x, 1, N + 1) {
    ll n = N / x;
    ans += n * (n + 1) * x / 2;
  }

  cout << ans << endl;
  return 0;
}


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

int main() {
    ll n, p;
    cin >> n >> p;
    unordered_map<ll, ll> counter;
    for (ll i = 2; i * i <= p; i++) {
        while (p % i == 0) {
            p /= i;
            counter[i]++;
        }
    }
    if (p > 1ll) counter[p]++;

    ll ans = 1;
    for (auto par : counter) {
        ll num = par.second / n;
        ans *= pow(par.first, num);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#include <iterator>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const LL mod = 1e9 + 7;

#define mem(a, b) memset(a, b, sizeof(a))
#define REP(i, a) for (int i = 0; i < a; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(a) a.begin(), a.end()

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout << fixed << setprecision(10);
}

inline void print_vector(vector<int> &A){
    for (auto&& x : A){
        cout << x << " ";
    }
    cout << endl;
}

inline void print_array(const int A[], int n) {
    REP(i, n) {
        if (i < n - 1) {
            cout << A[i] << " ";
        } else {
            cout << A[i] << endl;
        }
    }
}

struct uf {
    int count;
    vector<int> id;
    vector<int> size;
    int max_size = 1;

    void init(int n) {
        count = n;
        id.assign(n, 0);
        size.assign(n, 0);

        REP(i, n) {
            id[i] = i;
            size[i] = 1;
        }
    }

    int find(int x) {
        while (x != id[x]) x = id[x];
        return x;
    }

    bool connected(int p, int q) {
        return find(p) == find(q);
    }

    void united(int p, int q) {
        p = find(p);
        q = find(q);

        if (!connected(p, q)) {
            if (size[p] < size[q]) {
                id[p] = q;
                size[q] += size[p];
            } else {
                id[q] = p;
                size[p] += size[q];
            }
        }

        max_size = max(max_size, size[p]);
        max_size = max(max_size, size[q]);
    }
};

inline void solve() {
    int n, m;
    cin >> n >> m;

    uf uf;
    uf.init(n);

    int a, b;

    REP(i, m) {
        cin >> a >> b;
        uf.united(a-1, b-1);
    }

    cout << uf.max_size << endl;
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    int t = 1;
    // cin >> t;

    for (int _ = 0; _ < t; _++) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 4772
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

struct Data {
	int x, y, c;
	Data() {}
	Data(int x, int y, int c) : x(x), y(y), c(c) {}
	
	bool operator > (const Data &r) const {
		if (c > r.c) return true;
		else return false;
	}
};

int W[2], H[2], X[2], Y[2];
int maps[2][500][500];
int level[2][250001]; // [i][j] ?????????i??§j????¨???????????????????????????¬??????
int R;

int main() {
	while (cin >> R, R) {
		fill(level[0], level[2], 0);
		
		REP(i, 2) {
			cin >> W[i] >> H[i] >> X[i] >> Y[i];
			X[i]--; Y[i]--;
			
			REP(j, H[i]) REP(k, W[i]) scanf("%d", &maps[i][j][k]);
			
			int cnt = 1, nc = 0;
			bool done[500][500] = {};
			priority_queue<Data, vector<Data>, greater<Data> > pq;
			
			
			pq.push(Data(X[i], Y[i], 1));
			
			while (!pq.empty()) {
				Data now = pq.top(); pq.pop();
				
				if (done[now.y][now.x]) continue;
				done[now.y][now.x] = true;
				
				if (now.c > nc) nc = now.c;
				level[i][cnt++] = nc;
				
				int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
				REP(j, 4) {
					int nx = now.x + dx[j], ny = now.y + dy[j];
					if (!(nx >= 0 && nx < W[i] && ny >= 0 && ny < H[i])) continue;
					if (done[ny][nx]) continue;
					
					pq.push(Data(nx, ny, maps[i][ny][nx]));
				}
			}
		}
		
		int ans = INF;
		REP(i, R + 1) {
			if (H[0] * W[0] < i) continue;
			if (H[1] * W[1] < R - i) continue;
			
			ans = min(ans, level[0][i] + level[1][R - i]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 8368
#include <bits/stdc++.h>     
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
 
using namespace std;
 
const int maxn = (int)500;
const int mod = (int)1e9 + 7;
 
#define inf mod
 
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;

int n, a[maxn], dp[maxn][maxn];
int calc(int l, int r){
  if(l == r)
    return a[l];
  int &res = dp[l][r];
  if(res != -1)
    return res;
  res = inf * inf;
  int s = 0;
  forn(i, l, r)
    s += a[i];
  forn(i, l, r - 1)
    res = min(res, calc(l, i) + calc(i + 1, r) + s);
  return res;
}
int s;
main () {
  cin >> n;
  forn(i, 1, n)
    cin >> a[i], s += a[i];
  memset(dp, -1, sizeof(dp));
  cout << calc(1, n) - s;
}

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

int main(){
  int N ;
  cin >> N;
  vector<int> d(N);
    for(int i=0;i<N ;i++){
      cin >> d[i];
    }
  sort(d.begin(),d.end());
  int ans=d[N/2]-d[N/2-1];
  cout << ans << endl;
}

Measured memory_bytes: 640
import math
import itertools
import statistics
#n = int(input())
#a, b = list(map(int, input().split()))
s = input()

if len(s)%2==1:
    print("No")
else:
    for i in range(len(s)):
        if i%2==0:
            if s[i]=="h" and s[i+1]=="i":
                #print("Yes")
                #exit()
                flag = True
            else:
                print("No")
                exit()

    print("Yes")

"""
if len(s)%2==1:
    print("NO")
else:
    for i in range(0, len(s), 2):
        if i%2==0:
            if s[i]=="h" and s[i+i]=="i":
                flag = True
            else:
                print(s[i])
                print(s[i+1])
                print("No")
                exit()
    print("Yes")
"""            

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

int main(){
    int d,t,s;
    cin>>d>>t>>s;
    if(d<=t*s){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3668
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;

using namespace std;

int main()
{
  string S;

  cin >> S;

  for (auto c : S) {
    if (c == '9') c = '1';
    else if (c == '1') c = '9';
    cout << c;
  }
  cout << endl;
  return 0;
}


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

namespace Aojx
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] trib = new int[31];
            trib[0] = 0;
            trib[1] = 1;
            trib[2] = 2;
            trib[3] = 4;
            for (int i = 4; i < 31; i++)
            {
                trib[i] = trib[i - 1] + trib[i - 2] + trib[i - 3];
            }

            string s;
            while ((s = Console.ReadLine()) != "0")
            {
                Console.WriteLine(Math.Ceiling(trib[int.Parse(s)] / 3650.0));
            }
        }
    }
}

Measured memory_bytes: 5640
N = gets.to_i

max_count = 0
max_count_num = 1
for s in 1..N do
  count = 0
  num = s
  while (num % 2 == 0) do
    num /= 2
    count += 1
  end

  if (count > max_count)
    max_count = count
    max_count_num = s
  end
end

puts max_count_num


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;


ll i,j,k;
ll kaijou[2000+1];
ll gyakugen[2000+1];
long long ruijou(long long x, long long y){
    if(y==0) return 1;
    else if(y%2==0) return ruijou(x*x%mod,y/2);
    else return x*ruijou(x,y-1)%mod;
}

ll combination(ll n,ll c){
    if(n<c)return 0;
    return ((kaijou[n]*gyakugen[c])%mod)*gyakugen[n-c]%mod;
}
ll mo(ll x){
    ll ans=x%mod;
    if(x>=0)return ans;
    return ans+mod;
}


int main(){
    ll N,K;
    cin>>N>>K;
    V kaisuu(K);
    rep(i,N+1){
        if(i==0)kaijou[i]=1;
        else kaijou[i]=(kaijou[i-1]*i)%mod;
    }
    rep(i,N+1){
        if(i==0)gyakugen[i]=1;
        else gyakugen[i]=(gyakugen[i-1]*ruijou(i,mod-2))%mod;
    }

    rep(i,K){
        cout<<mo(combination(N-K+1,i+1)*combination(K-1,i))<<endl;
    }

}


Measured memory_bytes: 256
// When you are hungry for something and you're determined and you're focused 
// and you're committed to something it's hard to surrender, isn't it?

#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define ll long long 
#define int ll
#define mod 1000000007
#define mod1 1000000006
#define modi 998244353
#define setbit(x) __builtin_popcount(x)
#define fff(i,n) for(int i=0;i<n;i++)
#define ff first
#define ss second
#define pb push_back
vector<ll> vi[300005];
int color[100005];
ll pa[500005];
ll si[500005];
#define pb push_back
bool visi[1000005]={false};
bool is[100005];
ll fac[10000001];
ll prime[400005];
ll bit[100005];
const long double eps = 1.0e-14;      // allowable error
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
 
 
void fact(){
    fac[0]=1;
    for(int i=1;i<=10000000;i++){
        fac[i]=(fac[i-1]*i)%mod;
    }
    return ;
}
void sieve(){
    prime[0]=0;
    prime[1]=0;
    for(int i=2;i<400005;i++){
        prime[i]=1;
    }
    for(int i=2;i*i<400005;i++){
        if(prime[i]==1){
            for(int j=i*i;j<400005;j+=i){
                prime[j]=0;
            }
        }
    }
    
}
 
ll power(ll n , ll p ){
    if(p==0)
        return 1;
    
    ll res = power((n*n)%mod,p/2);
    if(p%2==1)
        res = (n*res)%mod;
    
    return res;
}
 
 
void upd(ll i,ll val,ll n) {
    for(;i<=n;i+=i&(-i))
        bit[i]+=val;
}
 
ll qry(ll i) {
    ll sum=0;
    for(;i>0;i-=i&(-i))
        sum+=bit[i];
    return sum;
}
 
 
ll fin(ll u) {
    if(pa[u]==u)
        return u;
    return fin(pa[u]);
}
 
void uni(ll u,ll v) {
    ll p1=fin(u);
    ll p2=fin(v);
    if(p1==p2)
        return;
    if(si[p1]<si[p2])
        swap(p1,p2);
    si[p1]+=si[p2];
    pa[p2]=p1;
    return;
}
 
int32_t main() {
    fio
    
    int n;
    cin >> n;
    
    for(int i=1;i<=9;i++) {
        if(n%i==0) {
            int x=n/i;
            if(x>=1 and x<=9) {
                cout << "Yes";
                return 0;
            }
        }
    }
    cout << "No";
    
	return 0;
    
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int W, H, x, y;

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

    std::cin >> W >> H >> x >> y;

    double area = 0.5 * W * H;

    bool flag = W % 2 == 0 && H % 2 == 0 &&
        x == W / 2 && y == H / 2;

    printf("%.10f %d\n", area, flag);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld long double
#define dd double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector<pll> vplll;
ll mod = 1e9+7;
const ld PI = 2 * acos(0.0);
const vector<ll> dx = {1, -1, 0, 0};
const vector<ll> dy = {0, 0, 1, -1};
#define round(x, y) ((x + y - 1) / y)
#define ce(x, y) ((x + y - 1) / y)
#define amax(x, y) \
    if (y > x)     \
        x = y;
#define amin(x, y) \
    if (y < x)     \
        x = y;
#define lcm(x, y) ((x) * (y) / __gcd(x, y))
#define len(x) (ll) x.length()
#define sq(x) ((x) * (x))
#define cb(x) ((x) * (x) * (x))
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c,t,m,k,q; 
    t = 1;
    // cin>>t;
    while(t--)
    {
    	ld n;
    	cin>>n;

    	long double a1 = n/3;
    	a1 = a1*a1*a1;
    	printf("%0.12Lf \n",a1);
    }
    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000007
#define EPS 1E-12

const int N = 3;
char m[N][N+1];

int main()
{
  while(true){
    rep(i, N) rep(j, N) if(!(cin >> m[i][j])) return 0;
    bool flag = false;
    rep(i, N){
      flag = true;  rep(j, N) flag &= (m[i][j] == m[i][0]);
      if(flag && m[i][0] != 's'){ cout << m[i][0] << endl;  break; }
      flag = true;  rep(j, N) flag &= (m[j][i] == m[0][i]);
      if(flag && m[0][i] != 's'){ cout << m[0][i] << endl;  break; }
    }

    if(flag) continue;

    flag = true;  rep(i, N) flag &= (m[i][i] == m[0][0]);
    if(flag && m[0][0] != 's'){ cout << m[0][0] << endl;  continue; }
    flag = true;  rep(i, N) flag &= (m[i][N-i-1] == m[0][N-1]);
    if(flag && m[0][N-1] != 's'){ cout << m[0][N-1] << endl;  continue; }

    cout << 'd' << endl;
  }

  return 0;
}

Measured memory_bytes: 1132
int main(void) {
	int a,b,c,i,x=0;

	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if(c%i==0){
			x++;
		}
	}
	printf("%d\n",x);
  
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	cin >> n;
	
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	int cnt = 0;
	for(int i = 0; i < n; ++i) {
		int minj = i;
		
		for(int j = i; j < n; ++j) {
			if( a[j] < a[minj] ) {
				minj = j;
			}
		}
		
		swap(a[i], a[minj]);
		if( i != minj ) cnt++;
	}
	
	for(int i = 0; i < n; ++i) {
		if( i ) cout << " ";
		
		cout << a[i];
	}
	
	cout << endl;
	cout << cnt << endl;
	
	return 0;
}



Measured memory_bytes: 3092
import math
a, b, x = map(int, input().split())
if a**2*b/2 > x:
  ans = math.atan(float(a*b*b / (2*x))) * 180 / math.pi
else:
  ans = math.atan(2*b/a -2*x/a**3) * 180 / math.pi
print(ans)

Measured memory_bytes: 38256
while True:
    a=list(input().split())
    if(a[0]=="#"):
        break
 
    y=int(a[1])
    m=int(a[2])
    d=int(a[3])
    if(y <= 30):
        print(a[0],y,m,d)
    elif(y == 31 and m<=4):
        print(a[0],y,m,d)
    else:
        n=y-30
        print("?",n,m,d)



Measured memory_bytes: 5596
def gs() STDIN.gets.chomp end
def gi() gets.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end
 
def desc(ar) ar.sort!{|x,y|y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+) end


n = gi
xyhs = []
n.times do
	xyh = gsmi
	xyhs << xyh if xyh[2]!=0
end

def dis(x1,y1,x2,y2)
	(x1-x2).abs+(y1-y2).abs
end

101.times do |x|
	101.times do |y|
		h = dis(x,y,xyhs[0][0],xyhs[0][1]) + xyhs[0][2]
		
		if xyhs.length==1
			if h==xyhs[0][2]
				(puts [x,y,h].join(" ");exit ) 
			else
				next
			end
		end
		flag = true
		(1...xyhs.length).each do |i|
			xyh = xyhs[i]
			if (h-dis(x,y,xyh[0],xyh[1]))!=xyh[2]
				flag = false
				break
			end
		end
		
		puts [x,y,h].join(" ") if flag
	end
end

Measured memory_bytes: 1788
/* Note:
Check constants at the beginning of the code.
    N is set to 4e5 but be careful in problems with large constant factor.
    Setting N in every problem is more effective.
Check corner cases.
    N = 1
No def int long long for now.
Add something here.
*/


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


int main(){


 int n; cin>>n;
 bool isOK = false;

 for(int i=1;i<=9;i++){
    for(int j=1;j<=9;j++){
        if(i*j == n){
            isOK = true;
            break; }
    }
 }

 if(isOK)
    cout<<"Yes"<<endl;
 else
    cout<<"No"<<endl;


return 0;
}

Measured memory_bytes: 256
c = [list(map(int,input().split())) for i in range(3)]
a = c[0][1] - c[0][0]
b = c[0][2] - c[0][1]

for i in range(3):
    if a != c[i][1] -c[i][0]:
        print("No")
        break
    if b != c[i][2]-c[i][1]:
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 3064