akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
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(){
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll ans = 0;
  while(1){
    ll tmp = 0;
    rep(i,n){
      tmp += a[i]/n;
    }
    if(tmp==0) break;
    rep(i,n){
      ll t = a[i]/n;
      a[i] = a[i] - t*n + tmp-t;
    }
    ans += tmp;
  }
  cout << ans << endl;
  return 0;
}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
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<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int h,w;cin>>h>>w;
    vvc s(h,vc(w));
    vector<vector<bool> > b(h,vb(w));
    rep(i,h)rep(j,w){
        cin>>s[i][j];
        if(s[i][j]=='#')b[i][j]=true;
    }
    queue<pair<int,int>> que;
    que.push(make_pair(0,0));
    b[0][0]=false;
    while(!que.empty()){
        int x = que.front().first;
        int y = que.front().second;
        que.pop();
        bool is_right = false;
        //右と下に移動
        for(int i=0;i<3;i+=2){
            int ex = x + dx[i];
            int ey = y + dy[i];
            if(ex < 0 || ex >=h || ey <0 || ey >= w)continue;
            if(b[ex][ey]){
                b[ex][ey]=false;
                que.push(make_pair(ex,ey));
                if(is_right){
                    out("Impossible");
                    return 0;
                }
                if(i == 0)is_right = true;
            }
        }
    }
    //rep(i,h)rep(j,w)cout<<b[i][j];
    rep(i,h)rep(j,w)if(b[i][j]){
        out("Impossible");
        return 0;
    }
    out("Possible");
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
const int MAXN=100005;
int n,m;
int fa[MAXN];
bool vis[MAXN];
int ans=0;

int find(int x){
	if (fa[x]==x) return x;
	else return fa[x]=find(fa[x]);
}

int main()

