akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define ull unsigned long long
#define ll long long
const int inf = 1e9;
const int MAXN = 4e6+4;

vector<vector<int>> vect(3e5+1, vector<int>(0));
vector<bool> was(3e5+1, false);
vector<int> arr(3e5+1, 0);
vector<int> depth(3e5+1, 0);
vector<int> colors;
ll mod=1e9+7;
void solve(){
    int n;
    cin>>n;
    arr.resize(n);
    colors.resize(n);
    int mass[4];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    mass[1]=0;
    mass[2]=0;
    mass[3]=0;
    ll mult=1;
    for(int i=0;i<n;i++){
        if(arr[i]==mass[3] && arr[i]==mass[1] && arr[i]==mass[2]){
            mult*=3l;
            mult%=mod;
            mass[1]++;
            colors[i]=1;
        }
        else if(arr[i]==mass[3] && arr[i]==mass[1]){
            mult*=2l;
            mult%=mod;
            mass[1]++;
            colors[i]=1;
        }
        else if(arr[i]==mass[2] && arr[i]==mass[1]){
            mult*=2l;
            mult%=mod;
            mass[1]++;
            colors[i]=1;
        }
        else if(arr[i]==mass[2] && arr[i]==mass[3]){
            mult*=2l;
            mult%=mod;
            mass[2]++;
            colors[i]=2;
        }
        else if(arr[i]==mass[1]){
            mass[1]++;
            colors[i]=1;
        }
        else if(arr[i]==mass[2]){
            mass[2]++;
            colors[i]=2;
        }
        else if(arr[i]==mass[3]){
            mass[3]++;
            colors[i]=3;
        }
        else {
            mult=0;
        }
    }
    cout<<(mult%mod+mod)%mod;


}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n=1;
    for(int i=0;i<n;i++) solve();
    return 0;
}

Measured memory_bytes: 10112
program trained
  implicit none
  integer :: n, a(100000) = 0, i, k
  read(*,*) n
  do i = 1, n
    read(*,*) a(i)
  end do
  i = 1
  do k = 1, n
    i = a(i)
    if (i == 2) then
      write(*,'(i0)') k
      stop
    end if
  end do
  write(*,'(i0)') -1
end program trained

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PA;
typedef priority_queue<int, vector<int>, greater<int> > GQint;
typedef priority_queue<int> PQint;
typedef priority_queue<PA, vector<PA>, greater<PA> > GQpair;
typedef priority_queue<PA> PQpair;
typedef	set<int> Sint;
typedef	set<PA> SPA;
typedef map<int, int> MAP;
#define REP(i, a, n) for(ll i = (ll) a;i < (ll) n;i++)
#define fi first
#define se second
#define pb push_back
#define INF 100000001
#define MOD 100000
#define MAXN 1002
#define MAXM 1001
#define MAXK 100001

string s;
int ans = 700;

int main()
{
    cin >> s;
    REP(i, 0, 3){
        if(s[i] == 'o'){
            ans += 100;
        }
    }
    cout << ans << endl;


    return 0;
}
/*













*/


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
using ll = long long;
using pii = pair<int, int>;
constexpr ll INF = 1ll<<30;
constexpr ll longINF = 1ll<<60;
constexpr ll MOD = 1000000007;
constexpr bool debug = 0;
//---------------------------------//

int main() {
	int N;
	cin >> N;
	
	vector<int> A(N);
	REP(i, N) scanf("%d", &A[i]);
	
	int M = N / 2;
	vector<vector<ll>> dp(M + 1, vector<ll>(3, -longINF));
	
	REP(j, 3) dp[0][j] = 0;
	REP(i, M) {
		REP(j, 3) if (i * 2 + j < N) chmax(dp[i + 1][j], dp[i][j] + A[i * 2 + j]);
		REP(j, 2) chmax(dp[i + 1][j + 1], dp[i + 1][j]);
	}
	cout << dp[M][2] << endl;
	return 0;
}


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

ll cnt;
ll n;
ll l;
vector<ll> win,lose;
vector<vector<ll>> h;

void dfs(){
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=n;j++){
            if(i==n&&j==n){
                for(ll k=1;k<=n;k++){
                    if(win[k]!=l||lose[k]!=l)return;
                }
                cnt++;
            }
            if(i<=j)continue;
            if(h[i][j]==0){
                h[i][j]=1;h[j][i]=-1;
                win[j]++;lose[i]++;
                if(win[j]<=l&&lose[j]<=l){
                    dfs();
                }
                win[j]--;lose[i]--;
                h[i][j]=-1;h[j][i]=1;
                win[i]++;lose[j]++;
                if(win[j]<=l&&lose[j]<=l){
                    dfs();
                }
                h[i][j]=0;h[j][i]=0;
                win[i]--;lose[j]--;
                return;
            }
        }
    }
}

