akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
ll dp[210000];
ll to[210000][30];
ll nex[30];
bool can[210000];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;cin>>s;
  s='S'+s+'S';
  for(int i=0;i<30;i++)nex[i]=s.size()-1;
  for(int i=s.size()-1;i>=0;i--){
    for(int j=0;j<26;j++)to[i][j]=nex[j];
    if(s[i]!='S')nex[s[i]-'a']=i;
  }
  // for(int i=0;i<210000;i++)back[i]=mp(llINF,llINF);

  for(int i=0;i<210000;i++){
    dp[i]=llINF;
  }

  dp[0]=0;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<26;j++){
      dp[to[i][j]]=min(dp[to[i][j]],dp[i]+1);
    }
  }

  can[s.size()-1]=true;
  for(int i=s.size()-1;i>=0;i--)
    for(int j=0;j<26;j++)
      if(dp[to[i][j]]==dp[i]+1 && can[to[i][j]])can[i]=true;
 
  ll now=0;
  while(now != s.size()-1){
    
    for(int i=0;i<26;i++)
      if(dp[to[now][i]] == dp[now]+1 && can[to[now][i]]){
	cout<<(char)('a'+i);
	now=to[now][i];
	break;
      }
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 49360
local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local function upper_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if(x < ary[1]) then return 1 end
  if(ary[num] <= x) then return num + 1 end
  local min, max = 1, num
  while(1 < max - min) do
    local mid = mfl((min + max) / 2)
    if(ary[mid] <= x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local n = io.read("*n")
local a = {}
for i = 1, n do
  a[i] = io.read("*n")
  a[i] = -a[i]
end
local t = {a[1]}
for i = 2, n do
  local pos = upper_bound(t, a[i])
  if i - 1 < pos then
    table.insert(t, a[i])
  else
    t[pos] = a[i]
  end
end
print(#t)


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int x;
  cin >> x;
  int cnt=x/100;
  int sum=x%100;
  if(sum<=cnt*5) cout << "1" << endl;
  else cout << "0" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<int,int> p;
//const ll big=998244353;
const ll big=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}
ll lcm(ll a,ll b){
    return a/__gcd(a,b)*b;
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    ll n,m;cin >> n >> m;
    vec<ll> a(n);
    bool ok=true;
    rep(i,n){
        cin >> a[i];
        if(a[i]%2)ok=false;
        a[i]/=2;
    }

    int cnt=0;
    rep(i,n){
        ll k=a[i];
        int now=0;
        while(k%2==0){
            now++;
            k/=2;
        }
        if(i==0)cnt=now;
        if(cnt!=now)ok=false;
    }
    if(!ok){
        cout << 0 << endl;
        return 0;
    }

    ll ans=1;
    rep(i,n)ans=lcm(ans,a[i]);
    //ans*(odd)であってm以下
    m/=ans;
    m=(m+1)/2;
    cout << m << endl;
}

Measured memory_bytes: 3964
//
//  main.cpp

#include <iostream>
using namespace std;


int main(){	
	int n;
	int numbers[101];
	cin >> n;
	for(int i=1;i<=n;i++)cin >> numbers[i];
	
	long long dp[101][21]={{}};//i?????????????´???????????¨?????????????j?????????????????????????????°
	dp[1][numbers[1]] = 1;
	for(int i=1;i<n;i++){
		for(int j=0;j<21;j++){
			if(dp[i][j] != 0){
				if(j+numbers[i+1] >= 0 && j+numbers[i+1] < 21){
					dp[i+1][j+numbers[i+1]] = dp[i+1][j+numbers[i+1]] + dp[i][j];
				}
				if(j-numbers[i+1] >= 0 && j-numbers[i+1] < 21){
					dp[i+1][j-numbers[i+1]] = dp[i+1][j-numbers[i+1]] + dp[i][j];
				}
			}
		}
	}
	
	cout << dp[n-1][numbers[n]] << endl;
	
	return 0;
}

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

int N, flag[101];

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        int d;
        cin >> d;
        flag[d] = 1;
    }
    int ans = 0;
    for (int i = 1; i <= 100; i++) {
        ans += flag[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    //tax:8%
    let a: f32 = read();
    //tax:10%
    let b: f32 = read();

    let min_a_price = (a / 0.08).ceil() as usize;
    let min_b_price = (b / 0.1).ceil() as usize;

    let next_a_price = ((a + 1.0) / 0.08).ceil() as usize;
    let next_b_price = ((b + 1.0) / 0.1).ceil() as usize;
 
    let mut vec_a: Vec<usize> = Vec::new();
    let mut vec_b: Vec<usize> = Vec::new();

    let mut ans: i32 = -1;

    for i in min_a_price .. next_a_price {
        vec_a.push(i);
    }
    for i in min_b_price .. next_b_price {
        vec_b.push(i);
    }

    for i in vec_a.iter() {
        if vec_b.contains(i) == true{
            ans = *i as i32;
            break;
        }
    }

    println!("{}",ans);

}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 101
#define MAXW 100001
ll dp[MAXN][MAXW];
ll w[MAXN];
ll v[MAXN];
int main() {
    int N, W;
    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        cin >> w[i] >> v[i];
    }
    memset(dp, 0, sizeof(dp));
    for (int i = w[1]; i <= W; i++) {
        dp[1][i] = v[1];
    }
    for (int i = 2; i <= N; i++) {
        for (int j = 1; j <= W; j++) {
            if (j - w[i] >= 0) {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
            }
            else {
                dp[i][j] = dp[i - 1][j];
            }
        }
    }
    cout << dp[N][W] << endl;
    return 0;
}

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

int main() {
string s;
cin >> s;
set<char> a;
rep(i,s.size()){
  a.insert(s.at(i));
}
if(a.size() == s.size()) cout << "yes" << endl;
else cout << "no" << endl;
  }


Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		br.close();

		int a = Integer.parseInt(s.substring(0, 2));
		int b = Integer.parseInt(s.substring(2, 4));
		if (a == 0 || a > 12) {
			if (b == 0 || b > 12) {
				System.out.println("NA");
			} else {
				System.out.println("YYMM");
			}
		} else {
			if (b == 0 || b > 12) {
				System.out.println("MMYY");
			} else {
				System.out.println("AMBIGUOUS");
			}
		}
	}
}


