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

int main(){
  long long  A, B;
  long long res = 1;
  cin >> A >> B;

  long long i = 2;

  while(true){
    if(A%i==0 && B%i==0){
      A /= i;
      B /= i;
      res *= i;
    } else {
        if(i>=5000){
        res = res * A * B;
        break;
      }
      i++;
    }
  }

  cout << res << endl;
}


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

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int IINF = 2002002002;
constexpr ll LINF = 9009009009009009009LL;

//===




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

	Vi P(N);
	for (int i = 0; i < N; ++i) {
		cin >> P[i];
		--P[i];
	}

	Vi idx(N);
	for (int i = 0; i < N; ++i) {
		idx[P[i]] = i;
	}

	set<int> s;

	ll ans = 0;

	for (int x = N - 1; x >= 0; --x) {
		int idx_x = idx[x];

		s.insert(idx_x);
		auto it = s.find(idx_x);
		auto it_cpy = it;

		int l1 = -1, l2 = -1, r1 = N, r2 = N;
		if (it_cpy != s.begin()) {
			--it_cpy;
			l1 = *it_cpy;
		}
		if (it_cpy != s.begin()) {
			--it_cpy;
			l2 = *it_cpy;
		}

		it_cpy = it;

		if (it_cpy != s.end()) ++it_cpy;
		if (it_cpy != s.end()) {
			r1 = *it_cpy;
		}
		if (it_cpy != s.end()) ++it_cpy;
		if (it_cpy != s.end()) {
			r2 = *it_cpy;
		}

		ll c = static_cast<ll>(l1 - l2) * (r1 - idx_x) + static_cast<ll>(idx_x - l1) * (r2 - r1);

		ans += c * (x + 1);
	}

	cout << ans << endl;
}

Measured memory_bytes: 5760
def prime? n
  (2..Math.sqrt(n)).each do |sieve|
    return false if (n % sieve).zero? && !n.eql?(sieve)
  end
  true
end

n = gets.chop.to_i
cnt = 0

n.times do
  g = gets.chop.to_i
  cnt += 1 if prime? g
end

puts cnt

Measured memory_bytes: 6116
#include <bits/stdc++.h>
#define for1(a,b,i) for(int i=a;i<=b;++i)
#define FOR2(a,b,i) for(int i=a;i>=b;--i)
using namespace std;
typedef long long ll;
inline int read() {
	int f=1,sum=0;
	char x=getchar();
	for(;(x<'0'||x>'9');x=getchar()) if(x=='-') f=-1;
	for(;x>='0'&&x<='9';x=getchar()) sum=sum*10+x-'0';
	return f*sum;
}

#define M 500005
int n;
int a[M][2],sta[M];

int main () {
	//freopen("a.in","r",stdin);
	n=read();
	for1(1,n,i) {
		a[i][0]=read();
		a[i][1]=read();
		sta[i*2]=a[i][1];
		sta[i*2-1]=a[i][0];
	}
	sort(sta+1,sta+2*n+1);
	
	ll ans=0,sum=0;
	for1(1,n,i) ans+=a[i][0],sum+=a[i][1];
	ans=min(ans,sum),sum=0;
	for1(1,n,i) sum+=sta[i];
	for1(1,n,i) {
		if(max(a[i][0],a[i][1])<sta[n]) return printf("%lld\n",sum),0;
		if(min(a[i][0],a[i][1])>sta[n]) return printf("%lld\n",sum),0;
		
		ll now=sum;
		now+=max(a[i][0],a[i][1])-sta[n];
		now+=max(0,min(a[i][0],a[i][1])-sta[n-1]);
		ans=min(ans,now);
	}
	printf("%lld\n",ans);
}

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

int main() {
int n;
cin >> n;
ll ans = 0;
 rep(i,n)rep(j,n)rep(k,n) ans += gcd(i,gcd(j,k));
  
    cout << ans << endl;

return 0;

}


Measured memory_bytes: 3636
<?php
  $str = trim(fgets(STDIN));
  $input = str_split($str);
  $s1 = $input[0];
  $s2 = "";
  $c1 = 1;
  $c2 = 0;
  for($i=1;$i<4;$i++){
  	if($input[$i]!=$s1){
      $s2 = $input[$i];
    }
  }
  for($i=1;$i<4;$i++){
  	if($input[$i]==$s1){
      $c1++;
    }elseif($input[$i]==$s2){
      $c2++;
    }
  }

  if($c1==2 and $c2==2){
	echo("Yes");
  }else{
    echo("No");
  }

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(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;}

