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

#define debug(x) cout << #x << ": " << (x) << endl

class UFT {
  int *par;
  int *rank;

public:

  UFT(const size_t N): par(new int [N]), rank(new int [N]) {
    std::iota(par, par + N, 0);
    std::fill(rank, rank + N, 0);
  }

  ~UFT() { delete [] par; delete [] rank; }

  int find(int x) { return par[x] == x ? x : par[x] = find(par[x]); }
  bool same(int x, int y) { return find(x) == find(y); }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rank[x] < rank[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if (rank[x] == rank[y])
        ++rank[x];
    }
  }

};

int main(int argc, char *argv[]) {
  int N, K, L;
  cin >> N >> K >> L;
  UFT ufroad(N + 1);
  UFT ufrail(N + 1);

  for (int i = 0; i < K; ++i) {
    int p, q;
    cin >> p >> q;
    ufroad.unite(p, q);
  }

  for (int i = 0; i < L; ++i) {
    int r, s;
    cin >> r >> s;
    ufrail.unite(r, s);
  }

  map<pair<int, int>, int> cnts;
  for (int i = 1; i < N + 1; ++i) {
    ++cnts[make_pair(ufroad.find(i), ufrail.find(i))];
  }

  for (int i = 1; i < N + 1; ++i) {
    cout << cnts[make_pair(ufroad.find(i), ufrail.find(i))]
         << (i == N ? "\n" : " ");
  }

  return 0;
}


Measured memory_bytes: 15104
#include <iostream>

using namespace std;


int main(){

	int n, ans;


	while(cin>>n){

		ans = 0;

		for(int a=0; a<=9; a++){

			for(int b=0; b<=9; b++){

				for(int c=0; c<=9; c++){

					for(int d=0; d<=9; d++){

						if(n == a+b+c+d)ans++;

					}

				}

			}

		}

		cout<<ans<<endl;

	}

	return 0;

}

Measured memory_bytes: 1160
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = 1;
        int x;
 
        while (true) {
 
            x = sc.nextInt();
            if (x == 0) {
                break;
            }
            System.out.println("Case " + i + ": " + x);
            i++;
        }
    }
}


Measured memory_bytes: 42484
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<iostream>
#include<algorithm>//next_permutation
#include<complex>
#include<math.h>
#include<sstream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep2(i, j, n) for (int i = j; i < (int)(n); i++)
using ll = long long int;
int main() {
	int N;
	cin >> N;
	N %= 10;
	if (N == 2 || N == 4 || N == 5 || N == 7 || N == 9) {
		cout << "hon" << endl;
		return 0;
	}
	if (N == 0 || N == 1 || N == 6 || N == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "bon" << endl;
	}
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] A = new int[N];
		int[] ans = new int[N];
		
		A[0] = N;
		for(int i = 1; i < N; i++) {
			A[i] = scan.nextInt();
		}
		
		for(int i = 0; i < N; i++) {
			if(A[i] != N) {
				ans[A[i]-1]++;
			}
		}
		
		
		for(int i = 0; i < N; i++) {
			System.out.println(ans[i]);
		}
	}

}


