akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define N 2001

int n, m, sum[N][N], ngang[N][N], doc[N][N], Q;
int x3, y3, x2, y2;
char a[N][N];

// Tinh số thành pahanf liên thông của HCN giới hạn bởi 4 đường x3 y3 x2 y2;
// Theo đề bài : Graph các đỉnh xanh LÀ 1 CÂY
// =>> Số thành phần liên thông của cây : = số đình - số cạnh
// => Duy trì mảng sum (i,  j) : Tổng số đỉnh trong khoảng HCN (1, 1) -> (i, j)
// => Duy trì mảng ngang (i,  j) : Tổng số cạnh ngang trong khoảng HCN (1, 1) -> (i, j)
// => Duy trì mảng doc (i,  j) : Tổng số cạnh dọc trong khoảng HCN (1, 1) -> (i, j)


void Init()
{
    cin >> n >> m >> Q;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            sum[i][j] = 0, doc[i][j] = 0, ngang[i][j] = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
        {
            cin >> a[i][j];
            sum[i][j]     = sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + (a[i][j] - '0');                            // a(i,j) = 1 khi dinh> mau xanh
            ngang[i][j]   = ngang[i][j - 1] + ngang[i - 1][j] - ngang[i - 1][j - 1] + (a[i][j] == '1' && a[i][j - 1] == '1' ? 1 : 0); // Nếu có cạnh nối từ a(i,j) xuống HCN(1,1) (i, j - 1) thì số cạnh tăng 1
            doc[i][j]     = doc[i][j - 1] + doc[i - 1][j] - doc[i - 1][j - 1] + (a[i][j] == '1' && a[i - 1][j] == '1' ? 1 : 0);       // Nếu có cạnh nối từ a(i,j) về HCN(1,1) (i - 1, j) thì số cạnh tăng 1
        }
}

