akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
  ll q,h,s,d;
  cin >> q >> h >> s >> d;
  ll n;
  cin >> n;
  vector<int> a(4);
  a[0] = q*8;
  a[1] = h*4;
  a[2] = s*2;
  a[3] = d;
  ll ans = 0;
  sort(a.begin(), a.end());
  if(a[0] == d && a[1] != d){
    while(n >= 2){
      ans += d;
      n -= 2;
    }
    while(n>0){
      ans += a[1]/2;
      n -= 1;
    }
  } 
  else ans = n * a[0]/2;
  cout << ans << endl;
return 0;
}

Measured memory_bytes: 3608
import sys, math

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == [] and n != 1:
        arr.append([n, 1])

    return arr

N = int(input())
A = list(map(int, sys.stdin.readline().rsplit()))

ok = True
S = set()
for a in A:
    arr = factorization(a)
    # print(arr)
    for b, _ in arr:
        if b in S:
            ok = False
            break
        else:
            S.add(b)
    if ok is False:
        break
if ok:
    print("pairwise coprime")
else:
    tmp = A[0]
    for a in A[1:]:
        tmp = math.gcd(a, tmp)
    if tmp != 1:
        print("not coprime")
    else:
        print("setwise coprime")


Measured memory_bytes: 193588
#include<bits/stdc++.h>
#define PI 2*acos(0)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int k;
    cin>>k;
    double cur,x;
    x=(PI*k*1.0)/180;
    //cout<<"x="<<x<<endl;
    cur=0;
    double x1,y1,x2,y2;
    int cnt=0;
    x1=0.0;y1=0.0;
    while(1){
        x2=cos(cur)+x1;
        y2=sin(cur)+y1;
        cnt++;
        //cout<<"x2="<<x2<<" "<<"y2="<<y2<<endl;
        if(abs(x2-0.0)<=1e-10 && abs(y2-0.0)<=1e-10) break;
        //if(cnt==6) break;
        x1=x2;
        y1=y2;
        cur+=x;
        if(cur> 2*PI) cur-=2*PI;
    }
    cout<<cnt<<endl;
    return 0;
}


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

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back

int main() {
	int n;
	cin >> n;
	int S = 0;
	for (int i = 0; i < n; i ++) {
		int x;
		cin >> x;
		if (x&1) S++;
	}
	if (S&1) puts ("NO");
	else puts ("YES");
	return 0;
}

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