Measured memory_bytes: 61824
#include <iostream>
#include <queue>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	int a[n];
	rep(i, n) scanf("%d", &a[i]);
	int num = min(n, k);
	int ans = 0;
	rep(i, num + 1) {
		rep(j, num - i + 1) {
			priority_queue<int, vector<int>, greater<int>> que;
			rep(l, i) que.push(a[l]);
			rep(l, j) que.push(a[n - 1 - l]);
			rep(l, k - i - j) {
				if (que.empty()) break;
				if (que.top() < 0)
					que.pop();
				else
					break;
			}
			int now = 0;
			while (!que.empty()) {
				now += que.top();
				que.pop();
			}
			ans = max(ans, now);
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
    int n, a;
    int bitsum = 0;
    int count = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        bitsum |= a;
    }
    while (bitsum % 2 == 0)
    {
        count++;
        bitsum /= 2;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import std.stdio;
import std.regex;

void main(){
	auto io = new IO();
	
	auto N = io.line()[0];
	auto A = io.line(N);
	
	size_t paired = 0;
	size_t surplus = 0;
	
	foreach( i,a ; A ){
		if( surplus == 1 ){
			paired += (a+1)/2;
			surplus = ( (a+1)/2 ) ? (a+1)%2 : 0 ;
		}else{
			paired += a/2;
			surplus = a%2;
		}
		//writeln( i,",",a,":",paired,"  ",surplus );
	}
	paired.writeln();
	
	return;
}

import std.stdio,std.conv,std.string;
import std.algorithm,std.array,std.math;

class IO
{
	T[] line( T = size_t , string token = " " )( size_t m = 1 ){
		T[] arr = [];
		foreach( i ; 0..m ){
			arr ~= this.read!T();
		}
		return arr;
	}
	T[][] rect( T = size_t , string token = " " )( size_t m = 1 ){
		T[][] arr = new T[][](m);
		foreach( i ; 0..m ){
			arr[i] = this.read!T(token);
		}
		return arr;
	}
	private T[] read( T = size_t )( string token = " " ){
		T[] arr;
		foreach( elm ; readln().chomp().split(token) ){
			arr ~= elm.to!T();
		}
		return arr;
	}
}

// T -> T[]
pure T[] step( T = size_t )( in T begin , in T end , in T step = 1 ){
	T[] ret;
	for( T i = begin ; i < end ; i += step ){
		ret ~= i;
	}
	return ret;
}
unittest{
	assert( step(0,10,2) == [0,2,4,6,8] );
}

// T[] -> T[]
pure T[] fill( T )( T[] args , in T filling ){
	foreach( ref arg ; args ){
		arg = filling;
	}
	return args;
}
T[] map( T )( T[] args , T function(T) f ){
	foreach( ref arg ; args ){
		arg = f(arg);
	}
	return args;
}
unittest{
	assert( [true,false,true,false].fill(true) == [true,true,true,true] );
	assert( [1,-2,3,-4].map!int(x=>x*2) == [2,-4,6,-8] );
}
// T[] -> number
pure T sum( T )( in T[] args ){
	T ret = 0;
	foreach( i ; 0..args.length ){
		ret += args[i];
	}
	return ret;
}
pure T ave(T)( in T[] args ){
	return args.sum()/args.length;
}
pure real multi( in real[] args ){
	real ret = 1.0;
	foreach( i ; 0..args.length ){
		ret *= args[i];
	}
	return ret;
}

// T[] -> bool
pure bool any( T )( in T[] args , in T target ){
	foreach( arg ; args ){
		if( arg == target ){return true;}
	}
	return false;
}
pure bool all( T )( in T[] args , in T cond ){
	foreach( arg ; args ){
		if( arg != cond ){return false;}
	}
	return true;
}
pure bool have( T )( in T[] args , in T[] target ... ){
	bool[] found = new bool[](target.length);
	foreach( arg ; args ){
		foreach( i,t ; target ){
			if( arg == t ){
				found[i] = true;
			}
		}
	}
	foreach( f ; found ){
		if( f == false ){return false;}
	}
	return true;
}


unittest{
	assert( [1,2,3,4,5].sum() == 15 );
	assert( [1,2,3,4,5].ave() == 3 );
	assert( cmp( [0.3,0.3].multi() , 0.09 ) , "multi() test failed" );
	assert( cmp( [0.3,0.3,0.3].multi() , 0.027 ) , "multi() test failed" );
	
	assert( [1,1,1].all(1) == true );
	assert( [1,1,2].all(1) == false );
	assert( [1,1,2].any(2) == true );
	assert( [1,1,2].any(3) == false );
	
	assert( [1,2,3,4,5].have([1,3,5]) == true );
	assert( [1,2,3,4,5].have([1,3,5,7]) == false );
}

Measured memory_bytes: 2044
#include<iostream>
#include<cmath>
#include<cstdio>

using namespace std;
static double EPS = 1.0e-10;

bool is_zero(const double x){ return abs(x)<EPS; }
double get_area(const double& t){ return sin(t*M_PI/180.0)/2; }

double solve(const int& n){
  double ans=0;
  double t, t_=360;
  for(int i=0; i<n-1; ++i){
    cin >> t;
    t_-=t;
    ans+=get_area(t);
  }
  ans+=get_area(t_);
  return ans;
}

int main(){
  int n, m;
  while(cin >> n && n){
    double a=solve(n);
    cin >> m;
    double b=solve(m);
    if(is_zero(a-b)) printf("0\n");
    else if(a>b) printf("1\n");
    else printf("2\n");
  }
  return 0;
}

Measured memory_bytes: 1220
S = input()
#S = "BWBWBW"
#S = "BBW"

Ws = [x == "W" for x in S]

nB = sum(Ws)
ans = 0
for n,x in enumerate(Ws):
	if x:
		ans += n
ans -= nB*(nB-1)//2
print(ans)



Measured memory_bytes: 5096
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace  std;
int main()
{
    int a,b;
    cin >> a ;
    map<int,int>::iterator it;
    map<int,int> mapa;
    for (int i=0;i<a;i++){
        cin >> b;
        it = mapa.find(b);
        if (it != mapa.end())
            mapa[b]++;
        else mapa.insert (std::pair<int,int>(b, 1) );
    }
    int removidas=0;
    for (it = mapa.begin(); it != mapa.end(); ++it) {
        if (it->first>it->second) removidas+=it->second;
        else if (it->first<it->second) removidas+=(it->second-it->first);
    }
    cout << removidas;

}

Measured memory_bytes: 4736
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define MAXN 200001

using namespace std;
int n,a[MAXN],b[MAXN],l[MAXN],r[MAXN];
LL ans=0;
queue <int> q;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&b[i]);
        l[i]=i-1;
        r[i]=i+1;
    }
    l[1]=n;
    r[n]=1;
    for(int i=1;i<=n;i++)
    {
        if(b[i]>b[l[i]]&&b[i]>b[r[i]])q.push(i);
    }
    while(!q.empty())
    {
        int u=q.front();
        q.pop();
        if(b[u]==a[u])continue;
        int v=b[l[u]]+b[r[u]];
        int cnt=(b[u]-max(b[l[u]],b[r[u]]))/v+1;
        if((b[u]-a[u])%v==0)cnt=(b[u]-a[u])/v;
        b[u]-=cnt*v;
        ans+=cnt;
        if(b[u]<a[u])
        {
            cout<<-1<<endl;
            return 0;
        }
        if(b[l[u]]>b[u]&&b[l[u]]>b[l[l[u]]])q.push(l[u]);
        if(b[r[u]]>b[u]&&b[r[u]]>b[r[r[u]]])q.push(r[u]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3840
// AOJ 0514
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define rep(i,a) for(int i=0;i<(a);++i)
#define all(a) (a).begin(), (a).end()
#define clr(a,v) memset((a),(v),sizeof(a))

struct dat
{
	int i, j, k, r;

	dat( int i, int j, int k, int r )
	:	i(i), j(j), k(k), r(r)
	{}

	bool operator < ( const dat &d ) const
	{ return r > d.r; }
};

int a, b, c;
int N;
short f[300];
std::vector<dat> ds;

int main()
{
	while( scanf( "%d%d%d", &a, &b, &c ), a|b|c )
	{
		ds.clear();
		clr( f, 0 );

		scanf( "%d", &N );
		rep( t, N )
		{
			int i, j, k, r;
			scanf( "%d%d%d%d", &i, &j, &k, &r );
			--i; --j; --k;
			ds.push_back( dat( i, j, k, r ) );
		}

		std::sort( all(ds) );

		rep( t, N )
		{
			int &i = ds[t].i, &j = ds[t].j, &k = ds[t].k, &r = ds[t].r;

			if( r )
				f[i] = f[j] = f[k] = 1;
			else if( f[i]+f[j]+f[k] == 2 )
				(!f[i]?f[i]:!f[j]?f[j]:f[k]) = -1;
		}

		rep( i, a+b+c )
			printf( "%d\n", !~f[i]?0:f[i]>0?1:2 );
	}

	return 0;
}

Measured memory_bytes: 1068
import java.math.BigDecimal;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String str = sc.nextLine();
		long b = 0;
		long ans = 1;
		long  c = (long)Math.pow(10, 18);
		for (int i=0; i<n; i++) {
			b = sc.nextLong();
			if (b == 0) {
				ans = 0;
				break;
			}
			long ans2 = Long.MAX_VALUE;
			if(new BigDecimal(ans).multiply(new BigDecimal(b)).compareTo(new BigDecimal(ans2)) == -1) {
				ans *= b ;
			} else {
				ans = ans2;
			}
			if (ans > c || ans < 0) {
				ans = -1;
			}
		}
		sc.close();

		System.out.println(ans);
	}
}




