akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
int A[3010],fir[3010],dis[6010],nxt[6010],id;
void link(int a,int b){nxt[++id]=fir[a],fir[a]=id,dis[id]=b;}
bool dfs(int x,int fa=-1){
	for(int i=fir[x];i;i=nxt[i])
		if(fa!=dis[i]&&!dfs(dis[i],x)&&A[dis[i]]<A[x])
			return 1;
	return 0;
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),a,b;
	for(int i=1;i<=n;++i)A[i]=gi();
	for(int i=1;i<n;++i)a=gi(),b=gi(),link(a,b),link(b,a);
	for(int i=1;i<=n;++i)if(dfs(i))printf("%d ",i);
	return 0;
}


Measured memory_bytes: 512
N,Y = list(map(int,input().split()))

for a in range(N+1):
  for b in range(N+1):
    if 10000*a + 5000*b + 1000*(N-a-b) == Y and N-a-b >= 0:
      print("{} {} {}".format(a,b,N-a-b))
      quit()

print("-1 -1 -1")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<string> s(n);
    vector<ll> MARCH(5, 0);
    rep(i, n){
        cin >> s[i];
        if(s[i][0] == 'M')MARCH[0]++;
        if(s[i][0] == 'A')MARCH[1]++;
        if(s[i][0] == 'R')MARCH[2]++;
        if(s[i][0] == 'C')MARCH[3]++;
        if(s[i][0] == 'H')MARCH[4]++;
    }
    ll ans = 0;
    for(int i = 0; i < 5; i++){
        for(int j = i+1; j < 5; j++){
            for(int k = j+1; k < 5; k++){
                ans += MARCH[i]*MARCH[j]*MARCH[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 6144
#include<bits/stdc++.h>
using namespace std;
/**
********************************************************************
******************* Author:Bisnu sarkar ****************************
********************************************************************
**/
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';

int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

int dx[8]= {1,0,-1,0,-1,-1,1,1};
int dy[8]= {0,1,0,-1,-1,1,-1,1};
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

int a[N],b[N];

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

    int t=1,te=0;
    // cin>>t;
    while(t--){
        int n;
        cin>>n;

        for(int i=1;i<=n;++i){
            cin>>a[i];
            a[i]-=1;
        }
        for(int i=1;i<=n;++i){
            cin>>b[i];
            b[i]-=1;
        }

        std::vector<int> v;

        for(int i=0;i<n;++i){
            v.push_back(i);
        }
        int c=1,in1,in2;
        do{
            bool f1=true,f2=true;
            for(int i=0;i<v.size();++i){
                if(a[i+1]!=v[i]){
                    f1=false;
                    break;
                }   
            }
            for(int i=0;i<v.size();++i){
                if(b[i+1]!=v[i]){
                    f2=false;
                    break;
                }   
            }
            if(f1){
                in1=c;
            }
            if(f2){
                in2=c;
            }
            ++c;

        }while(next_permutation(v.begin(),v.end()));

        printf("%d\n", abs(in1-in2));
        //printf("Case %d: ",++te);
    }
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int solve(vi &A, int s) {
  int ans{0};
  vector<bool> V(A.size(), false);
  vi T(10001);
  auto B = A;
  sort(ALL(B));
  REP(i, A.size()) T[B[i]] = i;
  REP(i, A.size()) {
    if (V[i]) continue;
    int cur{i};
    int num{0}, sum{0}, min_{INF};
    while (!V[cur]) {
      V[cur] = true;
      auto w = A[cur];
      ++num;
      sum += w;
      min_ = min(min_, w);
      cur = T[w];
    }
    ans += min(sum + (num - 2) * min_, min_ + sum + (num + 1) * s);
  }
  return ans;
}

int main() {
  int n, s{INF};
  cin >> n;
  vi A(n);
  REP(i, n) {
    cin >> A[i];
    s = min(s, A[i]);
  }
  cout << solve(A, s) << endl;
}


Measured memory_bytes: 3184
#include <iostream>
#include <string>
using namespace std;
int main(){
  string a,b;
  cin >> a;
  cin >> b;
  if(a.size()>b.size()){
    cout << "GREATER" << endl;
  }else if(b.size()>a.size()){
    cout << "LESS" << endl;
  }else{
    if(a<b)cout << "LESS" << endl;
    else if(a>b)cout << "GREATER" << endl;
    else cout << "EQUAL" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
public class Hello {
    public static void Main(){
        // 1行に複数の入力値がある場合の例
        string [] inputs = System.Console.ReadLine().Split(' ');
        int a = int.Parse(inputs[0]);
        int b = int.Parse(inputs[1]);
        int c = (a * b);
        int d = (a + b) * 2;
        System.Console.WriteLine(c + " " + d);
    }
}



Measured memory_bytes: 9056
#include <stdio.h>

char s[200200];
long long p[2019],q[2019],a;

int main()
{
  scanf ("%s",s);
  for (int i=0;s[i];i++){
    for (int j=0;j<2019;j++) p[j] = q[j], q[j] = 0; p[0]++;
    for (int j=0;j<2019;j++) q[(j*10+s[i]-'0')%2019] += p[j];
    a += q[0];
  }
  printf ("%lld\n",a);
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;

#define TT template<typename T>
#define TTF template<typename T, typename F>
#define ET(T) typename T::value_type
TT inline T sq(T x){return x*x;}
TT inline T In(){T x;cin>>x;return x;}
TT inline void Out(T&x){cout<<x;}
TT inline void sort(T&v){sort(begin(v),end(v));}
TT inline void revs(T&v){reverse(begin(v),end(v));}
TT inline void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT inline int ubnd(T&v,ET(T)&x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT inline int lbnd(T&v,ET(T)&x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF inline void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF inline void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
#undef TT
#undef TTF
#undef ET

inline void fast_io(){ios::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}

const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000;


int main()
{
  int dp[512] = {1};
  for (int i = 1; i <= 17; i++){
    int x = sq(i);
    for (int j = 0; j + x < 512; j++){
      if (!dp[j]) continue;
      dp[j + x] += dp[j];
    }
  }
  int n;
  while (n = in()){
    printf("%d\n", dp[n]);
  }

  return (0);
}

// priority_queue queue deque front stringstream max_element min_element insert count make_tuple

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

int main() {
	// your code goes here
	int N;
	cin>>N;
	
	int* t = new int[N];
	int* x = new int[N];
	int* y = new int[N];
	bool ans =true;
	
	for(int i=0;i<N;i++){
		cin>>t[i]>>x[i]>>y[i];
		if(ans){
			int difft= t[i]-t[i-1];
			int dist = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
			
			if(difft<dist){
				ans =false;
			}else if((difft-dist)%2!=0){
				ans =false;
			}
		}
	}
	if(ans){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 1408
import math
A, B = list(map(int, input().split()))

amax = math.ceil((A + 1) / 8 * 100) - 1
amin = math.ceil(A / 8 * 100)
bmax = math.ceil((B + 1) * 10) - 1
bmin = math.ceil(B * 10)

if amin > bmax or bmin > amax:
    print(-1)
else:
    print(int(max(amin, bmin)))


Measured memory_bytes: 3060
import java.util.*;


public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Work> list = new ArrayList<>();
        for(int tmp = 0; tmp < n;tmp++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            Work work = new Work(a,b);
            list.add(work);
        }


        Collections.sort(list, new Comparator<Work>() {
            @Override
            public int compare(Work obj0, Work obj1) {
                if(obj0.time < obj1.time){
                    return -1;
                }else if(obj0.time > obj1.time){
                    return 1;
                }else{
                    return 0;
                }
            }
        });
        boolean result = true;
        long time = 0;
        for(int tmp = 0;tmp < n; tmp++){
            Work work = list.get(tmp);
            time += work.cost;
            if(time > work.time){
                result = false;
                break;
            }
        }

        if(result){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }


    }

    //最大公約数
    static class Work {
        public int cost;
        public int time;

        public Work(int a,int b){
            this.cost = a;
            this.time = b;
        }

    }
}


Measured memory_bytes: 104072
#include <bits/stdc++.h>
using namespace std;
long long X[200000], Y[200000];
int main () {
    int N;
    cin >> N;
    for (int i = 1; i <= N; i++) {
        int A;
        cin >> A;
        if (A+i < N) {
            X[A+i]++;
        }
        if (i-A > 0) {
            Y[i-A]++;
        }
    }
    long long ans = 0;
    for (int i = 0; i < N; i++) {
        ans += X[i]*Y[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 6700
#include<iostream>
#include<limits.h>
#include<queue>
using namespace std;
char cheese[1001][1001];
int dx[4] = {-1,0,0,1};
int dy[4] = {0,1,-1,0};
int H, W, N,sx,sy;
int d[1001][1001]; //各个位置到指定地点最短距&#31163; 
int bfs(int sx, int sy, int ex,int ey){
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			d[i][j] = INT_MAX;
		}
	}
	typedef pair<int, int>P;
	queue<P> que;
	que.push(P(sx,sy));
	d[sx][sy] = 0;
	while(!que.empty()){
		P p = que.front();
		que.pop();
		if(p.first == ex && p.second == ey){
			break;
		}
		for(int i = 0; i < 4; ++i){
			int x = p.first + dx[i], y = p.second + dy[i];
			if(x >= 0 && x <= H && y >= 0 && y < W && cheese[x][y] != 'X' && d[x][y] == INT_MAX){
				que.push(P(x,y));
				d[x][y] = d[p.first][p.second] + 1;
			}
		}
	}
	return d[ex][ey];
}
int main(){
	int result = 0;
	cin >> H >> W >> N;
	for(int i = 0; i < H; ++i){
		for(int j = 0; j < W; ++j){
			cin >> cheese[i][j];
			if(cheese[i][j] == 'S'){
				sx = i;
				sy = j;
			}
		}
	}
	// result += bfs(sx,sy,'1');
	for(int k = 1; k <= N; ++k){
		for(int i = 0; i < H;++i){
			for(int j = 0; j < W; ++j){
				if(cheese[i][j] == ('0' + k) ){
					int ex = i;
					int ey = j;
					result += bfs(sx,sy,ex,ey);
					sx = ex;
					sy = ey;					
				}
			}
		}
	}
	cout << result << endl;
}

Measured memory_bytes: 6108
s = list(input())

n = len(s)
if (n % 2 == 1):
   s.pop(int(n/2))

n = int(len(s)/2)
x = s[:n]
y = s[n:]
y = y[::-1]
print(len([1 for i in range(n) if x[i] != y[i]]))


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

int main(){
  int i,j,A,B;
  cin >> A >> B;
  int ans;
  ans = 0;
  while(A*12.5 > ans || B*10 >ans){
    ans++;
  }
  if( ans<(A+1)*12.5 && ans<(B+1)*10 ) cout << ans;
  else cout << "-1";
  return 0;
}

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

int main() {
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int cntodd = 0;
    rep(i,n){
        if(a[i]%2 == 1){
            cntodd++;
        }
    }
    if(cntodd%2 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <map>
#include <iomanip>

using namespace std;
typedef long long  ll;

int main() {
	ll n, m;
	cin >> n >> m;
	ll ans = 0;
	if (n * 2 >= m) {
		cout << m / 2 << endl;
		return 0;
	}
	ans += n;
	m -= n * 2;
	ans += m / 4;
	cout << ans << endl;
	return 0;
}

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

int mod = 1000000007;
signed main() {
	int a,b,c,d,e;
	cin >> a >> b >> c >> d >> e;
	//vector<int> v(n);
	//for (size_t i = 0; i < n; ++i)
	//{
	//	cin >> v[i];
	//}

	int mx = 10;
	int aa = a % 10;
	int ba = b % 10;
	int ca = c % 10;
	int da = d % 10;
	int ea = e % 10;
	if (min(mx, aa) != 0) mx = min(mx, aa);
	if (min(mx, ba) != 0) mx = min(mx, ba);
	if (min(mx, ca) != 0) mx = min(mx, ca);
	if (min(mx, da) != 0) mx = min(mx, da);
	if (min(mx, ea) != 0) mx = min(mx, ea);

	int sum = 0;
	if(aa == 0) sum += a;
	else sum += ((a / 10) + 1) * 10;
	if (ba == 0) sum += b;
	else sum += ((b / 10) + 1) * 10;
	if (ca == 0) sum += c;
	else sum += ((c / 10) + 1) * 10;
	if (da == 0) sum += d;
	else sum += ((d / 10) + 1) * 10;
	if (ea == 0) sum += e;
	else sum += ((e / 10) + 1) * 10;

	sum += mx;
	sum -= 10;

	cout << sum << endl;

}




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

int main() {
    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    char c1, c2, c3;
    c1 = toupper(s1[0]);
    c2 = toupper(s2[0]);
    c3 = toupper(s3[0]);

    cout << c1 << c2 << c3 << endl;
}

Measured memory_bytes: 256
n=int(input())
def dfs(s):
  if int(s)>n:
    return 0
  if all(s.count(i)>0 for i in '753'):
    ans=1
  else:
    ans=0
  for i in '753':
    ans+=dfs(s+i)
  return ans
print(dfs('0'))


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

int main(){
  int n,r;
  int ans;
  cin >> n >> r;
  if(n >= 10){
    ans = r;
  }else{
    ans = r + 100*(10 - n);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(3 * n);
	for(int i = 0; i < 3 * n; i++) cin >> a[i];
	sort(a.rbegin(), a.rend());
	long long ans = 0;
	for(int j = 0; j < n; j++) ans += a[1 + 2 * j];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
    const int M=1e6;
    using namespace std;
    int f[M];
    struct node
    {
    	int x,y,id;
    }a[M];
    struct edge
    {
    	int u,v,wt;
    	bool operator < (const edge &e) const
    	{
    		return wt<e.wt;
    	}
    }g[M];
    bool cmpx(node a,node b)
    {
    	return a.x<b.x;
    }
    bool cmpy(node a,node b)
    {
    	return a.y<b.y;
    }
    int find(int x)
    {
    	return x==f[x]?x:f[x]=find(f[x]);
    }
    int main() {
    	int n,m=1;
    	long long cst=0;
    	cin>>n;
    	for(int i=1;i<=n;i++)
        {
        	f[i]=i;
        	cin>>a[i].x>>a[i].y;
        	a[i].id=i;
        }
        sort(a+1,a+n+1,cmpx);
        for(int i=2;i<=n;i++) g[m++]=(edge){a[i-1].id,a[i].id,a[i].x-a[i-1].x};
        sort(a+1,a+n+1,cmpy);
        for(int i=2;i<=n;i++) g[m++]=(edge){a[i-1].id,a[i].id,a[i].y-a[i-1].y};
        sort(g+1,g+m);
        for(int i=1;i<m;i++)
        {
        	if(find(g[i].u)!=find(g[i].v))
        	{
        		cst+=g[i].wt;
        		f[f[g[i].u]]=f[g[i].v];
        	}
        }
        cout<<cst<<endl;
    	return 0;
    }

Measured memory_bytes: 10496
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <stack>
#include <sstream>

using namespace std;


//polygon의 중심 좌표를 구한다.
//중심 좌표로부터 

string ntos(long long int n)
{
	stringstream ss;
	ss << n;
	return ss.str();
}
int main(void)
{
	long long int N, K;
	string digit;
	 
	cin >> N >> K;
	for (int i = 0; i < K; i++)
	{
		char temp;
		cin >> temp;
		digit.push_back(temp);
	}

	for (long long int i = N;; i++)
	{
		string s = ntos(i);
		bool flag = true;
		for (int j = 0; j < s.length(); j++)
		{
			for (int k = 0; k < K; k++)
			{
				if (s[j] == digit[k])
				{
					flag = false;
					break;
				}
			}
			if (flag == false)
			{
				break;
			}
		}
		if (flag == true)
		{
			cout << i << endl;
			break;
		}
	}
	return 0;
}

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


int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    int m = max({a,b,c});
    int d =  m;
    rep(i,k) m *= 2;
    cout << a+b+c+m-d << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memset( x, y, sizeof x )
using namespace std;

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

const int MAXN = 300010;

int a[MAXN], n;
LL ans;

int main()
{
#ifdef wxh010910
	freopen( "data.in", "r", stdin );
#endif
	scanf( "%d", &n );
	for( int i = 1 ; i <= 3 * n ; i++ ) scanf( "%d", &a[ i ] );
	sort( a + 1, a + 3 * n + 1 );
	for( int i = 3 * n - 1, j = 1 ; j <= n ; i -= 2, j++ ) ans += a[ i ];
	cout << ans << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <cmath>
#include <string>
#include <utility>
using namespace std;
typedef long long int ll;

int main() {
  int H, N, A[100000];
  int sum = 0;
  cin >> H >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  cout << (sum >= H ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<functional>
#include<bitset>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(int)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b, c;
	cin >> a >> b >> c;
	if(a > max(b, c)) cout << 'A' << endl;
	if(b > max(c, a)) cout << 'B' << endl;
	if(c > max(a, b)) cout << 'C' << endl;
}
/* --------------------------------------- */



Measured memory_bytes: 3128
import fractions
def gcd(a,b):
   f=fractions.gcd(a,b)
   f2=a*b//f
   return f2

a,b,c,d=map(int,input().split())

bc=b//c
bd=b//d
bcd=b//(gcd(c,d))

a=a-1

ac=a//c
ad=a//d
acd=a//(gcd(c,d))

print((b-(bc+bd-bcd))-(a-(ac+ad-acd)))

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

int main() {
	double v, y; int ans;
	while (cin >> v) {
		y = 4.9 * pow((v / 9.8), 2);
		ans = (int)((y + 5) / 5) + 1;
		cout << ans << endl;
	}
	return 0;
}


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


int main(){
    string n;
    cin >> n;
    n.insert(0, 1, '0');
 
    vector<array<ll, 2>> dp(n.size());
    dp.at(0).at(0) = n.at(0) - '0';
    dp.at(0).at(1) = 1 + (n.at(0) - '0');
    for(ll i = 1; i < n.size(); ++i){
        const ll d = n.at(i) - '0';
        dp.at(i).at(0) = min(
            dp.at(i - 1).at(0) + d,
            dp.at(i - 1).at(1) + 10 - d
        );
        dp.at(i).at(1) = min(
            dp.at(i - 1).at(0) + d + 1,
            dp.at(i - 1).at(1) + 9 - d
        );
    }
    cout << dp.at(n.size() - 1).at(0) << endl;
    return 0;
}


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

int main(){
  int n, x;

  while (1) {
    cin >> n >> x;
    if (n == 0 && x == 0) {
      break;
    }

    int i, j, k,
        cnt = 0;
    for(i = 1; i < n + 1; i++){
      for(j = 1; j < n + 1; j++){
        for(k = 1; k < n + 1; k++){
          if (i == j || j == k || i == k) {
            continue;
          }
          if (i + j + k == x) {
            cnt++;
          }
        }
      }
    }
    cout << cnt / 6 << endl;
  }
}



Measured memory_bytes: 3096
//
// Created by yamunaku on 2019/12/20.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    // CFS;
    int n, m;
    cin >> n >> m;

    vector<vector<int>> eList(n); // 隣接リスト
    vector<vector<int>> rList(n); // 隣接リスト
    vector<int> inDeg(n, 0); // 入次数
    int u, v;
    for(int i = 0; i < n - 1 + m; i++){
        cin >> u >> v;
        u--, v--;
        eList[u].push_back(v);
        rList[v].push_back(u);
        inDeg[v]++;
    }

    queue<int> zeroQue; // 入次数 0 の頂点でまだ取られていないものを入れる
    for(int i = 0; i < n; i++){
        if(inDeg[i] == 0) zeroQue.push(i);
    }

    vector<int> result; // トポロジカルソートの結果を入れる
    while(!zeroQue.empty()){
        int u = zeroQue.front(); // 入次数 0 の頂点 u を 1 つ取る
        zeroQue.pop();

        result.push_back(u);
        for(int v:eList[u]){ // u を始点とする辺すべてについて、
            inDeg[v]--; // 終点の入次数を減らす
            if(inDeg[v] == 0) zeroQue.push(v); // 入次数が 0 になったら取ることができる
        }
    }

    vi ans(n);
    vi depth(n);
    ans[result[0]] = depth[result[0]] = 0;
    repl(i, 1, n){
        int ma = -1, idx = -1;
        for(auto &nx:rList[result[i]]){
            if(ma < depth[nx]){
                ma = depth[nx];
                idx = nx;
            }
        }
        ans[result[i]] = idx + 1;
        depth[result[i]] = i;
    }
    rep(i, n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13436
#include <cmath>
#include <cstdio>
#include <vector>
#include <iterator>
#include <iostream>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <stdio.h>
#include <functional>
#include <chrono>
using namespace std;

#define rep(i,s,n) for(ll i=s;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

using vl = vector<ll>;
using vvl = vector<vector<ll>>;

template<class T>
vector<vector<T>> vvt(T init, ll m, ll n) {
	vector<vector<T>> ans = vector<vector<T>>(m, vector<T>(n, init));
	return move(ans);
}

template<class T>
vector<T> vt(T init,ll n) {
	vector<T> ans = vector<T>(n, init);
	return move(ans);
}

template<class T>
T maxVec(vector<T> &v) {
	T ans = -INF;
	rep(i,0, v.size()) {
		ans = max(ans, v[i]);
	}
	return ans;
}

// 素数判定
bool judge(ll n) {
	for (ll i = 2; i * i <= n; i++) if (n %= i)return false;
	return true;
}


template <class C>
void print(const C& c, std::ostream& os = std::cout)
{
	std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, ", "));
	os << std::endl;
}
/*
ll count(ll n,ll r) {
	ll ans = 0,check = 1;
	rep(i,0, r) {
		if ((n & check) > 0) {
			ans++;
		}
		check = check << 1;
	}
	return ans;
}
*/
bool sortreverse(ll a, ll b) {
	return a > b;
}

bool kansu(pll a, pll b) {
	return a.first < b.first;
}

ll kiriage(ll a, ll b) {
	if (a % b == 0)return a / b;
	return a / b + 1;
}

ll n,m,x,y;
vl a, b;


int main() {
	cin >> n;
	ll ans = 0;
	if (n % 2 == 1) {
		printf("%d", 0);
		exit(0);
	}
	for (ll i = 5; i < 1000000000000000001; i *= 5) {
		ans += (n / 2) / i;
	}
	printf("%lld\n", ans);
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define umax(m, x) (m = max(m, x));
#define umin(m, x) (m = min(m, x));

#define rng(v) v.begin(), v.end()
#define rrng(v) v.rbegin(), v.rend()

#define debug(x) cerr << #x << " = " << x << endl

using namespace std;

using ll = long long int;

using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;

using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;

const int INF = 1e9;
const ll LINF = 1e18;

inline void yn(bool f) { cout << (f ? "Yes" : "No") << endl; }


int main() {
    ll x;
    cin >> x;

    vl a(4000), b(4000);
    rep(i, 4000) {
        ll t = (ll)i - 2000;
        a[i] = t * t * t * t * t;
        b[i] = t * t * t * t * t;
    }

    rep(i, 4000) {
        ll ti = (ll)i - 2000;

        rep(j, 4000) {
            ll tj = (ll)j - 2000;

            if (a[i] - b[j] == x) {
                cout << ti << " " << tj << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3692
from __future__ import print_function
import numpy as np
import sys

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

n=int(input())
S=list(input())
array0=np.zeros(n,dtype=int)
array1=np.zeros(n,dtype=int)
array2=np.zeros(n,dtype=int)

array0[0]= 1 if S[0]=='#' else 0
for i in range(1,n):
    array0[i]= array0[i-1]+1 if S[i]=='#' else array0[i-1]


array1[n-1]= 1 if S[n-1]=='.' else 0
for i in range(n-2,-1,-1):
    array1[i]= array1[i+1]+1 if S[i]=='.' else array1[i+1]
    
for i in range(0,n):
    array2[i]=array0[i]+array1[i]
eprint(array0)
eprint(array1)
eprint(array2)
    
print(min(array2)-1)
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#


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

int main(){
  int N,x; cin>>N>>x;
  int a[100],ans=0;
  for(int i=0;i<N;i++){
    cin>>a[i];
  }
  sort(a,a+N);
  for(int j=0;j<N;j++){
    if(j==N-1 && a[j]<x){
      break;
    }
    if(a[j]<=x){
      x-=a[j];
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


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


int main() {
  int a1,a2,a3; cin >> a1 >> a2 >> a3;
  cout << a3 << ' ' << a1 << ' ' << a2 << endl;

  return 0;

}

Measured memory_bytes: 256
n = int(input())
ryuka = [0] * (n+1)

for i in range(n+1):
    if i==0:
        ryuka[i] = 2
    elif i==1:
        ryuka[i] = 1
    else:
        ryuka[i] = ryuka[i-2] + ryuka[i-1]

print(ryuka[-1])

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

long long n, ans, mod = 1e9+7;

long long power(long long mul, long long cnt){
    long long ret = 1;
    while (cnt){
        if (cnt&1){
            ret *= mul;
            ret %= mod;
        }
        mul *= mul;
        mul %= mod;
        cnt >>= 1;
    }
    return ret;
}

int main() {
    cin >> n;
    ans = power(10, n);
    ans -= power(9, n)*2;
    ans += power(8, n);
    ans %= mod;
    ans += mod;
    ans %= mod;
    cout << ans << "\n";
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)



int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    ull k;
    cin >> k;
    string s = to_string(k);

    int sz = SZ(s);
    // ull p = 0;
    // ull ans = 0;
    // FORD(i, sz - 1, 0) {
    //     string pre = s.substr(0, i);
    //     // string post = s.substr(i);
    //     int a = stoi(pre);
    //     ans += a * pow(2, sz - i - 1) + ;

    // }

    ull ans = 0;
    for (int i = 0; i < 1 << (sz - 1); i++) {
        VI vec;
        vec.pb(0);
        for (int j = 0; j < sz + 2; j++) {
            if (i & 1 << j) {
                vec.pb(j + 1);
            }
        }
        vec.pb(100);
        ull a = 0;
        for (int j = 0; j < SZ(vec) - 1; j++) {
            string ss = s.substr(vec[j], vec[j+1] - vec[j]);
            if (ss != "") a += (ull) stoull(ss);
        }
        ans += a;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
int ABS(int a) {if(a<0) a = -a; return a;}
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数の個数*/int divisor_number(int n){auto p = prime_factor(n); int res = 1; for(auto x:p)res*=(x.second+1); return res;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int a,b; cin >> a >> b;
    if(a<=b){out(a);}
    else out(a-1);

    return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <queue>

using T = tuple<ll, int, int>;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int h, w;
    cin, h, w;
    int sx, sy, gx, gy;
    cin, sy, sx, gy, gx;
    sx--;
    sy--;
    gx--;
    gy--;
    auto mp = make_v(h, w, '#');
    REP(i, 0, h) {
        REP(j, 0, w) {
            cin, mp[i][j];
        }
    }

    priority_queue<T, vector<T>, greater<T>> q;
    q.emplace(0, sx, sy);
    const int inf = 1 << 29;
    auto cost = make_v(h, w, inf);
    int ans = -1;
    while (q.size()) {
        auto [c, x, y] = q.top();
        q.pop();
        if (x == gx && y == gy) {
            ans = c;
            break;
        }
        if (cost[y][x] < c) continue;
        cost[y][x] = c;
        REP(dx, -2, 3) {
            REP(dy, -2, 3) {
                if (dx == 0 && dy == 0) continue;
                int nc = 1;
                if (dx * dy == 0 && abs(dx + dy) == 1) {
                    nc = 0;
                }
                int nx = x + dx;
                int ny = y + dy;
                if (0 <= nx && nx < w && 0 <= ny && ny < h && mp[ny][nx] == '.' && cost[ny][nx] > c + nc) {
                    cost[ny][nx] = c + nc;
                    q.emplace(c + nc, nx, ny);
                }
            }
        }
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 8488
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def gcd(a,b):
    while b>0:a,b=b,a%b
    return a

def main():
    n=int(input())
    aa=LI()
    gl=[0]*n
    gr=[0]*n
    g=aa[0]
    for i,a in enumerate(aa):
        g=gcd(g,a)
        gl[i]=g
    g=aa[-1]
    for i,a in enumerate(aa[::-1]):
        g=gcd(g,a)
        gr[n-1-i]=g
    ans=max(gl[n-2],gr[1])
    for i in range(1,n-1):
        g=gcd(gl[i-1],gr[i+1])
        if g>ans:ans=g
    print(ans)

main()

Measured memory_bytes: 14488
import java.util.*;
public class Main {


    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] ruiseki = new long[N+1];


        Map<Long,Integer> m = new HashMap<>();
        m.put(0L,1);
        for (int i = 0; i < N ; i++) {
            int num = sc.nextInt();
            ruiseki[i+1] = ruiseki[i]+num;
            if(!m.containsKey(ruiseki[i+1])){
                m.put(ruiseki[i+1],1);
            }else{
                m.put(ruiseki[i+1],m.get(ruiseki[i+1])+1);
            }
        }
        long ans = 0;
        for (Map.Entry<Long,Integer> e : m.entrySet()) {
            long n  = (long) e.getValue();
            if(n>1)
            ans += n *(n-1) /2;
        }


        System.out.println(ans);

    }
}

Measured memory_bytes: 73136
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
const int maxx=1e3+10; 
int n; 
int num[maxx];
int ju(int x,int y,int z){
	if(x+y>z)return 1;
	else return 0;
}
int main(){
	scanf("%d",&n);
	rep(i,0,n){
		scanf("%d",&num[i]); 
	}
	sort(num,num+n);
	int ans=0;
	rep(i,0,n){
		rep(j,i+1,n){
			if(num[i]==num[j])continue;
			else{
				rep(k,j+1,n){
					if(num[i]!=num[j]&&num[i]!=num[k]&&num[j]!=num[k]){
						if( ju(num[i],num[j],num[k]) ){
							ans++;
						}
					}
				}
			}
		}
	}
	cout<<ans;
} 

Measured memory_bytes: 3740
import java.util.*;
import java.lang.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        int C = Integer.parseInt(sc.next());


        if(C>=A&&C<=B)System.out.print("Yes");
        else System.out.print("No");


        System.out.println();
    }

}

Measured memory_bytes: 21716
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <bitset>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define INF 1200000000
#define LLINF 1100000000000000000
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

string pats[] = {
  "KIHBR",
  "KIHBRA",
  "KIHBAR",
  "KIHBARA",
  "KIHABR",
  "KIHABRA",
  "KIHABAR",
  "KIHABARA",
  "AKIHBR",
  "AKIHBRA",
  "AKIHBAR",
  "AKIHBARA",
  "AKIHABR",
  "AKIHABRA",
  "AKIHABAR",
  "AKIHABARA",
};

int main()
{
  string S;
  cin >> S;
  for (auto& T : pats) {
    if (S == T) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdlib.h>
#define A 1001
int main(){
  int n,a[A],i,j,x,v;
  scanf("%d",&n);
  if(n>101 || n<0)exit(1);
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }
  for(i=1;i<=n;i++){
    v=a[i];
    j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
    for(x=1;x<=n;x++){
      if(x!=n){printf("%d ",a[x]);}
      else printf("%d",a[x]);
    }
    printf("\n");
  }
  
  
  return 0;
}
  


Measured memory_bytes: 2048
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
	static String a;
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int count = 0;
		IN:for(int i = 0; i < n; i++) {
			int x = stdIn.nextInt();
			for(int j = 2; j*j <= x; j++) {
				if(x % j == 0) continue IN;
			}
			count++;
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 31108
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.12.29 19:57:37
 */

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

// ===================### 素数取得 ###=================== //
bool primeDp[1000000000];
vector<int> getPrimes(int n) {
    int u = n + 32;
    double lu = log(u);
    vector<int> ret((int)(u / lu + u / lu / lu * 1.5));

    for (int i = 2; i <= n; i++)
        primeDp[i] = true;
    int sqn = sqrt(n);
    for (int i = 2; i <= sqn; i++) {
        if (!primeDp[i])
            continue;
        for (int j = i * i; j <= n; j += i)
            primeDp[j] = false;
    }
    int idx = 0;
    for (int i = 2; i <= n; i++) {
        if (primeDp[i]) {
            ret[idx] = i;
            idx++;
        }
    }
    return vector<int>(ret.begin(), ret.begin() + idx);
}

int main() {
    vector<int> primes = getPrimes(1000000);
    int x;
    scanf("%d", &x);

    auto iter = lb(primes, x);

    printf("%d\n", *iter);

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define RS(x) rsort(x.begin(),x,end()))
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
typedef long double ld;
signed main(){
int a,b,c,d;
cin >> a >> b >> c >> d;
REP(i,100){
    c-=b;
    if(c<=0){
        cout << "Yes";
    return 0;
    }
    a-=d;
    if(a<=0){
        cout << "No";
    return 0;
    }
}
}

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

int main()
{
    int N, L;
    cin >> N >> L;
    int ans = (L - 1) * N + (N+1) * N /2;

    int m = abs(L), index=0;
    for (int i = 0; i < N; i++)
        if (m > abs(L + i))
            m = abs(L + i), index = i;
    // cout << m << ' ' << index << ' ' << L - index << ' ' << ans << endl;
    ans -= L + index;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import bisect
X,Y,A,B,C=map(int,input().split())

AList=list(map(int,input().split()))
BList=list(map(int,input().split()))
CList=list(map(int,input().split()))

AList.sort(reverse=True)
BList.sort(reverse=True)
CList.sort(reverse=True)

alist = AList[0:X] + BList[0:Y] + CList
alist.sort(reverse=True)

print(int(sum(alist[:X+Y])))

Measured memory_bytes: 22720
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long H, W;
    scan(H, W);
    long N = lread();
    auto A = aryread();
    long[] ans;
    foreach (i, a; A)
    {
        ans ~= repeat(i + 1).take(a).array();
    }
    foreach (h; 0 .. H)
    {
        if (h & 1)
        {
            arywrite(ans[h * W .. (h + 1) * W].reverse().array());
        }
        else
        {
            arywrite(ans[h * W .. (h + 1) * W]);
        }
    }
}


Measured memory_bytes: 4424
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int counter = scanner.nextInt();
        final int[] mountains = new int[counter];

        for (int i = 0; i < counter; i++) {
            mountains[i] = scanner.nextInt();
        }

        int res = 1;
        for (int i = 1; i < counter; i++) {
            boolean ok = true;
            for (int j = 0; j < i; j++) {
                if (mountains[i] < mountains[j]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                res++;
            }
        }
        System.out.println(res);
    }
}


Measured memory_bytes: 21716
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int count = 0;
        for (int i = a; i <= b; i++) {
            if (c % i == 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 26404
#include <cstring>
#include <iostream>
#include <string>

const int MOD = 1e9 + 7;

using namespace std;

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

    long long dp[S.size() + 5][4];

    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    for (int i = 0; i < S.size(); i++) {
        for (int j = 0; j < 4; j++) {
            if (S[i] == '?')
                dp[i + 1][j] += (dp[i][j] * 3LL) % MOD;
            else
                dp[i + 1][j] += dp[i][j];
        }

        if (S[i] == 'A' || S[i] == '?') dp[i + 1][1] += dp[i][0] % MOD;
        if (S[i] == 'B' || S[i] == '?') dp[i + 1][2] += dp[i][1] % MOD;
        if (S[i] == 'C' || S[i] == '?') dp[i + 1][3] += dp[i][2] % MOD;
    }

    cout << dp[S.size()][3] % MOD << endl;
}

Measured memory_bytes: 3712