bool solve(string s){
    if(s[0]!='A') return false;
    int cnt=0;
    for(int i =2; i<=s.size()-2; i++){
        if(s[i]=='C')cnt++;
    }
    if(cnt!=1) return false;
    cnt = 0;
    rep(i, s.size()){
        int tmp = s[i]-'a';
        if(tmp<0 || tmp>25) cnt++;
    }
    if(cnt!=2) return false;
    return true;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    string asn = solve(s)?"AC":"WA";
    cout<<asn<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        double sum = IntStream.range(0, n).mapToDouble(i -> {
            String x = scan.next();
            String u = scan.next();
            double total = 0;
            if ("BTC".equals(u)) {
                total += Double.parseDouble(x) * 380000;
            } else {
                total += Integer.parseInt(x);
            }
            return total;
        }).sum();
        System.out.println(sum);
    }
}

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

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src_, int dst_, Weight weight_) :
        src(src_), dst(dst_), weight(weight_) { }
};
bool operator < (const Edge &e, const Edge &f) {
    return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
        e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int const MAX_V = 10010;
vector<int> stronglyConnectedComponents(Graph const & g){
    static int cmp[MAX_V];
    static int added[MAX_V], visited[MAX_V], ord[MAX_V], S[MAX_V];
    const int n = g.size();
    Graph rg(n);
    for(int i = 0; i < n; i++){
        for(auto &e : g[i]) rg[e.dst].eb(e.dst, e.src, e.weight);
        added[i] = visited[i] = cmp[i] = 0;
    }
    int sz = 0;
    for(int i = 0; i < n; i++){
        if(visited[i]) continue;
        int s = 0;
        S[s++] = i;
        while(s){
            int v = S[s-1];
            visited[v] = true;
            bool pushed = false;
            for(auto & e : g[v]){
                int dst = e.dst;
                if(visited[dst]) continue;
                S[s++] = dst;
                pushed = true;
            }
            if(!pushed){
                int t = S[--s];
                if(added[t]) continue;
                added[t] = true;
                ord[sz++] = t;
            }
        }
    }
    int k = 1;
    for(int i = 0; i < n; i++){
        int u = ord[n-i-1];
        if(cmp[u]) continue;
        int s = 0;
        S[s++] = u;
        while(s){
            int v = S[--s];
            cmp[v] = k;
            for(auto & e : rg[v]){
                int d = e.dst;
                if(!cmp[d]) S[s++] = d;
            }
        }
        k++;
    }
    return vector<int>(cmp, cmp+n);
}

int main(){
    int n,m;
    scanf("%d%d", &n,&m);
    Graph g(n);
    rep(i,m){
        int a,b;
        scanf("%d%d", &a,&b);
        g[a].eb(a,b,0);
    }
    vector<int> c = stronglyConnectedComponents(g);
    int q; cin >> q;
    rep(i,q){
        int a,b;
        scanf("%d%d", &a,&b);
        printf("%d\n", c[a]==c[b]);
    }
}

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

long long n, zero = 0, one = 0;
vector<long long> a, b;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    long long p;
    cin >> p;
    if(p == 0)
      ++zero;
    else if(p == 1)
      ++one;
    else
      a.push_back(p);
  }
  sort(a.begin(), a.end(), greater<long long>());
  if(n == a.size() && n == 2 && a[0] == 3 && a[1] == 2) {
    for(auto p : a) cout << p << endl;
    return 0;
  }
  for(int i = 0; i < zero; ++i) b.push_back(0);
  if(zero % 2) {
    if(one > 0) {
      b.back() = 1;
      --one;
      b.push_back(0);
    }
    else if(a.size()) {
      b.back() = a.back();
      a.pop_back();
      b.push_back(0);
    }
  }
  for(int i = 0; i < one; ++i) b.push_back(1);
  sort(a.begin(), a.end());
  n = a.size();
  if(n >= 2 && a[n - 1] == 3 && a[n - 2] == 2)
    swap(a[n - 1], a[n - 2]);
  for(auto p : a) cout << p << endl;
  for(auto p : b) cout << p << endl;
  return 0;
}


Measured memory_bytes: 3144
#include<stdio.h>
int main(void) {
    int a,b;
    scanf("%d%d",&a,&b);
    int n = 0;
    if(a >= 13) {
        n += b;
    } else if(a >= 6) {
        n += b/2;
    }
    printf("%d\n",n);
    return 0;
}

Measured memory_bytes: 128
def kakuketa(p):
    s=0
    while p>0:
       s+=p%10
       p=p//10
    return s

A=[]
n=int(input())
for i in range(1,n):
    j=n-i
    if i+j==n:
        A.append(kakuketa(i)+kakuketa(j))
print(min(A))

Measured memory_bytes: 3864
#include<iostream>
#include<vector>
#include<algorithm>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;