Measured memory_bytes: 48844
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N = int(input())
A = list(map(int, input().split()))

tot = 0

mx = A[0]
for a in A:
    if a < mx:
        tot += mx - a
    mx = max(mx, a)
print(tot)


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

int n, pos;
vector<int> pre, in, post;

void rec(int l, int r){
	if(l >= 0) return;
	int root = pre[pos++];
	int m = distance(in.begin(), find(in.begin(), in.end(), root));
	
}

void solve(){
	pos = 0;
	rec(0, pre.size());
	for (int  i = 0; i < n; i++)
	{
		if(i) cout << " ";
		cout << post[i];
	}
	cout << endl;
}

int main(){
	int n; cin >> n;
	vector<int> x(n);
	int MAX = -1;
	rep(i, n) {
		cin >> x[i];
		MAX = max(MAX, x[i]);
	}
	int cnt = 1;
	ll tmp, ans = 1e9;
	while (cnt <= MAX)
	{
		tmp = 0;
		rep(i, n){
			tmp += pow((x[i]-cnt), 2);
		}
		ans = min(ans, tmp);
		cnt++;
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ff first
#define ss second
#define len(x) (int)(x.size())
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ii = pair<int, int>;

int main(){
	ios::sync_with_stdio(0);
	string st;
	cin >> st;
	int n = len(st);
	int i =0;
	vector<ii> vs;
	vector<int> idx;
	while(i<n){
		int l = 0, r=0;
		while(i<n and st[i]=='R') ++r, ++i;
		idx.push_back(i-1);
		while(i<n and st[i]=='L') ++l, ++i;
		vs.push_back({r, l});
	}
	vector<int> ans(n, 0);
	n = len(vs);
	for(int i=0; i<n; ++i){
		int res = vs[i].ff-vs[i].ss;
		int x = (vs[i].ff+vs[i].ss)/2;
		int y = x;
		if(abs(res)%2==1){
			if(res>0){ 
				if(vs[i].ff%2==0)
					++y;
				else
					++x;
			}
			else{
				if(vs[i].ss%2==0)
					++x;
				else
					++y;
			}
		}
		ans[idx[i]] = x;	
		ans[idx[i]+1] = y;	
	}
	n = len(ans);
	for(int i=0; i<n; ++i)
		cout << ans[i] << ( i == n-1 ? '\n' : ' ' ); 
}


Measured memory_bytes: 1736
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
typedef long double ld;
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
//ll tree[4 * nax];
//9uS-22RSwk7gQqh

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


Measured memory_bytes: 256
#include<stdio.h>

#define MAX 250

int main(){
  int H,i,A[MAX+1];

  scanf("%d",&H);
  for(i=1 ; i<=H ; i++){
    scanf("%d",&A[i]);
  }

  for(i=1 ; i<=H ; i++)
  {
    printf("node %d: key = %d, ",i,A[i]);

    if(i/2 >= 1) printf("parent key = %d, ",A[i/2]);
    if(2*i <= H) printf("left key = %d, ",A[2*i]);
    if(2*i+1 <= H) printf("right key = %d, ",A[2*i+1]);

    printf("\n");
  }
  return 0;
}



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

int main()
{
    string s;
    cin >> s;
    short ans = 0;
    short len = s.length();
    for (short i = 0; i < len / 2; i++)
    {
        if (s[i] != s[len - i - 1]) ans++;
    }
    cout << ans;
}

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

int main() {

    int x;
    cin >> x;

    if (x == 7 || x == 5 || x == 3) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define int long long
 
// loop
#define FOR(i, a, b) for (int i = (a); i < (b); i++) 	// a ~ b-1	(ascending)
#define REP(i, n) FOR(i, 0, n)							// 0 ~ n-1
#define NREP(i, n) FOR(i, 1, n + 1)						// 1 ~ n
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)	// a ~ b	(descending)
#define RREP(i, n) RFOR(i, n, 0)						// n ~ 0
#define RNREP(i, n) RFOR(i, n, 1)						// n ~ 1
 
// container operation
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); i++)
#define ASORT(c) std::sort((c).begin(), (c).end())
#define DSORT(c) std::sort((c).begin(), (c).end(), std::greater<typeof((c).front())>())
#define SIZE(x) ((int)(x).size())
 
