akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ABC050a
{
	class Program
	{
		static void Main(string[] args)
		{
			int A,B,z=0;
			string op;
            var word = Console.ReadLine().Split(' ');
			A = int.Parse(word[0]);
			op = word[1];
			B = int.Parse(word[2]);
			if (op == "+" )
				z = A + B;
			else if (op == "-" ) 
				z = A - B;
			Console.WriteLine(z);
			Console.ReadKey();
			
		}
	}
}


Measured memory_bytes: 11092
#include <stdio.h>

int main(void)
{
	int a[100][100],b[100],c[100],n,m,i,j,k;
	scanf("%d%d",&n,&m);
	for(i=0;i<=99;i++)
	{
		for(j=0;j<=99;j++)
		{
			a[i][j]=0;
			b[i]=0;
			c[i]=0;
		}
	}
	for(i=0;i<=n-1;i++)
	{
		for(j=0;j<=m-1;j++)
		{
			scanf("%d",&k);
			a[i][j]=k;
		}
	}
	for(i=0;i<=m-1;i++)
	{
		scanf("%d",&k);
		b[i]=k;
	}
	for(i=0;i<=n-1;i++)
	{
		for(j=0;j<=m-1;j++)
		{
			c[i]=c[i]+a[i][j]*b[j];
		}
		printf("%d\n",c[i]);
	}
	return 0;
			
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int BIT = 29;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi a(n), b(n);
    vvi sb(BIT, vi(n));
    vi sm(BIT, 0);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
        rep(j,BIT){
            sb[j][i] = (((1 << j) - 1) & b[i]);
            sm[j] += ((b[i] >> j) & 1);
        }
    }
    int ans = 0;
    rep(i,BIT){
        int res = 0;
        sort(all(sb[i]));
        rep(j,n){
            int ch = sm[i];
            int mask = (((1 << i) - 1) & a[j]);
            int comp = (1 << i) - mask;
            int cnt = n - (lower_bound(all(sb[i]),comp) - sb[i].begin());
            if((a[j] >> i) & 1){
                ch += n-cnt;
            }else{
                ch += cnt;
            }
            res ^= ch % 2;
        }
        ans += (res << i);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 26608
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a+b==15)System.out.println("+");
    else if(a*b==15)System.out.println("*");
    else System.out.println("x");
  }
}

Measured memory_bytes: 21844
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class E
{
	public static void Main()
	{
		long mod = 1000000007;
		long N = GetLong();
		long M = GetLong();
		long K = GetLong();

		long xsum = 0;
		for(long d = 1; d <= M - 1; d++)
			xsum = (xsum + (d * (M - d)) % mod) % mod;
		xsum = (((xsum * N) % mod) * N) % mod;

		long ysum = 0;
		for(long d = 1; d <= N - 1; d++)
			ysum = (ysum + (d * (N - d)) % mod) % mod;
		ysum = (((ysum * M) % mod) * M) % mod;
		
		var mct = new ModCombTable((int)(N * M), mod);
		long comb = mct.ModComb(N * M - 2, K - 2);
		long ans = (((xsum + ysum) % mod) * comb) % mod;
		Console.WriteLine(ans);
	}
}


public class ModCombTable
{
	private long[] f = null;
	private long[] fInv = null;
	private long mod;

	public ModCombTable(int N, long m)
	{
		mod = m;

		// calc factorial
		f = new long[N+1];
		f[0] = 1;
		for(int i = 1; i <= N; i++)
			f[i] = (f[i-1] * i) % mod;

		// calc factorial inverse
		fInv = new long[N+1];
		fInv[N] = ModInv(f[N]);
		for(int i = N; i > 0; i--)
			fInv[i-1] = (fInv[i] * i) % mod;
	}

	public long ModComb(long n, long k)
	{
		if(n < 0 || n < k)
			return 0;
		
		return (((f[n] * fInv[k]) % mod) * fInv[n-k]) % mod;
	}

	public long ModInv(long x)
	{
		return ModPow(x, mod - 2);
	}

	public long ModPow(long x, long n)
	{
		long res = 1;
		while(n > 0)
		{
			if((n & 1) == 1)
				res = (res * x) % mod;
			x = (x * x) % mod;
			n >>= 1;
		}
		return res;
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Measured memory_bytes: 14048
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
	}

	let mut l: Vec<usize> = vec![0; 87];
	l[0] = 2;
	l[1] = 1;

	let mut i = 2usize;
	loop {
		if i > n {
			break;
		}
		l[i] = l[i-1] + l[i-2];
		i += 1;
	}
	println!("{}", l[n]);
}



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

const int N = 2e5 + 10;

long long a[N];

