akhauriyash/Code-Regression huggingface dataset:
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

const int64_t kMod = 1000000007LL;
// const int64_t kMod = 998244353LL;
struct Mint {
  int64_t value;
  Mint(int64_t value = 0LL) : value((value % kMod + kMod) % kMod) {}
  Mint operator-() const {
    return Mint(-value);
  }
  Mint &operator+=(const Mint rhs) {
    if ((value += rhs.value) >= kMod) {
      value -= kMod;
    }
    return *this;
  }
  Mint &operator-=(const Mint rhs) {
    if ((value += kMod - rhs.value) >= kMod) {
      value -= kMod;
    }
    return *this;
  }
  Mint &operator*=(const Mint rhs) {
    (value *= rhs.value) %= kMod;
    return *this;
  }
  Mint operator+(const Mint rhs) const {
    return Mint(*this) += rhs;
  }
  Mint operator-(const Mint rhs) const {
    return Mint(*this) -= rhs;
  }
  Mint operator*(const Mint rhs) const {
    return Mint(*this) *= rhs;
  }
  Mint Pow(int64_t p) const {
    if (p == 0LL) {
      return 1LL;
    } else if (p < 0LL) {
      return Pow(-p).Pow(kMod - 2LL);
    }
    Mint temp = Pow(p >> 1LL);
    temp *= temp;
    if (p & 1LL) {
      temp *= (*this);
    }
    return temp;
  }
  Mint Inv() const {
    return Pow(kMod - 2LL);
  }
  Mint &operator/=(const Mint a) {
    return *this *= a.Inv();
  }
  Mint operator/(const Mint a) const {
    return Mint(*this) /= a;
  }
};

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

  int64_t S;
  cin >> S;

  vector<int64_t> dp(S + 1, -1);
  dp[0] = 1;
  dp[1] = 0;
  dp[2] = 0;

  auto Dfs = [&](auto &&Func, const int64_t n) -> Mint {
    if (n >= 0 && dp[n] >= 0) {
      return Mint(dp[n]);
    } else if (n <= 0) {
      return Mint(0);
    }
    // } else if (n == 0) {
    //   return Mint(1);
    // } else if (n <= 2) {
    //   return Mint(0);
    // }
    Mint ans = 0;
    for (int64_t i = 3; i <= n; ++i) {
      ans += Func(Func, n - i);
    }
    dp[n] = ans.value;
    return ans;
  };
  // const int64_t L = static_cast<int64_t>(T.length());
  Mint result = Dfs(Dfs, S);
  cout << result.value << endl;
  return 0;
}


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

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long a[3];
  for (int i = 0; i < 3; i++) {
    cin >> a[i];
    if (!(a[i] % 2)) {
      cout << "0\n";
      return 0;
    }
  }
  sort(a, a + 3);
  cout << a[0] * a[1] << '\n';
  return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func main() {
	sc.Split(bufio.ScanWords)
	n := ri()
	v := make([]float64, n)
	for i := 0; i < n; i++ {
		v[i] = float64(ri())
	}

	for len(v) > 1 {
		sort.Float64s(v)
		x, y := v[0], v[1]
		v = append(v, (x+y)/2)
		v = v[2:]
	}

	fmt.Println(v[0])
}


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

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); i--)
#define ITER(it, a) for(typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a, value) memset(a, value, sizeof(a))

#define SZ(a) (int) a.size()
#define ALL(a) a.begin(),a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const LL INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 100100;

VI g[2][MAX];
int R[2];

VI G[MAX];

int dfs(int x, VI* g)
{
	int v = -1;
	if (SZ(g[x]) % 2 == 0) v = x;

//	cout<<x<<' '<<v<<endl;

	FOR (i, 0, SZ(g[x]))
	{
		int to = g[x][i];
		int w = dfs(to, g);
//		cout<<"!!!! "<<v<<' '<<w<<endl;
		if (w == -1) continue;
		if (v == -1)
		{
			v = w;
			continue;
		}

		G[v].PB(w);
		G[w].PB(v);

		v = -1;
	}
//	cout<<"! "<<v<<endl;

	return v;
}

int C[MAX];

void dfs(int x, int c)
{
	C[x] = c;
	FOR (i, 0, SZ(G[x]))
	{
		int to = G[x][i];
		if (C[to] == INF) dfs(to, -c);
	}
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	int n;
	scanf("%d", &n);
	FOR (it, 0, 2)
	{
		FOR (i, 0, n)
		{
			int x;
			scanf("%d", &x);
			x--;
			if (x < 0) R[it] = i;
			else g[it][x].PB(i);
		}
	}

	FOR (i, 0, n)
	{
		if ((SZ(g[0][i]) & 1) != (SZ(g[1][i]) & 1))
		{
			cout<<"IMPOSSIBLE"<<endl;
			return 0;
		}
	}

	dfs(R[0], g[0]);
	dfs(R[1], g[1]);

	FOR (i, 0, n)
	{
		C[i] = INF;
	}

	FOR (i, 0, n)
	{
		if (C[i] != INF) continue;
		if (SZ(g[0][i]) % 2 != 0) C[i] = 0;
		else
		{
			dfs(i, 1);
		}
	}

/*	FOR (i, 0, n)
	{
		cout<<i<<": ";
		FOR (j, 0, SZ(G[i]))
		{
			cout<<G[i][j]<<' ';
		}
		cout<<endl;
	}
	cout<<endl;*/

	printf("POSSIBLE\n");
	FOR (i, 0, n)
	{
		printf("%d ", C[i]);
	}
	printf("\n");


}