{
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for (int i=1;i<MAXN;i++){
		fa[i]=i;
	}

	for (int i=1;i<=m;i++){
		int x,y,z;
		cin>>x>>y>>z;
		fa[find(x)]=find(y);
	}

	for (int i=1;i<=n;i++){
		if (!vis[find(i)]){
			vis[find(i)]=true;
			ans++;
		}
	}

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

Measured memory_bytes: 1152
use std::io;
use std::cmp;


fn main() {
    let (a, b, c) = {
        let i = read::<usize>();
        (i[0], i[1], i[2])
    };

    println!("{}", b + cmp::min(c, a + b + 1));
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
std::str::FromStr,
T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 4352
package main

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

func main() {
	sc := NewScanner()

	n := sc.ReadInt()
	k := sc.ReadInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = sc.ReadInt()
	}

	totalL := 0
	for _, ai := range a {
		totalL += ai
	}

	lastLogCount := n + k

	cutLogs := make([]CutLog, n)
	for i, ai := range a {
		cutTimes := Max(0, lastLogCount*ai/totalL-1)
		eachL := float64(ai) / (float64(cutTimes) + 1)
		cutLogs[i] = CutLog{i, cutTimes, eachL}
	}

	totalCutCount := 0
	for _, cutLog := range cutLogs {
		totalCutCount += cutLog.CutTimes
	}

	sort.Slice(cutLogs, func(i, j int) bool {
		return cutLogs[i].EachL > cutLogs[j].EachL
	})

	longestCutLog := cutLogs[k-totalCutCount]

	fmt.Println(int(math.Ceil(longestCutLog.EachL)))
}

type CutLog struct {
	Number   int
	CutTimes int
	EachL    float64
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *Scanner) ReadFloat() float64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseFloat(text, 64)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 10804
#include<iostream>
#include<vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
using namespace std;


int main(){

	long long X, Y;
	long long sum = 0;
	cin >> X >> Y;

	if (X == 1){
		sum += 300000;
	}

	if (X == 2){
		sum += 200000;
	}

	if (X == 3){
		sum += 100000;
	}

	if (Y == 1){
		sum += 300000;
	}

	if (Y == 2){
		sum += 200000;
	}

	if (Y == 3){
		sum += 100000;
	}


	if (X == 1 && Y == 1){
		sum += 400000;
	}
	cout << sum;
	

	return 0;
}

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

int main() {
    long long n;
    cin >> n;
    long long h[n];
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    long long ans = 0;
    std::vector<long long> v;
    for (int i = 0; i < n; i++) {
        if ( h[i] >= h[i+1]) {
            ans++;
            if ( i == n-1 ) {
                v.push_back(ans);
            }
        } else {
            v.push_back(ans);
            ans = 0;
        }
    }
    cout << *max_element(v.begin(), v.end()) << endl;
    return 0;
}


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

int main(void){
	int n;
	int c;
	int *v;
	int sum = 0;
	scanf("%d", &n);
	v = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++)
		scanf("%d", v + i);
	for(int i = 0; i < n; i++){
		scanf("%d", &c);
		if(v[i] - c > 0)sum += v[i] - c;
	}
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    ll n, m;
    cin >> n >> m;
    ll a[101000], b[100100], c[101000];
    vector<P> x;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        x.emplace_back(P(a[i], 1));
    }
    for(int i = 0; i < m; i++){
        cin >> b[i] >> c[i];
        x.emplace_back(P(c[i], b[i]));
    }

    sort(x.begin(), x.end());
    reverse(x.begin(), x.end());

    ll res = 0;
    for(auto y: x){
        if(n >= y.sc){
            res += y.fs * y.sc;
            n -= y.sc;
        }
        else{
            res += y.fs * n;
            n -= n;
        }
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 8092
solve :: Int -> Int -> [Int] -> Int
solve _ _ [] = 0
solve _ _ (_:[]) = 0
solve n k (a:b:rs)
  | a == b = solve n k (b:rs)
  | n <= k = 1
  | otherwise = 1 + solve (n - k + 1) k ((minimum (take k array)):(drop k array))
  where
    array = a:b:rs

main :: IO ()
main = do
  s1 <- getLine
  s2 <- getLine
  let n:k:_ = map (\x -> read x :: Int) $ words s1
      array = map (\x -> read x :: Int) $ words s2
  print $ solve n k array


Measured memory_bytes: 37884
#include<stdio.h>
int main(){
  int n,a,i;
  scanf("%d\n",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a);
    if(a%2==0 && a%3!=0 && a%5!=0){
      printf("DENIED\n");
      return 0;
    }
  }
  printf("APPROVED\n");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

char s[300000];
stack<ll> st,st2,L2;
queue<ll> L;

int main(void){
    ll a,l,max,maxi,level;

    scanf("%s",s);

    int len = strlen(s);
    max = 0;level = 0;maxi = 0;
    REP(i,len){
        if(s[i] == '/')
            level++;
        else if(s[i] == '\\')
            level--;
        if(max < level){
            max = level;maxi = i;
        }    
    }
    a = 0;l = 0;
    REP(i,maxi + 1){
        if(s[i] == '\\')
            st.push(i);
        else if(s[i] == '/' && st.empty() == false){
            ll b = i - st.top();
            st.pop();
            a += b;l += b;
        }

        if(st.empty() == true && l > 0){
            L.push(l); l = 0;
        }
    }
    l = 0;
    RFOR(i,maxi,len){
        if(s[i] == '/')
            st2.push(i);
        else if(s[i] == '\\' && st2.empty() == false){
            ll b = st2.top() - i;
            st2.pop();
            a += b;l += b;
        }
        if(st2.empty() == true && l > 0){
            L2.push(l);l = 0;
        }
    }

    while(L2.empty() == false){
        L.push(L2.top());L2.pop();
    }


    printf("%lld\n%lld",a,L.size());
    if(L.size() > 0)
        printf(" ");
    while(L.empty() == false){
        printf("%lld",L.front());
        L.pop();
        if(L.empty() == true)
            break;
        else
            printf(" ");
    }
    printf("\n");
    return 0;
} 

Measured memory_bytes: 3284
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#define ll long long

using namespace std;

int a[105];

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

	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (i != minj) {
            int tmp = a[i];
            a[i] = a[minj];
            a[minj] = tmp;
			cnt++;
		}
	}
	for (int i = 0; i < N; i++) {
		if (i != 0) {
			cout << " ";
		}
		cout << a[i];
	}
	cout << endl << cnt << endl;

	return 0;
}





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

#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,l,r) for (int i=l;i<=r;i++)
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
#define mod 1000000007
#define random_jbt mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using namespace std;

int main(){
    int n,h=0,ans=0,a[22];
    cin>>n;
    for (int i=1;i<=n;i++){
        cin>>a[i];
    }
    ans=1;
    for (int i=2;i<=n;i++){
        bool ok=true;
        for (int j=i-1;j>=1;j--){
            if (a[j]>a[i])ok=false;
        }
        if (ok)ans++;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

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

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}
ll mul(ll a, ll b, ll md){
	return a*b % md;
}
vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}
ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
const int N = 500+5;

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	fact_init(2005);
	int n, k; cin>>n>>k;
	for(int i = 1; i <= k; i++){
		int ans = komb(k-1, i-1) * komb(n-k-(i-1) + i, i) % mod;
		cout<<ans<<"\n";
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a,b;
    while(1){
        scanf("%d %d",&a,&b);
        if(a==0&&b==0){break;}
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
    }
}


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