int main()
{
  int n;
  cin >> n;
  int a[n][n];
  int dp[n][n];
  int rdp[n][n],cdp[n][n];
  int mex = -100000000;
  rep(i,n)rep(j,n)
    {
      cin >> a[i][j];
      rdp[i][j] = cdp[i][j] = -100000000;
      mex = max(mex,a[i][j]);
    }
  if(n == 1)
    {
      cout << a[0][0] << endl;
      return 0;
    }

  rep(i,n)
    {
      rdp[i][0] = a[i][0];
      REP(j,1,n)
	{
	  rdp[i][j] = max(rdp[i][j],rdp[i][j-1]+a[i][j]);
	  mex = max(mex,rdp[i][j]); 
	}
    }

  rep(x,n)
    {
      cdp[0][x] = a[0][x];
      REP(y,1,n)
	{
	  cdp[y][x] = max(cdp[y][x],cdp[y-1][x]+a[y][x]);
	  mex = max(mex,cdp[y][x]);
	}
    }

  rep(i,n)
    {
      dp[i][0] = a[i][0];
      REP(j,1,n)
	{
	  dp[i][j] = dp[i][j-1] + a[i][j];
	  mex = max(mex,dp[i][j]);
	}
    }

  REP(i,1,n)rep(j,n)dp[i][j] = dp[i][j] + dp[i-1][j],mex = max(mex,dp[i][j]);



  REP(i,1,n)
    {
      REP(j,1,n)
	{
	  for(int y=i-1;y>=0;y--)
	    {
	      for(int x=j-1;x>=0;x--)
		{
		  int a,b,c;
		  a = x-1>=0?dp[i][x-1]:0;
		  b = y-1>=0?dp[y-1][j]:0;
		  c = (x-1>=0 && y-1>=0)?dp[y-1][x-1]:0;
		  int area = dp[i][j] - (a+b) + c;
		  mex = max(area,mex);		  
		}
	    }
	}
    }


  cout << mex << endl;  
  return 0;
}

Measured memory_bytes: 1316
#include<stdlib.h>
#include<stdio.h>
int cnm(int *a,int *b)
{
    return *a-*b;
}
int main()
{
    int a,b,c,d=0;
    scanf("%d %d",&a,&c);
    int op[a];
    for(b=0;b<a;b++)
        scanf("%d",&op[b]);
    qsort(op,a,sizeof(op[0]),cnm);
    for(b=0;b<c;b++)
        d+=op[b];
    printf("%d",d);
    return 0;
}


Measured memory_bytes: 2204
using System;
using System.Linq;

namespace arc073_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] t = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long ret = x[1];
            for (int i = 1; i < x[0]; i++)
            {
                ret += Math.Min(t[i] - t[i - 1], x[1]);
            }
            Console.WriteLine(ret);
        }
    }
}

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

using namespace std;

typedef long long int llint;
typedef pair<int, int> pii;
typedef pair<llint, llint> pll;
typedef vector<int> vi;
typedef vector<llint> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define ci cin
#define co cout
#define en endl
#define ln cout<< '\n'
#define rep(i, n) for(int i = 0; i < n; i++)
#define outl(x) cout<< (x) << '\n'
#define pb push_back
#define fi first
#define se second
#define MOD 1000000007

template<typename Tn> Tn gcd(Tn a, Tn b)
{
    return (b ? gcd(b, a % b) : a);
}

template<typename Tn> Tn lcm(Tn a, Tn b)
{
    return a / gcd(a, b) * b;
}

string IntToString(int number)
{
    stringstream ss;
    ss << number;
    return ss.str();
}

llint cnt = 0;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

int n;
string str[10010];

int main()
{
    int a, b, ab;
    a = b = ab = 0;
    
    ci >> n;
    rep(i, n) {
	ci >> str[i];

	int pos = 0;
	while(1) {
	    auto tmp = str[i].find("AB", pos);
	    if(tmp != string::npos) {
		cnt++;
		pos = tmp + 1;
	    } else break;
	}

	int len = str[i].size();
	if(str[i][len - 1] == 'A' && str[i][0] == 'B') ab++;
	else if(str[i][len - 1] == 'A') a++;
	else if(str[i][0] == 'B') b++;
    }

    if(ab > 0) {
	cnt += ab - 1;
	if(a > 0) cnt++, a--;
	if(b > 0) cnt++, b--;
    }

    cnt += min(a, b);
    
    co << cnt << en;
    
  
    return 0;
}


Measured memory_bytes: 768
#include <stdio.h>

int min(int, int);

int main(){
  int n, i, p[100], x, m[100][100], k, l, j, q;


  scanf("%d", &n);
  for(i = 1; i <= n; i++) scanf("%d %d", &p[i - 1], &p[i]);

  for(i = 1; i <= n; i++) m[i][i] = 0;
  for(l = 2; l <= n; l++){
    for(i = 1; i <=  n-l+1; i++){
      j = i + l - 1;
      m[i][j] = 100000;
      for(k = i; k <= j-1; k++){
	q = m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j];
	m[i][j] = min(m[i][j], q);
	}
      }
    }
  printf("%d\n", m[1][n]);

  return 0;
}

int min(int x, int y){

  if(x > y) return y;
  else return x;
}

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

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

string lst[]={"dream","dreamer","erase","eraser"};

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	reverse(s.begin(),s.end());
	for (int i=0; i<4; i++)
		reverse(lst[i].begin(),lst[i].end());
	int n=s.size();
	for (int i=0; i<n; i++) {
		bool up=false;
		for (int j=0; j<4; j++) {
			int l=lst[j].size();
			if(s.substr(i,l)!=lst[j])
				continue;
			i+=l-1;
			up=true;
		}
		if(!up) {
			cout<<"NO\n"; return 0;
		}
	}
	cout<<"YES\n";
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  if(s[s.size()-1]!='s'){
    s.push_back('s');
  }else{
    s.push_back('e');
    s.push_back('s');
  }
  cout << s << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

