akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

ll ans=0;
mat G(1000010);
vec d(1000010,-2);
void BFS(){
    d[0]=-1;
    QUE que; que.push(0);
    while(!que.empty()){
        int p=que.front(); que.pop();
        each(q,G[p]){
            if(d[q]!=-2) continue;
            d[q]=d[p]+1;
            ans=max(ans,d[q]);
            que.push(q);
        }
    }
}

int main(){
    int H,W; cin>>H>>W;
    vector<string> A(H);
    rep(i,H) cin>>A[i];
    vec h={0,1,0,-1},w={1,0,-1,0};
    rep(i,H){
        rep(j,W){
            rep(k,4){
                int u=i+h[k], v=j+w[k];
                if(u<0 || v<0 || u>=H || v>=W) continue;
                G[i*W+j+1].pb(u*W+v+1);
            }
            if(A[i][j]=='#'){
                G[0].pb(i*W+j+1);
            }
        }
    }
    BFS();
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 95464
#include <stdio.h>
 
int main(void){
     
    int i,n;
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<n;i++){
            int up[101],num[101];
            int j,k;
            scanf("%d",&k);
            for(j=0;j<k;j++){
                scanf("%d",&num[j]);
            }
            for(j=0;j<k-1;j++){
                up[j]=num[j+1]-num[j];
            }
            int max,min;
            max=min=0;
            for(j=0;j<k-1;j++){
                if(up[j]>0 && up[j]>max){
                    max=up[j];
                }else if(up[j]<0 && up[j]<min){
                    min=up[j];
                }
            }
            printf("%d %d\n",max,-min);
             
        }
    }
    return 0;
}

Measured memory_bytes: 2588
#include "stdio.h"