int main() {
    ll m;
    while(true){
        cin>>n;
        if(n==0)return 0;
        cin>>m;
        l=(n-1)/2;
        h.assign(n+1,vector<ll>(n+1,0));
        win.assign(n+1,0);
        lose.assign(n+1,0);
        rep(i,m){
            ll p,q;
            cin>>p>>q;
            h[p][q]=-1;
            h[q][p]=1;
            lose[q]++;
            win[p]++;
        }
        cnt=0;
        dfs();
        cout<<cnt<<endl;
    }
}



Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  ll A,B;
  cin>>A>>B;
  if(A==0){
    if(B>=0) cout<<B<<endl;
    else cout<<-B+1<<endl;
  }else if(B==0){
    if(A>=0) cout<<A+1<<endl;
    else cout<<-A<<endl;
  }else if((A>=0&&B>=0)||(A<=0&&B<=0)){
    if(B>=A) cout<<B-A<<endl;
    else cout<<A-B+2<<endl;
  }else{
    if((B>=0&&B>=-A)||(B<=0&&A>=-B)) cout<<B+A+1<<endl;
    else cout<<-B-A+1<<endl;
  }
}

Measured memory_bytes: 256
// -*- coding: utf-8 -*-
//import java.awt.*;
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    InputStream inputStream;
    if (args.length > 0 && args[0].equals("devTesting")) {
      try {
        inputStream = new FileInputStream(args[1]);
      } catch(FileNotFoundException e) {
        throw new RuntimeException(e);
      }
    } else {
      inputStream = System.in;
    }
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskB solver = new TaskB();
    solver.solve(1, in, out);
    out.close();
  }
  
  static class TaskB {    
    int n;
    String s;
    
    void solve(int testNumber, InputReader in, PrintWriter out) {
      s = in.next();
      n = s.length();
      int paper = 0, rock = 0, wins = 0, loses = 0;
      for (int i = 0; i < n; ++i) {
        if (s.charAt(i) == 'g') {
          if (paper < rock) {
            ++paper;
            ++wins;
          } else
            ++rock;
        } else {
          if (paper < rock)
            ++paper;
          else {
            ++rock;
            ++loses;
          }
        } 
      }
      out.println(wins - loses);
    }
    
  }
      
  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }
    
    public String nextLine() {
      try {
        return reader.readLine();
      } catch(IOException e) {
        throw new RuntimeException(e);
      }
    }

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

    public long nextLong() {
      return Long.parseLong(next());
    }
    
    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public boolean hasInput() {
      try {
        if (tokenizer != null && tokenizer.hasMoreTokens()) {
          return true;
        }
        reader.mark(1);
        int ch = reader.read();
        if (ch != -1) {
          reader.reset();
          return true;
        }
        return false;
      } catch(IOException e) {
        throw new RuntimeException(e);
      }
    }
    
  }
}


Measured memory_bytes: 10964
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