int main(){
    ll n, t;
    cin >> n >> t;
    vi s(n);
    rep(i, n){
        cin >> s[i];
    }

    ll ans = 0;
    for(ll i = 1; i < n; i++){
        if(s[i]-s[i-1] <= t)
            ans += s[i] - s[i-1];
        else
            ans += t;
    }
    cout << ans + t << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
#define MOD 1000000007
#define FormulaToConvertMicrosecondsToSeconds(duration) duration / 1e+6
#define _CRT_SECURE_NO_DEPRECATE
#define ll                    long long
#define nl                    '\n'                             // NL - sign of new line

#define upperString(str)      transform(str.begin(), str.end(), str.begin(), ::toupper); // make entire string uppercase
#define lowerString(str)      transform(str.begin(), str.end(), str.begin(), ::tolower); // make entire string lowercase

#define ps(x,y)               fixed << setprecision(y) << x     // usage: t=1.1234; cout << ps(t,4); // it means it will print 4 decimal places.

#define eb                    emplace_back
#define sortv(v)              sort(v.begin(), v.end());
#define rsortv(v)             sort(v.rbegin(), v.rend());
#define rev(v)		          reverse(v.begin(), v.end())       // reverse the vector

#define si                    set<int>

#define mii			          std::map <int,int>
#define multimii		      std::multimap <int,int>
#define mss			          map <string, string>
#define w(t)                  unsigned t; cin >> t; while(t--)
mt19937                       rng(chrono::steady_clock::now().time_since_epoch().count());

void solve();
//==================================

bool isPrime(int num) {
	if (num == 1) return false;
	for (int i = 2; i <= sqrt(num); i++) {
		if (num % i == 0) return false;
	}
	return true;
}

ll binarySearch(int a[], int l, int r, int x)
{
	while (l <= r)
	{
		int mid_index = l + (r - l) / 2;

		if (a[mid_index] == x)
			return mid_index;
		else if ( x > a[mid_index])
		{
			l = mid_index + 1;
		}
		else if ( x < a[mid_index])
		{
			r = mid_index - 1;
		}
	}
	return -1;
}

ll fast_power(ll base, ll power) {
	ll result = 1;
	while (power > 0) {

		// if( power % 2 == 1)
		if (power & 1) { // Can also use (power & 1) to make code even faster
			result = (result * base) % MOD;
		}
		base = (base * base) % MOD;

		// power /= 2
		power >>= 1; // Can also use power >>= 1; to make code even faster
	}
	return result;
}

//==================================
int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	//--------------------------------
	auto t1 = std::chrono::high_resolution_clock::now();

	//int t = 1;
	//cin >> t;
	//while (t--)
	//{

	solve();
	//}



	auto t2 = std::chrono::high_resolution_clock::now();
	auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count();

	cerr << "\n\nTime taken : " << FormulaToConvertMicrosecondsToSeconds(duration) << " secs" << nl;
	return 0;
}

void solve() //Task A. Double Cola!!! Two teams composing !
{

	ll h;
	int n, a;
	cin >> h >> n;

	int sum = 0;
	while (n--)
	{
		cin >> a;
		sum += a;
	}

	cout << ((sum >= h) ? "Yes" : "No");


} // !solve


/* TESTS:


*/

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

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int length = str.length();
        
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<length; i++){
            //1文字ずつ確認
            char c = str.charAt(i);
            //大文字の場合、小文字変換
            if(Character.isUpperCase(c)) sb.append(Character.toLowerCase(c));
            //小文字の場合、大文字変換
            else if(Character.isLowerCase(c)) sb.append(Character.toUpperCase(c));
            //上記以外の場合、そのまま出力
            else sb.append(c);
        }
        System.out.println(sb);


    }

}




Measured memory_bytes: 26092
C = [[int(i) for i in input().split()] for k in range(3)]
tC = [list(k) for k in zip(*C)]
for i in range(2):
    p = [C[i][k]-C[i+1][k] for k in range(3)]
    tp = [tC[i][k]-tC[i+1][k] for k in range(3)]
    if p[0] == p[1] == p[2] and tp[0] == tp[1] == tp[2]:
        continue
    else:
        print("No")
        exit()
else:
    print("Yes")

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

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

const ld pi = 3.141592653589793;

int h, w, k, ans;
char c[10][10];