// debug
#define check(x) std::cout << #x << " = " << x << '\n'
 
// print
#define cout(x) std::cout << x << '\n'
 
// typedef
typedef std::vector<int> VI;
typedef std::vector<VI> VII;
typedef std::vector<bool> VB;
typedef std::vector<VB> VBB;
typedef std::vector<std::string> VS;

std::string yes = "Yes\n";
std::string no = "No\n";

void solve();

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

// typical unbounded knapsack (repetition of items allowed)
// See also: https://docs.google.com/spreadsheets/d/1C8roTg1X77F8Jv87tBHH2qjVfzUie8S5nsT6jfxyvz4/edit?usp=sharing
void solve() {
  int h, n;
  std::cin >> h >> n;

  // dp[i][j] := (the minimum cost needed to achieve j damage using 0~ith magic)
  int inf = 1000000000;
  VII dp(n+1, VI(h+1, inf));
  dp.at(0).at(0) = 0;

  int a, b;
  REP(i, n) {
    std::cin >> a >> b;
    dp.at(i+1).at(0) = 0;
    REP(j, h+1) {
      // The following is not correct:
      //   if (j-a >= 0) {
      //     dp[i+1][j] = min(dp[i+1][j], dp[i][j], dp[i+1][j-a]);
      //   } else {
      //     dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
      //   }
      // because this restricts the total damage to be exactly equal to h

      int nj = std::min(j+a, h);
      dp.at(i+1).at(j) = std::min(dp.at(i).at(j), dp.at(i+1).at(j));
      dp.at(i+1).at(nj) = std::min(dp.at(i+1).at(nj), dp.at(i+1).at(j)+b);
      // The following is a mistake:
      // // Note that
      // //   min(dp[i][nj], dp[i+1][j]+b)
      // // is not enough,
      // // as the same value may appear in nj and in such a case
      // // new dp[i+1][nj] may be greater than old dp[i+1][nj]
      // dp.at(i+1).at(nj) = std::min(std::min(dp.at(i).at(nj), dp.at(i+1).at(nj)),
      //     dp.at(i+1).at(j)+b);
      // as dp[i+1][j] = min(dp[i+1][j], dp[i][j]) is needed for all j = 0~h
    }
  }
  cout(dp.at(n).at(h));
}

Measured memory_bytes: 78592
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int num;
  cin >> num;
  char str[num - 1];
  cin >> str;
  
  int counter = 1;
  for (int i = 0; i < num - 1; i ++){
    if (str[i] != str[i + 1]){
      counter++;
    } 
  }
  cout << counter << endl;
}

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



int main()
{
	int n,m,k,ans=0,t;
	scanf("%d",&n);
	scanf("%d%d",&m,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&t);
		int cur=1;
		while(cur<=m)
		{
			ans++;
			cur+=t;
		}
	}
	printf("%d",ans+k);
	return 0;
}

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

