akhauriyash/Code-Regression huggingface dataset:
chomp (my ($k, $a, $b) = split / /, <STDIN>);
if ($b - $a <= 1) {
  print $k + 1, "\n";
} else {
  my $n = $a;
  $n += int(($k + 1 - $a) / 2) * ($b - $a);
  $n += ($k + 1 - $a) % 2;
  print "$n\n";
}

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

const int END = -1;
struct StNod
{
  int m_nParnt;
  int m_nLeft;
  int m_nRigt;

  StNod() :
     m_nParnt(END), m_nLeft(END), m_nRigt(END)
  { }
};

enum EnDir
{
  D_Left,
  D_Right,
};

void fnInput(vector<int> &rvnPodr, vector<int> &rvnIodrSeq)
{
  int nMaxSiz;

  cin >> nMaxSiz;
  rvnPodr.resize(nMaxSiz);
  rvnIodrSeq.resize(nMaxSiz + 1);

  for (int i = 0; i < nMaxSiz; i++)
    cin >> rvnPodr[i];

  int nNode;
  for (int i = 1; i < nMaxSiz + 1; i++)
  {
    cin >> nNode;
    rvnIodrSeq[nNode] = i;
  }
}

void fnStructTree(const vector<int> &cnrvnPodr, const vector<int> &cnrvnIodrSeq, vector<StNod> &rvoNod)
{
  for (int i = 1; i < cnrvnPodr.size(); i++)
  {
    int nParnt = END;
    int nx = cnrvnPodr[0];
    EnDir enDir;
    while (nx != END)
    {
      nParnt = nx;
      if (cnrvnIodrSeq[ cnrvnPodr[i] ] < cnrvnIodrSeq[nx])
      {
        nx = rvoNod[nx].m_nLeft;
        enDir = D_Left;
      }
      else
      {
        nx = rvoNod[nx].m_nRigt;
        enDir = D_Right;
      }
    }

    rvoNod[ cnrvnPodr[i] ].m_nParnt = nParnt;
    if (enDir == D_Left)
      rvoNod[nParnt].m_nLeft = cnrvnPodr[i];
    else
      rvoNod[nParnt].m_nRigt = cnrvnPodr[i];
  }
}

void fnPostOrder(const vector<StNod> &cnrvoNod, int nx)
{
  static int stnPrt = 0;
  if (nx == END)  return;

  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nLeft);
  fnPostOrder(cnrvoNod, cnrvoNod[nx].m_nRigt);

  if (stnPrt++) cout << " ";
  cout << nx;
}

void fnResult(const vector<StNod> &cnrvoNod)
{
  int nx = 1;
  while (cnrvoNod[nx].m_nParnt != END)
    nx = cnrvoNod[nx].m_nParnt;

  fnPostOrder(cnrvoNod, nx);
  cout << endl;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnPodr, vnIodrSeq;
  fnInput(vnPodr, vnIodrSeq);

  StNod oNod;
  vector<StNod> voNod(vnIodrSeq.size(), oNod);
  fnStructTree(vnPodr, vnIodrSeq, voNod);
  
  fnResult(voNod);
  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
int main()
{
  std::string S, T;std::cin >>S >> T;
  std::vector<std::vector<int>> p1(26),p2(26);
  for(int i = 0; i < S.size(); i++){p1[S[i]-'a'].push_back(i);}
  for(int i = 0; i < T.size(); i++){p2[T[i]-'a'].push_back(i);}
  std::sort(p1.begin(),p1.end()), std::sort(p2.begin(),p2.end());
  std::cout << (p1==p2?"Yes":"No") << std::endl;
  return 0;
}

Measured memory_bytes: 2824
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

int main(){
	ll r;
	cin >> r;
	cout << 3 * pow(r,2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int k, n;cin>>k>>n;
	int arr[n];
	cin>>arr[0];
	vector<int> v;
	for(int i = 1; i < n; ++i){
		cin>>arr[i];
		v.push_back(arr[i] - arr[i-1]);
	}
	v.push_back(arr[0] + k - arr[n-1]);
	sort(v.begin(), v.end());
	cout<<accumulate(v.begin(), v.end(), 0) - v.back()<<endl;
	return 0;
}

Measured memory_bytes: 1912
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	long double v;
	while(cin >> v){
		long double t = v / 9.8;
		long double y = 4.9 * t * t;
		long double floor = (y + 5) / 5.0;
		cout << (int)ceil(floor) << '\n';
	}
	return 0;
}
// Write Here



Measured memory_bytes: 3292
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var d = new Dictionary<int, int>();
        var d2 = new Dictionary<int, int>();
        for (int i = 0; i < n; i++)
        {
            var e1 = i + a[i];
            var e2 = i - a[i];
            if (d.ContainsKey(e1)) d[e1]++;
            else d[e1] = 1;
            if (d2.ContainsKey(e2)) d2[e2]++;
            else d2[e2] = 1;
        }
        getAns(d, d2);
    }
    static void getAns(Dictionary<int, int> a, Dictionary<int, int> b)
    {
        var ans = 0L;
        foreach (var x in a)
        {
            if (b.ContainsKey(x.Key)) ans += (long)x.Value * b[x.Key];
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 48084
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vd(T) vector<vector<T>>
#define v(T) vector<T>
#define mod (ll)(1e9+7)
#define pp(T) pair<T,T>
#define pb push_back
#define mp make_pair
#define NN 100005
#define IO ios_base::sync_with_stdio(NULL),cin.tie(0),cout.tie(0)
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define DEBUG cout<<"***********DEBUGGING***********"<<endl
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 
ll power(ll a,ll b){ if(b==0) return 1; ll s=power(a,b/2); s*=s;if(b&1) return s*a; return s;}
ll powermod(ll a,ll b,ll m){ if(b==0) return 1; ll s=power(a,b/2);s*=s; s%=m; if(b&1) return (s*a)%m; return s;}
inline int add(ll a,ll b,ll m=0){
    if(m==0) return a+b;
    return (a%m+b%m)%m;
}

inline int sub(ll a,ll b ,ll m=0){
    if(m==0) return a-b;
    return ((a%m-b%m)%m+m)%m;
}

inline int mul(ll a,ll b,ll m=0){
    if(m==0)return (a*b);
    return ((a%m)*(b%m))%m;
}

inline int div(ll a,ll b,ll m=0){
    if(m==0) return a/b;
    return ((a%m)*(powermod(a,b,m-2)%m))%m;
}

bool isopen(char c){
    return ((c=='(')||(c=='{')||(c=='['));
}

ll longest_balanced_parenthesis(string a,ll n){
    stack<char> s;
    ll start=0;
    ll ans=0,m=0;
    for(ll i=0;i<n;i++){
        if(isopen(a[i])){
            s.push(a[i]);
        }
        else{
            if(isopen(a[i])|| s.empty()){
                m=max(m,ans);
                continue;
            }
            else{
                s.pop();
                ans+=2;
                m=max(ans,m);
            }
        }
    }

    return m;

}

ll setup_k(ll *a,ll k){
  ordered_set x;
  // Now , insert and then check number of integers less than k by just using x.order_of_key(k+1)
}

int main() {

    IO; 

    ll a,b,c,d;
cin>>a>>b>>c>>d;
cout<<max(a*b,c*d)<<endl;
    

}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const a = lines[0].split("");
    const b = lines[1].split("");
    const ans = a.map((v, i)=>v+(b[i]||"")).join("");
    console.log(ans);
});


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