Measured memory_bytes: 21076
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

#define EPS     1e-11
#define INF     0x7fffffff
#define LL_INF  0x7fffffffffffffff

typedef long long LL;
struct Point {
        int x, y;
};
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};


int main() {
    int k;
    cin >> k;
    cout << ((int)k/2) * ((int)(k+1)/2) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){

int a,b;

scanf("%d %d",&a,&b);

if(a==b){

printf("a == b\n");

};

if(a>b){

printf("a > b\n");

};

if(a<b){

printf("a < b\n");

};

return 0;

};

Measured memory_bytes: 580
//#include<bits\stdc++.h>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<string>
#include<ctime>
#include<cmath>
#include<cctype>
#include<cstdlib>
#include<queue>
#include<deque>
#include<stack>
#include<vector>
#include<algorithm>
#include<utility>
#include<bitset>
#include<set>
#include<map>
#define ll long long
#define db double
#define INF 10000000000000010ll
#define ldb long double
#define pb push_back
#define put_(x) printf("%d ",x);
#define get(x) x=read()
#define gt(x) scanf("%d",&x)
#define gi(x) scanf("%lf",&x)
#define put(x) printf("%d\n",x)
#define putl(x) printf("%lld\n",x)
#define gc(a) scanf("%s",a+1)
#define rep(p,n,i) for(RE int i=p;i<=n;++i)
#define go(x) for(int i=lin[x],tn=ver[i];i;tn=ver[i=nex[i]])
#define fep(n,p,i) for(RE int i=n;i>=p;--i)
#define vep(p,n,i) for(RE int i=p;i<n;++i)
#define pii pair<int,int>
#define mk make_pair
#define RE register
#define P 1000000007
#define gf(x) scanf("%lf",&x)
#define pf(x) ((x)*(x))
#define uint unsigned long long
#define ui unsigned
#define EPS 1e-8
#define sq sqrt
#define S second
#define F first
#define mod 998244353
using namespace std;
char buf[1<<15],*fs,*ft;
inline char getc()
{
    return (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<15,stdin),fs==ft))?0:*fs++;
}
inline int read()
{
    RE int x=0,f=1;RE char ch=getc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getc();}
    while(ch>='0'&&ch<='9'){x=((ll)x*10+ch-'0')%mod;ch=getc();}
    return x*f;
}
const int MAXN=200010;
int n,len;
ll c[MAXN];
int lin[MAXN],ver[MAXN<<1],nex[MAXN<<1];
inline void add(int x,int y)
{
	ver[++len]=y;
	nex[len]=lin[x];
	lin[x]=len;
}
int main()
{
	//freopen("1.in","r",stdin);
	get(n);
	rep(2,n,i)
	{
		int get(x),get(y);
		add(x,y);add(y,x);
	}
	rep(1,n,j)go(j)if(tn>j)c[tn]-=j;
	ll ans=0;
	rep(1,n,i)
	{
		c[i]+=c[i-1];
		ans+=(ll)(i+1)*i/2;
		ans+=c[i];
	}
	putl(ans);return 0;
}


Measured memory_bytes: 9196
import collections 

h,w,m=map(int,input().split())
x=[]
y=[]
t=[]

for _ in range(m):
  a=list(map(int,input().split()))
  x.append(a[0])
  y.append(a[1])
  t.append(a)
  
X=collections.Counter(x)
Y=collections.Counter(y)

va,co=zip(*Y.most_common())
va1,co1=zip(*X.most_common())
X1=co1[0]
Y1=co[0]
chx=0
chy=0

for i in va:
  if Y[i]==Y1:
    chy+=1
    
for j in va1:
  if X[j]==X1:
    chx+=1


ans=0
for r in t:
  h=r[0]
  g=r[1]
  if X[h]==co1[0] and Y[g]==co[0]:
    ans+=1
    
if ans<(chx*chy):
  print(X1+Y1)
  
else:
  print(X1+Y1-1)

Measured memory_bytes: 213836
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