const int MAX_N = 300100;
int prime[MAX_N];
bool is_prime[MAX_N + 1];
int sieve(int n){
    int p = 0;
    for(int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i <= n; i++){
        if(i % 7 == 1 || i % 7 == 6){
            if(is_prime[i]){
            prime[p++] = i;
            for(int j = 2*i; j <= n; j += i) is_prime[j] = false;
            }
        }else{
            is_prime[i] = false;
        }
    }
    return p;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int sz = sieve(MAX_N);
    int n;
    while(1){
        cin >> n;
        if(n == 1) break;
        cout << n << ":";
        rep(i, 0, sz){
            if(n % prime[i] == 0){
                cout << " " << prime[i];
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int n,k;
bool isOK(int x){
    int sum=x;
    rep(i,n-1){
        x/=2;
        sum+=x;
        if(x==0)break;
    }
    return sum<=k;
}
signed main(){
    cin>>n>>k;
    int ok=-1,ng=k+1;
    while(ng-ok>1){
        int mid=(ok+ng)/2;
        if(isOK(mid))ok=mid;
        else ng=mid;
    }
    cout<<ok<<endl;
    return 0;
}



Measured memory_bytes: 3104
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#define va vector<long long int> a 
#define vb vector<long long int> b
#define M 1000000007
using namespace std;
ll t;
void fast(){cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);}
ll power(ll x,ul y,ll p){ll res = 1;x = x % p;if(x == 0)return 0;while (y > 0){if (y & 1)res = (res*x) % p;y = y>>1;x = (x*x) % p;}return res;}
void solve(){
	ll x;
	cin>>x;
	ll sum=100;
	for(ll i=1;i<10000000;i++){
		sum+=sum/100;
		if(sum>=x){
			cout<<i<<endl;
			break;
		}
	}
 }
int main(){
	fast();
	solve();
	return 0;
}



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

int main(void){
    int W,a,b,ans;
    cin>>W>>a>>b;
    int f=b-a+W,s=a-b+W;
    if((b>=a&&a+W>=b)||(b+W>=a&&b+W<=a+W)){
        cout<<0<<endl;
    }else{
        if(f>s)
            ans=s;
        else
            ans=f;
        cout<<abs(ans)<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int H, A[2000001];

void maxHeapify(int i) {
	int l, r, largest, t;
	l = 2 * i;
	r = 2 * i + 1;
	if (l <= H && A[l] > A[i]) largest = l;
	else largest = i;
	if (r <= H && A[r] > A[largest]) largest = r;
	if (largest != i) {
		t = A[i]; 
		A[i] = A[largest]; 
		A[largest] = t;
		maxHeapify(largest);
	}
}

int extract() {
	int maxv;
	if (H < 1) return;
	maxv = A[1];
	A[1] = A[H--];
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i, int key) {
	int tmp;
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		tmp = A[i];
		A[i] = A[i / 2];
		A[i / 2] = tmp;
		i = i / 2;
	}
}

void insert(int key) {
	H++;
	A[H] = -1000000001;
	increaseKey(H, key);
}

main() {
	int key;
	char com[20];
	while (1) {
		scanf("%s", com);
		if (com[0] == 'i') {
			scanf("%d", &key);
			insert(key);
		}
		else if (strcmp(com, "extract") == 0) {
			printf("%d\n", extract());
		}
		else break;
	}

	return 0;
}


Measured memory_bytes: 5748
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int N, K, C;
string s;

int Llimit[200000 + 10], Rlimit[200000 + 10];

int main() {
	cin >> N >> K >> C >> s;

	int bef = - 2 * C - 1;
	int cnt = 0;
	for (int i = 0; i < N && cnt < K; i++) {
		if (s[i] == 'o') {
			if (i - bef > C) {
				Llimit[cnt] = i + 1;
				cnt++, bef = i;
			}
		}
	}
	bef = N + 2 * C + 1;
	cnt = 0;
	for (int i = N - 1; i >= 0 && cnt < K; i--) {
		if (s[i] == 'o') {
			if (bef - i > C) {
				Rlimit[cnt] = i + 1;
				cnt++, bef = i;
			}
		}
	}

	for (int i = 0; i < K; i++) {
		if (Llimit[i] == Rlimit[K - 1 - i] && Llimit[i] != 0) {
			cout << Llimit[i] << "\n";
		}
	}

	return 0;
}

Measured memory_bytes: 3332
local n=io.read("n","l")
local s=io.read()

local precheck=true
local t={s:byte(1,2*n)}
table.sort(t)
for i=1,2*n-1,2 do
    if t[i]~=t[i+1] then
        precheck=false
    end
end
if not precheck then
    print(0)
    return
end

local rmap={}
local bmap={}
for bit=0,(1<<n)-1 do
    local r1=""
    local r2=""
    local b1=""
    local b2=""
    for i=0,n-1 do
        if bit&(1<<i)>0 then
            local r=i+1
            local b=i+1+n
            r1=r1..s:sub(r,r)
            b2=s:sub(b,b)..b2
        else
            local r=i+1
            local b=i+1+n
            b1=s:sub(b,b)..b1
            r2=r2..s:sub(r,r)
        end
    end
    local rkey=r1.." "..r2
    local bkey=b1.." "..b2
    rmap[rkey]=(rmap[rkey] or 0)+1
    bmap[bkey]=(bmap[bkey] or 0)+1
end

local combination=0
for k,_ in pairs(rmap) do
    combination=combination+rmap[k]*(bmap[k] or 0)
end
print(combination)

Measured memory_bytes: 76976
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        String s = sc.next();

        char c = s.charAt(s.length() - 1);
        String a = "s";
        if(c == 's') {
            a = "es";
        }

        System.out.println(s + a);
    }
}


Measured memory_bytes: 39140
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n; cin >> n;
  vll a(n); REP(i, n) cin >> a[i];
  ll total=1, odd=1;
  REP(i, n) {
    total *= 3;
    if (a[i] % 2 == 0) odd *= 2;
  }
  cout << total - odd << endl;
  return 0;
}


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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP0(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP0(i, n) for (int i = (n)-1; i >= 0; --i)
#define REP1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define RREP1(i, n) for (int i = (n); i >= 1; --i)

typedef long long LL;
typedef pair<int, int> pii;

const int INTINF = int(1e9) + 1;
const LL LLINF = LL(1e18) + 1;
long double eps = 1.0E-14;
#define pow10(n) int(1e##n + n)

void solve()
{
    LL N, A, B;
    cin >> N >> A >> B;

    vector<LL> X(N);
    REP0 (i, N)
    {
        cin >> X[i];
    }

    LL ans = 0;
    REP0 (i, N - 1)
    {
        ans += min(B, A * (X[i + 1] - X[i]));
    }

    cout << ans << endl;
}

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(20);
    solve();
    return 0;
}


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

int main() {
    ll N, A, B;
    cin >> N >> A >> B;

    ll ans = (N / (A + B)) * A + min(A, N % (A + B));
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define MAXN   100001
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > pipii;
typedef priority_queue<pii,vector<pii>,greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;
int cnt =0;


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int ans=0;
    for(int i =1;i <=n;i++){
        int m = n/i;
        ans+= i*m*(m+1)/2;

    }
    cout<<ans<<endl;





	
	
	
}


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

int main() {
  int A[3];
  cin >> A[0] >> A[1] >> A[2];
  sort(A, A+3);
  if(A[0] == 5 && A[1] == 5 && A[2] == 7) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, k, min(0), ans(-1);
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> x[i];
    }
    for (int i = 0; i < n - k + 1; ++i)
    {
        int start = x[i], end = x[i + k - 1];
        if (start <= 0 && end >= 0)
        {
            int min = (-start > end) ? 2 * end - start : end - 2 * start;
            if (min < ans || ans < 0)
                ans = min;
        }
    }
    if (ans < 0)
    { //全部が正または全部が負
        for (int i = 0; i < n; ++i)
            x[i] = abs(x[i]);
        sort(x.begin(), x.end());
        ans = x[k - 1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
 
//-----------------------------------------------------------------------------------
 
    int N;
    double K, ans = 0;

    cin >> N >> K;

    for (int i = 1; i < N+1; i++)
    {
        if (i < K)
        {
            ans += pow(0.50,ceil(log2(K/i))) / N;
        }
        else
        {
            ans += 1.0/N;
        }
        
    }
    
    cout << setprecision(12) << ans << "\n";
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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

int main(void){
    int N; cin >> N;
    VI L(N); REP(i,N) cin >> L[i];
    SORT(L);
    int sum = 0; REP(i,N-1) sum += L[i];
    cout << (L[N-1] < sum ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
import static java.lang.System.in;
import static java.lang.System.out;

import java.io.*;
import java.util.*;

public class Main {
	static final double EPS = 1e-10;
	static final double INF = 1L << 31;
	static final double PI = Math.PI;

	public static Scanner sc = new Scanner(in);
	StringBuilder sb = new StringBuilder();
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public void run() throws IOException {
		String input;
		String[] inputArray;
		input = br.readLine();
		inputArray = input.split(" ");

		int n = Integer.valueOf(inputArray[0]);
		int [] a = new int[n]; 
		long ans = 0L;
		a[0] = Integer.valueOf(br.readLine());
		ans+=(a[0]-1);
		int m = 1;
		for (int i=1; i<n; i++){
			a[i] = Integer.valueOf(br.readLine());
			if (a[i]==m+1) m++;
			else if (a[i]>m+1){
				ans+=(a[i]-1)/(m+1);
			}
		}
		sb.append(ans);
		ln(sb);
	}

	public static void main(String[] args) throws IOException {
		new Main().run();
	}
	public static void ln(Object obj) {
		out.println(obj);
	}
}


Measured memory_bytes: 18696
def overlap(a, b, c, d):
    if d <= a:  return False
    if b <= c:  return False
    return True
 
a,b = map(int, input().split())
res = 0
for i in range(int(input())):
    s, t = map(int, input().split())
    if overlap(a, b, s, t): res = 1
print(res)


Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {
	public void main(Scanner sc) {
		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println(a * b);
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		new Main().main(sc);
	}
}


Measured memory_bytes: 35756
n = int(input())
f = []
for _ in [0]*n:
  f += [list(map(int,input().split()))]
p = []
for _ in [0]*n:
  p += [list(map(int,input().split()))]
m = -10000001*n
for x in range(1,1024):
  k = 0
  s = format(x,'010b')
  for t in range(n):
    k += p[t][sum([int(s[i])*f[t][i] for i in range(10)])]
  m = max(m,k)
print(m)  

Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String keyence = "keyence";
        if (keyence.equals(S)) {
            System.out.println("YES");
            return;
        }
        int length = S.length();
        for (int i = 0; i < length; i++) {
            for (int j = i + 1; j < length; j++) {
                StringBuilder sb = new StringBuilder(S);
                String target = sb.delete(i, j).toString();
                if (keyence.equals(target)) {
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}


Measured memory_bytes: 22740
#include<bits/stdc++.h>
#define ll long long 
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

ll fact(ll n)
{
    ll ans=1,i;
    for(i=1;i<=n;i++) ans+=i;
    return ans;
}

ll cnt[10][10];

int main()
{
    ll n,m,i,a,b;
    cin>>n;
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        string s=to_string(i);
        ll front=s[0]-'0',end=s[s.size()-1]-'0';
        ans+=2*cnt[end][front];
        ans+=front==end;
        cnt[front][end]++;
    }
    cout<<ans;
}

Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define vcout(v) rep(i,v.size()) cout << v[i] << " "; cout << endl
#define mcout(m) rep(j,m.size()){vcout(m[j]);}

// 移動ベクトル
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
const ll INF = 1e18;
void mainsolve(){

	ll h,w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i,h) cin >> s[i];

	ll res = 0;

	rep(i,h) rep(j,w){
		if(s[i][j] == '#') continue;
		P start = P(i,j);

		vector<vector<ll>> dp(h,vector<ll>(w,INF));
		dp[start.first][start.second] = 0;

		queue<P> q;
		q.push(start);

		while(!q.empty()){
			P nowp = q.front();
			q.pop();
			rep(l,4){
				P nextp = P(nowp.first + dx[l], nowp.second + dy[l]);
				if(0 <= nextp.first && nextp.first < h && 
				   0 <= nextp.second && nextp.second < w && 
				   dp[nextp.first][nextp.second] == INF && 
				   s[nextp.first][nextp.second] != '#'){
				   	q.push(nextp);
				   	dp[nextp.first][nextp.second] = dp[nowp.first][nowp.second] + 1;
				}
			}
		}


		rep(a,h) rep(b,w){
          if(dp[a][b] != INF) res = max(res, dp[a][b]);
		}
	}

	cout << res << endl;

 	return;
}

int main(){
	
	//ll TC;cin>>TC;rep(I,TC){cout<<"case:"<<I+1<<"---"<<endl; // comment out!
		mainsolve();
	//} // comment out!
	return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.{readLine, readInt}
import scala.util.control.Breaks
import scala.collection.mutable.BitSet

object Main {
  val b = new Breaks

  def check(board:Array[Array[String]], i:Int, j:Int) = {
    var k = i
    var l = j
    var flg = board(i)(j) == "."

    while(flg && k>=0 && l>=0) {
      if(board(k)(l)!=".") flg = false
      k-=1;l-=1
    }

    k = i;l = j
    while(flg && k<8 && l<8) {
      if(board(k)(l)!=".") flg = false
      k+=1;l+=1
    }

    k = i;l = j
    while(flg && k<8 && l>=0) {
      if(board(k)(l)!=".") flg = false
      k+=1;l-=1
    }

    k = i;l = j
    while(flg && k>=0 && l<8) {
      if(board(k)(l)!=".") flg = false
      k-=1;l+=1
    }
    flg
  }

  def scan(board:Array[Array[String]],x:BitSet,y:BitSet):Boolean = {
    if(!x.isEmpty || !y.isEmpty) {
      var flg = false
      b.breakable {
        for(i<-x) {
          for(j<-y) {
            if(check(board,i,j)) {
              board(i)(j)="Q"
              if(scan(board,x-i,y-j)) {
                flg = true
                b.break
              } else {
                board(i)(j)="."
              }
            }
          }
        }
      }
      flg
    } else {
      true
    }
  }

  def main(args:Array[String]) = {
    val n = readInt
    val board = Array.ofDim[String](8,8)
    val x = BitSet(0,1,2,3,4,5,6,7)
    val y = BitSet(0,1,2,3,4,5,6,7)
    for(i<-0 to 7;j<-0 to 7) board(i)(j) = "."

    for(i<-0 until n) {
      val s = readLine.split(" ").map(_.toInt)
      board(s(0))(s(1)) = "Q"
      x -= s(0)
      y -= s(1)
    }
    scan(board,x,y)
    board.foreach( e=> println(e.mkString("")) )
  }
}

Measured memory_bytes: 47968
import math
N=int(input())

a=[chr(i) for i in range(97, 97+26)]
# [chr(i) for i in range(ord('a'), ord('z')+1)]
if N>26:
    answers = []
    while N > 0:
        N-=1
        b = N % 26
        answers.append(a[b ])
        N = N // 26

    answers.reverse()
    b = ''
    for a in answers:
        b += a
    print(b)
else:
    print(a[N-1])


Measured memory_bytes: 62064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N, M;
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	cin >> N >> M;
	ll a = ((M / 2 + M % 2) * (N / 2 + N % 2));
	ll b = (M / 2) * (N / 2);
	if (N == 1 || M == 1) {
		cout << "1\n" << "\n";
		return 0;
	}
	else cout << a + b << "\n";
	return 0;
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll INFLL = 1e18;
constexpr int MOD = 1e9 + 7;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //cout << fixed << setprecision(6);
    int n; cin >> n;
    vll cum(n + 1, 0);
    for (int i = 1; i < n+1; i++) {
        int a; cin >> a;
        cum[i] = cum[i-1] + a;
    }

    ll ans = INFLL;
    for (int i = 0; i < n+1; i++)
        ans = min(ans, abs(cum.back()-cum[i]*2));

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

Measured memory_bytes: 4720
#include<bits/stdc++.h>
    #define sz(a) (int)(a).size()
     
    using namespace std;
     
    template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
    template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
    const int INF = 2e5+2;
    const long long hell = 998244353ll;
    

    int main(){
    	
    	ios_base::sync_with_stdio(0);cin.tie(0);
    	int n;
    	cin>>n;
    	vector<int>arr = {0,1,100,10000,1000000},brr = {0,9,999,99999,999999};
    	long long ans = 0;
    	for(int i=1;i<8;++i){
    	 	if(n>arr[i]){
    	 	 	ans += min(brr[i],n) - arr[i]+1;
    	 	}else{
    	 	 	ans += max(n-arr[i]+1,0);
    	 	 	break;
    	 	}
    	}
    	cout<<ans<<endl;

    #ifdef LOCAL
        cout << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
    #endif	
    	return 0;
    }

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

using namespace std;



int main ()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    long long N, memo, counter, final;
    long long seq[100010];


    cin >> N;
    for(long long i = 0; i<N; i++)
        cin >> seq[i];
    stable_sort(seq, seq+N);
    memo = seq[0];
    counter = 0;
    final = 0;
    for (long long i = 0; i<N; i++)
    {
        if (seq[i] == memo)
            counter++;
        else
        {
            if (counter >= memo)
                final += (counter-memo);
            else
                final += counter;
            memo = seq[i];
            counter = 1;
        }
    }
    if (counter >= memo)
        final += (counter-memo);
    else
        final += counter;
    cout << final << endl;
    return 0;
}

Measured memory_bytes: 1408
n,a,b=map(int,input().split())
if a>b:
  print(0)
  exit()
if n==1 and a!=b:
  print(0)
  exit()
if n==1 and a==b:
  print(1)
  exit()
m=n-2
print(b*m-a*m+1)

Measured memory_bytes: 9004
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <limits.h>
using namespace std;

int main()
{
    int n,quantum;
    cin >> n >> quantum;
    std::map<std::string, int> data;
    std::queue<std::string> que;
    for(int i=0; i<n; i++){
        std::string name;
        int time;
        cin >> name >> time;
        data[name] = time;
        que.push(name);
        //cout << name << " " << time << endl;
    }
    //cout << endl;
    
    int sum = 0;
    while(que.size() > 0){
        std::string name = que.front();
        que.pop();
        int time = data[name];
        if(time > quantum){
            int remain = time - quantum;
            data[name] = remain;
            sum += quantum;
            que.push(name);
            //cout << name << " " << sum << " remain:" << remain << endl;
        }else{
            sum += time;
            cout << name << " " << sum << endl;
        }
    }
    //cout << sum << endl;
}


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

void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int main(){
    int N;
    int64_t S[100000];
    cin >> N;
    for(int i=0; i<N; i++) cin >> S[i];

    int64_t ans = 0;
    for(int d=1; d<N-1; d++){
        int64_t res = 0;
        set<int> st;
        int l = 0, r = N-1;
        while(true){
            l += d;
            r -= d;
            if(r <= d) break;
            if(st.count(l)) break;
            st.insert(l);
            if(st.count(r)) break;
            st.insert(r);
            res += S[l] + S[r];
            chmax(ans, res);            
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
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; }

int main() {
    int N; cin >> N;
    vector<vector<int>> A(N + 1, vector<int>(3, 0));
    for (int i = 1; i <= N; i++) for (int j = 0; j < 3; j++) cin >> A[i][j];

    vector<vector<int>> dp(N + 1, vector<int>(3, 0));
    for (int lst = 0; lst < 3; lst++) dp[1][lst] = A[1][lst];
    for (int i = 2; i <= N; i++) for (int lst = 0; lst < 3; lst++) {
        for (int nxt = 0; nxt < 3; nxt++) if (lst != nxt) {
            chmax(dp[i][nxt], dp[i - 1][lst] + A[i][nxt]);
        }
    }
    int ans = 0;
    for (int lst = 0; lst < 3; lst++) chmax(ans, dp[N][lst]);
    cout << ans << endl;
    return 0;
}

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

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

  if (a > b) {
    printf("a > b\n");
  }

  else if (a < b) {
    printf("a < b\n");
  }

  else {
    printf("a == b\n");
  }

  return 0;

}

Measured memory_bytes: 1760
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

ll dp[60][60][3000];
int x[60];
int main() 
{
	int N, A;
	cin >> N >> A;
	for (int i = 0; i < N; i++) {
		cin >> x[i];
	}
	dp[0][0][0] = 1;
	for (int i = 0; i < N; i++) {						//i番目まで使った
		for (int j = 0; j <= i; j++) {					//j枚のカードを使う
			for (int k = 0; k <= 50 * (j+1); k++) {			//総和がkになる
				dp[i + 1][j][k] += dp[i][j][k];
				if (k >= x[i]) {
					dp[i + 1][j + 1][k] += dp[i][j][k - x[i]];
				}
			}
		}
	}
	ll ans = 0;
	for (int i = 1; i <= N; i++) {
		ans += dp[N][i][i * A];
	}
	cout << ans << endl;
}


Measured memory_bytes: 69888
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int K = scan.nextInt();
		Set<Integer> k = new HashSet<>();

		for(int i = 0; i < K; i++) {
			int d = scan.nextInt();
			for(int j = 0; j < d; j++) {
				k.add(scan.nextInt());
			}
		}


		System.out.println(N - k.size());

	}
}

Measured memory_bytes: 37260
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
using namespace std;

#define PB push_back

bool dp[21][2001];


int main(int argc,char* argv[]){
  int n,q,x,i,j,val,tmp;
  queue<int> m;
  int w[21];
  memset(dp,0,sizeof(dp));
  dp[0][0]=true;
  
  cin>>n;
  for(i=1;i<=n;i++)
    cin>>w[i];

  cin>>q;
  for(i=0;i<q;i++){
    cin>>x;
    m.push(x);
  }

  while(!m.empty()){
    val=m.front();m.pop();

    for(i=1;i<=n;i++){
      tmp=w[i];
      for(j=0;j<=val;j++){

	if(j>=tmp){
	  if(dp[i-1][j] || dp[i-1][j-tmp])
	    dp[i][j]=true;
	}
	else
	  if(dp[i-1][j])
	    dp[i][j]=true;
      }
    }
    
    if(dp[n][val])
      cout<<"yes"<<endl;
    else
      cout<<"no"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long int
#define mp make_pair
#define S second
#define F first
int mod=1e9+7;
#define input_from_file  freopen("input.txt", "r", stdin);

ll dp[1<<22][25];
ll allmask;
ll recursion(ll &n,ll mask,vector<vector<int>> &vec,ll level){
  if(level>=n){
    if(mask==allmask) return 1;
    return 0;
  }
  if(dp[mask][level]!=-1) return dp[mask][level];
  ll val=0;
  for(int i=0;i<n;i++){
    if(vec[i][level]==1 && (mask & (1<<i))==0){
      val=(val%mod+recursion(n,mask | (1<<i),vec,level+1)%mod)%mod;
    }
  }
  dp[mask][level]=val;
  return dp[mask][level];
} 
signed main()
{
  //------------ SEE BELOW ARTICLE---------------
 // https://codeforces.com/blog/entry/64250?#comment-484569
  //input_from_file;
  ll n;cin>>n;
  vector<vector<int>> vec(n,vector<int> (n,0));
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)  cin>>vec[i][j];
  }
  allmask=(1<<n)-1;
  memset(dp, -1 , sizeof dp);
  cout<<recursion(n,0,vec,0);
  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define FOR_EX(i, a, b) for (int i = a; i < b; i++)
#define FOR_IN(i, a, b) for (int i = a; i <= b; i++)

#define ALL(a) a.begin(), a.end()

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    int a = s.size();
    int z = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'A') {
            a = min(a, i);
        } else if (s[i] == 'Z') {
            z = max(z, i);
        }
    }
    cout << z - a + 1 << endl;
}


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

void ANS(int X,char C){
  for(int i=1;i<=13;i++){
   if((X & (0b1 << i))==0) cout << C << ' ' << i << endl;
  }
}

int main(){
  char mark;
  int n,S=0,H=0,C=0,D=0,num;
  cin >> n;

  for(int i=0;i<n;i++){
    cin >> mark >> num;
    switch(mark){
    case 'S':
      S+= 0b1 << num;
      break;
    case 'H':
      H+= 0b1 << num;
      break;
    case 'C':
      C+= 0b1 << num;
      break;
    case 'D':
      D+= 0b1 << num;
      break;
    }
  }
  ANS(S,'S');
  ANS(H,'H');
  ANS(C,'C');
  ANS(D,'D');
}


Measured memory_bytes: 3136
a,b=map(int,input().split())
l=[2,3,4,5,6,7,8,9,10,11,12,13,1]
if l.index(a)>l.index(b):
    print("Alice")
elif l.index(a)==l.index(b):
    print("Draw")
else:
    print("Bob")

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try {
            String line = br.readLine();
            int w = Integer.parseInt(line);
            ArrayList<Integer> vline = new ArrayList<>();
            for(int i=1 ; i<=w ;i++){
                vline.add(i);
            }
            line = br.readLine();
            int n = Integer.parseInt(line);
            for (int i = 0; i < n; i++) {
                line = br.readLine();
                StringTokenizer st = new StringTokenizer(line, ",");
                int vNum1 = Integer.parseInt(st.nextToken());
                int vNum2 = Integer.parseInt(st.nextToken());
                int originalNum1 = vline.get(vNum1 -1);
                int originalNum2 = vline.get(vNum2 -1);
                vline.set(vNum1 -1,originalNum2);
                vline.set(vNum2 - 1,originalNum1);
            }
            for(int i:vline){
                System.out.println(i);
            }
        } catch (Exception e) {
            System.err.println();
        }
    }
}