int main() {
  string s;
  cin >> s;
  string a;
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '0') a += '0';
    else if(s[i] == '1') a += '1';
    else if(s[i] == 'B') {
      if(!a.empty()) a.pop_back();
    }
  }

  cout << a;

  return 0;
 


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,x;
int main(){
    cin>>n;
    for(int i=0;i*108/100<=n;i++){
        if(i*108/100==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":(\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double dp[3001][3001];
double solve(double a[],int i,int x){
	if(x==0)return 1;
  	if(i==0)return 0;
  	if(dp[i][x]>-0.9)return dp[i][x];
  	return dp[i][x]=a[i]*solve(a,i-1,x-1)+(1-a[i])*solve(a,i-1,x);
}


int main(){
	int n;
    cin>>n;
  	double a[n];
  	memset(dp,-1,sizeof(dp));
  	for(int i=1;i<=n;i++){
      cin>>a[i];
    }
  	cout<<fixed<<setprecision(10)<<solve(a,n,(n+1)/2);


	return 0;
}

Measured memory_bytes: 74316
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
using namespace std;
int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	if(a==b&&b==c)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

using namespace std;

typedef long long LL;
typedef unsigned long long uLL;
typedef long double ldb;
typedef pair<int,int> pii;

int A[3][101];

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    for(int i = 1; i <= n; ++i)
        cin>>A[1][i];
    for(int i = 1; i <= n; ++i)
        cin>>A[2][i];
    for(int i = 1; i <= 2; ++i)
        for(int j = 1; j <= n; ++j)
            A[i][j] += max(A[i-1][j], A[i][j-1]);
    cout<<A[2][n]<<endl;
    return 0;
}


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
typedef struct {
	vector <int> to;
	int cost;
} edge;

int main( void ){
	// initialize();
	string S, T;
	cin >> S >> T;
	int ans = k_mod;
	int N = S.size(), K = T.size();
	rep( i, 0, N - K + 1 ){
		int temp = 0;
		rep( j, 0, K )
		      temp += ( S[ i + j ] != T[ j ] );
		ans = min( ans, temp );
	}
	cout << ans << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 3596
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	uresi := 0

	uresi += (n / 500) * 1000
	n -= (n / 500) * 500

	uresi += (n / 5) * 5

	fmt.Println(uresi)
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


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

using namespace std;

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

    int in, n, tmp;
    cin >> in >> n;
    while(n--) {
        cin >> tmp;
        in -= tmp;
        if(in < 0) break;
    }
    if(in < 0) cout << -1 << endl;
    else cout << in << endl;

}




Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
vector<int> dy = {1, 0, -1, 0};
vector<int> dx = {0, 1, 0, -1};
int INF = 10000;
int main(){
  while (1){
    int w, h;
    cin >> w >> h;
    if (w == 0 && h == 0){
      break;
    }
    vector<vector<vector<bool>>> ok(h, vector<vector<bool>>(w, vector<bool>(4, true)));
    for (int i = 0; i < w; i++){
      ok[h - 1][i][0] = false;
      ok[0][i][2] = false;
    }
    for (int i = 0; i < h; i++){
      ok[i][w - 1][1] = false;
      ok[i][0][3] = false;
    }
    for (int i = 0; i < h * 2 - 1; i++){
      if (i % 2 == 0){
        for (int j = 0; j < w - 1; j++){
          int x;
          cin >> x;
          if (x == 1){
            ok[i / 2][j][1] = false;
            ok[i / 2][j + 1][3] = false;
          }
        }
      }
      if (i % 2 == 1){
        for (int j = 0; j < w; j++){
          int x;
          cin >> x;
          if (x == 1){
            ok[i / 2][j][0] = false;
            ok[i / 2 + 1][j][2] = false;
          }
        }
      }
    }
    vector<vector<int>> d(h, vector<int>(w, INF));
    d[0][0] = 1;
    queue<pair<int, int>> Q;
    Q.push(make_pair(0, 0));
    while (!Q.empty()){
      int y = Q.front().first;
      int x = Q.front().second;
      Q.pop();
      for (int i = 0; i < 4; i++){
        if (ok[y][x][i]){
          int y2 = y + dy[i];
          int x2 = x + dx[i];
          if (d[y2][x2] == INF){
            d[y2][x2] = d[y][x] + 1;
            Q.push(make_pair(y2, x2));
          }
        }
      }
    }
    if (d[h - 1][w - 1] == INF){
      cout << 0 << endl;
    } else {
      cout << d[h - 1][w - 1] << endl;
    }
  }
}


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

using namespace std;

const int mod = 1e9+7;
void add_self (int &a,int b)
{
    a+=b;
    if (a>=mod)
        a-=mod;
}

int mul(int a,int b)
{
   return (long long)a*b%mod;
}
int n;

struct M
{
    vector <vector <int> > t;
    M() {
        t.resize(n,vector <int> (n));
    }

    M operator* (const M&b) const {
        M c=M();
        for (int i=0;i<n;i++)
            for (int j=0;j<n;j++)
            for (int k=0;k<n;k++)
                add_self(c.t[i][k],mul(t[i][j],b.t[j][k]));
        return c;
    }
};
int main()
{
   // freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

    long long k;
    cin >> n >> k;
    vector <vector <int> > connect(n,vector <int> (n));
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
        cin >> connect[i][j];

    M answer=M();
    for (int i=0;i<n;i++)
        answer.t[i][i]=1;

    M c=M();
    c.t=connect;

    while (k)
    {
        if (k%2)
            answer=answer*c;
        c=c*c;
        k/=2;
    }

    int total=0;
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
        add_self(total,answer.t[i][j]);
    cout << total;

}



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

# A - Ice Tea Store
prices = list(map(int, input().split()))
n = int(input())

stores = []
units = [1, 2, 4, 8]
magnifications = list(reversed(units))

for i in range(4):
	compared_price = prices[i] * magnifications[i]
	store = [units[i], prices[i], compared_price]
	stores.append(store)

# 0:購入単位, 1:価格, 2:比較用の価格
stores.sort(key=lambda x:x[2])

amount = n * 4
ans = 0

for i in range(4):
	unit = stores[i][0]
	price = stores[i][1]

	ans += price * (amount//unit)
	amount %= unit

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
signed main(){
  int N; cin>>N;
  bool X = false;
  int ans1 = 0;
  int ans2 = 0;
  for(int i=0; i<=N; i++){
    ans1 = i;
    ans2 = i*1.08;
    if(ans2 == N){
      X = true;
      break;
    }
  }
  if(X) cout<<ans1<<endl;
  else cout<<":("<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
const int Base=2e3+10;
const int mod=1e9+7;
const int inv2=mod/2+1;
const int M=5e3+10;
const int N=2e5+10;
using namespace std;
int n,ans,a[N],b[N],h[N],dp[M][M];
int Pow(int a,int b) {
	int ans=1;
	while(b) {
		if(b&1) ans=1ll*ans*a%mod;
		b>>=1;a=1ll*a*a%mod;
	}
	return ans;
}
int C(int n,int m) {
	return 1ll*h[n]*Pow(h[n-m],mod-2)%mod*Pow(h[m],mod-2)%mod;
}
int main() {
	scanf("%d",&n);h[0]=1;
	for(int i=1;i<=M<<1;i++) h[i]=1ll*h[i-1]*i%mod;
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i],&b[i]);
	for(int i=1;i<=n;i++) dp[Base-a[i]][Base-b[i]]++;
	for(int i=1;i<=5000;i++)
		for(int j=1;j<=5000;j++)
			dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
	for(int i=1;i<=n;i++) {
		ans=(ans+dp[Base+a[i]][Base+b[i]])%mod;
		ans=(ans-C((a[i]+b[i])*2,a[i]*2)+mod)%mod;
	}
	printf("%d\n",1ll*ans*inv2%mod);
	return 0;
}

Measured memory_bytes: 100736
#include<stdio.h>
#define MAX 100000
#define N -1

typedef struct node{
  int p,l,r;
}Node;

Node T[MAX];
int n,depth[MAX];

void printchild(int x){
  int t = T[x].l;
  int i=0;
  for(;t!=N;t=T[t].r){
    if(i!=0)printf(", ");
    i=1;
    printf("%d",t);
  }
}

void print(int x){
  printf("node %d: parent = %d, depth = %d, ",x,T[x].p,depth[x]);
  if(T[x].p==N)printf("root, [");
  else if(T[x].l==N)printf("leaf, [");
  else printf("internal node, [");
  printchild(x);
  printf("]\n");
}

void getdepth(int x,int y){
  depth[x]=y;
  if(T[x].r!=N)getdepth(T[x].r,y);
  if(T[x].l!=N)getdepth(T[x].l,y+1);
}

int main(){
  scanf("%d",&n);
  int i;
  for(i=0;i<n;i++)T[i].p=T[i].l=T[i].r=N;
  int j,current,num,child;
  for(i=0;i<n;i++){
    scanf("%d %d",&current,&num);
    int left;
    for(j=0;j<num;j++){
      scanf("%d",&child);
      if(j==0)T[current].l=child;
      else T[left].r=child;
      left=child;
      T[child].p=current;
  }
  }
  int r;
  for(i=0;i<n;i++)if(T[i].p==N)r=i;
  getdepth(r,0);
  for(i=0;i<n;i++)print(i);
  
  return 0;
}



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

int main(){
  int d;
  cin >> d;
  if(d==25){cout << "Christmas" << endl;}
  if(d==24){cout << "Christmas Eve" << endl;}
  if(d==23){cout << "Christmas Eve Eve" << endl;}
  if(d==22){cout << "Christmas Eve Eve Eve" << endl;}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			String o = sc.nextLine();
			String e = sc.nextLine();

			StringBuilder sb = new StringBuilder(o);
			for (int i = 0; i < e.length(); i++) {
				sb.insert(2 * i + 1, e.charAt(i));
			}

			System.out.println(sb.toString());

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 23764
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    boolean good = true;
    for (int i = 0; i < s.length(); i+= 2) {
      char c = s.charAt(i);
      if (c == 'L') good = false;
    }
    for (int i = 1; i < s.length(); i+= 2) {
      char c = s.charAt(i);
      if (c == 'R') good = false;
    }
    if (good) {
      os.println("Yes");
    } else {
      os.println("No");
    }
  }
}

Measured memory_bytes: 23252
#include<bits/stdc++.h>
 using namespace std;
 
 int main(){
 	int N;
 	cin >> N;
 	N=N%10;
 	if(N==3){
 		cout << "bon" << endl;
 	}else if(N==0 || N==1 || N==6 || N==8){
 		cout << "pon" << endl;
 	}else{
 		cout << "hon" << endl;
 	}
 	
 	return 0;
 }

Measured memory_bytes: 3640
#include<stdio.h>

int main(int argc, const char * argv[])
{
    int n,i,j,k,max;
    
    max = k = 0;
    j = 1;
    scanf("%d", &n);
    do{
        scanf("%d", &i);
        if((i == j  &&  i == 1) || (i == 1)){
            k++;
        }else{
            k = 0;
        }
        if(max < k){
            max = k;
        }
        j = i;
    }while(--n);
    
    printf("%d\n", max + 1);
    return 0;
}



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

const int INF = 0x3f3f3f3f;
const int MAXD = 123;
const int MAXK = 112345;
const int mod = 1000000000+7;

char ent[MAXK];
int d, strSize;
int pd[MAXK][MAXD][2];

int rec(int cur, int sum, int last_digit_gt)
{
	// cout << last_digit_gt << " -- " << sum << endl;
	if(cur==strSize){
		if(sum % d==0) return 1;
		else return 0;
	}

	if(pd[cur][sum][last_digit_gt]!=-1)
		return pd[cur][sum][last_digit_gt];

	int acum = 0;
	int lim = last_digit_gt ? (ent[cur]-'0') : 9;
	for(int i=0; i<=lim; i++){
		// cout << cur << " // " << i << endl;
		int next_last_digit = last_digit_gt && (i == lim);
		acum += rec(cur+1, (sum+i)%d, next_last_digit);
		acum = acum%mod;
	}

	return pd[cur][sum][last_digit_gt] = acum;
}

int main()
{
	scanf("%s\n%d", ent, &d);
	strSize = strlen(ent);

	memset(pd, -1, sizeof(pd));

	int resp = 0;
	for(int i=0; i<(ent[0]-'0'); i++){
		resp += rec(1,i%d,0);
		resp = resp%mod;
	}
	resp += rec(1,(ent[0]-'0')%d,1);
	resp = resp%mod;

	cout <<  ((resp-1) % mod  < 0 ? (resp-1) % mod + mod : (resp-1) % mod) << '\n';

	return 0;
}

Measured memory_bytes: 109184
#include<bits/stdc++.h>
using namespace std;int main(){int a,b,c,k;cin>>a>>b>>c>>k;int max=a;if(b>a){max=b;b=0;}else if(c>a&&c>b){max=c;c=0;}else{a=0;}for(int i=0;i<k;i++){max*=2;}cout<<a+b+c+max;return 0;}

Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(n):
  a.append(list(input().split()))
for i in range(0,n):
  a[i].append(i+1)
for i in range(0,len(a)):
  a[i][1]=int(a[i][1])
a.sort(key=lambda x:(x[0],-x[1]),reverse = False)
for i in range(0,n):
  print(a[i][2])

Measured memory_bytes: 3064
function main(input) {
    const args = input.split('\n');
    const N = args[0],
          nums = args.slice(1, args.length - 1);

    console.log(nums.filter((n, i) => nums.indexOf(n) === i).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(){
  int N, X, Y;
  cin >> N >> X >> Y;
  --X,--Y;
  vector<int> ans(N);
  for(int i = 0; i < N; ++i){
    for(int j = i+1; j < N; ++j){
      int d = j-i;
      d = min(d,abs(i-X)+abs(j-Y)+1);
      ++ans[d];
    }
  }
  for(int i = 1; i < N; ++i)
    cout << ans[i] << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(ll i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;



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

	ll a, b, c, k;
	cin >> a >> b >> c >> k;

	for (int i = 0; i < k; i++)
	{
		if (b <= a)
		{
			b *= 2;
		}
		else if (c <= b)
		{
			c *= 2;
		}
	}

	if (a < b && b < c)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int culc(int c,int b,int a){
	int price = 0;
	
	price += (a/5)*1520+(a%5)*380;
	price += (b/4)*1870+(b%4)*550;
	price += (c/3)*2244+(c%3)*850;
	
	return price;
}

int main(void) {
	int g,i,j,k,min,t;
	
	while(scanf("%d",&g),g){
		min = 9500;
		for(i = 0;i <= g/500;i++){
			for(j = 0;j <= (g-i*500)/300;j++){
				k = g-i*500-j*300;
				if(!(k%200)){
					k /= 200;
					t = culc(i,j,k);
					if(t < min){
						min = t;
					}
				}	
			}
		}
		printf("%d\n",min);
	}
	
	return 0;
}

Measured memory_bytes: 600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication46
{
    class Program
    {
        static void Main()
        { int p = int.Parse(Console.ReadLine());
            for (int q = 0; q < p; q++) {
                string a = Console.ReadLine();
                int[] b = new int[8];
                int[] c = new int[8];
                for (int d = 0; d < 8; d++)
                {
                    b[d] = c[d] = (int)char.GetNumericValue(a[d]);
                }
                Array.Sort(b);
                Array.Sort(c);
                Array.Reverse(b);
                int f, y; f = y = 0;
                for (int g = 0; g < 8; g++)
                { f = 10 * f + b[g]; }
                for (int h = 0; h < 8; h++)
                {
                    if (y == 0 && c[h] == 0) continue;
                    y = 10 * y + c[h];
                }
                Console.WriteLine(f-y);
            }
        }
    }
}

Measured memory_bytes: 9292
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int X, Y, Z;
	cin >> X >> Y >> Z;
	int len = Y + 2 * Z;
	int cnt = 0;
	while (len <= X) {
		len += Y + Z;
		cnt++;
	}
	cout << cnt;
}

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

int main() {
  
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  
  if ( e - a <= k )
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>

using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int k;
	cin >> k;
	char j = s.at(k-1);
	for (int i = 0; i < n; i++)
	{
		if (s.at(i) != j)
		{
			s.at(i) = '*';
		}
	}
	cout << s << endl;


}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[222222][3];

int main(){
	
	REP(i,222222)REP(j,3)dp[i][j] = LLINF;
	REP(i,2)dp[0][i] = 0;
	
	ll n;cin >> n;
	vector<ll> v(n);
	ll sum = 0;
	REP(i, n){
		cin >> v[i];
		sum += v[i];
	}
	
	ll now = 0;
	REP(i,n){
		REP(j,3){
			if(j < 2)dp[i][j] = min(dp[i][j], now);
			ll tmp = 0;
			if(j % 2) {
				tmp = (v[i] % 2 == 0);
			}
			else {
				tmp = (v[i] % 2 == 1);
				if(i != n - 1 && v[i] == 0)tmp = 2;
			}
			if(j == 0){
				dp[i+1][j] = min(dp[i+1][j], dp[i][j] + tmp);
				dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + tmp);
			}
			else if(j == 1){
				dp[i+1][j] = min(dp[i+1][j], dp[i][j] + tmp);
				dp[i+1][j+1] = min(dp[i+1][j+1], dp[i][j] + tmp);
			}
			else {
				dp[i+1][j] = min(dp[i+1][j], dp[i][j] + tmp);
			}
		}
		now += v[i];
	}
	
	//SHOW2d(dp, n+1, 5);
	
	ll ans = LLINF;
	now = 0;
	REP(i,n+1){
		REP(j,3){
			ans = min(ans, dp[i][j] + (sum - now));
		}
		now += v[i];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 7040
while True:
    n, x = map(int, input().split())
    if n+x==0:
        break
    count=0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            a=x-(i+j)
            if a!=i and a!=j and a<=n and 0<a<i:
                count += 1
    print(count)

Measured memory_bytes: 7656
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  map<int,int> a;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    a[x]++;
  }
  vector<int> b;
  for(auto x:a)
    b.push_back(x.second);
  sort(b.begin(),b.end());
  int c=0;
  for(int i=0;i<(int)b.size()-k;i++)
    c+=b.at(i);
  cout<<c<<endl;
}

Measured memory_bytes: 10748
# AOJ DSL_2_E
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_E

line = input()
n, q = list(map(int, line.split()))
N = 1
while N < n + 1:
    N *= 2
a = [0 for _ in range(0, 2 * N - 1)]

def get(i, k, l, r):
    z = a[0]
    while True:
        m = (l + r) // 2
        if i < m:
            k = k * 2 + 1
            r = m
        else:
            k = k * 2 + 2
            l = m
        z += a[k]
        if k >= N - 1:
            break
    return z

def add(s, t, x, k, l, r):
    if r <= s or t <= l:
        return
    elif s <= l and r <= t:
        a[k] += x
        return
    m = (l + r) // 2
    add(s, t, x, k * 2 + 1, l, m)
    add(s, t, x, k * 2 + 2, m, r)
    return

for t in range(0, q):
    line = input()
    qu = list(map(int, line.split()))
    if qu[0] == 0:
        add(qu[1], qu[2]+1, qu[3], 0, 0, N)
    elif qu[0] == 1:
        ans = get(qu[1], 0, 0, N)
        print(ans)




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

using namespace std;

typedef long long ll;

ll n, a[3][100000],ans = 0;

int main() {
	cin >> n;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < n; j++)cin >> a[i][j];
		sort(a[i], a[i] + n);
	}
  
	ll memo[100000]{};
	for (int i = 0, j = 0; i < n; i++) {
		while (j < n && a[1][i] >= a[2][j])j++;
		memo[i] = n - j;
	}
	for (int i = n - 1; i > 0; i--)memo[i - 1] += memo[i];
	for (ll i = 0, j = 0,k = 0; i < n;i++) {
		while (j < n && a[0][i] >= a[1][j])j++;
		ans += memo[j];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main()
{
    string a[3] = {"Sunny","Cloudy","Rainy"};
    string s;
    cin >> s;
    for (int i = 0;i<3;++i){
        if (a[i] == s){
            if (i == 2){
                cout << a[0];
                break;
            }
            else{
                cout << a[i+1];
            }
        }
    }

    return 0;
}


Measured memory_bytes: 380
import java.util.*;

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

    int t1=a+b;
    int t2=a-b;
    int t3=a*b;

    int max=Math.max(t1,t2);
    max=Math.max(max,t3);

    System.out.println(max);
  }
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int> A(N-1);
  vector<int> B(N);
  for (int i = 0; i < N-1; i++) {
    cin >> A.at(i);
    B.at(A.at(i)-1)++;
  }
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cout << B.at(i) << endl;
  }
}