int main(){
	int n, now;
	long long x, ans, sum;
	scanf("%d %lld",&n,&x);
	a[0] = 0;
	ans = 1e18;
	for (int i = 1; i <= n; i++){
		scanf("%lld",&a[i]);
		a[i] += a[i - 1];
	}
	for (int k = 1; k <= n; k++){
		sum = 0; now = 3;
		for (int i = n; i >= 1; i -= k){
			sum += (a[i] - a[max(0, i - k)]) * max(now, 5);
			now += 2;
			if (sum >= ans) break;
		}
		ans = min(ans, sum + x * (n + k));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>

using namespace std;

int main() {
  while (true) {
    int h, w;
    cin >> h >> w;
    if (!h && !w) break;
    for (int y = 0; y < h; ++y) {
      for (int x = 0; x < w; ++x) {
        if ((x + y) % 2 == 0) {
          cout << '#';
        } else {
          cout << '.';
        }
      }
      cout << endl;
    }
    cout << endl;
  }
}

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

int main() {

  int N, K;
  cin >> N >> K;

  int total = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    
    if (x < (K - x)) {
      total += (x * 2);
    }
    else {
      total += ((K - x) * 2);
    }
  }

  cout << total << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
using namespace std;
typedef long long ll;

int N;
string S;
string A;

int main(){

  cin >> N;
  cin >> A;
  int res=0;
  for(int i=0;i<N;i++){
    cin >> S;
    bool ok=false;
    for(int j=0;j<(int)S.size();j++){
      if(S[j]==A[0]){
	for(int k=1;k<(int)S.size();k++){
	  int id = 1;
	  bool f=false;
	  for(int l=j+k;l<(int)S.size();l+=k){
	    //	    cout << "no" << l << ":"<<"k="<<k<<" "<<S[l] << " " << A[id] << endl;
	    if(S[l]==A[id]){
	      if(id==(int)A.size()-1){ f=true; break;}
	    } else break;
	    id++;
	  }
	  if(f){ ok=true; }
	}
      }
    }
        if(ok) res++;
    //    cout << res << endl;
  }
  cout << res << endl;
}

Measured memory_bytes: 1208
open Printf
let input_int_array n =
	Array.init n (fun _ -> Scanf.scanf " %d" (fun v -> v))

let get_int () = Scanf.scanf " %d" (fun v -> v)
let get_2_ints () = Scanf.scanf " %d %d" (fun u v -> u,v)
let get_3_ints () = Scanf.scanf " %d %d %d" (fun u v w -> u,v,w)
let get_4_ints () = Scanf.scanf " %d %d %d %d" (fun u v w x -> u,v,w,x)
let get_5_ints () = Scanf.scanf " %d %d %d %d %d" (fun u v w x y -> u,v,w,x,y)

let print_int_endline n = n |> string_of_int |> print_endline
let char_list_of_string str = 
  let rec f0 i a =
    if i<0 then a else f0 (i-1) (str.[i]::a)
  in f0 (String.length str - 1) []
let string_of_char_list ls = 
  List.fold_left (fun u v -> u ^ (String.make 1 v)) "" ls

let () =
  let s = Scanf.scanf " %s" (fun v -> v)
  in let w = get_int ()
  in let l = s |> char_list_of_string
  in
  let rec f0 l a k = match l with
  | h::t -> if k mod w <> 0 then f0 t a (k+1) else f0 t (h::a) (k+1)
  | [] -> a
  in
  f0 l [] 0 |> List.rev |> string_of_char_list |> print_endline






Measured memory_bytes: 896
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){
  int a,b;
  while(cin>>a>>b){
    int c = a+b;
    int ans = 0;
    while(c > 0){
      ans++; c/=10;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n,m,x[100001],d[100001];

int main(void)
{
    cin >> n >> m;
    rep(i,m)
    {
        cin >> x[i];
    }

    sort(x, x + m);

    rep(i,m-1)
    {
        d[i] = x[i+1] - x[i];
    }

    sort(d, d + m - 1);

    lin res = 0;

    rep(i, m-1-(n-1))
    {
        res += d[i];
    }

    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

#define N 200010
#define MAX 1000000000000000000
#define MOD 1000000007

#include <stdio.h>

int main (void) {
    int n, r;

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

    if (n >= 10) {
        printf("%d", r);
    } else {
        printf("%d", r + (100 * (10 - n)));
    }

    return 0;
}



Measured memory_bytes: 1720
import math
n  = int(input())
arr = list(map(int , input().split()))
pre =[0]*(n+1)
mod = 10**9+7
pre[0]=arr[0]
for i in range(1 , n):
	pre[i]=pre[i-1]+arr[i]
	pre[i]=pre[i]%mod
ans = 0
for i in range(0 , n):
	ans = ans + (arr[i])*(pre[n-1]-pre[i])
	ans = ans%mod
print(ans)

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

int main() {
	int n,k;cin>>n>>k;
	vector<int> x(n),r,l;
	int ex=-1;
	int right;
	for(int i=0;i<n;i++){
		cin>>x[i];
		if(ex*x[i]<=0){
			right=i;
		}
		ex=x[i];
	}
	int ans=1;
	for(int i=0;i<9;i++)ans*=10;
//	for(int i=1;i<=center;i++){
//		ans=-x[i]
//	}
	for(int i=0;i<=n-k;i++){
		int temp=0;
		if(x[i]<0){
			temp+=-x[i];
			temp+=x[i+k-1]-x[i];
		}else{
			temp+=x[i+k-1];
		}
		if(temp<ans)ans=temp;
		temp=0;
		if(x[i+k-1]>0){
			temp+=x[i+k-1];
			temp+=x[i+k-1]-x[i];
		}else{
			temp+=-x[i];
		}
		if(temp<ans)ans=temp;
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector <int> a(n), b(n), c(n), dpa(n), dpb(n), dpc(n);

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

    dpa[0] = a[0];
    dpb[0] = b[0];
    dpc[0] = c[0];

    for (int i = 1; i < n; i++) {
        dpa[i] = a[i] + max(dpb[i - 1], dpc[i - 1]);
        dpb[i] = b[i] + max(dpa[i - 1], dpc[i - 1]);
        dpc[i] = c[i] + max(dpa[i - 1], dpb[i - 1]);
    }

    cout << max(dpa[n - 1], max(dpb[n - 1], dpc[n - 1]));
    return 0;
}

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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");
#define random rand() ^ (rand() << 5)

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;

ll ans;
ll x[N]; 
int v[N];
vector < ll > v1, v2;

main() {
	int n;
	ll c;
	cin >> n >> c;
	for (int i = 1; i <= n; i++) {
		scanf("%lld %d", &x[i], &v[i]);
	}
	v1.resize(n + 1);
	v2.resize(n + 1);
	ll sum = 0;            
	for (int i = 1; i <= n; i++) {
		sum += v[i];
		ans = max(ans, sum - x[i]);
		v1[i] = sum - x[i];
	}
	sum = 0;
	set < pair < ll, int > > s, s1; 	
	for (int i = n; i >= 1; i--) {
		sum += v[i];
		ans = max(ans, sum - (c - x[i]));
		v2[i] = sum - (c - x[i]);
		s.insert(mk(-v2[i], i));
		s1.insert(mk(-v1[i], i));
	}
	for (int i = 1; i < n; i++) {
		s.erase(mk(-v2[i], i));
		ll cur = -s.begin() -> fr;
		ans = max(ans, v1[i] + cur - x[i]);
	}
	for (int i = n; i > 1; i--) {
		s1.erase(mk(-v1[i], i));
		ll cur = -s1.begin() -> fr;
		ans = max(ans, v2[i] + cur - (c - x[i]));
	}
	cout << ans;
}

Measured memory_bytes: 15488
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=int(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using ll = long long;

int main(){
    ll a,b,c;cin>>a>>b>>c;
    if(a+b<c&&4*a*b<(c-a-b)*(c-a-b)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> // {{{
// clang-format off
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define pb emplace_back
#define em emplace
#define fi first
#define se second
#define USE1(...) template <typename __VA_ARGS__> inline
#define USE2(T, ...) USE1(T, typename __VA_ARGS__)
#define mygc(c) (c) = getchar_unlocked()
#define mypc(c) putchar_unlocked(c)
 
using ll = long long;
template<typename T> using vec = std::vector<T>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE2(T=int,V=vec<T>)V reserved(int n){V v;v.reserve(n);return v;}
USE1(T=int)vec<T>in(int n){auto v=reserved<T>(n);rep(i,n)v.pb(in<T>());return v;}
USE2(T,U=std::pair<T,int>)vec<U>enume(const vec<T>&x,int s=0){int N=x.size();auto v=reserved<U>(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE2(T,U)void prif(bool b,T t,U f){if(b)pr(t);else pr(f);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
struct IoSetup { // {{{
  IoSetup() {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.precision(20);
    std::cout.setf(std::ios::fixed);
  }
} iosetup; //}}}
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

ll f(ll x) {
  return x * (x + 1) / 2;
}

signed main() {
  ll X = in();
  ll l = 0, r = X;
  while (r - l > 1) {
    ll m = (r + l) / 2;
    if (f(m) < X)
      l = m;
    else
      r = m;
  }
  pr(r);
  return 0;
}


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

template<Int MOD = 1000000007>
struct Mod{
  Int prev=0;
  vector<Int> fact,inv,finv;
  Mod(){}
  Mod(Int n){init(n);}
  
  Int pow(Int x,Int n){
    Int res=1;
    while(n){
      if(n&1) (res*=x)%=MOD;
      (x*=x)%=MOD;
      n>>=1;
    }
    return res;
  }
  
  Int inverse(Int a){
    return pow(a,MOD-2);
  }
  
  void init(Int n){
    if(prev>=n) return;
    prev=n;
    fact=inv=finv=vector<Int>(n);
    
    fact[0]=1;
    for(Int i=1;i<n;i++)
      fact[i]=(fact[i-1]*i)%MOD;
    
    inv[1]=1;
    for(Int i=2;i<n;i++)
      inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
    
    finv[0]=1;
    for(Int i=1;i<n;i++)
      finv[i]=finv[i-1]*inv[i]%MOD;
  }
  
  Int comb(Int n,Int k){
    Int res=1;
    for(Int i=0;i<k;i++){
      res*=(n-i)%MOD;
      res%=MOD;
      res*=inverse(i+1);
      res%=MOD;
    }
    return res;
  }
  
  //only for prime MOD
  Int C(Int n,Int k){
    if(k<0||k>n) return 0;
    return fact[n]*finv[k]%MOD*finv[n-k]%MOD;
  }

  Int H(Int n,Int k){
    return C(n+k-1,n);
  }

  Int S(Int n,Int k){
    Int res=0;
    for(Int i=1;i<=k;i++){
      Int tmp=C(k,i)*pow(i,n)%MOD;
      if((k-i)&1) res+=MOD-tmp;
      else res+=tmp;
      res%=MOD;
    }
    res=res*finv[k]%MOD;
    return res;
  }
  
  Int B(Int n,Int k){
    Int res=0;
    for(Int j=1;j<=k;j++){
      res+=S(n,j);
      res%=MOD;
    }
    return res;
  }
  
  Int montmort(Int n){
    Int res=0,rinv=1;
    for(Int k=2;k<=n;k++){
      rinv=rinv*inverse(k)%MOD;
      if(k%2) res+MOD-rinv;
      else res+=rinv;
      res%=MOD;
    }
    for(Int i=1;i<=n;i++) res=res*i%MOD;
    return res;
  }
  
  // calculate P(t) from given points in [0,N]
  Int LagrangePolynomial(vector<Int> &y,Int t){
    Int n=y.size()-1;
    init(n+1);
    Int num=1;
    for(Int i=0;i<=n;i++)
      num=num*((t-i)%MOD)%MOD;
    Int res=0;
    for(Int i=0;i<=n;i++){
      Int tmp=(y[i]*num%MOD)*inverse((t-i)%MOD)%MOD;
      tmp=tmp*finv[i]%MOD;
      tmp=tmp*finv[n-i]%MOD;
      if((n-i)&1) tmp=MOD-tmp;
      res=(res+tmp)%MOD;
    }
    return res;
  }
};

//INSERT ABOVE HERE
signed main(){
  const Int MOD = 1e9+7;
  Mod<MOD> mod(2e5);
  Int n,k;
  cin>>n>>k;
  cout<<(n<=k)<<endl;
  return 0;
}



Measured memory_bytes: 7480
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }




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

    ll A, B; cin >> A >> B;
    if(abs(A-B)%2 == 0){
        cout << (A+B)/2 << endstr;
    }
    else{
        cout << "IMPOSSIBLE" << endstr;
    }
    return 0;
}


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

int main()
{
   int n,d;
   cin>>n>>d;
   int x,y; int cnt=0;
   for(int i=0;i<n;i++)
     {
          cin>>x>>y;
          long long num=(pow(x,2)+pow(y,2)) ; 
          long long check= pow(d,2);
          if(num<=check)
             cnt++;
     }
    cout<<cnt<<endl; 
}


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

template <typename T>
inline T read(){
	T x=0,f=1;char c=getchar();
	while(!isdigit(c)){	if(c=='-') f=-f;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read<int>()
#define readlint read<lint>()
const int inf=1e9+1e7,MAXN=2e5+1e1;
const double eps=1e-10;

struct Node{
	int w2,w5,p;
};

Node a[MAXN<<1];
int b[3100][3100],n;
lint ans=0;

void Read(int id){
	int x=0,f=1,X=0,F=1,cnt=0;char c=getchar();
	while(!isdigit(c)){	if(c=='-') f=-f;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	if(c=='.'){
		while(!isdigit(c)){	if(c=='-') F=-F;c=getchar();}
		while(isdigit(c)){X=(X<<3)+(X<<1)+(c-48);++cnt;c=getchar();}
	}
	lint k3=X*F;
	if(k3==0) cnt=0;
	while((k3) && (k3%10==0)) k3/=10,--cnt;
	lint k1=x*f;
	a[id].p=cnt;
	while(cnt--) k1*=10;
	lint k2=k1+k3;
	while((k2) && (k2%2==0)) ++a[id].w2,k2/=2;
	while((k2) && (k2%5==0)) ++a[id].w5,k2/=5;
	return;
}

int main(void){

	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

	scanf("%d",&n);
	for(int i=1;i<=n;i++) Read(i);
	// for(int i=1;i<=n;i++) printf("%d %d %d\n",a[i].w2,a[i].w5,a[i].p);
	for(int i=1;i<=n;i++){
		lint res=0;
		int w2=a[i].w2,w5=a[i].w5,p=a[i].p;
		for(int j=0;j<=w2-p+48;j++) for(int k=0;k<=w5-p+48;k++) res+=b[j][k];
		++b[p-w2+48][p-w5+48];
		ans+=res;
		// printf("%lld ",res);
		// printf("%d %d\n",max(a[i].p-a[i].w2,0),max(a[i].p-a[i].w5,0));
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 6300
#include<iostream>
using namespace std;
int main(){
  unsigned int n;cin>>n;
  unsigned int* a =new unsigned int[n];
  for(int i=0;i<n;i++){ cin>>a[i]; }
  unsigned long long c=0;
  unsigned long long s=0;
  unsigned int r=0;
  for(int l=0;l<n;l++){
    while(1){
      if(r==n) break;
      if((s^a[r])==(s+a[r])){
        s+=a[r];
        r++;
      }else{
        break;
      }
    }
    c+=r-l;
    if(l==r){
      r++;
    }else{
      s-=a[l];
    }
  }
  cout<<c<<endl;
  return 0;
}


Measured memory_bytes: 1024
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m,k = li()

exist = False
for i in range(n+1):
    for j in range(m+1):
        if (i*m + j*n - 2*i*j) == k:
            
            exist = True
            
print("Yes") if exist else print("No")

Measured memory_bytes: 3316
using System;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var sArray = Console.ReadLine().ToCharArray();

            var rCount = ulong.MinValue;
            var gCount = ulong.MinValue;
            var bCount = ulong.MinValue;
            foreach (var item in sArray)
            {
                switch (item)
                {
                    case 'R':
                        rCount++;
                        break;
                    case 'G':
                        gCount++;
                        break;                    
                    default:
                        bCount++;
                        break;
                }
            }
            ulong rgbCount = rCount * bCount * gCount;
            for (int i = 0; i < sArray.Length - 2; i++)
                for (int j = i + 1; j < sArray.Length - 1; j++)
                {
                    var ki = j + j - i;
                    if (ki >= n) continue;
                    var si = sArray[i];
                    var sj = sArray[j];
                    var sk = sArray[ki];
                    if (si == sj || si == sk || sj == sk) continue;
                    rgbCount--;
                }

            Console.WriteLine(rgbCount);
        }
    }
}


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

// Solution class
class Solution {
    public Solution() { }
    private static final InputReader scan = new InputReader();
    // solve method
    public void solve() throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        // code goes here...
        int seconds = scan.nextInt();

        int hr = seconds / 3600;
        int min = (seconds % 3600) / 60;
        int sec = (seconds % 3600) % 60;
        out.println(hr + ":" + min + ":" + sec);

        out.close();
    }
}

// InputReader class
class InputReader {
    private final BufferedReader br;
    private StringTokenizer st = new StringTokenizer("");
    public InputReader() { br = new BufferedReader(new InputStreamReader(System.in)); }
    public String next() throws IOException {
        while (!st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException ie) { ie.printStackTrace(); }
        }
        return st.nextToken();
    }
    public String nextLine() throws IOException {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException ie) { ie.printStackTrace(); }
        return str;
    }
    public int nextInt() throws IOException { return Integer.parseInt(next()); }
    public long nextLong() throws IOException { return Long.parseLong(next()); }
    public double nextDouble() throws IOException { return Double.parseDouble(next()); }
}

// Main class
public class Main {
    public Main() { }
    // driver method
    public static void main(String[] args) throws IOException {
        new Solution().solve();
    }
}



Measured memory_bytes: 24296
#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int expr(string& s, int& i);
int term(string& s, int& i);
int factor(string& s, int& i);
int number(string& s, int& i);

int expr(string& s,int& i) {
	int a = term(s, i);
	while (s[i] == '+' || s[i] == '-') {
		char op = s[i];
		i++;
		int b = term(s, i);
		if (op == '+') {
			a = a+b;
		}
		else {
			a = a - b;
		}
	}
	return a;
}

int term(string& s, int& i) {
	int a = factor(s, i);
	while (s[i] == '*' || s[i] == '/') {
		char op = s[i];
		i++;
		int b = factor(s, i);
		if (op == '*') {
			a = a*b;
		}
		else {
			a = a / b;
		}
	}
	return a;
}

int factor(string& s, int& i) {
	if (isdigit(s[i])) {
		int a = number(s, i);
		return a;
	}
	else {
		i++;//(
		int a = expr(s, i);
		i++;//)
		return a;
	}
}

int number(string& s, int& i) {
	int a = s[i]-'0';
	i++;
	while (isdigit(s[i])) {
		a = a * 10 + (s[i] - '0');
		i++;
	}
	return a;
}

int main()
{
	int n;
	cin >> n;
	REP(j, n) {
		string ss;
		cin >> ss;
		int k = 0;
		cout << expr(ss, k) << endl;
	}

}

Measured memory_bytes: 3116
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi
# endregion
N = ri()
a = sorted(ri_(), reverse=True)
print(sum(a[0::2]) - sum(a[1::2]))

Measured memory_bytes: 62956
#include<iostream>
int main(){
  int u,k,C,V,A[1000][1000],D[1000][1000],n;
  std::cin >> n;
  for(int i=0;i<n;i++)for(int j=0;j<n;j++)D[i][j] = 200001;
  for(int i=0;i<n;i++){     std::cin >> u >> k;
    for(int j=0;j<k;j++){   std::cin >> V >> C;
      D[u][V] = C;}}
  for(int i=0;i<n;i++)D[i][i] = 0;
  for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)D[i][j]= std::min(D[i][j],D[i][k] + D[k][j]);
  for(int i=0;i<n;i++)std::cout << i << " " << D[0][i] << std::endl;
  return 0;
}

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

int main(void){
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    
    for (;a >= b || b >= c;k--) {
        if (a >= b) {
            b *= 2;
            continue;
        }
        
        if (b >= c) {
            c *= 2;
            continue;
        }
    }
    
    if (k >= 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No"  << endl;
    }
    return 0;    
}


Measured memory_bytes: 3616
using System;
using System.Linq;

namespace ProblemA
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = CIN.String();

            char initial = S[0];

            for (int i = 1; i < 4; i++)
            {
                if (initial == S[i])
                {
                    Console.WriteLine("Bad");
                    return;
                }

                initial = S[i];
            }
            Console.WriteLine("Good");
        }
    }

    internal static class CIN
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }

        public static int[] IntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] LongArray()
        {
            return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] DoubleArray()
        {
            return Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
        }
    }
}

Measured memory_bytes: 13140
S = input()

base_list = ["A", "T", "G", "C"]
seq_list = []
seq = ""
for s in S:
  if s in base_list:
    seq += s
  else:
    seq_list.append(seq)
    seq = ""
seq_list.append(seq)
seq_len_list = [len(seq) for seq in seq_list]
print(max(seq_len_list))

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

using namespace std;

int main() {
    string s;
    cin>>s;
    if(s=="SUN")
        cout<<7;
    else if(s=="MON")
        cout<<6;
    else if(s=="TUE")
        cout<<5;
    else if(s=="WED")
        cout<<4;
    else if(s=="THU")
        cout<<3;
    else if(s=="FRI")
        cout<<2;
    else if(s=="SAT")
        cout<<1;
}


Measured memory_bytes: 256
N = int(input())
b = list(map(int, input().split()))

ans = []
while not b == []:
  lenb = len(b)
  for i, v in enumerate(reversed(b)):
#    print(i, v, lenb, b)
    if (lenb - i) == v:
      del b[lenb - i - 1]
      ans.append(lenb - i)
      break
  else:
    print(-1)
    exit()

for a in reversed(ans):
  print(a)


Measured memory_bytes: 3060
#include <stdio.h>

void insertionSort(int *, int);

int main(){
  int A[1000], N, i;

  scanf("%d",&N);

  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  printf("%d",A[0]);
  for(i = 1; i < N; i++){
    printf(" %d",A[i]);
  }
  printf("\n");
  insertionSort(A, N);

  return 0;
}

void insertionSort(int *a, int n){
  int i, j, k, key;

  for(j = 1; j < n; j++){
    key = *(a + j);
    i = j - 1;
    while(i >= 0 && *(a + i) > key){
      *(a + (i+1)) = *(a + i);
      i = i - 1;
    }
    *(a + (i+1)) = key;
    printf("%d",*a);
    for(k = 1; k < n; k++) printf(" %d",*(a+k));
    printf("\n");
  }

  return;
}



Measured memory_bytes: 2060
n=int(input())
a=list(map(int, input().split()))

a.sort()
dp = [True] * a[-1]
ans = 0

for i,num in enumerate(a):
    if dp[num-1]:
        j= 2 * num
        while j <= a[-1]:
            dp[j-1] = False
            j += num
        if not i+1==len(a):
            if a[i]==a[i+1]:
                dp[num-1] = False

for k in a:
    if dp[k-1]:
        ans += 1

#print(dp)
print(ans)
       

Measured memory_bytes: 32236
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    long h,w,a,b;
    scanf("%ld %ld %ld %ld", &h, &w, &a, &b);
    if(a * b == 1){
        printf("No");
        return 0;
    }
    long n = 999999999 / (a * b - 1);
    long m = -n * (a * b - 1) - 1;
    if( (m - n) * (h / a) * (w / b) + n * h * w <= 0){
        printf("No");
    } else {
        printf("Yes\n");
        for(int i = 1; i < h+1; i++){
            for(int j = 1; j < w+1; j++){
                if(i % a == 0 && j % b == 0){
                    printf("%ld ", m);
                } else {
                    printf("%ld ", n);
                }
            }
            printf("\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 3240
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int h = sc.nextInt(),w = sc.nextInt();
		Map<Character,Integer> map = new HashMap<>();
		for(int i = 0; i < h; i++) {
			String s = sc.next();
			for(char c : s.toCharArray()) {
				if(map.containsKey(c)) {
					map.put(c, map.get(c)+1);
				} else {
					map.put(c, 1);
				}
			}
		}
		int one = 0,two = 0,four = 0;
		four = w/2 * (h/2);
		if(h%2==1&&w%2==1) {
			one = 1;
			two = w/2 + h/2;
		} else if(h%2==0&&w%2==1) {
			two = h/2;
		} else if(w%2==0&&h%2==1) {
			two = w/2;
		}
		//System.out.println(String.format("one=%d two=%d four=%d", one,two,four));
		Iterator<Integer> itr = map.values().iterator();
		while(itr.hasNext()) {
			int i = itr.next();
			//System.out.println(i);
			while(i>0) {
				if(i>=4&&four>0) {
					four--;
					i-=4;
				} else if(i>=2&&two>0) {
					two--;
					i-=2;
				} else if(i>=1&&one>0) {
					one--;
					i-=1;
				} else {
					break;
				}
			}
			//System.out.println(i);
		}
		//System.out.println(String.format("one=%d two=%d four=%d", one,two,four));
		if(one!=0||two!=0||four!=0) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}

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

int main(int argc, char *argv[]){
  int n;
  vector<int> a;
  while(cin >> n){
    a.push_back(-n);
  }
  sort(a.begin(), a.end());
  std::cout << -a[0] << std::endl;
  std::cout << -a[1] << std::endl;
  std::cout << -a[2] << std::endl;
  return 0;
}

Measured memory_bytes: 1220
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    wi,vi = map(int,input().split())
    w.append(wi)
    v.append(vi)
dp = [[0]*(W+1) for i in range(N+1)]
for i in range(N):
    for sum_w in range(W+1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w-w[i]]+v[i])
        dp[i+1][sum_w]=max(dp[i+1][sum_w],dp[i][sum_w])

print(dp[N][W])

Measured memory_bytes: 120684
void main()
{
    dchar[] s = rdDchar;

    bool rev;
    dchar[] front, back;
    long q = rdElem;
    foreach (i; 0 .. q)
    {
        string[] p = rdRow!string;
        if (p.length == 1)
        {
            rev = !rev;
        }
        else
        {
            long f = p[1].to!long - 1;
            dchar c = p[2].to!dchar;

            if (f)
            {
                if (rev) front ~= c;
                else back ~= c;
            }
            else
            {
                if (rev) back ~= c;
                else front ~= c;
            }
        }
    }

    if (rev)
    {
        s.reverse();
        back.reverse();
        writeln(back, s, front);
    }
    else
    {
        front.reverse();
        writeln(front, s, back);
    }
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 4632
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

K, N = reads()
MOD = 998244353

MAXN = 4020

fact = [1] * MAXN
for i in range(1, MAXN): fact[i] = (fact[i-1] * i) % MOD
invfact = [0] * MAXN; invfact[-1] = pow(fact[-1], MOD-2, MOD)
for i in range(MAXN-2, -1, -1): invfact[i] = invfact[i+1] * (i+1) % MOD
def comb(n, k):
  return fact[n] * invfact[n-k] * invfact[k] % MOD if 0 <= k <= n else 0
def h(n, k):
  return comb(n+k-1, n)

def solve(n, k, u):
  ans = 0
  for q in range(u+1):
    ans = (ans + comb(u, q) * pow(2, u-q, MOD) % MOD * h(n-u+q, k-q-u)) % MOD
  return ans

anss = [0] * (2*K+1)
for i in range(2, K+2):
  u = sum(j < i-j <= K for j in range(1, K+1))
  if i % 2 == 1:
    ans = solve(N, K, u)
  else:
    ans = (solve(N, K-1, u) + solve(N-1, K-1, u)) % MOD
  anss[i] = ans
  print(ans)

for j in range(K+2, 2*K+1):
  print(anss[2*K - j + 2])


Measured memory_bytes: 57052
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});
/* 入力は 
 */

var re = /\s+|$/;
reader.on('close', () => {
    var scores = [];
    var m,f,r;
    for (var line of lines) {
	[m,f,r] = line.trim().split(' ').map(Number);
	if (m==-1 && f==-1 && r==-1) {
	    break;
	}
	scores.push([m,f,r]);
    }
    
    console.log(aux(scores));
});

function aux(scores)
{
    var s = [];

    for (var score of scores) {
	let grade, m, f, r;
	[m,f,r] = score;
	if (m==-1 || f==-1) {
	    grade='F';
	} else if (m+f >= 80) {
	    grade='A';
	} else if (m+f >= 65) {
	    grade='B';
	} else if (m+f >= 50) {
	    grade='C';
	} else if (m+f >= 30 && r>=50) {
	    grade='C';
	} else if (m+f >= 30) {
	    grade='D';
	} else {
	    grade='F';
	}

	s.push(grade);
    }

    return(s.map(String).join('\n'));
}


Measured memory_bytes: 16412
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

namespace detail {
template <typename T, std::size_t NDIMS>
struct vector_builder {
  using type = std::vector<typename vector_builder<T, NDIMS - 1>::type>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    const auto vec = std::vector<T>(dims.empty() ? 0 : dims.back(), v);
    if (!dims.empty()) dims.pop_back();
    return vector_builder<std::vector<T>, NDIMS - 1>::make(dims, vec);
  }
};

template <typename T>
struct vector_builder<T, 1> {
  using type = std::vector<T>;

  static type make(std::vector<std::size_t> dims, const T& v = {}) {
    return type(dims.empty() ? 0 : dims.back(), v);
  }
};
}  // namespace detail

template <typename T, typename... SIZE_T>
auto exvector(const T& v, SIZE_T... dims) {
  static_assert(sizeof...(dims) != 0, "invalid dimension");
  std::vector<std::size_t> vec_dims{dims...};
  return detail::vector_builder<T, sizeof...(dims)>::make(vec_dims, v);
}

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T& data, vector<int>& iter) {
  cout << data << " ";
}
template <typename T>
void dump(const vector<T>& data, vector<int>& iter) {
  for (auto elem : data) dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>>& data, vector<int>& iter) {
  for (auto elem : iter) {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++) {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T>& data, int dummy) {
  for (int i = 0; i < data.size(); i++) {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T& data) {  // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long N, long long M) {
  vector<int> vals;
  for (int i = 1; i * i <= M; i++) {
    if (M % i == 0) {
      vals.push_back(i);
      vals.push_back(M / i);
    }
  }
  sort(vals.begin(), vals.end());
  int ans = 0;
  for (auto val : vals) {
    if (val <= M / N) ans = val;
  }
  cout << ans << endl;
}

int main() {
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  solve(N, M);
  return 0;
}


Measured memory_bytes: 256
while True:
    n, k = map(int, input().split())
    if n == 0:
        break
    a = [int(input()) for _ in range(n)]
    s = sum(a[:k])
    result = s
    for i in range(n - k):
        s += a[k + i] - a[i]
        result = max(result, s)
    print(result)


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

static constexpr int L = 6;

int remaining_blacks(const vector<string> &rows, const int rbits,
                     const int cbits) {
    const int H = rows.size();
    const int W = rows[0].size();

    const bitset<L> rbs(rbits);
    const bitset<L> cbs(cbits);

    int ans = 0;
    for (int r = 0; r < H; ++r) {
        for (int c = 0; c < W; ++c) {
            if (rbs.test(r) || cbs.test(c)) continue;
            if (rows[r][c] == '#') ++ans;
        }
    }
    return ans;
}

int choices(const vector<string> &rows, const int K) {
    const int H = rows.size();
    const int W = rows[0].size();

    int ans = 0;

    for (int rbits = 0; rbits <= (1 << H) - 1; ++rbits) {
        for (int cbits = 0; cbits <= (1 << W) - 1; ++cbits) {
            if (remaining_blacks(rows, rbits, cbits) == K) ++ans;
        }
    }

    return ans;
}

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

    int H, W, K;
    cin >> H >> W >> K;
    vector<string> rows(H, "");
    for (auto &row : rows) cin >> row;

    cout << choices(rows, K) << '\n';

    return 0;
}


Measured memory_bytes: 3608
#include<iostream>
#include<math.h>
using namespace std;

void swap(int &a,int &b){
    int  t=a;
    a=b;
    b=t;
}

void sort(int &a,int &b,int &c){
    if(a < b) swap(a,b);
    if(b < c) swap(b,c);
    if(a < b) swap(a,b);
}

int main(){
    int a[1000],b[1000],c[1000];
    int num;
    int i=0;
    do{
        cin >> num;
    }while(num > 1000);
    while(i < num){
        cin >> a[i] >> b[i] >>c[i];
        if(a[i] >= 1 && a[i] <= 1000)
             if(b[i] >= 1 && b[i] <= 1000)
                 if(c[i] >= 1 && c[i] <= 1000){
                    sort(a[i],b[i],c[i]);
                    i++;
                }
    }
    for(int i=0;i<num;i++){
        if(pow(a[i],2) == (pow(b[i],2) + pow(c[i],2)))
            cout << "YES"<<endl;
        else 
            cout << "NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1160
import heapq


x, y, z, k = map(int, input().split())
x_cake = [-float('inf')] + sorted(map(int, input().split()))
y_cake = [-float('inf')] + sorted(map(int, input().split()))
z_cake = [-float('inf')] + sorted(map(int, input().split()))


index_set = set()
x_index = y_index = z_index = -1
que = []
heapq.heappush(que, (-(x_cake[-1] + y_cake[-1] + z_cake[-1]), (-1, -1, -1)))
index_set.add((-1, -1, -1))
for _ in range(k):
    popped_tuple = heapq.heappop(que)
    print(-popped_tuple[0])
    x_index, y_index, z_index = popped_tuple[1]
    if (x_index-1, y_index, z_index) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index-1] + y_cake[y_index] + z_cake[z_index]), (x_index-1, y_index, z_index)))
        index_set.add((x_index-1, y_index, z_index))
    if (x_index, y_index-1, z_index) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index-1] + z_cake[z_index]), (x_index, y_index-1, z_index)))
        index_set.add((x_index, y_index-1, z_index))
    if (x_index, y_index, z_index-1) not in index_set:
        heapq.heappush(que, (-(x_cake[x_index] + y_cake[y_index] + z_cake[z_index-1]), (x_index, y_index, z_index-1)))
        index_set.add((x_index, y_index, z_index-1))

Measured memory_bytes: 59608
a = []
a = input().split()
H = int(a[0])
A = int(a[1])

hit = H // A
#print('hit=', hit)

nokori = H % A
#print('nokori=', nokori)

if nokori > 0:
  print(hit + 1)
if nokori == 0:
  print(hit)

#print('H=', H, 'A=', A)


Measured memory_bytes: 2940