Measured memory_bytes: 24052
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);

            var sum = A.Sum();
            long a = 0;
            long b = 0;
            long sum_2 = 0;

            for(int i =0; i < N; i++)
            {
                sum_2 += A[i];
                if(sum_2 > sum / 2)
                {
                    a = sum_2;
                    long a1 = sum - a;
                    long a_sa = Math.Abs(a - a1);

                    b = sum_2 - A[i];
                    long b1 = sum - b;
                    long b_sa = Math.Abs(b - b1);


                    Console.WriteLine(Math.Min(a_sa,b_sa));
                    break;
                }
                else if(sum_2 == sum/2)
                {
                    Console.WriteLine(0);
                    break;
                }
            }


            
        }
      
    }

}


Measured memory_bytes: 33488
# -*- coding: utf-8 -*-

H,W,A,B = map(int, input().split())
mod = (10 ** 9 + 7)

# 予め組み合わせ計算に必要な階乗と逆元のテーブルを作っておく
factorial = [0] * (H+W)
factorial[0] = 1
factorial[1] = 1
inverse = [0] * (H+W)
inverse[0] = 1
inverse[1] = 1
for i in range(2,H+W):
    factorial[i] = factorial[i-1] * i % mod
    # フェルマーの小定理から(x! ** mod-2 % mod == x! ** -1 % mod)
    # powに第三引数入れると冪乗のmod付計算を高速にやってくれる
    inverse[i] = pow(factorial[i], mod-2, mod)
    