int main(){
	int a, b;
	cin >> a >> b;
	for (int i = 0; i<2000;i++){
		if ( floor((float) (i*8)/100) == a && floor((float) (i*10)/100) == b) {cout << i; return 0;};
	}
	cout << -1;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
    long long x;
    mint(long long x=0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1), ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};
// combination c(max);
// mint c(n, k)

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    combination c(1e6);
    mint ans = 0;
    for (int m = 0; m <= min(n-1, k); ++m) {
        ans += c(n, m) * c(n-1, m);
    }
    cout << ans << endl;
}

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

int main() {
  int n, h, w;
  cin >> n >> h >> w;
  
  int cnt = 0;
  while (n--) {
    int a, b;
    cin >> a >> b;
    if (a >= h && b >= w) ++cnt;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<algorithm>
#include<map>
#include<set>
#include<functional>

using namespace std;

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

long long int W, H, x, y;

int main() {
	cin >> W >> H >> x >> y;

	cout << (W * H) / 2.0 << " " << flush;

	if (W % 2 == 0 && H % 2 == 0 && x ==  W / 2 && y == H / 2) {
		cout << 1 << endl;
	}
	else {
		cout << 0 << endl;
	}

}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    a = [0] * N
    w = [0] * N

    for _ in range(M):
        p, s = map(str, input().split())
        if a[int(p) - 1] == 1:
            continue
        if s == "AC":
            a[int(p) - 1] = 1
        elif s == "WA":
            w[int(p) - 1] += 1

    wa = 0
    for i in range(N):
        if a[i] == 1:
            wa += w[i]

    print(sum(a), wa)


if __name__ == "__main__":
    main()


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

#define MOD 1000000007
typedef unsigned long long ull;
typedef long long ll;

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

#define MAX 200001
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;

  if (n == 2) {
    cout << 0;
    return 0;
  }

  COMinit();

  ull max = modpow(2, n, MOD) - 1;  // 総パターン数

  // n x n-1 x .. x n-k+1
  ull nca = 1;
  for (int i = 1; i <= a; i++) {
    nca *= n - i + 1;
    nca %= MOD;
  }

  nca *= finv[a];
  nca %= MOD;

  ull ncb = 1;
  for (int i = 1; i <= b; i++) {
    ncb *= n - i + 1;
    ncb %= MOD;
  }

  ncb *= finv[b];
  ncb %= MOD;

  ll ans = max - nca - ncb;
  cout << (ans + MOD * 2) % MOD;
}


Measured memory_bytes: 4992
def GcdLcm(a, b):
	p = a * b
	if a < b:
		a, b = b, a
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b
	return [b, int(p / b)]

while True:
	try:
		a, b = [eval(item) for item in input().split()]
		g, l = GcdLcm(a, b)
		print(str(g), str(l))
	except EOFError:
		break

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, int> Pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  ll k;
  cin >> n >> k;
  vi a(n), f(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> f[i];
  sort(a.begin(), a.end());
  sort(f.begin(), f.end(), greater<int>());
  dump(a);
  dump(f);
  auto isOk = [&](ll mid) {
    ll kk = k;
    dump(mid);
    rep(i, n) {
      ll af = (ll)a[i] * f[i];
      if (mid < af) {
        ll j = ((af - mid) + f[i] - 1) / f[i];
        if (j <= kk) {
          kk -= j;
        } else {
          return false;
        }
      }
    }
    return true;
  };
  ll ng = -1;
  ll ok = (ll)a[n - 1] * f[0];
  dump(ng, ok);
  while (abs(ok - ng) > 1) {
    ll mid = (ok + ng) / 2;
    if (isOk(mid)) ok = mid;
    else ng = mid;
  }
  cout << ok << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
int const M=1e6+10,inf=1e9+10;
int inc,a[M];
main()
{
	int n,sum=0;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],sum+=a[i];
	if(sum%((n*(n+1))/2)!=0)return cout<<"NO",0;
	int res=(sum/((n*(n+1))/2));
	//cout<<res;
	for(int i=1;i<=n;i++)
	{
		int last=i+1;
		if(last==n+1)last=1;
		int bad=res-(a[last]-a[i]);
		//cout<<bad<<" ";
		if(bad<0 || bad%n!=0)return cout<<"NO",0;
	}
	cout<<"YES";
}

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

const int MAX_V = 105, INF = 10005;

struct edge {
    int to, cap, rev;
};

vector<edge> G[MAX_V];
vector<int> used(MAX_V, 0);

void add_edge (int from, int to, int cap) {
    G[from].push_back((edge){to, cap, (int)(G[to].size())});
    G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

int dfs (int v, int t, int f) {
    if (v == t) return f;
    used[v] = 1;
    for (int i = 0; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (!used[e.to] && e.cap > 0) {
            int d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

int max_flow (int s, int t) {
    int ans = 0;
    for (; ; ) {
        for (int i = 0; i < MAX_V; i++) {
            used[i] = 0;
        }
        int f = dfs(s, t, INF);
        if (f == 0) {
            return ans;
        }
        ans += f;
    }
}


int main() {
    int v, n;
    cin >> v >> n;
    for (int i = 0; i < n; i++) {
        int u, v, c;
        cin >> u >> v >> c;
        add_edge(u, v, c);
    }/*
    for (int i = 0; i < v; i ++) {
        for (int j = 0; j < G[i].size(); j++) {
            edge &e = G[i][j];
            cout << "{"<<e.to <<", "<<e.cap <<", " << e.rev <<"}" << " | ";
        }
        cout << endl;
    }*/
    cout << max_flow(0, v-1) << endl;
    return 0;
}

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

int main(){
     int N;
     while(cin>>N,N){
	  int sum=0;
	  for(int i=0;i<N/4;i++){
	       int t;
	       cin>>t;
	       sum+=t;
	  }
	  cout<<sum<<endl;
     }
}
     

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vst;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

const ll mod=1e9+7;
const ll inf=1e16; 

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

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

  ll n;
  cin >> n;
  cout << (n+1)/2 << endl;
   
  
  
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n, s, c = int(input()), [[0 for i in range(10)] for j in range(10)], 0
for i in range(1, n+1): s[int(str(i)[0])][int(str(i)[-1])] += 1
print(sum([s[i][j] * s[j][i] for i in range(1, 10) for j in range(1, 10)]))

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

int main(){
	string s1,s2,s3,s[55]={""};
	cin>>s1>>s2;
	int len1=s1.size(),len2=s2.size(),n=0;
	for(int i=0;i<len1-len2+1;i++){
		int f=0;
		s3=s1.substr(0,i)+s2+s1.substr(i+len2);
		for(int j=0;j<len1;j++){
			if(s1[j]=='?'||s1[j]==s3[j]){
				continue;
			}
			f=1;
		}
		if(f==0){
			n++;
			s[n]=s3;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<s[i].size();j++){
			if(s[i][j]=='?'){
				s[i][j]='a';
			}
		}
	}
	sort(s+1,s+n+1);
	if(s[1]!="")cout<<s[1]<<endl;
	else cout<<"UNRESTORABLE"<<endl;
	return 0;
}

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

int main() {
	int n; cin >> n;
	set <int> s;
	rep(i,n) {
		int a; cin >> a;
		s.insert(a);
	}
	cout << s.size() << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

int N;
vector<int> A;
string f(){
  REP(i, N){
    if(A[i]%2 == 1) return "first";
  }
  return "second";
}

signed main() {
  cin >> N;

  A.resize(N);
  REP(i, N) cin >> A[i];

  cout << f() << "\n";

  return 0;
}

Measured memory_bytes: 1024
ans_list = []
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
while True:
    y1, m1, d1, y2, m2, d2 = map(int, input().split())
    if y1+y2+m1+m2+d1+d2 == -6:
        break
    else:
        ans = 0
        dis_m = m2 - m1
        dis_y = y2 - y1
        leap = 0
        if dis_y == 0:
            leap = 0
            if y1 % 4 == 0:
                if y1 % 100 == 0:
                    if y1 % 400 != 0:
                        leap = 1
                else:
                    leap = 1
            if dis_m == 0:
                ans = d2 - d1
            else:
                ans += sum(days[m1:m2-1]) + days[m1-1] - d1 + d2
            if leap == 1 and m1 < 3 and 2 < m2:
                ans += 1
            ans_list.append(ans)
        else:
            for y in range(y1, y2+1):
                leap = 0
                if y % 4 == 0:
                    if y % 100 == 0 and y % 400 != 0:
                        leap = 0
                    else:
                        leap = 1
                if y == y1:
                    ans += sum(days[m1:]) + days[m1-1] - d1
                    if leap == 1 and m1 < 3:
                        ans += 1
                elif y == y2:
                    ans += sum(days[:m2-1]) + d2
                    if leap == 1 and m2 > 2:
                        ans += 1
                else:
                    if leap == 0:
                        ans += 365
                    else:
                        ans += 366
            ans_list.append(ans)
for a in ans_list:
    print(a)



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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

vector<int> a;
void addd(int d){
    if(d==a.size()) a.push_back(1);
    else a[d]++;

    if(a[d]==10 ||
        d!=a.size()-1 && abs(a[d]-a[d+1])>1){
        a[d]=0;
        addd(d+1);
        a[d]=max(0, a[d+1]-1);
    }
}

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

    rep(i, k){
        addd(0);
    }
    for(auto it=a.rbegin(); it!=a.rend(); it++) cout<<(*it);
    cout<<endl;

    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main()
{
  int N;
  cin>>N;
  int last=N%10;
  if(last==2 || last==4 || last==5 || last==7 || last==9)
  {
    cout<<"hon"<<endl;
  }
  else if(last==0 || last==1 || last==6 || last==8)
  {
    cout<<"pon"<<endl;
  }
  else{
    cout<<"bon"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;


public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			String[] s = sc.nextLine().split(",");
			int[] values = new int[11];
			double[] v = new double[2];
			for(int i=0;i<11;i++){
				if(i == 0){
					values[i] = 0;
				}else{
					values[i] = Integer.parseInt(s[i-1]) + values[i-1];
				}
			}

			for(int i=0;i<2;i++){
				v[i] = Integer.parseInt(s[i+10]);
			}

			double temp = v[0] /(v[0] + v[1]);
			temp *= values[10];

			boolean flag = true;
			for(int i=0;i<10;i++){
				if(values[i] <= temp && temp <= values[i+1] && flag){
					System.out.println(i+1);
					flag = false;
				}
			}
		}
	}
}

Measured memory_bytes: 17148
#include <iostream>

using namespace std;

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

    int i = 1, rezultat = 0;

    while(i <= n){
        int h;
        cin >> h;

        if(h >= k){
            rezultat = rezultat + 1;
        }
        i = i + 1;
    }

    cout << rezultat << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int f=0;
	int k,a,b;
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			f=1;
			break;
		}
	}
	if(f==1)
	printf("OK");
	else
	printf("NG");
}

Measured memory_bytes: 3764
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <deque>
 
#define ll long long
#define cint const int
#define ld long double
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define add +
#define minus -
#define squer(a) sqrt(a)
#define mod % 
 
using namespace std;

int n, m;
string s;

int main () {
	cin >> n >> m >> s;
	for (int i = 0; i < n; ++i) {
		if (i + 1 == m) {
			cout << char(tolower(s[i]));
			continue;
		}
		cout << s[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
using namespace std;


int main() {
	long long H, W;
	cin >> H >> W;
	//H,Wのどちらかが3倍の場合
	if (H % 3 == 0 || W % 3 == 0){
		cout << "0\n";
		return 0;
	}

	//それ以外の場合全通りやってみる
	long long maxSize = 0, maxH = 0;
	for (long long i = 0; i < H; i++){
		if (i*W>H*W / 3){
			maxSize = i*W;
			maxH = i;
			break;
		}
	}
	long long minSize = (H - maxH)*(W / 2);
	long long ans = maxSize - minSize;

	maxSize = 0;
	long long maxW = 0;
	for (long long i = 0; i < W; i++){
		if (i*H>H*W / 3){
			maxSize = i*H;
			maxW = i;
			break;
		}
	}
	minSize = (W - maxW)*(H / 2);
	if (ans > maxSize - minSize){
		ans = maxSize - minSize;
	}

	//縦3分割

	if (ans > (W*(H / 3 + 1)) - (W*(H / 3))){
		ans = (W*(H / 3 + 1)) - (W*(H / 3));
	}
	//よこ3分割
	if (ans > (H*(W / 3 + 1)) - (H*(W / 3))){
		ans = (H*(W / 3 + 1)) - (H*(W / 3));
	}

	//1/3超えないパターン

	//それ以外の場合全通りやってみる
	maxSize = 0, maxH = 0;
	for (long long i = 0; i < H; i++){
		if (i*W>H*W / 3){
			i--;
			maxSize = i*W;
			maxH = i;
			break;
		}
	}
	
	if (W % 2 == 0){
		minSize = (H - maxH)*(W / 2);
	}
	else{
		minSize = (H - maxH)*(W / 2+1);
	}
	if (ans > minSize - maxSize){
		ans = minSize - maxSize;
	}

	maxSize = 0;
	 maxW = 0;
	for (long long i = 0; i < W; i++){
		if (i*H>H*W / 3){
			i--;
			maxSize = i*H;
			maxW = i;
			break;
		}
	}
	if (H % 2 == 0){
		minSize = (W - maxW)*(H / 2);
	}
	else{
		minSize = (W - maxW)*(H / 2+1);
	}
	if (ans > minSize - maxSize){
		ans = minSize - maxSize;
	}

	cout << ans << "\n";


	return 0;
}

Measured memory_bytes: 256
import bisect
L = []
for _ in range(int(input())):
  a, b = map(int, input().split())
  a, b = (a-1)//2, (b-1)//2
  L.append([a,b])
X_1 = [i for i in range(2, 10**5+1)]
X_2 = []
while len(X_1)>0:
  X_2.append(X_1[0])
  X_1 = [x for x in X_1 if x%X_1[0] != 0]
T = [0]*(10**5)
for i in range(10**5-1):
  if bisect.bisect_left(X_2, 2*i+1)!=bisect.bisect_right(X_2, 2*i+1)\
  and bisect.bisect_left(X_2, i+1)!=bisect.bisect_right(X_2, i+1):
    T[i+1]=T[i]+1
  else:
    T[i+1]=T[i]
for l in L:
  print(T[l[1]+1]-T[l[0]])

Measured memory_bytes: 116156
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define Fi first
#define Se second
signed main(){
    int a,p;
    cin>>a>>p;
    p+=a*3;
    cout<<p/2<<endl;
    return 0;
}


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

#define int long long
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define WL(t) while(t --)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define print(arr) for (auto it = arr.begin(); it != arr.end(); ++it) cout << *it << " "; cout << endl;
#define debug(x) cout << x << endl;
#define debug2(x,y) cout << x << " " << y << endl;
#define debug3(x,y,z) cout << x << " " << y << " " << z << endl;
#define rep(i,a,n) for(int i=a; i<n; i++)
#define endl "\n"
#define E "\n"
#define show(arr) REP(i,arr.size()){cout<<arr[i]<<" ";}
const int INF = 1e18+1;
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;
const int MAX = 1e18;
const int N = 55556;
vi s(N,1);

void solve()
{
    int n,i=11;
    cin>>n;
    vi a;
    while (a.size()<n&&i<N){
        if (s[i]&&i%5==1) a.pb(i);
        i++;
    }
    show(a);
    cout<<E;
}

signed main()
{
    int t=1;
    //cin>>t;

    s[0]=0;
    s[1]=0;
    for (int i=2; i*i<N; i++){
        if (s[i]==0) continue;
        for (int j=i*i; j<N; j+=i) s[j]=0;
    }

    WL(t)solve();

    return 0;
}


Measured memory_bytes: 3540
#include <bits/stdc++.h>
//#pragma GCC target("avx,avx2,sse4.2")
#define rep(q, a, b) for (int q = a, q##_end_ = b; q <= q##_end_; ++q)
#define dep(q, a, b) for (int q = a, q##_end_ = b; q >= q##_end_; --q)
#define mem(a, b) memset(a, b, sizeof a)
#define debug(a) cerr << #a << ' ' << a << "___" << endl
using namespace std;
// char buf[10000000], *p1 = buf, *p2 = buf;
#define Getchar() getchar()  // p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 10000000, stdin), p1 == p2) ? EOF : *p1++
void in(int &r) {
    static char c;
    r = 0;
    while (c = Getchar(), c < 48);
        ;
    do
        r = (r << 1) + (r << 3) + (c ^ 48);
    while (c = Getchar(), c > 47);
}
const int mn=100005;
int val[mn],mid[mn],n;
struct BIT{
	int c[mn];
	void add(int x,int v){
		while(x)c[x]=max(c[x],v),x&=x-1;
	}
	int ask(int x){
		int ans=0;
		while(x<=n)ans=max(ans,c[x]),x+=x&-x;
		return ans;
	}
}an;
int main(){
	in(n);
	rep(q,1,n)in(val[q]),mid[q]=val[q];
	sort(mid+1,mid+n+1);
	rep(q,1,n)val[q]=lower_bound(mid+1,mid+n+1,val[q])-mid;
	rep(q,1,n)an.add(val[q],an.ask(val[q])+1);
	cout<<an.ask(1);
	return 0;
}

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

struct TPond
{
	int DownPoint;
	int Surface;
};

void ConstructPond(stack<TPond> &PondRow, stack<int> &DownPointRow, int InputCount)
{
	TPond Pond;
	Pond.DownPoint = DownPointRow.top();
	Pond.Surface = InputCount - DownPointRow.top();
	//???????±????????????´?????????????±??????????
	//???????±????????????´????????´?????????
//	cout << Pond.DownPoint << ' ' << Pond.Surface << endl;
	if(PondRow.empty()){
		
	}else{
		//????????´???????±????????????§???????±????????????????????????°?±?list???????????????
		//????????´???????±????????????§???????±????????????????????????°????????´???????±???????????????????
		if(Pond.DownPoint > PondRow.top().DownPoint){
			
		}else{
			while(!PondRow.empty() && Pond.DownPoint < PondRow.top().DownPoint){
				Pond.Surface += PondRow.top().Surface;
				PondRow.pop();
			}
			
		}
	}
	PondRow.push(Pond);
	DownPointRow.pop();
	return;
}

void Output(stack<TPond> PondRow)
{
	stack<TPond> DummyPondRow;
	int Count = 0;
	//?????¢???????±???????
	int SumOfSurface = 0;
	while(!PondRow.empty()){
		SumOfSurface += PondRow.top().Surface;
		DummyPondRow.push(PondRow.top());
		PondRow.pop();
		Count += 1;
	}
	//?????¢?????¨??°???????????????
	cout << SumOfSurface << endl << Count << ' ';
	//?????????????????¢??????????????????
	for(int i = 0; i < Count-1; i++){
		cout << DummyPondRow.top().Surface << ' ';
		DummyPondRow.pop();
	}
	cout << DummyPondRow.top().Surface << endl;
	return;
}

int main()
{
	//?±?(????????????????????°??¨??¢???????????±?????????)????????????list???????????????
	stack<TPond> PondRow;
	//????????????????????°????????????stack???????????????
	stack<int>   DownPointRow;
	//????????????????????°???????????????????????????????????°???????????????
	int InputCount = 0;
	while(true){
		//??????????????????????????\???????????\?????????
		char Input;
		cin >> Input;
		if(cin.good() == false){
			break;
		}
		InputCount += 1;
		//???????????\???????????????DownPointRow???????????????
		if(Input == '\\'){
			DownPointRow.push(InputCount);
		}//???????????\????????????????????´?????????????????????????±?????§??????????
		if(Input == '/' && !DownPointRow.empty()){
			ConstructPond(PondRow, DownPointRow, InputCount);
		}
	}
	if(PondRow.empty()){
		cout << 0 << endl << 0 << endl;
	}else{
		Output(PondRow);
	}
	return 0;
}

Measured memory_bytes: 1288
#include <iostream>
#include <vector>

using namespace std;

int main(){
    vector<unsigned long long> v;
    unsigned long long n,atl=2,ans=0;
    
    cin >> n;

    for(unsigned long long i=0;i<n;i++){
        unsigned long long t;
        cin >> t;
        v.push_back(t);
    }
    ans=v.at(0)-1;
    for(unsigned long long i=1;i<n;i++){
        if(atl==v.at(i)){
            atl++;
        }
        if(atl<v.at(i)){
            ans+=(v.at(i)/atl);
            if(v.at(i)%atl==0){
                ans--;
            }
        }
    
    }
    cout << ans << endl;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define FOR(i, N) for (long i = 0; i < (N); i++)

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

    if (x < 600) {
        cout << 8 << endl;
    } else if (x < 800) {
        cout << 7 << endl;
    } else if (x < 1000) {
        cout << 6 << endl;
    } else if (x < 1200) {
        cout << 5 << endl;
    } else if (x < 1400) {
        cout << 4 << endl;
    } else if (x < 1600) {
        cout << 3 << endl;
    } else if (x < 1800) {
        cout << 2 << endl;
    } else {
        cout << 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3648
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n, k;
  cin >> n >> k;
  double ans = 0;
  for(int i = 1; i <= n; i++) {
    ll tmp = i;
    int cnt = 0;
    while(tmp < k) {
      tmp *= 2;
      cnt++;
    }
    ans += (double)1 / (n * pow(2, cnt));
  }
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 101
#define WHITE 0
#define BLACK 1

typedef struct node{
  int omomi[MAX];
  int color;
}Node;


Node point[MAX];
int n;
int count=0;

int d[MAX];
int pi[MAX];



void prim();

int main(){
  int i,j;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      scanf("%d",&point[i].omomi[j]);
      if(point[i].omomi[j]==-1)point[i].omomi[j]=2001;
    }
  }

  prim();

  for(i=1;i<=n;i++){
    count+=d[i];
  }
  printf("%d\n",count);
  
  return 0;
}


void prim(){
  int i,j,u,v;
  int mincost;

  for(i=1;i<=n;i++){
    d[i]=2001;
    
    point[i].color=WHITE;

    d[1]=0;
  }

  while(1){
    mincost=2001;

    for(i=1;i<=n;i++){
      if(point[i].color!=BLACK && d[i]<mincost){
	mincost=d[i];
	u=i;
      }
    }
    
    if(mincost==2001)break;

    point[u].color=BLACK;

    for(v=1;v<=n;v++){
      if(point[v].color==WHITE && point[u].omomi[v]<d[v]){
	d[v]=point[u].omomi[v];
      }
    }

    
  }



  

  }



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


int main () {
	
  int a,b,c,k;
  cin >> a;
  cin >> b;
  cin >> c;
  cin >> k;
  
  if(k<=a)
  {
	  cout << k << endl;
  }
  
  else if(k<=(a+b))
  {
		cout << a << endl;
  }
  else
  {
  	cout << a-(k-a-b);
  }

   	
	return 0;
}


Measured memory_bytes: 3128
from collections import defaultdict


def main():
    s = input()
    ans = 0
    for i in range(len(s)):
        if i < (len(s) + 2 - 1) // 2:
            ans -= s[i] == "p"
        else:
            ans += s[i] == "g"
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}

int main(){
    int n;
    in(n);
    vector<int> x(n),y(n);
    in(x,y);
    double d0=0,d1=0,d2=0;
    ll d3=0;
    rep(i,n){
        d0+=abs(x[i]-y[i]);
        d1+=(x[i]-y[i])*(x[i]-y[i]);
        d2+=abs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
        d3=max(d3,(ll)abs(x[i]-y[i]));
    }
    d1=sqrt(d1);
    d2=pow(d2,0.33333333333333);
    out(d0);out(d1);out(d2);out((double)d3);
}


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

namespace AtCoder.Question
{
    public class QuestionB
    {
        public static void Main(string[] args)
        {
            var n = ReadValue<long>();
            var array = ReadValues<long>();
            long result = 1;
            long max = (long)Math.Pow(10,18);
            if (array.Any(x => x == 0))
            {
                Console.WriteLine(0);
                return;
            }
            for (int i = 0; i < array.Length; i++)
            {
                if (max / result < array[i])
                {
                    Console.WriteLine(-1);
                    return;
                }
                result *= array[i];
            }
            Console.WriteLine(result);
        }
        static T ReadValue<T>()
        {
            return (T)Convert.ChangeType(Console.ReadLine(), typeof(T));
        }
        static (T1, T2) ReadValue<T1, T2>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)));
        }
        static (T1, T2, T3) ReadValue<T1, T2, T3>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)));
        }
        static (T1, T2, T3, T4) ReadValue<T1, T2, T3, T4>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T1)Convert.ChangeType(input[0], typeof(T1)), (T2)Convert.ChangeType(input[1], typeof(T2)), (T3)Convert.ChangeType(input[2], typeof(T3)), (T4)Convert.ChangeType(input[3], typeof(T4)));
        }
        static T[] ReadValues<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return input.Select(x => (T)Convert.ChangeType(x, typeof(T))).ToArray();
        }
    }
}


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

int main(void){
    int N;
    cin >> N;
    vector<float> v(N);

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

    for (int i = 0; i < N-1; i++){
        sort(v.begin()+i, v.end());
        v[i+1] = (v[i] + v[i+1]) / 2.0;
    }

    cout << v[N-1] << endl;

    return 0;
}

Measured memory_bytes: 256
H,W=map(int, input().split())
S=["."+input()+"." for _ in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
ans="Yes"
for i in range(H):
  for j in range(W):
    if S[i][j]=="#" and S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
      ans="No"
print(ans)

Measured memory_bytes: 3064