int main() {
  int a[32] = {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 << a[k-1] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#include <vector>
using namespace std;
int main(){
  int mod = 1000000007;
  int n,m;
  cin >> n >> m;
  int difference = abs(n - m);
  if(difference > 1){
    cout << 0 << endl;
    return 0;
  }
  long long ans = 1;
  rep(i, n){
    ans *= i + 1;
    ans %= mod;
  }
  rep(i, m){
    ans *= i + 1;
    ans %= mod;
  }
  if(difference == 0){
    ans *= 2;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
s = input()
s_origin = s
n = len(s)

for i in range(n):
    for j in range(ord("a"), ord("z")+1):
        if not (chr(j) in s) and \
            s + chr(j) != s_origin and \
                s_origin < s + chr(j):
            print(s + chr(j))
            exit()
    if len(s) == 1 and s != "z":
        print(chr(ord(s) + 1))
        exit()
    s = s[:-1]

print(-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
unordered_map<int,int> ma;
int main() {
	for(int i=0,x;i<3;i++) {
		scanf("%d",&x);
		ma[x]++;
	}
	if(ma.size()==2) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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();
		
		List<E> odd = new ArrayList<>(100_001);
		List<E> even = new ArrayList<>(100_001);
		for (int i = 0; i < 100_001; i++) {
			E oddE = new E(i);
			odd.add(oddE);
			E evenE = new E(i);
			even.add(evenE);
		}
		
		for (int i = 0; i < N; i++) {
			if (i % 2 == 0) {
				E oddE = odd.get(sc.nextInt());
				oddE.count++;
			} else {
				E evenE = even.get(sc.nextInt());
				evenE.count++;
			}
		}
		
		Collections.sort(odd);
		Collections.sort(even);
		
		E firstOdd = odd.get(0);
		E firstEven = even.get(0);
		
		if (firstEven.num == firstOdd.num) {
			if (firstEven.count + odd.get(1).count >= firstOdd.count + even.get(1).count) {
				firstOdd = odd.get(1);
			} else {
				firstEven = even.get(1);
			}
		}
		
		System.out.println(N - (firstEven.count + firstOdd.count));
	}
	
	static class E implements Comparable<E> {

		int num;
		int count;
		
		public E(int num) {
			this.num = num;
		}
		
		//出現数が多い順
		@Override
		public int compareTo(E o) {
			return o.count - this.count;
		}
		
	}
}



Measured memory_bytes: 65828
#include<bits/stdc++.h>
using namespace std;
int l,r;
long long ans=1e18;
int main(){
	scanf("%d%d",&l,&r);
	if(l/2019!=r/2019)ans=0;
	else {
		for(int i=l;i<=r;i++){
			for(int j=i+1;j<=r;j++){
				ans=min(ans,1LL*i*j%2019);
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
//const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) {cout << (A) << '\n'; exit(0);}

int main()
{
  ll N;
  cin >> N;
  vector<ll> L(N);
  vector<ll> P(1010), Q(1010);
  for (ll i = 0; i < N; i++)
  {
    cin >> L.at(i);
    P.at(L.at(i))++;
    Q.at(L.at(i))++;
  }
  for (ll i = 0; i < P.size() - 1; i++)
  {
    P.at(i + 1) += P.at(i);
  }
  for (ll i = Q.size() - 1; i >= 1; i--)
  {
    Q.at(i - 1) += Q.at(i);
  }

  ll ans = 0;
  for (ll i = 0; i < N; i++)
  {
    for (ll j = i + 1; j < N; j++)
    {
      ll a = L.at(i), b = L.at(j);

      ll l = max(0LL, abs(a - b) + 1);
      ll r = min((ll)P.size() - 1, a + b - 1);

      ll tmp = P.at(r) - P.at(l - 1);
      if (abs(a - b) < a && a < a + b)
        tmp--;
      if (abs(a - b) < b && b < a + b)
        tmp--;
      ans += max(0LL, tmp);

      //cerr << a << " " << b << " " << l << " " << r << " " << tmp << endl;
    }
  }
  ans /= 3;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  for(;;){
    int n,w;
    cin >> n >> w;
    if(!n) return 0;
    vector<int> his;
    his.assign(11,0);
    int r=0,h=0;
    REP(i,n){
      int tmp;
      cin >> tmp;
      ++his[tmp/w];
      r=max(r,tmp/w);
      h=max(h,his[tmp/w]);
    }
    double answer=0.01;
    REP(i,r+1)
      answer+=1.0*his[i]/h*(r-i)/r;
    cout << answer << endl;
  }
}

Measured memory_bytes: 1260
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

ll gcd(ll a, ll b) {
    if(a < b) gcd(b, a);
    ll r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}
map<ll,ll> prime_factor(ll n){
    map<ll,ll> res;
    for  (ll i=2;i*i<=n;i++){
        while (n%i == 0){
            ++ res[i];
            n /= i;
        }
    }
    if(n!=1){
        res[n] += 1;
    }
    return res;
}
int main() {
    

    ll a,b;
    cin >> a >> b;
    ll g = gcd(a,b);
    ll ans = 0;
    map <ll, ll> p = prime_factor(g);
    ans = p.size() + 1;
    cout << ans << endl;

}

Measured memory_bytes: 256
N,K=map(int,input().split())

ablist=[]
for _ in range(N):
  a,b=map(int,input().split())
  ablist.append((a,b))
ablist.sort()
  
s=0
for a,b in ablist:
  s+=b
  if s>=K:
    print(a)
    break

Measured memory_bytes: 16940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
main(){
  long long n,ans=1;cin >> n;
  int cc=1000000007;
  for(int i=1;i<=n;i++){
    ans = (ans*i)%cc;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
 
using namespace std;
 
signed main()
{
    fast;
    int n;
    cin>>n;

    vector<int> a(n);

    for ( int i = 0 ; i < a.size() ; i++ )
    {
        cin>>a[i];
    }
    int k = 1;
    int c = 0;
    for ( int i = 0 ; i < a.size() ; i++ )
    {
        if ( a[i] == k )
        {
            c++;
            k++;
        }
    }

    if ( c == 0 )
    {
        cout<<"-1"<<endl;
        return 0;
    }

    cout<<a.size()-c<<endl;
    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

A, B, C = get_ints
K = get_int

a = A
b = B
c = C

K.times do
  if b <= a
    b *= 2
  else
    c *= 2
  end
end

puts b > a && c > b ? 'Yes' : 'No'


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

int main(){
  int a,n,i,sum=0; cin>>n;
  i=n;
  while(true){
    a=i%10;
    i/=10;
    sum+=a;
    if(i%10==0)break;
  }
  if(n%sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
const int N=3e5+5,M=1e5+5;
int n,q,dep[N],p[N],w[N],dp[512][M];
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d%d",&p[i],&w[i]);
    for(int i=1;i<=n&&i<512;i++)
        for(int j=100000;j>=0;j--)
        {
            if(j>=w[i]) dp[i][j]=max(dp[i][j],dp[i/2][j-w[i]]+p[i]);
            dp[i][j]=max(dp[i][j],dp[i/2][j]);
        }
    scanf("%d",&q);
    while(q--)
    {
        int v,L;scanf("%d%d",&v,&L);
        vector<int>vc;
        while(v>=512) vc.push_back(v),v>>=1;
        int ans=dp[v][L];
        for(int i=0;i<1<<vc.size();i++)
        {
            int wi=0,pi=0;
            for(int j=0;j<vc.size();j++)
                if(i>>j&1)
            {
                wi+=w[vc[j]];
                pi+=p[vc[j]];
                if(wi>L) break;
            }
            if(wi<=L)
                ans=max(ans,dp[v][L-wi]+pi);
        }
        printf("%d\n",ans);
    }
}


Measured memory_bytes: 205388
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)

typedef long long ll;

const int Inf = 100100100;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, c, maxi;
    cin >> a >> b >> c;
    maxi = max(a, max(b, c));
    int ans = a + b + c + maxi * 9;
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 256
import math

def read_input():
    return int(input())

def solve(X):
    n = 0
    balance = 100.0
    while balance < X:
        balance = math.floor(balance * 1.01)
        n += 1
    ans = n
    print(ans)

def main():
    X = read_input()
    solve(X)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9024
#include <iostream>
#include <bits/stdc++.h>
#include<string>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <fstream>
#include <vector>

#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define SPACE " "
#define nLINE '\n'
#define ss second
#define ff first
//scanf("%d",&x) ,s.insert(x);
using namespace std;

ll GCD(ll a, ll b) {
	//Euclidian
	if (!b) return a;
	else return GCD(b, a % b);
}
const ll MAX = 51;
bool prime[MAX];
void sieve() {
	for (int p = 2; p * p <= MAX; p++)
		if (prime[p] == false)
			for (int i = p * 2; i <= MAX; i += p)
				prime[i] = true;
}

int comb(int a, int b)
{
	if (a < b) return 0;
	if (a == b) return 1;
	if (b == 0) return 1;
	return comb(a - 1, b) + comb(a - 1, b - 1);
}
int x[30];
long long int y[30];
long long int func(int s, int t)
{
	if (t == 0) return 1;
	if (s == 0) return 1;

	if (x[s] == 0) return func(s - 1, t);
	else
	{
		long long int sum = 0;
		for (int i = 0;i <= t;i++) sum += comb(s - 1, i) * y[i];

		long long int s1 = sum;

		sum = 0;
		for (int i = 0;i <= t - 1;i++) sum += comb(s - 1, i) * y[i];
		long long int s2 = (x[s] - 1) * sum;
		long long int s3 = func(s - 1, t - 1);
		return s1 + s2 + s3;
	}
}



int dp[13][1 << 13];
double arr[20][20];
int n;
int dvds[13],svs[13];
vector<double> sssp(int);
vector<double> minDis[20];
int Size;

double solve(int current, int mask) {
    if(mask == ((1 << Size) - 1)) return -arr[dvds[current]][0];

    if(dp[current][mask] != -1)
        return dp[current][mask];


    double Max = -arr[dvds[current]][0];
    for(int i= 0; i< Size; i++)
        if((mask & (1 << i)) == 0)
            Max = max(Max, svs[i] - arr[dvds[current]][dvds[i]]+ solve(i, mask | (1 << i)));

    return dp[current][mask]= Max;
}

int nextMin(int,int);
int lis[100001];
int main() {
	int N,K,s=0;
	cin >> N >> K;
	int juice[N];
    for(int n=0;n<N;n++){
        cin >> juice[n];
    }
    sort(juice,juice+N);
    for(int k=0;k<K;k++)
        s+=juice[k];
    cout << s << nLINE;
}

bool used[20];
vector<double> sssp(int src) {
	vector<double> disSource(n);
	fill(disSource.begin(), disSource.end(), INT_MAX);
	disSource[src] = 0;
	int curr = src;
	memset(used, false, sizeof used);
	used[curr] = true;
	while (curr != -1) {
		for (int j = 0;j < n;j++) {
			if (arr[curr][j] != -1) {
				if (disSource[j] == INT_MAX) disSource[j] = arr[curr][j] + disSource[curr];
				else disSource[j] = std::min(disSource[j], disSource[curr] + arr[curr][j]);
			}
		}
		used[curr] = true;
		curr = nextMin(curr,src);
	}
	return disSource;
}

int nextMin(int curr,int src) {
	int indx = -1;
	double Min = 1e9;
	for (int i = 0;i < n;i++) {
		if (arr[curr][i]!=-1 && arr[curr][i] <= Min && used[i] == false) {
			Min = arr[curr][i];
			indx = i;
		}
	}
	if (indx == -1){
        for(int i=0;i<n;i++)
            if(arr[src][i]!=-1 && arr[curr][i] <= Min && used[i]== false)
                indx = i , Min = arr[curr][i];
	}
	if (indx == -1) return -1;
	return indx;
}


Measured memory_bytes: 3524
import java.util.*;

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

    String s = sc.next();

    String[] sList = s.split("");

    int[] intList = new int[s.length()];
    for(int i = 0;i < s.length(); i++){
      intList[i] = Integer.parseInt(sList[i]);
    }

    int startBlack = 0;
    int startWhite = 0;

    if(intList[0] == 0) {
      int next = 0;
      for (int i = 0; i < s.length(); i++) {
        if(intList[i] == next) {
          if(next == 0) {
            next = 1;
          } else if (next == 1) {
            next = 0;
          }
        } else {

          startBlack++;

          if(next == 0) {
            next = 1;
          } else if (next == 1) {
            next = 0;
          }
        }
      }
    } else if (intList[0] == 1) {
      int next = 1;
      for (int i = 0; i < s.length(); i++) {
        if(intList[i] == next) {
          if(next == 0) {
            next = 1;
          } else if (next == 1) {
            next = 0;
          }
        } else {

          startBlack++;
          if(next == 0) {
            next = 1;
          } else if (next == 1) {
            next = 0;
          }
        }
      }
    }

    if(startBlack > startWhite) {
      System.out.println(startBlack);
    } else if (startWhite > startBlack) {
      System.out.println(startWhite);
    } else {
      System.out.println(startBlack);
    }

  }
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
vector<ll> fib(100,-1);
ll calc_fib(ll k){
  if(fib[k] != -1){
    return fib[k];
  }
  fib[k] = calc_fib(k-1) + calc_fib(k-2);
  return fib[k];
}
int main(){
  fib[0] = 1;
  fib[1] = 1;
  ll n;
  cin >> n;
  rep(i,n){
    calc_fib(i);
  }
  cout << calc_fib(n) << endl;
}



Measured memory_bytes: 3104
import java.util.*

private fun readInts() = readLine()!!.split(" ").map { it.toInt() }
private fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
private fun <K, V> Map<out K, V>.toMutableMap(): MutableMap<K, V> = LinkedHashMap(this)
private fun <K, V> mutableMapOf(): MutableMap<K, V> = LinkedHashMap()
private fun <K, V> mutableMapOf(vararg pairs: Pair<K, V>) = pairs.toMap().toMutableMap()

fun main(args: Array<String>) {
    val S = readLine()!!
    val (a, b, c) = S.split("/").map { it.toInt() }

    when {
        a > 2019 -> println("TBD")
        a < 2019 -> println("Heisei")
        else -> {
            when {
                b > 4 -> println("TBD")
                b < 4 -> println("Heisei")
                else -> {
                    when {
                        c > 30 -> println("TBD")
                        else -> println("Heisei")
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 35976
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    string s;
    cin >> s;
    string a = "";
    int n = 0;
    rep(i,s.size()){
        if(s[i] == '1')a += '1';
        else if(s[i] == '0')a += '0';
        else if(a.empty())continue;
        else a.erase(a.begin()+a.size()-1);
    }
    cout << a << endl;
    return 0;
}

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

int main() {
	int A, B, C, X;
	cin >> A >> B >> C >> X;
	int res = 0;

	for(int i = 0; i <= A; i++){
		for(int j = 0; j <= B; j++){
			for(int k = 0; k <= C; k++){
				if (500*i+100*j+50*k == X){
					res++;
				}
			}
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
const ll maxSum = 50*50+1;
int main() {
    ll N ;
    ll D ;
    cin >> N ;
    cin >> D ;
    D = D * D ;
    ll X , Y ;
    ll ans = 0 ;
    for(ll i = 0 ; i < N ; i++){
        cin >> X >> Y ;
        if(X * X + Y * Y <= D ){
            ans ++ ;
        }
    }   
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  string S;
  cin>>S;
  vector<int> min_set,max_set;
  int N=S.size();
  ll count1=0;
  ll count2=0;
  ll ans=0;
  for(int i=0;i<N;i++){
    if(S.at(i)=='<'){
      count1++;
    }else{
      count2++;
      if(i==N-1){
        break;
      }
      if(S.at(i+1)=='<'){
        ll x=max(count1,count2);
        ll y=min(count1,count2);
        ans+=x*(x+1)/2+y*(y-1)/2;
        count1=0;
        count2=0;
      }
    }
  }
  ll x=max(count1,count2);
  ll y=min(count1,count2);
  ans+=x*(x+1)/2+y*(y-1)/2;
  cout<<ans<<endl;;
}


Measured memory_bytes: 900
#define REP(i, n) for(int i = 0; i < (int)(n); i++)

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

int main() {
	string s;
	cin >> s;

	if ( (s[0] == s[1])  && (s[1] == s[2]) ) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int mod = 1e9+7;
int n;
ll *f[110],_f[110][110],fac[110],ifac[110];
ll fp(ll a,ll k){
	ll ans=1;
	for(;k;k>>=1,a=a*a%mod)
		if(k&1) ans=a*ans%mod;
	return ans;
}
void upd(ll&a,ll b){a=(a+b)%mod;}
int main(){
	read(n);
	for(int i=0;i<=n;i++)
		f[i]=_f[i]+55;
	fac[0]=1;
	for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	ifac[n]=fp(fac[n],mod-2);
	for(int i=n;i;i--) ifac[i-1]=ifac[i]*i%mod;
	f[n-1][1]=f[n-1][0]=1;
	for(int i=n;i;i--)
		for(int j=-n;j<=n;j++){
			for(int p=0;p<=i;p++)
				for(int q=0;p+q<=i;q++)
					if((j+p-q)%2==0&&p+q&&abs(p+q)>=abs(j))
						upd(f[i-p-q][j+p-q>>1],f[i][j]*ifac[p]%mod*ifac[q]);
		}
	cout<<(fac[n]*f[0][0]%mod+mod)%mod<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main(){
  string n;
  cin>>n;
  bool ja=true;
  for(int i=1;i<len(n);i++){
    if(n[i]!='9') ja=false;
  }
  if(ja){
    cout<<(len(n)-1)*9+(n[0]-'0')<<endl;
    return 0;
  }
  cout<<(len(n)-1)*9+(n[0]-'0')-1<<endl;
}

Measured memory_bytes: 3596
import sys
input = sys.stdin.readline
def main():
  n=int(input())
  if n==0:
    print(0)
    exit()
  s=1 if n>0 else 0
  n=abs(n)
  for j in range(s,31,2):
    if ((n>>j) & 1): #立っているビットのところで処理が走る
      n+=pow(2,j+1)
  print(bin(n)[2:])
if __name__=='__main__':
  main()


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

int main(){
	string s0, s1;
	cin >> s0 >> s1;
	s0 = s0 + s1.at(s1.size()-1);
	if(s0 == s1){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}


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

#define     bip(a)         __builtin_popcount(a)
#define     ull            unsigned long long
#define     ll             long long
#define     u              unsigned
#define     pb             push_back
#define     pf             push_front ///for list
#define     mp             make_pair
#define     is             insert
#define     ff             first
#define     ss             second
#define     vi             vector<int>
#define     vl             vector<ll>
#define     si             set<int>
#define     sl             set<ll>
#define     li             list<int>
#define     pii            pair<int,int>
#define     pll            pair<ll,ll>
#define     mii            map<int,int>
#define     mll            map<ll,ll>
#define     ma             INT_MAX
#define     mi             INT_MIN
#define     mod            1000000007
#define     pi             3.14159265359
#define     e              2.71828182846
#define     inf            1000000000000000LL
#define     all(x)         x.begin(), x.end()
#define     lb(a,b,c)      lower_bound(a,a+b,c)-a
#define     ub(a,b,c)      upper_bound(a,a+b,c)-a
#define     lbv(a,c)       lower_bound(all(a),c)-a.begin()
#define     ubv(a,c)       upper_bound(all(a),c)-a.begin()
#define     srt1(a,b)      sort(a,a+b)
#define     srt2(a,b)      sort(a,a+b,greater<int>())
#define     gcd(a,b)       __gcd(a,b)
#define     lcm(a,b)       (a*(b/gcd(a,b)))
#define     harmonic(n)    0.57721566490153286l+log(n)
#define     mem(a, b)      memset(a, b, sizeof(a))

///s.lower_bound(a),s.upper_bound(a), for set
///nCr(x, y) = nCr(x-1, y-1) + nCr(x-1, y)
///factorial digit   ((n * log10(n / e) +log10(2 * pi * n) /2.0));


int main()
{
    ll x;
    cin>>x;
    for(ll i=1; i<300; i++){
        for(ll j=i-1; j>-300; j--){
            if(ceil(pow(i,5))-ceil(pow(j,5))==x){
                cout<<i<<" "<<j<<endl;
                return 0;
            }
        }
    }
}



Measured memory_bytes: 4032
d,g=map(int,input().split())
plist=[]
clist=[]
for i in range(d):
    p,c=map(int,input().split())
    plist.append(p-1)
    clist.append(c)
def f(pl,goal):
    result=0
    if goal<0:
        return 0
    for i in range(d,0,-1):
        if goal>=pl[i-1]*(i)*100:
            result+=pl[i-1]
            goal-=pl[i-1]*(i)*100
        else:
            if goal%((i)*100)==0:
                result+=goal//((i)*100)
                goal=0
                break
            
                
            result+=goal//((i)*100)+1
            goal=0
            break
    if goal>0:
        return 1000
    return result
blist=[list(str(bin(i)))[2:][-1::-1]for i in range(2**d)]
result=1000
    
for c in blist:
    qlist=plist[:]
    h=g
    ires=0
    for i in range(len(c)):
        if c[i]=='1':
            qlist[i]=0
            h-=clist[i]+(plist[i]+1)*(i+1)*100
            ires+=plist[i]+1
    result=min([result,f(qlist,h)+ires])
print(result)

Measured memory_bytes: 3188
s_list = list(input())

kws = [list(kw) for kw in ["dream", "dreamer", "erase", "eraser"]]

memo = [0 for _ in range(len(s_list)+1)]
memo[0] = 1
for i in range(len(s_list)):
    if memo[i] == 1:
        for kw in kws:
            l = len(kw)
            if s_list[i:i+l] == kw:
                memo[i+l] = 1

if memo[-1] == 1:
    print("YES")
else:
    print('NO')

Measured memory_bytes: 50696
N=int(input())
def F(n):
    A=[]
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            A.append(i)
            if i != n // i:
                A.append(n//i)
    return A
D=F(N-1)
E=F(N)
E=sorted(E)
G=[]
for i in E[1:]:
  a=N
  while a%i==0:
    a//=i
  if a%i==1:
    G.append(i)
print(len(G)+len(D)-1)

Measured memory_bytes: 3316
#include<iostream>
using namespace std;
void print(char str[],int begin,int end)
{
	for (int i = begin; i <= end; i++)
		cout << str[i];
	cout << endl;
}
void reverse(char str[],int begin,int end)
{
	int mid = (begin + end) / 2;
	for(int i = begin;i <= mid;i++)
	{
		char tmp = str[i];
		str[i] = str[end + begin - i];
		str[end + begin - i] = tmp;
	}
}
void replace(char str[],int begin,int end,char replaceStr[])
{
	for(int i = begin;i <= end;i++)
		str[i] = replaceStr[i - begin];
}
int main()
{
	char inputStr[1000];
	cin >> inputStr;
	int q;
	cin >> q;
	for(int i = 0;i < q;i++)
	{
		char command[10];
		cin >> command;
		int b, e;
		cin >> b >> e;
		switch (command[2])
		{
		case 'i':
			print(inputStr, b, e);
			break;
		case 'v':
			reverse(inputStr, b, e);
			break;
		case 'p':
			char rp[1000];
			cin >> rp;
			replace(inputStr, b, e, rp);
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 3112
function main()
	N,A,B,C,D=map(x->parse(Int,x),split(readline()))
	M=Dict{Int,Int}()
	M[0]=0
	M[1]=D
	function dfs(x)
		if haskey(M,x)
			return M[x]
		end
		t=10^18
		if x<=div(t,D)
			t=min(t,x*D)
		end
		for (a,b)=[2=>A,3=>B,5=>C]
			t=min(t,x%a*D+dfs(div(x,a))+b,mod(-x,a)*D+dfs(div(x+a-1,a))+b)
		end
		return M[x]=t
	end
	println(dfs(N))
end
for _=1:parse(Int,readline())
	main()
end


Measured memory_bytes: 222152
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

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

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = nextInt();
		int numK = nextInt();
		int numX = nextInt();
		int numY = nextInt();

		long res = 0;
		for (int i = 1; i <= Math.min(numN, numK); i++) {
			res += numX;
		}
		for (int i = numK + 1; i <= numN; i++) {
			res += numY;
		}

		out.println(res);
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

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

int ans;
//saiki procedure
//1st step to next, end condtion is important
void DFS(vector<int>A,int n,int m,int q,vector<int>a,vector<int>b,vector<int>c,vector<int>d){
    //if(A.size()==n){
    if(A.size()==n+1){
        // calc score
        int now = 0;
        for(int i=0; i<q; i++){
            if(A[b[i]]-A[a[i]] == c[i]) now += d[i];
        }
        ans = max(ans,now);
        return;
    }

    A.push_back(A.back());
    while(A.back() <= m){
        DFS(A,n,m,q,a,b,c,d);
        A.back()++;
    }
}

int main(){
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> a(q);
    vector<int> b(q);
    vector<int> c(q);
    vector<int> d(q);
    for(int i=0; i<q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    // full search
    //DFS(vector<int>(0),n,m);
    DFS(vector<int>(1,1),n,m,q,a,b,c,d);
    cout << ans << endl;
    return 0;
}




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

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	ll K,A,B;
	cin >> K >> A >> B;
	corner(A>=B,K+1);
	ll ans = 1;
	if(A-1<=K) {
		ans += A-1;
		K -= A-1;
	}
	if(B-A>2){
	ans += (B-A)*(K/2);
	K %= 2LL;
	}
	ans += K;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

// Union-Find 木 (Verified: AtCoder Typical Contest 001 B)
struct UnionFind {
private:
    const int n;
    int __size;
    vector<int> uf;
public:
    // 初期化 UnionFind uni(n) のように宣言すれば良い
    UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
    // find (木の根を求める)
    int find(int x) {return (uf[x] < 0) ? x : uf[x] = find(uf[x]);}
    // x と y が同じ集合に属するかどうか
    bool same(int x, int y) {return find(x) == find(y);}
    // x が属する集合の要素数
    int size(int x) {return -uf[find(x)];}
    // 集合はいくつあるか
    int size()      {return __size;}
    // x と y の属する集合を併合
    void unite(int x, int y) {
        x = find(x); y = find(y);
        if(x == y) return;
        __size--;
        if(uf[y] < uf[x]) swap(x, y);
        uf[x] += uf[y]; uf[y] = x;
    }
};


char board[510][510];
signed main() {
    int H, W; cin >> H >> W;

    UnionFind uf(H*W);
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            cin >> board[i][j];
        }
    }

    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            for(int k=0; k<4; k++) {
                int ni = i + dx[k], nj = j + dy[k];
                if(ni < 0 or nj < 0 or ni >= H or nj >= W) continue;

                if(board[i][j] == board[ni][nj]) continue;

                int idx = i * W + j;
                int idy = ni * W + nj;
                uf.unite(idx, idy);
            }
        }
    }

    vector<int> cnt1(H*W), cnt2(H*W);
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            int id = i * W + j;
            id = uf.find(id);

            if(board[i][j] == '.') cnt1[id]++;
            else cnt2[id]++;
        }
    }

    int ans = 0;
    for(int i=0; i<H*W; i++) {
        ans += cnt1[i] * cnt2[i];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4224
#include <stdio.h>
#include <string.h>
#define LEN 100005
typedef struct pp{
  char name[100];
  int t;
} P;

P Q[LEN];
int head, tail, n;
void enquene(P x){
  Q[tail]=x;
  tail=(tail+1)%LEN;
}
P dequene(){
  P x=Q[head];
  head=(head+1)%LEN;
  return x;
}
int min(int a, int b){
  if(a<b)
	return a;
  else
	return b;
}
int main(){
  int elaps=0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);
  for(i=1; i<=n; ++i){
	scanf("%s", &Q[i].name);
	scanf("%d", &Q[i].t);
}
  head=1;
  tail=n+1;
  while(head!=tail){
	u=dequene();
	c=min(q, u.t);
	u.t-=c;
	elaps+=c;
	if(u.t>0)
	  enquene(u);
	else
	  printf("%s %d\n", u.name, elaps);
}
  return 0;
}



Measured memory_bytes: 11884
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

int n;
vector<int> d;


void solve(){
    cin >> n;
    d.resize(n,0);
    rep(i,n){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    vector<int> t(n+1,0);
    rep(i,n){
        if (i%2==0) t[i]=d[i];
        else t[i]=24-d[i];
    }

    ll ans=12;
    rep(i,n+1){
        rep(j,i){
            ans=min(ans,(ll)abs(t[i]-t[j]));
        }
    }

    cout << ans << endl;
    
}

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader(); 
        String S = r.s();
        boolean flag = false;
        for(int i = 0; i < 3; i++){
            if(S.charAt(i) == S.charAt(i+1)){
                flag = true;
                break;
            }
        }
        println(flag ? "Bad" : "Good");
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

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

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

    if (X == 2) {
        std::cout << X << std::endl;
        return 0;
    }

    std::vector<int> primes;
    primes.push_back(2); 
    for (int i = 3; i < 10000000; i += 2) {
        bool isPrime = true;
        for (int p : primes) {
            if (i % p == 0) {
                isPrime = false;
                break;
            }
        }

        if (isPrime) {
            if (i >= X) {
                std::cout << i << std::endl;
                return 0;
            } else {
                primes.push_back(i);
            }
        }
    }

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll INF = 1ll<<60;
static const int MOD = 1e9+7;

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

    vector<int> sum(N+1,0);
    for(int i=0; i<N; i++){
        sum[i+1] = sum[i];
        if(s[i] == 'R') sum[i+1]++;
    }

    int ans = N;

    for(int i=0; i<=N; i++){
        ans = min(ans,max(i-sum[i],sum[N]-sum[i]));
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 4408
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

//_(＾～＾ ｣ ∠)_

using LL = long long;

int main() {

    int N, M;
    cin >> N >> M;

    map<int, int> m;
    for (int i = 0; i < N; i++) {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++) {
            int a;
            cin >> a;
            m[a]++;
        }
    }

    int ans = 0;
    for (auto x: m) if (x.second == N) ans++;
    cout << ans << endl;

    return 0;
}



























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

int main()
{
	int n;
	cin >> n;
	LL a, b, pr;
	LL ans;
	for(int i = 1; i <= n; i++)
	{
		cin >> a >> b;
		pr = a * b;
		LL t = sqrt(pr);
		if(t * (t + 1) < pr)
			ans = t * 2 - 1;
		else if(t * t == pr)
		{
			if(a == b)
				ans = (t - 1) * 2;
			else
				ans = (t - 1) * 2 - 1;
		}
		else
			ans = (t - 1) * 2;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N,A,B=gets.chomp.split(" ").map(&:to_i)
MOD=10**9+7
def ppow(x, n)
    return 1 if n == 0
    return ppow(x**2 % MOD, n / 2) if (n % 2) == 0
    return ppow(x**2 % MOD, n / 2) * x if (n % 2) == 1
end

def kaijou(a, b)
    (b..a).inject(1) {|i,j| i*j % MOD }
end

ret = ppow(2, N)
ret -= 1
ret -= (kaijou(N, N-A+1) * ppow(kaijou(A, 1), MOD-2)) % MOD
ret -= (kaijou(N, N-B+1) * ppow(kaijou(B, 1), MOD-2)) % MOD
ret += MOD*2
puts ret % MOD


Measured memory_bytes: 1788
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
#include<string.h>
using namespace std;

int main(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); 
	int a, b; cin >> a >> b;
	double x =((double)a + b) / 2;
	cout <<ceil(x) << endl;
	return 0;
}




Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
const int MOD = 10007;

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int dp[1010][8] = {};
    dp[0][1] = 1;
    map<char, int> dic;
    for(int i = 0; i < 3; i++) dic["JOI"[i]] = i;

    for(int i = 0; i < N; i++){
        for(int s1 = 0; s1 < 8; s1++){
            for(int s2 = 0; s2 < 8; s2++){
                if((s2 >> dic[s[i]] & 1) && (s2 & s1) != 0){
                    dp[i + 1][s2] += dp[i][s1];
                    dp[i + 1][s2] %= MOD;
                }
            }
        }
    }
    int ans = 0;
    for(int s = 0; s < 8; s++){
        ans += dp[N][s];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1252
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(int i=p;i<n;++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

int main()
{
    ll W, H, x, y;
    cin >> W >> H >> x >> y;

    if ((W%2) == 0 && (H%2) == 0 && (W/2) == x && (H/2) == y)
    {
        const double ans = static_cast<double>((W * H) >> 1);
        printf("%.09lf 1\n", ans);
    }
    else // else if (((W%2) == 0 && (W/2) == x) || ((H%2) == 0 && (H/2) == y))
    {
        const double ans = static_cast<double>((W * H)) * 0.5;
        printf("%.09lf 0\n", ans);
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (c % gcd(a, b) ? "NO" : "YES") << endl;
    return 0;
}


Measured memory_bytes: 256