string s,token;
int cnt=0, d[3];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>s;
	istringstream ss(s);
	while(getline(ss, token, '/')){
		d[cnt]=stoi(token);
		cnt++;
	}
	if(d[0]<2019){
		cout<<"Heisei";
	}
	else if(d[0]==2019){
		if(d[1]<4){
			cout<<"Heisei";
		}
		else if(d[1]==4){
			if(d[2]<=30){
				cout<<"Heisei";
			}
			else
				cout<<"TBD";
		}
		else{
			cout<<"TBD";
		}
	}
	else{
		cout<<"TBD";
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	static int N;
	static int M;
	static int[] h;
	static int[] w;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			N = sc.nextInt();
			M = sc.nextInt();
			if (N == 0 && M == 0)
				break;
			h = new int[N + 1];
			w = new int[M + 1];
			for (int i = 0; i < N; ++i) {
				h[i + 1] = sc.nextInt();
			}
			for (int i = 0; i < M; ++i) {
				w[i + 1] = sc.nextInt();
			}
			for (int i = 1; i <= N; ++i) {
				h[i] = h[i - 1] + h[i];
			}
			for (int i = 1; i <= M; ++i) {
				w[i] = w[i - 1] + w[i];
			}

			int[] hs = new int[1000 * 1000 + 1];
			int[] ws = new int[1000 * 1000 + 1];
			for (int i = 0; i <= N; ++i) {
				for (int j = i + 1; j <= N; ++j) {
					++hs[h[j] - h[i]];
				}
			}
			for (int i = 0; i <= M; ++i) {
				for (int j = i + 1; j <= M; ++j) {
					++ws[w[j] - w[i]];
				}
			}
			int ans = 0;
			for (int i = 1; i < hs.length; ++i) {
				ans += hs[i] * ws[i];
			}
			System.out.println(ans);
		}
		sc.close();
	}
}

Measured memory_bytes: 289564
N = int(input())

ab = 0
x = 0
y = 0
z = 0

for _ in range(N):
    s = input()
    ab += s.count("AB")
    if (s[-1] == "A" and s[0] == "B"):
        z += 1
    elif (s[-1] == "A"):
        x += 1
    elif (s[0] == "B"):
        y += 1

if (not x and not y) and z:
    print(ab + z-1)
else:
    print(ab + min(x+z, y+z))

Measured memory_bytes: 3064
N, M = list(map(lambda n: int(n), input().split(" ")))
L = []
R = []
for i in range(M):
  tmp = input().split(" ")
  L.append(int(tmp[0]))
  R.append(int(tmp[1]))

maxL = max(L)
minR = min(R)

print(max([minR - maxL + 1, 0]))

Measured memory_bytes: 16980
#include <iostream>
#include <vector>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <deque>
#include <math.h>
#include <map>
#include <stack>
#include <list>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <cstring>
#include <climits>
#include <iterator>
#include <cassert>
#include <string>
using namespace std;

