akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int num[] = new int[4];
		String flg[] = new String[3];
		for (int i = 0; i < 4; i++) {
			num[3 - i] = n % 10;
			n /= 10;
		}
//		for(int i=0;i<4;i++) {
//			System.out.println(num[i]);
//		}
		int sum = num[0];
		for (int bit = 0; bit < (1 << 3); bit++) {
			for (int i = 0; i < 3; i++) {
				if ((bit & (1 << i)) != 0) {
					sum += num[i + 1];
					flg[i] = "+";
				} else {
					sum -= num[i + 1];
					flg[i] = "-";
				}
			//	System.out.println(flg[i]+" "+sum);
			}
			if (sum == 7) {
				System.out.println(num[0] + flg[0] + num[1] + flg[1] + num[2] + flg[2] + num[3] + "=7");
				break;
			}else {
				sum=num[0];
			}
		}
	}

}


Measured memory_bytes: 21332
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		int K = scanner.nextInt();
		char st[] = new char[s.length()];
		boolean flag = true;
		for (int i = 0; i < st.length; i++) {
			st[i] = (char) (s.charAt(i) - 'a');
			if (st[i] != 0 && flag) {
				if (K - 26 + st[i] >= 0) {
					K = K - 26 + st[i];
					st[i] = 0;
				} else {
					// flag = false;
				}
			}
		}
		st[st.length - 1] = (char) ((st[st.length - 1] + K) % 26);
		for (int i = 0; i < st.length; i++) {
			System.out.print((char) (st[i] + 97));
		}
		System.out.println("");

	}
}


Measured memory_bytes: 26728
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define mp make_pair
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

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

	vector<int> b(N);
	for (int i = N-1; i >= 0; i--) {
		int c = 0;
		for (int j = 2*(i+1); j <= N; j += i+1) {
			if (b[j-1]) c ^= 1;
		}
		if (a[i] != c) b[i] = 1;
	}

	vector<int> ans;
	for (int i = 0; i < N; i++) if (b[i]) ans.push_back(i+1);

	cout << ans.size() << endl;
	for (int i = 0; i < (int)ans.size(); i++) {
		if (i > 0) cout << " ";
		cout << ans[i];
	}
	cout << endl;
    return 0;
}


Measured memory_bytes: 3064
from functools import reduce
from operator import and_

N, M, X, Y = map(int, input().split())

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

Z = -1
R = 'War'
for zz in range(X + 1, Y + 1):
    xb = reduce(and_, [x < zz for x in xs])
    yb = reduce(and_, [y >= zz for y in ys])
    if xb and yb:
        R = 'No War'
        break

print(R)

Measured memory_bytes: 3572
N = int(input())
h = list(map(lambda x: int(x), input().split()))

#dp[i] はiまで行く最小のコスト
inf = 10**8
dp = [inf for i in range(N)]
dp[0] = 0 #初期化条件
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]))
  
print(dp[N-1])

Measured memory_bytes: 13924
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a<b){
        if(b<c){
            cout << a << " " << b << " " << c <<endl;
        }else{
            if(a<c){
                cout << a << " " << c << " " << b <<endl;
            }else{
                cout << c << " " << a << " " << b <<endl;
            }
        }
    }else{
        if(a<c){
            cout << b << " " << a << " " << c <<endl;
        }else{
            if(b<c){
                cout << b << " " << c << " " << a << endl;
            }
            else{
                cout << c << " " << b << " " << a <<endl;
            }
        }
    }
}


Measured memory_bytes: 3084
def main():
    n, m = map(int, input().split())
    t = list(map(int, input().split()))
    if n >= m:
        return 0
    t.sort()
    x = [[t[i], t[i+1] - t[i]] for i in range(m-1)]
    x.append([t[m-1], 0])
    x.sort(key=lambda a: a[1], reverse=True)
    sum_dis = t[m-1] - t[0]
    skip_dis = sum([x[i][1] for i in range(n - 1)])
    return sum_dis - skip_dis


print(main())

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

const int MAX_N = 200005;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(MAX_N);

vector<int> to[MAX_N];

struct DP {
  mint dp;
  int t;
  DP(mint dp=1, int t=0):dp(dp),t(t) {}
  DP& operator+=(const DP& a) {
    dp *= a.dp;
    dp *= comb(t+a.t, t);
    t += a.t;
    return *this;
  }
  DP operator-(const DP& a) const {
    DP res(*this);
    res.t -= a.t;
    res.dp /= comb(res.t+a.t, res.t);
    res.dp /= a.dp;
    return res;
  }
  DP addRoot() const {
    DP res(*this);
    res.t++;
    return res;
  }
};

vector<DP> dp[MAX_N];
DP dpSum[MAX_N];

