akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)(n); i++)

int main(){
int N, M; cin >> N >> M; int A[M], B[M]; vector< vector<int> > nxt(N);
REP(i, N){ nxt[i]={}; }
REP(i, M){ cin >> A[i] >> B[i]; A[i]--; B[i]--; nxt[A[i]].push_back(B[i]); nxt[B[i]].push_back(A[i]); }
int col[N]={}, n=0; bool ksht[N]={};
REP(i, N){
  if(col[i]){ continue; }
  vector<int> V={i}; ksht[i]=true; n++;
  for(int j=0; j<V.size(); j++){ 
    int v=V[j], l=nxt[v].size(); col[v]=n; 
    REP(k, l){
      int nv=nxt[v][k];
      if(!ksht[nv]){ V.push_back(nv); ksht[nv]=true; } 
    }
  }
}
int ans=0, siz[n+1]={};
REP(i, N){ siz[col[i]]++; }
REP(i, N){ ans=max(ans, siz[col[i]]); }
cout << ans << "\n";
}

Measured memory_bytes: 17612
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

ll n, m;
vl hs;
vvl to;

ll dfs(ll v, vector<bool>& visited) {
    if (visited[v]) return 0;

    visited[v] = true;
    ll h = hs[v];
    bool f = true;
    ll res = 0;
    for (auto nv : to[v]) {
        if (hs[nv] >= h) f = false;
        res += dfs(nv, visited);
    }
    if (f) res++;
    return res;
}

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

    cin>>n>>m;
    hs = vl(n);
    cin>>hs;
    to = vvl(n);
    rep(i, m) {
        ll v1, v2;
        cin>>v1>>v2; v1--; v2--;
        to[v1].push_back(v2);
        to[v2].push_back(v1);
    }
    vector<bool> visited(n);
    ll ans = 0;
    rep(i, n) {
        if (!visited[i]) ans += dfs(i, visited);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 11912
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

int main(){
  ll n,m;
  vector<ll> a(mx);
  vector<ll> b(mx,0);
  cin >> n >> m;
  rep(i,n){
    cin>>a[i];
  }
  unordered_map<ll,ll> mp;
  rep(i,n){
    b[i+1]=(b[i]+a[i])%m;
    mp[b[i+1]]++;
  }
  mp[0]++;
  ll ans=0;
  for(auto c:mp){
    ans += c.S*(c.S-1)/2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5260
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
// #include<bits/stdc++.h>
using namespace std;
#define ll long long
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;

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

int main(){
  ll A,B;
  cin >> A >> B;
  ll C,D;
  cin >> C >> D;
  ll m = (C*D)/gcd(C,D);
  ll C1,D1;
  C1 = B/C - (A-1)/C;
  D1 = B/D - (A-1)/D;
  ll m1;
  m1 = B/m - (A-1)/m;
  cout << (B-A+1)-(C1+D1-m1) << endl;
  return 0;
}


Measured memory_bytes: 256
// https://arc004.contest.atcoder.jp/tasks/arc004_1

#include <iostream>

using namespace std;

int main() {
  int n;
  cin >> n;
  int y;
  cin >> y;
  y /= 1000;

  for (int a = 0; a <= n; a++) {
    for (int b = 0; a + b <= n; b++) {
      int c = n - (a + b);
      int sum = a * 10 + b * 5 + c;
      if (sum == y) {
	cout << a << " " << b << " " << c << endl;
	exit(0);
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
using namespace std;
int main(void){
    int n,q;
    cin>>n>>q;
    queue<pair<string,int>> que;
    for(int i=0;i<n;i++){
        string n;
        int t;
        cin>>n>>t;
        que.push(pair<string,int>(n,t));
    }
    int t=0;
    while(!que.empty()){
        pair<string,int> p;
        p=que.front();
        que.pop();
        if(p.second<=q){
            t+=p.second;
            cout<<p.first<<" "<<t<<endl;
        }
        else{
            p.second-=q;
            t+=q;
            que.push(p);
        }
    }
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (auto& x : a) { cin >> x; }
    for (auto& x : b) { cin >> x; }
    for (auto& x : c) { cin >> x; }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    auto itA = a.begin(), itB = b.begin(), itC = c.begin();
    int64_t accA = 0, accB = 0, accC = 0;
    for (; itC != c.end(); ++itC) {
        for (; itB != b.end() && *itB < *itC; ++itB) {
            for (; itA != a.end() && *itA < *itB; ++itA) {
                accA += 1;
            }
            accB += accA;
        }
        accC += accB;
    }
    cout << accC << '\n';
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
	int n, a, b,tuuka=0,kaigai=0;
	string s;
	cin >> n >> a >> b >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'a'&&tuuka < a + b) {
			cout << "Yes" << endl;
			tuuka++;
			goto loop;
		}
		if (s[i] == 'b') {
			kaigai++;
			if (tuuka < a + b && kaigai <= b) {
				cout << "Yes" << endl;
				tuuka++;
				goto loop;
			}
		}
		cout << "No" << endl;
	loop:;
	}
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using lint=long long;
using real=long double;
constexpr lint mod=1000000007;
struct mint{lint value;};
lint inverse(lint a){
    lint m=mod,u=0,v=1;
    while(a!=0){
        lint t=m/a;
        m-=t*a;std::swap(a,m);
        u-=t*v;std::swap(u,v);
    }
    assert(m==1);
    if(u<0)u+=mod;
    return u;
}
mint operator*(mint x,mint y){return mint{x.value*y.value%mod};}
mint&operator*=(mint&x,mint y){return x=mint{x.value*y.value%mod};}
mint operator/(mint x,mint y){return mint{x.value*inverse(y.value)%mod};}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::vector<std::vector<lint>>g(n);
    for(lint i=0;i<n-1;i++){
        lint u,v;std::cin>>u>>v;u--,v--;
        g.at(u).push_back(v);
        g.at(v).push_back(u);
    }
    std::vector<lint>ord;
    auto dfs=[&](auto&&dfs,lint x,lint p)->void{
        ord.push_back(x);
        auto&&v=g.at(x);
        for(lint y:v)if(p!=y)dfs(dfs,y,x);
        if(x)v.erase(std::find(v.begin(),v.end(),p));
    };
    dfs(dfs,0,0);
    auto rord=std::vector<lint>(ord.rbegin(),ord.rend());
    std::vector<lint>sz(n,1);
    std::vector<mint>fact(n+1);fact.at(0)=mint{1};
    for(lint i=1;i<=n;i++)fact.at(i)=fact.at(i-1)*mint{i};
    std::vector<mint>dp(n),ep(n);ep.at(0)=mint{1};
    for(lint x:rord){
        for(lint y:g.at(x))sz.at(x)+=sz.at(y);
        dp.at(x)=fact.at(sz.at(x)-1);
        for(lint y:g.at(x))dp.at(x)*=dp.at(y)/fact.at(sz.at(y));
    }
    for(lint x:ord){
        for(lint y:g.at(x)){
            ep.at(y)=dp.at(x)*ep.at(x)*fact.at(n-sz.at(y)-1)*fact.at(sz.at(y))
                /(dp.at(y)*fact.at(sz.at(x)-1)*fact.at(n-sz.at(x)));
        }
    }
    for(lint i=0;i<n;i++){
        std::cout<<(dp.at(i)*ep.at(i)*fact.at(n-1)
            /(fact.at(sz.at(i)-1)*fact.at(n-sz.at(i)))).value<<'\n';
    }
}


Measured memory_bytes: 24176
#include<iostream>
using namespace std;
int main(void)
{
	int a,b;
	cin>>a>>b;
	if(13<=a){
		cout<<b<<endl;
	}
	else if(13>a && a>=6){
		cout<<b/2<<endl;
	}
	else{
		cout<<0<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
-- Structured Program I - Print a Frame

import Control.Applicative

main :: IO ()
main = do
  xs <- map words . takeWhile (/= "0 0") . lines <$> getContents
  mapM_ putStrLn $ map (frame . map read) xs

frame :: [Int] -> String
frame [h, w] = a ++ (concat $ replicate (h - 2) b) ++ a
  where
    a = replicate w '#' ++ "\n"
    b = '#' : replicate (w - 2) '.' ++ "#\n"



Measured memory_bytes: 4372
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int top;
int S[1000];

void push(int x) {
    S[++top]=x;
}
int pop() {
    top--;
    return S[top+1];
}
int main() {
    int a, b;
    top=0;
    char s[100];
    while (cin >> s) {
        if (s[0]=='+') {
            a=pop();
            b=pop();
            push(a+b);
        } else if (s[0]=='-') {
            b=pop();
            a=pop();
            push(a-b);
        } else if (s[0]=='*') {
            a=pop();
            b=pop();
            push(a*b);
        } else {
            push(atoi(s));
        }
    } 
    printf("%d\n",pop());  
    return 0;
}

Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repn(i,n) for(ll i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define bac(i,a,b) for(ll i=a;i>=b;i--)
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define pi pair<ll,ll>
#define vpi vector<pair<ll,ll>>
using namespace std;

ll MOD=1e9+7;
ll g,h,l;
const ll N=100005, inf=1e9+5;

ll add(ll a,ll b); ll mul(ll a,ll b); ll binpo(ll a,ll b);

int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    ll lt = sz(t), ls = sz(s);
    ll dp[lt+1][ls+1]={};
    rep(i,1,lt){
        rep(j,1,ls){
            if(s[j-1]==t[i-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    string ss;
    ll i = lt, j = ls;
    // cout<<dp[lt][ls]<<endl;
    if(!dp[lt][ls]){
        cout<<ss;
        return 0;
    }
    // rep(i,1,lt){
    //     rep(j,1,ls){
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }
    while(i!=0 and j!=0){
        // cout<<i<<" "<<j<<endl;
        if(dp[i-1][j]==dp[i][j]){
            i--;
        }
        else if(dp[i][j]==dp[i][j-1]){
            j--;
        }
        else{
            ss += s[j-1];
            i--;j--;
        }
    }
    reverse(all(ss));
    cout<<ss;
    // cout<<dp[lt][ls];
}

ll add(ll a,ll b)
{
    return (a%MOD+b%MOD)%MOD ;
}
ll mul(ll a,ll b)
{
    return (a* 1ll *b)%MOD ;
}
ll binpo(ll a,ll b)
{
    int ans = 1 ;
    while(b)
    {
        if( b % 2 != 0)
        {
            ans = mul(ans,a);
        }
        a = mul(a,a);
        b = b/2;
    }
    return ans;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int x,a; cin >>x >>a;
  if(x<a) cout <<0;
  else cout <<10;
}

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

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

int main(){
  int N;cin >> N;
  vll A(N);rep(i,N)cin>>A[i];
  sort(all(A),greater<ll>());
  ll ans=0;
  rep(i,N){
    if(i==0)ans+=A[0];
    else if(i==N-1) continue;
    else ans+=A[(i+1)/2];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4836
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define N '\n'
#define S ' '
#define Z '0'
#define RT return
#define elif else if
#define W(a) while(a)
#define RP(a,b,c) for(ll a=(b);a<(c);++a)
#define R(a,b) for(ll a=0;a<(b);++a)
#define RD(a,b) for(ll a=(b);a>=0;++a)
#define LI(a) for(auto &x:a)I(x)
#define P(a) cout<<"a"<<N
#define F(a) cout<<fixed<<setprecision(10)<<a
#define D(a,b,c) cout<<setfill(a)<<setw(b)<<right<<c
#define C cin.tie(0);ios::sync_with_stdio(false)
ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y,z;
const int P[15]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};
inline void I(){}
template<class T,class...A>inline void I(T&&t,A&&...a){cin>>t;I(move(a)...);}
template<class T>inline void O(T t){cout<<t<<N;}
template<class T,class...A>inline void O(T t,A...a){cout<<t<<S;O(move(a)...);}
inline ll dig(ll a){ll d=1;W(a/=10)++d;RT d;}
inline ll GCD(ll a,ll b){ll c;W(a){c=a;a=b%a;b=c;}RT b;}
inline bool isp(ll a){if(a<48){RP(i,0,15)if(P[i]==a)RT 1;}
    elif(a<2809)RT GCD(614889782588491410,a)==1;
    else {O("Error:Argument is Over-2808!");exit(1);}RT 0;}

int main(){
    C;
    ll A[3];
    LI(A);
    sort(A,A+3);
    cout<<abs(A[1]-A[0])+abs(A[2]-A[1]);
















}


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

int main(void){
    int a, b, m, mb=INT_MAX, ans=INT_MAX;
    cin >> a >> b >> m;
    vector<int> al(a),bl(b);
    
    rep(i,a){
        cin >> al.at(i);
        if(al.at(i)<ans)ans=al.at(i);
    }
    rep(i,b){
        cin >> bl.at(i);
        if(bl.at(i)<mb)mb=bl.at(i);
    }
    ans+=mb;
    rep(i,m){
        int x, y, c, ttl;
        cin >> x >> y >> c;
        ttl=al.at(x-1)+bl.at(y-1)-c;
        if(ttl<ans)ans=ttl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var h = next(), w = next();
  var a = nexts(h,1);
  var ans1 = xArray("'.'",h,w);
  var ans2 = xArray("'.'",h,w);
  for(var i = 0; i < h; i++){
    ans1[i][0] = ans2[i][w-1] = "#";
    for(var j = 1; j < w-1; j++){
      if(i & 1)ans1[i][j] = "#";
      else ans2[i][j] = "#";
      if(a[i][j] === ".")continue;
      ans1[i][j] = ans2[i][j] = "#";
    }
  }
  console.log(ans1.map(a=>a.join("")).join("\n"));
  console.log("");
  return ans2.map(a=>a.join("")).join("\n");
}

Measured memory_bytes: 44336
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <math.h>
using namespace std;

int n, m, inf = 1e6;
int a[105], b[105], c[105], d[105], e[105];

int route1(int n) {
    int s = 1;
    for (int i = 0; i < n; i++) s = (s * 2) % inf;
    return s;
}

int route2(int n) {
    a[0] = 1;  b[0] = c[0] = d[0] = e[0] = 0;
    for (int i = 1; i < n; i++) {
        a[i] = (a[i - 1] + b[i - 1] + c[i - 1] + e[i - 1]) % inf;
        b[i] = (a[i - 1] + b[i - 1] + c[i - 1]) % inf;
        c[i] = (a[i - 1] + b[i - 1] + c[i - 1] + d[i - 1]) % inf;
        d[i] = (a[i - 1] + d[i - 1]) % inf;
        e[i] = (c[i - 1] + e[i - 1]) % inf;
    }
    return (4 * a[n - 1] + 3 * (b[n - 1] + c[n - 1]) + 2 * d[n - 1] + e[n - 1]) % inf;
}


int main(void){
    cin >> n >> m;
    if (m == 1) {
        cout << route1(n) << endl;
    }
    else { // m == 2
        cout << route2(n) << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3076
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var h = new int[N];
            for (int i = 0; i < N; i++)
            {
                h[i] = cin.ReadInt;
            }

            Console.WriteLine(h.Where(t => t >= K).Count());
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 19296
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
const int MAX_N=3000;
int n,k;
ll fact[MAX_N], invfact[MAX_N];
ll extgcd(ll a, ll b, ll& x, ll&y){
    ll d=a;
    if(b!=0){
        d=extgcd(b, a%b, y, x);
        y-=(a/b)*x;
    }
    else {
        x=1; y=0;
    }
    return d;
}

ll mod_inverse(ll a, ll m=MOD){
    ll x,y;
    extgcd(a,m,x,y);
    return (m+x%m)%m;
}
ll comb(ll a, ll b){
    if(b<0) return 0;
    if(a<0) return 0;
    if(a<b) return 0;
    return fact[a]*invfact[b]%MOD*invfact[a-b]%MOD;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>k;
    fact[0]=1;
    invfact[0]=1;
    rep(i,1,MAX_N){
        fact[i]=fact[i-1]*i%MOD;
        invfact[i]=mod_inverse(fact[i]);
    }
    if(n==k){
        cout <<1<<"\n";
        rep(i,2,k+1){
            cout <<0<<"\n";
        }
        return 0;
    }
    rep(i,1,k+1){
        ll ans=1;
        ans=comb(k-1,i-1)*((comb(n-k-1,i-2)+2*comb(n-k-1,i-1)%MOD+comb(n-k-1,i))%MOD)%MOD;
        cout <<ans<<"\n";
    }
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, K;
  cin >> N >> K;
  llvec A(N);
  rep(i, N){
    cin >> A[i];
  }
  ll cnt = 0;
  ll tmp = 0;
  set<ll> equiv;
  rep(i, N-1){
    if(A[i]<=A[i+1]){
      cnt++;
      //cout << i << " " << A[i] << "<" << A[i+1] << " cnt=" << cnt << endl;
    }else{
      cnt=0;
    }
    if(cnt>=K-1){
      equiv.insert(i-K+2);
    }
  }
  if(cnt>=K-1){
    tmp += cnt-K+2;
  }
  //for(auto i:equiv)cout << i << " ";
  //cout << endl;
  //cout << tmp << endl;
  set<ll> num;
  bool chk=true;
  rep(i, K){
    num.insert(A[i]);
  }
  ll ans = (equiv.count(0)==0? 1:0);
  for(ll i=1;i<=N-K;i++){
    auto it0 = num.lower_bound(A[i-1]);
    auto it1 = num.upper_bound(A[i+K-1]);
    if(it0==num.begin() and it1==num.end()){      
      //}else if(equiv.count(i)==0){
    }else{
      if(equiv.count(i)==0)
      ans +=1;
    }
    //cout << A[i-1] << " " << A[i+K-1] << " " << ans << endl;
    num.erase(A[i-1]);
    num.insert(A[i+K-1]);
  }

  if(equiv.size()>0)ans++;
  cout << ans;
  return 0;
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
    #define REP(i, n) for(int i = 0;i < n;i++)
    #define REPR(i, n) for(int i = n;i >= 0;i--)
    #define FOR(i, m, n) for(int i = m;i < n;i++)
    #define FORR(i, m, n) for(int i = m;i >= n;i--)
    #define SORT(v, n) sort(v, v+n);
    #define VSORT(v) sort(v.begin(), v.end());
    #define llong long long
    #define pb(a) push_back(a)
    #define INF 999999999
    using namespace std;
    typedef pair<int, int> P;
    typedef pair<llong, llong> LP;
    typedef pair<int, P> PP;
    typedef pair<llong, LP> LPP;
    //vector<tuple<long long, long long, long long>>vec;

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

    llong gcd(llong a, llong b) {
            return b != 0 ? gcd(b, a % b) : a;
        }

    int main()
    {
    int n;
    cin>>n;
    vector<llong> a(n,0);
    llong ans=1000000001;
    llong cnt;
    REP(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    for(int i=0; i<a.size()-1; i++)
    {
        cnt=gcd(a[i],a[i+1]);
        ans=min(cnt,ans);
    }
    cout<<ans<<endl;
    }

Measured memory_bytes: 1024
//Switching Railroad cars

#include <iostream>
#include <stack>
using namespace std;

int main() {
	int n;
	stack<int> s;
	while(cin >> n) {
		if(n != 0) s.push(n);
		else {
			cout << s.top() << endl;
			s.pop();
		}
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

int h, w, n, x, y;
string s, t, c = "UDLR";
int now[4] = {0}, lim[4] = {0};

bool solve();

int main() {
  cin >> h >> w >> n >> x >> y >> s >> t;
  if(solve())
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}

bool solve() {
  now[0] = x;
  now[1] = h + 1 - x;
  now[2] = y;
  now[3] = w + 1 - y;
  lim[0] = lim[1] = h;
  lim[2] = lim[3] = w;
  for(int i = 0; i < n; ++i) {
    cout << endl;
    for(int j = 0; j < 4; ++j)
      if(c[j] == s[i])
        if(--now[j] == 0) return 1;
    for(int j = 0; j < 4; ++j)
      if(c[1 ^ j] == t[i] && now[j] + 1 <= lim[j]) ++now[j];
  }
  return 0;
}

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

int main(){
  int n,x;
  cin >> n >> x;
  vector<int> l(n);
  for(int i=0; i<n; i++) cin >> l[i];
  int d=0, cnt=1;
  for(int i=0; i<n; i++) {
    d += l[i];
    if(d <= x) cnt++;
    else {
      cout << cnt << endl;
      return 0;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
trash=gets
input = gets
ary = input.split(" ")
ary.map!(&:to_i)
ary.sort!{|a,b|b <=> a}
long=ary[0]
ary.delete_at(0)
if long < ary.inject(:+) then
    print "Yes"
else
    print "No"
end

Measured memory_bytes: 1788
a,b,k = map(int, input().split())
li = dict(a = a, b = b, k = k)

now = "a"
for i in range(li["k"]):
    add = 0
    if li[now] % 2:
        li[now] -= 1
    li[now] = int(li[now]/2)
    add += li[now]
    if now == "a":
        now = "b"
    else:
        now = "a"
    li[now] += add
print(li["a"],li["b"])

Measured memory_bytes: 3064
// ARC090
// C - Candies

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;

const int MAX_N = 100;

int N;
int a[3][MAX_N + 1];
int dp[3][MAX_N + 1];

int main() {
    cin >> N;

    memset(a, 0, sizeof(a));
    for (int i = 1; i <= 2; i++) {
        for (int j = 1; j <= N; j++) {
            cin >> a[i][j];
        }
    }

    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= 2; i++) {
        for (int j = 1; j <= N; j++) {
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]) + a[i][j];
        }
    }

    cout << dp[2][N] << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int H[N];
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  int ans=0,count=0;
  for(int i=1;i<N;i++){
    if(H[i-1]>=H[i]){
      count++;
      ans=max(ans,count);
    }
    else{
      count=0;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
typedef long long ll;
typedef pair<ll, ll> lll;
typedef vector<lll> vlll;
 
int main() {FIN
	
	ll n, x, l, i, c = 0, ans;
	cin >> n;
	vlll rb(n);
	for (i = 0; i < n; i++) {
		cin >> x >> l;
		rb[i] = lll(x + l, x - l);
	}
	sort(rb.begin(), rb.end());
	for (i = 0; i < n; i++) {
		if (i == 0) {
			ans = rb[i].first;
			c++;
		} else if (rb[i].second >= ans) {
			ans = rb[i].first;
			c++;
		}
	}
	cout << c << "\n";
	return 0;
}


Measured memory_bytes: 1792
N = int(input())
pool = [int(i) for i in input().split()]
sum = 0
sub = 0
for i in range(len(pool)):
    sum += pool[i]
sum = sum/2    
sub = sum
for i in range(0,N-1,2):
    sub -= pool[i]
a = pool[N-1]-sub
print(int(a)*2)
for i in range(len(pool)-1):
    print(int(pool[i]-a)*2)
    a = pool[i]-a

Measured memory_bytes: 14024
import Data.List

main = interact $ unlines . map (show . matsuzaki . map read . words) . init . lines

matsuzaki [n,p] = last . take p . sort $[p1+p2 | p1<-primes', p2<-primes', p1<=p2]
 where primes' = take p (dropWhile (<=n) primes)

primes = 2:3:[x | i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
 where isPrime n = null [i | i<-takeWhile (\x -> x*x <= n) primes, rem n i == 0]

Measured memory_bytes: 5840
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstdlib>
#define cmax(a,b) (a<(b)?a=(b),1:0)
#define cmin(a,b) (a>(b)?a=(b),1:0)
#define dmin(a,b) ((a)<(b)?(a):(b))
#define dmax(a,b) ((a)>(b)?(a):(b))
#define regsiter register
#define CL fclose(stdin),fclose(stdout)
namespace io
{
	int F()
	{
		int n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
	long long G()
	{
		long long n=0,F=1;
		char ch;
		while((ch=getchar())!='-'&&(ch<'0'||ch>'9'));
		ch=='-'?F=0:n=ch-'0';
		while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0';
		return F?n:-n;
	}
}
int a[111];
int main()
{
	int n=io::F();
	for(register int i=1;i<=n;++i)a[i]=io::F();
	long long ans=1,od=1;
	for(register int i=1;i<=n;++i)ans*=3;
	for(register int i=1;i<=n;++i)
		if(a[i]%2==0)od*=2;
	printf("%lld\n",ans-od);
	return 0;
}




Measured memory_bytes: 128
#include <iostream>
#include <cmath>
using namespace std;
int main(void) {
    long long int n;
    cin >> n;
    int max = 1;
    for (int i = 1; i <= sqrt(n*1.0); i++) {
        if (n%i == 0) {
            max = i;
        }
    }
    int ans = 0;
    long long int a = n / max;

    while (1) {
        if (a == 0) {
            break;
        }
        a = a / 10;
        ans++;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>):Unit {
    repeat(readLine()!!.toInt()){
        val (n, k) = readLine()!!.split(' ').map(String::toInt)
        val homes = readLine()!!.split(' ').map(String::toLong)
        println(homes.last() - homes.first() - (1 until n).map{
            homes[it] - homes[it - 1]
        }.sortedDescending().take(k - 1).sum())
    }
}


Measured memory_bytes: 75240
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
// #define endl '\n';
#define fi first
#define se second
#define NONVOID [[nodiscard]]
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}

int main() {

    int x,y;
    cin>>x>>y;
    fin(gcd(x,y));
}




Measured memory_bytes: 3092
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
#print(n,a,b,c,)
p = 0
for i in range (n):
  #print("i=",i)
  #print("ryouri",a[i],"wotabetanode",b[a[i]-1],"mannzokudowoemasita")
  p += b[a[i]-1]
  if i >= 1 and a[i]-1 == a[i-1]:
    #print(a[i]-1,a[i-1])
    ci = a[i-1]
    #print(ci)
    #print("rennbannnanode",c[ci-1],"tsuikasimasu")
    p += c[ci-1]
    #print(p)
print(p)

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


int main(){
	char S[10];
	scanf("%s",S);

	if(strlen(S) %2 != 0){
		printf("No\n");
		return 0;
	}
	if(S[0] != 'h'){
		printf("No\n");
		return 0;	
	}
	for(int i=0; i<strlen(S)-1; i+=2){
		if(S[i] == 'h' && S[i+1] == 'i'){
			int count = 0; 
		}
		else{
			printf("No\n");
			return 0;				
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 128
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

/*

1 2 3 4 5 6 7 8 9
5
1 0 1 1 0
=> 0 1 1 1 0

1 2 3 4 5 6 7 8 9
8
1 1 0 1 0 0 0 1
0 0 0 0 0 0 0 1

*/

fn main() {
    let N = read!(usize);
    let mut A = read![[i64]];

    A.insert(0, 0);
    let mut dp = vec![0; N + 1];

    for i in (1..N + 1).rev() {
        let mut m = 2;
        let mut s = A[i];
        while i * m <= N {
            s ^= dp[i * m];
            m += 1;
        }
        dp[i] = s;
    }
    debug!(dp);

    let M = (1..N + 1)
        .filter_map(|i| {
            if dp[i] != 0 {
                Some(i.to_string())
            } else {
                None
            }
        })
        .collect::<Vec<_>>();

    println!("{}", M.len());
    println!("{}", M.join(" "));
}


Measured memory_bytes: 14344
#include<bits/stdc++.h>
using namespace std;
bool ispal(string a)
{
    long long int n=a.length();
    if(n==1)
        return true;
    else{
    int i=0,j;
    j=n-1;
    while(1)
    {
        if(a[i]!=a[j])
        {
            cout<<i<<" "<<j;
           return false;
        }
        i++,j--;
        if(i==j)
         {
        //     cout<<i<<" ";
             break;
        }
    }
    return true;
}}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
long long int a,b,d;
cin>>a>>b>>d;
int d1,d2;
a--;
d1= a/d;
d2= b/d;
cout<<d2-d1;
}

Measured memory_bytes: 3608
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define MOD 1000000007
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n, x;
	cin >> n >> x;

	Array s(n);
	REP(i, n) cin >> s[i];
	sort(all(s), greater<ll>());

	Matrix dp(n+1, Array(x + 1,0));
	dp[0][x] = 1;

	for (int i = 0; i < n; i++) {
		REP(j, x+1) {
			(dp[i + 1][j % s[i]] += dp[i][j]) %= MOD;
			(dp[i + 1][j] += (n-i-1)*dp[i][j]%MOD) %= MOD;
		}
	}

	ll sum = 0;
	REP(i, x + 1) (sum +=(i* dp[n][i])%MOD)%=MOD;

	cout << sum << endl;

	return 0;
}

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

int main() {
  int N, L;
  cin >> N >> L;
  vector<int> a(N);
  for(int i = 0; i < N; i++) {
    a[i] = L + i;
  }
  vector<int> b(N);
  for(int i = 0; i < N; i++) {
    b[i] = abs(a[i]);
  }
  int min = 1000;
  int c;
  for(int i = 0; i < N; i++) {
    if(min > b[i]) {
      min = b[i];
      c = i;
    }
  }
  if(a[c] < 0) min = min * (-1);
  int ans = 0;
  for(int i = 0; i < N; i++) {
    ans += a[i];
  }
  cout << ans - min << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int N,L,j=0,sum=0,min=100;
    scanf("%d%d",&N,&L);
    int abso[N];
    for(int i=0;i<N;i++){
        sum+=L+i;
    }
    for(int i=0;i<N;i++){
        if(L+i<0)
            abso[i]=-(L+i);
        else
            abso[i]=L+i;
        if(min>abso[i]){
            min=abso[i];
            j=i;
        }
    }
    printf("%d\n",sum-(L+j));
    return 0;
}


Measured memory_bytes: 128
package main

import (
  "fmt"
)

func main() {
  var N int
  fmt.Scanf("%d\n", &N)
  p := make([]float64, N)
  for i:=0;i<N;i++ {
    fmt.Scanf("%f", &p[i])
  }
  fmt.Println(solve(N, p))
}

func solve(n int, p []float64) float64 {
  dp := make([][]float64, n+1)
  for i:=range dp {
    dp[i] = make([]float64, n+1)
  }
  dp[0][0] = 1
  //
  for i:=1;i<=n;i++ {
    for j:=0;j<=i;j++ {
      if j == 0 {
        dp[i][j] = dp[i-1][j]*(1-p[i-1])
        continue
      }
      dp[i][j] = dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
    }
  }
  //
  var ret float64
  for j:=n/2+1;j<=n;j++ {
    ret += dp[n][j]
  }
  return ret
}


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

int main ()
{
    int n, p;
    vector<bool> num(1000001, true);
    vector<int> prim;
    num[0] = num[1] = false;
    for (int i = 2; i <= 1000000; i++) {
        for (int j = 2; num[i] && i * j <= 1000000; j++) {
            num[i * j] = false;
        }
        if (num[i]) prim.push_back(i);
    }

    while (cin >> n >> p, !(n < 0 || p < 0)) {
        vector<int> v;
        int s = upper_bound(prim.begin(), prim.end(), n) - prim.begin();
        if (prim[s] <= n) s++;
        for (int i = 0; i <= p; i++) {
            for (int j = i; j <= p; j++) {
                v.push_back((prim[s + i] + prim[s + j]));
            }
        }

        sort(v.begin(), v.end());
        cout << v[p-1] << endl;
    }

    return 0;
}

Measured memory_bytes: 1712
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        for (int i = 0; i < N/2; i++) {
            if (S.charAt(i) != S.charAt(N-1-i)) {
                System.out.println("No");
                return;
            }
        }
        for (int i = 0; i < N/2; i++) {
            if (S.charAt(i) != S.charAt(N/2-1-i)) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");
    }
}



Measured memory_bytes: 22100
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =998244353;
const int maxn = 300005;
#define endl '\n'
#define ld long double
#define int ll
#define all(x) (x).begin(),(x).end()
typedef long double dbl;
#define pw(x) (1LL << (x))
#define forn(i, n) for (int i = 0; i < (n); i++)
const ll md = (ll) 1e9 + 7;
 
inline ll add(ll a, ll b) {
  a += b;
  if (a >= md) a -= md;
  return a;
}
 
inline ll sub(ll a, ll b) {
  a -= b;
  if (a < 0) a += md;
  return a;
}
 
inline ll mul(ll a, ll b) {
  return (ll) ((long long)((a%md) * (b%md)) % md);
}
 
inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
 
inline ll inv(ll a) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

vector<int> g[maxn], ed;
int n;
int dfs(int u, int p){
  int sub = 1;
  for(auto v:g[u]){
    if(v == p){
      continue;
    }
    int now = dfs(v, u);
    sub += now;
    ed.push_back(now*(n-now));
  }
  return sub;
}

int32_t main()
{ 
  IOS

  
int n, x, t;
cin >> n >> x >> t;

  cout << ((n+x-1)/x)*t;
  





  

  










  
    
} 
 

Measured memory_bytes: 10680
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EACH(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

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

#define INF INT_MAX/3

#define MAX_N 1000

int n,l;
vector<string> v;

int main(){
	cin>>n>>l;
	REP(i,n){
		string s;
		cin>>s;
		v.push_back(s);
	}
	sort(all(v));
	REP(i,v.size()){
		cout<<v[i];
	}
	cout<<endl;
	return 0;
}




Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.math.max

val br = BufferedReader(InputStreamReader(System.`in`))
val out = PrintWriter(System.out)

fun main() {
    br.use { out.use {
        solve()
        out.flush()
    } }
}


fun Long.mod() = this % 1000000007

fun solve() {
    val n = readInteger()
    val s = br.readLine()!!.toList()
    val countMap = elementCountMap(s)
    var ans = 1L
    for (c in countMap.values) {
        ans = (ans * (c + 1L).mod()).mod()
    }
    out.println(ans - 1)
}

fun <T>elementCountMap(list: List<T>): Map<T, Int> {
    val countMap = mutableMapOf<T, Int>()
    for (e in list) {
        countMap.merge(e, 1) { oldValue, value -> oldValue + value }
    }
    return countMap
}

fun readInteger() = Integer.parseInt(br.readLine())
fun readLong() = java.lang.Long.parseLong(br.readLine())
fun readStringList() = br.readLine()!!.split(' ')
fun readIntegerList() = readStringList().map(Integer::parseInt)
fun readLongList() = readStringList().map(java.lang.Long::parseLong)
fun readDoubleList() = readStringList().map(java.lang.Double::parseDouble)


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


table = {}
for i in range(h):
    a = input()
    for c in a:
        if c not in table:
            table[c] = 1
        else:
            table[c] += 1

mod0 = []
mod1_3 = []
mod2 = []
for key, value in table.items():
    if value % 4 == 0:
        mod0.append(key)
    elif value % 4 == 2:
        mod2.append(key)
    else:
        mod1_3.append(key)


if w % 2 == 0 and h % 2 == 0:
    if len(mod1_3) > 0 or len(mod2) > 0:
        print("No")
    else:
        print("Yes")

elif w % 2 == 0 or h % 2 == 0:
    if h % 2 == 0:
        w, h = h, w

    if w // 2 < len(mod2):
        print("No")
    elif len(mod1_3) > 0:
        print("No")
    else:
        print("Yes")
else:
    if len(mod1_3) == 1 and len(mod2) <= h // 2 + w // 2:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 65012
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main()
{
    int N; cin >> N;
    vector<int> a(N);
    long long sum = 0;
    rep (i, 0, N) {
        cin >> a[i];
        sum += a[i];
    }
    long long mean = round(sum / (float)N);

    long long cost = 0;
    rep (i, 0, N) {
        if (mean != a[i])
            cost += pow(a[i]-mean, 2);
    }

    cout << cost << endl;
}

Measured memory_bytes: 384
#include <stdio.h>

int main(void) {
    
    int S;
    
    scanf("%d", &S);
    
    int hour = S/3600;
    int minute = S%3600/60;
    int second = S%3600%60;
    
    printf("%d:%d:%d\n", hour, minute, second);
	
	
	return 0;
}



Measured memory_bytes: 2052
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
	string st;
	while (getline(cin,st)) {
		int jnum = 0, inum = 0;
		for (int i = 0; i < st.size(); ++i) {
			string a = st.substr(i, 3);
			if (a == "JOI")jnum++;
			else if (a == "IOI")inum++;
		}
		cout << jnum << endl << inum << endl;
	}
	
	return 0;
}

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

using namespace std;

int main(){
    int l,r,d;
    scanf("%d %d %d", &l, &r, &d);
    printf("%d", r/d - (l-1)/d);
    return 0;
    
    return 0;
}


Measured memory_bytes: 3256
#include <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
 
using namespace boost::multiprecision;
using namespace std;
 
int main()
{
  int n;
  cin >> n;

  vector<int> ar;
  for (int i=0; i<n; ++i){
    int a;
    cin >> a;
    ar.push_back(a);
  }

  sort(ar.begin(), ar.end(), std::greater<int>());
  cpp_int s = 0;
  for (int i=0; i<n-1; ++i){
    s += ar[(i+1)/2];
  }

  cout << s;
  
  return 0;
}


Measured memory_bytes: 3952
def lcm(a, b):
    if a < b:
        a2, b2 = b, a
    else:
        a2, b2 = a, b
    while b2 != 0:
        a2, b2 = b2, a2%b2
    return a*b//a2

N = int(input())
T1 = int(input())
if N == 1:
    ans = T1
else:
    T2 = int(input())

    ans = lcm(T1, T2)

    for i in range(N-2):
        Ti = int(input())
        ans = lcm(ans, Ti)

print(ans)

Measured memory_bytes: 3064