class AVL_like_BIT:  # 1-indexed
    def __init__(self,n):  # 1~nを要素として持ちうる。
        self.n = n
        self.tree = [0]*(self.n+1)
        self.depth = n.bit_length()

    def add(self,k):  # kを木に加える
        while k<=self.n:
            self.tree[k]+=1
            k += k&-k
    
    def delete(self,k): # kを木から削除する
        while k<=self.n:
            self.tree[k]-=1
            k += k&-k

    def sum(self,k):  # 1~kの和
        ans = 0
        while k>0:
            ans += self.tree[k]
            k -= k&-k
        return ans
    
    def lower_bound(self,k):  # k以上の最小要素
        x = self.sum(k-1)
        if x == self.sum(self.n):  # k以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k-1)なるpの右端 + 1が答え
            q = p+v
            if q <= self.n and self.tree[q] <= x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def upper_bound(self,k):  # k以下の最大要素
        x = self.sum(k)
        if x == 0:  # k以下の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = sum(k)なるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < x:
                x -= self.tree[q]
                p += v
            v>>=1
        return p+1

    def query(self,k):  # k番目の要素出力
        if k > self.sum(self.n):  # k個以上の要素がないときは-1を返す
            return -1
        p = 0
        v = 1<<self.depth
        for i in range(self.depth + 1):  # sum(p) = kなるpの左端が答え
            q = p+v
            if q <= self.n and self.tree[q] < k:
                k -= self.tree[q]
                p += v
            v>>=1
        return p+1

def compress(a):
    b = sorted(set(a))
    d = {x:i+1 for i,x in enumerate(b)}
    return b,d


import heapq

n,q = readints()

X = []

block = []
free = []
for i in range(n):
    s,t,x = readints()
    X.append(x)
    block.append([s-x,x])
    free.append([t-x,x])

b,d = compress(X)
block = [(x[0],d[x[1]]) for x in block]
free = [(x[0],d[x[1]]) for x in free]
heapq.heapify(block)
heapq.heapify(free)

ans = []
avl = AVL_like_BIT(len(d))
for i in range(q):
    D = readint()
    while block and block[0][0]<=D:
        a = heapq.heappop(block)
        avl.add(a[1])
    while free and free[0][0]<=D:
        a = heapq.heappop(free)
        avl.delete(a[1])
    ans.append(avl.lower_bound(0))

ans = [b[x-1] if x >=0 else -1 for x in ans]
printrows(ans)


Measured memory_bytes: 156120
N = int(input())
ans = [-1] * (N ** 2)
X = [int(x)-1 for x in input().split()]
for i, x in enumerate(X):
    ans[x] = i+1
left, right = [], []
for i in range(N):
    l_cnt, r_cnt = i, N - (i+1)
    left.extend([(X[i], i+1)] * l_cnt)
    right.extend([(X[i], i+1)] * r_cnt)
l, r = 0, N ** 2 - 1
left.sort()
right.sort()
for _, x in left:
    while ans[l] != -1:
        l += 1
    ans[l] = x
for _, x in reversed(right):
    while ans[r] != -1:
        r -= 1
    ans[r] = x
counter = [[] for _ in range(N)]
for i, a in enumerate(ans):
    counter[a-1].append(i)
if all(counter[i].index(x) == i for i, x in zip(range(N), X)):
    print("Yes")
    print(*ans)
else:
    print("No")
assert(all(a != -1 for a in ans))
assert(all(len(row) == N for row in counter))


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll N;
    cin >> N;
    cout << 180 * (N - 2) << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

inf = float('inf')