int main(void){
  int x,y,z,i,j,k;
  char c;
  scanf("%d", &x);
  int a[4][13];
  char b[4] = {'S','H','C','D'};
  for(j = 0; j < 4; j++){
    for(k = 0; k < 13; k++){
      a[j][k] = 0;
    }
  }
  //printf("%d\n", x);
  for(i = 0; i < x*2; i++){
    scanf("%c %d", &c, &y);
    if(c == 'S'){
      a[0][y-1] = 1;
    }else if(c == 'H'){
      a[1][y-1] = 1;
    }else if(c == 'C'){
      a[2][y-1] = 1;
    }else if(c == 'D'){
      a[3][y-1] = 1;
    }

  }
  for(j = 0; j < 4; j++){
    for(k = 0; k < 13; k++){
      if(a[j][k] == 0){
        printf("%c %d\n", b[j],k+1);
      }
    //  printf("%d\n", a[j][k]);
    }
  }
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    ll o, e;
    if(n%2 == 0){
        cout<<0.50000000<<endl;
        exit(0);
    }
    else{
        o = (n/2)+1;
        e = n/2;
        cout<<std::setprecision(15) << (double)o/n << '\n'<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
x = raw_input()

y = []
for i in x:
    if len(y) == 0:
        y.append(i)
    elif i == 'S':
        y.append(i)
    elif i == 'T' and y[-1] == 'T':
        y.append(i)
    else:
        y.pop()

print len(y)


Measured memory_bytes: 4456
P = input().split()
N = int(P[0])
M = int(P[1])
K = int(P[2])


for i in range(0,N+1):
    for j in range(0,M+1):
        if((M - j) * i + (N - i) * j == K):
            print("Yes")
            exit()
print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(int)(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;
const ll mod = 1000000007;

int main()
{
  ll n; cin>>n;
  vector<ll> a(n);
  rep(i, n) cin>>a[i];

  ll ans = 0;
  ll sta = 0;
  for (int i=1; i<n; i++) {
    if (a[i-1] == a[i]) continue;

    if (a[i-1] < a[i]) {
      if (sta == 1) continue;
      if (sta == 0) sta = 1;
      else {
        ans++;
        sta = 0;
      }

    } else {
      if (sta == -1) continue;
      if (sta == 0) sta = -1;
      else {
        ans++;
        sta = 0;
      }
    }
  }
  cout << ans+1 << endl;

  return 0;
}


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

int main() {
    int h, n;
    cin >> h >> n;
    int tot = 0;
    for (int i = 0; i <= n - 1; i++) {
        int a;
        cin >> a;
        tot += a;
    }
    if (tot >= h) cout << "Yes" << '\n';
    else cout << "No" << '\n';
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<unordered_map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1e18;
#define Pint pair<ll, ll>
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rnr(i,a,b) for(int i=int(a);i>=int(b);i--)
#define rep(i,b) rng(i,0,b)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N, M, K; cin >> N >> M >> K;
    rep(i, N + 1) {
        rep(j, M + 1) {
            if(i * (M - j) + j * (N - i) == K) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#define N_MAX 10000
#define Q_MAX 500
int count = 0;

void search(int array[],int n,int k){
    for(int i=0;i<n;i++){
        if(array[i] == k){
            count++;
            return;
        }
    }
}

int main(){
    int n,q;
    int s_array[N_MAX],t_array[Q_MAX];
    
    std::cin >> n;
    for(int i=0;i<n;i++){
        std::cin >> s_array[i];
    }
    
    std::cin >> q;
    for(int i=0;i<q;i++){
        std::cin >> t_array[i];
        search(s_array,n,t_array[i]);
    }
    
    std::cout << count << '\n';
    
    return 0;
}
    



Measured memory_bytes: 3140
#include <iostream>
#include <string>
typedef long long ll;
using namespace std;

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

  ll n; cin >> n;

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

  string ans = "";
  while(true) {
    if(n == 0) break;
    if(n%2 == 0) ans = "0"+ans;
    else {
      n--;
      ans = "1"+ans;
    }
    n /= -2;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vct vector<ll>
#define umap unordered_map<ll,ll>
#define mpp map<ll,ll>
#define stt set<ll>
#define pir pair<ll,ll>
#define vpp vector<pair<ll,ll> >

ll poww(ll x,ll y,ll m){   
    ll res=1;
    while(y){if(y%2==0){x=(x*x)%m;y=y/2;}else{res=(res*x)%m;y--;}}
    return res;
}
void prt(vct v)
{
    for(ll i=0;i<v.size();i++)cout<<v[i]<<"\n";
    // cout<<"\n";
}
vct siev(ll n)
{
    vct ans;ll ar[n+1];
    memset(ar,-1,sizeof(ar));ar[0]=0;ar[1]=0;
    for(ll i=2;i<=n;i++)
    {if(ar[i]==-1){ans.push_back(i);ar[i]=1;for(ll j=2*i;j<=n;j=j+i)ar[j]=0;}}
    return ans;
}
ll isprime(ll n)
{
    if(n==1||n==0)return 0;
    for(ll i=2;i<=sqrt(n);i++)if(n%i==0)return 0;
    return 1;
}
ll etf(ll n) 
{
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)n /= i;
            result -= result / i;
        }
    }
    if(n > 1)result -= result / n;
    return result;
}
vct divsors(ll n)
{
    vct ans;//ans.push_back(1);
    for(ll i=1;i<=sqrt(n);i++)
    {if(n%i==0){ans.push_back(i);if(i!=(n/i))ans.push_back(n/i);}}
    // sort(ans.begin(),ans.end());
    return ans;
}
ll cnd(ll n){ll cnt=0;while(n){cnt++;n=n/10;}return cnt;}
ll t,m,n;
ll t1,t2,k;
ll mod=1000000007;
ll cntt(vct A)
{
    sort(A.begin(),A.end());
    int mod=1000000007;
    int n=A.size();
    
    long long int sum=0;
    long long int ans=0;
    int ar[n];
    for(int i=0;i<n;i++)ar[i]=A[i];
    for(int i=0;i<n-2;i++)
    {
        for(int j=i+1;j<n-1;j++)
        {
            sum=A[i]+A[j];
            int l=j+1;int r=n-1;
            
            while(l<=r)
            {
                int mid=(l+r)/2;
                if(A[mid]>=sum)
                {
                    r=mid-1;
                }
                else
                {
                    l=mid+1;
                }
            }
            l--;
            ans=(ans+(l-j));
        }
    }
    return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;
    vct v(n);
    for(ll i=0;i<n;i++)cin>>v[i];
    cout<<cntt(v);
    
    
    
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

ll n;

vector<ll> a;

bool judge(ll p){ //p番目が条件を満たすかどうか
    vector<ll> s(n);
    ll sum=0;
    ll cnt=-1;
    rep(i,n){
        s[i]=a[i];
        if(s[i]<=a[p]*2){ //a[p]の2倍以下であれば吸収
            sum+=s[i];
            cnt=i; //最後に吸収した番号を記録
        }
    }
    bool flag=true;
    while(true){
        ll total=0; //吸収した後の大きさ
        ll num=cnt; //最後に吸収した番号
        for(ll i=cnt+1;i<=n-1;i++){
            if(a[i]<=sum*2){
                total+=a[i];
                num=i;
            }
        }
        sum=total;
        
        if(num==n-1){
            break;
        }
        else if(num==cnt){
            flag=false;
            break;
        }
        else{
            cnt=num;
        }
    }
    return flag;
}
int main()
{
    cin >> n;
    
    rep(i,n){
        ll x;
        cin >> x;
        a.push_back(x);
    }
    sort(a.begin(),a.end());
    ll left=-1;
    ll right=n;
    while(right-left>1){
        ll mid=(left+right)/2;
        if(judge(mid)){
            right=mid;
        }
        else{
            left=mid;
        }
    }
    cout << n-right << endl;
    return 0;
} 

Measured memory_bytes: 1908
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    ll X;
    cin >> X;

    ll p = 0;
    p += (X / 500) * 1000;
    p += ((X - (X / 500) * 500) / 5) * 5;
    cout << p << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef long long ll;

int main () {
	ll n, m;
	ll i, j;
	ll a[100];
	ll tmp = 0;
	ll ret = 9999999;
	
	cin>>n;
	
	for (i=0;i<n;i++){
		cin>>a[i];
	}
	
	for (i=0;i<=100;i++) {
		for(j=0;j<n;j++) {
			tmp += (abs(i-a[j]))*(abs(i-a[j]));
		}
		if(ret > tmp) {
			ret =tmp;
			tmp =0;
		}
	}
	cout << ret << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define INF 999999999
typedef long long int Int;
using ll = long long;
using VI = vector<int>;
int gcd(Int a, Int b) {
 return b != 0 ? gcd(b, a % b) : a;
}
int lcm(Int a, Int b) {
 return a / gcd(a, b)*b;
}
int main(){
  int n;cin >> n;
  n = lcm(2,n);
  cout << n << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int N;
	int d[100];
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> d[i];
    int num[101] = {0};
	
	for (int i = 0; i < N; ++i) {
		num[d[i]]++;
	}
    int res = 0;
	for (int i = 0; i < 101; ++i) {
		if (num[i] > 0) {
			res++;
		}
	}
	cout << res << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}




struct BIT{
  vector<int> bit;
  int n;

  BIT(int m){
    n = m;
    bit.assign(2*n,0);
  } 

  int sum(int i){
    int s = 0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }
  int sum(int a,int b){
    
    return sum(b-1)-sum(a-1);
  }
  void add(int i,int x){
    while(i<=n){

      bit[i]+=x;
      i+=i&-i;
    }
  }
};



main(){
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n){
    cin>>a[i];
  }

  int l=0,r=1<<30;
  while(r-l>1){
    int m=(r+l)/2;
    
    BIT bit(n+n+1);
    int num=0;
    int sum=0;
    bit.add(sum+n+1,1);
    rep(i,n){
      int c=(a[i]<=m)? 1:-1;
      sum+=c;
      num+=bit.sum(1,sum+n+1);
      bit.add(sum+n+1,1);
    }
    if(num>(n+1)*n/2/2) r=m;
    else l=m;
  }

  cout<<r<<endl;
}


Measured memory_bytes: 4184
#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

int main() {
    int n;  cin >> n;
    string s;   cin >> s;

    char v[]= {'R', 'G', 'B'};
    ll **cnt = new ll*[3];
    for (int i = 0; i < 3; i++)
        cnt[i] = new ll[n];

    if (s[0] == 'R')
        cnt[0][0] = 1;
    else if (s[0] == 'G')
        cnt[1][0] = 1;
    else 
        cnt[2][0] = 1;

   
    
    for (ll i = 1; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            if (v[j] == s[i]) {
                cnt[j][i] = cnt[j][i-1]+1;
            }
            else {
                cnt[j][i] = cnt[j][i-1];
            }
        }
    }

    

    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            if (s[i] != s[j]) {
                int tmp;
                for (int k = 0; k < 3; k++) {
                    if (s[i] != v[k] && s[j] != v[k])
                        tmp = k;
                }
                if (2*j-i >= n) {
                    ans += cnt[tmp][n-1] - cnt[tmp][j];
                }
                else {
                    ans += cnt[tmp][n-1]-cnt[tmp][2*j-i] + cnt[tmp][2*j-i-1] - cnt[tmp][j];
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<int, pair<int, int>> PP;
typedef pair<P, int> PPi;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
// constexpr int mod = 1e+9 + 7;
constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

ll dp[3005][3005];

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

    int n, s;
    cin >> n >> s;
    vector<int> a(n);
    for(int i = 0; i < n; ++i)  cin >> a[i];

    for(int i = 0; i < n; ++i){
        chadd(dp[i][0], 1);
        for(int j = 0; j <= s; ++j){
            if(dp[i][j] == 0)   continue;
            chadd(dp[i + 1][j], dp[i][j]);
            if(j + a[i] <= s)   chadd(dp[i + 1][j + a[i]], dp[i][j]);
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; ++i) chadd(ans, dp[i][s]);
    cout << ans << endl;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

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

  string s;
  cin >> s;

  string t1 = "erase";
  string t2 = "eraser";
  string t3 = "dreamer";
  string t4 = "dream";

  vector<bool> ok(s.size() + 1, 0);
  ok.at(0) = true;

  for (int i = 0; i < s.size(); i++) {
    if (!ok.at(i)) continue;

    if (s.size() >= i + 5 && (s.substr(i, 5) == t1 || s.substr(i, 5) == t4))
      ok.at(i + 5) = true;
    if (s.size() >= i + 6 && s.substr(i, 6) == t2) ok.at(i + 6) = true;
    if (s.size() >= i + 7 && s.substr(i, 7) == t3) ok.at(i + 7) = true;
  }

  cout << (ok.at(s.size()) ? "YES" : "NO") << endl;

  return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
#define INF 1e9
#define MOD 1000000007
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(void) {
    int N, M;
    cin >> N >> M;

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    vector<int> B(M), C(M);
    vector<pii> command(M);
    for (int i = 0; i < M; i++)
    {
        cin >> B[i] >> C[i];
        command[i] = {C[i], B[i]};
    }
    
    sort(A.begin(), A.end());
    sort(command.begin(), command.end(), greater<pii>());
    int start = 0;
    for (int i = 0; i < M; i++)
    {
        int lb = lower_bound(A.begin() + start, A.end(), command[i].first) - (A.begin() + start);
        
        fill(A.begin() + start, A.begin() + start + min(lb, command[i].second), command[i].first);
        start += min(lb, command[i].second);
    }

    ll ans = 0;    

    for (int i = 0; i < N; i++)
    {
        ans += (ll) A[i];
    }
    
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5032
def read_input():
    n, m = map(int, input().split())
    return n, m

def submit():
    n, m = read_input()

    one_time = 1900*m + 100*(n - m)
    success_prob = (1/2)**m


    #成功するまでの試行回数は幾何分布に従うはず
    #平均は1/p
    avg_times = int(1/success_prob)

    print(one_time * avg_times)

if __name__ == '__main__':
    submit()

Measured memory_bytes: 38384
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

template< typename T >
struct FordFulkerson {
  struct edge {
    int to;
    T cap;
    int rev;
  };

  vector< vector< edge > > graph;
  vector< int > used;
  const T INF;
  int timestamp;

  FordFulkerson(int n) : INF(numeric_limits< T >::max()), timestamp(0) {
    graph.resize(n);
    used.assign(n, -1);
  }

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

  T dfs(int idx, const int t, T flow) {
    if(idx == t) return flow;
    used[idx] = timestamp;
    for(auto &e : graph[idx]) {
      if(e.cap > 0 && used[e.to] != timestamp) {
        T d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  T max_flow(int s, int t) {
    T flow = 0;
    for(T f; (f = dfs(s, t, INF)) > 0; timestamp++) {
      flow += f;
    }
    return flow;
  }
};

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

  cin >> N >> M >> L >> R;
  vector< vector< pair< int, int>> > edge(N + 1, vector< pair< int, int>>(N + 1, {-1, -1}));
  for(int i = 0; i < M; i++) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    edge[a][b] = {c, d};
  }
  vector< int > dis(N + 1, MOD);
  dis[L] = 0;
  priority_queue< pair< int, int >, vector< pair< int, int>>, greater< pair< int, int>> > PQ;
  PQ.push({0, L});
  while(!PQ.empty()) {
    auto box = PQ.top();
    PQ.pop();
    int cn = box.second;
    int c = box.first;
    if(dis[cn] < c) {
      continue;
    }
    for(int i = 1; i <= N; i++) {
      if(edge[cn][i].first == -1) {
        continue;
      }
      if(dis[i] > c + edge[cn][i].first) {
        dis[i] = c + edge[cn][i].first;
        PQ.push({dis[i], i});
      }
    }
  }
  vector< vector< bool>> flag(N + 1, vector< bool >(N + 1, false));
  queue< int > Q;
  Q.push(R);
  bool v[10000] = {};
  while(!Q.empty()) {
    int cn = Q.front();
    Q.pop();
    for(int i = 1; i <= N; i++) {
      if(edge[i][cn].first == -1) {
        continue;
      }
      if(dis[cn] - edge[i][cn].first == dis[i]) {
        flag[i][cn] = true;
        if(v[i]++) continue;
        Q.push(i);
      }
    }
  }
  FordFulkerson< int > d(N + 2);
  for(int i = 1; i <= N; i++) {
    for(int j = 1; j <= N; j++) {
      if(flag[i][j]) {
        d.add_edge(i, j, edge[i][j].second);
      }
    }
  }
  cout << d.max_flow(L, R) << endl;
  return 0;
}



Measured memory_bytes: 3348
#include <bits/stdc++.h>
using namespace std;
int main(){
  double  n;
  double t,a;
  double anss,maxs;
  double sa[1000];
  cin >> n;
  cin >> t >> a;
  int h;
  for(int i=0;i<n;i++){
    cin >> h;
    sa[i] = abs((t - h*0.006)-a);
    if(i==0){
      anss = 1;
      maxs = sa[i];
    } else {
      if(maxs > sa[i] ){
        anss = i+1;
        maxs = sa[i];
      } else if (maxs < sa[i]){

      }
    }
  }
  cout << anss << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
char m[1000][1000];
ll dp[1000][1000];
ll paths(int r,int c)
{
    if(m[0][0] == '#' or m[r-1][c-1] == '#')
        return 0;
    for(int i=0;i<c;i++)
    {
        if(m[0][i] == '#')
            break;
        dp[0][i] = 1;
    }

      for(int i=0;i<r;i++)
    {
        if(m[i][0] == '#')
            break;
        dp[i][0] = 1;
    }
    for(int i=1;i<r;i++)
    {
        for(int j=1;j<c;j++)
        {
            if(dp[i][j] == -1)
                continue;
            if(dp[i-1][j]!=-1)
                dp[i][j]= (dp[i][j] + dp[i-1][j] )% mod;
             if(dp[i][j-1]!=-1)
                dp[i][j] = (dp[i][j] + dp[i][j-1]) % mod;
        }
    }
    //   for(int i=0;i<r;i++)
    // {
    //     for(int j=0;j<c;j++)
    //     {cout<<dp[i][j]<<"\t";
    //     }
    //     cout<<endl;
    // }


    return dp[r-1][c-1];
}
int main()
{
    int r,c;
    cin>>r>>c;
     memset(dp,0,sizeof dp); 
    for(int i=0;i<r;i++)
        for(int j=0;j<c;j++)
        {
               cin>>m[i][j];
               if(m[i][j] == '#')
                dp[i][j] = -1;
        }
    cout<<paths(r,c);    

    return 0;
}

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

int main() {
  char c;
  cin >> c;

  // ここにプログラムを追記
  if (c=='a' || c=='i' ||c=='u' || c=='e' || c=='o')
    cout << "vowel";
  else
    cout << "consonant";
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin>>N>>M;
  vector<int> v(M*2);
  for(int i=0;i<M*2;i++){
    cin>>v.at(i);
  } 
  for(int i=0;i<N;i++){
    int c=0;
    for(int j=0;j<M*2;j++){
      if(v.at(j)==i+1){
        c++;
      }
    }
    cout<<c<<endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

class Main{
  
  static int gcd(int a, int b){
    if ( a < b )
      gcd(b,a);
    if ( b == 0)
      return a;
    else
      return gcd(b, a % b);
  }
  
  static int gcd_3(int a, int b, int c){
    int X = gcd(a,b);
    return gcd(X,c);
  }
  
  
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int K = sc.nextInt();
    int sum = 0;
    
    for (int i = 1; i <= K; i++){
      for (int j = 1; j <= K; j++){
        for (int k = 1; k <= K; k++){
          sum = sum + gcd_3(i,j,k);
        }
      }
    }
    
    System.out.println(sum);
  }
  
}

Measured memory_bytes: 35988
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <vector>
#include <map>
#include <stack>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
template<class T> void read(T& x){cin>>x;}
void read(int& x){scanf("%d", &x);}
void read(int64_t& x){scanf("%lld", &x);}
void read(double& x){scanf("%lf", &x);}
template<class T, class U, class... V>
void read(T& x, U& y, V&... z){read(x); read(y, z...);}

int main(){
  stack<int> st;
  string tmp;
  int x, y;
  while(cin >> tmp){
    if(tmp == "+") {
      y = st.top(); st.pop();
      x = st.top(); st.pop();
      st.push(x+y);
    } else if(tmp == "-") {
      y = st.top(); st.pop();
      x = st.top(); st.pop();
      st.push(x-y);
    } else if(tmp == "*") {
      y = st.top(); st.pop();
      x = st.top(); st.pop();
      st.push(x*y);
    } else{
      st.push(stoi(tmp));
    }
  }
  printf("%d\n", st.top());
}


Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int N;
vector<int> h(100001);

int main(void)
{
	cin >> N;

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

	ll dp[100001];
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);

	for (int n = 3; n <= N; n++)
	{
		dp[n] = min(dp[n - 2] + abs(h[n] - h[n - 2]), dp[n - 1] + abs(h[n] - h[n - 1]));
	}

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

Measured memory_bytes: 1408
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;
using System.Threading.Tasks;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }
    

    Scanner cin;

    List<int>[] es;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        es = new List<int>[N];
        for (int i = 0; i < N; i++)
        {
            es[i] = new List<int>();
        }

        for (int i = 0; i < N - 1; i++)
        {
            int A = cin.nextInt() - 1;
            int B = cin.nextInt() - 1;
            es[A].Add(B);
            es[B].Add(A);
        }

        if (dfs(0, -1) == 0) Console.WriteLine("Bob");
        else Console.WriteLine("Alice");
        
    }

    int dfs(int a, int pre)
    {
        int ans = 0;
        foreach (var next in es[a])
        {
            if (next == pre) continue;
            ans ^= dfs(next, a) + 1;
        }
        return ans;
    }
    
}




class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}



Measured memory_bytes: 35472
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int rhythm[] = new int[3];
		int count5 = 2;
		int count7 = 1;

		for(int i = 0; i < 3; i++){
			rhythm[i] = Integer.parseInt(sc.next());
		}

		for(int i = 0; i < 3; i++){
			switch(rhythm[i]){
			case 5:
				count5--;
				break;
			case 7:
				count7--;
				break;
			default:
				break;
			}
		}

		if(count5 == 0 && count7 == 0){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}


Measured memory_bytes: 9296
n = int(input())
c = input()
l = 0
r = n-1
ans = 0
while l<r:
    if c[l] == "R": l += 1
    if c[r] == "W": r -= 1
    
    if c[l]=="W" and c[r]=="R":
        l += 1
        r -= 1
        ans += 1
        
print(ans)

Measured memory_bytes: 9340
#include<bits/stdc++.h>
		#include <bitset>
		using namespace std;
		#define ll long long 
		#define ld long double
		#define MOD 1000000007
		#define mod9 1000000009
		#define mod 1000003
		#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
		#define mp make_pair
		#define pb push_back
		#define ct ll t;cin>>t;while(t--)
		#define bi begin()
		#define ei end()
		#define fi first 
		#define se second   	
		bool isPrime(ll n) 
		{ 
			// Corner case 
			if (n <= 1) 
				return false; 
			
			// Check from 2 to n-1 
			for (ll i = 2; i*i <= n; i++) 
				if (n % i == 0) 
					return false; 
			
			return true; 
		}
		long long binpow(long long a, long long b) {
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = (res%mod) * (a%mod);
				a = (a%mod) * (a%mod);
				b >>= 1;
			}
			return res%mod;
		}

		bool compare(const pair<ll,ll>&a,const pair<ll,ll>&b)
		{
			return (a.se<b.se);
		}
		ll lcm(ll a,ll b)
		{
			return(a*b)/__gcd(a,b);
		}
		vector<ll>s[2005];
		void SieveOfEratosthenes() 
		{  
			ll n=2005;
			bool prime[1000005]; 
			memset(prime, true, sizeof(prime)); 
			// s[0]=1;
			// s[1]=1;
			for (int p=2; p*p<=n; p++) 
			{ 
				s[p].pb(1);
				if (prime[p] == true) 
				{   
					for (int i=p+p; i<=n; i += p) {
						prime[i] = false; 
						s[i].pb(p);
						}
				} 
			} 
			// for(ll i=2;i<10005;i++)
			// {
			// 	if(prime[i])
			// 	{
			// 		// s.pb(i);
			// 	}
			// }
		} 
		void eea(ll a, ll b, ll & x, ll & y) {
		if (a == 0) {
			x = 0;
			y = 1;
			return ;
		}
		ll x1, y1;
		eea(b % a, a, x1, y1);
		x = y1 - (b / a) * x1;
		y = x1;
		return ;
	}
	ll modinverse(ll a,ll m)
	{
		ll x, y;
		eea(a, m, x, y);
		if (__gcd(a,m) != 1) {
		return -1;
		}
	else {
		x = (x % m + m) % m;
		cout << x << endl;
		return x;
	}
	}
		ll fact[1000007]={0};
		ll expo(ll x, ll y) {ll res=1;x=x%MOD;while(y>0){if(y&1)res=(1ll*res*x)%MOD;
		y=y>>1;x=(1ll*x*x)%MOD;} return res;}
		void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%MOD;}
		ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],MOD-2)))%MOD; return res; }
		ll ncr(ll n,ll r){ ll res=1; if(r>n-r)r=n-r; for(ll i=0;i<r;i++) {  res*=n-i;  res/=i+1; } return res;}
			ll C(ll n, ll k) {
    ll res = 1;
    for (ll i = 1; i <= k; ++i)
        res = ((res) * (n - k + i) / i)%MOD;
    return (ll)(res + 0.01)%MOD;
}
				
		int main()
		{
			fast
			ll x,y,z;
			cin>>x>>y>>z;
			swap(x,y);
			swap(x,z);
			cout<<x<<" "<<y<<" "<<z<<"\n";
			}

 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    int n,k;cin>>n>>k;
    vin x(n);
    rep(i,n)cin>>x[i];
    int minus=inf;
    rep(i,n){
        if(x[i]>0){
            minus=i;
            break;
        }
    }
    if(minus==0){
        cout<<x[k-1]<<endl;
        return 0;
    }
    if(minus==inf){
        cout<<-x[n-k]<<endl;
        return 0;
    }
    vin sumr(k);
    vin suml(k);
    int m=inf;
    for(int i=max(0,k-minus);i<min(k,n-minus);i++){
        if(i==k-1)break;
        if(2*x[minus+i]-x[minus-k+i+1]<m)m=2*x[minus+i]-x[minus-k+i+1];
    }
    for(int i=max(0,k-n+minus-1);i<min(k,minus);i++){
        if(i==k-1)break;
        if(-2*x[minus-1-i]+x[minus+k-i-2]<m)m=-2*x[minus-1-i]+x[minus+k-i-2];
    }
    if(k<=n-minus){
        m=min(m,x[minus+k-1]);
    }
    if(k<=minus){
        m=min(m,-x[minus-k]);
    }
    cout<<m<<endl;
}

