akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define maxs(x,y) x = max(x, y)
#define mins(x,y) x = min(x, y)
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n, m;
    cin >> n >> m;
    
    cout << (1900*m + 100*(n-m)) * (pow(2, m)) << endl;


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

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    double result = MAX((1.0+N-K)/N, 0);
    for (int a=1; a<=MIN(K-1, N); a++){
        double n = ceil(log2((double)K/a));
        result += 1.0/N * pow(0.5,n);
    }
    printf("%.12lf", result);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=101234;

int n,x,y,z;
bool a[25][25],flg[1<<22];
ll dp[1<<22];
queue<ll> q2;

int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; ++i)
    {
        for(int j=0; j<n; ++j)
            scanf("%d",&a[i][j]);
    }
    dp[0]=0;
    for(int j=0; j<n; ++j)
    {
        if(a[0][j]==1)
        {
            x=1<<j;
            dp[x]=1;
            q2.push(x);
        }
    }
    q2.push(0);
    for(int i=1; i<n; ++i)
    {
        while(q2.front()!=0)
        {
            x=q2.front();
            q2.pop();
              for(int j=0; j<n; ++j)
            {
                if(a[i][j]==1)
                {
                    y=1<<j;
                    if((z=x|y)!=x){
                        dp[z]=(dp[z]+dp[x])%MOD;
                        if(flg[z]==0){
                            q2.push(z);
                            flg[z]=1;
                        }
                    }
                }
            }
        }
        q2.pop();
        q2.push(0);
    }
    printf("%lld",dp[(1<<n)-1]);
    return 0;
}


Measured memory_bytes: 26112
#!/usr/bin/python3
# coding: utf-8

# 整数 > 整数型
def I(): return int(input())

# 整数列 '1 2 3 4' > 整数型リスト
def IsIl(): return list(map(lambda x: int(x), input().split()))

# 改行挟む整数列　'1/n 2/n 3/n' > 整数型りすと
def InIl(n): return [input() for i in range(n)]

# 整数列 '1 2' > 整数型タプル
def IsIt(): return map(lambda x: int(x), input().split())

# 改行挟む整数列　'1\n 2\n 3\n' > 整数型たぷる
def InIl(n): return map(input() for i in range(n))

# 文字列 'abcd' > 文字型リスト
def SsSl(): return list(map(lambda x: x, input()))

# 整数 '1234' > 整数型リスト

# 文字列 'aba' > 辞書（文字型:個数）{'a':2,'b':1}
def SSd():
    from collections import defaultdict
    A = input() # [int(i) for i in input().split()]
    dd=defaultdict(int)
    for a in A:
        dd[a]+=1
    return dd

#リストにn個要素を読み込む

# その他アルゴリズムテンプレート
# https://qiita.com/chun1182/items/ddf2b6cba932b2bb0d4e

n = I()

print((int(n/2)+n%2)/n)


        
        
    



Measured memory_bytes: 3064
s = gets.chomp

begin_index = -1
end_index = -1

for i in 0...s.length
  c1 = s[i]
  c2 = s[i + 1]
  c3 = s[i + 2]
  if c1 == c2
    begin_index = i + 1
    end_index = i + 2
    break
  elsif c1 == c3
    begin_index = i + 1
    end_index = i + 3
    break
  end
end

puts "#{begin_index} #{end_index}"


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

#define int long long
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end()))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int H, W, K;
string c[1100000];
vvint dp;
signed main() {
    int x1, y1, x2, y2;
    cin >> H >> W >> K;
    cin >> y1 >> x1 >> y2 >> x2;
    x1--, y1--, x2--, y2--;
    rep(i, H) { cin >> c[i]; }
    dp.resize(H);
    fill(all(dp), vint(W, LLONG_MAX));
    dp[y1][x1] = 0;
    queue<pint> q;
    q.push({y1, x1});
    while (!q.empty()) {
        pint cur = q.front();
        int yc = cur.first, xc = cur.second;
        q.pop();
        rep(i, 4) {
            reps(j, K) {
                int yn = yc + DY[i] * j, xn = xc + DX[i] * j;
                if (yn < 0 || yn >= H || xn < 0 || xn >= W || c[yn][xn] == '@' || dp[yn][xn] <= dp[yc][xc]) {
                    break;
                }
                if (dp[yn][xn] == LLONG_MAX) { q.push({yn, xn}); }
                dp[yn][xn] = dp[yc][xc] + 1;
            }
        }
    }
    if (dp[y2][x2] != LLONG_MAX) { cout << dp[y2][x2] << endl; }
    else { cout << -1 << endl; }

}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  vector< vector<long long> > dp(n + 1, vector<long long>(n + 1));
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j + i <= n; j++) {
      long long vl = a[j] - dp[j + 1][j + i];
      long long vr = a[j + i - 1] - dp[j][j + i - 1];
      dp[j][j + i] = max(vl, vr);
    }
  }
  cout << dp[0][n] << '\n';
  return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <cstdio>

int a[110];