DP dfs(int v, int p=-1) {
  // dpSum[v] = DP(1,0);
  dp[v] = vector<DP>(to[v].size());
  rep(i,to[v].size()) {
    int u = to[v][i];
    if (u == p) continue;
    dp[v][i] = dfs(u,v);
    dpSum[v] += dp[v][i];
  }
  return dpSum[v].addRoot();
}
void bfs(int v, const DP& dpP=DP(), int p=-1) {
  if (p != -1) dpSum[v] += dpP.addRoot();
  rep(i,to[v].size()) {
    int u = to[v][i];
    if (u == p) continue;
    bfs(u, dpSum[v] - dp[v][i], v);
  }
}

int main() {
  int n;
  cin >> n;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  dfs(0);
  bfs(0);
  rep(i,n) {
    cout << dpSum[i].addRoot().dp << endl;
  }
  return 0;
}

Measured memory_bytes: 34292
n = gets.to_i
sum = Hash.new(0)
while o = gets do
    v,k = o.split(" ")
    v = v.to_f
    k = k.to_s
    sum[k] += v
end

total = 0
sum.each do |k,v|
    if k == "JPY"
        total = total + v.to_f
    elsif k == "BTC"
        total = total + (v.to_f*380000.0)
    end
end

puts total

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

enum{
  t = 0,
  f ,
  r ,
  b ,
  l ,
  d,
};

array<int,6> dice = {1,3,5,4,2,6};

void Spin(array<int,6> &D,int dir){
  if(dir == l){//
    swap(D[t],D[r]);
    swap(D[r],D[d]);
    swap(D[d],D[l]);
  }
  else if(dir == r){
    swap(D[t],D[l]);
    swap(D[l],D[d]);
    swap(D[d],D[r]);
  }
  else if(dir == f){
    swap(D[t],D[b]);
    swap(D[b],D[d]);
    swap(D[d],D[f]);
  }
  else if(dir == b){
    swap(D[t],D[f]);
    swap(D[f],D[d]);
    swap(D[d],D[b]);
  }
  else if(dir == d){//leftspin
    swap(D[f],D[r]);
    swap(D[r],D[b]);
    swap(D[b],D[l]);
  }
  else if(dir == t){
    swap(D[f],D[l]);
    swap(D[l],D[b]);
    swap(D[b],D[r]);
  }
}

void ViewDice(array<int,6> D){
  rep(i,6){
    cout << D[i]<< " ";
  }
  cout << endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  array<int,6> di;
  cin >> di[t] >> di[f] >> di[r] >> di[l] >> di[b] >> di[d];
  string s;
  cin >> s;
  rep(i,s.size()){
    if(s[i] == 'S'){
      Spin(di,f);
    }
    if(s[i] == 'E'){
      Spin(di,r);
    }
    if(s[i] == 'W'){
      Spin(di,l);
    }
    if(s[i] == 'N'){
      Spin(di,b);
    }
  }
  cout << di[t]<<endl;
  return 0;
}

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

#ifndef DEBUG
#define endl '\n'
#define debugf(...)
#define debug(...)
#else
#define debugf(...) printf(__VA_ARGS__)
#define debug(...) __VA_ARGS__
#endif

const int N = 1e5 + 5;



int (((((main)))))() <%
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	int n, k;
	cin >> n >> k;


	int ans = 0;
	if (n == 0)
		ans = 1;
		
	while (n > 0) {
		ans++;
		n /= k;
	}

	cout << ans << endl;
	
	return 0;
%>