Measured memory_bytes: 16384
x1, y1, x2, y2 = map(int, input().split())
dx = x1 - x2
dy = y1 - y2

x3 = x2 + dy
y3 = y2 - dx

x4 = x1 + dy
y4 = y1 - dx

print(x3, y3, x4, y4)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int,input().split()))

orient=0
count=0
prev=A[0]

for i in range(1,N):
    if A[i]<prev:
        if orient==1:
            count+=1
            prev=A[i]
            orient=0
        elif orient==-1:
            prev=A[i]
        else:
            orient=-1
            prev=A[i]
    elif A[i]>prev:
        if orient==-1:
            count+=1
            prev=A[i]
            orient=0
        elif orient==1:
            prev=A[i]
        else:
            orient=1
            prev=A[i]

       
print(count+1)

Measured memory_bytes: 14436
import java.util.*;
public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int M = sc.nextInt();
      long[] a = new long[N];
      long[] b = new long[N];
      long[] c = new long[M];
      long[] d = new long[M];
      for(int i=0;i<N;i++){
        a[i] = sc.nextLong();
        b[i] = sc.nextLong();
      }
      for(int i=0;i<M;i++){
        c[i] = sc.nextLong();
        d[i] = sc.nextLong();
      }
      for(int i=0;i<N;i++){
        long min = 4*100000000+1;
        long ans = 0;
        for(int j=0;j<M;j++){
          long man = (long)Math.abs(a[i]-c[j])+(long)Math.abs(b[i]-d[j]);
          if(man<min){
            min = man;
            ans = j+1;
          }
        }
        System.out.println(ans);
      }
    }
}


Measured memory_bytes: 35920
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class CTwoAlpinists {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int n;
        cin >> n;
        vector<long long int> t_vec(n, 0);
        for (int i = 0; i < n; ++i) {
            cin >> t_vec[i];
        }
        vector<long long int> a_vec(n, 0);
        for (int i = 0; i < n; ++i) {
            cin >> a_vec[i];
        }
        int cnt = 0;
        vector<long long int> cnt_t;
        vector<long long int> cnt_a;
        long long int now_a = 0;
        long long int now_t = 0;
        long long ans = 1;
        for (int j = 0; j < n; ++j) {
            if (now_a == a_vec[n - 1 - j])cnt_a.push_back(now_a);
            else cnt_a.push_back(1);
            now_a = a_vec[n - 1 - j];
            if (now_t == t_vec[j])cnt_t.push_back(now_t);
            else cnt_t.push_back(1);
            now_t = t_vec[j];
        }
        for (int k = 0; k < n; ++k) {
            if (cnt_a[n - 1 - k] == 1 && cnt_t[k] == 1 && t_vec[k] != a_vec[k]) ans = 0;
            else if (cnt_a[n - 1 - k] == 1 && a_vec[k] > t_vec[k]) ans = 0;
            else if (cnt_t[k] == 1 && t_vec[k] > a_vec[k]) ans = 0;
            ans *= min(cnt_a[n - 1 - k], cnt_t[k]);
            ans = ans % 1000000007;
        }
        cout << ans << endl;
    }
};


int main() {
    CTwoAlpinists solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

#define ln '\n'
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for(int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, c;
    cin >> n >> m >> c;
    VI b(m);
    REP(i, m) cin >> b[i];

    int ans = 0;
    REP(i, n) {
        int ab_sum = c;
        REP(j, m) {
            int a;
            cin >> a;
            ab_sum += a * b[j];
        }
        if(ab_sum > 0) ans++;
    }
    cout << ans << ln;
    return 0;
}


Measured memory_bytes: 256
# by the authority of GOD     author: manhar singh sachdev #

import os,sys
from io import BytesIO, IOBase

def main():
    print(int(input())^1)

#Fast IO Region
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()

Measured memory_bytes: 62524
#pragma GCC optimize ("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
const Int Inf = 1e17;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define mp make_pair
#define Pr(t) priority_queue<t>
#define gPr(t) priority_queue<t,vector<t>,greater<t>>
#define V(t) vector<t>
#define rep(i,n) for(int(i)=0; i<n; i++)
#define rer(i,l,r) for(int i=l; i<=r; i++)
#define gnr(i,l,r) for(int i=r; i>=l; i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) {rep(pri2i,n-1)cout<<a[pri2i]<<' '; if(n>1)cout<<a[n-1]<<'\n';}
#define prip(p) cout<<p.fi<<' '<<p.se<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template< class T >
struct edge {
  int fr, to;
  T w;

  edge(int to, T w) : fr(-1), to(to), w(w) {}

  edge(int fr, int to, T w) : fr(fr), to(to), w(w) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< Edges< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

template< class T >
vector< T > dijkstra(WeightedGraph< T > &g, int s) {
  const auto INF = numeric_limits< T >::max();
  vector< T > dist(g.size(), INF);

  using Pi = pair< T, int >;
  queue< Pi > que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.front();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.w;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

int n,m,_,x,y,q;
string s,sb;
bool ok;
char cf,cb;

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

  cin>>n>>m; WeightedGraph<int>g(n*3);
  rep(i,m){
    cin>>x>>y; x--; y--;
    g[x].eb(y+n,1);
    g[x+n].eb(y+n*2,1);
    g[x+n*2].eb(y,1);
  }
  cin>>x>>y; x--,y--;
  auto ans=dijkstra(g,x);
  pri1(ans[y]>1e9?-1:ans[y]/3);
}

Measured memory_bytes: 17792
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

void Q1() {

	double r;
	double PI = 3.141592653589;
	cin >> r;

	printf("%lf %lf\n", PI*r*r, 2 * r*PI);

}

void Q2() {
	int a, b;
	string op;

	while (true)
	{
		cin >> a >> op >> b;
		if (op == "?") { break; }
		else if (op == "+") {
			cout << a + b << endl;
		}
		else if (op == "-") {
			cout << a - b << endl;
		}
		else if (op == "*") {
			cout << a * b << endl;
		}
		else if (op == "/"){
			cout << a / b << endl;
		}
	}
	
}

void Q3() {
	int x; cin >> x;
	long long sum = 0;
	vector<int> a;
	a.resize(x);

	for (int i = 0; i < x; i++) {
		cin >> a[i];
		sum += a[i];

	}

	sort(a.begin(), a.end());

	cout << a[0] << " " << a[x - 1] << " " << sum << endl;
}

void Q4() {

	while (true)
	{
		int a, b;
		cin >> a >> b;

		if (a == 0 && b == 0)break;

		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++) {
				cout << "#";
			}
			cout << "\n";
		}
		cout << "\n";
	}
}