Measured memory_bytes: 1408
n = int(input())
a=list(map(int,input().split()))
forward = []
back = []
result = ''
t = 0
for i in range(n):
    t ^= a[i]
    forward.append(t)
t = 0
for i in range(n-1, -1, -1):
    t ^= a[i]
    back.append(t)

for i in range(n):
    if i == 0:
        t = back[n-2]
    elif i == n-1:
        t = forward[n-2]
    else:
        t = forward[i-1] ^ back[n-2-i]
    result += str(t) + ' '

print(result)


Measured memory_bytes: 36228
#include <stdio.h>

int max(int a,int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}


int main(void)
{
	int n,W,i;
	scanf("%d %d",&n,&W);
	
	int v[n],wei[n];
	
	for(i = 0; i < n; i++){
		scanf("%d %d",&v[i],&wei[i]);
	}
	
	int dp[110][10010];
	
	for(int w = 0; w <= W; w++){
		dp[0][w] = 0;
	}
	
	for(i = 0; i < n; i++){
		for(int w = 0; w <= W; w++){
			if(w >= wei[i]){
				dp[i+1][w] = max(dp[i][w-wei[i]] + v[i],dp[i][w]);
			}else{
				dp[i + 1][w] = dp[i][w];
			}
		}
	}
	
	printf("%d\n",dp[n][W]);
	
	return 0;
}
	
	
	
	
		