# 組み合わせの数だけ返してくれる関数(自作)
def nCr(n, r):
    # 10C7 = 10C3
    r = min(r, n-r)
    # 分子の計算
    numerator = factorial[n]
    # 分母の計算
    denominator = inverse[r] * inverse[n-r] % mod
    return numerator * denominator % mod

h = H - A
w = B + 1
ans = 0
# マスを右上に1つずつずらして、必ず通る場所でパターンを足し合わせていく
while h > 0 and w <= W:
    ans = (ans + nCr(h+w-2, h-1) * nCr(H-h+W-w, H-h)) % mod
    h -= 1
    w += 1

print(ans)

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

int i,j,k,l,n,ans=0;

int main(){
	while(scanf("%d",&n)!=EOF){
		for(i=1;i<600/n;i++){
			ans+=(n*i)*(n*i)*n;
		}
		printf("%d\n",ans);
		ans=0;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <stack>

int main() {

	std::string str;
	std::getline(std::cin, str);

	std::istringstream iss(str);

	std::istream_iterator<std::string> it(iss);
	std::istream_iterator<std::string> last;

	std::stack<std::string> v;

	while (it != last) {
		std::string s = *it;

		if (s == "+") {
			int a = std::stoi(v.top());
			v.pop();
			int b = std::stoi(v.top());
			v.pop();

			v.push(std::to_string(a + b));

		} else if (s == "-") {
			int a = std::stoi(v.top());
			v.pop();
			int b = std::stoi(v.top());
			v.pop();

			v.push(std::to_string(b - a));

		} else if (s == "*") {
			int a = std::stoi(v.top());
			v.pop();
			int b = std::stoi(v.top());
			v.pop();

			v.push(std::to_string(a * b));

		} else {
			v.push(s);
		}
		++it;
	}
	std::cout << v.top() << std::endl;

	return 0;
}

Measured memory_bytes: 3264
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

using Graph = vector<vector<int>>;


void dfs(Graph& g, vector<int>& vec, vector<bool>& visited, int v, int num)
{
  visited[v] = true;
  vec[v] = num;
  num++;
  for (const auto& next: g[v]) {
    if (visited[next]) continue;
    dfs(g, vec, visited, next, num);
  }
}

int main(int argc, char const* argv[])
{
  int N, u, v, a, b;

  scanf("%i %i %i", &N, &u, &v);

  vector<int> U, V;
  vector<bool> u_visited, v_visited;
  Graph G(N + 1);

  U.assign(N + 1, 0);
  u_visited.assign(N + 1, false);

  V.assign(N + 1, 0);
  v_visited.assign(N + 1, false);

  for (int i = 0; i < N - 1; i++) {
    scanf("%i %i", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }

  if (G[u].size() == 1 and G[u][0] == v) {
    printf("%i\n", 0);
    return 0;
  }

  int ans = 0;

  dfs(G, U, u_visited, u, 0);
  dfs(G, V, v_visited, v, 0);

  for (int i = 0; i < N + 1; i++) {
    if (U[i] < V[i]) {
      ans = V[i] > ans ? V[i] : ans;
    }
  }
  ans--;

  printf("%i\n", ans);

  return 0;
}


Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define int int64_t
#define pcnt __builtin_popcount
#define pb push_back
#define ALL(x) (x).begin(),(x).end()
#define vec vector<int>
#define mat vector<vector<int>> //mat データ名(縦,vec(横));
int INF = 1000000000000000001; //10^18+1
int MOD = 1000000007; //10^9+7
//cout << fixed << setprecision(15); (小数点以下表示)

signed main () {
  int N,K,a,ans;
  cin >> N >> K;
  ans=N;
  vec d(K),have(N+1,0);
  for(int i=0;i<K;i++){
    cin >> d.at(i);
    for(int j=0;j<d.at(i);j++){
      cin >> a;
      if(have.at(a)==0){
        ans--;
        have.at(a)++;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
import copy

n = int(input())
c = input().split()
bubble = copy.copy(c)
select = copy.copy(c)

def BubbleSort(C, N):
    for i in range(0, N):
        for j in range(N-1, i, -1):
            if int(C[j][1]) < int(C[j-1][1]):
                temp = C[j]
                C[j] = C[j-1]
                C[j-1] = temp
    return C

def SelectionSort(C, N):
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if int(C[j][1]) < int(C[minj][1]):
                minj = j
        temp = C[i]
        C[i] = C[minj]
        C[minj] = temp
    return C

BubbleSort(bubble, n)
SelectionSort(select, n)

print(*bubble)
print("Stable")
print(*select)

def isSame(C1, C2):
    for i in range(0, len(C1)):
        if C1[i] != C2[i]:
            return False
    return True

if isSame(bubble, select):
    print("Stable")
else:
    print("Not stable")
    
         



Measured memory_bytes: 6344
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		
		String t = scanner.next();
		
		scanner.close();
		
		if (t.endsWith("s")) {
			System.out.println(t.concat("es"));
		} else {
			System.out.println(t.concat("s"));
		}
	}

}


Measured memory_bytes: 27032
input = gets.chomp.split(" ").map(&:to_i)

H = input[0]
W = input[1]
K = input[2]
dic = 1
copy_count = 0
res_line = Array.new(W)

H.times do
  line = gets.chomp.split("")
  count = line.count("#")
  if count == 0
    copy_count += 1
    next
  end
  

  counter = 1
  line.each_with_index do |e,i|

    if e == "." || counter == count
      res_line[i] = dic
    elsif e == "#"
      res_line[i] = dic
      dic += 1
      counter += 1
    end
  end
  dic += 1
  copy_count += 1
  copy_count.times do
    puts res_line.join(" ")
  end
  copy_count = 0
end


if copy_count != 0
  copy_count.times do
    puts res_line.join(" ")
  end
end


Measured memory_bytes: 2556
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    ios_base::sync_with_stdio (false);
    string s,t;
    
    cin >> s >> t;
    int n = (int)s.size();
    int m = (int)t.size();
    if (m != (n + 1))
    {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < n; i++)
    {
        if (s[i] != t[i])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    if (isalpha(t[n]))
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3600