akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define inf 1e18
#define fo(i,y,n,inc)	for(int i=y;i<n+y;i+=inc)
#define cin(t) int t;cin>>t
#define w(t) while(t--)
#define nl cout<<endl;
#define pb push_back
#define ft(i) (i&(-1*i))
#define arrIn(arr,size)		for(int i=0;i<size;i++){cin>>arr[i];}
#define arrOut(arr,size,seperater)	for(int i=0;i<size;i++){cout<<arr[i]<<seperater;}
using namespace std;

int max(int a, int b) {
	if (a > b)
		return a;
	return b;
}

int min(int a, int b) {
	if (a < b)
		return a;
	return b;
}

int powmd(int a, int b) {
	if (b == 1)	return a;
	if (b == 0)	return 1;

	int half = powmd(a, b / 2);
	int ans = half * half;
	ans %= mod;
	if (b & 1) {
		ans *= a;
	}
	ans %= mod;
	return ans;
}

void fastIO() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}
int n;
vector<int> tree[100005];
int dp[100005][2];

int solve(int currNode, int parent , int prevBlack) {

	if (dp[currNode][prevBlack] != -1)	return dp[currNode][prevBlack];
	int ans = 0;
	int first = 1;
	int second = 1;
	bool leafNode = true;
	for (auto it : tree[currNode]) {
		if (it != parent) {
			leafNode = false;
			second *= solve(it, currNode, 0);
			second %= mod;
			if (!prevBlack) {
				first *= solve(it, currNode, 1);
				first %= mod;
			}
		}
	}
	if (prevBlack == 1) {
		ans = second;
	}
	else ans = first + second;
	ans %= mod;
	return dp[currNode][prevBlack] = ans;
}

int32_t main() {

	fastIO();

	cin >> n;
	fo(i, 0, n - 1, 1) {
		cin(a); cin(b);
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	memset(dp, -1, sizeof(dp));

	cout << solve(1, -1, 0) << endl;

	return 0;
}

// cout << "Case #" << i << ": " << answer << endl;

Measured memory_bytes: 17512
#include<bits/stdc++.h>
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define ll long long
#define M 100000007
#define fr first
#define sc second
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll, ll>
#define psi pair<string, ll>
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define PI 3.14159265
#define r0 return 0
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;


int main() {
  fast
  ll h,n;
  cin>>h>>n;
  ll a[n];
  rep(i,0,n) cin>>a[i];
  rep(i,0,n){
      h-=a[i];
      if(h<=0) {
          cout<<"Yes";
          return 0;
      }
  }
  cout<<"No";
}



Measured memory_bytes: 1024
def con(n):
    sum = 0
    while n>0:
        sum +=n%10
        n //=10
    return sum
N,A,B = map(int,input().split())
total=0
for i in range(N+1):
    sum = con(i)
    if A<=sum and sum<=B:
        total +=i
print(total)

Measured memory_bytes: 3060
import sys


def input(): return sys.stdin.readline().strip()


def resolve():
    n, m = map(int, input().split())
    cnt = 0
    if 2*n <= m:
        cnt += n
        m -= n * 2
        cnt += m // 4
    else:
        cnt += m // 2
    print(cnt)
resolve()

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

int main(){
  int N;
  cin >> N;
  int ans=0;
  for(int i=0;i<=N;i++){
    if(i>0&&i<10){
      ans+=1;
    }
    else if(i>99&&i<1000){
      ans+=1;
    }
    else if(i>9999&&i<100000){
      ans+=1;
    }
  }
  cout << ans << endl;
}


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

int main()
{
    long long int n,temp=0,ans=0;
    cin>>n;
    
    temp=n%500;
    
    ans=(n/500)*1000;
    
    temp=temp-(temp%5);
    
    ans=ans+temp;
    
    cout<<ans;
    
    return 0;
}

Measured memory_bytes: 256
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-02-22 21:01:55
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

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

    int ans;
    for (ans = 1; pow(k, ans) <= n; ans++) {

    }

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


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map(String::toInt)

    a.forEach {
        if (it % 2 == 0 && (it % 3 != 0 && it % 5 != 0)) {
            println("DENIED")
            return
        }
    }
    println("APPROVED")
}


Measured memory_bytes: 38300
#include<stdio.h>
#include<math.h>
#define N 1000