Measured memory_bytes: 5804
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	//入力を受け取る
	int H, W, h, w;
	cin >> H >> W >> h >> w;

	//計算する
	int ans = (H - h) * (W - w);

	//答えを出力する
	cout << ans << endl;
}



Measured memory_bytes: 256
import itertools


n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

junretsu = []
for i in itertools.permutations(range(1, n + 1)):
    junretsu.append(i)
junretsu = sorted(junretsu)
a = junretsu.index(p)
b = junretsu.index(q)

print(abs(a - b))

Measured memory_bytes: 8308
#include<bits/stdc++.h>
 
#define pb push_back
#define MP make_pair
#define rep(i,a,b) for(long long i=a;i<b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
using namespace std;
 
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;
ll mod = 1e9 + 7  ;

ll arr[51][51][63] ; 
vector<ll> vt(53) ; 
ll n,k ;
void rec( ll po ){
    if(po<0) return ; 
    if( ((k) &(1LL<<po)) == 0 ){rec(po-1) ;return ; }
   // cout<<k<<" "<<po<<"----------------      "<<((k) &(1<<po))<<endl; 
    vector<ll> temp(53,0) ; 

    rep(i,0,n){
        rep(j,0,n){
            temp[i] =  temp[i] + (vt[j]*arr[j][i][po])%mod ;
            if(temp[i]>=mod) temp[i]-= mod ;  
        }
    }
 rep(i,0,n) vt[i] = temp[i] ;
 rec(po-1) ;  
 return ; 
}


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

    rep(i,0,n) rep(j,0,n)  cin>>arr[i][j][0] ; 

    rep(p,1,63){
        rep(st,0,n){
            rep(ed,0,n){
                ll tot = 0 ; 
                rep(mid,0,n){
                    tot = tot + (arr[st][mid][p-1]*arr[mid][ed][p-1])%mod ;
                    if(tot >=mod ) tot -= mod ; 
                }
                arr[st][ed][p] = tot ;
               
            }
        }
    }
 rep(i,0,n) vt[i] = 1 ;   
 rec(60) ; 
 ll tot = 0 ; 
 rep(i,0,n) {
       tot = tot + vt[i];
                    if(tot >=mod ) tot -= mod ; 
 }