void Q5() {
	while (true)
	{
		int a, b;
		cin >> a >> b;

		if (a == 0 && b == 0)break;

		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++) {
				if (i != 0 && i != a - 1 && j != 0 && j != b - 1)
					cout << ".";
				else
					cout << "#";
			}
			cout << "\n";
		}
		cout << "\n";
	}

}

void Q6() {
	while (true)
	{
		int a, b;
		cin >> a >> b;

		if (a == 0 && b == 0)break;

		for (int i = 0; i < a; i++) {
			for (int j = 0; j < b; j++) {
				if ((i + j) % 2 == 0)
					cout << "#";
				else
					cout << ".";
			}
			cout << "\n";
		}
		cout << "\n";
	}

}

int main() {
	Q6();
	return 0;
}

Measured memory_bytes: 1124
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N, 0);
    for (int i = 0; i < N; ++i) {
        cin >> p[i];
    }

    sort(p.begin(), p.end());
    int ans = 0;
    for (int i = 0; i < K; ++i) {
        ans += p[i];
    }
    cout << ans << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3628
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
void solve(){
	ll n;
	cin>>n;
	if(n>=30)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3604
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
num = sum(a)
# print(num)
for i in range(n):
    m = min(a[i], b[i])
    a[i] -= m
    b[i] -= m
    m = min(a[i + 1], b[i])
    a[i + 1] -= m
    b[i] -= m
aft = sum(a)
# print(aft)
print(num - aft)

Measured memory_bytes: 18476
#include<iostream>
using namespace std;
 
int main(){
    int a,b,c,count;
    cin >> a >> b >> c;
    count = 0;
    for(int i = a; i <= b; i++){
        if(c % i == 0){
            count += 1;
        }
    }
    cout << count << endl;
 
    return 0;
}


Measured memory_bytes: 3116
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int a[225816],p[225816],x[225816];
priority_queue< int, vector<int>, greater<int> > pql;
priority_queue< int > pqr;

int main(void){
	int n,i,l,r,ans=1,k;
	bool flag = false;
	cin >> n >> k;
	for(i=0; i<n; ++i){
		cin >> a[i];
		p[a[i]] = i;
	}
	for(i=0; i<k; ++i){
		pql.push(a[i]);
		pqr.push(a[i]);
	}
	for(i=1; i<n; ++i){
		x[i] = x[i-1];
		if(a[i-1] < a[i]){
			++x[i];
		}
	}
	if(x[k-1] - x[0]==k-1){
		flag = true;
	}
	for(r=k; r<n; ++r){
		l = r - k;
		++ans;
		while(p[pql.top()]<=l){
			pql.pop();
		}
		while(p[pqr.top()]<=l){
			pqr.pop();
		}
		if(x[r] - x[l+1] == k-1){
			if(flag){
				--ans;
			}else{
				flag = true;
			}
			pql.push(a[r]);
			pqr.push(a[r]);
			continue;
		}
 		if(a[l] < pql.top() && pqr.top() < a[r]){
 			--ans;
		}
		pql.push(a[r]);
		pqr.push(a[r]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 4340
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second

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

    int sum = 0;
    rep(i, 0, n.length()) {
        sum += n[i] - '0';
    }
    if (sum % 9 == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    long long int a;
    cin>>n;
    std::deque<long long int> deq;
    for (int i=0;i<n;i++) {
        cin>>a;
        deq.emplace_back(a);
    }
    std::deque<long long int> s(n+1);
    for (int i=0;i<n;i++) {
        s[i+1]=s[i]+deq[i];
    }
    const long long INF=1LL<<60;
    long long int ans=INF;
    for (int i=1;i<n;i++) {
        long long int one=s[i];
        long long int another=s[n]-s[i];
        ans=min(ans,abs(one-another));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6916
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}

template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template<typename T>
ostream& operator << (ostream& os, vector<T>& v){
	rep(i,v.size()){ os << v[i] << (i == v.size() - 1 ? "" : " "); } return os;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& v){
	for(T& x: v){ is >> x; } return is;
}

map<int, int> primeFactor(int n){
	map<int, int> res;
	for(int i = 2; i * i <= n; i++){
		while(n % i == 0){
			++res[i];
			n /= i;
		}
	}
	if(n != 1) res[n] = 1;
	return res;
}

signed main(){
	int a, b;
	cin >> a >> b;

	auto x = primeFactor(a);
	auto y = primeFactor(b);
	int ans = 0;
	for(auto p : x){
		if(not y.count(p.first)) continue;
		ans++;
	}
	cout << ans + 1 << endl;
}


Measured memory_bytes: 256
n = int(input())
a = [int(x) for x in input().split()]
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if a[i]+a[j]>a[k] and a[j]+a[k]>a[i] and a[i]+a[k]>a[j]:
                if a[i]!=a[j] and a[j]!=a[k] and a[i]!=a[k]: 
                    #print(a[i],a[j],a[k])
                    count+=1
print(count)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(x) ((int)x.size())
#define FOR(i,a,b) for (int i=a;i<=b;++i)
#define FORD(i,a,b) for (int i=a;i>=b;--i)
using namespace std;
typedef long long LL;
typedef pair<int,int> pa;
typedef vector<int> vec;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,ans,s[500010];
int main(){
	cin>>n;
	FOR(i,1,n) s[i]=s[i/10]+(i%10);
	ans=1000000000;
	FOR(i,1,n-1) ans=min(ans,s[i]+s[n-i]);
	cout<<ans<<endl;
	return 0;
}

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

int main(){
  int h, n;
  cin >> h >> n;
  vector<int> dp(h+1,200000000);
  dp[0] = 0;
  rep(i,n){
    int a, b;
    cin >> a >> b;
    rep(j,h){
      int nj = min(h,j+a);
      dp[nj] = min(dp[nj],dp[j]+b);
    }
  }
  cout << dp[h] << endl;
}

Measured memory_bytes: 256
#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
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
int dx[4]={0,0,-1,1},dy[4]={1,-1,0,0};

const int limit=50;
int n,m;
int a[limit],b[limit];
bool G[limit][limit],visited[limit];

void dfs(int v){
  visited[v]=true;
  rep(next,n){
    if(G[v][next]==false) continue;
    if(visited[next]==true) continue;
    dfs(next);
  }
}

int main(int argc, char const *argv[]) {
  std::cin >> n >> m;
  rep(i,m){
    std::cin >> a[i] >> b[i];
    a[i]--,b[i]--;
    G[a[i]][b[i]]=G[b[i]][a[i]]=true;
  }
  int ans=0;
  rep(i,m){
    G[a[i]][b[i]]=G[b[i]][a[i]]=false;  //辺を取り除く
    rep(j,n) visited[j]=false;  //全て未訪問に初期化
    dfs(0);
    bool bridge=false;
    rep(j,n) if(visited[j]==false) bridge=true; //到達できない点が生じたなら、除いた辺は橋である
    if(bridge) ans++;
    G[a[i]][b[i]]=G[b[i]][a[i]]=true;//辺を戻す
  }

  std::cout << ans << '\n';
  return 0;
}


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

int main() {
  int N, A;
  cin >> N >> A;
  
  if (A == 0) {
    if (N % 500 == 0) {
      cout << "Yes"<< endl; 
    }
    else {
      cout << "No" << endl; 
    }
    return 0;
  }
  if (N <= A) {
    cout << "Yes" << endl;
    return 0;
  }
  // N > A && A > 0
  int modulo = N % 500;
  if (modulo > A) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main() {
char a,b,c;
cin >> a>>b>>c;
if(a=='R'){
  if(b=='R'){
    if(c=='R'){
      cout << "3";
    }else cout << "2";
  }else cout <<"1";
}else if(b=='R'){
  if(c=='R'){
    cout <<"2";
  }else cout <<"1";
}else if(c=='R'){
  cout << "1";
}else cout <<"0";
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

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

    int a,b;
    cin >> a >> b;
    int ans = 0;
    cout << max(a-2*b, ans)<<endl;
    return 0;
    
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m, k, like int
	fmt.Scan(&n, &m)

	list := make(map[int]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&k)
		for j := 0; j < k; j++ {
			fmt.Scan(&like)
			list[like] += 1
		}
	}

	count := 0
	for _, sumLike := range list {
		if sumLike == n {
			count++
		}
	}
	fmt.Println(count)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
typedef pair<int, int> pii;
const int maxn = 1 << 20;
vector<pii> dp[maxn];
int a[maxn];
int main()
{
	int n, m;
	scanf("%d", &m);
	n = 1 << m;
	for(int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	dp[0] = {mp(a[0], 0)};
	int ans = 0;
	for(int i = 1; i < n; ++i)
	{
		for(int j = 0; j < m; ++j)
			if(i & (1 << j))
				for(auto v : dp[i ^ (1 << j)])
					dp[i].push_back(v);
		dp[i].push_back(mp(a[i], i));
		sort(dp[i].begin(), dp[i].end(), greater<pii>());
		dp[i].erase(unique(dp[i].begin(), dp[i].end()), dp[i].end());
		dp[i].erase(dp[i].begin() + 2, dp[i].end());
		ans = max(ans, dp[i][0].first + dp[i][1].first);
		printf("%d\n", ans);
	}
		
	return 0;
}

Measured memory_bytes: 90368
#include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cerr<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cerr<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

class SuffixArray {
public:
  string &s;
  vector<int> sa, rank;
  int n;
  void construct_sa(){
    sa.resize(n+1);
    rank.resize(n+1);
    rep(i,n+1){
      sa[i]=i;
      rank[i] = (i<n)?s[i]:(-1);
    }
    vector<int> tmp(n+1,0);
    for(int k=1; k<=n; k*=2){
      auto comp = [&](const int i, const int j){
        if(rank[i]!=rank[j]) return rank[i]<rank[j];
        int ri = (i+k<=n)?(rank[i+k]):-1;
        int rj = (j+k<=n)?(rank[j+k]):-1;
        return ri < rj;
      };
      sort(all(sa), comp);
      tmp[sa[0]]=0;
      rep(i,1,n+1){
        tmp[sa[i]] = tmp[sa[i-1]];
        if(comp(sa[i-1], sa[i])) tmp[sa[i]]++;
      }
      swap(tmp, rank);
    }
  }
  SuffixArray(string &str) : s(str){
    n = s.size();
    construct_sa();
  }
  int getRank(const string t){
    int m = t.size();
    int l = 0, r = n+1;
    while(r-l>1){
      int mid = (r+l)/2;
      if(s.compare(sa[mid], m, t) < 0) l = mid;
      else r = mid;
    }
    return r;
  }
};

int rank_v[100005];

class SegTree{
public:
  int n;
  vector<int> data[1<<18];
  SegTree(int n_){
    n=1;
    while(n<n_) n*=2;
    rep(i,n_){
      data[n-1+i].pb(rank_v[i]);
    }
    for(int i=n-2; i>=0; i--){
      int il = 2*i+1, ir = 2*i+2;
      data[i].resize(data[il].size()+data[ir].size());
      merge(all(data[il]), all(data[ir]), data[i].begin());
    }
  }
  // 区間[a,b)でx以下の個数
  int query(int a, int b, int x, int k, int l, int r){
    if(r<=a || b<=l) return 0;
    if(a<=l && r<=b){
      return upper_bound(all(data[k]), x) - data[k].begin();
    }
    int vl = query(a,b,x,k*2+1,l,(r+l)/2);
    int vr = query(a,b,x,k*2+2,(r+l)/2,r);
    return vl+vr;
  }
  int query(int a, int b, int x){
    return query(a,b,x,0,0,n);
  }
};


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

  string s;
  int q;
  cin>>s>>q;
  SuffixArray sa(s);
  int n = s.size();

  rep(i,n) rank_v[i] = sa.rank[i];
  SegTree st(s.size());
// dbg(sa.rank, sa.sa);
  rep(_,q){
    int l,r;
    string t;
    cin>>l>>r>>t;
    r = r+1 - (t.size()-1);
    int lb = sa.getRank(t);
    int ub = sa.getRank(t+'|');
    // dbg(lb,ub);

    int ans = st.query(l,r,ub-1) - st.query(l,r,lb-1);
    cout << ans << endl;
  }

  return 0;
}



Measured memory_bytes: 22328
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int mypow(int a,int b,int c){
	if(b==0)return 1;
	if(b%2)return mypow(a,b-1,c)*a%c;
	int z=mypow(a,b/2,c);
	return z*z%c;
}
signed main(){
	cout<<"square1001"<<endl;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h> 
using namespace std;int main(){int n,k;cin>>n>>k;unordered_set<int> g;for(int i=0;i<k;i++){int d;cin>>d;for(int i=0;i<d;i++){int u;cin>>u;g.insert(u);}}int r=g.size();cout<<n-r<<endl;}

Measured memory_bytes: 3600
import java.util.*;

class Main{

    boolean[] used;
    boolean[][] path;
    int[] soutai;

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt();
            if(n==0) break;

            used = new boolean[26];
            path = new boolean[26][26];
            soutai = new int[26];

            for(int i=0; i<n; i++){
                String s = sc.next();
                int first = s.charAt(0) - 'a';
                int last = s.charAt(s.length()-1) - 'a';
                soutai[first]++;
                soutai[last]--;
                used[first] = used[last] = true;
                path[first][last] = true;
            }

            System.out.println(check());
        }
    }

    String check(){
        int idx = 0;
        for(int i=0; i<soutai.length; i++){
            if(!used[i]) continue;
            if(soutai[i]!=0) return "NG";
            idx = i;
        }
        for(int k=0; k<26; k++)
            for(int i=0; i<26; i++)
                for(int j=0; j<26; j++)
                    path[i][j] = path[i][j] | (path[i][k] & path[k][j]);

        for(int i=0; i<26; i++){
            if(!used[i]) continue;
            if(!path[idx][i]) return "NG";
            if(!path[i][idx]) return "NG";
        }
        return "OK";
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 45560
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define eps 1e-12
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,l,r,d;
int a[300005],sum,b[300005];
char ch[300005];
int ans[300005];
int getans(int x){
	if(x==0||ans[x]) return ans[x];
	int cnt=0;
	for(int i=0;(1<<i)<=x;i++){
		if(x&(1<<i)) cnt++;
	}
	return getans(x%cnt)+1;
}
int Mod[30];
int bit[505];
int len;
int check(int x){
	int i;
	for(i=x;i<=x+len-1;i++){
		if(b[i]>bit[i-x+1]) return 1;
		if(b[i]<bit[i-x+1]) return -1;
	}
	return 0;
}
int getMod(int x){
	len=0;
	while(x){
		bit[++len]=x%2;
		x>>=1;
	}
	int i,j;
	for(i=1;i<=len/2;i++) swap(bit[i],bit[len-i+1]);
	for(i=1;i<=n-len+1;i++){
		while(check(i)>=0){
			for(j=i+len-1;j>=i;j--){
				b[j]-=bit[j-i+1];
				if(b[j]<0) b[j]+=2,b[j-1]--;
			}
		}
		if(i==n-len+1) break;
		if(b[i]) b[i]=0,b[i+1]+=2;
	}
	int ans=0;
	for(i=n-len+1;i<=n;i++) ans=ans*2+b[i];
	return ans;
}
ll qpow(ll a,ll b,ll mo){
	ll ans=1,base=a;
	while(b){
		if(b&1) ans=ans*base%mo;
		base=base*base%mo;
		b>>=1;
	}
	return ans;
}
int main(){
	int i,j,k;
	n=read();
	for(i=1;i<=n;i++) ans[i]=getans(i);
	scanf("%s",ch+1);
	for(i=1;i<=n;i++) b[i]=a[i]=ch[i]-'0',sum+=a[i];
	if(sum==0){
		for(i=1;i<=n;i++) puts("1");
		return 0;
	}
	sum--;
	if(sum) Mod[0]=getMod(sum);
	sum+=2;
	for(i=1;i<=n;i++) b[i]=a[i];
	Mod[2]=getMod(sum);
	sum--;
	int now;
	for(i=1;i<=n;i++){
		if(a[i]==1&&sum==1){puts("0");continue;}
		if(a[i]==1) now=((Mod[0]-qpow(2,n-i,sum-1))%(sum-1)+sum-1)%(sum-1);
		else now=(Mod[2]+qpow(2,n-i,sum+1))%(sum+1);
		printf("%d\n",ans[now]+1);
	}
    return 0;
}

Measured memory_bytes: 6284
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<tuple>
#include<list>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    ll n,a[100010],x[100010],y[100010],ne=0,ans=0;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        if(a[i]<0) ne++;
    }
    sort(a,a+n);
    if(a[0]>=0){
        rep(i,n-2){
            x[i]=a[0];
            y[i]=a[i+1];
            a[0]-=a[i+1];
        }
        x[n-2]=a[n-1];
        y[n-2]=a[0];
        ans=a[n-1]-a[0];
    }
    else if(a[0]<0 && a[n-2]>0){
        rep(i,ne-1){
            x[i]=a[n-2];
            y[i]=a[i+1];
            a[n-2]-=y[i];
        }
        rep2(i,ne-1,n-2){
            x[i]=a[0];
            y[i]=a[i+1];
            a[0]-=y[i];
        }
        x[n-2]=a[n-1];
        y[n-2]=a[0];
        ans=x[n-2]-y[n-2];
    }
    else{
        rep(i,n-1){
            x[i]=a[n-1];
            y[i]=a[i];
            a[n-1]-=y[i];
        }
        ans=x[n-2]-y[n-2];
    }
    cout<<ans<<endl;
    rep(i,n-1){
        cout<<x[i]<<' '<<y[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
    #pragma gcc optimize("ofast")
    using namespace std;

    #define ll long long //data types used often, but you don't want to type them time by time
    #define ull unsigned long long
    #define ui unsigned int
    #define mod 998244353
    #define us unsigned short
    #define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
    #define INF LONG_MAX
    #define PI 3.1415926535897932384626
    #define mp make_pair
    #define fi first
    #define se second
    #define pb push_back
    #define rep(x,j,n)for(int x=j;x<n;x++)
    typedef vector<pair<ll,ll>> vpi;
    typedef vector<ll> vi;
    typedef vector<vi> vvi;

    ll modexp(ll a,ll b,ll m)
    {
        ll r=1;
        a=a%m;
        while(b>0)
        {
            if(b&1)
                r=(r*a)%m;
            b>>1;
            a=(a*a)%m;
        }
        return r%m;
    }


    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);cout.tie(0);
        ll h,w; cin>>h>>w;
        ll ans = (h+1)/2;
        ans*=(w+1)/2;
        ll a = h/2;
        a*=(w/2);
        if(w==1||h==1)
        {
            cout<<1<<endl;
        }
        else cout<<ans+a<<endl;
        return 0;
    }


Measured memory_bytes: 256
package main

import (
	"fmt"
	"strings"
)

var (
	n int
	m []map[string]int
)

func dfs(cnt int, last3 string) int {
	if v, ok := m[cnt][last3]; ok {
		return v
	}

	if cnt == n {
		return 1
	}

	ans := 0
	for _, r := range "ACGT" {
		if isNotAGC(last3 + string(r)) {
			ans = (ans + dfs(cnt+1, last3[1:]+string(r))) % 1000000007
		}
	}

	m[cnt][last3] = ans
	return ans
}

func isNotAGC(last4 string) bool {
	for i := range last4 {
		s := []rune(last4)
		if i < 3 {
			s[i], s[i+1] = s[i+1], s[i]
		}

		if strings.Contains(string(s), "AGC") {
			return false
		}
	}
	return true
}

func main() {
	fmt.Scan(&n)

	m = make([]map[string]int, n+1)
	for i := range m {
		m[i] = make(map[string]int)
	}
	fmt.Println(dfs(0, "TTT"))
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

string S;
int main() {
  cin >> S;
  string year = S.substr(0,4);
  string month = S.substr(5,2);
  string day = S.substr(8,2);
  int y=stoi(year);
  int m=stoi(month);
  int d=stoi(day);
  if (y < 2019) {
    cout << "Heisei" << endl;
    return 0;
  } else if (y > 2019) {
    cout << "TBD" << endl;
    return 0;
  }

  if (m < 5) {
    cout << "Heisei" << endl;
    return 0;
  } else {
    cout << "TBD" << endl;
    return 0;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  long long n;
  vector <long long> a(5); 
  cin>>n>>a[0]>>a[1]>>a[2]>>a[3]>>a[4];
  sort(a.begin(),a.end());
  cout<<(n+a[0]-1)/a[0]+4<<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int[] mem;
		int n,time,i;
		
		n = sc.nextInt();
		time = sc.nextInt();
		mem = new int[n];
		
		for (i=0 ; i<n ; i++) {
			mem[i] = i+1;
		}
		
		for (i=0 ; i<time ; i++) {
			String reader;
			String[] swap;
			swap = new String[2];
			reader = sc.next();
			swap = reader.split(",");
			
			int a = Integer.parseInt(swap[0])-1;
			int b = Integer.parseInt(swap[1])-1;
			
			int m = mem[a];
			mem[a] = mem[b];
			mem[b] = m;
		}
		
		for (i=0 ; i<n ; i++) {
			System.out.println(""+mem[i]);
		}
		
		sc.close();
	}
}


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

int main(){
	int n;
	
	cin>>n;
	
	for(int i = 0; i < (1<<n); i++){
		cout<<i<<":";
		for(int j = 0, k = i; k; j++){
			if(k&(1<<j)){
				cout<<" "<<j;
				k &= ~(1<<j);
			}
		}
		cout<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 3084
#include<stdio.h>

int main(void)
{
  int N,i,j;

  scanf("%d",&N);
  for(i=1;i<=9;i++)
    for(j=1;j<=9;j++)
      if(i*j==N){
        printf("Yes\n");
        return 0;
      }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 128
from collections import defaultdict
N, M = map(int, input().split())
H = list(map(int, input().split()))

edges = defaultdict(list)

for _ in range(M):
    a, b = map(lambda x:int(x)-1, input().split())
    edges[a].append(b)
    edges[b].append(a)

ans = 0
for i in range(N):
    ok = True
    for adj in edges[i]:
        if H[adj] >= H[i]:
            ok = False
            break
    if ok:
        ans += 1
print(ans)


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

int main()
{
    vector<int> a(5);
    int i,sum = 0;
    for(i = 0;i < 5;++i){
        cin >> a.at(i);
    }
    for(i = 0;i < 5;++i){
        if(a.at(i)%10 == 0){
            sum += a.at(i);
        }else{
            sum += (a.at(i)/10+1)*10;
        }
    }
    vector<int> spare(5);
    for(i = 0;i < 5;++i){
        if(a.at(i)%10){
            spare.at(i) = 10-a.at(i)%10;
        }else{
            spare.at(i) = 0;
        }
    }
    sort(spare.begin(),spare.end());
    cout << sum-spare.at(4) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int N, a[3];
    cin >> N;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[j];
        }
        sort(a, a + 3);
        cout << (a[0]*a[0] + a[1]*a[1] == a[2]*a[2] ? "YES" : "NO") << endl;
    }
    return 0;
}

Measured memory_bytes: 3056
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 1000005
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=1e9+7;
typedef ll Weight;
struct Edge {
	int src, 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;
int main(){
	int n,m;
	cin>>n>>m;
	ll cntr[114514]={0};
	ll cntr_sum[114514]={0};
	ll cntl[114514]={0};
	vector<ll> data;
	rep(i,n){
		int a;
		cin>>a;a--;
		data.pb(a);
		if(i>0){
			cntr[a]++;
			cntr_sum[a]+=(data[i]-data[i-1]+(ll)m)%(ll)m;
		}
		if(i<n-1){
			cntl[a]++;
		}
	}
	/*rep(i,m)cout<<cntr_sum[i]<<" ";
	cout<<endl;*/
	int kukans=0;
	ll ans=0;
	rep(i,n-1){
		ll bef=data[i];
		ll aft=data[i+1];
		if(bef>aft){
			ans+=(1+aft);
		}else{
			ans+=(aft-bef);
		}
		if(bef>aft&&aft>0)kukans++;
	}
	//cout<<ans<<endl;
	ll mi=ans;
	for(int i=0;i<m-1;i++){
		ans+=(cntr_sum[i]-cntr[i]);
		ans-=kukans;
		kukans -= cntr[i+1];
		kukans += cntl[i];
		//cout<<ans<<endl;
		mi=min(mi,ans);
	}
	cout<<mi<<endl;
}

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

using namespace std;
int main(){
	
	string n;
	cin >> n;
	
	bool flag = false;
	
	for(int i=0; i<n.size(); i++){
		if(n[i] == '7'){
			flag = true;
			break;
		}
	}
	
	if(flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	
	return 0;
}


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

class Main{

	static char[][] map;
	static int N;
	static int M;
	static boolean flag;
	static int ans;



	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		int A =sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int ans = 0;
		int[] data = {A,B,C};
		Arrays.sort(data);
		
		
		
		
		int max = data[2];
		int mid = data[1];
		int min =data[0];
		
		ans = 0;
		if(max == mid&& min == mid){
			System.out.println(ans);
			return;
		}
		while(true){
			
			
			
						
			if(min == mid){
				min++;
				mid++;
			}else{
				min = min +2;
			}
			
			ans++;
			
			if(max == mid&& min == mid){
				System.out.println(ans);
				return;
			}
			
			data[0] = max;
			data[1] = mid;
			data[2] = min;
			Arrays.sort(data);
			  min = data[0];
			mid = data[1]  ;
			 max = data[2] ;
			
			
			
		}


	}


}

class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}





Measured memory_bytes: 23636
from math import gcd
from functools import reduce
from itertools import product

def resolve():
  K = int(input())
  # result = sum([ gcd(gcd(x[0], x[1]), x[2]) for x in itertools.product(range(1, K+1), range(1, K+1), range(1, K+1)) ])
  step1 = [ gcd(x[0], x[1]) for x in product(range(1, K+1), range(1, K+1)) ]
  result = sum([ gcd(x[0], x[1]) for x in product(step1, range(1, K+1)) ])
  print(result)

if __name__ == "__main__":
    resolve()

Measured memory_bytes: 72184
from collections import Counter

n = int(input())
s = input()
c = Counter(s)
cnt = c['R'] * c['G'] * c['B']

for i in range(n-2):
    for j in range(i+1, n-1):
        w = j - i
        if j+w >= n:
            continue
        if s[i] != s[j] and s[j+w] != s[j] and s[j+w] != s[i]:
            cnt -= 1

print(cnt)


Measured memory_bytes: 9456
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Globalization;

namespace AtCoderTest
{
    class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine().Trim());
            var buf = Console.ReadLine().Trim().Split();
            const int inf = (int)1e9;
            List<int> h = new List<int>();
            List<int> min = new List<int>();
            min.Add(0);
            for (int i = 0; i < N; i++) {
                h.Add(int.Parse(buf[i]));
                min.Add(inf);
            }

            for (int i = 0; i < N; i++) {
                if (i == 0) continue;
                int diff = h[i] - h[i - 1];
                if (diff < 0) diff = -diff;
                int tmp = min[i-1] + diff;
                if (min[i] > tmp) min[i] = tmp;

                if (i <= N - 2)
                {
                    int diff2 = h[i + 1] - h[i - 1];
                    if (diff2 < 0) diff2 = -diff2;
                    min[i + 1] = min[i-1] + diff2;
                }
            }

            int sum = min[N-1];
            Console.WriteLine(sum);
        }

    }
}

Measured memory_bytes: 36516
#include<iostream>
using namespace std;
int main()
{
    int t,n,s,s1,s2;
    cin >> s;
    s2=s%100;
    s1=s/100;
    if((s1!=0 && s2!=0) && (s1<=12) && (s2<=12))
    {
        cout<<"AMBIGUOUS";
    }

    else  if((s1!=0) &&(s1<=12))
    {
        cout<<"MMYY";
    }
    else if((s2!=0)&&(s2<=12))
    {
        cout<<"YYMM";
    }

    else
    {
        cout<<"NA";
    }

}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 300 + 5;
const ll inf = 1e14;

int n, k;
ll a[N], dp[N][N];

void init() {
  cin >> n >> k;
  for(int i = 1 ; i <= n ; ++i) cin >> a[i];
  a[0] = 0;
}
void solve() {
  ll mn = inf;
  for(int i = 0 ; i <= n ; ++i) {
    for(int j = 0 ; j <= n ; ++j) {
      dp[i][j] = inf;
    }
  }
  dp[0][0] = 0;
  for(int i = 1 ; i <= n ; ++i) {
    for(int j = 1 ; j <= i ; ++j) {
      for(int l = 0 ; l < i ; ++l) dp[i][j] = min(dp[i][j], dp[l][j - 1] + max(0LL, a[i] - a[l]));
    }
  }
  for(int i = 0 ; i <= n ; ++i) mn = min(mn, dp[i][n - k]);
  cout << mn << '\n';
}

int main() {
  init();
  solve();
}


Measured memory_bytes: 1024