akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector> 
using namespace std;
#define pb push_back
int main(void){
	char buf;
	int tmp;
	while(cin >> tmp){
		vector<int> list;
		if(cin.eof())
			break;
		list.pb(tmp);
		for(int i=0;i<4;i++){
			cin >> buf >> tmp;
			list.pb(tmp);
		}
		sort(list.begin(),list.end());
		int card[14]={0};
		for(int i=0;i<5;i++)
			card[list[i]]++;
		int cmax=0,cnmax=0,series=1;
		for(int i=1;i<=13;i++){
			if(cmax < card[i]){
				cnmax=cmax;
				cmax=card[i];
			}else if(cnmax < card[i])
				cnmax=card[i];
			if(card[i]&&card[i-1])
				series++;
			else if(series!=5)
				series=1;
		}
		if(series==4&&card[1])
			series++;
		
		if(cmax==4)
			cout << "four card"<< endl;
		else if(cmax==3&&cnmax==2)
			cout <<"full house" << endl;
		else if(series == 5)
			cout << "straight" << endl;
		else if(cmax==3)
			cout <<"three card" << endl;
		else if(cmax==2 && cnmax==2)
			cout <<"two pair" << endl;
		else if(cmax==2)
			cout <<"one pair" << endl;
		else
			cout <<"null" << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define nl cout << endl
#define pb push_back
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define Sort(x) sort(all(x))
#define print_vector(my_vector_name) for(int i=0; i<my_vector_name.size(); i++) cout << my_vector_name[i] << " ";nl
//debugger
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define hang while (1)

char charFromNumber(int n) {
	return char(n+'a');
}

int main() {
	fast;
	ll n;
	cin >> n;
	string ans;
	while (n) {
		n--;
		ll q = n/26;
		ans=charFromNumber(n%26)+ans;
		n=q;
	}
	cout << ans;
	return 0;
}

//notes
/*
 value of INT_MAX and INT_MIN is fixed and they are
 INT_MAX = 2147483647
 INT_MIN = -2147483648
 use these format of input when number of inputs not provided
 *while(scanf("%lld",&n)!=EOF)
 *while using getline(cin,s) for taking input of a string which is 
 having white space characters just write cin>>ws; before geline(cin,s)
 to make it work properly
*/

/*
 use 2-D vector for representing the pair<int,pair<int,int> > kind of things
*/

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using ll = long long int;

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    int flag = 0;
    int i = 0;
    int j = 0;
    int k = 0;
    while(1){
        if(flag == 0){
            if(a.size() == i){
                cout << 'A' << endl;
                return 0;
            }
            if(a[i] == 'a'){
                flag = 0;
            }else if(a[i] == 'b'){
                flag = 1;
            }else{
                flag = 2;
            }
            i++;
        }else if(flag == 1){
            if(b.size() == j){
                cout << 'B' << endl;
                return 0;
            }
            if(b[j] == 'a'){
                flag = 0;
            }else if(b[j] == 'b'){
                flag = 1;
            }else{
                flag = 2;
            }
            j++;
        }else{
            if(c.size() == k){
                cout << 'C' << endl;
                return 0;
            }
            if(c[k] == 'a'){
                flag = 0;
            }else if(c[k] == 'b'){
                flag = 1;
            }else{
                flag = 2;
            }
            k++;
        }
    }
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(false), cin.tie(NULL)

typedef long long ll;

using namespace std;

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

	ll arr[n];

	for(int i=0; i<n; i++)
		cin >> arr[i];

	sort(arr, arr+n);

	cout << arr[n-1]-arr[0];
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

/*
AC
差分で考える
C<=y<=D
-D<=y<=-c
の２パターンある．１つ目のパターンの個数mを固定
m*C-D*(n-1-m)<=(yの総和)=B-A<=m*D-C*(n-1-m)
逆にこれが成り立つようなmがあれば，yを構成できる．
*/

int main(void){
	ll n,a,b,c,d;
	cin>>n>>a>>b>>c>>d;
	reg(m,0,n-1){
		if(m*c-d*(n-1-m)<=b-a && b-a<=m*d-c*(n-1-m)){
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N=sc.nextInt(),K=sc.nextInt();
      	long ans=0;
		long[] H = new long[N];
		for(int i = 0;i<N;i++) {
			H[i]=sc.nextInt(); 
		}
		Arrays.sort(H);
		for(int i = 0;i<N-K;i++) {
			ans+=H[i];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 83840
def main():
    N = int(input())
    abc = [
        list(map(int, input().split()))
        for _ in range(N)
    ]

    ans = f(N, abc)
    print(ans)


def f(N, abc):
    """
    2回連続で同じ活動(abc)を行えない

    1: a or b or c
    2:
        1-a: b or c
        1-b: c or a
        1-c: a or b

    1日目
        aをしたときの幸福最大
        bをしたときの幸福最大
        cをしたときの幸福最大
    2日目
        aをしたときの幸福最大(b, c から)
        bをしたときの幸福最大(c, a から)
        cをしたときの幸福最大(a, b から)
    """
    dp = [[None] * 3 for _ in range(N + 1)]
    dp[0] = [0, 0, 0]
    dp[1] = abc[0]

    for i in range(2, N + 1):
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + abc[i-1][0]
        dp[i][1] = max(dp[i-1][2], dp[i-1][0]) + abc[i-1][1]
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + abc[i-1][2]

    ans = max(dp[N])
    return ans


if __name__ == "__main__":
    main()


Measured memory_bytes: 47384
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String[] array = new String[10];
        String s1, s2;
        int m, h, counter = 0;
        while(true){
            array[counter] = scanner.next();
            if(array[counter].equals("-"))break;
            m = scanner.nextInt();
            h = 0;
            for(int i = 0; i < m; i++){
                h += scanner.nextInt();
            }
            h %= array[counter].length();
            s1 = array[counter].substring(0, h);
            s2 = array[counter].substring(h);
            array[counter++] = s2 + s1;
        }
        for(int i = 0; i < counter; i++){
            System.out.println(array[i]);
        }
    }
}



Measured memory_bytes: 26436
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<limits>
#include<list>
#include <stdio.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0;i < (n); ++i)
#pragma GCC optimize("Ofast")



int main() {
	int n, k;
	cin >> n >> k;
	vector<int>x(n);
	rep(i, n)cin >> x[i];
	int count = 0;
	rep(i, n) {
		count += 2*min(x[i], k - x[i]);
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll n,i,j,count;
  cin>>n;
  	vector<ll> h(n);
  	for(i=0;i<n;i++){
      	cin>>h[i];
    }

  	ll ans=1;
  
  	for(i=1;i<n;i++){
      count=0;
      for(j=0;j<i;j++){
		if(h[i]>=h[j]){
          count++;
        }
      }
  		if(count==i){
          ans++;
        }
    }
  	
  cout<<ans<<endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 0

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

#define MAX_N (1000*100)

int N;
int D[MAX_N+5];
#define DIVN  (998244353)
vector<ll> P[MAX_N+5];

bool pairless(const pair<int,int> &lhs, const pair<int,int> &rhs)
{
	return lhs.second < rhs.second;
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N;
	FOR(n,N) {
		cin >> D[n];
		P[D[n]].push_back(n);
	}

	ll ans = 0;
	int count=0;
	int d=0;
	int prev = 0;
	for(; d<N; d++) {
		if(d==0) {
			if(P[d].size()!=1 || P[d][0]!=0) {
				ans = 0;
				DOUT << "break: 1"<<endl;
				break;
			}
			count = 1;
			prev = 1;
			ans = 1;
			DOUT << "[d="<<d<<"]: P[d].size()="<<P[d].size()<<", count="<<count<<", ans="<<ans<<endl;
			continue;
		}

		if(P[d].size()==0) {
			break;
		}
		count += P[d].size();
		ll inc = 1;
		for(int i=0; i<P[d].size(); i++) {
			inc *= prev;
			inc %= DIVN;
		}
		ans = ans  * inc % DIVN;
		DOUT << "[d="<<d<<"]: P[d].size()="<<P[d].size()<<", count="<<count<<", ans="<<ans<<endl;
		prev = P[d].size();
	}
	if(count!=N) {
		ans = 0;
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 6144
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

int main() {
	int a,b;cin>>a>>b;
	int ans;
	if(a!=1&&b!=1) ans=1;
	else if(a!=2&&b!=2) ans=2;
	else ans=3;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  string a,b,c;
  cin>>n>>a>>b>>c;

  int ans=0;
  REP(i,n){
    if(a[i]==b[i]&&b[i]==c[i]) continue;
    else if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i]) ans++;
    else ans+=2; 
  }

  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>

using namespace std;

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

	int a, b, c;
	cin >> a >> b >> c;
	set<int> s;
	s.insert(a);
	s.insert(b);
	s.insert(c);
	if ((int)s.size() == 2) cout << "Yes\n";
	else cout << "No\n";
}


Measured memory_bytes: 888
n = int(input())
s = input()
t = input()

ans = ""
for i in range(n, 0, -1):
    if (s[n-i:] == t[:i]):
        ans = s[:n-i] + t[:i] + t[i:]
        break
    else:
        ans = s + t

print(len(ans))

Measured memory_bytes: 3060
in1 = input()
in2 = input()
N, x = in1.split()
N = int(N)
x = int(x)
a = list()
for i in in2.split():
  a.append(int(i))
a.sort()
count = 0
for ai in a:
  if x > ai:
    count += 1
    x -= ai
  elif x == ai:
    count += 1
    x -= ai
    break
  else:
    x -= ai
    break
if x > 0 and count > 0:
  count -= 1
print(count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
#define MOD 1000000007
using ll = long long;
using namespace std;
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(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin>>n;
cout<<800*n-200*(n/15)<<endl;
//system("pause");
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long ans[100005],h[100005];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>h[i];
	memset(ans,63,sizeof(ans));
	ans[0]=0;
	ans[1]=fabs(h[1]-h[0]);
	for(int i=2;i<n;i++)ans[i]=min(ans[i-2]+fabs(h[i-2]-h[i]),ans[i-1]+fabs(h[i-1]-h[i]));
	cout<<ans[n-1];
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define opf(i) cout<<fixed<<setprecision(10)<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define matC(name,fnum,snum); vector<vector<char>> name((fnum),vector<char>((snum),0));
#define debugP int debug_point; cin>>debug_point;
#define FI first
#define SE second
const ll MOD= 1e9 + 7;



vector<pair<int,int>> Dir={{-1,0},{1,0},{0,1},{0,-1}};

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    ll h,w;
    cin>>h>>w;
    mat(maze,h,w);
    mat(dis,h,w);
    ll ans=0;
    rep(i,h){
      rep(j,w){
        char tmp;
        cin>>tmp;
        if(tmp=='.'){maze[i][j]=1;ans++;}
        else maze[i][j]=2;
      }
    }
    dis[0][0]=1;
    queue<pair<ll,ll>> que;
    que.push(make_pair(0,0));
    bool flag=true;
    while(que.size()&&flag){
      rep(i,4){
        ll ty=que.front().FI+Dir[i].FI;
        ll tx=que.front().SE+Dir[i].SE;
        if(ty>=0&&ty<h&&tx>=0&&tx<w&&dis[ty][tx]==0&&maze[ty][tx]==1){
          dis[ty][tx]=dis[que.front().FI][que.front().SE]+1;
          if(ty==h-1&&tx==w-1){
            flag =false;
            break;
          }
          que.push(make_pair(ty,tx));
        }
      }
      que.pop();
    }
    if(flag)op(-1)
    else op(ans-dis[h-1][w-1]);
    return 0;
}


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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(iii,n){cout<<x[iii]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

#define UF_NUM 505050

typedef pair<li, li> PI;


li nums[101010];
bool res[101010];

int main() {

	li n, m;
	cin >> n >> m;
	rin{
		res[i] = false;
		nums[i] = 1;
	}
	res[0] = true;

	rep(i, m) {
		li x, y;
		cin >> x >> y;
		x--;
		y--;
		nums[x]--;
		nums[y]++;
		if (res[x]) {
			res[y] = true;
			if (nums[x] == 0) {
				res[x] = false;
			}
		}
	}

	li ans = 0;
	rep(i, n)if (res[i])ans++;
	cout << ans << endl;


	return 0;
}

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

using namespace std;
#define int long long
#define N 666666
int a[N],b[N];
bool cmp(int a,int b){
	return a>b;
}
int check(int num,int n,int m,int v,int p){
	memcpy(b,a,sizeof(a));
	for(int i=num;i<=n;i++){
		if(!v) break;
		b[i]+=m;
		v--;
	}
	for(int i=1;i<=p-1;i++){
		if(!v) break;
		b[i]+=m;
		v--;
	}
	if(!v){
		if(b[p]<=b[num]) return 1;
		else return 0;
	}
	int sum=v*m;
	for(int i=p;i<num;i++){
		if(b[i]>b[num]) return 0;
		int t=b[num]-b[i];
		t=min(t,m);
		sum-=t;
		if(sum<=0) break;
	}
	if(sum<=0) return 1;else return 0;
}
void slove(){
	int n,m,v,p;
	cin>>n>>m>>v>>p;
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+1+n,cmp);
	int l=0;int r=n;
	int ans=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid,n,m,v,p)){
			ans=mid;
			l=mid+1;
		}else{
			r=mid-1;
		}
	}
	cout<<ans;
}
signed main(){
	slove();
	return 0;
} 

Measured memory_bytes: 6400
#include <iostream>

using namespace std;

#define MAX_YEAR 7368792

bool is_bloom[MAX_YEAR];

int main(void) {
    while (1) {
        int m, n;
        cin >> m >> n;
        if (m == 0 && n == 0) break;

        for (int i = 0; i < MAX_YEAR; ++i) {
            is_bloom[i] = true;
        }

        int year = m;
        for (int i = 0; i < n; ++i) {
//        cout << year << endl;
            for (int j = year; j <= MAX_YEAR; j += year) {
                is_bloom[j] = false;
            }
            while (!is_bloom[year]) year++;
        }

        cout << year << endl;
    }
    return 0;
}


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

int main() {
  int a,b,c;
  int K;
  cin >> a >> b >> c >> K;
  
  int ans = 0;
  while (a >= b){
    ans++;
    b *= 2;
  }
  while (b >= c){
    ans++;
    c *= 2;
  }
  if (ans <= K) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(ll, N, A, B);
  if (N == 1) {
    print(A == B ? 1 : 0);
    return;
  }
  if (B < A) {
    print(0);
    return;
  }
  print((N - 2) * (B - A) + 1);
}


Measured memory_bytes: 384
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

long long int infty = 1e15;

int main(){
  
  // read problem
  long long int N, M, L, A, B, C;
  scanf("%lld%lld%lld", &N, &M, &L);
  std::vector<std::vector<long long int> > d(N);
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      d[i].push_back(-1);
    }
  }
  for(long long int i = 0; i < M; i++){
    scanf("%lld%lld%lld", &A, &B, &C);
    //if(C < L){
      d[A-1][B-1] = C;
      d[B-1][A-1] = C;
    //}
  }
  
  
  long long int Q, tmp1, tmp2;
  std::vector<long long int> s, t;
  
  scanf("%lld", &Q);
  for(long long int i = 0; i < Q; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    s.push_back(tmp1);
    t.push_back(tmp2);
  }
  
  /*
  std::cerr << "d:" << std::endl;
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      std::cerr << d[i][j] << " ";
    }std::cerr << std::endl;
  }
   */
  
  // solve problem
  // 1) calculate the minimum distance between each pair of vertices
  for(long long int k = 0; k < N; k++){
    for(long long int i = 0; i < N; i++){
      for(long long int j = 0; j < N; j++){
        if(d[i][k] > 0 && d[k][j]>0){
          d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]);
          if(d[i][j] < 0){
            d[i][j] = d[i][k] + d[k][j];
          }
        }
      }
    }
  }
  
  /*
  std::cerr << "the result of d:" << std::endl;
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      std::cerr << d[i][j] << " ";
    }std::cerr << std::endl;
  }
   */
  
  // 2) make another graph which shows the pair of cities between which the car can go without charging
  std::vector<std::vector<long long int> > d2(N);
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      d2[i].push_back(-1);
    }
  }
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      if(d[i][j] >= 0 && d[i][j] <= L){
        d2[i][j] = 1;
      }
    }
  }
  /*
  std::cerr << "d2:" << std::endl;
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      std::cerr << d2[i][j] << " ";
    }std::cerr << std::endl;
  }
   */
  
  for(long long int k = 0; k < N; k++){
    for(long long int i = 0; i < N; i++){
      for(long long int j = 0; j < N; j++){
        if(d2[i][k] > 0 && d2[k][j]>0){
          d2[i][j] = std::min(d2[i][j], d2[i][k] + d2[k][j]);
          if(d2[i][j] < 0){
            d2[i][j] = d2[i][k] + d2[k][j];
          }
        }
        
      }
    }
  }
  /*
  std::cerr << "the result of d2:" << std::endl;
  for(long long int i = 0; i < N; i++){
    for(long long int j = 0; j < N; j++){
      std::cerr << d[i][j] << " ";
    }std::cerr << std::endl;
  }
  */
  // answer
  std::cerr << "Answer:" << std::endl;
  for(long long int i = 0; i < Q; i++){
    if(d2[s[i]-1][t[i]-1]<0){
      std::cout << -1 << std::endl;
    }
    else{
      std::cout << d2[s[i]-1][t[i]-1]-1 << std::endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 4332
#include<bits/stdc++.h>
using namespace std;
struct node { int val, gs; }e[100005], e2[100005];
bool cmp(node x, node y) { return x.gs > y.gs; }
int main() {
	int i, n, x;
	cin >> n;
	for(i = 1; i <= n; ++i) {
		cin >> x;
		if(i & 1) ++e[x].gs;
		else ++e2[x].gs;
	}
	for(i = 1; i <= 100000; ++i) e[i].val = i, e2[i].val = i;
	sort(e + 1, e + 100000 + 1, cmp);
	sort(e2 + 1, e2 + 100000 + 1, cmp);
	if(e[1].val != e2[1].val) cout << n - e[1].gs - e2[1].gs;
	else cout << min(n - e[1].gs - e2[2].gs, n - e[2].gs - e2[1].gs);
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define mod 1000000007



int main(){
  ll n,k;
  cin >>  n>>k ;
  if(n>=2*k-1)cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    if(0<=x-r && x+r<=W && 0<=y-r && y+r<=H){printf("Yes\n");return 0;}
    printf("No\n");
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
#include<string>
#include<cassert>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){

	string S;
	cin>>S;


	int N = S.length();
	ll ans_count = 0;
	//cout<<"N : "<<N<<endl;

	array<int,200001> dp;	
	array<int,200001> arr;	


	int moto = 1;
	for(int i = 0; i <= N; i++){
		arr[i] = moto;
		moto = (moto * 10) % 2019;
	}

	int num = S[N-1] - '0';
	dp[0] = num;
	for(int i = 1; i < N; i++){
		num = num + (S[N - 1 - i] - '0') * arr[i];
		num = num % 2019;
		dp[i] = num;
	}
	
//	for(int i = 0; i < N ; i++){
//		cout<<dp[i]<<endl;
//	}

	for(int i = 1; i < 2019; i++){
		int ct = 0;
		for(int j = 0; j < N; j++){

			if(dp[j] == i)ct++;
		}
		ans_count += ct * (ct - 1) / 2;
	}



	int ct = 0;
	int flag = 0;
	for(int j = 0; j < N; j++){

		if(dp[j] == 0){
			flag = 1;
			ct++;
		}
	}
	ans_count += (ct+flag) * ((ct+flag) - 1) / 2;


	//	for ( int i = 0; i <= N - 4; i++){
	//
	//		int num = stoi(S.substr(N - 1 - i - 3, 4));
	//		//cout<<"num : "<<num<<endl;
	//		int amari = num % 2019;
	//		if( amari == 0){
	//			ans_count++;
	//		}
	//		int new_amari = 1000;
	//
	//		//cout<<"i : "<<i<<endl;
	//		for ( int j = 1; (N - 1 - i - 3) - j >= 0; j++){
	//			
	//			//cout<<"ind : "<<(N-1-i-3)-j<<endl;
	//			int number = S[N-1-i-3-j,1] - '0';
	//			//cout<<"num : "<<number<<endl;
	//		
	//			//cout<<new_amari * 10 * number<<endl;
	//			
	//			//new_amari = (new_amari * 10 ) % 2019;
	//			
	//			//cout<<"na : "<<new_amari<<endl;
	//			//amari = (new_amari * number + amari) % 2019;
	//			amari = (arr[3 + j] * number + amari) % 2019;
	//
	//			if( amari == 0){
	//				ans_count++;
	//			}
	//		}
	//	}

	cout<<ans_count<<endl;
	return 0;
	//少なくとも４桁
	//
	//2019 = 3 * 673


}



Measured memory_bytes: 5336
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
int main(void){
    int n;
    ll x;
    cin>>n>>x;
    vector<ll> v(n);
    rep(i, n) cin>>v[i];
    vector<ll> v2 = v;
    ll ans1 = 0;
    ll ans2 = 0;
    rep(i, n-1){
        if(v[i] + v[i+1]>x){
            ll s = v[i];
            ll t = v[i+1]; 
            ll a = min(t, s+t-x);
            v[i+1] -= a;
            v[i] -= (s+t-x)-a;
            ans1 += s+t-x;
        }
    }
    reverse(v2.begin(), v2.end());
    rep(i, n-1){
        if(v2[i] + v2[i+1]>x){
            ll s = v2[i];
            ll t = v2[i+1]; 
            ll a = min(t, s+t-x);
            v2[i+1] -= a;
            v2[i] -= (s+t-x)-a;
            ans2 += s+t-x;
        }
    }
    cout<<min(ans1, ans2)<<endl;
    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l,r;
  cin>>l>>r;
  if(r-l>3000){
    cout<<0<<endl;
  }
 
  else{ 
    long long ans=2020;
    for(long long i=l;i<r;i++){
      for(long long j=i+1;j<=r;j++){
        ans=min(ans,(i*j)%2019);
      }
    }
    cout<<ans<<endl;
  }
  
   
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val ABC = Array("A", "B", "C")
  def printABC(n: Int): Unit = {
    println(ABC(n))
  }

  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val (a, b, c) = (sc.nextInt(), sc.nextInt(), sc.nextInt())
  val ss = (1 to n).map { _ =>
    val s = sc.next()
    S.find(s)
  }

  var state = State(Array(a, b, c), Nil)
  ss.zipWithIndex.foreach { case (s, idx) =>
    val Array(i, j) = s.target
    if(state(i) + state(j) <= 0) {
      println("No")
      sys.exit(0)
    }
    state = if(state(i) == 0) state.add(i, j)
    else if(state(j) == 0) state.add(j, i)
    else {
      ss.lift(idx + 1).fold { state.add(i, j) } { nextS =>
        if(nextS.target.contains(i)) state.add(i, j) else state.add(j, i)
      }
    }
  }
  println("Yes")
  state.result.reverse.foreach(printABC)

}

case class State(ary: Array[Int], result: List[Int]) {
  def add(incr: Int, decr: Int): State = {
    val nextAry = ary.clone()
    nextAry(incr) += 1
    nextAry(decr) -= 1
    State(nextAry, incr :: result)
  }

  def apply(n: Int): Int = ary(n)
}

sealed abstract class S {
  lazy val name: String = getClass.getSimpleName.init

  def target: Array[Int]
}

object S {
  case object AB extends S {
    override val target: Array[Int] = Array(0, 1)
  }

  case object AC extends S {
    override val target: Array[Int] = Array(0, 2)
  }

  case object BC extends S {
    override val target: Array[Int] = Array(1, 2)
  }

  val values: Seq[S] = AB :: AC :: BC :: Nil
  def find(name: String): S = values.find(_.name == name).get
}


Measured memory_bytes: 72056
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<int,int>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int INF=1000000007;
using ll=long long;


int n;
string s,t;
void check(string *u){
	REP(i,1,n){
		if(s[i]=='o'){
			if(t[i]=='S'){
				if(t[i-1]=='S')t+="S";
				else t+="W";
			}else{
				if(t[i-1]=='S')t+="W";
				else t+="S";
			}
		}else{
			if(t[i]=='S'){
				if(t[i-1]=='S')t+="W";
				else t+="S";
			}else{
				if(t[i-1]=='S')t+="S";
				else t+="W";
			}
		}
	}
	if(s[0]=='o'){
		if(t[0]=='S'){
			if(t[n-1]=='S')t+="S";
			else t+="W";
		}else{
			if(t[n-1]=='S')t+="W";
			else t+="S";
		}
	}else{
		if(t[0]=='S'){
			if(t[n-1]=='S')t+="W";
			else t+="S";
		}else{
			if(t[n-1]=='S')t+="S";
			else t+="W";
		}
	}
}
int main(){
	cin>>n>>s;
	t="SS";
	check(&t);
	if(t[0]==t[n]&&t[1]==t[n+1]){
		rep(i,n)cout<<t[i];
		return 0;
	}
	t="SW";
	check(&t);
	if(t[0]==t[n]&&t[1]==t[n+1]){
		rep(i,n)cout<<t[i];
		return 0;
	}
	t="WS";
	check(&t);
	if(t[0]==t[n]&&t[1]==t[n+1]){
		rep(i,n)cout<<t[i];
		return 0;
	}
	t="WW";
	check(&t);
	if(t[0]==t[n]&&t[1]==t[n+1]){
		rep(i,n)cout<<t[i];
		return 0;
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 640
N = int(input())
asiba = list(map(int,input().split()))
dp =[10**10] *N

dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-2]+abs(asiba[i]-asiba[i-2]),dp[i])
    dp[i] = min(dp[i-1]+abs(asiba[i]-asiba[i-1]),dp[i])
print(dp[N-1])

Measured memory_bytes: 13976
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<ll,pll> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n,m;
vi d,a;
vvi g;

bool dfs(int v,int w,int x,int pre){
	a[v]++;
	bool B=0;
	for(auto u:g[v]){
		if(!a[u]&&u!=w) B|=dfs(u,w,x,v);
		if(u==x&&u!=pre) return 1;
	}
	return B;
}

int main(){
	cin>>n>>m;
	d=vi(n);
	g=vvi(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--;v--;
		d[u]++;d[v]++;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	bool B=1;
	for(int i=0;i<n;i++) if(d[i]%2==1) B=0;
	sort(d.begin(),d.end());
	if(d[n-1]==2||n>=2&&d[n-1]<=4&&d[n-2]==2) B=0;
	if(n>=2&&d[n-1]==4&&d[n-2]==4){
		int s=-1,t;
		a=vi(n);
		for(int i=0;i<n;i++) if(g[i].size()==4){
			if(s==-1) s=i;
			else t=i;
		}
		B&=dfs(s,t,s,-1);
	}
	cout<<(B?"Yes":"No")<<endl;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
string s,t;int ans=0;
int main(){
  cin >> s >> t;
  for(int i = 0;i<3;i++){
    if(s.at(i)==t.at(i)){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
Scanf.scanf "%d %d" (fun h w ->
    let a = Array.init h (fun _ ->
        Array.init w (fun _ ->
            Scanf.scanf " %d" (fun a -> a)))
    in
    let rec loop y x dir hist =
        if y = h then hist else
            if a.(y).(x) mod 2 = 0 then (
                let x = x + dir in
                if x < 0 || x >= w then loop (y + 1) (x - dir) (-dir) hist
                                   else loop y x dir hist
            ) else (
                let nx = x + dir in
                let nx, ny, dir = if nx < 0 || nx >= w then nx - dir, y + 1, -dir
                                                       else nx, y, dir
                in
                if ny = h then hist else (
                    let hist = (y + 1, x + 1, ny + 1, nx + 1) :: hist in
                    a.(y).(x) <- a.(y).(x) - 1;
                    a.(ny).(nx) <- a.(ny).(nx) + 1;
                    loop ny nx dir hist
                )
            )
    in
    let hist = loop 0 0 1 [] in
    let l = List.length hist in
    let hist = List.rev hist in
    Printf.printf "%d\n" l;
    List.iter (fun (y, x, ny, nx) -> Printf.printf "%d %d %d %d\n" y x ny nx) hist
)

Measured memory_bytes: 18048
#include <iostream>
#include <bits/stdc++.h>
#define NMAX 100000
using namespace std;
int dp[NMAX];
 
 
int frogSolver(int n, int h[], int k){ 
  dp[0] = 0;
  
  for(int i=1; i<=k;i++){
    dp[i] = abs(h[0]-h[i]);   
  }
  for(int i = k+1; i<n;i++){
    int mini = INT_MAX;
    for(int j=i-k;j<i;j++){
      mini = min((abs(h[j]-h[i])+dp[j]),mini);
    }
    dp[i] = mini;
  }
 
  return dp[n-1]; 
 
}
 
int main(void) {
  int n,t,k;
  int h[NMAX];
  cin >> n;
  cin >> k;
  for(int i =0;i<n;i++){
    cin >> t;
    h[i] = t;
  }
 
  printf("%d \n",frogSolver(n,h,k));
  return 0;
}

Measured memory_bytes: 1024
N = int(input())
S = input()

r = 0
g = 0
b = 0
for i, s in enumerate(S):
    if s == 'R':
        r += 1
    elif s == 'G':
        g += 1
    else:
        b += 1

ans = r * g * b
for i in range(N-2):
    for j in range(i+1, N-1):
        if S[i] == 'R':
            if S[j] == 'G':
                if 2 * j - i < N and S[j + j - i] == 'B':
                    ans -= 1
            if S[j] == 'B':
                if 2 * j - i < N and S[j + j - i] == 'G':
                    ans -= 1
        elif S[i] == 'G':
            if S[j] == 'R':
                if 2 * j - i < N and S[j + j - i] == 'B':
                    ans -= 1
            if S[j] == 'B':
                if 2 * j - i < N and S[j + j - i] == 'R':
                    ans -= 1
        else:
            if S[j] == 'R':
                if 2 * j - i < N and S[j + j - i] == 'G':
                    ans -= 1
            if S[j] == 'G':
                if 2 * j - i < N and S[j + j - i] == 'R':
                    ans -= 1
print(ans)





Measured memory_bytes: 68584
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

N = getN()
if N % 10 == 3:
    print('bon')
elif N % 10 == 0 or N % 10 == 1 or N % 10 == 6 or N % 10 == 8:
    print('pon')
else:
    print('hon')

Measured memory_bytes: 68928
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		String s = br.readLine();
		int l = s.length();
		char last = s.charAt(0);
		int cnt = 0;
		for(int i = 1; i < l; i++){
			char c = s.charAt(i);
			if(c!=last){
				cnt++;
				last = c;
			}
		}
		sb.append(cnt);
		System.out.println(sb);
	}
}

Measured memory_bytes: 10836
#include<bits/stdc++.h>
using namespace std;
// #define ll long long int
#define int long long int
int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	string path;
	cin >> path;

	int f = 1;
	int k = max(c, d);
	for (int i = a - 1; i < n - 1 && i < k - 2; ++i)
	{
		if(path[i] == '#' && path[i + 1] == '#')
		f = 0;
	}
	int l = 1;
	if(f)
	{
		if(c > d)
		{
			 l = 0;
			for (int i = b - 1; i < d; ++i)
			{
				if(path[i] == '.' && path[i - 1] == '.' && path[i + 1] == '.')
				{
					l = 1;break;
				}
			} 
			if(l == 0)
				f = 0;
		}
	}

	if(f)
		cout << "Yes";
	else
		cout << "No";
	return 0;
}	

Measured memory_bytes: 592
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
using namespace std;

int main(void)
{
    string s;
    cin >> s;
    if(s <= "2019/04/30"){cout << "Heisei" << endl;}
    else{cout << "TBD" << endl;}
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			char c = in.nextChar();
			if(c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
				out.println("vowel");
			} else {
				out.println("consonant");
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public char nextChar() {
			return next().charAt(0);
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 22740
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>

using namespace std;

typedef unsigned long long ull;
const ull B= 100000007;

void contain(string a, string b){
	int al=a.length();
	int bl=b.length();
	//B???al???????¨????
	ull t=1;
	for(int i=0;i<al;i++) t*=B;
	
	//a??¨b????????????al???????????¢?????????????????\???????¨????
	ull ah=0,bh=0;
	for(int i=0;i<al;i++) ah=ah*B+a[i];
	for(int i=0;i<al;i++) bh=bh*B+b[i];
	
	//b?????´????????????????????????????????????????????\???????????§??????
	for(int i=0;i+al<=bl;i++){
		if(ah==bh) printf("%d\n",i);
		//if(i+al<bl) 
		bh=bh*B+b[i+al]-b[i]*t;
	}
}

int main(){
	bool ans;
	string T,P;
	cin>>T;
	cin>>P;
	if(T.size()>=P.size()){
		contain(P,T); //P???T?????????????????????????
	}
}

Measured memory_bytes: 5020
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

/* MACROS SAMPAH */
#define Jehian using
#define Norman namespace
#define Saviero std
#define cepet {ios_base::sync_with_stdio(0);cin.tie(0);}

Jehian Norman Saviero;

/* MACROS FOR TYPE */
typedef long l;
typedef long double ld;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;

/* MACROS FOR PRINT */
#define nl printf("\n")
#define sp printf(" ")

/* MACROS FOR FUNCTION AND METHOD */
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define eb emplace_back
#define RESET(x) memset((x), 0, sizeof(x))
#define SET(x,y) for(int _je = sizeof(x)/sizeof(x[0]); _je--;) x[_je] = y
#define SQR(x) (x)*(x)
#define CUBE(x) SQR(x)*(x)
#define ALL(x) (x).begin(), (x).end()
#define ALLSIZE(x,n) (x), (x)+(n)

/* MACROS FOR ATTRIBUTE */
#define fi first
#define se second

/* MACROS FOR SCAN */
#define scc(x) scanf("%c", &x)
#define scd(x) scanf("%Lf", &x)
#define scf(x) scanf("%f", &x)
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scld(x) scanf("%Lf", &x)
#define scui(x) sci(x)
#define scul(x) scl(x)
#define scull(x) scll(x)

#define special pair<pll,ll>

const ll MAX_PEOPLE = 1e6+10;
set<pll> kanan[MAX_PEOPLE];
ll posisi[MAX_PEOPLE];
ll visited[MAX_PEOPLE];
bool valid = true;

void dfs(ll i){
	for (auto& it : kanan[i]){
		if (!visited[i] && !visited[it.fi]){
			posisi[i] = 0;
			posisi[it.fi] = posisi[i]+it.se;
			visited[i] = true;
			visited[it.fi] = true;
			dfs(it.fi);
		} else if (visited[i] && !visited[it.fi]){
			posisi[it.fi] = posisi[i]+it.se;
			visited[it.fi] = true;
			dfs(it.fi);
		} else if (!visited[i] && visited[it.fi]){
			posisi[i] = posisi[it.fi]-it.se;
			visited[i] = true;
		} else {
			valid = valid && ((posisi[it.fi] - posisi[i]) == it.se);
		}
	}
}

int main(){
	ll N, M;
	cin >> N >> M;
	RESET(posisi);
	RESET(visited);
	ll a, b, c;
	for (ll i = 0; i < M; ++i){
		cin >> a >> b >> c;
		kanan[a].insert(mp(b,c));
		kanan[b].insert(mp(a,-c));
	}
	for (ll i = 1; i <= N && valid; ++i){
		if (!visited[i]){
			dfs(i);		
		}
	}
	puts(valid ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 90496
def resolve():
    (N, A, B, C) = list(map(int, input().split(" ")))
    ls = [int(input()) for i in range(N)]

    # input: i(lsのindexで、くっつけるかもしれない竹), a, b, c（作った竹の長さ）
    # output: cost
    # return: 長さa, b, cの竹を作るのに必要な最小コスト
    def get_cost(i, a, b, c):
        # 竹をくっつけたあと、微調整
        if (i == N):
            if (a == 0 or b == 0 or c == 0):
                return float('inf')
            diff = abs(A - a) + abs(B - b) + abs(C - c)
            return diff
        
        not_concat = get_cost(i+1, a, b, c) # 竹をくっつけない場合
        concat_a = get_cost(i+1, a+ls[i], b, c) + (0 if a == 0 else 10) # aに竹ls[i]をくっつける場合
        concat_b = get_cost(i+1, a, b+ls[i], c) + (0 if b == 0 else 10) # bに竹ls[i]をくっつける場合
        concat_c = get_cost(i+1, a, b, c+ls[i]) + (0 if c == 0 else 10) # cに竹ls[i]をくっつける場合

        return min([not_concat, concat_a, concat_b, concat_c])
    
    print(get_cost(0, 0, 0, 0))

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 3064
#include <stdio.h>

int main(void)
{
	int a,i,j;
	for(i=1;i<=9;i++){
		for(j=1;j<=9;j++){
		a=i*j;
		printf("%dx%d=%d\n",i,j,a);
		}
	}
	return 0;
}


Measured memory_bytes: 1996
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
sn = [list(input()) for i in range(n)]
snc = [Counter(sn[i]) for i in range(n)]

s = set(sn[0])
for i in range(n):
	s = s & set(sn[i])

s = sorted(list(s))
ans = ""
for c in s:
	m = float("inf")
	for i in range(n):
		m = min(m, snc[i][c])
	ans+=c*m

print(ans)

Measured memory_bytes: 9400
#include <iostream>
#define MOD 1000000007
using namespace std;

int main(void){
    long long n, m;
    cin >> n >> m;
    long long x[100005], y[100005];
    for(int i=1;i<=n;i++){
        cin >> x[i];
    }
    for(int i=1;i<=m;i++){
        cin >> y[i];
    }
    long long sumX = 0, sumY = 0;
    for(int i=1;i<=n;i++){
        sumX += ( ((i-1) * x[i]) % MOD - ((n-i) * x[i]) % MOD);
        sumX %= MOD;
       
    }
    for(int i=1;i<=m;i++){
    	sumY += ( ((i-1) * y[i]) % MOD - ((m-i) * y[i]) % MOD);
    	sumY %= MOD;
    }
	long long ans = ((sumX * sumY)%MOD + MOD ) %MOD;
	
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import java.lang.*;
import java.io.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		String u, nl = System.getProperty("line.separator");
		StringBuilder 
			p = new StringBuilder(1000),
		  	d = (new StringBuilder(100)).append("."),
		  	s = (new StringBuilder(100)).append("#"),
		  	k = new StringBuilder(100);
		Scanner r = new Scanner(System.in);
		int h, w, ww = 0x10;
		while (0 != (ww >>= 1)) {
			d.append(d);
			s.append(s);
		}
		ww = d.length();
		while (0 != ((h = r.nextInt()) | (w = r.nextInt()))) {
			while (w > ww) {
				d.append(d);
				s.append(s);
				ww <<= 1;
			}
			p.append(u = s.substring(0, w)).append(nl);
			k.setLength(0);
			k.append(d.substring(0, w)).append(nl)
			.replace(0, 1, "#").replace(w - 1, w, "#");
			while (2 != h--) {
				p.append(k);
			}
			p.append(u).append(nl).append(nl);
		}
		System.out.print(p);
	}
}

Measured memory_bytes: 18404
n = int(input())
L = list(map(int,input().split()))
L.sort()
cnt = 0
for i in range(0,n):
    for j in range(0,i+1):
        for k in range(0,j+1):
            if (L[k] != L[j] and L[j] != L[i] and L[k]+L[j] > L[i]):
                cnt += 1

print(cnt)


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

#define gcd(m,n) __gcd(m,n)
#define lcm(m,n) m*(n/gcd(m,n))
#define fast std::ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pi acos(-1.0)
#define endl '\n'
#define MOD 1000000007
#define ull unsigned long long
#define ll long long
#define ld long double
#define pb push_back
#define dbg(x) cout << #x << "  " << x << endl;

ll power(ll base, ll exp) 
{ll res=1;while(exp>0) {if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return res;}
ll mod(ll a, ll b) {return (a % b + b) % b;}

using namespace std;

int main() 
{	
	fast;
	ll n; cin>>n;
	unordered_map<string,ll>mp;
	for(ll i = 0; i < n; i++)
	{
		string s;
		cin>>s; mp[s]++;
	}
	cout << mp.size() << endl;
	return 0;
}

Measured memory_bytes: 17716
package main

import (
	"fmt"
)

func main() {
	var a, b, c, k int
	fmt.Scanf("%d %d %d %d", &a, &b, &c, &k)
	fmt.Println(checker(a, b, c, k))
}

func checker(a int, b int, c int, k int) int {
	if a > k {
		return k
	} else if a+b > k {
		return a
	}

	return a + (k-(a+b))*(-1)
}


Measured memory_bytes: 1820
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string s; cin>>s; int n= s.size()/2;
    int x = 0,cnt=0;
    char c = s[n];
    if(s.size()%2!=0){
    while(s[n+x]==c&&s[n-x]==c){
        
        cnt++;
        x++;
        if(n+x>=s.size()) break;
        }
    }
    else
    while(s[n-x-1]==c&&s[n+x]==c){
        cnt++;
        x++;
        if(n+x>=s.size()) break;
    }
    cout<<cnt+n<<endl;
}


Measured memory_bytes: 512