cout<<tot<<endl; 
}





Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>

#define MAX_H 10

using namespace std;

int s[5][MAX_H+1];
int H;

void solve() {
	int point = 0, pre = 0;
	while(1){
		pre = point;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < 3; j++)
			{
				if(s[j][i] == s[j+1][i] && s[j+1][i] == s[j+2][i]){
					int p = s[j][i];
					for (int k = j; k < 5; k++)
					{
						if(s[k][i] != p) break;
						s[k][i] = 0;
						point += p;
					}
				}
			}
		}
		if(point == pre) break;
		for (int i = 0; i < 5; i++)
		{
			for (int j = H-1; j >= 0 ; j--)
			{
				if(s[i][j] == 0){
					for (int k = j-1; k >= 0; k--)
					{
						if(s[i][k] != 0){
							s[i][j] = s[i][k];
							s[i][k] = 0;
							break;
						}
					}
				}
			}
		}
	}
	cout << point << endl;
	return;
}

int main(){
	while(1){
		cin >> H;
		if(H == 0) break;
		for (int i = 0; i < H; i++)
		{
			for (int j = 0; j < 5; j++)
			{
				cin >> s[j][i];
			}
		}
		solve();
	}
	return 0;
}


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

int main() {
        string s;
        string b;
        int cnt = 0;

        cin >> s;
        cin >> b;
        rep(i, s.size()) {
                if(s[i] != b[i]) {
                        cnt++;
                }
        }
        cout << cnt << endl;
        return 0;
}