template<class T> bool amin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool amax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define REP(i, n) for(int i=0;i<n;i++)
#define REPE(i, n) for(int i=0;i<=n;i++)
#define REP2(i, j, n) for(int i=j;i<n;i++)
#define REP2E(i, j, n) for(int i=j;i<=n;i++)
#define REP3(i, j, n, s) for(int i=j;i<n;i+=s)
#define REP3E(i, j, n, s) for(int i=j;i<=n;i+=s)
#define RREP(i, n) for(int i=n;i>=0;i--)
#define RREP2(i, n, j) for(int i=n;i>=j;i--)
#define MSI unordered_map<string, int>
#define MII unordered_map<int, int>
#define VI vector<int>
#define VL vector<long>
#define PI pair<int, int>
#define VPI vector<PI>
#define VVI vector<VI>
#define VC vector<char>
#define VVL vector<VL>
#define VVPI vector<VPI>
#define MSVI unordered_map<string, VI>
#define MII unordered_map<int, int>
#define TCASES int t; cin>>t; while(t-- > 0)
#define MOD 1000000007


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL_TEST
	freopen("input.txt","r",stdin);
	#endif
	int a, b;
	cin >> a >> b;
	cout << ((a*b)%2==0 ? "Even" : "Odd") << '\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int h[100010];
  rep(i,n) cin >> h[i];
  bool b = true;
  if (n != 1) {
    for (int i = n - 1; i >= 1; i--) { // 前からだと、2 2 2 1とかで引っかかる
      if (h[i] - h[i - 1] < 0) {
        h[i - 1]--;
        if (h[i] - h[i - 1] < 0)
          b = false;
      }
    }
  }
  rep(i,n - 1) {
    if (h[i] > h[i + 1]) b = false;
  }
  if (b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

char P[505][505], B[505][505], R[505][505];

int main(){
	int h, w, flag, pos;
	scanf("%d %d",&h,&w);
	for (int i = 1; i <= h; i++) scanf("%s", P[i] + 1);
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			B[i][j] = '.';
		}
	}
	for (int i = 2; i <= h - 1; i++){
		if (i % 2 == 0){
			for (int j = 2; j <= w - 1; j++) B[i][j] = '#';
		}
		else{
			flag = 0;
			for (int j = 2; j <= w - 1; j++){
				if (P[i][j] == '#'){
					flag = 1;
					break;
				}
			}
			if (!flag){
				pos = 0;
				for (int j = 2; j <= w - 1; j++){
					if (P[i - 1][j] == '.'){
						pos = j;
						break;
					}
				}
				if (!pos) B[i][2] = '#';
				else B[i][pos] = '#';
			}
		}
	}
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++){
			if (P[i][j] == '#') R[i][j] = B[i][j] = '#';
			else{
				if (B[i][j] == '.') R[i][j] = '#';
				else R[i][j] = '.';
			}
		}
	}
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++) printf("%c", R[i][j]);
		printf("\n");
	}
	printf("\n");
	for (int i = 1; i <= h; i++){
		for (int j = 1; j <= w; j++) printf("%c", B[i][j]);
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1536
// D.

#include <sstream>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(int argc, char *argv[])
{
	int n, m, ans = 0;
	cin >> n >> m;
	int mm = (int)sqrt(m);
	for (int i = 1; i <= mm; ++i) {
		int a = m / i;
		if (a * i == m) {
			if (a >= n) {
				ans = max(ans, i);
			}
			if (i >= n) {
				ans = max(ans, a);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
    ll x;
    cin>>x;
    ll k,d;
    cin>>k>>d;
   ll now=(abs(x))/d;
   if(now==k){
       cout<<abs(abs(x)-k*d)<<"\n";
   }else if(now>k){
       cout<<abs(abs(x)-k*d)<<"\n";
   }else{
       k-=now;
       cout<<(k%2?abs(abs(x)-(now+1)*d):abs(abs(x)-now*d))<<"\n";
   }
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;
const int INF = 1001001001;

int MAX_V = 100; // 頂点数
vector<vector<int>> d(MAX_V, vector<int>(MAX_V, INF));
void warshall_floyd() {
  for(int k = 0; k < MAX_V; ++k)
    for(int i = 0; i < MAX_V; ++i)
      for(int j = 0; j < MAX_V; ++j)  d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> prev(MAX_V, vector<int>(MAX_V, INF));
  vector<int> a(m), b(m), c(m);
  rep(i, m) {
    cin >> a[i] >> b[i] >> c[i];
    --a[i]; --b[i];
    d[a[i]][b[i]] = c[i];
    d[b[i]][a[i]] = c[i];
  }

  rep(i, n) d[i][i] = 0;

  warshall_floyd();

  int ans = m;
  rep(i, m) {
    bool used = false;
    rep(j, n) {
      if(d[j][a[i]] + c[i] == d[j][b[i]]) used = true;
    }
    if(used) ans--;
  }
  cout << ans << endl;
}

Measured memory_bytes: 384
def fun():
     print('ac')
     print('AC')
     print('ACAC')
     print('ac')
     print('aacc')
ls=input()
k=0
s=0
kai=len(ls)
for i in range(len(ls)):
     if ls[i]=='A':
          if kai>i:
               kai=i
     if ls[i]=='Z':
          if i>s:
               s=i
print(s-kai+1)

Measured memory_bytes: 3516
import java.util.Scanner;

public class Main {
    public static void main(String args[] ) throws Exception {
    	new Main().exec(args);
    }

    public Main() {
    }

    public void exec(String args[]) throws Exception {
    	//初期化読み込み
    	Scanner sc = new Scanner(System.in);
    	String s = sc.nextLine();
    	boolean flag_C = false;
    	boolean flag_F = false;
    	int cn = 0;
    	for(char c:  s.toCharArray()) {
    		cn++;
    		if(cn>100) break;
    		if(!flag_C ) {
    			if(c == 'C') {
    				flag_C = true;
    			}
    		}else if(flag_C && !flag_F){
    			if(c == 'F') {
    				flag_F = true;
    				break;
    			}
    		}
    	}
    	System.out.println(flag_F?"Yes":"No");
	}
}

Measured memory_bytes: 10192
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq

while True:
    n,r = map(int,input().split(" "))
    if n==0 and r == 0:
        break
    q = []
    for i in range(n):
        heapq.heappush(q,(i,n-i))
    for i in range(r):
        p,c = map(int,input().split(" "))
        tmpQueue = []
        for j in range(p-1+c):
            tp = heapq.heappop(q)
            if j < p-1:
                heapq.heappush(tmpQueue,(j+c,tp[1]))
            else:
                heapq.heappush(tmpQueue,(j-p+1,tp[1]))
        for j in range(p-1+c):
            heapq.heappush(q,heapq.heappop(tmpQueue))
    print(heapq.heappop(q)[1])

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

int t[10000];
vector<P>E[10000];
int d[10000][3][201];

struct st {
	int u, c, i, a;
};
bool operator<(const st&a, const st&b) {
	return a.c > b.c;
}
int main() {
	int n, m, x; scanf("%d%d%d", &n, &m, &x);
	rep(i, n)scanf("%d", &t[i]);
	rep(i, m) {
		int a, b, d; scanf("%d%d%d", &a, &b, &d); a--; b--;
		E[a].push_back(P(d, b)); E[b].push_back(P(d, a));
	}
	priority_queue<st>que;
	memset(d, 0x3f, sizeof(d));
	d[0][0][0] = 0; que.push({ 0,0,0,0 });
	while (!que.empty()) {
		st s = que.top(); que.pop();
		if (d[s.u][s.i][s.a] != s.c)continue;
		for (P v : E[s.u]) {
			int a = min(x, s.a + v.first), k = t[v.second];
			if (abs(s.i - t[v.second]) == 2) {
				if (a < x)continue;
			}
			if (k == 1)k = s.i;
			else a = 0;
			if (d[v.second][k][a] > s.c + v.first) {
				d[v.second][k][a] = s.c + v.first;
				que.push({ v.second, d[v.second][k][a],k,a });
			}
		}
	}
	int Min = INF;
	rep(i, 3)rep(j, x + 1) {
		Min = min(Min, d[n - 1][i][j]);
	}
	printf("%d\n", Min);
}

Measured memory_bytes: 27848
#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;


#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;
    
    input!{ s: Chars }

    let ans = 700 + s.iter().filter(|x| **x == 'o').count() * 100;

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

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


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

int main(){
    ll N; string S;
    cin >> N >> S;
    ll r = 0, g = 0, b = 0;
    rep(i, 0, N){
        if(S[i] == 'R') r++;
        if(S[i] == 'G') g++;
        if(S[i] == 'B') b++;
    }
    ll ans = r*g*b;
    rep(i, 0, N-1){
        rep(j, i+1, N){
            ll k = 2*j - i;
            if(k >= N) continue;
            if(S[i] != S[j] && S[j] != S[k] && S[k] != S[i]) ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> p(n);
    REP(i, n) cin >> p[i];

    ll ans = 0;
    FOR(i, 1, n-1) {
        ll mi = min({p[i-1], p[i], p[i+1]}), ma = max({p[i-1], p[i], p[i+1]});
        if(p[i] != mi && p[i] != ma) ans++;
    }
    cout << ans << endl;

    return 0;
}


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

int main () {
  int X;
  cin >> X;
  if (X<600) cout << 8 << endl;
  else if (X<800) cout << 7 << endl;
  else if (X<1000) cout << 6 << endl;
  else if (X<1200) cout << 5 << endl;
  else if (X<1400) cout << 4 << endl;
  else if (X<1600) cout << 3 << endl;
  else if (X<1800) cout << 2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,n) for(int i=0;i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define min(...) min({__VA_ARGS__})
#define max(...) max({__VA_ARGS__})
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define ALL(x) (x).begin(),(x).end()
signed _main(); signed main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=998244353;
const long long INF = 1LL << 60;
using P=pair<int,int>;

//// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
////nCr (mod MOD)を求める
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
////

signed _main(){
  int N,M,K; cin >> N >> M >> K;
  COMinit();
  int ans=0;
  rep(i,K+1){
    ans+=((((COM(N-1,i)%MOD)*M)%MOD)*modpow(M-1,N-i-1,MOD))%MOD;
  }
  cout << ans%MOD << endl;
  return 0;
}


Measured memory_bytes: 15600
import java.util.*;

public class Main {
	  public static void main(String args[]){
      	Scanner scan = new Scanner(System.in);
            
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        
        String cnt;
        
        if( a + b >= c )cnt = "Yes";
        else 
          cnt = "No";
            
        System.out.println(cnt);
        
      }
}

Measured memory_bytes: 22740
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

int eq(char *str1, char *str2) {
	int count = 0;
	while (str1[count] != 0 || str2[count] != 0) {
		if (str1[count] != str2[count])return 0;
		count++;
	}
	return 1;
}

int main(void) {
	char s[5001];
	char list[10000][5001];
	int listcount = 0;
	char a = 'a';
	int k = 0, count = 0;
	scanf("%s", &s);
	scanf("%d", &k);
	for (int i = 0; i < 5001; i++) {
		if (s[i] == 0) {
			count = i;
		}
	}
	for (int ch = 0; ch < 26; ch++) {
		char moji = a + ch;
		for (int i = 0; i < count; i++) {//offset
			if (s[i] == moji) {
				for (int j = 0; j + i < count && j < k; j++) {
					char str[5001] = "";
					strncpy(str, s + i, j+1);
					str[j + 1] = 0;
					int flag = 0;
					for (int lc = 0; lc < listcount; lc++) {
						if (eq(list[lc], str)) {
							flag = 1;
							break;
						}
					}
					if (flag) {
						flag = 0;
						continue;
					}
					strncpy(list[listcount], str, j+1);
					list[listcount][j + 1] = 0;
					listcount++;
				}
			}
		}
		if (listcount >= k) {
			char temp[5001];
			char s[5001];
			for (int i = 0; i < listcount; i++) {
				for (int j = i + 1; j < listcount; j++) {
					if (strcmp(list[i], list[j]) > 0) {
						strcpy(s, list[i]);
						strcpy(list[i], list[j]);
						strcpy(list[j], s);
					}
				}
			}
			printf("%s\n", list[k - 1]);
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long 
#define FI first 
#define SE second
#define pb push_back 
#define eb emplace_back
#define mod 1000000007
#define all(c) (c).begin(),(c).end()
#define LB  lower_bound
#define UB  upper_bound
#define max3(a,b,c) max(c,max(a,b))
#define min3(a,b,c) min(c,min(a,b))
#define mems(s, n) memset(s, n, sizeof(s))
#define NINF -1e18
#define INF 1e18
#define int ll int
#define OOK order_of_key  //no of elements less than
#define FBO find_by_order //iterator pointing kth element;indexing starts from 0
#define CK3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define CK4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl

typedef pair<int,int> PII;
typedef pair<pair<int,int>,int> PPII;
typedef pair<int,pair<int,int>> PIPI;
typedef map<int,int>MII;
typedef vector<int> VI;
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/*int power(int a, int b)
{int x=1,y=a;while(b>0){if(b%2){x =(x*y)%mod;}y =(y*y)%mod;b/=2;}return x%mod;}
*/
//int modInverse(int a, int m) {return power(a, m-2);} //gcd(a,m)=1 


signed main()
{
ios::sync_with_stdio(false); cin.tie(0);
int T=1,T1=0;//cin>>T;
while(T1++<T)
{
    string s;
    cin>>s;
    if(s[3]==s[2]&&s[4]==s[5])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll h,a; cin>>h>>a;
    if(h%a==0) cout<<h/a<<endl;
    else cout<<1+h/a<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    int N;
    cin >> N;
    set<int> s,ss;
    rep(i,N){
        int a;
        cin >> a;
        for (int j = 400; j <= 3200; j += 400) {
            if(a < j && a >= j-400) s.insert(j),ss.insert(j);
        }
        if(a >= 3200) {
            s.insert(i);
            
        }
    }
    
    cout << (ss.size() == 0 ? 1 : ss.size()) csp s.size() << endl;
    
    
    
    

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define POW(n) ((n) * (n))
#define ALL(a) (a).begin(), (a).end()

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long S) {
  string s = to_s(S);

  ll ans = 0;
  REP(i, s.size()) { ans += s[i] == '1'; }

  cout << ans << endl;
}

int main() {
  ios::sync_with_stdio(false);
  long long S;
  cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  cout << (n + 110) / 111 * 111 << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll h_pow(ll x,ll n){
    ll ret = 1;
    while(n>0){
        if(n&1) ret = ret * x;
        x = x * x;
        n >>= 1;
    }
    return ret;
}

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

    rep(i,32){
        ll t = h_pow(3,i);
        if(t>=N){
            cout << i << endl;
            break;
        }
    }
}

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

using Tup = tuple<int64, int64, int64>;

vector<char> ch;
int32 toint[256] = {};

char back(char c, int32 x){
	int32 idx = toint[c];
	idx = (idx+52-x)%52;
	return ch[idx];
}

int main(void){
	REP(i, 26){
		ch.push_back((char)('a'+i));
		toint['a'+i] = ch.size()-1;
	}
	REP(i, 26){
		ch.push_back((char)('A'+i));
		toint['A'+i] = ch.size()-1;
	}

	int32 n;
	while(cin >> n && n){
		vector<int32> k(n);
		REP(i, n) cin >> k[i];
		string s;
		cin >> s;
		REP(i, s.size()){
			s[i] = back(s[i], k[i%n]);
		}
		cout << s << endl;
	}
}



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

int main(){
    int n,a,b,c;
    cin>>n>>a>>b>>c;
    int l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    int ans=1e8,res,x,y,z;
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1<<3*n); ++bit)
    {
        x=0,y=0,z=0,res=0;
        /* bit で表される集合の処理を書く */
        /*int cnt=0;
        for(int j=0;j<n;j++){
            if((bit>>j&1)) cnt++; //bitのj番目が1ならcnt++
        }*/
        for(int i=0;i<3*n;i+=3){
            if((bit>>i&1)){
                if(x!=0){
                    x+=l[i/3];
                    res+=10;
                }
                else x+=l[i/3];
            }
            else if((bit>>(i+1)&1)){
                if(y!=0){
                    y+=l[i/3];
                    res+=10;
                }
                else y+=l[i/3];
            }
            else if((bit>>(i+2)&1)){
                if(z!=0){
                    z+=l[i/3];
                    res+=10;
                }
                else z+=l[i/3];
            }

        }
        if(z==0 || x==0 || y==0) continue;
        res+=abs(x-a)+abs(y-b)+abs(z-c);
        ans=min(ans,res);

    }

    cout<<ans;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}


int main()
{
    int x1, x2, y1, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int  x = x2 - x1, y = y2 - y1;
    printf("%d %d %d %d\n" ,x2 - y,y2 + x, x1 - y, y1 + x);
    return 0;
}


Measured memory_bytes: 256