Measured memory_bytes: 256
/*************************************************************************
	> File Name: 4.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/9/19 20:39:53
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
LL read(){
	char x=getchar(); LL u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=1e6+10;
LL a[maxx],c[maxx],n,x,m,cnt=0,sum=0,ans=0,vis[maxx];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	n=read(); x=read(); m=read();
	a[++cnt]=x;
	vis[x]=1;
	while(1){
		a[cnt+1]=a[cnt]*a[cnt]%m;
		if(vis[a[cnt+1]]){
			int j=0;
//			cout<<vis[a[cnt+1]]<<endl;
			for(int i=1;i<=cnt && n>0;++i)
				if(i>=vis[a[cnt+1]]) c[++j]=a[i],sum+=a[i];
				else ans+=a[i],--n;
			
			cnt=j;
			break;
		}
		else{
			vis[a[cnt+1]]=cnt+1;
			++cnt;
		}
	}
	if(cnt){
		ans+=sum*(n/cnt);
		for(int i=1;i<=n%cnt;++i) ans+=c[i];
	}
	printf("%lld\n",ans);


		
	return 0;
}


Measured memory_bytes: 5308
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    string s;
    ll k;
    cin >> s >> k;
    ll num = -1;
    ll value = 1;
    rep(i, 0, s.size()) {  
        //cout << s[i] << endl; 
        if(s[i] == '1') {
            num = i;
        }
        else {
            //num = i;
            value = s[i]-'0';
            //cout << num << " " << value << endl;
            break;
        }
    }

    //cout << num << " " << k << endl;

    if(num >= k-1) {
        cout << 1 << endl;
    }
    else {
        cout << value << endl;
    }

    return 0;

}   

Measured memory_bytes: 256
#coding:utf-8
import sys
a=[]
b=[]
N,M=map(int ,raw_input().split())
for i in range(N):
    a.append(list(raw_input()))
for i in range(M):
    b.append(list(raw_input()))

def chk(a,b,x,y):
    global M
    global N
    #x,y:左上座標
    #print x,y
    for row in range(M):
        for col in range(M):
            if a[row+y][col+x]!= b[row][col]:
                return False
    return True

f=False
for row in range(N-M):
    for col in range(N-M):
        if chk(a,b,col,row):
            f=True
if N==1 and M==1 and a[0][0]==b[0][0]:
    print "Yes"
elif f:
    print "Yes"
else:
    print "No"

Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h,n;cin>>h>>n;
    ll sum = 0;
    rep(i,n){ll a;cin>>a;sum+=a;}
    if(sum<h)cout<<"No";
    else cout<<"Yes";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct help{
 ll weight,value;
};
ll knapsack2(help arr[],ll n,ll tw,ll mv){
  ll dp[n+1][mv+1];
  for(ll i=0;i<=n;i++){
    for(ll j=0;j<=mv;j++){
        dp[i][j]=INT_MAX;
    }
  }
  dp[0][0] = 0;
  for(ll i=1;i<=n;i++){
    for(ll j=0;j<=mv;j++){
        //dp[i][j] = INT_MAX;
        if(i==0 && j==0){
            dp[i][j] = 0;
        }
        else{
            ll op1=INT_MAX,op2=INT_MAX;
          if(arr[i].value<=j){
            op1 = min(op1,arr[i].weight+dp[i-1][j-arr[i].value]);
          }
          op2 = min(op2,dp[i-1][j]);
        dp[i][j] = min(op1,op2);
      }
    }
  }
  ll ans = 0;
   for(ll j=0;j<=mv;j++){
    if(dp[n][j]<=tw){
      ans = j;
    }
   }
  return ans;
}
int main(){
 ll n,w,mv=0;
 cin>>n>>w;
 help arr[n+1];
 for(ll i=1;i<=n;i++){
    cin>>arr[i].weight>>arr[i].value;
    mv+=arr[i].value;
 }
 //ll mv = n*1000;
 cout<<knapsack2(arr,n,w,mv);
}


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

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

  int a;
  string s;
  cin>>a>>s;
  if(a>=3200){
    cout<<s<<endl;
  }else{
    cout<<"red"<<endl;

  }

  return 0;
}


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

int main() {
    int N, M, max=0;
    string u;
    cin >> N;
    vector<string> s(N);
    for(int i=0; i<N; i++) cin >> s.at(i);
    cin >> M;
    vector<string> t(M);
    for(int i=0; i<M; i++) cin >> t.at(i);
    vector<int> coin(N);
    
    for(int i=0; i<N; i++){
        u = s.at(i);
        for(int j=0; j<N; j++){
            if(u == s.at(j)) coin.at(i)++;
        }
        for(int j=0; j<M; j++){
            if(u == t.at(j)) coin.at(i)--;
        }
        if(max < coin.at(i)) max = coin.at(i);
    }
    cout << max << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
    long sum;
    int i, n, num, min, max;
    scanf("%d\n%d", &n, &num);
    min = num;
    max = num;
    sum = num;
    for (i = 1; i < n; i ++) {
        scanf("%d", &num);
        sum += num;
        if (num > max) max = num;
        if (num < min) min = num;
    }    
    printf("%d %d %ld\n", min, max, sum);
    return 0;
}

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

int main(){
  
  //input
  int N;
  cin >> N;
  int rnum=0;
  char cl[N];
  for(int i=0;i<N;i++){
    cin >> cl[i];
    if(cl[i]=='R') rnum++;
  }
  
  //setup
  int Total =0;
  for(int i=0;i<rnum;i++){
    if(cl[i]=='W') Total++;
  }
  
  //output
  cout << Total << endl;
  
}

Measured memory_bytes: 3812
#include <string>
#include <iostream>
#include <sstream>
using namespace std;

int main() {
	int i=0;
	string str, word;

	getline(cin, str);
	while(~str.find("."))str[str.find(".")] = ' ';
	while(~str.find(","))str[str.find(",")] = ' ';
	stringstream ss(str);

	while (ss >> word) {
		int len = word.length();
		if(len>=3&&len<=6){
			if(i==0){cout<<word;i++;}
			else    cout<<' '<<word;
		}
	}
	cout<<"\n";
	return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int N, M, K, Q, W, H, R, C;
string S;

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

    cin >> N;
    vector<int> X(N);
    REP(i, N) cin >> X.at(i);

    int ans = INF;
    for (int x = 1; x <= 100; x++) {
        int sum = 0;
        REP(i, N) { sum += (X[i] - x) * (X[i] - x); }
        chmin(ans, sum);
    }

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


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

typedef long long lint;
#define fint register int
#define flint register lint

inline int ty()
{
	fint a=0,b=1,c=getchar();
	while(!isdigit(c))b^=c=='-',c=getchar();
	while(isdigit(c))a=a*10+c-48,c=getchar();
	return b?a:-a;
}

const int _ = 3007 , mo = 1000000007;
#define ad(a,b) (a=(1ll*a+(1ll*b%mo+mo)%mo)%mo)

int n,m;
lint f[_][_][2]={0};

int main()
{
	n=ty(),m=ty();
	for(fint i=1;i<=n;i++)f[0][i][0]=1;
	f[0][0][1]=1;

	for(fint i=0;i<m;i++)
	{
		for(fint j=0;j<=n;j++)
		{
			if(f[i][j][0])
			{
				if(j>0)ad(f[i+1][j][j==1],f[i][j][0]);// -w +w
				if(j>0)ad(f[i+1][j-1][j==1],f[i][j][0]);// -w +b
				if(j<n)ad(f[i+1][j+1][0],f[i][j][0]);// -b +w
				if(j<n)ad(f[i+1][j][0],f[i][j][0]);// -b +b
			}
			if(f[i][j][1])
			{
				if(j>0)ad(f[i+1][j][1],f[i][j][1]);// -w +w
				if(j>0)ad(f[i+1][j-1][1],f[i][j][1]);// -w +b
				if(j<n)ad(f[i+1][j+1][1],f[i][j][1]);// -b +w
				if(j<n)ad(f[i+1][j][1],f[i][j][1]);// -b +b
			}
		}
	}

	flint ans=0;
	for(fint i=0;i<=n;i++)ad(ans,f[m][i][1]);
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 141184
#include <iostream>
#include <queue>

using namespace std;

int main() {
    priority_queue<long, deque<long>, std::greater<long> > pq;
    long a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    pq.push(a*x+b*y);
    pq.push(2*c*x+b*y);
    pq.push(a*x+2*c*y);
    pq.push(2*c*max(x,y));
    if (x >= y) pq.push(a*(x-y)+2*c*y);
    else pq.push(2*c*x+b*(y-x));
    cout << pq.top() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define ll long long int 
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

int main(){
	fastIO;
	ll a,b,c,d;
	cin >> a >> b >> c >> d;
	cout << max(a*c,max(b*d, max(a*d, b*c))) << "\n";
}

Measured memory_bytes: 3160
from itertools import combinations


N, *S = open(0).read().split()
MARCH = ("M", "A", "R", "C", "H")
cnt = {c: 0 for c in MARCH}
for s in S:
    if s[0] in MARCH:
        cnt[s[0]] += 1
print(sum(cnt[a] * cnt[b] * cnt[c] for a, b, c in combinations(MARCH, 3)))


Measured memory_bytes: 10864
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int MOD = 1000000007;
const ll INF = 1LL << 60;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) {return a / GCD(a, b) * b;}

int main()
{
	int N;
	cin >> N;
	int a;
	int count4 = 0;
	int count2 = 0;
	for(int i = 0; i < N; i++)
	{
		cin >> a;
		if(a % 4 == 0) count4++;
		if(a % 4 != 0 && a % 2 == 0) count2++;
	}
	if((count2 == 0 && count4 * 2 + 1 >= N )|| (count2 != 0 && count4 * 2 + count2 >= N))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K; cin >> K;
    int c[50] = {};
    rep(i, 50) c[i] = 49;
    cout << 50 << endl;
    int r = (K/50);
    K -= (K/50) * 50;
    rep(i, 50) {
        c[i] += r;
    }
    rep(i, 50){
        if(K > 0) {
            c[i] += 50 + 1;
            rep(j, 50) c[j]--;
            K--;
        }
    }
    rep(i, 50) {
        if (i != 0) cout << " ";
        cout << c[i];
    }
    cout << endl;


    return 0;
}
// 4
// 3 3 3 3
// 7 2 2 2

Measured memory_bytes: 384
n=int(input())
fact=1
for i in range(2,n+1):
	fact*=i
sieve=[0]*2+[1]*100000
primes=[]
for i,e in enumerate(sieve):
	if sieve[i]==1:
		primes.append(i)
		for j in range(i*2,len(sieve),i):
			sieve[j]=0
ans=1
MOD=10**9+7
for prime in primes:
	if fact%prime==0:
		count=0
		while fact%prime==0:
			fact=fact//prime
			count+=1
		ans=(ans*(count+1))%MOD
print(ans%MOD)

Measured memory_bytes: 4596
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Hassan El Desouky
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define el '\n'
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
#define FORD(i,a,b) for(int i = a; i >= b; --i)
#define RI(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(n)-1)
#define SQR(x) (x)*(x)
typedef long long ll;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef long double ld;
typedef vector<int>		vi;
typedef vector<pii>		vpii;
const double EPS = 1e-9;
const int N = 1e3+2, M = 2e5+5, OO = 0x3f3f3f3f;
//int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
//int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Directio
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


class CBeTogether {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n; in >> n;
	    vector<int> v(n);
	    for (int& x: v) in >> x;
        ll ans = OO;
        for (int i = -100; i <= 100; ++i) {
            ll temp = 0ll;
            for (int j = 0; j < n; ++j) {
                temp += pow((i-v[j]), 2);
            }
            ans = min(ans, temp);
        }
        out << ans << el;
	}
};


int main() {
	CBeTogether solver;
    ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n;
	cin>>n;
	ll sum=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3!=0&&i%5!=0)
		{
			sum+=i;
		}
	}
	cout<<sum<<endl;
	return 0;
} 

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
A = [[] for _ in range(3)]
for i in range(3):
    A[i] = [int(x) for x in input().strip().split()]
N = int(input())

for n in range(N):
    d = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == d:
                A[i][j] = 0

for i in range(3):
    if sum(A[i]) == 0:
        print('Yes')
        exit()
    if A[0][i] + A[1][i] + A[2][i] == 0:
        print('Yes')
        exit()

if A[0][0] + A[1][1] + A[2][2] == 0 or A[0][2] + A[1][1] + A[2][0] == 0:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 3064
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import sys

sys.setrecursionlimit(10000)
INF = float('inf')



N, K, X, Y = [int(input()) for _ in range(4)]

ans =0
while K > 0 and N > 0:
    K-=1
    N-=1
    ans += X
while N > 0:
    N-=1
    ans += Y
print(ans)


Measured memory_bytes: 14344
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
using namespace std;
typedef long long ll;
using P=pair<int,int>;

class Edge
{
	public:
	int ind;
	int from;
	int to;

	Edge(int n,int c)
	{
		to=n;
		ind=c;
	}
};

vector<Edge> g[100000];
int ans[100000];
bool used[100000];
vector<int> tres;
void visit(int now)
{
	used[now]=true;
	for(int i=0;i<g[now].size();i++)
	{
		if(!used[g[now][i].to])
			visit(g[now][i].to);
	}
	tres.push_back(now);
	return;
}
void tsort(int n)
{
	tres.clear();
	fill(used,used+n,false);
	for(int i=0;i<n;i++)
	{
		if(!used[i])
			visit(i);
	}
	reverse(tres.begin(),tres.end());
}
int main()
{
	fill(ans,ans+100000,-1);
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n-1+m;i++)
	{
		int a,b;
		cin>>a>>b;
		a--;b--;
		g[a].push_back(Edge(b,i));
	}
	tsort(n);
	ans[tres[0]]=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<g[tres[i]].size();j++)
		{
			Edge e=g[tres[i]][j];
			ans[e.to]=tres[i]+1;
		}
	}
	for(int i=0;i<n;i++)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 10484
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int s=0,m=0,n,i,j,x,y;
	scanf("%d%d%d",&n,&x,&y);
	for(i=1;i<=n;i++)
	{
		j=i;
		m=0;
		while(j)
		{
			m+=j%10;
			j/=10;
		}
		if(m>=x&&m<=y)
			s+=i;
	}
	printf("%d",s);
	return 0;
}


Measured memory_bytes: 256
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); cout << '\n';}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

Graph graph1, graph2;
Vec dist1, dist2;

void dijkstra1(ll s){
	priority_queue<P, vector<P>, greater<P> > que;
	que.push({0, s});
	while(!que.empty()){
		P o = que.top(); que.pop();
		if(o.fs >= dist1[o.sc]) continue;
		dist1[o.sc] = o.fs;
		for(P i : graph1[o.sc]) que.push({o.fs+i.sc, i.fs});
	}
}

void dijkstra2(ll s){
	priority_queue<P, vector<P>, greater<P> > que;
	que.push({0, s});
	while(!que.empty()){
		P o = que.top(); que.pop();
		if(o.fs >= dist2[o.sc]) continue;
		dist2[o.sc] = o.fs;
		for(P i : graph2[o.sc]) que.push({o.fs+i.sc, i.fs});
	}
}

int main(void){
	ll n, m, s, t;
	cin >> n >> m >> s >> t;
	s--, t--;
	graph1.resize(n);
	graph2.resize(n);
	dist1.assign(n, LINF);
	dist2.assign(n, LINF);
	rep(i, m){
		ll u, v, a, b;
		cin >> u >> v >> a >> b;
		u--, v--;
		graph1[u].pb({v, a});
		graph1[v].pb({u, a});
		graph2[u].pb({v, b});
		graph2[v].pb({u, b});
	}
	dijkstra1(s);
	dijkstra2(t);

	Vec ans(n);
	rep(i, n) ans[i] = dist1[i]+dist2[i];
	repr(i, n-1) chmin(ans[i], ans[i+1]);
	rep(i, n) ans[i] = 1e15-ans[i];
	co(ans);

	return 0;
}


Measured memory_bytes: 18972
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)					// repeat
#define repr(i, begin, end) for (ll i = begin - 1; end <= i; i--)		// repeat reverse

std::chrono::system_clock::time_point  start;

void TimeStart(void)
{
	start = std::chrono::system_clock::now();
}

void TimeEnd(void)
{
	auto time = std::chrono::system_clock::now() - start;
	auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count();
	cerr << endl << msec << " msec " << endl;
}

#endif



int main(void)
{
	ll a; cin >> a;
	ll p; cin >> p;

	cout << (ll)((a * 3 + p) / 2);

	return 0;
}

Measured memory_bytes: 256
s = input()
c = ans = i = 0
while i<len(s)-1:
    if s[i:i+2]=='BC':
        ans += c
        i += 2
    elif s[i]=='A':
        c += 1
        i += 1
    else:
        c = 0
        i += 1

print(ans)


Measured memory_bytes: 3500
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int64_t i = 0; i < (n); ++i)
#define repe(i, n) for (int64_t i = 0; i <= (n); ++i)
#define reps(i, s, n) for (int64_t i = (s); i < (n); ++i)
#define repse(i, s, n) for (int64_t i = (s); i <= (n); ++i)
#define repr(i, n) for (int64_t i = (n); i >= 0; --i)
const int64_t inf = (int64_t)1e18;
const int64_t mod = (int64_t)1e9 + 7;


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

  int64_t N; cin >> N;
  vector<int64_t> hs(N);
  rep(i, N) cin >> hs[i];

  int64_t ans = 0;
  int64_t highest = 0;

  rep(i, N) {
    if (hs[i] >= highest) {
      ans++;
      highest = hs[i];
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;

int a[100005];
int b[100005];

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    bool check = true;
    for (int i = 1; i <= n; ++i) b[i] = a[i];
    b[1]--;
    for (int i = 2; i <= n; ++i) {
        if (b[i] - 1 >= b[i - 1]) {
            b[i]--;
        }
        else if (b[i] >= b[i - 1]) continue;
        else {
            check = false;
        }
    }
    if (check) {
        cout << "Yes" << '\n';
    }
    else cout << "No" << '\n';
    return 0;
}



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

int main(){
	// sengen
	LL n;
	// nyuryoku
	cin >> n;
	// keisan
	LL wari = 1e9 + 7;
	LL aj,bk,ch;
	LL ans;
	for(int i=0;i<n;i++){
		if(i == 0){
			aj = 10;
			bk = 9;
			ch = 8;
		}else{
			aj = aj*10%wari;
			bk = bk*9%wari;
			ch = ch*8%wari;
		}
	}
	ans = 2*wari + aj - 2*bk + ch;
	ans = ans%wari;
	// syutsuryoku
	cout << ans << endl;
}

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


ll N;

int main(){
  cin >> N;
  vector<vector<ll>> SP(N, vector<ll>(2));
  for(int i =0; i< N; i++){
    cin >> SP.at(i).at(0) >> SP.at(i).at(1);
  }

  ll leng = 0.0;
  ll buf;
  for(int i = 0; i<N-1; i++){
    for(int j = i+1; j<N; j++){
      buf = (SP.at(i).at(0) - SP.at(j).at(0))  * (SP.at(i).at(0) - SP.at(j).at(0)) +
      (SP.at(i).at(1) - SP.at(j).at(1)) *
      (SP.at(i).at(1) - SP.at(j).at(1));
      leng += sqrt(buf);
    }
  }
  // cout <<  leng << endl;

  ll ans = leng * 2.0 / N;
  // printf(%%.10f\n",ans);
  cout << setprecision(10)<< ans << endl;

}


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

using namespace std;

typedef long long int ll;

void solve()
{
	ll n = 100, x;
	cin >> x;
    for(int i = 1; i <= 1e6;i++)
	{
        n = (n / 100) + n;
        if(n >= x)
		{
            cout<<i;
            return;
        }
    }
}

int main()
{
	int t = 1;
	//cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}



Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a==c)
	{
		cout<<"No";
		return 0;
	}
	if(a==b||b==c||a==c)
		cout<<"Yes";
	else
		cout<<"No";	
} 

Measured memory_bytes: 256
#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    A=list(map(int,input().split()))
    Q=int(input())
    cnt=[0]*(10**5+1)
    sumA=sum(A)
    for a in A:
        cnt[a]+=1
        
    for query in range(Q):
        b,c=map(int,input().split())
        sumA+=cnt[b]*(c-b)
        cnt[c]+=cnt[b]
        cnt[b]=0
        print(sumA)
        
    
    
    
if __name__=="__main__":
    main()


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, A, B, C;
string S[int(1e5+5)];
char ans[int(1e5+5)];

int main(){
  cin >> N >> A >> B >> C;
  for (int i = 0; i < N; i++) cin >> S[i];

  for (int i = 0; i < N; i++){
    if (A < 0 || B < 0 || C < 0){
      No(); return 0;
    }

    if (S[i] == "AB"){
      if (A == 0 && B == 0){
        No(); return 0;
      }
      if (A == 1 && B == 1){
        if (S[i + 1] == "BC") B = 2, A = 0, ans[i] = 'B';
        else A = 2, B = 0, ans[i] = 'A';
      }else{
        if (A < B) A++, B--, ans[i] = 'A';
        else B++, A--, ans[i] = 'B';
      }
    }else if (S[i] == "BC"){
      if (B == 0 && C == 0){
        No(); return 0;
      }
      if (B == 1 && C == 1){
        if (S[i + 1] == "AC") C = 2, B = 0, ans[i] = 'C';
        else B = 2, C = 0, ans[i] = 'B';
      }else{
        if (B < C) B++, C--, ans[i] = 'B';
        else B--, C++, ans[i] = 'C';
      }
    }else{
      if (A == 0 && C == 0){
        No(); return 0;
      }
      if (A == 1 && C == 1){
        if (S[i + 1] == "AB") A = 2, C = 0, ans[i] = 'A';
        else A = 0, C = 2, ans[i] = 'C';
      }else{
        if (A < C) A++, C--, ans[i] = 'A';
        else A--, C++, ans[i] = 'C';
      }
    }
  }

  Yes();
  for (int i = 0; i < N; i++) cout << ans[i] << endl;
  return 0;
}


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

using namespace std;

using ll = long long int;

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    string S;
    cin >> S;
    int yyyy = stoi(S.substr(0, 4));
    int mm = stoi(S.substr(5, 2));
    int dd = stoi(S.substr(8, 2));
    // cout << yyyy << endl;
    // cout << mm << endl;
    // cout << dd << endl;
    if (yyyy < 2019){
        cout << "Heisei" << endl;
    }else if (2019 < yyyy){
        cout << "TBD" << endl;
    }else{
        if (mm < 4){
            cout << "Heisei" << endl;
        }else if (4 < mm){
            cout << "TBD" << endl;
        }else{
            if (dd <= 30){
                cout << "Heisei" << endl;
            }else{
                cout << "TBD" << endl;
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int cnt=0,mini=1e9,maxi=-1;
int mini1=1e9,maxi1=-1,cnt1=0,cnt2=0;
int main(){
ios_base::sync_with_stdio(0);
	int n,m;
	cin>>n>>m;
	n*=500;
	if(m<=n){
		cout<<"Yes";
	return 0;
	}
	cout<<"No";
}
//     *    *  *  ****    *    *   *
//    *	*   * *   *      * *   *   *
//   *****  **    ****  *****  *****
//   *   *  * *      *  *   *      *
//   *   *  *  *  ****  *   *  *****

//   ****  ****  *       *
//   *      **   *      * *
//   ****   **   *     *****
//      *   **   *     *   *
//   ****  ****  ****  *   *


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, k;
    cin >> n >> k;
    long double ans = 0;
    for (int i = 1; i <= n; ++i) {
        long double a = 1.0L/n;
        int j = i, cnt = 0;
        while(j < k) j *= 2, cnt++;
        ans += a*pow(0.5L, cnt);
    }
    cout << setprecision(15) << ans << "\n";
    return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

bool f(char c) { return (c == 'A' || c == 'C' || c == 'G' || c == 'T'); }

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

  string s;
  cin >> s;
  int n = s.size();

  int ans = 0;
  for (int l = 0; l < n; l++) {
    int r = l;
    while (r < n && f(s[r])) {
      r++;
    }
    ans = max(ans, r - l);
  }
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<pair<P, int>> city(m);
    REP(i, m) {
        cin >> city[i].first.first >> city[i].first.second;
        city[i].second = i + 1;
    }
    sort(ALL(city));
    
    vector<PL> ans(m + 1);
    int order = 1;
    int prev_p = city[0].first.first;
    REP(i, m) {
        if(city[i].first.first != prev_p) order = 1;
        ans[city[i].second].first = city[i].first.first;
        ans[city[i].second].second = order;
        order++;
        prev_p = city[i].first.first;
    }

    FOR(i, 1, m) {
        cout << setfill('0') << setw(6) << ans[i].first;
        cout << setfill('0') << setw(6) << ans[i].second << endl;;
    }
    return 0;
}


Measured memory_bytes: 4224
N=int(input())
D,X=map(int,input().split())
A=[]
for i in range(N):
  a=int(input())
  A.append(a)

def solve(a,x):
  res=0
  cnt=0
  while cnt*a+1<=x:
    res+=1
    cnt+=1
  return res

ans=0
for i in range(N):
  ans+=solve(A[i],D)

print(ans+X)

Measured memory_bytes: 3064
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    PrintWriter pw = new PrintWriter(System.out);

    int n = sc.nextInt();

    for (int i = 1; i <= n; i++) {
      if (i % 3 == 0) {
        pw.print(" " + i);
        continue;
      }
      if (String.valueOf(i).contains("3")) {
        pw.print(" " + i);
        continue;
      }
    }
    pw.println();
    pw.flush();
  }
}


Measured memory_bytes: 28332
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)
#define MAX_NM (500000)
using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

Int inv[MAX_NM];
Int Fact[MAX_NM];
Int invFact[MAX_NM];
Int N, M, K;

void init(void) {
    Fact[0] = 1;
    inv[1] = 1;
    invFact[0] = 1;

    for(Int i = 2;i <= 2*M*N;i++) {
        inv[i] = MOD - (MOD / i)*inv[MOD % i] % MOD;
    }

    for(Int i = 1;i <= 2*N*M;i++) {
        Fact[i] = (i*Fact[i-1])%MOD;
        invFact[i] = (inv[i]*invFact[i-1])%MOD;
    }
}

Int comb(int n, int k) {
    if(k < 0 || k > n)
        return 0;
    //cout<<Fact[n]<<" "<<invFact[n-k]<<" "<<invFact[k]<<endl;
    return ((Fact[n]*invFact[n-k]%MOD)*invFact[k])%MOD;
}

int main(void) {
    Int sum = 0;
    cin>>N>>M>>K;

    init();
    Int pattern = comb(N*M-2,K-2);

    for(Int d = 1;d < M;d++) {
        Int ans = ((d*(M-d)%MOD)*N%MOD)*N%MOD;
        sum = (ans + sum) % MOD;
    }
    
    for(Int d = 1;d < N;d++) {
        Int ans = ((d*(N-d) % MOD)*M%MOD)*M%MOD;
        sum = (ans + sum) % MOD;
    }

    cout<<sum*pattern%MOD<<endl;

    return 0;
}


Measured memory_bytes: 11136
<?php
fscanf(STDIN,'%d %d %d',$A,$B,$K);
$max = max($A,$B);
$array = [];
for ($i=1; $i <= $max ; $i++) {
  // code...
  if($A%$i==0 && $B%$i==0){
    $array[] = $i;
  }
}
$arrayREV = array_reverse($array);
echo $arrayREV[$K-1];
 ?>


Measured memory_bytes: 3828
using System;
using static System.Console;
using System.Linq;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] tmp = ReadLine().Split(' ').Select(long.Parse).ToArray();
            long A = tmp[0];
            long B = tmp[1];
            long C = tmp[2];
            long K = tmp[3];

          	if(K <= A)
            {
                WriteLine(K);
            }
            else if(K <= A + B)
            {
                WriteLine(A);
            }
            else
            {
                WriteLine(2 * A + B - K);
            }
        }
    }
}

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

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

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

int main()
{
    int n, a, b;
    cin >> n >> a >> b;
    int ans = 0;
    vector<int> div = {10000, 1000, 100, 10, 1};
    for (int i = 1; i < n + 1; ++i)
    {
        int dsum = 0;
        for (int j = 0; j < div.size(); ++j)
        {
            dsum += (i / div[j]) % 10;
        }
        if (a <= dsum && dsum <= b)
        {
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, M = map(int,input().split())
a = 0
b = 0
A = []
B = []
city = [0]*N
for i in range(M):
    a, b = map(int,input().split())
    A.append(a)
    B.append(b)
for i in range(M):
    city[A[i] - 1] += 1
    city[B[i] - 1] += 1
for i in range(N):
    print(city[i])


Measured memory_bytes: 9124
N = int(input())
AList = [ 0 for i in range(N)]
BList = [int(i) for i in input().split()]
AList[1-1] = BList[1-1]
AList[N-1] = BList[N-1-1]
for k in range(N):
    if 2 <= k and k <= N-1 and BList[k-1-1] <= BList[k-1]:
        AList[k-1] = BList[k-1-1]
    elif 2 <= k and k <= N-1 and BList[k-1-1] > BList[k-1]:
        AList[k-1] = BList[k-1]
print(sum(AList))

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <stack>
#include <numeric>
#include <cassert>
#include<map>
#include<bitset>

using lli = long long int;
lli inf = 1000000007;
using namespace std;

lli rep_pow(lli x, lli n) {
	lli res = 1;
	while (n > 0) {
		if (n & 1) { res = res * x % inf; }
		x = x * x % inf;
		n >>= 1;
	}
	return res;
}

void solve() {
	int n, a, b;
	cin >> n >> a >> b;

	lli all = rep_pow(2, n) - 1;

	// a
	lli A0 = 1, A1 = 1;
	for (lli x = 0; x < a; x++) {
		A0 = A0 * (n - x) % inf;
		A1 = A1 * (x + 1) % inf;
	}
	all = (all - A0 * rep_pow(A1, inf - 2)) % inf;


	// a
	lli B0 = 1, B1 = 1;
	for (lli x = 0; x < b; x++) {
		B0 = B0 * (n - x) % inf;
		B1 = B1 * (x + 1) % inf;
	}
	all = (all - B0 * rep_pow(B1, inf - 2)) % inf;
	all = (all + inf) % inf;

	cout << all << endl;
}

int main()
{
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
string N;
int ans=0,counter=0;
signed main(){
  cin >> N;
  /*for(int i=1;i<=N.size();i++){
    for(int j=0;j<N.size()-i+1;j++){
      for(int k=0;k<i;k++){
        if(N[j+k]=='A' || N[j+k]=='C' || N[j+k]=='G' || N[j+k]=='T') counter++;
        else{
          ans=max(ans,counter);
          counter=0;
          break;
        }
      }
    }
  }*/
  for(int i=0;i<N.size();i++){
    if(N[i]=='A' || N[i]=='C' || N[i]=='G' || N[i]=='T') counter++;
    else{
      ans=max(ans,counter);
      counter=0;
    }
  }
  ans=max(ans,counter);
  counter=0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256