Measured memory_bytes: 3892
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter, deque
import itertools
#from scipy.misc import comb

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

def comb(a,b):
	p = fac[a-b]*fac[b]%MOD
	return fac[a]*pow(p,MOD-2,MOD)%MOD

fac=[1]
for i in range(H+W):
	fac.append(fac[-1]*(i+1)%MOD)

ans=0
for i in range(W-B):
	p = comb(H-A-1+B+i,B+i)*comb(W-B-i-2+A,A-1)
	ans += p%MOD
	ans %= MOD

print(ans)

Measured memory_bytes: 20284
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	int x;
	cin >> x;
	if (x >= 30) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3632
n,m = map(int,input().split())

def f(m):
    d = []
    r = int(m**0.5)
    for i in range(1,r+1):
        if m % i == 0:
            d.append(i)
            d.append(m//i)
    d.sort(reverse = 1)
    return d

d = f(m)
for x in d:
    p = m//x
    #print(x,p)
    #if n <= p and p % n != 0:
    if n <= p:
        print(x)
        exit() 

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

using namespace std;
using ll = long long int;
using ullong = unsigned long long;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define int ll
//int INF = 1e9;
const long long INF = 1LL << 60;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
typedef pair<int, int> Vec2;
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template<class T> inline void chmax(T& a, T b) { if (a < b) a = b; }
template<class T> inline void chmin(T& a, T b) { if (a > b)  a = b; }

const int MAX_N = 110;
const int MAX_V = 100100;
int N;
int W, weight[MAX_N], value[MAX_N]; 
int dp[MAX_N][MAX_V];

signed main() {
	ios::sync_with_stdio(false);
	cin >> N >> W;
	for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];
	for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;
	dp[0][0] = 0;

	rep(i, N) {
		rep(j, MAX_V) {
			if (j - value[i] >= 0)
				chmin(dp[i + 1][j], dp[i][j - value[i]] + weight[i]);
			chmin(dp[i + 1][j], dp[i][j]);
		}
	}

	long long res = 0;
	for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
		if (dp[N][sum_v] <= W) res = sum_v;
	}
	cout << res << endl;
	return 0;
}


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