int main(void){
  int i,n;
  double xa[N],ya[N],ra[N],
         xb[N],yb[N],rb[N];
  double diff2,tr2;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%lf%lf%lf%lf%lf%lf",
        &xa[i],&ya[i],&ra[i],
        &xb[i],&yb[i],&rb[i]);
  }
  for(i=0;i<n;i++){
    diff2=(xb[i]-xa[i])*(xb[i]-xa[i])+(yb[i]-ya[i])*(yb[i]-

ya[i]);
    tr2=(ra[i]+rb[i])*(ra[i]+rb[i]);

    if(diff2>tr2){
      printf("0\n");
    }else{
      if(ra[i]+sqrt(diff2)<rb[i]){
        printf("-2\n");
      }else if(rb[i]+sqrt(diff2)<ra[i]){
        printf("2\n");
      }else{
        printf("1\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
using System;

public class D {
    public static void Main() {
        long h = long.Parse(Console.ReadLine().Split(' ')[0]);
        Console.WriteLine(F(h, 1));
    }

    private static long F(long h, long n) {
        if (h <= 1) return n;
        return n+F(h/2, n*2);
    }

}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define SIZE 300005
#define MOD 1000000007LL
#define EPS 1e-10
#define INF 2147483647
#define LLINF 9223372036854775807
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
typedef complex<double> dcomplex;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cerr<<a[i]<<((i==a.size()-1)?"\n":" ");}}
ll gcd(ll a,ll b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
ll lcm(ll a,ll b){return a==0||b==0?0:a*b/gcd(a,b);}
ll modfact(ll a){ll b=1;FOR(i,2,a)b=b*i%MOD;return b;}
ll modpow(ll a, ll n){ll b=1;while (n>0){if(n&1)b=b*a%MOD;a=a*a%MOD;n>>=1;}return b;}
ll modcomb(ll n, ll k){ll b=1;k=min(n-k,k);DOWN(i,n,n-k+1)b=b*i%MOD;return b*modpow(modfact(k),MOD-2)%MOD;}

int N, Ma, Mb;

int main() {
    int size = 400;
    int inf = 100000;
    cin >> N >> Ma >> Mb;
    vector<vector<int>> dp(size+1, vector<int>(size+1, inf));
    dp[0][0] = 0;
    int a, b, c;
    REP(i, N) {
        cin >> a >> b >> c;
        DOWN(x, size, a) DOWN(y, size, b)
            dp[x][y] = min(dp[x][y], dp[x-a][y-b] + c);
    }
    int ans = inf;
    FOR(i, 1, 40)
        ans = min(ans, dp[i*Ma][i*Mb]);
    if(ans==inf) ans = -1;
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 896
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int length = s.length()-2;
    System.out.print(s.charAt(0));
    System.out.print(length);
    System.out.println(s.charAt(length+1));
  }
}

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

int main() {
    int N, count = 0;
    cin >> N;
    for (int i = 1; i <= 9; i++) {
        if (N <= i * 9 && N % i == 0) {
            count++;
        }
    }
    if (count > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

int main() {
  int N, sum;
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int min, max;
    cin >> min >> max;
    sum += max - min + 1;
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**7)
MOD=10**9+7

class Bit:
    def __init__(self, n):
        self.size = n
#        self.node = [0] * (n + 1)
        self.tree = [0] * (n + 1)
 
    def sum(self, i):
        i+=1
        s = 0
        while i > 0:
            s = max(s,self.tree[i])
            i -= i & -i
        return s
 
    def add(self, i, x):
        i+=1
#        self.node[i] += x
        while i <= self.size:
            self.tree[i] = max(self.tree[i],x)
            i += i & -i

#    def get(self,i)
#        return self.node(i+1)

n=int(input())
H = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

modosu = sorted(list(set(H)))
zaatu = {h:j for j,h in enumerate(modosu)}

#print(modosu)
#print(zaatu)

dp = Bit(n)
for i in range(1,n+1):
#    print(i,zaatu[i])
    dp.add(zaatu[H[i-1]], dp.sum(zaatu[H[i-1]])+A[i-1])

print(dp.sum(n-1))








Measured memory_bytes: 120912
package main
import "fmt"
func main() {
  var k,s,m int
  fmt.Scan(&k,&s)
  for x:=0;x<k+1;x++ {
    for y:=0;y<k+1;y++ {
      z := s-x-y
      if 0 <= z && z <= k { m++ }
    }
  }
  fmt.Println(m)
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
using namespace std;
int main() {
   int a;
   string s;
   cin >> a >> s;
   if(a >= 3200){
      cout << s << endl;
   }else{
      cout << "red" << endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[4];
	int i;
	for(i=0;i<4;i++)
	{
		scanf("%d",&a[i]);
	}
	if(a[0]>=a[3]||a[1]<=a[2])
	{
		printf("0");
	}
	else if(a[0]>=a[2]&&a[1]>=a[3])
	{
		 printf("%d",a[3]-a[0]);
	}
	else if(a[0]>=a[2]&&a[1]<a[3])
	{
		printf("%d",a[1]-a[0]);
	}
	else if(a[0]<a[2]&&a[3]<=a[1])
	{
		printf("%d",a[3]-a[2]);
	}
	else if(a[0]<a[2]&&a[3]>a[1])
	{
		printf("%d",a[1]-a[2]);
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <fstream>
#include <iostream>

using namespace std;

const int DIV = 998244353;

int main(int argc, char* argv[])
{
#ifdef VLAD_LOCAL
	ifstream f("in.txt");
#else
	istream &f = cin;
#endif
	int n, s;
	f >> n >> s;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
		f >> a[i];
	vector<vector<int64_t>> d(n + 1);
	d[0].resize(s + 1);
	d[0][0] = 1;
	for (int i = 0; i < n; i++) {
		d[i + 1].resize(s + 1);
		for (int j = 0; j < s + 1; j++)
			d[i + 1][j] = (d[i][j] << 1) % DIV;
		for (int j = 0; j < s + 1; j++) {
			int x = j + a[i];
			if (x < s + 1)
				d[i + 1][x] = (d[i + 1][x] + d[i][j]) % DIV;
			else
				break;
		}
	}
	printf("%lld", d[n][s]);
	return 0;
}



Measured memory_bytes: 74196
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

int main() {
	ll a, b; cin >> a >> b;
	cout << a*b / gcd(a, b) << endl;
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

char m[101][101];
int c[101][101];

int w, h;
void search(int x, int y) {
	if (x + 1 < w && y < h) {
		int cost = c[x][y];
		if (m[x][y] != m[x + 1][y]) {
			cost++;
		}
		if (cost < c[x + 1][y]) {
			c[x + 1][y] = cost;
			search(x + 1, y);
		}
	}
	if (x < w && y + 1 < h) {
		int cost = c[x][y];
		if (m[x][y] != m[x][y + 1]) {
			cost++;
		}
		if (cost < c[x][y + 1]) {
			c[x][y + 1] = cost;
			search(x, y + 1);
		}
	}
}

int main() {
	cout << fixed << setprecision(10);
	cin >> h >> w;

	REP(y, 100)REP(x, 100) {
		c[x][y] = INF;
	}

	REP(y, h)REP(x, w) {
		cin >> m[x][y];
	}

	c[0][0] = m[0][0] == '#' ? 1 : 0;
	search(0, 0);
	cout << (c[w - 1][h - 1] + 1) / 2 << endl;
	return 0;
}

/**
10000

6 6
######
#.....
######
......
##.###
..#.#.

2 2
##
..


*/

Measured memory_bytes: 256
X, N = map(int, input().split())
retsu = list(map(int, input().split()))
# X, N = 6, 5
# retsu = [4,7,10,6,5]

hanbetsu = []
for i in range(102):
    hanbetsu.append(i)

retsu = set(retsu)
hanbetsu = set(hanbetsu)
hikaku = hanbetsu.difference(retsu)

if X in hikaku:
    print(X)
else:
    for i in range(1,101):
        if X - i in hikaku:
            print(X-i)
            break
        elif X + i in hikaku:
            print(X+i)
            break

Measured memory_bytes: 9212
n=int(input())
res=0
M=[[0 for _ in range(10)] for _ in range(10)]
for i in range(n+1):
  a=i%10
  b=int(str(i)[0])
  M[a][b]+=1
for i in range(1,10):
  for j in range(1,10):
    res+=M[i][j]*M[j][i]
    
print(res)

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void){
    int n,num,backnum;
    cin>>n;
    int count=0;
    int max=0;
    for (int i=0;i<n;i++){
        if (i==0) {cin>>backnum;}
        else{
            cin>>num;
            if(backnum>=num){
                count++;
            }
            else {count=0;}
            if(max<count){max=count;}
            backnum=num;
        }
    }
    cout<<max<<endl;
}


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

int main(void){
    int num;
    char *string;
    int rnum, bnum, i;

    scanf("%d", &num);
    getchar();

    string = (char *)malloc(num);
    scanf("%s", string);

    for(i=0; i<num; i++){
        if(string[i] == 'R') rnum ++;
        else bnum ++;
    }

    if(rnum > bnum) printf("Yes\n");
    else printf("No\n");

    free(string);
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
    int A,B,C,D,E,F,G; cin>>A>>B>>C>>D>>E>>F>>G;
    int sum=min({A,D,E});
    int ans=sum*3;
    ans+=(A-sum)/2*2;
    ans+=(D-sum)/2*2;
    ans+=(E-sum)/2*2;
    ans+=B;
    int sum2=(A-sum)%2+(D-sum)%2+(E-sum)%2;
    if(sum2==2&&sum>=1) ans++;
    cout<<ans<<endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

void solve()
{
	const ll MAX_SIZE = 1000005;

	bool num[MAX_SIZE];
	for(int i = 0; i < MAX_SIZE; ++i)
	{
		num[i] = false;
	}

	int n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	int ans = 0;
	for(int i = 0; i < n; ++i)
	{
		if(num[a[i]] == true)
		{
			continue;
		}

		if (!(i < n - 1 && a[i] == a[i + 1])) { ans++; }

		ll prime = 0;
		while(prime += a[i], prime < MAX_SIZE)
		{
			num[prime] = true;
		}
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

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

int  n;
double tmp,ans,x;

int main(){
	tmp = 0.000000;
	scanf("%d",&n);
	for(int i =0;i<n;i++){
		scanf("%lf",&x);
		tmp += 1.000/x;
	}
	ans = 1.000/tmp;
	printf("%.8lf\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	int card1[201], card2[201];
	for (int i = 1; i <= 200; i++) {
		card1[i] = i;
		card2[i] = i;

	}
	int k;
	for (int i = 0; i < m; i++) {
		cin >> k;
		if (k == 0) {
			for (int o = 1; o <= n; o++) {
				card2[2 * o - 1] = card1[o];
			}
			for (int o = 1; o <= n; o++) {
				card2[2 * o] = card1[n + o];
			}
		}
		else {
			for (int o = 1; o <= 2 * n; o++) {
				if (k >= o) {
					card2[2 * n - k + o] = card1[o];
				}
				else {
					card2[o - k] = card1[o];
				}
			}
		}
		for (int o = 1; o <= 2 * n; o++) {
			card1[o] = card2[o];
		}
	}
	for (int i = 1; i <= 2 * n; i++) {
		cout << card1[i] << endl;
	}
}

Measured memory_bytes: 3100
use num::Num;
use proconio::input;
use proconio::fastout;
use proconio::marker::Usize1;

#[fastout]
fn main() {
    input! {
        n: usize,
        q: usize,
        c: [usize; n],
        queries: [(Usize1, Usize1); q],
    }
    let mut pi: Vec<Option<usize>> = vec![None; n+1];
    let mut ps = vec![vec![]; n];
    for i in 0..n {
        if let Some(num) = pi[c[i]] {
            ps[num].push(i);
        }
        pi[c[i]] = Some(i);
    }
    let mut qs = vec![vec![]; n];
    for i in 0..q {
        let (l, r) = queries[i];
        qs[l].push((r, i));
    }

    let mut ans = vec![0; q];
    let mut d: BIT<usize> = BIT::new(n);
    for x in (0..n).rev() {
        for &y in &ps[x] {
            d.add(y, 1);
        }
        for &query in &qs[x] {
            let r = query.0;
            let i = query.1;
            ans[i] = (r-x+1) - d.sum(r);
        }
    }

    for &a in &ans {
        println!("{}", a);
    }
}

struct BIT<T> {
    n: usize,
    d: Vec<T>,
}

impl<T> BIT<T>
where
    T: Num + Copy + Clone,
{
    fn new(n: usize) -> Self {
        BIT {
            n: n,
            d: vec![T::zero(); n + 1],
        }
    }

    fn add(&mut self, mut i: usize, x: T) {
        i += 1;
        while i <= self.n {
            self.d[i] = self.d[i] + x;
            i += i & i.wrapping_neg();
        }
    }

    fn sum(&self, mut i: usize) -> T {
        let mut x = T::zero();
        i += 1;
        while i != 0 {
            x = x + self.d[i];
            i -= i & i.wrapping_neg(); 
        }
        x
    }

    fn sums(&self, l: usize, r: usize) -> T {
        self.sum(r - 1) - self.sum(l - 1)
    }
}


Measured memory_bytes: 91028
#include <stdio.h> 
int main()
{
    char str[11];
    scanf("%s",str);
    if(str[5]=='0')
    {
        if(str[6]=='1' || str[6]=='2' || str[6]=='3' || str[6]=='4')
        printf("Heisei");
        else
        printf("TBD");
    }
    else
        printf("TBD");
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,j,n) for(int (i)=(j);(i)<(n);(i)++)
#define eFOR(i,j,n) for(int (i)=(j);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
const int INF = 1000000000;
const ll LLINF = 1LL << 62;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }

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

    int n, m;
    cin >> n >> m;
    int u, v;
    vector<VI> edge(n * 3 + 1);
    FOR(i, 0, m){
        cin >> u >> v;
        edge[u].push_back(v + n);
        edge[u + n].push_back(v + n * 2);
        edge[u + n * 2].push_back(v);
    }
    int s, t;
    cin >> s >> t;

    vector<bool> ever(n * 3 + 1, false);
    queue<pair<int, int>> bfs;
    ever[s] = true;
    bfs.push({ s, 0 });
    while (!bfs.empty()){
        int now = bfs.front().first;
        int dis = bfs.front().second + 1;
        bfs.pop();
        for (int i : edge[now]){
            if (ever[i])continue;
            ever[i] = true;
            bfs.push({ i, dis });
            if (i == t){
                cout << dis / 3 << "\n";
                return 0;
            }
        }
    }
    cout << -1 << "\n";
}


Measured memory_bytes: 16768
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstdlib>
#define INF 100000000
#define _INF -100000000
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i <= (int)n; i++)
#define Loopr(i, n) for(int i = (int)n - 1; i >= 0; i--)
#define Loopr1(i, n) for(int i = (int)n; i >= 1; i--)
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> P;

int main() {
	int n; cin >> n;
	vi A(n); Loop(i, n) cin >> A[i];
	ll ans = 0;
	Loop(i, n) {
		int s = A[i] / 2;
		int t = A[i] % 2;
		A[i] = t;
		ans += s;
		if (t == 1) {
			if (i + 1 < n&&A[i + 1] > 0) {
				A[i + 1]--;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
    int N; cin >> N;
    ll A[N];
    for(int i = 0; i < N; i++) cin >> A[i];
    sort(A, A+N, greater<int>());
    vector<ll> v;
    // for(int i = 0; i < N ; i++){
    //     cout << A[i] << ' ';
    // }
    // cout << endl;
    for(int i = 1; i < N; i++){
        // cout << i << endl;
        if(A[i-1] == A[i]){
            // i++; miss ↓に影響
            v.push_back(A[i]);
            i++;
        }
        if(v.size() == 2) break;
    }
    if(v.size() == 2){
        cout << v[0]*v[1] << endl;
    }
    else{
        cout << 0 << endl;
    }
    // cout << v[0] << endl;
    // cout << v[1] << endl;


    return 0;
}

Measured memory_bytes: 1024
import random
import time
import copy
import math
start=time.time()
d=int(input())
c=list(map(int,input().split()))
s=[]
cli=[]
for i in range(d+1):
  ch=[]
  for j in c:
    ch.append(i*j)
  cli.append(ch)
for i in range(d):
  s.append(list(map(int,input().split())))
last=[0]*26
score=0
solution=[]
for day in range(1,d+1):
  co=[]
  dla=[]
  down=0
  for (i,j) in zip(last,c):
    down+=(day-i)*j
  for (i,j) in zip(last,c):
    dla.append(down-(j*(day-i)))
  for con in range(26):
    co.append(s[day-1][con]-dla[con])
  choice=co.index(max(co))
  score+=co[choice]
  last[choice]=day
  #print(choice+1)
  #print(score)
  solution.append(choice)
#print(score)
stemp=1000000
etemp=100
def tem():
  return stemp-((stemp-etemp)*(time.time()-start)/1.9)
while time.time()-start<1.9:
  
  sc=0
  sol=copy.deepcopy(solution)
  for x in [random.randrange(d) for i in range(5)]:
    sol[x]=random.randrange(26)
  last=[0]*26
  for (day,i) in zip(range(1,d+1),sol):
    sc+=s[day-1][i]
    last[i]=day
    for (i,j) in zip(last,range(26)):
      sc-=cli[i][j]
  try:
    prob = math.exp((sc-score)/tem())
  except:
    prob=0
  #print("{} {}".format(sc,prob))
  if prob>random.random():
    solution=copy.deepcopy(sol)
    score=sc
    print(score)
for i in solution:
  print(i+1)
#print(sco)

Measured memory_bytes: 10520
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#pragma warning(disable : 4996) //_CRT_SECURE_NO_WARNINGS
#define row 3
#define col 3
int main(void) {
	int list[3][3];
	int n, res = 0;
	int* data;
	//make binngo
	for (int i = 0;i < row;i++) {
		for (int k = 0;k < col;k++) {
			scanf("%d", &list[i][k]);
		}
	}
	scanf("%d", &n);
	data = (int*)malloc(sizeof(int) * n);
	for (int i = 0;i < n;i++) {
		scanf("%d", &data[i]);
	}
	//compare list with data
	for (int i = 0;i < row;i++) {
		for (int k = 0;k < col;k++) {
			for (int j = 0;j < n;j++) {
				if (list[i][k] == data[j]) {
					list[i][k] = 0;
				}
			}
		}
	}
	/*横探索*/
	for (int i = 0;i < row;i++) {
		for (int k = 0;k < col;k++) {
			if (list[i][k] != 0) {
				res = 0;/*探索が失敗したら初期化*/
				break;
			}
			else {
				res += 1;
			}
		}
		if (res == 3) {
			puts("Yes");
			break;
		}
	}
	if (res == 3) {
		free(data);
		data = NULL;
		return 0;
	}
	else {
		res = 0;/*初期化*/
		/*縦探索*/
		for (int i = 0;i < col;i++) {
			for (int k = 0;k < row;k++) {
				if (list[k][i] != 0) {
					res = 0;/*探索が失敗したら初期化*/
					break;
				}
				else {
					res += 1;
				}
			}
			if (res == 3) {
				puts("Yes");
				break;
			}
		}
	}
	if (res == 3) {
		free(data);
		data = NULL;
		return 0;
	}
	else {
		res = 0;/*初期化*/
		/*斜め探索*/
		for (int i = 0;i < row;i++) {
			if (list[i][i] != 0) {
				res = 0;/*探索が失敗したら初期化*/
				break;
			}
			else {
				res += 1;
			}
		}
	}
	if (res == 3) {
		puts("Yes");
		free(data);
		data = NULL;
		return 0;
	}
	else {
		res = 0;/*初期化*/
		for (int i = 2, k = 0;k < row;i--,k++) {
			if (list[i][k] != 0) {
				res = 0;/*探索が失敗したら初期化*/
				break;
			}
			else {
				res += 1;
			}
		}
	}
	if (res == 3) {
		puts("Yes");
		free(data);
		data = NULL;
		return 0;
	}
	else {
		puts("No");
		free(data);
		data = NULL;
		return 0;
	}
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <cctype>
#include <fstream>
#include <cstring>

using namespace std;

#define ll long long
#define MOD 1000000007
#define INF 2000000000
#define LINF 9000000000000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define du(x) cout<<#x<<'='<<x<<endl
#define du2(x,y) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<'\n'<<endl
#define du3(x,y,z) cout<<#x<<'='<<x<<' '<<#y<<'='<<y<<' '<<#z<<'='<<z<<'\n'<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl
#define ddarr(arr,a,b) rep(i,a){rep(j,b){cout<<*(arr+i*b+j)<<' ';}cout<<endl;}
#define ddd ifstream in("Text.txt");cin.rdbuf(in.rdbuf());

int S[10000], T[500];

int main() {

    int N, Q;
    cin >> N;
    rep(i, N)cin >> S[i];
    cin >> Q;
    rep(i, Q)cin >> T[i];

    int tot = 0;

    rep(j,Q)rep(i, N)
        if (S[i] == T[j]) {
            tot++;
            break;
        }

    cout << tot << endl;


}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(), v.end()
#define PI 3.141592653589793238462643383279
typedef long long int ll;
typedef unsigned long long ull;
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;}
typedef pair<ll,ll> P;
const long long MOD = 1e9+7;
const ll INF = 1LL << 60;

struct card{
    char suit;
    int num;
};


void bubbleSort(card a[], int n){
    for(int i = 0; i < n; i++){

        for(int j = n -1; j >= i+1; j--){
            if(a[j].num < a[j-1].num){
                swap(a[j],a[j-1]);
            }
        }
    }
}

void selectionSort(card a[], int n){
    for(int i = 0; i < n; i++){
        int mi = i;
        for(int j = i; j < n; j++){
            if(a[mi].num > a[j].num){
                mi = j;
            }
        }
        swap(a[i],a[mi]);
    }

}

void print(card a[], int n){
    for(int i = 0; i < n; i++){
        cout << a[i].suit << a[i].num;
        if(i < n -1){
            cout << " ";
        }
    }
    cout << endl;
}

bool is_stable(card a[], card b[], int n){
    for(int i = 0; i < n; i++){
        if(a[i].suit != b[i].suit)return false;
    }
    return true;
}


int main(){
    int n;
    cin >> n;
    card cards1[36];
    card cards2[36];

    for(int i = 0; i < n; i++){
        cin >> cards1[i].suit >> cards1[i].num;
        cards2[i] = cards1[i];
    }

    bubbleSort(cards1,n);
    selectionSort(cards2,n);
    
    print(cards1,n);
    cout << "Stable" << endl; //バブルソートは安定ソートだから（書き方によっては不安定にもなり得る）
    print(cards2,n);
    if(is_stable(cards1,cards2,n)){ //選択ソートは必ずしも安定ソートではない
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }





}


Measured memory_bytes: 3116
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define md 998244353
#define trace(...)
#define ll long long int
#define ld long double
#define fi first
#define se second
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define mem(a) memset(a, 0, sizeof(a))
#define vpi std::vector<pair<int,int>>
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define pb push_back
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())
#define minf -10000000
#define vi vector<int>
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
    uniform_int_distribution<int> uid(0,lim-1);
    return uid(rang);
}
ll power(ll x, ll y,ll p) { 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or equal to p 
    while (y > 0) {  
        if (y & 1) // If y is odd, multiply x with result
            res = (res*x) % p;  
        y = y>>1; // y = y/2 // y must be even now
        x = (x*x) % p;   
    } 
    return res; 
}
ll power(ll x, ll y) { 
    ll res = 1;      // Initialize result 
    while (y > 0) {    
        if (y & 1)// If y is odd, multiply x with result 
            res = (res*x) ;  
        y = y>>1; // y = y/2 // y must be even now 
        x = (x*x);   
    } 
    return res; 
}
 
ll max3(ll a,ll b,ll c){
    return max(a,max(b,c));
}
ll min3(ll a,ll b,ll c){
    return min(a,min(b,c));
}
bool isPrime(ll n) { // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
const int nax=2e5+10;

void solve(){
    ll a,b,c,k;cin>>a>>b>>c>>k;
    ll ans=0;
    ll tp=min(k,a);
    ans+=tp;
    k-=tp;a-=tp;
    if(k==0){
        cout<<ans<<endl;
        return;
    }
    tp=min(k,b);
    k-=tp;b=tp;
    if(k==0){
        cout<<ans<<endl;
        return;
    }
    tp=min(k,c);
    ans-=tp;
    cout<<ans<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout<<fixed<<setprecision(8);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
    #endif
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <bits/stdc++.h>
#define mod 998244353
typedef long long ll;

using namespace std;

void Fastio(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

ll fact[1000006], inv[1000006];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) ;
        inv[i] = fp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}

long double  NCR(int n, int m){
    long double res = 1;
    m = min(m, n - m);
    for(int i = 0; i < m; i++){
        res = res * ( n - i) / (i + 1);
 }
    return res;
}
ll tol(string a){
    ll res=0;
    while(a[0]=='0'){
        a.erase(a.begin());
    }
    if(a=="")a="0";
    for(int i=0; i<a.size(); i++){
        res*=10; res+=a[i]-'0';
    }
    return res;
}
int check(string a, string b){
    for(int i=0; i<a.size(); i++){
        if(a[i]>b[i])return 1;
        if(b[i]>a[i])return -1;
    }
    return 0;
}
class data{
public:
    ll v,d,p;
    data(){}
    data(ll vv, ll dd, ll pp){
        v=vv;  d=dd; p=pp;
    }
};

int primeFactors(int n)
{
    ll c=0;
    while (n % 2 == 0)
    {
        c++;
        n = n/2;
    }
    for (int i = 3; i*i <= n; i = i + 2)
    {
        while (n % i == 0)
        {
            c++;
            n = n/i;
        }
    }
    if (n > 2)
        c++;
    return c;
}
int n,m, counter;
vector<int>arr[200005];
int vis[200005];
void dfs(int node){
    vis[node]=1; counter++;
    for(int i=0; i<arr[node].size(); i++){
        if(!vis[arr[node][i]])dfs(arr[node][i]);
    }
}
int main()
{
    Fastio();
    int n,k; cin>>n>>k;
    vector<int>v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    sort(v.begin(), v.end());
    int mn=1e9;
    for(int i=0; i<=n-k; i++){
        mn=min(mn,v[i+k-1]-v[i]);
    }
    cout<<mn<<'\n';

    return 0;
}



Measured memory_bytes: 6016
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n;
  cin >> n;
  if(n % 2) {
    puts("0");
    return 0;
  }
  ll ans = 0;
  for(ll i = 10; i <= n; i *= 5) {
    ans += n / i;
  }
  cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cctype>
#include <locale>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

int main() {
    long x;
    cin >> x;
    long a = x / 500;
    long rest = x - a * 500;
    long b = rest / 5;
    cout << a * 1000 + b * 5 << endl;
    return 0;

}

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

int main()
{
	int N;
	int odd = 0;

	cin >> N;
	for (int i = N; i > 0; i--)
	{
		if (i % 2)
		{
			odd++;
		}
	}

	cout << (float)odd / (float)N;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
import copy
b=list(map(int,input().split()))
c=copy.copy(b)
ans=[]
for _ in range(n):
	rem=-1
	cnt=0
	for j in range(n):
		if b[j]==j+1-cnt:
			rem=j
		if b[j]==0:
			cnt+=1
	if rem==-1:
		print(-1)
		exit()
	ans.append(rem)
	b[rem]=0
for i in range(n):
	p=ans[-i-1]
	print(c[p])

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

int main() {
	int N, X;
	cin >> N >> X;
	vector<int> L(N);
	for (int i = 0; i < N; i++) {
		cin >> L.at(i);
	}

	int ans = 1;
	int p = 0;
	for (int i = 0; i < N; i++) {
		p += L.at(i);
		if (p <= X) ++ans;
	}
	cout << ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a, b;
    int n;

    while (cin >> a >> b >> n) {
        int s = 0;

        a *= 10;
        for (int i = 0; i < n; i++) {
            s += (a / b) % 10;
            a %= b;
            a *= 10;
        }
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int main()
{
	ll g,h=1,ans=0; cin>>g;
	while(g>=h)
	{
		ll c=min(g/h,9LL);
		g-=h*c,ans+=c,h*=10;
	}
	cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>
#include <regex>
#include <functional>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
const int MOD = 1000000007;
const int MAX_N = 100000;

typedef long long ll;

int main() {
    const double PI = 3.14159265358979323846;
    int r;
    cin >> r;
    cout << std::setprecision(12) << r * 2 * PI << endl;
}

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

using namespace std;

const int N=2e5+5,OO=0x3f3f3f3f,M=1e9+7;
int t,n,m,k;
string s;


int main() {
    cin>>s;
    for(int i=0;i<s.length()-1;++i){
        if(s[i]==s[i+1]){
            cout<<i+1<<" "<<i+2;
            return 0;
        }
        if(i+2<s.length()&&s[i]==s[i+2]){
            cout<<i+1<<" "<<i+3;
            return 0;
        }
    }
    cout<<-1<<" "<<-1;
    return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

//桁数
ll GetDigit(ll num)
{
  return log10(num) + 1;
}

//約数全列挙
vector<ll> enum_div(ll n)
{
  vector<ll> ret;
  for (ll i = 1; i * i <= n; ++i)
  {
    if (n % i == 0)
    {
      ret.push_back(i);
      if (i * i != n)
      {
        ret.push_back(n / i);
      }
    }
  }
  sort(begin(ret), end(ret));
  return ret;
}

//累乗(xのn乗%mod)
ll modpow(ll x, ll n, ll mod = MAX)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

//階乗
ll factorial(ll n)
{
  if (n > 0)
    return n * factorial(n - 1);
  else
    return 1;
}

void Main()
{
  ll n;
  cin >> n;
  str s;
  cin >> s;
  ll ans = 0;
  for(ll i = 0;i < n;i++)
  {
    for(ll j = i + 1;j < n;j++)
    {
      if(2 * j - i < n && 2 * j - i >= 0 && s[i] != s[j]&&s[j] != s[2 * j - i]&&s[i] != s[2 * j - i]) ans++;
    }
  }
  ll r = 0, g = 0, b = 0;
  rep(i, n)
  {
    if(s[i] == 'R') r++;
    if(s[i] == 'G') g++;
    if(s[i] == 'B') b++;
  }
  fin(r * g * b - ans);
}

/*
2 - 1 = 3 - 2
r < g < b * b = g * 2 - r
r < b < g * b = (g + r) / 2
b < r < g *

b < g < r *
g < r < b *
g < b < r *
*/

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  //cout << setfill('0') << internal << setw(4); 0埋め４桁
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


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

task = []
N = int(input())
for _ in range(N):
    task.append(list(map(int, input().split())))

task.sort()
#print(task)
ans = 0

task_minmax = [None] * (N+1)
task_minmax[N] = [0, 10**9]
for i in range(N-1, -1, -1):
    task_minmax[i] = [max(task_minmax[i+1][0], task[i][0]), min(task_minmax[i+1][1], task[i][1])]

mini = 0
maxi = 10**9

#print(task_minmax)

for i in range(N-1):
    temp = 0
    if i != 0:
        ans = max(ans, max(0, min(maxi, task_minmax[i+1][1]) - max(mini, task_minmax[i+1][0]) + 1) + (task[i][1] - task[i][0]) + 1)

    mini = max(task[i][0], mini)
    maxi = min(task[i][1], maxi)

    temp += max(maxi - mini + 1, 0)
    temp += max(task_minmax[i+1][1] - task_minmax[i+1][0] + 1, 0)

    ans = max(temp, ans)

print(ans)


Measured memory_bytes: 68956
X=int(input())
if X>=1800:
    print(1)
elif X>=1600:
    print(2)
elif X>=1400:
    print(3)
elif X>=1200:
    print(4)
elif X>=1000:
    print(5)
elif X>=800:
    print(6)
elif X>=600:
    print(7)
else:
    print(8)

Measured memory_bytes: 9176
n = int(input())
key = ["AC", "WA", "TLE", "RE"]
value = [0,0,0,0]
for _ in range(n):
    tmp = str(input())
    if tmp in key:
        index = key.index(tmp)
        value[index]+=1
for i in range(4):
    print("{0} x {1}".format(key[i],value[i]))

Measured memory_bytes: 9068
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define fi first;
#define se second;
#define print(x,y) (cout << (x) << (y))
#define inf INT_MAX
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,bool> pib;
typedef vector<pii> vii;
typedef vector<pib> vib;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<string,string> pss;
typedef vector<pss> vss;
const int MOD = 1e9 + 7; //998244353;


int main(){
    boost;
    int a , b;
    cin >> a >> b;
    if(a==b)cout << "Yes" ; else cout << "No";
}



Measured memory_bytes: 256
n, *abc = [int(x) for x in input().split()]
l = [int(input()) for i in range(n)]
A = 0; B = 1; C = 2;

minmp = 10 ** 9
for k in range(2 ** (2 * n)):
    mat = [[], [], [], []]  # mat[0]:= Aの材料, mat[1]:=Bの材料, mat[2]:=Cの材料
    # for i = 0, ..., N-1
    # kの 2*i & 2*i+1ビット目が 0b00: l[i]はAに使う
    #     ↑lsbから             0b01: l[i]はBに使う
    #                         0b10: l[i]はCに使う
    #                         0b11: l[i]は使わない
    for i in range(n):
        mat[k & (0b11)].append(l[i])
        k >>= 2

    if len(mat[0]) == 0 or len(mat[1]) == 0 or len(mat[2]) == 0:
        continue

    mp = 0
    for j in range(3):
        mp += 10 * (len(mat[j]) - 1)
        mp += 1 * abs(abc[j] - sum(mat[j]))

    minmp = min(minmp, mp)

print(minmp)

Measured memory_bytes: 3064
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
using namespace std;

const long mod = 1000000007;
const long indlim = 5368709119;
long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
long fact(long x) { if (x == 0) return 1; else return((fact(x - 1) * x) % mod); }
long mybase(long N, long B) { if (N == 0) return 0; string S = ""; while (N != 0) { string M = to_string(N % B); N -= N % B; N /= B; S = M + S; }return stol(S); }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {

	char s;
	long res = 0;
	for (int i = 1; i <= 4; i++) { cin >> s; res += (s == '+') ? 1 : -1; }
	cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<typename Num>
        constexpr Num mypow(Num a, long long b) {
            if(b==0)return 1;
            if (a==0)return 0;
            Num x = 1;
              while (b > 0) {
                if(b & 1)x*=a;
                a*=a;
                b >>= 1;
              }
              return x;
        }

    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;
    }

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo
//mint,dijkstra,gyakugen

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n,m;
        cin>>n>>m;
        if(m>n*2){
            cout<<(m+n*2)/4<<endl;
        }else{
            cout<<m/2<<endl;
        }
    }

Measured memory_bytes: 3580
import itertools
A, B, C, D = list(input())
ops = itertools.product('+-', repeat=3)
res = ''
for op1, op2, op3 in ops:
    if eval(A+op1+B+op2+C+op3+D) == 7:
        res = A+op1+B+op2+C+op3+D
if res:
    print(res+'=7')
else:
    print('No')

Measured memory_bytes: 3060