# dist[i][j]: iからjへのコスト,  n:頂点数
def warshall_floyd(dist,n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if i == j:
                    dist[i][j] = 0
                elif dist[i][j] > dist[i][k] + dist[k][j]:
                    dist[i][j] = dist[i][k] + dist[k][j]

N,M = map(int,input().split())
edges = []
ad = [[inf]*N for _ in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    a -= 1;  b -= 1
    edges.append((a,b,c))
    ad[a][b] = c
    ad[b][a] = c

warshall_floyd(ad,N)
ans = M

for a,b,c in edges:
    for s in range(N):
        if ad[s][a] + c == ad[s][b]:
            ans -= 1
            break

print(ans)

Measured memory_bytes: 3436
#include <stdio.h>

int main(){
  int n,q;
  int S[10000], T[500];
  int count=0;
  int i,j;
  int si;
  scanf("%d", &n );
  //printf("%d\n", n);
  for (i=0 ; i<n; i++ ) {
    scanf("%d", &S[i] );
    //printf("%d ", S[i] );
  }
  //printf("\n");
  scanf("%d", &q );
  for (i=0 ; i<q; i++ ) {
    scanf("%d", &T[i] );
  }

  si=0;
  for(i=0; i<q; i++){
    for(j=si; j<n ; j++){
      //printf("S=%d T=%d",j,i);
      if(S[j]==T[i]){
        count++;
        break;
      }
    }
  }
  printf("%d\n", count );
  return 0;
}

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

int main(int argc, char **argv) {
  string S;
  cin >> S;
  if (S[1] == 'B') {
    cout << "ARC";
  } else {
    cout << "ABC";
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 3592
n = int(input())
a = list()
for i in range(n):
    x, y = input().split()
    y = int(y)
    if x == "S":
        a.append(y + 0)
    if x == "H":
        a.append(y + 13)
    if x == "C":
        a.append(y + 26)
    if x == "D":
        a.append(y + 39)
for i in range(1, 53):
    if not (i in a):
        if i <= 13:
            print("S {}".format(i - 0))
        elif i <= 26:
            print("H {}".format(i - 13))
        elif i <= 39:
            print("C {}".format(i - 26))
        else:
            print("D {}".format(i - 39))


Measured memory_bytes: 5592
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> >vvi;
const ll MOD=1000000007LL;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int>c(m);
  vector<int>dp(n+1,INF);
  rep(i,m)cin>>c[i];
  dp[0]=0;
  rep(j,m){
    rep(i,n+1){
      if(i-c[j]>=0)dp[i]=min(dp[i],dp[i-c[j]]+1);
    }
  }
  cout<<dp[n]<<endl;
}
      



Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
int main(){
    ll n;
    cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll now=1;
    ll ans=0;
    rep(i,n){
        if(a[i]!=now){
            ans++;
        }else{
            now++;
        }
    }
    if(ans==n) cout<<-1<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 1792
ab=[]

n,m = map(int,input().split())

for i in range(m):
    ab.append(tuple(map(int,input().split())))

ab.sort(key=lambda x:x[1])

res=0
for z in range(len(ab)):
    x=ab[0][1]
    for j in range(len(ab)):
        if x > ab[0][0]:
            del ab[0]
        else:
            res+=1
            break
    if len(ab)==0:
        res+=1
        break
    
print(res)

Measured memory_bytes: 18612
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int r;R(r);W(3*r*r);
    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
SC = [tuple(map(int,input().split())) for i in range(M)]

if N==1:
    r = range(10)
elif N==2:
    r = range(10,100)
else:
    r = range(100,1000)
for n in r:
    #print(n)
    n = str(n)
    for s,c in SC:
       #print("s=",s,"c",c)
        if n[s-1] != str(c):
            break
    else:
        print(n)
        exit()
print(-1)


Measured memory_bytes: 3064
from bisect import bisect_left

n = int(input())
lll = list(map(int, input().split()))
lll.sort()
ans = 0

for i in range(n - 2):
    li = lll[i]
    for j in range(i + 1, n - 1):
        k = bisect_left(lll, li + lll[j], lo=j)
        ans += k - j - 1
print(ans)


Measured memory_bytes: 43868
#include<bits/stdc++.h>
using namespace std;
 
int main(void){
  int n;
  cin >> n;
  
  long long a = 2;
  long long b = 1;
  long long l = 0;
  
  if(n == 1){
    cout << 1 << endl;
    return 0;
  }
  
  for(int i = 2; i <= n; i++){
    l = b + a;
    a = b;
    b = l;
  }
  
  cout << l << endl;
  return 0;
     
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
#define dbg if(debug)
#define size(x) (int)(x).size()
using namespace std;
typedef pair<int,int> pii;
#ifdef OMNI
	const bool debug = 1;
#else
	const bool debug = 0;
#endif

//---------------------- PROVE, THEN WRITE ----------------------//


int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int n;
	cin>>n;
	ll k;
	cin>>k;
	vector<int> a(n);
	for(int &x: a){
		cin>>x;
		--x;
	}
	vector<int> path;
	vector<bool> vis(n);
	function<void(int)> dfs = [&](int v){
		if(vis[v] || k==0)
			return;
		vis[v] = 1;
		path.pb(v);
		k--;
		dfs(a[v]);
	};
	dfs(0);
	if(k==0)
		return cout<<a[path.back()]+1,0;
	int i;
	for(i=0;i<size(path);++i){
		if(a[path.back()]==path[i])
			break;
	}
	
	assert(i<size(path));
	path = vector<int> (path.begin()+i,path.end());
	k%=size(path);
	cout<<path[k]+1;
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}
	

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

using namespace std;

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

    int n;
    cin >> n;
    vector<vector<int>> as(1);
    {
        int a;
        cin >> a;
        as[0].push_back(a);
    }
    for (int i = 1; i < n; i++) {
        int a;
        cin >> a;
        if (as.back().back() >= a) {
            as.emplace_back(vector<int>({a}));
        } else {
            int sz = as.size();
            int l = -1, r = sz - 1;
            while (l < r - 1) {
                int m = (l + r) / 2;
                if (as[m].back() < a) {
                    r = m;
                } else {
                    l = m;
                }
            }
            as[r].push_back(a);
        }
    }
    cout << as.size() << endl;
}

Measured memory_bytes: 6708
#include<stdio.h>
 
#define MAX 500000
 
int Tree[MAX];  
int n;
 
void maxHeapify(int i){
  int largest ,exchange, l, r;
  l = getLeft(i);
  r = getRight(i);
   
  if((n+1 >l) && (Tree[l] > Tree[i])) largest = l;
 
  else largest = i;
   
  if((n+1 > r) && (Tree[r] > Tree[largest])) largest = r;
 
  if (largest != i){
 
    exchange = Tree[i];
    Tree[i] = Tree[largest];
    Tree[largest] = exchange;
    maxHeapify(largest);
 
  } 
}
 
void buildMaxHeap(){
  int i;
  for (i=(n/2); i+1>1; i--){
    maxHeapify(i);
     }
}
  
int getLeft(int i){
  return (2*i);
}
 
int getRight(int i){
  return (2*i + 1);
}
int getParent(int i){
  return i/2;
}

 
main()
{
  int i;
  scanf("%d",&n);
 
  for(i=1; i<=n; i++){
 
    scanf("%d",&Tree[i]);
 
  }
 
  buildMaxHeap();
 
  for(i=1; i<=n; i++){
     
    printf(" %d",Tree[i]);
 
  }
 
  printf("\n");
 
  return 0;
}

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

long long N, W, weight[105], value[105];
long long dp[105][100005];

long long f(long long n, long long w) {
	if (n==0) return 0;
	if (dp[n][w] != -1) return dp[n][w];
	dp[n][w] = f(n-1, w);
	if (w >= weight[n])
		dp[n][w] = max(dp[n][w], f(n-1, w-weight[n])+value[n]);
	return dp[n][w];
}

int main() {
	cin >> N >> W;
	for(long long i=1; i<=N; i++) {
		cin >> weight[i] >> value[i];
	}
	memset(dp, -1, sizeof(dp));
	cout << f(N, W) << endl;
	return 0;
}

Measured memory_bytes: 82432
#include <iostream>
#include <cmath>

using namespace std;


int main() {

	int N, D;
	cin >> N >> D;
	int pos[10][20];

	for (int i = 0; i < N; i++) {
	for (int j = 0; j < D; j++) {
			cin >> pos[i][j];
	}
	}

	int ans = 0;

	int d = 0;

	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			d = 0;
			for (int k = 0; k < D; k++) {
				d += (pos[i][k] - pos[j][k]) * (pos[i][k] - pos[j][k]);
			}

			if (d == floor(sqrt(d)) * floor(sqrt(d)))ans++;



		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        
        //int a = stdIn.nextInt();
        int num[] = new int[3];
        //String s = stdIn.next();
        //char c[] = s.toCharArray();
        //boolean flag = true;
        for(int i = 0; i < 3; i++){
            num[i] = stdIn.nextInt();
        }
        
        Arrays.sort(num);
        
        System.out.println(num[2] * 10 + num[1] + num[0]);
        
        //System.out.println();
        //System.out.print();
    }
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL N;
  cin >> N;
  
  VLL P(N),Q(N);
  REP(i,N){
    cin >> P.at(i);
    Q.at(P.at(i)-1) = i;
  }
  
  
  int t=1,s=0;
  REP(i,N-1){
    if(Q.at(i+1)>Q.at(i))t++;
    else{
      chmax(s,t);
      t=1;
    }
  }
  chmax(s,t);
  
  cout << N-s << endl;
  
  return 0;
}

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

#define ll long long
#define ar array
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define forn(i,n) for(ll i=0; i<(n); i++)
#define fori(i,k,n) for(ll i=k; i<(n); i++) 
#define all(x) (x).begin(),(x).end()
#define en '\n'
#define FILL(x,v) memset(x,v,sizeof(x))
#define pb push_back

template<typename T> void print(vector<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(deque<T>& a)
{
	for (int i = 0; i < a.size(); i++)
		cout << a[i] << ' ';
	cout << en;
}
 
template<typename T> void print(vector<vector<T>>& a)
{
	for (int i = 0; i < a.size(); i++)
	{
		for (int j = 0; j < a[i].size(); j++)
			cout << a[i][j] << ' ';
		cout << en;
	}
}

const ll MOD = 1e9+7;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y){
	x -= y;
	if(x<0) return x + MOD;
	return x;
}
ll mult(ll x, ll y){
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if(p==0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p-1));
	return bin_pow(mult(x,x), p/2);
}
ll rev(ll x){
	return bin_pow(x, MOD - 2);
}

void solve(){
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	for(ll i = k; i<=n+1; i++){
		ll mn = i*(i-1)/2;
		ll mx = n*(n+1)/2 - (n-i)*(n-i+1)/2;
		ans += mx - mn + 1;
		ans %= MOD;
	}
	cout << ans << en;
}

int main(){
    ios::sync_with_stdio(0);
	cin.tie(0);
    cout.tie(0);
 
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
    int t = 1;
	// cin >> t;
    while(t--)
        solve();
    return 0;
}

Measured memory_bytes: 3644
D = list(input())
T = list(input())

d_len = len(D)
t_len = len(T)

flag = 0
p = -1

#後ろの?から入れられるかを試す
#入れられた最短の後ろに入れる
#それ以外の文字は?とする
#入れられる場所がなければUNRESTORABLEを表示

for i in range(d_len - t_len, -1, -1):
        #i文字目に対してチェック
        for j in range(t_len):
            if flag == 1:
                break

            if D[i+j] == '?' or D[i+j] == T[j]:
                if j == t_len - 1:
                    flag = 1
                    p = i
                    break
            else:
                break
    
if flag == 1:
    #他の?を全て置換して表示
    c = 0

    while True:
        if c == p:
            print("".join(T),end="")
            c += t_len
        elif c >= d_len:
            break
        elif D[c] == '?':
            print("a",end="")
            c += 1
        else:
            print(D[c],end="")
            c += 1
    
    print()

else:
    print("UNRESTORABLE")

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//????????????????????°?????\???
		int set = sc.nextInt();
		int[] num = new int[9];
		int[] color = new int[9];
		for (int setCount = 0; setCount < set; setCount++) {
			int RCount = 0;
			int GCount = 0;
			int[] used = new int[9];
			int trueSet = 0;
			//??\???
			for (int count = 0; count < 9; count++ ) {
				num[count] = sc.nextInt();
			}
			for (int count = 0; count < 9; count++) {
				String cl = sc.next();
				if (cl.equals("R") ) {
					color[count] = 0;
					RCount++;
				} else if (cl.equals("G") ) {
					color[count] = 1;
					GCount++;
				} else {
					color[count] = 2;
				}
			}
			//??????1
			if (RCount % 3 == 0 && GCount % 3 == 0) {
				//?????????????????????????????????
				for (int i = 0; i < 8; i++) {
					for (int j = i+1; j < 9; j++) {
						if (num[i] > num[j]) {
							int numTaihi = num[i];
							num[i] = num[j];
							num[j] = numTaihi;
							int colorTaihi = color[i];
							color[i] = color[j];
							color[j] = colorTaihi;
						}
					}
				}
				//????????????????????????????????????
				for (int xMaime = 0; xMaime < 7; xMaime++) {
					if (used[xMaime] == 0) {
						for (int yMaime = xMaime + 1; yMaime < 8; yMaime++) {
							if (used[xMaime] == 1) {
								break;
							}
							if(used[yMaime] == 0) {
								for (int zMaime = yMaime + 1; zMaime < 9; zMaime++) {
									if (used[xMaime] == 1) {
										break;
									}
									if (used[zMaime] == 0) {
										if (color[xMaime] == color[yMaime] && color[xMaime] == color[zMaime]) {
											if (num[xMaime] == num[yMaime] && num[xMaime] == num[zMaime]) {
												trueSet++;
												used[xMaime]++;
												used[yMaime]++;
												used[zMaime]++;
											} else if (num[xMaime]+1 == num[yMaime] && num[yMaime]+1 == num[zMaime]) {
												trueSet++;
												used[xMaime]++;
												used[yMaime]++;
												used[zMaime]++;
											}
										}
									}
								}
							}
						}
					}
				}
				//??????
				if (trueSet == 3) {
					System.out.println(1);
				} else {
					System.out.println(0);
				}
			} else {
				System.out.println(0);
			}
		}
	}
}

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

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

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 10;
int n, d;
int a[N][N];
int cnt;