public class Main {
	public static void main(String[] args) {		
		int n = nextInt();
		int[] A = new int[n];
		int[] B = new int[n];
		
		for (int i = 0; i < n; i ++) {
			A[i] = nextInt();
		}
		
		countingSort(A, B, 10000);
		
		PrintWriter out = new PrintWriter(System.out);
		for (int i = 0; i < n - 1; i ++) {
			out.print(B[i] + " ");
		}
		out.println(B[n - 1]);
		out.flush();
		out.close();
	}
	
	public static void countingSort(int[] A, int[] B, int k) {
		int[] C = new int[k + 1];
		
		for (int i = 0; i < A.length; i++) {
			C[A[i]]++;
		}
		
		for (int i = 1; i <= k; i++) {
			C[i] += C[i - 1];
		}
		
		for (int i = A.length - 1; i >= 0; i--) {
			B[C[A[i]] - 1] = A[i];
			C[A[i]]--;
		}
	}

	private static byte[] buf = new byte[1 << 20];
	private static int len = 0;
	private static int ptr = 0;

	private static byte read() {
		if (ptr >= len) {
			try {
				len = System.in.read(buf);
			} catch (Exception e) {
			}
			ptr = 0;
		}

		return buf[ptr++];
	}

	private static int nextInt() {
		int num = 0;

		byte b = read();
		while(!Character.isDigit(b)) b = read();
		while(Character.isDigit(b)) {
			num *= 10;
			num += b - '0';
			b = read();
		}

		return num;
	}
} 



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