int main() {
  cin >> h >> w >> k;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> c[i][j];
    }
  }

  for (int i = 0; i < (1 << h); i++) {
    for (int j = 0; j < (1 << w); j++) {
      int rem = 0;
      for (int p = 0; p < h; p++) {
        for (int q = 0; q < w; q++) {
          if (c[p][q] == '#' && (i & (1 << p)) && (j & (1 << q))) {
            rem++;
          }
        }
      }
      if (rem == k) {
        ans++;
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
long long int q[100001]={0};
int main(){
long long int i,j,n,m,a,b,c,o,l,t,g=0,k;
cin>>n>>m;
cin>>l;
for(i=1;i<m;i++){
cin>>o;
if(o>l){
a=o;
b=l;
}
else{
a=l;
b=o;
}
for(j=a-1;j>=b;j--)q[j]++;
l=o;
}
for(i=1;i<n;i++){
cin>>a>>b>>c;
k=min(a*q[i],b*q[i]+c);
g+=k;
}
cout<<g<<endl;
return 0;
}

Measured memory_bytes: 3856
// Package main provides
//
// File:  a.go
// Author: ymiyamoto
//
// Created on Wed Dec  5 01:13:12 2018
//
package main

import "fmt"

var k int

func main() {
	fmt.Scan(&k)
	half := k / 2
	if k%2 == 0 {
		fmt.Println(half * half)
	} else {
		fmt.Println(half * (half + 1))
	}
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC043A
{
    class Program
    {
        static void Main(string[] args)
        {
            int x;
            x = int.Parse(Console.ReadLine());
            int n = 0;
            for(int i=1;i<=x; i++)
            {
                n += i;
            }
            Console.WriteLine(n);
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
<?php
/*
    Problem URL : https://beta.atcoder.jp/contests/abc065/tasks/abc065_b

    Score  :
    Result :
    Time   : ms
    Memory : KB
 */

// define('DEBUG', true);
define('DEBUG', false);

ini_set('error_reporting', E_ALL & ~E_NOTICE);

fscanf(STDIN, "%d", $N);
$m = array();
$cursor = 1;
$ans = 0;

for ($i = 1; $i <= $N; $i++) {
    fscanf(STDIN, "%d", $a[$i]);
}

while(true) {
    $ans++;
    $cursor = $a[$cursor];
    if ($m[$cursor] == 1) {
        echo "-1\n";
        exit;
    }
    $m[$cursor] = 1;
    if ($cursor == 2) {
        echo $ans . PHP_EOL;
        exit;
    }
}


Measured memory_bytes: 17140
var x = require('fs').readFileSync('/dev/stdin', 'utf8').split(" ")
var w = x[0]*1
var h = x[1]*1
var a = x[2]*1
var b = x[3]*1
var r = x[4]*1

if(a >= r && b >= r && (w-a) >= r && (h-b) >= r)
    console.log("Yes");
else console.log("No");


Measured memory_bytes: 15344
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		String s3 = scan.next();
		System.out.println(s1.charAt(0) + "" + s2.charAt(1) + "" + s3.charAt(2));
	}
}

Measured memory_bytes: 19920
#include <stdio.h>

int main(void) {
	int a, b, c, d, p, money1, money2;
	scanf("%d%d%d%d%d",&a,&b,&c,&d,&p);
	
	money1= a*p;
	if(p<c){
		money2= b;
		}else{
		money2= b + (p-c)*d;
		}
	
	if(money1 < money2){
		printf("%d\n", money1);
		}else{
		printf("%d\n", money2);
		}
		
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;
template <typename T> using vvec = vector<vector<T>>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
    if (b <= 0) { return 1; } if (b == 1) { return a % mod; } if (b == 2) { return (a * a) % mod; }
    return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) % mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
    return (a * mpow(b, mod - 2, mod)) % mod;
}

int main() {
    int d, n; cin >> d >> n;
    int ans = pow(100, d) * n;
    if (n == 100) ans = pow(100, d) * 101;
    cout << ans << endl;
}



Measured memory_bytes: 3800
# /usr/bin/python
# -*- coding: utf-8 -*-
import math
from collections import defaultdict


int(input())
Ln = [0, 0]
mydict = defaultdict(lambda:0)
for a in list(map(int, input().split())):
  mydict[a] += 1
  if mydict[a] == 2:
    Ln.append(a)
    mydict[a] = 0
Ln = sorted(Ln,reverse=True)
print(Ln[0]*Ln[1])

Measured memory_bytes: 68376
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define x first
#define y second
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod = 998244353 ;
using namespace std;
void add(ll& a , ll b){
	a += b;
	if(a >= mod) a -= mod;
}
ll mul(ll a , ll b){
	return (a * b) % mod;
}

int main(){
	IOS;
	int n ; cin >> n ;
	vll a(n) ; for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	ll sum = 0 ;
	for(int i = 0 ; i < n ; i++) sum ^= a[i] ;
	if(sum) cout << "No"<< endl ;
	else cout << "Yes" << endl ;
	
	return 0;
}


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


Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		int N = nextInt();
		ArrayList<String> list = nextStrArray();
		for(int i = 0; i < N; i++){
			if(list.get(i).equals("Y")){
				myout("Four");
				return;
			}
		}
		myout("Three");
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32680
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      s: chars,
    }
    let t = "keyence".to_string();
    for i in 0..s.len() as i64 {
        for l in 0..s.len() as i64 {
            let mut ss = vec![];
            for ii in 0..s.len() as i64 {
                if ii >= i && ii <= i+l-1 {
                    continue;
                }
                ss.push(s[ii as usize])
            }
            let s2: String = ss.iter().map(|&v| v).collect();
            if s2 == t {
                println!("{}", "YES");
                return;
            }
        }
    }
    println!("{}", "NO");
}



Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	int pn = 1;
	if (ci - cn + 16 > cm) {
		if ((ct = getcha()) == '-') { pn = -1; ct = getcha(); }
		A = ct - '0';
		while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
	else {
		if ((ct = *ci++) == '-') { pn = -1; ct = *ci++; }
		A = ct - '0';
		while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';;
		return pn * A;
	}
}

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


	int N = getint();
	int RR = -1e9;
	int RL = -1e9;
	int RUD = -1e9;
	int LR = 1e9;
	int LL = 1e9;
	int LUD = 1e9;
	int UU = -1e9;
	int UD = -1e9;
	int URL = -1e9;
	int DU = 1e9;
	int DD = 1e9;
	int DRL = 1e9;
	bool R = false;
	bool L = false;
	bool U = false;
	bool D = false;

	rep(i, N) {
		int x = getint(), y = getint();
		char d = getcha();
		getcha();

		if (d == 'R') {
			R = true;
			RR = max(RR, x);
			LR = min(LR, x);
			URL = max(URL, y);
			DRL = min(DRL, y);
		}
		else if (d == 'L') {
			L = true;
			RL = max(RL, x);
			LL = min(LL, x);
			URL = max(URL, y);
			DRL = min(DRL, y);
		}
		else if (d == 'U') {
			U = true;
			RUD = max(RUD, x);
			LUD = min(LUD, x);
			UU = max(UU, y);
			DU = min(DU, y);
		}
		else {
			D = true;
			RUD = max(RUD, x);
			LUD = min(LUD, x);
			UD = max(UD, y);
			DD = min(DD, y);
		}
	}

	vector<double> kouho;
	kouho.pb(0);

	if (R && L) {
		kouho.pb(0.5 * (RL - RR));
		kouho.pb(0.5 * (LL - LR));
	}
	if (R && (U || D)) {
		kouho.pb(RUD - RR);
		kouho.pb(LUD - LR);
	}
	if (L && (U || D)) {
		kouho.pb(RL - RUD);
		kouho.pb(LL - LUD);
	}
	if (U && D) {
		kouho.pb(0.5 * (UD - UU));
		kouho.pb(0.5 * (DD - DU));
	}
	if (U && (R || L)) {
		kouho.pb(URL - UU);
		kouho.pb(DRL - DU);
	}
	if (D && (R || L)) {
		kouho.pb(UD - URL);
		kouho.pb(DD - DRL);
	}

	double saishou = 1e20;
	for (double D : kouho) {
		if (D >= 0) {
			double Xmax = max({ RR + D, RL - D, (double)RUD });
			double Xmin = min({ LR + D, LL - D, (double)LUD });

			double Ymax = max({ UU + D, UD - D, (double)URL });
			double Ymin = min({ DU + D, DD - D, (double)DRL });

			saishou = min(saishou, (Xmax - Xmin) * (Ymax - Ymin));
		}
	}
	
	cout << fixed << setprecision(12) << saishou << endl;

	Would you please return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int main()
{
	short N;
	scanf("%hd",&N);
	float b;
	if(N%2==0)
	{
		b=0.5;
	}
	else
	{
		b=(float)(N/2+1)/N;
	}
	printf("%0.10f",b);
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
typedef long long ll;
typedef unsigned long long ull;

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

	bell_max = max(a, b);
	bell_max = max(bell_max, c);

	cout << a + b + c - bell_max << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using st = string;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define chmax(x, y) { x = max(x, y); }
#define chmin(x, y) { x = min(x, y); }
#define INF 1e10

int main() {
    int x;
    cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(void)
{
	char num[1001];
	int sum, i;
	
	while(1) {
		sum=0;
		scanf("%s", num);
		if(num[0]=='0') break;
		for(i=0; num[i]!='\0'; i++) {
			sum+=num[i]-'0';
		}
	printf("%d\n", sum);
	}
	
	return 0;
}


Measured memory_bytes: 536
d = int(input())
c = list(map(int,input().split()))
s_di=[list(map(int,input().split())) for i in range(d)]
last=[0 for i in range(26)]

#donyoku
for i in range(1,d+1):
    tmp_max=-10**6
    tmp_choice=-1
    fuman=sum([(i-last[k])*c[k] for k in range(26)])
    for j in range(26):
        tmp=-fuman+(i-last[j])*c[j]+s_di[i-1][j]
        if tmp>tmp_max:
            tmp_max=tmp
            tmp_choice=j
    print(tmp_choice+1)
    last[j]=i


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

int main(){
    int N;
    int res = 0;
    cin>>N;
    vector<vector<int>> G(N,vector<int>(N,-1));
    for(int i=0;i<N;i++){
        int A;
        cin>>A;
        for(int j=0;j<A;j++){
            int x,y;
            cin>>x>>y;x--;
            G[i][x]=y;
        }
    }
    for(int bit=0;bit<(1<<N);bit++){
        vector<int> honest(N,0);
        for(int i=0;i<N;i++){
           if(1 & (bit >> i))honest[i]=1;
        }
        bool ok=true;
        for(int j=0;j<N;j++){
            if(!honest[j])continue;
            for(int k=0;k<N;k++){
                if(G[j][k]==-1)continue;
                if(G[j][k]!=honest[k])ok=false;
            }
        }
        if(ok)
        {
            res=max(res,accumulate(honest.begin(),honest.end(),0));
        }
    }
    cout<<res; 
    return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<b;++i) 
#define ROF(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vlli vector<long long int>
#define pb push_back
#define mp make_pair
#define all(c)  ((c).begin()), ((c).end())
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	string s;
	cin>>s;
	FOR(i,0,s.length()-1){
		if(s[i]=='A'&&s[i+1]=='C'){
			cout<<"Yes";
			exit(0);
		}
	}
	cout<<"No";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
#define vll vector<ll>
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

template<typename T>
void vecin(vector<T>& v, int n = 0){
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n; ++i)
    {
        cin >> v[i];
    }
}
template <typename T>
void vecout(vector<T> &v, int n = 0)
{
    if (n == 0)
        n = v.size();
    for (int i = 0; i < n-1; ++i)
    {
        cout << v[i] << " ";
    }
    cout << v[n - 1] << endl;
}
void print(string s){
    cout << s << endl;
}
struct edge{
    int to, from;
};

int main()
{
    ciosup;
    int n;
    cin >> n;
    cout << n*n*n << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		while(true){
			//数字(文字列)を入力
			String scanNum = scan.nextLine();

			//入力された数字が０の時終了
			if(scanNum.equals("0")){
				break;
			}

			//各位の合計
			int sumNum = 0;

			for(int i = 0 ;i < scanNum.length() ;i++){
				//入力された数値の各位をリストに追加
				Character placeNum = scanNum.charAt(i);
				//リストに追加された数値を合計に加算していく
				sumNum += Character.getNumericValue(placeNum);
			}
			System.out.println(sumNum);
		}
		scan.close();
	}
}



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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef pair<ll,pair<ll,ll>> PP;
#define fi          first
#define se          second
#define pb          push_back
#define INF         INT_MAX
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define dbg(x)      cout<<#x"="<<x<<endl
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     upper_bound(all(x),y)-x.begin()
#define lb(x,y)     lower_bound(all(x),y)-x.begin()
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
ll h,w;
DVector c(10,Vector(10));
Vector a;
void create_cost(){
  rep(k,10)rep(i,10)rep(j,10)if(c[i][j] > c[i][k]+c[k][j])c[i][j] = c[i][k]+c[k][j];
}


int main(){
  cin.sync_with_stdio(false);
  cin >> h >> w;
  rep(i,10)rep(j,10)cin >> c[i][j];
  rep(i,h)rep(j,w){
    ll ta;
    cin >> ta;
    if(ta>=0)a.pb(ta);
  }
  create_cost();
  ll ans = 0;
  each(itr,a)ans+=c[itr][1];
  cout << ans << endl;
}


Measured memory_bytes: 892
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    string s;
    cin >> s;

    if (s[1] == 'B') s[1] = 'R';
    else s[1] = 'B';

    cout << s << "\n";
    return 0;
}

Measured memory_bytes: 3652
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

s = input()

year = int(s[0:4])
month = int(s[5:7])
day = int(s[9:])



if (year > 2019):
    print("TBD")
elif (year < 2019):
    print("Heisei")
else:
    if (month > 4):
        print("TBD")
    elif (month < 4):
        print("Heisei")
    else:
        if (day > 30):
            print("TBD")
        else:
            print("Heisei")






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



int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	string s, t;
	int n;
	cin >> n;
	cin >> s >> t;
	string k = "";
	for (int i = 0; i < s.size(); ++i){
		k += s[i];
		k += t[i];
	}
	cout << k << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int mizuhasikaori(const void* x, const void* y) {
	int a = *(const int*)x, b = *(const int*)y;
	return a < b ? -1 : a > b;
}

int N, C, K;
int T[114514];

int main(void) {
	int i;
	int kyaku = 0;
	int saisyo = 0;
	int kotae = 0;
	if (scanf("%d%d%d", &N, &C, &K) != 3) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &T[i]) != 1) return 1;
	}
	qsort(T, N, sizeof(*T), mizuhasikaori);
	for (i = 0; i < N; i++) {
		if (kyaku <= 0) {
			saisyo = T[i];
		} else if (T[i] - saisyo > K) {
			kotae++;
			saisyo = T[i];
			kyaku = 0;
		}
		kyaku++;
		if (kyaku >= C) {
			kyaku = 0;
			kotae++;
		}
	}
	if (kyaku > 0) kotae++;
	printf("%d\n", kotae);
	return 0;
}