inline bool check(int x) {
    int y = sqrt(x);
    return y * y == x;
}

int main() {
    cin >> n >> d;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < d; ++j) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            int dist = 0;
            for (int k = 0; k < d; ++k) {
                int d = a[i][k] - a[j][k];
                dist += d * d;
            }
            if (check(dist))
                ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
long long mod=pow(10,9)+7;
#define long long int
int main() {	
	int t=1;
	//cin >> t;
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	while (t--) {
	     int dp[101][100005];
	     int n;
	     cin>>n;
	     int k;
	     cin>>k;
	     int arr[101];
	     memset(dp,0,sizeof(dp));
	     for(int i=0;i<n;i++)
	     {
	     	cin>>arr[i];
		 }
		 for(int i=0;i<=arr[0];i++)
		 {
		 	dp[0][i]=1;
		 }
		 
		for(int i=1;i<=n;i++)
		{   
		     vector<int>pre(k+1,0);
		       pre[0]=dp[i-1][0];
		       for(int j=1;j<=k;j++)
		       {
		       	  pre[j]=(pre[j-1]%mod+dp[i-1][j]%mod)%mod;
			   }
		    	for(int j=0;j<=k;j++)
		    	{
		    		if(arr[i]>=j)
		    		{
		    			dp[i][j]=pre[j];
					}
					else
					{
						dp[i][j]=(pre[j]+mod-pre[j-arr[i]-1])%mod;
					}
				}
		} 
	      cout<<dp[n-1][k];
      }
	} 
	
	
	