int Abs(int x) {return x > 0 ? x : -x;}
int main()
{
	int n; scanf("%d", &n); int s = 0;
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]), s += a[i];
	int id = -1, ans = 1e9;
	for(int i = 1; i <= n; i++)
	{
		if(Abs(a[i] * n - s) < ans) ans = Abs(a[i] * n - s), id = i;
	}
	printf("%d\n", id - 1);
}

Measured memory_bytes: 256
sa=str(input())
sb=str(input())
sc=str(input())

def solve(c,sa,sb,sc):
  if c=='a':
    if len(sa)==0:
      return 'A'
    else:
      c=sa[0]
      sa=sa[1:]
      return solve(c,sa,sb,sc)
  if c=='b':
    if len(sb)==0:
      return 'B'
    else:
      c=sb[0]
      sb=sb[1:]
      return solve(c,sa,sb,sc)
  if c=='c':
    if len(sc)==0:
      return 'C'
    else:
      c=sc[0]
      sc=sc[1:]
      return solve(c,sa,sb,sc)
  
print(solve('a',sa,sb,sc))

Measured memory_bytes: 3188
n=int(input())
h=list(map(int,input().split()))



under=min(h)
for i in range(n):
    h[i]-=under
ans=under

while True:
    if max(h)==0:
        break
    i=0
    while i<n:
        if h[i]==0:
            i+=1
        else:
            ans+=1
            while i<n and h[i]>0:
                h[i]-=1
                i+=1
                
print(ans)

Measured memory_bytes: 9008
import sys
readline = sys.stdin.readline


def reverse(d, x):
    res = 0
    for i in range(x+1):
        res <<= 1
        if (1<<i) & d:
            res |= 1
    return res

H, W = map(int, readline().split())

A = [list(map(int, readline().split())) for _ in range(H)]
B = [list(map(int, readline().split())) for _ in range(H)]
G = [[0]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        G[i][j] = abs(A[i][j] - B[i][j])

dp = [[0]*W for _ in range(H)]
dp[0][0] = 1<<G[0][0]
for s in range(H+W-1):
    for h in range(max(0, s-(W-1)), 1+min(s, H-1)):
        w = s - h
        d = dp[h][w]
        if w != W-1:
            g = G[h][w+1]
            dp[h][w+1] |= d<<g | d>>g | reverse(d, g)
        if h != H-1:
            g = G[h+1][w]
            dp[h+1][w] |= d<<g | d>>g | reverse(d, g)
ans = dp[H-1][W-1]
ans = (-ans&ans).bit_length() - 1
print(ans)

Measured memory_bytes: 53468
N = int(input())
A0 = list(map(int, input().split()))
A1 = list(map(int, input().split()))

A_max = 0

for n in range(0, N):
    A_sum = sum(A0[0:n+1]) + sum(A1[n:])
    if A_sum > A_max:
        A_max = A_sum

print(A_max)


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

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


	return 0;
    
}

Measured memory_bytes: 8832
#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

const double PI = 3.1415926535;

int main()
{
	double a, b, x;
	double l, r;
	cin >> a >> b >> x;
	cout << fixed << setprecision(10);
	if (x <= a * a * b / 2) {
		l =atan(b/a)*180/PI;
		r = 90;
		while (r - l >= 0.0000001) {
			double c = (l + r) / 2;
			if (a * b * b / tan(c * PI / 180)/2 >= x)
				l = c;
			else
				r = c;
		}
		cout << l;
	}
	else {
		l = 0;
		r= atan(b / a) * 180 / PI;
		while (r - l >= 0.0000001) {
			double c = (l + r) / 2;
			if ((a*a*b-a*a*a*tan(c * PI / 180)/2) >= x )
				l = c;
			else
				r = c;
		}
		cout << l;
	}
	return 0;
}

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

using namespace std;