Measured memory_bytes: 892
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Array
import Data.List.Split (splitOn)

main :: IO ()
main = do
  n <- getl toInt
  when (n /= 0) $ do
    m <- getl toInt
    xs <- rgetl m $ map toInt . splitOn ","
    print $ solve n xs
    main
    
solve :: Int -> [[Int]] -> Int
solve n xs = mst adj 0 [0] [1..n-1]
  where
    adj = foldl (\ar [i,j,l] -> ar // [((i,j),l),((j,i),l)]) (listArray ((0,0),(n-1,n-1)) $ repeat infty) xs
    
mst :: Array (Int,Int) Int -> Int -> [Int] -> [Int] -> Int
mst adj s us vs
  | null vs = s
  | otherwise = mst adj (s + l `div` 100 - 1) (i:us) (delete i vs)
  where
    (l,(_,i)) = minimum [(adj ! (u,v),(u,v)) | u <- us, v <- vs]

infty :: Int
infty = 2000000000

toInt :: String -> Int
toInt s = read s

getl :: (String -> a) -> IO a
getl f = f <$> getLine

rgetl :: Int -> (String -> a) -> IO [a]
rgetl n f = map f <$> replicateM n getLine

Measured memory_bytes: 14484
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s_1:chars,
        s_2:chars,
        s_3:chars,
    }
    let mut ans = String::new();
    let mut a:char = s_1[0];
    let mut b:char = s_2[0];
    let mut c:char = s_3[0];
    ans.push(a);
    ans.push(b);
    ans.push(c);
    ans = ans.to_uppercase();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node{int p,r,l;};