Measured memory_bytes: 4844
x = int(input())


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(n ** (1 / 2) + 1)):
        if n % k == 0:
            return False

    return True


def main():
    for i in range(10000):
        if is_prime(x + i):
            print(x + i)
            return


main()

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int l = s.length();
        char[] c = s.toCharArray();
        int hugs = 0;
        for(int i=0; i<l/2; i++){
            if(c[i] != c[l-1-i]) hugs++;
        }
        System.out.println(hugs);
    }
}

Measured memory_bytes: 22996
function main(input){
    input = input.split('\n');
    num = parseInt(input[0]);
    str = input[1].split(' ');
    strA = str[0];
    strB = str[1];
    out='';
    for(i=0;i<num;i++){
        out = out + strA[i] + strB[i];
    }
    console.log(out);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

vector<vector<int>> Graph;
vector<bool> seen;

int dfs(int s, int n) {
	if (n == 0) return 1;
	int ret = 0;
	for (auto i : Graph[s]) {
		if (seen[i]) continue;
		seen[i] = true;
		ret += dfs(i, n-1);
		seen[i] = false;
	}
	return ret;
}

int main() {
	int N, M;
	cin >> N >> M;

	Graph = vector<vector<int>>(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		Graph[a-1].push_back(b-1);
		Graph[b-1].push_back(a-1);
	}

	seen = vector<bool>(N);
	for (int i = 0; i < N; i++) seen[i] = false;
	seen[0] = true;
	cout << dfs(0, N-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
#define PI 3.141592653589793
#define MOD 1000000007
//#define MOD 998244353
#define ALL(obj) (obj).begin(),(obj).end()
const ll INF = 1LL << 60;
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;

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

int main(){
    ll n;
    cin >> n;
    ll ans=0;
    for (ll i=1;i*i<n;i++){
        for (ll j=i;j*i<n;j++){
            if (j!=i)ans++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3648
import sys
_ = input()
S = input().strip()

ps = [0]*(len(S)+1)
for i in range(2, len(S)+1):
  ps[i] = ps[i-1]+int(S[i-2:i] == 'AC')

for line in sys.stdin:
  l,r = map(int, line.strip().split(' '))
  print(ps[r]-ps[l])

Measured memory_bytes: 7964
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define PER(i,n,a) for(ll i=n;i>a;i--)
#define REP1(i,a,n) for(ll i=a;i<=n;i++)
#define forit(it,x) for(auto it=(x).begin();it!=(x).end();++it)
#define ull unsigned long long int
#define ld long double
#define prec(n) fixed<<setprecision(n)
#define test ll t; cin>>t; while(t--)
#define re return 0
#define pb push_back
#define PI 3.1415926535897932384626
#define MOD (ll)1000000007
#define fi first
#define se second
#define eb emplace_back
#define vll vector<ll>
#define vi  vector<int>
#define mpll map<ll,ll>
#define pll pair<ll,ll>
#define mp(x,y) make_pair(x,y)
const ll MAXI = (ll)1e9+7;
int main(){
    IOS;
//    test{
        ld d,t,s;
        cin>>d>>t>>s;
/*        int ar[n];
        REP(i,a,n){
           cin>>ar[i];
        }
        */
        ld p=(d/s);
        if(p<=t){
            cout<<"Yes"<<"\n";
        }else{
            cout<<"No"<<"\n";
        }
//    }
re;
}


Measured memory_bytes: 3740
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <bitset>
#include <cmath>
#include <stack>
#include <iomanip>
#include <map>
#include <math.h>
typedef long long ll;
using namespace std;
const int MOD = 1000000007;

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }

int main()
{
    int N;
    cin >> N;
    int A[N -1];
    for(int i = 0; i < N -1; i++)
    {
        cin >> A[i];
        A[i]--;
    }
    vector<int> buka(N,0);
    for(int i = 0; i < N -1; i++)
    {
        buka[A[i]]++;
    }
    for(int i = 0; i < N; i++)
    {
        cout << buka[i] << endl;
    }
    return(0);
}

Measured memory_bytes: 4344
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n;
  cin >> n;
  vector<ll> a(n);
  set<ll> st;
  for(int i=0;i<n;i++){
    cin >> a[i];
    st.insert(a[i]);
  }
  if(st.size()==n) cout <<"YES\n";
  else cout <<"NO\n";
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

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

    vector<int> d(n);
    for (auto i = 0; i < n; i++) cin >> d[i];

    int ans = 0;
    for (auto i = 0; i < n; i++) {
        for (auto j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
long int h,c_monsters,cnt,total;
int main(){
    cin>>h;
      while(h>0){
      h=h/2;
      c_monsters = pow(2,cnt);
      cnt++;
      total += c_monsters;
    }
      cout<<total;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cstring>
using namespace std;
typedef long long int ll;
const int INF = 1000000000;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a % b);
}
ll lcm(ll a, ll b){
    // a >= b
    for(ll i = a; i <= (b * a); i += a){
        if(i % b == 0) return i;
    }
}
int main(){
    for(ll a, b; cin >> a >> b;){
        cout << gcd(a, b) << " ";
        if(a > b){
            cout << lcm(a, b) << endl;
        }else{
            cout << lcm(b, a) << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1156
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPL(i,f,n) for(int i=f, i##_len=(n); i<i##_len; ++i)
typedef long long ll;

int cnt[100010];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, ans = 0;
	int a[100010];
	cin >> N;
	REP(i, N) {
		cin >> a[i];
		if (a[i] > N) {
			ans++;
		}
		else {
			cnt[a[i]]++;
		}
	}
	for (int i = 1; i <= N; i++) {
		if (cnt[i] < i) {
			ans += cnt[i];
		}
		else {
			ans += (cnt[i] - i);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main()
{
    int n, a[100];
    int rate_exist;
    int min_col = 0, max_col = 0;
    int free_col_num = 0;
    int i, rate;

    scanf("%d", &n);

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

    for (rate = 0; rate < 3200; rate += 400)
    {
        for (i = 0; i < n; i++)
        {
            if (rate <= a[i] && a[i] <= rate + 399)
            {
                rate_exist = 1;
                break;
            }
            else
            {
                rate_exist = 0;
            }
        }

        min_col += rate_exist;
        max_col += rate_exist;
    }
    for (i = 0; i < n; i++)
    {
        if (a[i] >= 3200) free_col_num++;
    }

    if (min_col == 0 && free_col_num > 0)
    {
        min_col = 1;
    }

    while (free_col_num > 0)
    {
        free_col_num--;
        max_col++;
    }

    printf("%d %d", min_col, max_col);
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int x, a;
   cin >> x >> a;
   cout << (x < a ? 0 : 10) << endl;
   return 0;
}


Measured memory_bytes: 256
#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() {
  int A, B, C;
  cin >> A >> B >> C;
  set<int> s;
  s.insert(A);
  s.insert(B);
  s.insert(C);
  string ans = "Yes";
  if (s.size() != 2) ans = "No";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
void Rev(string &S)
{
	size_t strLen=S.size();
	int i,j;
	j=strLen-1;
	for (i=0;i<strLen/2;i++){
		swap(S[i],S[j]);
		j--;
	}
}
int main(int argc, char* argv[])
{
	string S;
	int Q,i;
	cin>>S;
	cin>>Q;
	int T,F;
	string C;
	bool direct=0;
	for (i=1;i<=Q;i++){
		cin>>T;
		if (T==1){
			if (direct==0){
				direct=1;
			}else{
				direct=0;
			}
		}else if (T==2){
			cin>>F>>C;
			if (F==1){
				if (direct==0){
					S.insert(0,C);
				}else{
					S+=C;
				}
			}else{
				if (direct==0){
					S+=C;
				}else{
					S.insert(0,C);
				}
			}
		}
	}
	if (direct==1){
		Rev(S);
	}
	cout<<S<<endl;
	return 0;
}

Measured memory_bytes: 900
void main() {
    int[] tmp = readln.split.to!(int[]);
    int h = tmp[0], w = tmp[1];
    string[] a;
    foreach (i; 0 .. h) {
        string row = readln.chomp;
        if (row.any!(c => c == '#')) a ~= row;
    }
    h = a.length.to!int;
    int j;
    while (j < w) {
        int cnt;
        foreach (i; 0 .. h) {
            if (a[i][j] == '.') ++cnt;
        }
        if (cnt == h) {
            foreach (i; 0 .. h) {
                a[i] = a[i][0..j] ~ a[i][j+1..$];
            }
            --w;
        } else {
            ++j;
        }
    }
    foreach (x; a) {
        x.writeln;
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.container;
import std.typecons;

Measured memory_bytes: 508
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int A = intArray[0];
            int B = intArray[1];
            Console.WriteLine(A * B);
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 28232
#include<stdio.h>

int main(void)
{
    int N;
    scanf("%d",&N);
    
    if(N % 1000 == 0)
    {
    	printf("0\n");
    	return 0 ;
    }
    
    printf("%d\n",(N / 1000 + 1) * 1000 - N);
    
    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <string>
#include <vector>
using namespace std;

const int MAX_N=8000;

bool dp[2*MAX_N+4][2*MAX_N+4][2];
int x[MAX_N+3];
int y[MAX_N+3];

int main(){
    string s;
    int dx, dy, dir=1, sx;
    cin >>s >> dx >> dy;
   
    
    int ix=1, iy=0;
    for(int i =0; i < s.size(); i++){
        if(s[i]=='T' && dir==1){
            dir *=-1;
            iy++;
        }
        else if(s[i]=='T' && dir== -1){
            dir *=-1;
            ix++;
        }
        else if(s[i]=='F' && dir==-1){
            y[iy]++;
        }
        else if(s[i]=='F' && dir==1){
            x[ix]++;
        }

    }

    dp[1][x[1] + MAX_N][0] = 1;

    dp[0][MAX_N][1] = 1;
    
   for(int i =2; i <= ix; i++){
        for(int j = 0; j <= 2*MAX_N; j++){
            
            if(j+x[i] <= 2*MAX_N){
                dp[i][j][0] |= dp[i-1][j+x[i]][0];
            }
            if(j-x[i] >= 0){
                dp[i][j][0] |= dp[i-1][j-x[i]][0];
            }
        }
    }
    for(int i =1; i <= iy; i++){
        for(int j =0; j <= 2*MAX_N; j++){
            
            if(j+y[i] <= 2*MAX_N) dp[i][j][1] |= dp[i-1][j+y[i]][1];
            if(j-y[i] >= 0) dp[i][j][1] |= dp[i-1][j-y[i]][1];
        }
    }

   if(dp[ix][dx+MAX_N][0] && dp[iy][dy+MAX_N][1]) cout << "Yes" << endl;
   else cout << "No" << endl;

return 0;
}
    

Measured memory_bytes: 125056
#include <iostream>
#include <string>

using namespace std;

int main(){
  int N, max = 0, count = 0;
  string S;
  cin >> N;
  cin >> S;

  for (int i = 0; i < N; ++i)
  {
    if(S[i] == 'I'){
      count++;
      if(count > max)
        max = count;
    }
    else if(S[i] == 'D')
      count--;
  }
  cout << max;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define P pair<ll,ll>
#define Graph vector<vector<ll>>
#define INF (1ll<<60)
#define mod 998244353
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;}

vector<ll> divisor(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(ret.begin(),ret.end());//昇順に並べる
    return ret;
}

int main(){
	ll n;cin>>n;
	
	vector<ll> ret1,ret2,per1;
	
	divisor(n,ret1);
	divisor(n-1,ret2);
	ll ans=ret2.size()-1;//1は除く

	rep(i,ret1.size()){//割るパターンはこれだけ
		ll ins=n;
		if(ret1[i]==1) continue;
		while(ins%ret1[i]==0){
			ins/=ret1[i];
		}
		ins%=ret1[i];

		if(ins==1){
			ans++;
		}
	}

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

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

using namespace std;

using ll = long long;

int main() {
    ll N, K;
    cin >> N >> K;

    std::vector<ll> h(N);
    std::for_each(h.begin(), h.end(), [](auto &x) { cin >> x; });
    std::sort(h.begin(), h.end());

    ll ans = 1000000001;
    for (auto it = h.begin(); it != h.end(); ++it) {
        const auto hmin_it = it;
        const auto hmax_it = it + K - 1;
        if (hmax_it >= h.end()) { break; }
        ans = std::min(ans, *hmax_it - *hmin_it);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
// x が半公倍数 for all k, a[k] * (p + 0.5)
//
// let b[k] = a[k]/2. Then
//   b[k], 3b[k], 5b[k], ...
//
// x は b[k] の奇数倍 => x を 2 で割り切る回数は全てで等しくないとダメ．
// b[k] = c[k] 2^e とする．
// c の gcd の奇数倍
//   
use proconio::input;
use num::integer::*;

fn div2(mut n: usize) -> usize {
  let mut e = 0;
  while n % 2 == 0 {
    n /= 2;
    e += 1;
  }
  e
}

fn main() {
  input! {
    n: usize,
    m: usize,
    a: [usize; n],
  }
  let e = div2(a[0]);
  if a.iter().all(|v| div2(v.clone()) == e) {
    let mut l = 1;
    for &v in &a { 
      l = lcm(l, v/2);
      if l > m { 
        break;
      }
    }
    println!("{}", m/l - m/(2*l));
  } else { 
    println!("0");
  }
}


Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
	int M, N;
	cin >> N >> M;
	int count = 0;
	double sum = 0;
	int* points = new int[N];
	for (int i = 0; i < N; ++i) {
		cin >> points[i];
		sum += points[i];
	}
	sum = sum / (4 * M);
	for (int i = 0; i < N; ++i) {
		if (points[i] >= sum) {
			count++;
		}
	}

	if (count >= M) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	int mn = n + 1, res = 0, x;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (mn > x)
			res++;
		mn = min(mn, x);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
using namespace std; 
int dp[100005];
int solve(int a[],int n,int k)
{
  if(n<=1)
    return 0;
    
    if(dp[n]!=-1)
      return dp[n];
  int ans=INT_MAX;
      for(int i=1;i<=k;i++)
      {
        if(n>i)
        {
          ans=min(ans,abs(a[n-i]-a[n])+solve(a,n-i,k));
        }
      }
   

   return dp[n]=ans;
}
int main() 
{
  int t=1;
  //cin>>t;
  while (t--)
  {
    memset(dp,-1,sizeof(dp));
      int n,k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
      cin>>a[i];
    }
    cout<<solve(a,n,k)<<endl;
  }
  

  
} 


Measured memory_bytes: 12148
import itertools
def combination(n):
 m=0
 for i in itertools.product(range(10),repeat=4):
  (a,b,c,d)=i
  if a+b+c+d==n:
   m+=1
 return m

while True:
 try:
  n=int(input())
  print(combination(n))
 except EOFError:
  break

Measured memory_bytes: 7580