akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	static int n;
	static int a;
	static int b;
	static int z;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		a = sc.nextInt();
		b = sc.nextInt();
		z = a - b;
		int max = 0;
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
			if (max < arr[i]) {
				max = arr[i];
			}
		}
		int x = 1;
		int y = max / b + 1;
		while (y > x) {
			int m = (x + y) / 2;
			if (complete(m, arr)) {
				y = m;
			} else {
				x = m + 1;
			}
		}
		System.out.println(y);
	}
	
	static boolean complete(int m, int[] arr) {
		int[] tmp = arr.clone();
		int t = m;
		for (int i = 0; i < n; i++) {
			tmp[i] -= b * m;
			if (tmp[i] > 0) {
				if (tmp[i] % z == 0) {
					t -= tmp[i] / z;
				} else {
					t -= tmp[i] / z + 1;
				}
			}
			if (t < 0) {
				return false;
			}
		}
		return true;
	}
}


Measured memory_bytes: 58516
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    for j in range(len(str(i))//2):
        # if str(i)[:j] == str
        flag = True
        if str(i)[j] != str(i)[-(j+1)]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{    
	cin>>a;
	for(int i=0;i<=a.size();i++)
	{
		if(a[i]=='C')
		{
			for(int j=i+1;j<=a.size();j++)
			if(a[j]=='F')
			{
				cout<<"Yes\n";
				return 0;
			}
		}
	}
	cout<<"No\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a,b;
    cin >> a >>b;
    if((a%2==0) || (b%2==0)){
        cout << "Even";
    }else
        cout << "Odd";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int n, k;
	cin >> n >> k;
	int mx = 0, d = 0;
	rep(_,0,n){
		int a;
		cin >> a;
		mx = max(mx, a);
		d = __gcd(d, a);
	}
	if(k%d == 0 && k <= mx) puts("POSSIBLE");
	else puts("IMPOSSIBLE");
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double p[] = new double[N];
		for(int i=0;i<N;i++) p[i]=sc.nextDouble();
		sc.close();
		
		double dp[][] = new double[N+1][N+1]; //i枚目を投げた段階の、表の数kの確率
		dp[0][0]=1;//１枚も投げていないとき、表０枚の確率が1
		//配るDP
		for(int i=0;i<N;i++) {
			for(int j=0;j<N;j++) {
				dp[i+1][0] = dp[i][0]*(1-p[i]);
				dp[i+1][j+1] += dp[i][j+1]*(1-p[i]) + dp[i][j]*p[i];
			}
		}
		//N枚投げたあと
		double ans = 0;
		int half = (N+1)/2;
		for(int i=half;i<N+1;i++) {
			ans += dp[N][i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 124376
#include<iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<map>
using namespace std;
using ulong = unsigned long;
using ll = long long;

int main(){
	int n;
	cin >> n;
	vector<int> as(n), as2;
	for(int i=0;i<n;i++){
		cin >> as[i];
	}
	as2 = as;
	sort(as2.begin(), as2.end());
	map<int, int> mp;
	for(int i=0;i<n;i++){
		mp[as2[i]] = i;
	}

	int ans = 0;
	for(int i=0;i<n;i++){
		if(mp[as[i]] % 2 != i % 2){
			ans++;
		}
	}

	cout << ans / 2 << endl;
	return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

struct edge{long long  to, cost;};
typedef pair<long long,long long> P;

struct graph{
  long long V;
  vector<vector<edge> > G;
  vector<long long> d;

  graph(long long n){
      init(n);
  }
  void init(long long n){
    V = n;
    G.resize(V);
    d.resize(V);
    for(long long i = 0; i < V; i++){
        d[i] = 1e15;
    }
  }
  void add_edge(long long s, long long t, long long cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }
  void dijkstra(long long s){
    for(long long i = 0; i < V; i++){
        d[i] = 1e15;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      long long v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};

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

    graph g(n);

    for(long long i = 0; i < n-1; i++){
        long long a, b, c;
        cin >> a >> b >> c;
        g.add_edge(a-1, b-1, c);
        g.add_edge(b-1, a-1, c);
    }

    long long q, k;
    cin >> q >> k;

    g.dijkstra(k-1);

    vector<long long> ans;
    for(long long i = 0; i < q; i++){
        long long x, y;
        cin >> x >> y;

        ans.push_back(g.d[x-1]+g.d[y-1]);
    }

    for(long long i = 0; i < q; i++){
        cout << ans[i] << endl;
    }
    return 0;
}

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

int main() {
  int N;
  int ans;
  cin >> N;
  for(int i = 0; i < N; i++){
      int l, r;
      cin >> l >> r;
      ans += r - l + 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <tuple>
#include <stack>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF INT_MAX>>1 //要climits#includ

typedef long long ll;

using namespace std;

int main(void){
	ll w, h, x, y;
	cin >> w >> h >> x >> y;
	long double ans1 = w*h/2.0;
	if(h/2 == y && w/2 == x && h%2 == 0 && w%2 == 0){
		cout << ans1 << " " << 1 << endl;
		//printf("%.12lf 1\n", ans1);
	} else{
		cout << ans1 << " " << 0 << endl;
		//printf("%.12lf 0\n", ans1);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define IOS cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int N; cin >> N;
    int pos;
    rep(i,N){
        int a; cin >> a;
        if(!i) pos=a;
        else {
            pos=gcd(a,pos);
        }
    }
    cout << pos << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;

int main()
{
  ll a;
  cin >> a;
  cout << a + a * a + a * a * a << endl;
  return 0;
}


Measured memory_bytes: 3628
#x+y = A
#2x+4y = B

A,B = map(int,input().split())

Y = (B - 2*A) / 2

if not( Y.is_integer() ) or ( Y < 0) :
    print('No')
    exit(0)
else:
    X = A - Y
    if X < 0:
        print('No')
        exit(0)

print('Yes')


Measured memory_bytes: 8952
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> P;

int n, m, q;
vector <int> a, b, c, d;
int ans;

template <typename T>
void printVec(vector<T> &vec) {
  cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    cout << *it << " ";
  }
  cout << endl;
}

int main() {
  int n, k;
  cin >> n >> k;

  vector <int> sunuke(n, 0);
  for(int i = 0; i < k; i++) {
    int d;
    cin >> d;
    vector <int> a(d);
    
    for (int j = 0; j < d; j++) {
      cin >> a[j];
      sunuke[a[j] - 1] = 1;
    }
  }
  int ans = 0;
  for(int i = 0; i < n; i++) {
    if (sunuke[i] == 0) {
      ans = ans + 1;
    }
  }
  // printVec(sunuke);
  cout << ans << endl;
	return 0;
}


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

using namespace std;

using ll = long long;

bool isprime(int n) {
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

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

    while (!isprime(n)) {
        n++;
    }
    
    cout << n << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath> 
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int x,t;
	cin>>x>>t;
	if((x-t)>0)
		cout<<x-t<<endl;
	else
		cout<<0<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mxn= 1e5+5;
// check for forloop
// intialize variable
// overflow
// go for easy solution
#define mod 1000000007
ll INF = 1000000000000000005LL;
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    string s,t;
    cin>>s>>t;
    int n=s.size();
    int k=t.size();
    int ans=INT_MAX;
    for(int i=0;i<=n-k;i++){
        int temp=0;
        for(int j=0;j<k;j++){
            if(s[i+j]!=t[j]){
                temp++;
            }
        }
        ans=min(ans,temp);
    }
    cout<<ans;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define int long long
using namespace std;
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; }

const int INF=1e18;

signed main()
{   
    int N,W; cin>>N>>W;
    vector<int> w(N),v(N);
    for(int i=0;i<N;i++){
        cin>>w[i]>>v[i];
    }
    
    vector<vector<int> > dp(N+1,vector<int>(W+1,-1));
    dp[0][0]=0;

    for(int i=0;i<N;i++){
        for(int j=0;j<=W;j++){
            if(dp[i][j]==-1) continue;
            chmax(dp[i+1][j],dp[i][j]);
            if(j+w[i]<=W){
                chmax(dp[i+1][j+w[i]],dp[i][j]+v[i]);
            }
        }
    }
    cout<<*max_element(dp[N].begin(),dp[N].end())<<endl;
}   


Measured memory_bytes: 80256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int x,a,b,c,u;
    cin>>x>>a>>b;
    c = sqrt((x-a)*(x-a));
    u = sqrt((x-b)*(x-b));
 
    if(c>u)
        cout<<"B"<<endl;
    else
        cout<<"A"<<endl;
    
    return 0;
}

Measured memory_bytes: 256
while 1
  x = gets.split(' ')
  n = x[0].to_i
  m = x[1].to_s
  if(n==0)
    break
  end
  res = 0
  for i in 0..(m.length-1)
    res*=n
    if(m[i]=='0')
      res+=0
    end
    if(m[i]=='1')
      res+=1
    end
    if(m[i]=='2')
      res+=2
    end
    if(m[i]=='3')
      res+=3
    end
    if(m[i]=='4')
      res+=4
    end
    if(m[i]=='5')
      res+=5
    end
    if(m[i]=='6')
      res+=6
    end
    if(m[i]=='7')
      res+=7
    end
    if(m[i]=='8')
      res+=8
    end
    if(m[i]=='9')
      res+=9
    end
    if(m[i]=='A')
      res+=10
    end
    if(m[i]=='B')
      res+=11
    end
    if(m[i]=='C')
      res+=12
    end
    if(m[i]=='D')
      res+=13
    end
    if(m[i]=='E')
      res+=14
    end
    if(m[i]=='F')
      res+=15
    end
    if(m[i]=='G')
      res+=16
    end
    if(m[i]=='H')
      res+=17
    end
    if(m[i]=='I')
      res+=18
    end
    if(m[i]=='J')
      res+=19
    end
    if(m[i]=='K')
      res+=20
    end
    if(m[i]=='L')
      res+=21
    end
    if(m[i]=='M')
      res+=22
    end
    if(m[i]=='N')
      res+=23
    end
    if(m[i]=='O')
      res+=24
    end
    if(m[i]=='P')
      res+=25
    end
    if(m[i]=='Q')
      res+=26
    end
    if(m[i]=='R')
      res+=27
    end
    if(m[i]=='S')
      res+=28
    end
    if(m[i]=='T')
      res+=29
    end
    if(m[i]=='U')
      res+=30
    end
    if(m[i]=='V')
      res+=31
    end
    if(m[i]=='W')
      res+=32
    end
    if(m[i]=='X')
      res+=33
    end
    if(m[i]=='Y')
      res+=34
    end
    if(m[i]=='Z')
      res+=35
    end
  end
  ans = 2**100
  k = n
  for i in 2..n
    if k%i == 0
      tmp = 0
      r = 0
      while k%i==0
        k/=i
        r+=1
    end
      j=i
      while j<=res
        tmp+=res/j
        j*=i
      end
      ans = [ans,tmp/r].min()
    end
  end
  puts ans
end

Measured memory_bytes: 8800
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

class SkillUp
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(' ');

        var times = int.Parse(input[0]);
        var algo = int.Parse(input[1]);
        var target = int.Parse(input[2]);
        int total = int.MaxValue;

        int[][] textList = new int[times][];
        


        for(var i = 0; i < times; i++)
        {
            var put = Console.ReadLine().Split(' ');
            textList[i] = put.Select(int.Parse).ToArray();
        }


        for(var i = 0; i < Math.Pow(2, times); i++)
        {
            int[] rikaido = new int[algo + 1];
            bool flag = true;
            for(var j = 0;j < times; j++)
            {
                if(((i >> j) & 1) == 1)
                {
                    for(var k = 0; k < textList[j].Length; k++)
                    {
                        rikaido[k] += textList[j][k];
                    }
                }
            }

            for(var j = 1; j < rikaido.Length; j++)
            {
                if(target > rikaido[j])
                {
                    flag = false;   
                }
            }

            if (flag)
            {
                total = Math.Min(total, rikaido[0]);
            }

            

        }

    
        if(total == int.MaxValue)
        {
            total = -1;
        }

        Console.WriteLine(total);
    }
}

Measured memory_bytes: 28956
#include <bits/stdc++.h>
#define N 51
using namespace std;
int h,w,p=0;
string A,mp[N];
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int x,y,dir;
void start();

void Forward(){
  int nx = x+dx[dir],ny = y+dy[dir];
  if(nx>=0&&ny>=0&&nx<w&&ny<h&&mp[ny][nx]!='#') x=nx,y=ny;
}
 
void Back(){
  int nx = x+dx[(dir+2)%4],ny = y+dy[(dir+2)%4];
  if(nx>=0&&ny>=0&&nx<w&&ny<h&&mp[ny][nx]!='#') x=nx,y=ny;
}
 
void getIdx(){
  char ch = A[p];
  int cnt=0;
  while(1){
    if(ch=='{')cnt+=(A[p]=='{')-(A[p]=='}');
    if(ch=='[')cnt+=(A[p]=='[')-(A[p]==']');
    p++;
    if(cnt==0) return;
  } 
}

bool kabe(){
  int nx = x+dx[dir],ny = y+dy[dir];
  if(nx<0||ny<0||nx>=w||ny>=h) return 1;
  return mp[ny][nx] == '#';
}
 
int getCheck(){
  char P = A[p];
  if(P=='N')return dir == 0;
  if(P=='E')return dir == 1;
  if(P=='S')return dir == 2;
  if(P=='W')return dir == 3;
  if(P=='C')return kabe();
  if(P=='T')return 1;
}

void While(){
  int sp = p;
  int f = A[++p]=='~';p+=f;
  int l = p;
  while(1){
    bool con = (getCheck()+f)%2;p++;
    if(con==0) break;
    start();
    p = l;
  }
  p = sp;
  getIdx();
}
 
void If(){
  assert(A[p]=='[');
  int sp = p;
  int f = A[++p]=='~';p+=f;
  bool con = (getCheck()+f)%2;p++;
  if(con) start();
  p = sp;
  getIdx();
}
 
int ans,cnt;
void start(){
  while(1){
    if(cnt++>1e7)cout<<-1<<endl,exit(0);
    char P = A[p];
    if(P == '{') While();      
    else if(P == '[')If();
    else if(P =='^'||P=='v'){
      (P=='^')? Forward():Back(),ans++,p++;
      if(mp[y][x] == 'g')cout<<ans<<endl,exit(0);
    }
    else if(P=='<'||P=='>') dir=(P=='>')?(dir+1)%4:(dir+3)%4,ans++,p++;
    else return;
  }
}
 
int main(){
  cin>>h>>w;
  for(int i=0;i<h;i++)cin>>mp[i];
  cin>>A;

  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) if(mp[i][j] == 's')y = i,x = j;

  start();
  cout<<-1<<endl;
  return 0;
}

Measured memory_bytes: 3156
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    vector<int> v{ 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
    int K; cin >> K;
    cout << v[K - 1] << endl;
}


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


int main()
{
	string S;

	cin >> S;

	if(S == "ABC"){
		cout << "ARC";
	}
	else if(S == "ARC"){
		cout << "ABC";
	}


	return 0;
	
}

Measured memory_bytes: 3628
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
#define lli long long
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  sort(a,a+n);
  int sum=0;
  for(int i=0;i<n-1;i++)
    sum+=a[i];
  if(sum>a[n-1])
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
using ll = long long;

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(m);
    for (int i=0;i<m;i++){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end(),greater<int>());
    vector<int> b(m-1);
    for(int i=0;i<m-1;i++){
        b.at(i) = a.at(i+1)-a.at(i);
    }
    sort(b.begin(),b.end());
    int sum=0;
    for (int i=n-1;i<m-1;i++){
        sum+=b.at(i);
    }
    cout << -sum << endl;
    return 0;
}

Measured memory_bytes: 1024
A,B,C = map(int,input().split())
K = int(input())

ans = 0
while 1:
    if A < B:
        break
    else:
        B *= 2
        ans += 1

while 1:
    if B < C:
        break
    else:
         C *= 2
         ans += 1

if ans <= K:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 9040
n = int(input())
w = list(map(int, input().split()))

tmp = 10 ** 5

for i in range(1, n):
    s1 = sum(w[:i])
    s2 = sum(w[i:])
    gap = abs(s1 - s2)
    tmp = min(tmp, gap)
print(tmp)

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

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int n;
    string a,b,c;
    cin>>n>>a>>b;
    for(int i=0;i<n; i++)
        {
            c+=a[i];
            c+=b[i];
        }
    cout<<c<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int a[10000];
int main(){
  int n;
  while(cin>>n,n){

  for(int i=0;i<n;i++)cin>>a[i];
  int ans=1000000;
  sort(a,a+n);
  for(int i=1;i<n;i++)ans=min(ans,abs(a[i]-a[i-1]));
  cout<<ans<<endl;
  for(int i=0;i<n;i++)a[i]=0;
  }
  return 0;
}

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

unsigned long long sum;

int main() {
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) sum += s[i] - '0';
    (sum % 9) ? puts("No") : puts("Yes");
    return 0;
}


Measured memory_bytes: 3744
#include <iostream>
#include<string> 
#include<vector> 
#include<algorithm>
using namespace std;
int main()
{
	int n;
	cin >> n;
	vector<int> a(n); 
	for (int i = 0; i < n; i++)
	{ 
		cin >> a.at(i);
	} 
	sort(a.begin(), a.end());  
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		if (i == n - 1)
		{
			a.at(i) = a.at(i) / 2;
		} 
		ans += a.at(i);
	} 
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define lli long long int
#define rep(i,n) for(lli i=0; i<n; i++)
#define loop(i, j, n) for(lli i=j; i<n; i++)
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
//Function
lli combi(lli n, lli r)
{
	if(r==0 || r==n) return 1;
	else return combi(n-1,r) + combi(n-1,r-1);
}
lli sigma1(lli n){return n*(n+1)/2;}
lli sigma2(lli s, lli n){return sigma1(n) - sigma1(s -1);}
using namespace std;
// }}} End Header

lli body(lli a, lli b){
	return (a-b)*(a-b);
}
int main()
{
	lli n;
	map<string, lli> m;
	cin >> n;
	rep(i,n){
		string s;
		cin >> s;
		m.insert(make_pair(s, i));
	}
	cout << m.size() << endl;
	return 0;
}


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

int main(){
    string S;
    cin >> S;
    int ans;

    int cnt = 0;
    for ( int i = 0 ; i < 3 ; i++ ){
        if ( S[i] == 'o' ) cnt++;
    }

    ans = 700 + cnt * 100;
    cout << ans << endl;
}

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

struct Dice
{
	Dice(){}
	void init(int d[6]){
		for(int i = 0; i < 6; ++i)
			n[i] = d[i];
	}
	void toN(){ shift( n[0], n[1], n[5], n[4] ); }
	void toS(){ shift( n[0], n[4], n[5], n[1] ); }
	void toW(){ shift( n[0], n[2], n[5], n[3] ); }
	void toE(){ shift( n[0], n[3], n[5], n[2] ); }
	void shift( int& a, int& b, int& c, int& d ){
		int t = a;
		a = b;
		b = c;
		c = d;
		d = t;
	}
	void twist(){
		int a = n[1];
		n[1] = n[2];
		n[2] = n[4];
		n[4] = n[3];
		n[3] = a;
	}
	bool isSameNumber( const Dice& d ){
		for(int i = 0; i < 6; ++i){
			if(n[i] != d.n[i])
				return false;
		}
		return true;
	}
	bool isTwistSame( const Dice& d ){
		if( n[0] != d.n[0] || n[5] != d.n[5] )
			return false;

		for(int j = 0; j < 4; ++j){
			twist();
			if( this->isSameNumber( d ))
				return true;
		}
		return false;
	}
	bool isSame( const Dice& d ){
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		if( this->isTwistSame(d) ) return true;
		this->toE();
		if( this->isTwistSame(d) ) return true;
		this->toN();
		this->toN();
		if( this->isTwistSame(d) ) return true;

		return false;
	}
	
	int n[6];
};

int main()
{
	Dice dice[100];
	int n, i, j, d[6] = {};
	cin >> n;
	if( n <= 1 ){
		cout << "Yes\n";
		return 0;
	}

	for( i = 0; i < n; ++i){
		for(j = 0; j < 6; ++j){
			cin >> d[j];
		}
		dice[i].init(d);
	}

	for(i = 0; i < n - 1; ++i){
		for( j = i+1; j < n; ++j){
			if(dice[i].isSame(dice[j])){
				cout << "No\n";
				return 0;
			}
		}
	}

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

Measured memory_bytes: 1124
n = gets.chomp.to_i
a = gets.chomp.split().map(&:to_i).sort.reverse
alice = []
bob = []
i = 0
for i in 0..n-1
    if i%2 == 1
        bob.push(a[i])
    else
        alice.push(a[i])
    end
end
print alice.inject(:+) - bob.inject(:+)


Measured memory_bytes: 1788
#include<bits/stdc++.h>
typedef long long ll;
#define M 1000000007
#define endl "\n"
#define int long long 
using namespace std;
int32_t main()
{
    ios::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int ar[n+2];

    memset(ar,0,sizeof(ar));
    for(int i=1;i<=n;i++)
    {
    	cin>>ar[i];
    }
    int pref[n+2]={0};
    for(int i=1;i<=n;i++)
    {
    	pref[i]=__gcd(pref[i-1],ar[i]);
    }
    int suf[n+2]={0};
    for(int i=n;i>=1;i--)
    {
    	suf[i]=__gcd(suf[i+1],ar[i]);
    }
    int ma=0;
    for(int i=1;i<=n;i++)
    {
    	if(__gcd(pref[i-1],suf[i+1])>ma)
    	{
    		ma=__gcd(pref[i-1],suf[i+1]);
    	}
    }
    cout<<ma;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>

#define MAXN 3005
#define INF 100000000

int bit[2*MAXN];

void add(int x, int val) {
  x += 1;
  while(x < 2*MAXN) {
    bit[x] += val;
    x += x&(-x);
  }
}

int sum(int x) {
  x += 1;
  int ret = 0;
  while(x > 0) {
    ret += bit[x];
    x -= x&(-x);
  }
  return ret;
}

int main() {
  int n;
  std::cin >> n;

  int pos[2][n];
  for(int i = 0; i < 2*n; i++) {
    char c; int x;
    std::cin >> c >> x;
    int cur = c == 'W' ? 0 : 1;
    pos[cur][x-1] = i;
  }

  std::vector<std::vector<int> > dp(n+1, std::vector<int>(n+1, INF));

  dp[0][0] = 0;
  for(int i = 0; i <= n; i++) {
    if(i) add(pos[0][i-1], 1);

    for(int j = 0; j <= n; j++) {
      if(j) add(pos[1][j-1], 1);
      if(i < n) dp[i+1][j] = std::min(dp[i+1][j], dp[i][j] + pos[0][i] - sum(pos[0][i]));
      if(j < n) dp[i][j+1] = std::min(dp[i][j+1], dp[i][j] + pos[1][j] - sum(pos[1][j]));
    }

    for(int j = 0; j < n; j++)
      add(pos[1][j], -1);
  }

  std::cout << dp[n][n] << std::endl;
  return 0;
}



Measured memory_bytes: 19068
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  int x = stoi(s+t);
  for(int i=1;i<=1000;i++){
    if(i*i==x){
      cout << "Yes" << endl;
    return 0;
    }
  }
  cout << "No" << endl;
}
  

Measured memory_bytes: 256
# coding: utf-8
import sys
# from operator import itemgetter
sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)
from heapq import heappop, heappush
#from collections import OrderedDict, defaultdict
#import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque
#import numba

def sum_between(a, b):
    if a > b:a, b = b, a
    return (b-a+1) * (b+a) // 2

def run():
    N = int(input())
    n_dots = 0
    for i in range(1, N+1):
        n_dots += (1+i) * i // 2
    #print(n_dots)
    ans = (N-1) * (N+1) * N // 2
    #print(ans)
    for i in range(N-1):
        l, r = map(int, sysread().split())
        if l > r: l,r = r,l
        tmp = 0
        if l > 1: tmp += sum_between(r-1, r-l+1)
        tmp += r-l
        tmp += sum_between(N-l, 1)
        #print(tmp)
        ans -= tmp

    print(n_dots - ans)


    ans = (N-1) * N * N


if __name__ == "__main__":
    run()

Measured memory_bytes: 9196
def resolve():
    N,M = map(int,input().split())

    DP = [10 ** 8  + 1 for _ in range(1 << N)]
    DP[0] = 0

    for _ in range(M):
        a,_ = map(int,input().split())
        c = list(map(int,input().split()))
        bit = 0
        for j in c:
            bit |= 1 << (j-1)
        for j in range(1 << N):
            DP[j | bit] = min(DP[j]+a,DP[j|bit])
    print(DP[-1] if DP[-1] != 10 ** 8 + 1 else -1)
resolve()

Measured memory_bytes: 46680
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#ifdef PERVEEVM_LOCAL
    #define debug(x) std::cerr << (#x) << ":\t" << (x) << std::endl
#else
    #define debug(x) 238;
#endif

#define fastIO std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0)
#define NAME "File"

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

#ifdef PERVEEVM_LOCAL
    std::mt19937 rnd(238);
#else
    std::mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const double PI = atan2(0.0, -1.0);
const int INF = 0x3f3f3f3f;
const ll LINF = (ll)2e18;
const int N = 100100;

int a[N][3];
ll dp[N][3];

void run() {
    int n;
    scanf("%d", &n);

    for (int i = 1; i <= n; ++i) {
        scanf("%d%d%d", &a[i][0], &a[i][1], &a[i][2]);
    }

    for (int i = 1; i <= n; ++i) {
        dp[i][0] = std::max(dp[i - 1][1], dp[i - 1][2]) + a[i][0];
        dp[i][1] = std::max(dp[i - 1][0], dp[i - 1][2]) + a[i][1];
        dp[i][2] = std::max(dp[i - 1][0], dp[i - 1][1]) + a[i][2];
    }

    printf("%lld\n", std::max(std::max(dp[n][0], dp[n][1]), dp[n][2]));
}

int main(void) {
    // freopen(NAME".in", "r", stdin);
    // freopen(NAME".out", "w", stdout);

    auto start = std::chrono::high_resolution_clock::now();
    run();
    auto end = std::chrono::high_resolution_clock::now();

    #ifdef PERVEEVM_LOCAL
        std::cerr << "Execution time: "
                  << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count()
                  << " ms" << std::endl;
    #endif

    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll m, k;
    cin >> m >> k;
    if (k >= (1 << m)) {
        cout << "-1" << endl;
    }
    else if (m == 0) {
        if (k == 0) cout << "0 0" << endl;
        else cout << "-1" << endl;
    }
    else if (m == 1) {
        if (k == 0) cout << "0 0 1 1" << endl;
        else cout << "-1" << endl;
    }
    else {
        set<ll> s;
        rep(i, 1 << m) s.insert(i);
        deque<ll> dq;
        dq.push_back(k);
        s.erase(k);
        for(auto x : s) {
            dq.push_front(x);
            dq.push_back(x);
        }
        dq.push_back(k);
        rep(i, sz(dq)) {
            printf("%lld%s", dq[i], (i == (sz(dq) - 1)) ? "\n" : " ");
        }
    }
    return 0;
}


Measured memory_bytes: 10112
#include "bits/stdc++.h"
using namespace std;
int main()
{
    char n[4];
    scanf("%s", n);
    int a[4];
    for (int i = 0; i < 4; i++)
    {
        a[i] = n[i] - '0';
    }
    
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 2; j++)
        {
            for (int k = 0; k < 2; k++)
            {
                if ((a[0] + (i ? a[1] : -a[1]) + (j ? a[2] : -a[2]) + (k ? a[3] : -a[3])) == 7)
                {
                    printf("%d%c%d%c%d%c%d=7\n", a[0], i ? '+' : '-', a[1], j ? '+' : '-', a[2], k ? '+' : '-', a[3]);
                    return 0;
                }
            }
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define pii pair<int, int>
#define endl "\n"
#define int long long
#define F first
#define S second
#define B begin
#define E end
#define RB rbegin
#define RE rend
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const int INF = 1e9 + 1;
const double EPS = 1e-10;
const ll P = 1e9 + 7;
const int Q = 47;
 
using namespace std;
 
void hello()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}
 
void show(vector<int>& arr)
{
    for (auto i : arr)
        cout << i << " ";
    cout << endl;
}
void show(vector<vector<int>>& arr)
{
    for (auto i : arr)
        show(i);
    cout << endl;
}


signed main()
{
    hello();
    
    int n;
    cin >> n;
    string s;
    cin >> s;
    int cnt = 0;
    int res = INF;
    for (int i = 0; i < n; ++i)
        if (s[i] == 'R')
            ++cnt;
    int acnt = 0;
    res = cnt;
    for (int i = 0; i < n; ++i)
    {
        if (s[i] == 'R')
            ++acnt;
        res = min(res, (i + 1 - acnt) + max(cnt - acnt - (i + 1 - acnt), 0ll));
    }
    cout << res << endl;
}

Measured memory_bytes: 3656
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,g;
    cin>>a>>b>>c;
    if(a==b) cout<<c<<endl;
    if(a==c) cout<<b<<endl;
    if(c==b) cout<<a<<endl;

    return 0;
}


Measured memory_bytes: 3584
#include <stdio.h>

int main(void){
  char s[101],p[101];
  int i,j,sn=0,pn=0,t;

  scanf("%s %s",s,p);

//文字数カウント
  while(s[sn] != '\0') sn++;
  while(p[pn] != '\0') pn++;

  for(i=0;i<sn;i++){
    t=1;
    for(j=0;j<pn;j++)
      if(s[(i+j)%sn] != p[j]) t=0;
    if(t) break;
  }

  if( t )
    printf("Yes\n");
  else
    printf("No\n");

  return 0;
}


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

const int64_t INF = 1e+15;

int main() {
    int64_t A,B,Q;
    cin >> A >> B >> Q;
    vector<int64_t> s(A+10),t(B+10),x(Q);
    
    for ( int64_t i = 0; i < 5; ++i){
        s[i] = -INF;
        t[i] = -INF;
    }
    for ( int64_t i = 0; i < A; ++i){
        cin >> s[i+5];
    }
    for ( int64_t i = 0; i < B; ++i){
        cin >> t[i+5];
    }
    for ( int64_t i = 0; i < 5; ++i){
        s[i+A+5] = INF;
        t[i+B+5] = INF;
    }
    
    for ( int64_t i = 0; i < Q; ++i){
        cin >> x[i];
    }
    
    /*cout << "-----" ;
    for ( auto p : s ){
        cout << p << " " ;
    }
    cout << "======";*/
    
    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    
    for ( int64_t i = 0; i < Q; ++i){
        int64_t pos = x[i];
        auto itrs = lower_bound(s.begin(),s.end(),pos);
        auto itrt = lower_bound(t.begin(),t.end(),pos);
        
        int64_t idxs = itrs - s.begin();
        int64_t idxt = itrt - t.begin();
        
        
        vector<int64_t> ans(6,0);
        int64_t s0,s1,t0,t1;
        s0 = pos - s[idxs-1];
        s1 = s[idxs] - pos;
        t0 = pos - t[idxt-1];
        t1 = t[idxt] - pos;
        //cout << "st " << s0 << " " << s1 << " " << t0 << " " << t1 << endl;
        ans[0] = max(s1,t1);
        ans[1] = max(s0,t0);
        ans[2] = 2 * s1 + t0;
        ans[3] = 2 * s0 + t1;
        ans[4] = 2 * t1 + s0;
        ans[5] = 2 * t0 + s1;
        
        cout << *min_element(ans.begin(),ans.end()) << endl;
        
    }
    
    return 0;
}


Measured memory_bytes: 5580
#define EPS 1e-10
#define equals(a, b) (fabs((a) - (b)) < EPS)
#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

class Point
{
public:
  double x, y;
  Point (double x = 0, double y = 0) : x(x), y(y) {}
  Point operator + (Point p) {return Point(x + p.x, y + p.y); }
  Point operator - (Point p) {return Point(x - p.x, y - p.y); }
  Point operator * (double a) {return Point(a * x, a * y); }
  Point operator / (double a) {return Point(x / a, y / a); }

  double norm() { return x * x + y * y; }
  double abs() { return sqrt(norm()); }

  bool operator < (const Point &p) const
  {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const
  {
    return equals(x, p.x) && equals(y, p.y);
  }
};

typedef Point Vector;
typedef vector<Point> Polygon;

struct Segment
{
  Point p1, p2;
};

typedef Segment Line;

class Circle
{
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};


// dot and cross product
double dot(Vector a, Vector b)
{
  return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b)
{
  return a.x * b.y - a.y * b.x;
}

bool isOrthagonal(Vector a, Vector b)
{
  return equals(dot(a, b), 0.0);
}

bool isOrthagonal(Point a1, Point a2, Point b1, Point b2)
{
  return isOrthagonal(a1 - a2, b1 - b2);
}

bool isParallel(Vector a, Vector b)
{
  return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2)
{
  return isParallel(a1 - a2, b1 - b2);
}

int main()
{
  int T;
  scanf("%d", &T);
  while (T--)
  {
    Point p0, p1, p2, p3;
    scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &p0.x, &p0.y, &p1.x, &p1.y, &p2.x, &p2.y, &p3.x, &p3.y);
    if (isOrthagonal(p0, p1, p2, p3))
    {
      printf("1\n");
    }
    else if (isParallel(p0, p1, p2, p3))
    {
      printf("2\n");
    }
    else
    {
      printf("0\n");
    }
  }
}



Measured memory_bytes: 2760
#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")

// Begin {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}

constexpr int INF = 0x3f3f3f3f;
constexpr int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;

using pii = pair<int64_t, int64_t>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
// }}} End

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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

    size_t N; cin >> N;

    intmax_t sum = 0;
    vector<intmax_t> t(N);
    for (auto &ti: t) {
        cin >> ti;
        sum += ti;
    }

    size_t M; cin >> M;

    intmax_t maxv = 0;
    while (M--) {
        intmax_t p, x; cin >> p >> x;
        p--;

        cout << sum - (t[p] - x) << "\n";
    }

    return 0;
}


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

# mod=10**9+7
# rstrip().decode('utf-8')
# map(int,input().split())
# import numpy as np


def main():
	n=int(input())
	s="abcdefghijklmn"

	li=[[] for _ in range(10)]
	li[0]=[["a",0]]


	for i in range(1,10):

		for t,val in li[i-1]:
			for j in range(val+2):
				li[i].append([t+s[j],max(val,j)])

	for t,_ in li[n-1]:
		print(t)


if __name__ == "__main__":
	main()


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;


    string st;

    cin >> st;

    string st1;

    for(int i=0; i<=3; i++)
    {
        st1.pb(st[i]);
    }



    stringstream geeks(st1);

    ll x = 0;

    geeks >> x;


    string st2;


    for(int i=5; i<=6; i++)
    {
        st2.pb(st[i]);
    }


    stringstream g(st2);
    ll y = 0;

    g >> y;


    string st3;


    for(int i=8; i<=9; i++)
    {
        st3.pb(st[i]);
    }

    stringstream h(st3);

    ll z = 0;

    h >> z;

    if(x<=2019 && y<=4 && z<=30)
    {
        cout << "Heisei" << endl;
    }
    else
    {
        cout << "TBD" << endl;
    }






    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin,(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int h,w;
    cin >> h >> w;
    char a[h][w];
    REP(i,h){
        REP(j,w)cin >> a[i][j];
    }
    bool change=true;
    
    REP(i,h){
        change = true;
        REP(j,w){
            if(!(a[i][j] == '.' || a[i][j] == ',')){
                change = false;
            }
        }
        if(change){
            REP(j,w){
                a[i][j]=',';
            }
        }
    }
    REP(i,w){
        change = true;
        REP(j,h){
            if(!(a[j][i] == '.' || a[j][i] == ',')){
                change = false;
            }
        }
        if(change){
            REP(j,h){
                a[j][i] = ',';
            }
        }
    }

   
    bool flag;
    REP(i,h){
        flag = false;
        REP(j,w){
            if(a[i][j]!=','){
                cout << a[i][j];
                flag = true;
            }
        }
        if(flag)
        cout << endl;
    }
    

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <string> vs;

int main()
{
    ll x,a;
    cin>>x>>a;
    if(x<a)
        cout<<0<<endl;
    else
        cout<<10<<endl;
}


Measured memory_bytes: 256
def f;gets.split.map &:to_i;end
while(n,m=f)[0]>0
l=(0..2).map{(i=f)[0]=0;i}
r=[0,1].map{|x|a,b,c=t=l.map(&:dup);(0..m).find{|d|!(b[1]||a[1]&&c[1])||![t[x][-1]>t[z=y=x+1][-1]&&(x,y=y,x),(t[x].push t[y].pop),x=2-z]}||1e8}.min
p r<1e8?r:-1
end

Measured memory_bytes: 6132
# -*- coding: utf-8 -*-
"""
Created on Sat May 30 16:59:03 2020

@author: Tofu
"""

def tran(N,string):
    #print(N)
    #print(string)
    if len(string) > N:
        strout = string[:N]+'...'
        return strout
    else:
        return string

if __name__ == '__main__':
    N = int(input())
    string = input()
    ans = tran(N,string)
    print(ans)
    

Measured memory_bytes: 9120
using System;
using CompLib.Util;

public class Program
{
    public void Solve()
    {
        var sc = new Scanner();
        int[] x = sc.IntArray();

        for (int i = 0; i < 5; i++)
        {
            if (x[i] == 0)
            {
                Console.WriteLine(i + 1);
                return;
            }
        }
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 28236
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    ll n,k;
    scanf("%lld%lld",&n,&k);
    map<int,int> a;
    set<int> c;
    for(int i = 0; i < n; i++){
        int b;
        scanf("%d",&b);
        a[b]++;
        c.insert(b);
    } 
    vector<int> d;
    for(auto v: c){
        d.emplace_back(a[v]);
    }
    sort(d.begin(),d.end());
    int f = d.size();
    ll sum = 0;
    for(int i = 0; f > k; i++){
        sum += d[i];
        f--;
    }
    printf("%lld\n",sum);
}

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

using namespace std;
using i64 = int64_t;

int main(){
    string s;
    cin >> s;
    int ret = 0;
    for(auto&& c:s){
        if(c == '+')ret++;
        else ret--;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}

ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
//二項係数 nCr
const int MAX = 700000;

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

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main(){
  COMinit();
  ll n;
  cin>>n;
  vll a(n+1);
  rep(i,n+1)cin>>a[i];
  set<ll> s;
  ll cu;
  ll ccu;
  ll count;
  rep(i,n+1){
    if(s.count(a[i])){
      count=a[i];
      cu=i;
      break;
    }
    s.insert(a[i]);
  }
  rep(i,n){
    if(a[i]==count){
      ccu=i;
      break;
    }
  }
  ll no=n-cu+ccu;
  for(int i=1;i<=n+1;i++){
    ll ans=0;
    ans+=COM(n+1,i);
    ans-=COM(no,i-1);
    
    if(ans<0) ans+=MOD;
    COUT(ans);
  }
}

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

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

template<class T>
inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T>
inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T>
inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T>
inline T LCM(T a, T b) { return (a + (b - 1)) / b; }
template<class T>
inline T round_int(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	ll n, k;
	cin >> n >> k;

	ll ans = n % k;
	cout << min(ans, abs(ans - k)) << endl;
}

Measured memory_bytes: 256