struct Node T[MAX];
int n,D[MAX];
int search(int,int);
void print(int);
int main(){
  int i,j,r;
  int v,d,c,l;
  scanf("%d",&n);
  for(i=0;i<n;i++)T[i].p=T[i].r=T[i].l=NIL;
  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0)T[v].l=c;//子供として
      else T[l].r=c;//兄弟として
      l=c;//?
      T[c].p=v;//親を設定
    }
  }
  for(i=0;i<n;i++){
    if(T[i].p==NIL)r=i;
  }
  search(r,0);
  for(i=0;i<n;i++)print(i);
  return 0;
}

int search(int u,int p){
  D[u]=p;
  //printf("%d\n",D[u]);
  if(T[u].r!=NIL)search(T[u].r,p);
  if(T[u].l!=NIL)search(T[u].l,p+1);
}

void print(int u){
  int i,c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);
  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}



Measured memory_bytes: 6376
#include<cstdio>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
	int t,map[12][12],sum,ans,s,i,j,k,max0,a,b,c;
	while(scanf("%d",&t) && t)
	{
		memset(map,1,sizeof(map));
		max0=0;
		for(i=0;i<t;i++)
		{
			scanf("%d %d %d",&a,&b,&c);
			map[a][b]=map[b][a]=c;
			max0=max(max0,max(a,b));
		}
	/*	printf("%d\n\n",max0);
		 for(i=0;i<=max0;i++)
		 {
		 	for(j=0;j<=max0;j++)
		 	{
		 		printf("%d  ",map[i][j]);
		 		if(j == max0)
		 			printf("\n");
			 }
		 }*/
		for(k=0;k<=max0;k++)
		{
			for(i=0;i<=max0;i++)
			{
				for(j=0;j<=max0;j++)
				{
					map[i][j]=min(map[i][j],map[i][k]+map[k][j]);
				}
			}
		}
		sum=10000000,ans=0;
		for(i=0;i<=max0;i++)
		{
			s=0;
			for(j=0;j<=max0;j++)
			{
				if(i != j)
				{
					s+=map[i][j];
				}
			}
			if(s < sum)
			{
				sum=s;
				ans=i;
			}
		}
		printf("%d %d\n",ans,sum);
	}
}

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