Measured memory_bytes: 43480
#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#include<iomanip>
#define BUG puts("no bug")
#define sci(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define ll long long
#define ull unsigned long long
#define REP(a,b,c) for(ll a=b;a<=c;a++)
#define PER(a,b,c) for(ll a=b;a>=c;a--)
#define lb(a) (a&(-a))
#define pp (p<<1)
#define ppp (p<<1|1)
#define pi pair<ll,ll>
#define pii pair<pair<ll,ll>,ll>
using namespace std;
const ll MAXN=1e6+5;
ll n,m,t;
ll v[MAXN];
ll sum[MAXN];
int main(){
    cin>>n;
    REP(i,1,n){
        cin>>v[i];
        sum[v[i]]++;
    }
    ll ans=0;
    REP(i,1,n)ans+=sum[i]*(sum[i]-1)/2;
    REP(i,1,n){
        ll tmpans=ans;
        tmpans-=sum[v[i]]*(sum[v[i]]-1)/2;
        tmpans+=(sum[v[i]]-1)*(sum[v[i]]-2)/2;
        cout<<tmpans<<endl;
    }
}

Measured memory_bytes: 7296
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#define read(a) scanf("%d",&a)
using namespace std;
int n,m;
const int N=1e5+1;
typedef long long ll;
char S[N],T[N];
ll gcd(ll x,ll y){return y? gcd(y,x%y):x;}
map<ll,char> M;
int main()
{
	read(n);read(m);
	scanf("%s",S+1);scanf("%s",T+1);
	ll lcm=1ll*n*m/gcd(n,m);
	ll d1=lcm/n,d2=lcm/m;
	if(S[1]!=T[1]) return puts("-1"),0;
	for(int i=1;i<=n;++i) {M[1+d1*(i-1)]=S[i];}
	for(int i=1;i<=m;++i){
		ll pos=1+d2*(i-1);
		if(M.find(pos)!=M.end()) {if(M[pos]!=T[i])return puts("-1"),0;}
	}
	printf("%lld\n",lcm);
}