void Solve()
{
    for(int i = 1; i <= Q; i++)
    {

        cin >> x3 >> y3 >> x2 >> y2;

        int cnt_dinh  = sum[x2][y2] - sum[x3 - 1][y2] - sum[x2][y3 - 1] + sum[x3 - 1][y3 - 1];
        int cnt_ngang = ngang[x2][y2] - ngang[x3 - 1][y2] - ngang[x2][y3] + ngang[x3 - 1][y3];
        int cnt_doc   = doc[x2][y2] - doc[x3][y2] - doc[x2][y3 - 1] + doc[x3][y3 - 1];
            // Vs đếm ngang thì sẽ tính giới hạn cột từ x3 + 1 đến x2 để tránh cột x3 liên thông svs bên ngoài, tương tự vs đếm dọc

        cout << cnt_dinh - cnt_doc - cnt_ngang << endl;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    //freopen("NUSKE.INP", "r", stdin);
  // freopen("NUSKE.OUT", "w", stdout);

    Init();
    Solve();
}




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

int main() {
  vector<int>a(3);
  vector<int>b={5,5,7}; 
  for (int i = 0;i<3;i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  if(a==b){
  cout << "YES" << endl;
  }  
  else{
  cout << "NO" << endl;
  }  
}

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

int main() {
    int n; cin >> n;
    vector<pair<int, int>> a(n);
    REP(i, n) {cin >> a[i].first; a[i].second = i + 1;}
    sort(a.begin(), a.end());
    REP(i, n) cout << a[i].second << " ";
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59


ll calc(ll p){
  ll ans=0;
  while(p>=1){
    ans+=p%2;
    p=p/2;
  }
  return ans%2;
}

int main(){
  ll i,j;
  ll n,m;
  cin>>n>>m;
  ll k[m];
  ll d[m];
  for(i=0;i<m;i++){
    cin>>k[i];
    d[i]=0;
    for(j=0;j<k[i];j++){
      ll x;
      cin>>x;
      x--;
      d[i]+=(1<<x);
    }
  }
  
  ll p[m];
  ll ans=0;
  for(i=0;i<m;i++) cin>>p[i];
  for(i=0;i<(1<<n);i++){
    for(j=0;j<m;j++){
      if(calc(d[j]&i)!=p[j]) break;
      if(j==m-1) ans++;
    }
  }

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

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

int main(){
  int n,k,ans=0;
  cin>>n>>k;
  for (int i=0;i<n;i++){
    int h;
    cin>>h;
    if (h>=k){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	if (a <= b) {
	    System.out.println(a);
	} else {
	    System.out.println(a - 1);
	}
    }
}


Measured memory_bytes: 21844
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.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 REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
ll dp[2000000];
main(){
    int n=in(),m=in();
    vector<vec> v(m);
    rep(i,m){
        vec s;
        int k=in();
        rep(j,k){
            s.pb(in());
        }
        v[i]=s;
    }
    vec p;
    int ans=0;
    rep(i,m)p.pb(in());
    rep(i,1<<n){
        vec s(n);
        int ii=i;
        rep(j,n){
            s[j]=ii%2;
            ii/=2;
        }
        bool flag=true;
        rep(j,m){
            int t=0;
            for(auto u:v[j]){
                t+=s[u-1];
            }
            t%=2;
            //cout<<i<<" "<<j<<" "<<t<<" "<<p[j]%2<<endl;
            if(t!=(p[j]%2)) flag=false;
        }
        if(flag)ans++;
    }
    cout<<ans;
}



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

void dijk(int s, vector<vector<pair<int,int>>> &E, vector<long long> &D)
{
    int N=D.size(),vis[101010];
    for (int i = 0; i < N; ++i)
    {
        D[i]=10000000000000000LL;
    }
    for (int i = 0; i < N; ++i)
    {
        vis[i]=0;
    }
 
    priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> que;
 
    D[s] = 0;
    que.push({ 0, s });
 
    while (!que.empty()) 
    {
        auto q = que.top(); que.pop();
 
        long long cst = q.first;
        int cu = q.second;
 
        if (vis[cu]) continue;
        vis[cu] = 1;
 
        for(auto &p:E[cu]) 
        {
            long long cst2 = cst + p.second;
            int to = p.first;
 
            if (D[to]>cst2)
            {
                D[to]=cst2;
                que.push({D[to],to});
            }
        }
    }
}

int main(int argc, char const *argv[])
{
	int n,m,s,t;
	cin>>n>>m>>s>>t;--s;--t;
	vector<vector<pair<int,int>>> edge1(n),edge2(n);
	int u,v,a,b;
	for (int i = 0; i < m; ++i)
	{
		cin>>u>>v>>a>>b;--u;--v;
		edge1[u].push_back({v,a});
		edge1[v].push_back({u,a});
		edge2[u].push_back({v,b});
		edge2[v].push_back({u,b});
	}
	vector<long long> d1(n),d2(n);
	dijk(s,edge1,d1);
	dijk(t,edge2,d2);
	long long ans[n];
	ans[n-1]=d1[n-1]+d2[n-1];
	for (int i = n-2; i >= 0; --i)
	{
		ans[i]=min(ans[i+1],d1[i]+d2[i]);
	}
	for (int i = 0; i < n; ++i)
	{
		cout<<1000000000000000-ans[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 16252
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define MAX 100010
#define aout(a) REP(i,sizeof(a)) cout << a[i] << " "; cout << endl;
#define vout(v) REP(i,v,size()) cout << v[i] << " "; cout << endl;
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(){
  int K; cin>>K;
  REP(i,K) cout<<"ACL";
}

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

void upd(int &a,int b)
{
  a=max(a,b);
}


int main()
{
  int n;
  scanf("%d",&n);
  int D[100];
  for(int i=0;i<n;i++){
    scanf("%d",D+i);
  }
  sort(D,D+n);
  static int dp[100][25][25]={0};
  bool b=0;
  dp[n][24][24]=100;
  for(int i=n-1;i>=0;i--){
    for(int a=0;a<=24;a++){
      for(int b=0;b<=24;b++){
	/*if(dp[i][a][b]!=0){
	  printf("%d %d %d %d %d\n",i,D[i],a,b,dp[i][a][b]);
	  }*/
	if(a>=D[i]){
	  upd(dp[i][D[i]][b],min(dp[i+1][a][b],min(min(a-D[i],D[i]),b<24?24-b-D[i]:100)));
	}
	if(b>=D[i]){
	  upd(dp[i][a][D[i]],min(dp[i+1][a][b],min(min(b-D[i],D[i]),a<24?24-a-D[i]:100)));
	}
      }
    }
  }
  int ans=0;
  for(int a=0;a<=24;a++){
    for(int b=0;b<=24;b++){
      ans=max(ans,dp[0][a][b]);
    }
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  rep(i,s.size() ){
    cout<<'x';
  }
  cout<<endl;

  return 0;
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, yen;
    cin >> n >> yen;
    rep(x, n+1) rep(y, n-x+1) {
        int z = n - x - y;
        if (yen == 10000 * x + 5000 * y + 1000 * z) {
            printf("%d %d %d\n", x, y, z);
            return 0;
        }
    }
    puts("-1 -1 -1");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
#define mod ((ll)1e9+7)
#define inf ((ll)1e18+5)
#define maxx ((ll)1e5+5)
#define pb push_back
#define endl "\n"
#define time(i) cout<<"\nTime Elapsed "<<i<<" : " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test ll t; cin>>t; while(t--)
ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}
ll expm(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
/*
bool sv[maxx]={0};    // returns 0 if a num is prime
int sp[maxx]={0};     // gives smallest prime factor of the number
void Sieve() {for(int i= 2; i< maxx; i+= 2) sv[i]=1,sp[i] = 2;sv[2]=0;for(ll i = 3; i < maxx; i += 2){if (!sv[i]){sp[i] = i;for (ll j = i; (j*i) < maxx; j += 2){if (!sv[j*i])sv[j*i] = true, sp[j*i] = i;}}}}
ll fact[maxx]={0}; // returns factorial of that number
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<maxx;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncrm(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(expm(fact[r],mod-2)))%mod; res=(res*(expm(fact[n-r],mod-2)))%mod; return res;}
ll inv[maxx];   // returns the modular inverse of number
void inversify( ll m){inv[1]=1;for(int i=2;i<maxx;i++){inv[i]= m- m/i*inv[m%i]%m;}}
ll ncr(ll n,ll r,ll m){int ans=1;for (int i = 0; i < r; i++){ans=ans*(n-i)%m*inv[i+1]%m;}return ans;}
*/

vector<int> adj[maxx];
int du[maxx],dv[maxx];

void dfs(int u,int par, int dis[] )
{
  for(auto v: adj[u])
  {
    if(v==par) continue;
    dis[v]=dis[u]+1;
    dfs(v,u,dis);
  }
}

signed main(){
  fast;
  //usefile;
  //test
  {
    int n,u,v;
    cin>>n>>u>>v;
    u--;v--;
    for(int i=0;i<n-1;i++){
      int x,y;
      cin>>x>>y;
      x--;y--;
      adj[x].push_back(y);
      adj[y].push_back(x);
    }    
    dfs(v,-1,dv);
    dfs(u,-1,du);
    int ans=0;
    for(int i=0;i<n;i++)
    {
      if(du[i]<dv[i])
        ans=max(ans,dv[i]);

    }
    cout<<ans-1<<endl; 

  }
  //time("");
  return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
using namespace std;
bool okay(int x, int y) { return abs(x-y)<=1; }
int main() {
    for (;;) {
        int N; cin >> N;
        if (N == 0) break;
        vector<int> W(N); for (auto &w : W) cin >> w;
        vector<vector<bool>> dp(N, vector<bool>(N));
        for (int c = 2; c <= N; c += 2) {
            for (int i = 0; i < N; i++) {
                int j = i + c - 1;
                if (j >= N) break;
                if (c == 2) {
                    dp[i][j] = okay(W[i], W[j]);
                } else {
                    if (okay(W[i], W[j]) && dp[i+1][j-1]) {
                        dp[i][j] = true;
                    }
                    for (int k = i + 2; k < j; k += 2) {
                        if (dp[i][k-1] && dp[k][j]) dp[i][j] = true;
                    }
                }
            }
        }
        vector<int> dp2(N);
        for (int j = 0; j < N; j++) {
            if (j > 0) dp2[j] = dp2[j-1];
            for (int i = 0; i < j; i++) {
                if (dp[i][j]) dp2[j] = max(dp2[j], (i==0?0:dp2[i-1]) + j-i+1);
            }
        }
        cout << dp2[N-1] << '\n';
    }
    return 0;
}


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

constexpr long long MOD = 1'000'000'007;

class binomial_coefficients {
	long long MAX_VAL;
	vector<long long> fac, mmi;

public:

	binomial_coefficients(){
	}
	
	binomial_coefficients(long long num){
		init(num);
	}
	
	~binomial_coefficients(){
		
	}
	
	void init(long long num){
		MAX_VAL = num+1; 
		fac.resize(MAX_VAL);
		mmi.resize(MAX_VAL);
		
		factorial_mod();
		modular_multiplicatibe_inverse();
	}
	
	void factorial_mod(){
		 fac[0] = 1;
		for(long long i = 1; i < MAX_VAL; fac[i] %= MOD, i++)
			fac[i] = fac[i - 1] * (i % MOD);
	}
	
	long long power(long long x, long long n){
		long long ans = 1;
		for(;n;n >>= 1, x *= x, ans %= MOD, x %= MOD)
			if(n&1)ans*=x;
		return ans % MOD;
	}
	
	void exgcd(long long a, long long b, long long &x, long long &y){
		if(b == 0){
			x = 1;
			y = 0;
			return ;
		}
		exgcd(b, a % b, y, x);
		y -= a / b * x;
	}
	
	void modular_multiplicatibe_inverse(){
		long long x, y;  
		exgcd(fac[MAX_VAL - 1], MOD, x, y);
		mmi[MAX_VAL-1] = x;
		// mmi[MAX_VAL-1] = power(fac[MAX_VAL-1], MOD-2);
		for(long long i = MAX_VAL - 2; i >= 0; mmi[i]%=MOD, i--)
			mmi[i] = mmi[i + 1] * ((i + 1) % MOD);
	}
	
	long long combination(long long n, long long r){
		return n < r ? 0 :fac[n] * (mmi[r] * mmi[n-r] % MOD) % MOD;
	}
};

int main(){
	binomial_coefficients BC;
	long long n, k, ans = 0;
	
	cin>>n>>k;
	
	BC.init(n);
	
	for(int i = 0; i < n && i <= k; i++){
		ans += BC.combination(n, i) * BC.combination(n-1, i);
		ans %= MOD;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3328
def match_ACGT(char)
    if char == 'A' || char == 'C' || char == 'G' || char == 'T'
        true
    else
        false
    end
end

S = gets.chomp!.split("")
tmp = Array.new
ans = 0
0.upto(S.length - 1) do |i|
    while(match_ACGT(S[i])) do 
        tmp << S[i]
        i += 1
    end
    ans = tmp.length if ans < tmp.length
    tmp.clear
end

puts ans

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

if a>0 and b>0:
    print("Positive")
elif a==0 or b==0 or (a<0 and b>0):
    print("Zero")
else:
    if (b-a)%2==1:
        print("Positive")
    else:
        print("Negative")


Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
  long long a, b, k;

  scanf("%lld %lld %lld", &a, &b, &k);

  if(a >= k) {
    printf("%lld %lld\n", a - k, b);
  } else if(a + b >= k) {
    printf("0 %lld\n", a + b - k);
  } else {
    printf("0 0\n");
  }

  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>


using namespace std;

int friend_table[500][500];
bool member_in[500];

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

    int a, b, c;
    cin >> a >> b >> c;
    if (a + b + 1 < c) cout << b + a + b + 1 << "\n";
    else cout << b + c << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int
#define pii pair<ll,ll>
#define ti3 tuple<ll,ll,ll>

struct BIT
{
    std::vector<int> bit;
    
    BIT(int size) : bit(size, 0){ }
    
    void add(int k, int x) {
        while (k < bit.size()) {
            bit[k] += x;
            k += k &-k;
        }
    }
    int sum(int k) {
        int res = 0;
        while (k > 0) {
            res += bit[k];
            k -= k&-k;
        }
        return res;
    }
};

struct UnionFind {
    vector<int> data;
    
    UnionFind(int size) : data(size, -1) { }
    
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y)
        {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

ll a[3];
ll buf[3];

bool finished()
{
    for(int i = 0;i < 3;i++)
    {
        if(a[i] % 2  == 1)
        {
            return true;
        }
    }
    return false;
}

void shuf()
{
    for(int i = 0;i < 3;i++)
    {
        buf[i] = a[i];
    }
    a[0] = buf[1] / 2 + buf[2] /2;
    a[1] = buf[0] / 2 + buf[2] /2;
    a[2] = buf[0] / 2 + buf[1] /2;
}

int main(void)
{
    for(int i = 0;i < 3;i++)
    {
        cin >> a[i];
    }
    ll count = 0;
    if(finished())
    {
        cout << count << endl;
        return 0;
    }
    for(ll i = 1;i < 1e13;i *= 2)
    {
        count++;
        shuf();
        if(finished())
        {
            cout << count << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

int main()
{
    int x, a, b;

    cin >> x >> a >> b;

    if (a >= b) {
        cout << "delicious" << endl;
    } else if (b - a > x) {
        cout << "dangerous" << endl;
    } else {
        cout << "safe" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void display()
{
    int a, b, c, d;
    cin>>a>>b>>c>>d;
    puts( abs(a-c) <= d  ? "Yes" :  abs(a-b) <=d && abs(b-c) <=d ? "Yes" :"No");
    cout<<endl;
}
int main(void)
{
    display();
}

Measured memory_bytes: 3652
d = gets.to_i
cs = gets.split.map(&:to_i)

s = []
d.times do |i|
  s << gets.split.map(&:to_i)
end

manzoku = 0
last = Array.new(26, -1)

d.times do |i|
  t = gets.to_i - 1

  manzoku += s[i][t]
  last[t] = i

  26.times do |k|
    manzoku -= cs[k] * (i - last[k])
  end

  p manzoku
end


Measured memory_bytes: 14304
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int q = sc.nextInt();
		char[] S = sc.next().toCharArray();
		int[] count = new int[n + 1];
		for (int i = 0; i < count.length - 1; i++) {
			if (i + 1 < n && S[i] == 'A' && S[i + 1] == 'C') {
				count[i + 1] = count[i] + 1;
			} else {
				count[i + 1] = count[i];
			}
		}
		for (int i = 0; i < q; i++) {
			int l = sc.nextInt() - 1;
			int r = sc.nextInt() - 1;
			System.out.println(count[r] - count[l]);
		}
		sc.close();
	}
}

Measured memory_bytes: 65904
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
typedef pair<int,P> PP;
struct edge { int to, cor; };
vector<int>G[114514];
int dp[100006];
int a[114];
int n, k; 

int memo(int x) {
	if (dp[x])return dp[x];
	int res = -1;
	rep(i, n) {
		if (x >= a[i]) {
			if (memo(x - a[i]) == -1)res = 1;
		}
	}
	return dp[x] = res;
}

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

	rep(i, n)cin >> a[i];
	memo(k);
 (dp[k]==1)?puts("First"):puts("Second");
}

Measured memory_bytes: 8448
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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



int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	for(int i = k - n + 1; i <= k + n - 1; i++)cout << i << ' ';
	return 0;
}


Measured memory_bytes: 256
S=input()
N=len(S)
A=[0]
for i in range(N):
    s=int(S[-1-i])
    A.append((A[-1]+(s*pow(10,i,2019)))%2019)
d={}
for i in range(len(A)):
    if not A[i] in d:
        d[A[i]]=1
    else:
        d[A[i]]+=1
ans=0
for k in d.keys():
    ans+=d[k]*(d[k]-1)//2
print(ans)

Measured memory_bytes: 16460
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

const string YES = "Yes";
const string NO = "No";

bool is_strong(string S){
  string T = S;
  reverse(range(T));
  return S == T;
}

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

  string S;
  cin >> S;
  if(is_strong(S) and is_strong(S.substr(0, S.length() / 2))){
    cout << YES << endl;
  }else{
    cout << NO << endl;
  }



  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long int
#define hell (int)(1e9+7)
#define inf 1000000000000

using namespace std;

int helper(int h){
    if(h==1)
        return 1;
    if(h<=0)
        return 0;
    return (int)1+(int)(2)*helper(h/2);
}

void solve(){
    int h;
    cin>>h;
    cout<<helper(h);
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t,c;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#--Comparing Strings

a, b = map(int, input().split(" "))

a_str = str(a)
b_str = str(b)

aa = " "
bb = " "

for i in range(b):
  aa = a_str + aa

for j in range(a):
  bb = b_str + bb

dummy = [aa, bb]
ans = sorted(dummy)

print(ans[0])


Measured memory_bytes: 3060
package main

import (
	"fmt"
)

func main() {
	var n, y int
	fmt.Scan(&n, &y)

	var ok bool
L:
	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			k := n - i - j
			if 10000*i+5000*j+1000*k == y {
				fmt.Printf("%d %d %d\n", i, j, k)
				ok = true
				break L
			}
		}
	}

	if !ok {
		fmt.Println("-1 -1 -1")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

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

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

int main() {
  int r,c,k;
  cin>>r>>c>>k;
  int memo[r+1][c+1];
  for(int i=0;i<r+1;i++){
    for(int j=0;j<c+1;j++){
      memo[i][j]=0;
    }
  }
  for(int i=0;i<k;i++){
    int R,C,v;
    cin>>R>>C>>v;
    memo[R][C]=v;
  }
  vector<vector<vector<ll>>> dp(4,vector<vector<ll>>(r+1,vector<ll>(c+1,0)));
  for(int i=1;i<r+1;i++){
    for(int j=1;j<c+1;j++){
      for(int l=0;l<4;l++){
        dp[0][i][j]=max(dp[0][i][j],dp[l][i-1][j]);
      }
      dp[0][i][j]=max(dp[0][i][j],dp[0][i][j-1]);
      dp[1][i][j]=dp[1][i][j-1];
      dp[2][i][j]=dp[2][i][j-1];
      dp[3][i][j]=dp[3][i][j-1];
      if(memo[i][j]!=0){
        dp[1][i][j]=max(dp[1][i][j-1],dp[0][i][j]+memo[i][j]);
        dp[2][i][j]=max(dp[2][i][j-1],dp[1][i][j-1]+memo[i][j]);
        dp[3][i][j]=max(dp[3][i][j-1],dp[2][i][j-1]+memo[i][j]);
      }
    }
  }
  ll ans=0;
  for(int i=0;i<4;i++){
    ans=max(ans,dp[i][r][c]);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 390556
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10, m = 10000;
int f[nax];


int main () {

    for (int n = 1 ; n <= m ; ++ n) {

        for (int x = 1 ; x * x <= n ; ++ x) {

        for (int y = 1 ; y * y <= n - x * x - x * y ; ++ y) {

        for (int z = 1 ; z <= n - x * x - y * y - x * z - x * y ; ++ z) {

            int c = x * x + y * y + z * z + x * y + y * z + z * x;
            if (c > n) break;

            if (x * x + y * y + z * z + x * y + y * z + z * x == n) {
                ++ f[n];
            }
        }
        }
        }
    }

    int n;
    scanf("%d", &n);

    for (int i = 1 ; i <= n ; ++ i)
        printf("%d\n", f[i]);

}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  string S, T;
  cin >> S >> T;

  map<ll, ll> same_map1;
  map<ll, ll> same_map2;
  map<char, ll> alpha;
  set<char> s1;
  set<char> s2;

  rep(i, S.size()) {
    ll s = S[i];
    ll t = T[i];

    if (same_map1[s] != 0 && same_map1[s] != t) {
      COUT("No");
      return 0;
    } else {
      same_map1[s] = t;
    }

    if (same_map2[t] != 0 && same_map2[t] != s) {
      COUT("No");
      return 0;
    } else {
      same_map2[t] = s;
    }

    alpha[s]++;
    s1.insert(s);
    s2.insert(s);
  }

  if (alpha.size() < 26) {
    COUT("Yes");
    return 0;
  }

  if (s1 == s2) {
    COUT("Yes");
  } else {
    COUT("No");
  }

  return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define pb push_back 
#define mp make_pair
typedef long long ll;

int first_dig(int n){
	while(n>=10){
		n/=10;
	}
	return n;
}

int cd(int n){
	int ans=0;
	while(n){
		ans++;
		n/=10;
	}
	return ans;
}

int main(){
	int n; cin>>n;
	int ans=0;
	map<int,int> m;
	for(int i=1;i<=n;i++){
		if(i%10==0) continue;
		if(first_dig(i)==i%10){
			m[i%10]++;
			continue;
		}
		int temp=10*(i%10)+first_dig(i);
		if(temp<=n) m[temp]++;
	}
			
			
	for(int i=1;i<100;i++){
		if(i%10==0 || (i>10 && first_dig(i)==i%10)) continue;
		int temp=10*(i%10)+first_dig(i);
		if(i<10 && i<=n) ans+=m[i]*m[i];
		else ans+=m[i]*m[temp];
	}
			
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int sx,sy,tx,ty;

int main(){
    cin>>sx>>sy>>tx>>ty;

    int h=ty-sy;
    int w=tx-sx;
    rep(i,h) cout<<'U';
    rep(i,w) cout<<'R';
    rep(i,h) cout<<'D';
    rep(i,w+1) cout<<'L';
    rep(i,h+1) cout<<'U';
    rep(i,w+1) cout<<'R';
    cout<<"DR";
    rep(i,h+1) cout<<'D';
    rep(i,w+1) cout<<'L';
    cout<<'U'<<endl;
}

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

int main(){
  int x;
  cin >> x;
  int ans = 0;
  ans += (x / 500) * 1000;
  x %= 500;
  ans += (x / 5) * 5;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    
    ll D, N;
    cin >> D >> N;
    ll cnt = 0;
    for(ll i = 1; ;i++){
        ll d = 0;
        for(ll j = i; j % 100 == 0; j /= 100)d++;
        if(d == D)cnt++;
        if(cnt == N){
            cout << i << endl;
            return 0;
        }
    }
    
    return 0;
}

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

int main(){
  string S;
  cin >> S;

  int ans;
  for(int tmp=0; tmp<(1<<3); tmp++){
    bitset<3> bits(tmp);

    int calc= S.at(0)- '0';
    for(int i=0; i<3; i++){
      if( bits.test(i) ){
        calc+= S.at(i+1)- '0';
      }
      else{
        calc-= S.at(i+1)- '0';
      }
    }
    if( calc==7 ){
      ans= tmp;
      break;
    }
  }

  for(int i=0; i<3; i++){
    bitset<3> bits(ans);

    cout << S.at(i);
    if( bits.test(i) ){
      cout << "+";
    }
    else{
      cout << "-";
    }
  }
  cout << S.at(3) << "=7" << endl;
}

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

using namespace std;

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

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

    long long corner;
    if (N == 1 and M == 1) cout << 1;
    else if (N == 1 or M == 1) cout << N*M - 2;
    else cout << N*M - (2*N + 2*(M-2));
    cout << endl;
}

Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    T = list(map(int, readline().split()))
    M = int(readline())

    S = sum(T)

    for i in range(M):
        p, x = map(int, readline().split())
        p -= 1

        print(S - T[p] + x)


if __name__ == '__main__':
    main()


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

using namespace std;
using LL = long long;
using P = pair<int,int>;

LL modpow(LL x, LL n, LL mod){
	LL r=1;
	while(n){
		if(n&1) r=r*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return r;
}

int main(){
	int N;
	cin >> N;
	string X;
	cin >> X;
	vector<int> f(N+1);
	for(int n=1; n<=N; n++){
		int res=0, s=n;
		while(s){
			if(f[s]!=0){
				f[n]=f[s];
				break;
			}
			int d=0, bit=1;
			while(bit<=s){
				if(s&bit) d++;
				bit<<=1;
			}
			s%=d;
			res++;
		}
		f[n]+=res;
	}
	//rep(i,N+1) cout << f[i] << endl;
	if(X=="0"){
		cout << 1 << endl;
		return 0;
	}
	int num=0;
	LL sum_minus=0, sum_plus=0;
	reverse(X.begin(),X.end());
	rep(bit,N){
		if(X[bit]=='1') num++;
	}
	rep(bit,N){
		if(X[bit]=='1'){
			sum_plus+=modpow(2,bit,num+1);
			if(num>1) sum_minus+=modpow(2,bit,num-1);
		}
	}
	for(int bit=N-1; bit>=0; bit--){
		if(X[bit]=='1'){
			if(num==1) cout << 0 << endl;
			else{
				LL ans=sum_minus;
				ans-=modpow(2,bit,num-1);
				ans%=num-1;
				if(ans<0) ans+=num-1;
				cout << f[ans]+1 << endl;
			}
		}
		else{
			LL ans=sum_plus;
			ans+=modpow(2,bit,num+1);
			ans%=num+1;
			cout << f[ans]+1 << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 4368
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

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

    stringstream ss(s);
    string buf;
    vector<string> v;
    while (getline(ss, buf, '/'))
        v.push_back(buf);

    int mon = stoi(v[1]);
    if (mon < 5)
        cout << "Heisei\n";
    else
        cout << "TBD\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N,ans;
  cin>>N;
  vector<int64_t> vec(3);
  vec.at(0)=2;
  vec.at(1)=1;
  for(int i=0;i<N-1;i++){
    vec.at(2)=vec.at(0)+vec.at(1);
    ans=vec.at(2);
    vec.at(0)=vec.at(1);
    vec.at(1)=vec.at(2);
  }
  if(N==1){
    ans=1;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<algorithm>
#include <iomanip>
#include <cmath>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <bitset>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>

using namespace std;

int main() {
	int n; cin >> n;
	map<int, int> mp;


	for (int i = 0; i < n; i++) {
		int x;cin >> x;
		mp[x] += 1;
	}

	int ans = 0;

	for (pair<int, int> z : mp) {
		if (z.second % 2 == 1) {
			ans++;
		}
	}

	cout << ans << endl;


}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    int n,m;cin>>n>>m;
    vector<int> s[m];
    int k[m];
    rep(i,0,m){
        cin>>k[i];
        rep(j,0,k[i]){
            int w;cin>>w;w--;
            s[i].push_back(w);
        }
    }
    int p[m];
    rep(i,0,m)cin>>p[i];
    int u=pow(2,n);
    int ans=0;
    rep(i,0,u){
        int c[n];
        rep(j,0,n){
            int y=pow(2,j);
            int r=i/y;
            c[j]=r%2;
            //cout<<c[j]<<" ";
        }//cout<<endl;
        int o=0;
        rep(j,0,m){
            int cnt=0;
            rep(l,0,s[j].size())cnt+=c[s[j][l]];
            if(cnt%2!=p[j]){
                o=1;
                break;
            }
        }
        if(o==0)ans++;
        
    }
    cout<<ans<<endl;
}


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

using ll = long long;
using ld = long double;

int main()
{
    int n;
    cin >>n;
    vector<ll> v;
    v.push_back(2);
    v.push_back(1);
    
    for(int i = 2; i <= n; i++)
    {
        v.push_back(v[i-1]+v[i-2]);
    }
    cout << v[n]<<endl;

    return 0;
}

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


int main(){
    int n, h, m, s;
    while(scanf("%d", &n), n){
        int imos[86401] = {};
        for(int i = 0; i < n; i++){
            scanf("%d:%d:%d", &h, &m, &s);
            imos[3600*h+60*m+s]++;
            scanf("%d:%d:%d", &h, &m, &s);
            imos[3600*h+60*m+s]--;
        }
        int ans = 0, sum = 0;
        for(int i = 0; i < 86401; i++){
            sum += imos[i];
            ans = max(ans, sum);
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using vb = vector<bool>;
using boolGraph = vector<vb>;
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int a, b, c, x, y; cin >> a >> b >> c >> x >> y;

  int ans = a*x + b*y;
  int tmp;

  if (x < y) tmp = min(c*x*2 + b*(y-x), c*y*2);
  else tmp = min(c*y*2 + a*(x-y), c*x*2);

  ans = min(ans, tmp);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())

for i in range(tx - sx):
    print("R" ,end = "")

for i in range(ty - sy):
    print("U" ,end = "")
    
for i in range(tx - sx):
    print("L" ,end = "")

for i in range(ty - sy):
    print("D" ,end = "")

print("D" ,end = "")

for i in range(tx - sx + 1):
    print("R" ,end = "")

for i in range(ty - sy + 1):
    print("U" ,end = "")

print("L" ,end = "")

print("U" ,end = "")

for i in range(tx - sx + 1):
    print("L" ,end = "")

for i in range(ty - sy + 1):
    print("D" ,end = "")

print("R" ,end = "")

Measured memory_bytes: 51820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    int n;
    cin >> n;
    set<int> st;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        st.insert(a);
    }

    if(st.size()%2 == 0){
        cout << st.size()-1 << endl;
    } else cout << st.size() << endl;

    

    return 0;
}

Measured memory_bytes: 8192
import java.util.Scanner;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        long[][] dp = new long[n][n];
        long s = sum(arr,0,n-1,dp);

        System.out.println(s);
    }
    private static long sum(int[] arr, int i, int j, long[][] dp){
        if(i>j) return 0;
        if(i==j) return arr[i];
        if(dp[i][j]!=0) return  dp[i][j];
        return dp[i][j] = Math.max(arr[i]-sum(arr,i+1,j,dp ),arr[j]-sum(arr,i,j-1,dp ));
    }
}

Measured memory_bytes: 137664
#include <stdio.h>

int main(void)
{
  char a[5],b[5];
  int c = 0;
  
  scanf("%s",&a);
  scanf("%s",&b);
  
  for(int i = 0;i<3;i++)
  {
    if(a[i] == b[i]) c++;
  }
  printf("%d",c);
}

Measured memory_bytes: 128
//I am so vegetable
//#define err
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = acos(-1.0);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }


int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
    #ifdef err
	double be = clock();
    #endif
    string s;cin>>s;
    int ans = 0;
    _for(i,0,s.size()){
        if(s[i]=='?')s[i]='D';
    }
    cout<<s;
    #ifdef err
	double en = clock();
    cout<<"time: "<<fixed<<setprecision(8)<<en-be;
    #endif
	return 0;
}

Measured memory_bytes: 3712
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX = 200005;
//
//
int price[MAX];
int ans[MAX];
int vis[MAX];
int n;
void dfs(int node, vector<vector<int>>& vec, vector<int>& longest){
    if(vis[node] != -1)
        return ;
    vis[node] = 1;
    int idx = lower_bound(longest.begin(), longest.end(), price[node]) - longest.begin();
    int sz = longest.size();
    pair<int, int> change;
    if(idx >= sz){
        longest.push_back(price[node]);
        change = {idx, -1};
        ++sz;
    }
    else{
        change = {idx, longest[idx]};
        longest[idx] = price[node];
    }
    ans[node] = sz;
    for(int idx : vec[node]){
        dfs(idx, vec, longest);
    }
    if(change.second == -1 && !longest.empty())
        longest.pop_back();
    else
        longest[change.first] = change.second;
}
void solve(){
    cin>>n;
    for(int i = 1; i <= n; i++)
        cin>>price[i];
    vector<vector<int>> vec(n+1);
    for(int i = 0; i < n-1; i++){
        int f, s;
        cin>>f>>s;
        vec[f].push_back(s);
        vec[s].push_back(f);
    }
    memset(vis, -1, sizeof(vis));
    vector<int> longest;
    dfs(1, vec, longest);
    for(int i = 1; i <= n; i++)
        cout<<ans[i]<<"\n";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}


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

int main(void){
  int n, k;
  cin >> n >> k;
  int low = max(-1000000,k - (n - 1));
  int hi = min(1000000, k + (n - 1));
  for(int i = low; i <= hi; i++){
    cout << i << " ";
  }
  cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define M        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
 
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    ll n, i;
    cin>>n>>i;
    
    cout<<n-i+1;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;


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

	// long long?
	int N, M;
	cin >> N >> M;


	multiset<ll, greater<ll> > sA;
	for (int i = 0; i != N; ++i) {
		ll tmp = 0;
		cin >> tmp;
		sA.insert(tmp);
	}

	for (int i = 0; i != M; ++i) {
		ll tmp = *sA.begin();
		sA.erase(sA.begin());
		sA.insert(tmp / 2);
	}

	ll total = 0;
	for (multiset<ll>::iterator it = sA.begin(); it != sA.end(); ++it) {
		total += *it;
	}

	cout << total << endl;
	
	return 0;

}

Measured memory_bytes: 4992
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
from operator import mul

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
Ha = LI()

if N == 1:
    print(0)
    exit()

H = np.array(Ha,dtype='int')
# +の場合は右の要素が大きい
# 1 2 3
#   1 2 3
#   1 1
diff = H[1:]-H[:-1]
# -が連続する最大の回数をカウント
result = 0
count = 0
for i in range(N-1):
    if diff[i]<=0:
        count += 1
        continue
    else:
        result = max(count,result)
        count = 0
result = max(count,result)    

print(result)

Measured memory_bytes: 38324
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define lli long long int
#define f(i,a,b) for(i=a;i<b;i++)
#define ff first
#define sc second
#define pb push_back
#define full(v) v.begin(),v.end()
#define ms(a) memset(a,0,sizeof(a))
#define mod 1000000007
#define mod2 998244353
#define msb(b) memset(b,true,sizeof(b))
#define msf(b) memset(b,false,sizeof(b))
#define MAXN 100005

int main()
{
    fio;
    int t,n,i,k;
    cin >> n >> k;
    int a[n];
    f(i,0,n)
      cin >> a[i];
    sort(a, a + n);
    int sum = 0;
    f(i,0,k)
      sum += a[i];
    cout << sum << endl;
}


Measured memory_bytes: 3576
#include<iostream>
#include <string>
using namespace std;
int main()
{
    // 整数の入力
    string s;
    cin >> s;
	if(s.back()=='s'){
    cout << s << "es" << endl;
    }
  else{
    cout << s << "s" << endl;
  }
    return 0;
}

Measured memory_bytes: 3620
def cs(x):
    ans = 0
    for i in range(len(x)-1):
        ans += abs(x[i+1]-x[i])
    return ans


n = int(input())
a = [0] + list(map(int, input().split())) + [0]

s = cs(a)

for i in range(1, len(a)-1):
    dif = abs(a[i]-a[i-1]) + abs(a[i+1]-a[i]) - abs(a[i+1]-a[i-1])
    print(s-dif)

Measured memory_bytes: 14172
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int n,x,a[1100];
signed main()
{
	cin>>n>>x;
	rep(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	rep(i,n){
		x-=a[i];
		if(x<0){
			cout<<i;
			return 0;
		}
	}
	if(x==0){
		cout<<n;
	}else{
		cout<<n-1;
	}
}

Measured memory_bytes: 256