int main()
{
    int D;
    cin >> D;
    if (D == 25)
    {
        cout << "Christmas" << endl;
    }
    else if (D == 24)
    {
        cout << "Christmas Eve" << endl;
    }
    else if (D == 23)
    {
        cout << "Christmas Eve Eve" << endl;
    }
    else if (D == 22)
    {
        cout << "Christmas Eve Eve Eve" << endl;
    }
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii; typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <class F,class ...S> void dbg(const F& f, const S&...s){cerr <<f <<": "; dbg(s...);}


int main()
{
	const int CMX=3000;
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n, m, s;
	cin >>n >>m >>s;
	
	vector<vector<VI>> r(n);
	rep(i, m){
		int u, v, a, b;
		cin >>u >>v >>a >>b;
		r[u-1].push_back(VI{v-1, a, b});
		r[v-1].push_back(VI{u-1, a, b});
	}
	VI c(n), dx(n);
	rep(i, n) cin >>c[i] >>dx[i];
	s = min(CMX, s);

	typedef tuple<ll, int, int> pli;
	const ll INF = 1e18;
	priority_queue< pli, vector<pli>, greater<pli> > que;
	vector<vector<ll>> d(n, VL(CMX+10, INF));
	d[0][s] = 0;
	que.emplace(0, 0, s);
	while(!que.empty()){
		ll cost; int v, gk; tie(cost, v, gk) = que.top(); que.pop();
		 if(d[v][gk] < cost) continue;
		for(const auto& rp : r[v]){ 
			if(gk >= rp[1]){
				ll nct = d[v][gk] + rp[2];
				if(nct < d[rp[0]][gk-rp[1]]){
					d[rp[0]][gk-rp[1]] = nct;
					que.emplace(nct, rp[0], gk-rp[1]);
				}
			}
		}
		int wk = min<ll>(CMX, gk+c[v]);
		ll nct = d[v][gk] + dx[v];
		if(d[v][wk] > nct){
			d[v][wk] = nct;
			que.emplace(nct, v, wk);
		}
	}
	rep2(i, 1, n){
		ll ans = INF;
		rep(j, CMX+1) ans = min(ans, d[i][j]);
		cout << ans <<"\n";
	}
	
	return 0;
}


Measured memory_bytes: 6452