Measured memory_bytes: 6144
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int a,b,c,n,i,j,k;
int str[100005],str2[100005];
int main()
{
    string s1,s2;
    while(cin>>s1)
    {
        s2=s1;
        k=j=0;
        for(i=1;i<s1.length();i++)
        {
            if(s1[i]=='1'&&s1[i-1]=='1')
                {s1[i]='0';k++;}
            if(s1[i]=='0'&&s1[i-1]=='0')
            {
                s1[i]='1';k++;
            }
        }

        printf("%d\n",max(k,j));

    }
    return 0;
}


Measured memory_bytes: 512
#include <math.h>
#include <iostream>
using namespace std;

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



int main(){
    int N;
    int count = 0;
    cin>>N;
    int num;
    for(int i=0;i<N;i++){
        cin>>num;
        if(is_prime(num))
            count++;
    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    for(int i=n-1;i>=0;i--)
    {
        if(i%2==0)
        {
            bool f=true;
            for(int j=0,k=i/2;k<i;j++,k++)
            {
                if(s[j]!=s[k])
                {
                    f=false;
                    break;
                }
            }
            if(f)
            {
                cout<<i<<endl;
                break;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = [int(s) for s in list(map(str, INPUT().split('/')))]
    print("Heisei" if S[0] < 2019 or (S[0] == 2019 and S[1] < 5) else "TBD")


if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
# include<iostream>
# include<cstring>
# include<cstdio>
# include<algorithm>
# define LL long long
# include<queue>
using namespace std;
const int M = 200005;
int n,k,q,L;
LL ans;
int a[M],b[M];
int num[M][25];
bool use[25];
deque<int> qu;
inline int read(){
	int x = 0, w = 1 ; char c = getchar() ;
	while(c>'9'||c<'0'){ if(c=='-') w=-1; c=getchar();}
	while(c>='0'&&c<='9'){ x = x*10+c-'0';c=getchar();}
	return x*w ;
}
void work(int a,int x)
{
	for(int i=0;i<20;++i)
	  if(a&(1<<i)) num[x][++num[x][0]]=i;
}
int main()
{
	n = read();
	for(int i=1;i<=n;++i){
		a[i] = read();
	  work(a[i],i);
	}
	for(int i=1;i<=n;++i)
	  {
	  	for(int j=1;j<=num[i][0];++j)
	  	  {
	  	  	if(!use[num[i][j]]) use[num[i][j]]=1;
	  	  	else
	  	  	{
	  	  		while(use[num[i][j]]&&!qu.empty())
	  	  		{
	  	  			int tt=qu.back();
	  	  			qu.pop_back();
	  	  			--L;
	  	  			for(int k=1;k<=num[tt][0];++k)
	  	  			  use[num[tt][k]]=0;
				}
				use[num[i][j]]=1;
			}
		  }
		qu.push_front(i),++L,ans+=L;
	  }
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 21376
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
using namespace std;
int main(){
	ll n;
	cin>>n;
	ll sum=0;
	vector<ll> a(n+1);
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	a[0]=a[n];
	ll once = n * (n+1) / 2;
	if( sum % once != 0){
		cout<<"NO"<<endl;
		return 0;
	}
	ll tms = sum / once;
	ll cnt = 0;
	for(int i=0;i<n;i++){
		ll dif = a[i+1] - a[i];
		dif = tms-dif;
		if( dif<0 || dif%n !=0){
			cout<<"NO"<<endl;
			return 0;
		}
		else{
			cnt+=dif/n;
		}
	}
	if( cnt != tms){
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	return 0;
}

Measured memory_bytes: 1024
#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

int pre[100001];
int low[100001];
vector<int> E[100001];
vector<pair<int, int>> bri, nbri;

int dfs(int p, int prev, int topo) {
	pre[p] = topo;
	low[p] = topo;
	for (int to : E[p]) {
		if (pre[to] == 0) {
			low[p] = min(low[p], dfs(to, p, topo + 1));
			if (low[to] == pre[to]) bri.pb(mp(p, to));
			if (low[to] != pre[to]) nbri.pb(mp(p, to));
		}
		else {
			if (to == prev) continue;
			low[p] = min(low[p], low[to]);
		}
	}
	return low[p];
}

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


	int N, M;
	cin >> N >> M;
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		E[a].pb(b);
		E[b].pb(a);
	}

	dfs(1, 0, 1);

	co(bri.size());

	Would you please return 0;
}

Measured memory_bytes: 2560
//0010 Circumscribed Circle of A Triangle.
/*
½ÊãÌ_ (x1, y1)(x2, y2)(x3, y3) ð¸_Æµ½Op`Ì
OÚ~ÌSÀW(xp, yp)Æ¼a r ðoÍµÄI¹·évOðì¬µÄ­¾³¢B
x1, y1, x2, y2, x3, y3, xp, yp ÍA»ê¼ê -100 Èã 100 ÈºÌÀÆµÜ·B 

ÅÉf[^ZbgÌnª^¦çêÜ·
oÍÍA¬_Èºæ4ÅlÌÜüµÄAxp, yp, rð¼pXy[XÅæØÁÄ­¾³¢
*/

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;


//¼a@http://blog.livedoor.jp/calc/archives/9248011.html
//OS_@http://homepage2.nifty.com/gis_yasu21/sub1.htm

template<class T>
struct Point
{
	T x, y;
	Point(){}
	Point(T x, T y):x(x),y(y){}
};
template<class T>
T Square(const T &x)
{
	return x*x;
}
template<class T>
T Distance(const Point<T> &a, const Point<T> &b)
{
	return sqrt( Square(a.x-b.x) + Square(a.y-b.y) );
}

int main(void)
{
	const int N = 3;
	int n;
	Point<double> p[N], o;
	double r;
	int i, j;

	cin >> n;
	for(i = 0; i < n; i++)
	{
		for(j = 0; j < N; j++)
			cin >> p[j].x >> p[j].y;

		//wÌö®ÅOÚ~ÌÊÏðßé
		double a, b, c, s, S;
		a = Distance(p[1], p[2]);
		b = Distance(p[2], p[0]);
		c = Distance(p[0], p[1]);
		s = (a+b+c)/2;
		S = sqrt(s*(s-a)*(s-b)*(s-c));
		//abc/4SªOS~Ì¼a@¿ÈÝÉS/sÍàS~Ì¼a
		r = (a*b*c) / (4*S);

		//S = (1/2)*bc*sinAæè
		double sinA, sinB, sinC;
		sinA = 2*S/b/c;
		sinB = 2*S/c/a;
		sinC = 2*S/a/b;
		//]·èæèAa^2 = b^2 + c^2 - 2bc*cosA
		double cosA, cosB, cosC;
		cosA = (Square(b)+Square(c)-Square(a)) / (2*b*c);
		cosB = (Square(c)+Square(a)-Square(b)) / (2*c*a);
		cosC = (Square(a)+Square(b)-Square(c)) / (2*a*b);
		//sin(2A) = 2*sinA*cosA
		double sin2A, sin2B, sin2C;
		sin2A = 2*sinA*cosA;
		sin2B = 2*sinB*cosB;
		sin2C = 2*sinC*cosC;
		//OS~ÌXÀWÍA(x1*sin2A + x2*sin2B + x3*sin2C) / (sin2A+sin2B+sin2C)AyÀWà¯l
		o.x = (p[0].x*sin2A + p[1].x*sin2B + p[2].x*sin2C) / (sin2A + sin2B + sin2C);
		o.y = (p[0].y*sin2A + p[1].y*sin2B + p[2].y*sin2C) / (sin2A + sin2B + sin2C);

		
		//¬_Èºà\¦·éæ¤ÉµA¬_æ4ðlÌÜü·é
		cout << setprecision(3);
		cout << setiosflags(ios::fixed);
		cout << o.x << ' ' << o.y << ' ' << r << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define ve vector
#define pq priority_queue
#define vi vector<int>
#define vl vector<long long>
#define vii vector<vector<int>>
using namespace std;
using ll = long long;
using ld = long double;
const ll mod = 1000000007;



int main()
{

    int n,m;
    cin >> n >> m;
    ve<ve<int>> to(n);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--,b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    for(int p : to[0]){
        
        for(int q : to[p]){
            if(p==q) continue;
            if(q == n-1){
                out("POSSIBLE");
                return 0;
            }
        }
        
    }
    out("IMPOSSIBLE");


    return 0;
}


Measured memory_bytes: 12016
fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val v = readLine()!!.split(" ").map { it.toInt() }
  var emp = mutableMapOf<Int, Int>(0 to 0)
  var omp = mutableMapOf<Int, Int>(0 to 0)
  for (i in 0 until n) {
    if (i % 2 == 0) {
      emp[v[i]] = emp.getOrElse(v[i], { 0 }) + 1
    } else {
      omp[v[i]] = omp.getOrElse(v[i], { 0 }) + 1
    }
  }
  val emf = emp.maxBy { it.value }!!
  val omf = omp.maxBy { it.value }!!
  val ems = emp.maxBy { if (it.key == emf.key) 0 else it.value }!!
  val oms = omp.maxBy { if (it.key == omf.key) 0 else it.value }!!
  val en = (n + 1) / 2
  val on = n - en
  if (emf.key != omf.key) {
    println((en - emf.value) + (on - omf.value))
  } else {
    println(arrayOf((en - emf.value) + (on - oms.value), (en - ems.value) + (on - omf.value)).min()!!)
  }
}


Measured memory_bytes: 59480
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long a , b , c;
    cin >> a >>  b >> c;
    long long x;
    cin >> x;
    long long ans = 0;
    for(int i = 0 ; i <= a ; i++) {
        for(int j = 0 ; j <= b ; j++) {
            for(int k = 0 ; k <= c ; k++) {
                if(500 * i + 100 * j + 50 * k == x) {
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256