int main() {
    int n;
    string s;
    cin >> n >> s;
    if(n % 2 == 0) {
        int split = n / 2;

        for(int i=0;i<split;i++){
            if(s[i] != s[i+split]){
                cout << "No" << endl;
                return 0;
            }
        }

        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
Module Module1

  Sub Main(ByVal args() As String)
    Dim ok_cnt As integer
    Dim ng_cnt As integer
    Dim res As Boolean = False
    Dim ar As String() = Console.ReadLine().Split(" ")
    Dim tmp(ar.Length) As String
    	
    For i As Integer = 0 To ar.Length-1 Step 1
    	ok_cnt = 0
    	ng_cnt = 0
    	Array.Copy(ar, tmp, ar.Length)
    	tmp(i) = ""
    
    
    	For j As Integer = 0 To tmp.Length-1 Step 1
    		If tmp(j) IsNot Nothing AndAlso tmp(j).ToString.Trim.Length > 0 Then
              If (ar(i) = tmp(j)) Then
                ok_cnt += 1
              Else 
                ng_cnt += 1
              End If
          	End If
       Next

      If ok_cnt = 1 AndAlso ng_cnt = 1 Then
        res = True
        Exit For
      End If
    
	Next
    

  If res Then
    Console.WriteLine("Yes")
  Else
    Console.WriteLine("No")
  End If
    
    
  End Sub
  
End Module

Measured memory_bytes: 20432
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int N; cin >> N;
    bool all_even = true;
    rep(i,N) {
        int A; cin >> A;
        if (A % 2 == 1) all_even = false;
    }

    if (all_even) {
        cout << "second" << endl;
    } else {
        cout << "first" << endl;
    }
}

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

using namespace std;

int rd() {
	int x = 0; char c = getchar();
	while (c > '9' || c < '0') c = getchar();
	while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
	return x;
}

int n, p, a[110];
long long f[110][2];
int main() {
	n = rd(), p = rd();
	for (int i = 1; i <= n; i ++) a[i] = rd() & 1;
	f[0][0] = 1;
	for (int i = 1; i <= n; i ++) {
		if (a[i]) f[i][1] += f[i - 1][0], f[i][0] += f[i - 1][1];
		else f[i][1] += f[i - 1][1], f[i][0] += f[i - 1][0];
		f[i][0] += f[i - 1][0];
		f[i][1] += f[i - 1][1];
	}
	printf("%lld\n", f[n][p]);
	return 0;
}

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

typedef int ll;

#define int long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()

typedef pair<int,int>pii;
typedef pair<int,pair<int,int> > piii;

const int mod=1e9+7;

int POWER[65];
int power(int a, int b) {int ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
int inv(int x) {return power(x,mod-2);}

void precompute() {
	POWER[0]=1;
	for(int i=1;i<63;i++) POWER[i]=POWER[i-1]<<1LL;
}

vector<int>v,v1,w;

int nCr(int n , int r) {
	if(r>n)
		return 0;
	if(r>n-r)
		r=n-r;

	int ans=1;
	for(int i=1 ; i<=r ; i++) {
		ans=(ans*(n+1-i))/i;
	}
	return ans;
}
ll main() {
	// freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);
	
	int n,a,b;
	cin>>n>>a>>b;

	for(int i=0 ; i<n ; i++) {
		int x;
		cin>>x;

		v.pb(x);
	}	
	sort(v.rbegin(),v.rend());
	int num=v[0],cnt=0;
	w.pb(v[0]);
	for (int i=0 ; i<v.size() ; i++) {
		if(num==v[i])
			cnt++;
		else {
			// cout<<cnt<<" ";
			v1.pb(cnt);
			cnt=1;
			num=v[i];
			w.pb(v[i]);
		}
	}
	// cout<<cnt<<endl;
	v1.pb(cnt);

	if(a<=v1[0]) {
		int ret=0;
		for (int i=a ; i<=b ; i++) {
			ret=ret+nCr(v1[0],i);
		}
		double p=v[0];
		printf("%.9f\n",p);
		cout<<ret<<endl;
		return 0;
	}
	int tot=v1[0];
	int sum=w[0]*v1[0];
	for (int i=1 ; i<v1.size() ; i++) {
		int pi=tot;
		tot+=v1[i];
		// cout<<tot<<" "<<i<<" "<<v1[i]<<endl;
		if(tot<a) {
			sum+=(w[i]*v1[i]);
			continue;
		}
		int ret=0;
		for(int j=a ; j<=a ; j++) {
			ret=ret+nCr(v1[i],j-pi);
		}
		sum=sum+(w[i]*(a-pi));
		double ans=(double)sum/(double)a;
		printf("%.9f\n",ans);
		cout<<ret<<endl;
		return 0;
	}
}

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

#define int long long
#define double long double

// int g[1<<20];
int divs[1<<20];
int dp[1<<20];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, m;
  cin >> n >> m;

  int a[20], p[20];
  for ( int i = 0; i < n; i++ ) {
    cin >> a[i];
  }
  for ( int i = 0; i < n; i++ ) {
    cin >> p[i];
  }

  for ( int i = 1; i < (1<<n); i++ ) {
    int b = __builtin_popcount(i);
    int g = 1;
    for ( int j = 0; j < n; j++ ) {
      if ( (1<<j) & i ) {
	if ( g == a[j] ) g = g;	
	else if ( log10(g) + log10(a[j]) >= 18.5 ) {
	  g = 2000000000000000000LL;
	  break;
	}
	else g = g*a[j] / __gcd(g, a[j]);
      }
    }
    if ( b%2 ) divs[i] = m/g;
    else divs[i] = -(m/g);
    dp[i] = divs[i];    
  }
  /* for ( int i = 0; i < (1<<n); i++ ) {
    cout << dp[i] << endl;
    } */
  
  for ( int j = 0; j < n; j++ ) {
    for ( int i = 0; i < (1<<n); i++ ) {
      if ( i & (1<<j) ) dp[i] += dp[i & ~(1<<j)];      
    }
  }

  double ans = 0;
  for ( int i = 1; i < (1<<n); i++ ) {
    double tmp = 1;    
    for ( int j = 0; j < n; j++ ) {
      if ( i & (1<<j) ) tmp *= p[j];
      else tmp *= (100-p[j]);
    }
    tmp /= pow(100, n);    
    // cout << i << " " << dp[i] << " " << tmp << " " << dp[i]*tmp << endl;
    ans += dp[i] * tmp;    
  }

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



Measured memory_bytes: 20016
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef int_fast64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

template<int N, typename T, T M>
struct ModFact {
	T fact[N + 1];
	T ifact[N + 1];
	constexpr ModFact() : fact(), ifact() {
		fact[0] = 1;
		for (int i = 0; i < N; ++i)
			fact[i + 1] = (fact[i] * (i + 1)) % M;
		ifact[N] = power(fact[N], M - 2);
		for (int i = N - 1; i >= 0; --i)
			ifact[i] = (ifact[i + 1] * (i + 1)) % M;
	}
	constexpr T power(T a, T b) {
		T r = 1;
		while (b > 0) {
			if ((b & 1) != 0) r = (r * a) % M;
			a = (a * a) % M;
			b >>= 1;
		}
		return r;
	}
 
	constexpr T comb(T n, T r) {
		return (((fact[n] * ifact[r]) % M) * ifact[n - r]) % M;
	}
};
 
ModFact<200000, ll, MOD> fact;

int main() {
    ll H, W, A, B, ans = 0;
    ios::sync_with_stdio(false);
    cin.tie(0);
	cin >> H >> W >> A >> B;
    ll a = H-A-1;
    ll c = A-1;
    REP(i, W-B) {
        ans += fact.comb(a+B+i,a)*fact.comb(c+W-B-1-i,c);
        ans %= MOD;
    }
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <cctype>
#include <iostream>

using namespace std;
int main(){

        char ch;
        int alp[26] ={};
        while(cin >> ch){
                if(toupper(ch) >=65 && toupper(ch) <= 90)
                        alp[toupper(ch) - 65]++;
        }

        for(int i = 0; i < 26; i++){
                printf("%c : %d\n",(i+97),alp[i]);
        }

        return 0;
}

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  string s;
  while(getline(cin,s)){
    if(s==".") return 0;
    stack<int> ss;
    for(int i=0;i<s.length();i++){
      if(s[i]=='('){
        ss.push(0);
      }else if(s[i]=='['){
        ss.push(1);
      }else if(s[i]==')'){
        if(ss.empty()){
          cout << "no" << endl;
          goto next;
        }
        if(ss.top()==0){
          ss.pop();
        }else{
          cout << "no" << endl;
          goto next;
        }
      }else if(s[i]==']'){
        if(ss.empty()){
          cout << "no" << endl;
          goto next;
        }
        if(ss.top()==1){
          ss.pop();
        }else{
          cout << "no" << endl;
          goto next;
        }
      }
    }
    if(ss.empty()){
      cout << "yes" << endl;
    }else{
      cout << "no" << endl;
    }
    next:
    continue;
  }
  return 0;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  vector<string> abc(3);
  cin >> abc.at(0) >> abc.at(1) >> abc.at(2);
  //sort(abc.begin(), abc.end());
  //if(abc.at(0)+abc.at(2) == abc.at(1)){cout << "Yes" << endl;}
  //else{cout << "No" << endl;}
  char x;
  if(abc.at(1).at(0) < 91){x = abc.at(1).at(0);}
  else{x = abc.at(1).at(0) - 32;}
  cout << 'A' << x << 'C' << endl;
  return 0;
}

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

struct edge { int to,cost; };
typedef pair<int,int> P;
typedef pair<int,P> PP;

#define INF (1<<30)
int main(){
  int c,n,m,s,d;
  int a,b,f;
  edge e;
  int ans = INF;
  while(1){
    cin >> c >> n >> m >> s >> d;
    if(c == 0 && n == 0 && m == 0 && s == 0 && d == 0)break;
    vector<edge> G[101];
    int min_cost[101][20];
    for(int i=0;i<=n;i++){
      for(int j=0;j<=c+1;j++){
	min_cost[i][j] = INF;
      }
    }
    for(int i=0;i<m;i++){
      cin >> a >> b >> f;
      e.to = b;
      e.cost = f;
      G[a].push_back(e);
      e.to = a;
      e.cost = f;
      G[b].push_back(e);
    }
    
    priority_queue<PP,vector<PP>,greater<PP> > que;
    min_cost[s][c] = 0;
    que.push(PP(0,P(s,c)));
    while(!que.empty()){
      PP p;
      p = que.top();
      que.pop();
      int now = p.second.first;
      int tick = p.second.second;
      if(min_cost[now][tick] < p.first) continue;
      for(int i=0;i<G[now].size();i++){
	edge e = G[now][i];
	if(min_cost[e.to][tick] > min_cost[now][tick] + e.cost){
	  min_cost[e.to][tick] = min_cost[now][tick] + e.cost;
	  que.push(PP(min_cost[e.to][tick],P(e.to,tick)));
	}
	if( tick ){
	  if(min_cost[e.to][tick-1] > min_cost[now][tick] + e.cost / 2){
	    min_cost[e.to][tick-1] = min_cost[now][tick] + e.cost / 2;
	    que.push(PP(min_cost[e.to][tick-1],P(e.to,tick-1)));
	  }
	}
      }
    }
    ans = INF;
    for(int i=0;i<c+1;i++){
      if(ans > min_cost[d][i]){
	ans = min_cost[d][i];
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int N,K;
  cin >> N >> K;
  
  if(N > K){
    if(N%K == 0){
      cout << 0 << endl;}
      else{
      cout << K-N%K << endl;
      }
  }
 else if( N == K){
    cout << N%K << endl;
  }
    else if(N < K && ((K-N) > N)){
    cout << N << endl;
  }
  else{
    cout << K-N << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>

typedef struct a{
  int id;
  int solve;
  int rank;
}data;

int main(void){
  int i,j,k;
  data d[10000];
  int num;
  data tmp;
  int tie;
  int name;

  i = 0;
  while(1){
    scanf("%d,%d",&d[i].id,&d[i].solve);
    if(!d[i].id && !d[i].solve)break;
    i++;
  }

  num = i;

  for(i=0;i<num-1;i++){
    for(j=i+1;j<num;j++){
      if(d[i].solve < d[j].solve){
	tmp = d[i];
	d[i] = d[j];
	d[j] = tmp;
      }
    }
  }

  k = 0;
  tie = 31;
  for(i=0;i<num;i++){
    if(d[i].solve != tie)k++;
    d[i].rank = k;
    tie = d[i].solve;
  }

  while(scanf("%d ",&name)!=EOF){
    for(i=0;i<num;i++){
      if(d[i].id == name)printf("%d\n",d[i].rank);
    }
  }

  return 0;
}

Measured memory_bytes: 0
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (a, b, x): (i64, i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    fn bis<P>(ok: f64, ng: f64, p: P) -> f64
        where P: Fn(f64) -> bool {
        let mid = (ok + ng) / 2.0;
        if (ok - ng).abs() < 1e-8 {
            ok
        } else if p(mid) {
            bis(mid, ng, p)
        } else {
            bis(ok, mid, p)
        }
    }

    let A = a as f64;
    let B = b as f64;
    let X = x as f64;
    let theta = bis(0.0, std::f64::consts::FRAC_PI_2, |theta| {
        if theta <= (B / A).atan() { A * A * B - A * A * A * theta.tan() / 2.0 >= X }
        else { A * B * B / (2.0 * theta.tan()) >= X }
    });
    let ans = 180.0 * theta / std::f64::consts::PI;

    println!("{}", ans);
}

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

int main(){
    ios_base :: sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<pair<string, int>> songs(n);
    for(int i = 0; i < n; i++){
        cin >> songs[i].first >> songs[i].second;
    }
    reverse(songs.begin(), songs.end());
    string x; cin >> x;
    int sum = 0;
    for(int i = 0; i < n; i++){
        if(songs[i].first == x){
            break;
        }
        sum += songs[i].second;
    }
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 3556
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for (int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
}
int main() {
    int N;
    cin >> N;
    int p[10010];
    rep(i,0,N){
        cin>>p[i];
    }
    int max=0;
    int res=0;
    rep(i,0,N){
        chmax(max,p[i]);
        res+=p[i];
    }
    res-=max/2;
    cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int t[4], n[4];
    for (int i = 0; i < 4; i++) {
        cin >> t[i] >> n[i];
    }
    int a[4] = {6000, 4000, 3000, 2000};
    for (int i = 0; i < 4; i++) {
        cout << a[t[i] - 1] * n[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 3104
import Control.Monad

drawRect :: Int -> Int -> IO ()
drawRect h w = replicateM_ h (putStrLn $ replicate w '#')

main = getContents >>= mapM_ (\[h,w] -> do drawRect h w; putStrLn "") .
    takeWhile (/= [0,0]) . map (map read . words) . lines

Measured memory_bytes: 4124
#include <bits/stdc++.h>
#define int long long 
using namespace std;

int h,w;

int32_t main(){
    cin>>h>>w;
    if(h==1 || w==1){cout<<1<<endl;return 0;}
    if(h%2==0)cout<<h*w/2<<endl;
    else{
        cout<<(h-1)*w/2+(w+1)/2<<endl;
    }
    
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int num[n],ans;
        for(int i=0;i<n;i++)cin>>num[i];
        cin>>ans;
        int serch,kawa[2]={0,n-1};
        for(int i=1;kawa[1]>=kawa[0];i++){
            serch=(kawa[0]+kawa[1])/2;
            if(num[serch]==ans){
                cout<<i<<endl;
                break;
            }
            if(num[serch]>ans)kawa[1]=serch-1;
            else kawa[0]=serch+1;
            if(kawa[0]>kawa[1])cout<<i<<endl;
        }
    }
}

Measured memory_bytes: 1160
#coding:utf-8
n = int(input())
numbers = list(map(int, input().split()))
count = 0

for i in range(n-1):
    for j in range(n-1, i, -1):
        if numbers[j] < numbers[j-1]:
            numbers[j], numbers[j-1] = numbers[j-1], numbers[j]
            count += 1

print(*numbers)
print(count)

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

int main() {
	int n;
	cin >> n;
	vector <int> a(n), b(n);
	for(int i = 0; i < n; ++i) cin >> a[i];
	for(int i = 0; i < n; ++i) cin >> b[i];
	int c = -1;
	if(a == b){
		cout << 0;
		return 0;
	}
	vector <int> a1 = a;
	do{
		c++;
		if(a1 == b){
			cout << c;
			return 0;
		}
	} while(next_permutation(a1.begin(), a1.end()));
	c = -1;
	do {
		c++;
		if(b == a){
			cout << c;
			return 0;
		}
	}while(next_permutation(b.begin(), b.end()));
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define RIGHT '>'
#define LEFT '<'
#define TOP '^'
#define UNDER 'v'
#define LOOP 'l'
#define END '.'
#define MAX 101

void dfs(char mp[MAX][MAX],int i,int j){
    if(mp[i][j]==END){
        printf("%d %d\n" ,j ,i);
        return;
    }
    if(mp[i][j]==LOOP){
        printf("LOOP\n");
        return;
    }
    
    if(mp[i][j]==RIGHT){
        mp[i][j] = LOOP;
        dfs(mp,i,j+1);
    }
    else if(mp[i][j]==LEFT){
        mp[i][j] = LOOP;
        dfs(mp,i,j-1);
    }
    else if(mp[i][j]==TOP){
        mp[i][j] = LOOP;
        dfs(mp,i-1,j);
    }
    else{
        mp[i][j] = LOOP;
        dfs(mp,i+1,j);
    }
}


int main(){
    char mp[MAX][MAX];
    int n,m,i;
    
    while(1){
        scanf("%d%d" ,&n ,&m);
        if(!n&&!m) break;
        
        for(i = 0 ; i < n ; i++) scanf("%s" ,mp[i]);
        dfs(mp,0,0);
    }
    
    return 0;
}

Measured memory_bytes: 624
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <functional>

template <int K, class T>
struct Trie {
    struct Node {
        std::array<int, K> nxt;
        int id, sz, ch;
        explicit Node() : id(-1), sz(0), ch(0) { nxt.fill(-1); }
    };

    std::vector<Node> nodes;
    std::function<int(T)> enc;
    std::vector<std::vector<int>> travs;

    explicit Trie(T base) {
        nodes.emplace_back();
        enc = [=](T c) { return c - base; };
    }

    template <class Container>
    void add(const Container& s, int id) {
        int pos = 0;

        for (T c : s) {
            ++nodes[pos].sz;

            int ci = enc(c);

            int npos = nodes[pos].nxt[ci];
            if (npos == -1) {
                npos = nodes.size();
                nodes[pos].nxt[ci] = npos;
                nodes.emplace_back();

                ++nodes[pos].ch;
            }
            pos = npos;
        }

        ++nodes[pos].sz;
        nodes[pos].id = id;
    }

    int dfs(int pos, std::vector<int>& cs) {
        if (nodes[pos].id != -1) travs[nodes[pos].id] = cs;

        int ret = pos;
        for (int c = 0; c < K; ++c) {
            int npos = nodes[pos].nxt[c];
            if (npos == -1) continue;

            // reducible?
            bool red = (nodes[pos].ch == 1) &&
                       (nodes[pos].id == -1);

            if (!red) cs.push_back(c);
            nodes[pos].nxt[c] = dfs(npos, cs);
            if (!red) {
                cs.pop_back();
            } else {
                ret = nodes[pos].nxt[c];  // 圧縮
            }
        }
        return ret;
    }

    void compress(int n) {
        travs.resize(n);
        std::vector<int> cs;

        for (int c = 0; c < K; ++c) {
            int pos = nodes[0].nxt[c];
            if (pos == -1) continue;

            // 根は圧縮しない
            cs.push_back(c);
            nodes[0].nxt[c] = dfs(pos, cs);
            cs.pop_back();
        }
    }

    Node& operator[](int pos) { return nodes[pos]; }
    Node operator[](int pos) const { return nodes[pos]; }
};

void solve() {
    int n;
    std::cin >> n;

    Trie<26, char> trie('a');
    for (int i = 0; i < n; ++i) {
        std::string s;
        std::cin >> s;
        trie.add(s, i);
    }

    trie.compress(n);

    int q;
    std::cin >> q;
    while (q--) {
        int k;
        std::cin >> k;
        --k;

        std::vector<int> cs(26);
        for (auto& c : cs) {
            char d;
            std::cin >> d;
            c = d - 'a';
        }

        // Trieを辿る
        int pos = 0, ans = 1;
        for (auto c : trie.travs[k]) {
            if (trie[pos].id != -1) ++ans;

            for (auto d : cs) {
                int npos = trie[pos].nxt[d];
                if (d != c) {
                    if (npos != -1) ans += trie[npos].sz;
                } else {
                    pos = npos;
                    break;
                }
            }
        }

        std::cout << ans << "\n";
    }
}

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

    solve();

    return 0;
}


Measured memory_bytes: 79820
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)

using namespace std;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMod = 1e9 + 7;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

ll solve(const vector<string>& S, ll H, ll W, ll h, ll w) {
  if (S[h][w] == '#') {
    return -1;
  }

  ll sum = 0;
  REP(i, h - 1, h + 2) {
    REP(j, w - 1, w + 2) {
      if (i == h && j == w) {
        continue;
      }
      if (i < 0 || H <= i || j < 0 || W <= j) {
        continue;
      }
      if (S[i][j] == '#') {
        sum++;
      }
    }
  }
  return sum;
}

int main() {
  init();

  ll H, W;
  cin >> H >> W;
  vector<string> S(H);
  REP(i, 0, H) {
    string s;
    cin >> s;
    S[i] = s;
  }

  REP(h, 0, H) {
    REP(w, 0, W) {
      ll s = solve(S, H, W, h, w);
      if (s == -1) {
        cout << "#";
      } else {
        cout << s;
      }
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int a,b,c;
    a = scanner.nextInt();
    b = scanner.nextInt();
    c = scanner.nextInt();
 
    if ((a < c) && (b > c)||(a > c) && (b < c)) {   //(1)
      System.out.println("Yes");
      
    }
    else
      System.out.println("No");
  }
}


Measured memory_bytes: 22868
//void _(){
//    int h,w,n;
//    cin >> h >> w >> n;
//    ll total = (h-2ll)*(w-2);
//    unordered_map<ll,int> cnt;
//    vl ans(10);
//    rep(i,1,n){
//        int x,y;
//        cin >> x >> y;
//        rep(r,max(x-2,1),min(x,h-2))
//            rep(c,max(y-2,1),min(y,w-2)){
//                cnt[(ll(r)<<30)+c]++;
//            }
//    }
//    ans[0] = total-sz(cnt);
//    for(auto _ : cnt)
//        ans[_.Y]++;
//    print(ans,"\n");
//}
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define Y second
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
T1 ostream& print(T b, T e, string sep = " ", ostream& stream = cout){
    for(T it = b; it != e; ++it){
        stream << *it;
        if(it + 1 != e)
            stream << sep;
    }
    return stream;
}
T1 void print(vector<T> arr, string sep = " "){
    if(arr.empty()){
        return;
    }
    print(arr.begin(), arr.end(), sep);
    cout << '\n';
}
void _(){
    int h,w,n;
    cin >> h >> w >> n;
    ll total = (h-2ll)*(w-2);
    unordered_map<ll,int> cnt;
    vl ans(10);
    rep(i,1,n){
        int x,y;
        cin >> x >> y;
        rep(r,max(x-2,1),min(x,h-2))
            rep(c,max(y-2,1),min(y,w-2)){
                cnt[(ll(r)<<30)+c]++;
            }
    }
    ans[0] = total-sz(cnt);
    for(auto _ : cnt)
        ans[_.Y]++;
    print(ans,"\n");
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        _();
}


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

#define TRACE
#ifdef TRACE
#define TR(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define TR(...)
#endif

typedef long long                LL;
typedef vector < int >           VI;
typedef pair < int,int >         II;
typedef vector < II >            VII;

#define MOD                      1000000007
#define EPS                      1e-12
#define N                        200100
#define PB                       push_back
#define MP                       make_pair
#define F                        first 
#define S                        second
#define ALL(v)                   v.begin(),v.end()
#define SZ(a)                    (int)a.size()
#define FILL(a,b)                memset(a,b,sizeof(a))
#define SI(n)                    scanf("%d",&n)
#define SLL(n)                   scanf("%lld",&n)
#define PLLN(n)                  printf("%lld\n",n)
#define PIN(n)                   printf("%d\n",n)
#define REP(i,j,n)               for(LL i=j;i<n;i++)
#define PER(i,j,n)               for(LL i=n-1;i>=j;i--)
#define endl                     '\n'
#define fast_io                  ios_base::sync_with_stdio(false);cin.tie(NULL)

LL rec(LL a , LL b) {
  if(a < b) swap(a , b);
  if(b == 0) return -a;
  LL ret = (a / b) * b * 2LL;
  a -= (a / b) * b;
  ret += rec(a , b);
  return ret;
}

int main() {
  LL n,x;
  cin >> n >> x;
  cout << n + rec(n - x , x) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;

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

void output() { std::cout << std::endl; }
void input() {}

template <class Head, class... Tail> void input(Head &&head, Tail &&... tail) {
  std::cin >> head;

  input(std::forward<Tail>(tail)...);
}

template <class Head, class... Tail> void output(Head &&head, Tail &&... tail) {
  std::cout << head;
  if (sizeof...(tail))
    std::cout << " ";

  output(std::forward<Tail>(tail)...);
}

int main() {
  do {

    ll n;
    input(n);
    if (!n)
      break;

    vi s(n + 1, 0);
    s[0] = 1;
    FOR(i, 1, n + 1) {
      if (i > 2)
        s[i] += s[i - 3];
      if (i > 1)
        s[i] += s[i - 2];
      s[i] += s[i - 1];
    }

    output((s[n] - 1) / 3650 + 1);

  } while (true);
  return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<stdio.h>

using namespace std;
int main() {
	string s;
	cin >> s;


	int ans = 1;
	for (int i = 0; i < 2; i++) {
		if (s.at(i) != s.at(i + 1)) ans = 0;
	}

	if (!ans) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

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


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int A, B, C, D; cin >> A>> B >> C >> D;

    if(A+B < C+D) cout << "Right" << endl;
    else if(A+B > C+D) cout << "Left" << endl;
    else cout << "Balanced" << endl;

    return 0;
}


Measured memory_bytes: 256
def bsearch(q, items)
  lb, ub = 0, items.length
  while ub - lb > 1
    mid = (ub+lb)/2
    if items[mid] <= q
      lb = mid
    else
      ub = mid
    end
  end
  items[lb] === q
end

def solve(qs, items)
  items.sort!
  qs.select {|q| bsearch(q, items)}.count
end

gets
items = gets.split(" ").map(&:to_i)
gets
qs = gets.split(" ").map(&:to_i)
puts solve(qs, items)



Measured memory_bytes: 7208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}


// https://kyopro-friends.hatenablog.com/entry/2019/01/12/231035
void solve() {
  int n;
  cin >> n;
  int a[n][n];
  rep(i, n) rep(j, n) cin >> a[i][j];

  vector<int> dp(1 << n);
  // すでにペアになった女性の集合
  dp[0] = 1;

  rep(j, 1 << n) { // 2000000
    int i = __builtin_popcount(j);
    rep(k, n) {
      if (!(j & (1 << k))) {
        if (a[i][k] == 1) {
          add(dp[j | (1 << k)], dp[j]);
        }
      }
    }
  }

  cout << dp[(1 << n) - 1] << endl;
}


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

int main()
{
	int a, time, number, m1, s1, m2, s2, m3, s3, m4, s4;
	vector<pair<int, int> > team;
	
	while(1)
	{
		cin >> a;
		if (a == 0)
		{
			break;
		}
		team.clear();
		for(int i = 0; i < a; i++)
		{
			cin >> number;
			cin >> m1 >> s1 >> m2 >> s2 >> m3 >> s3 >> m4 >> s4;
			time = m1 *60  + s1 + m2 * 60 + s2 + m3 * 60 + s3 + m4 * 60 + s4;
		
			team.push_back(make_pair(time, number));
		
		}
	
		sort(team.begin(), team.end());
	
		cout << team[0].second << endl;
		cout << team[1].second << endl;
		cout << team[a - 2].second << endl;
	}
	return 0;
}

Measured memory_bytes: 1304
s = input()
while len(s)>0:
    if s[-5:]=='erase' or s[-5:]=='dream':
        s=s[:-5]
    elif s[-6:]=='eraser':
        s=s[:-6]
    elif s[-7:]=='dreamer':
        s=s[:-7]
    else:
        print('NO')
        exit(0)
print('YES')


Measured memory_bytes: 3316
/* Atcoder abc169b
 * See tasks at: https://atcoder.jp/contests/abc169/tasks/abc169_b
 */
#include <bits/stdc++.h>

#define until(symbol, max) for (int symbol = 0; (symbol) < (max); (symbol)++)

using namespace std;
using ll = uint64_t;
int main()
{
    int n;
    cin >> n;
    
    vector<ll> a(n);
    until(i, n)
    {
        ll val;
        cin >> val;
        a[i] = val;

        if (val == 0)
        {
            cout << 0;
            return 0;
        }
    }

    ll pd = 1;
    until(i, n)
    {
        if (a[i] <= 1'000'000'000'000'000'000ll / pd)
        {
            pd *= a[i];
        }
        else
        {
            cout << -1;
            return 0;
        }
    }

    cout << pd;
    return 0;
}


Measured memory_bytes: 4040
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define PI 3.14159265358979323846264338327950L
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
char in[120];
pair<pair<string,int>,int> p[110];
int main(){
    int a;
    scanf("%d",&a);
    for(int i=0;i<a;i++){
        int t;
        scanf("%s%d",in,&t);
        string tmp=in;
        p[i]=make_pair(make_pair(in,-t),i);
    }
    std::sort(p,p+a);
    for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}

Measured memory_bytes: 3748
a,b,n = map(int,input().split(' '))
if(b > n):
    result = a * n // b
    print(result)
else:
    con = n // b * b - 1
    result = (a * con) //b - a * (con // b)
    if(result < (a * n)//b - a * (n // b)):
        print((a * n)//b - a * (n // b))
    else:
        print(result)


Measured memory_bytes: 9184
N, M, C = map(int, input().split())
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    A = [int(i) for i in input().split()]
    if sum([a * b for a, b in zip(B, A)]) + C > 0:
        ans += 1

print(ans)

Measured memory_bytes: 38256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <typeinfo>
#include <math.h>

using namespace std;
using ll = long long;

int main() {

	int x, a;
	cin >> x >> a;
	
	if (x < a)
		cout << 0 << endl;
	else if (x >=a)
		cout << 10 << endl;

	//cin >> a;
}


Measured memory_bytes: 256
#include <iostream>


 

using namespace std;

 

int main()
{
   int i, h, m, s;
cin >> i;
h = i / 3600;
m =(i % 3600) / 60;
s =( i - m * 60 )% 3600;
cout << h << ":" << m << ":" << s << endl;

 

return 0;
}


Measured memory_bytes: 3116