int main() {
  int N;
  cin >> N;
  int x = 0;
  int y;
    
  for(int i = 0; i < N; i++) {
    cin >> y;
    if ((i+1)%2 == 1) {
      if(y%2 == 1) {
        x++;
      }
    }
  }
  
  cout << x << endl;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
const int maxn = 1e9 + 5;
#define INF 1000000000
const int MOD = 1e9+7;
const double PI = 3.14159265358979323846264338;

ll n,m,a[1 << 18],suma;

int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fastio
	cin >> n >> m;
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	sort(a,a+n);
	for(int i=0; i<n-m; i++){
		suma+=a[i];
	}
	cout << suma << endl;
	return 0;
} 
//^-^

Measured memory_bytes: 5156
import scala.io.StdIn.readLine
import scala.io.StdIn.readInt
import java.util.Scanner
import java.util.ArrayList

object Main extends App {
  val sc = new Scanner(System.in)
  val A = sc.nextLong()
  val B = sc.nextLong()
  val N = sc.nextLong()
  val x = List(B-1, N).min
  println((A*x/B)-A*(x/B))

}

Measured memory_bytes: 55360
#include<stdio.h>
int main(){
    int S,h,m,s;
    scanf("%d",&S);
    h = S/3600;
    m = (S-h*3600)/60;
    s = S-h*3600-m*60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}


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

#define INF 1e6

struct WarshallFloyd {
  vector<vector<int>> d;
  int v;

  WarshallFloyd(int n) : v(n), d(n, vector<int>(n, INF)) {
    for(int i = 0; i < v; ++i) d[i][i] = 0;
  }

  void add(int from, int to, int cost) {
    d[from][to] = cost;
    d[to][from] = cost;
  }

  void make() {
    for(int k = 0; k < v; ++k) {
      for(int i = 0; i < v; ++i) {
        for(int j = 0; j < v; ++j) {
          d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
        }
      }
    }
  }

  int dist(int i, int j) {
    return d[i][j];
  }
};

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

  int n;
  while(cin >> n, n != 0) {
    WarshallFloyd wf(10);
    for(int i = 0; i < n; ++i) {
      int a, b, c;
      cin >> a >> b >> c;
      wf.add(a, b, c);
    }
    wf.make();

    int num = 0;
    while(wf.dist(0, num) != INF) ++num;

    pair<int, int> ans(INF, -1);
    for(int i = 0; i < num; ++i) {
      int sum = 0;
      for(int j = 0; j < num; ++j) {
        sum += wf.dist(i, j);
      }
      ans = min(ans, {sum, i});
    }
    cout << ans.second << " " << ans.first << endl;
  }
}


Measured memory_bytes: 3124