akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0;i<n;i++)
const long long MOD = 1000000007;
const long long INF = MOD*MOD;
typedef pair<int,int> P;
typedef long long ll;
ll n,m,k, ans;
string s;


int main(){
  cin >> n;
  bool frag = true;
  rep(i,n){
    int ai; cin  >> ai;
    if(ai % 2) frag = false;
  }
  if(frag) cout << "second\n";
  else cout << "first\n";
}

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

using namespace std;

int main(){
	
	int a, b;
	string ans;
	
	cin >> a >> b;
	
	if (a == b){
		for (int i = 0; i < a; i ++){
			ans += to_string(a);
		}
	} else if (a > b){
		for (int i = 0; i < a; i++){
			ans += to_string(b);
		}
	} else {
		for (int i = 0; i < b; i++){
			ans += to_string(a);
		}
	}
	
	cout << ans;
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
string s;
map<string,int>f,g;
int func(string s);
int QAQ(string s)
{
    if(g.find(s)!=g.end())
    return g[s];
    if(s.size()==1)
    return g[s]=s[0]-'0'+1;
    for(int i=1;i<s.size();++i)
    {
        if(s.size()%i==0)
        {
            string t;
            for(int j=0;j<i;++j)
            {
                int r=1;
                for(int k=0;k<s.size()/i;++k)
                if(s[i*k+j]=='0')
                r=0;
                t+=(char)(r+'0');
            }
            g[s]=(g[s]+func(t))%mod;
        }
    }
    return g[s];
}
int func(string s)
{
    if(f.find(s)!=f.end())
    return f[s];
    for(int i=1;i<=s.size();++i)
    f[s]=(f[s]+1ll*func(s.substr(0,s.size()-i))*QAQ(s.substr(s.size()-i,i))%mod)%mod;
    return f[s];
}
int main()
{
    cin>>s;
    f[""]=1;
    cout<<func(s);
}

Measured memory_bytes: 12928
import sys
 
l = sys.stdin.readlines()
minv = int(l[1])
maxv = -1000000000

for r in map(int,l[2:]):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
 
print(maxv)

Measured memory_bytes: 23476
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
typedef long long ll;
bool debug=false;
int main(){
  ll a; string s; cin >> a >> s;
  if(a>=3200) cout << s;
  else cout << "red";
  return 0;
}


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


#define int long long


signed main() {
	// your code goes here
	int a,b;
	cin>>a>>b;
	if(a>=b)swap(a,b);
	for(int i = 0; i<b; ++i)cout<<a;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
CSF = [tuple(map(int, input().split())) for _ in range(N-1)]

for st in range(N):
    t = 0
    for i in range(st, N-1):
        C, S, F = CSF[i]
        k = max(0, (t-S + F-1)//F)
        t = S+F*k+C
    print(t)

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

int main(){
  string str;
  cin >> str;
  
  if(str.at(0) == str.at(1)){
    if(str.at(2) == str.at(3)&&str.at(0) != str.at(2)){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
  else{
    if(str.at(0) == str.at(3)&&str.at(1) == str.at(2)){
      cout << "Yes"<< endl;
    }
    else if(str.at(0) == str.at(2)&&str.at(1) == str.at(3)){
      cout << "Yes"<< endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 100005
#define MOD 1e9
#define pb push_back
#define pairs pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pairs>
#define lb lower_bound
#define ub upper_bound
#define ll long long
#define endl '\n'
using namespace std;
/* ----------------------------------------------------------------------------------- */

#define fastInput ios_base::sync_with_stdio(false), cin.tie(NULL);
#define all(x) x.begin(), x.end()
#define scan(a) scanf("%d", &a)
#define scanll(a) scanf("%lld", &a)
#define scanD(a) scanf("%lf", &a)
#define print(a) printf("%d\n", a)
#define printll(a) printf("%lld\n", a)
#define printD(a) printf("%lf\n", a)
#define printTwo(a) printf("%.2lf\n", a);
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
#define rep(i, a, n) for (int i = a; i < n; i++)
#define REP(i, a, n) for (int i = a; i <= n; i++)
#define inputArray(a,n) rep(i, 0, n) cin >> a[i];
#define copyArray(a,temp,n) rep(i, 0, n) temp[i]=a[i];
#define printArray(a,n) rep(i, 0, n) cout << a[i] << " "; cout << endl;

/* ----------------------------------------------------------------------------------- */

#define Cases  cout << "Case " << ++Case << ": ";
#define __test int tt; int Case=0; cin >> tt; while(tt--)
#define showTime cerr << "time = " << (clock() / CLOCKS_PER_SEC) << " sec" << '\n';

#define dbgA2(A, n, m) {cout<<"--> "<<#A<<" = \n";rep(i, 0, n){rep(j, 0, n){cout<<A[i][j]<<" ";}cout<<"\n";}cout<<"\n";}
#define dbgA(A, n) {cout<<" --> "<<#A<<" = (";rep(i, 0, n)cout<<A[i]<<" ";cout<<")\n";}
#define dbg(args...) {string sss(#args);sss+=',';cout<<" --> ";debugger::call(all(sss), args);cout<<"\n";}

/* ----------------------------------------------------------------------------------- */

ll gcd(ll n, ll m) { return m ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }

struct debugger {
	typedef string::iterator si;
	static void call(si it, si ed) {}
	template<typename T, typename ... aT>
	static void call(si it, si ed, T a, aT... rest) {
		string b;
		for(; *it!=','; ++it)
			if(*it!=' ')
				b+=*it;
		cout << b << "=" << a << " ";
		call(++it, ed, rest...);
	}
};

/* ----------------------------------------------------------------------------------- */


void solve() {
	int n;
	scan(n);
	int a = 1000;
	int i = 1;
	while (a < n) {
		a = 1000 * i;
		i++;
	}
	cout << a - n << endl;
}

int main() {
#ifdef Niloy
	read("input.txt");
	write("output.txt");
#endif

	solve();

	// __test {
	// 	solve();
	// }

	showTime;
	return 0;
}




Measured memory_bytes: 3760
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		long xyz[][] = new long[N][3];
		for(int i=0;i<N;i++) {
			long x = sc.nextLong(),y = sc.nextLong() ,z = sc.nextLong();
			xyz[i][0]=x;
			xyz[i][1]=y;
			xyz[i][2]=z;
		}
		sc.close();
		
		//各項目について、正負のどちらとして足すかで場合分け
		int pmset[][] = {{-1,1,1},{-1,-1,1},{-1,1,-1},{-1,-1,-1},{1,-1,1},{1,-1,-1},{1,1,-1},{1,1,1}};
		
		long points[][] = new long[8][N];
		
		for(int i=0;i<pmset.length;i++) {		
			int first = pmset[i][0], second=pmset[i][1], third=pmset[i][2];			
			for(int j=0;j<N;j++) {
				long sum = 0;
				for(int k=0;k<3;k++) {
					if(pmset[i][k]==1) {
						sum += xyz[j][k];
					}
					else {
						sum -= xyz[j][k];
					}
				}
				points[i][j]=sum;
			}
		}
		
		long ans = 0;
		for(int i=0;i<8;i++) {
			long tmp[] = points[i];
			rsort(tmp);
			long sum = 0;
			for(int j=0;j<M;j++) {
				sum += tmp[j];
			}
			ans = Math.max(ans, sum);
		}
		System.out.println(ans);
		
	}
	static void rsort(long array[]) {
		Arrays.sort(array);
		int len = array.length;
		for(int i=0;i<len/2;i++) {
			long tmp = array[i];
			array[i]=array[len-1-i];
			array[len-1-i]=tmp;
		}
	}
}



Measured memory_bytes: 27332
#include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
LL M,N;
LL K;
LL A[100001];
LL dp[302][100001];
LL deq[100001];
int main(){
    REP(i,302){
        REP(j,100001){
            dp[i][j]=0;
        }
    }
    cin>>N>>M>>K;
    REP(i,N){
        cin>>A[i];
        dp[0][i]=A[i];
    }
    for(int i=1;i<K;i++){
        int bg=0;
        int ed=0;
        deq[0]=0;
        ed++;

        REP(j,N){
            if(j==0)continue;
            if(dp[i-1][deq[bg]]!=0){
               dp[i][j]=dp[i-1][deq[bg]]+(i+1)*A[j];
            }else{
               dp[i][j]=0;
            }
            while(ed>bg){
               if(dp[i-1][j]<dp[i-1][deq[ed-1]])break;
               ed--;
            }
            deq[ed]=j;
            ed++;
            if(j>=M){
               if(deq[bg]==j-M)bg++;
            }
        }
        /*REP(j,N){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
        */
    }
    LL ans=0;
    REP(i,N){
        ans=max(ans,dp[K-1][i]);
    }
    cout<<ans<<endl;
    return 0;
}

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

using namespace std;

#define ll long long

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

    if(a >= 3200){
        cout << s << endl;
    }else{
    cout << "red" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int A,B,K;
  cin >> A >> B >> K;
  for( int i=0;i<K;i++ )
    {
      if( i%2==0)
	{
	  if(A%2 == 1)
	    A--;
	  B += A/2;
	  A /= 2;
	}
      else
	{
	  if(B%2 == 1)
	    B--;
	  A += B/2;
	  B /= 2;
	}
    }
  cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

#define dTolerance 1.0e-10

    //(x,y)が(x0,y0),(x1,y1)を通る直線のどちら側にあるか  1:左 -1:右 0:直線上
int LF_COUNTER_CLOCKWIZE(const double &x, const double &y, const double &x0, const double &y0, const double &x1, const double &y1){
    if((x1 - x0) * (y - y0) - (x - x0) * (y1 - y0) > dTolerance){
        return 1;
    } else if((x1 - x0) * (y - y0) - (x - x0) * (y1 - y0) < -dTolerance){
        return -1;
    } else {
        return 0;
    }
}

int main(){
    int q;
    scanf("%d", &q);
    for (int i = 0; i < q; i++){
        double x0,x1,x2,x3,y0,y1,y2,y3;
        scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
        if(LF_COUNTER_CLOCKWIZE(x0, y0, x2, y2, x3, y3) == 0 && LF_COUNTER_CLOCKWIZE(x1, y1, x2, y2, x3, y3) == 0 ){    //2線分が延長して一致する場合だけ面倒
            if(fabs(x0 - x1) < dTolerance){    //y軸平行  y座標比較
                if(max(y0, y1) < min(y2, y3) || max(y2, y3) < min(y0, y1)){    //交わらない
                    printf("0\n");
                } else {    //交わる
                    printf("1\n");
                }
            } else {    //x座標比較
                if(max(x0, x1) < min(x2, x3) || max(x2, x3) < min(x0, x1)){    //交わらない
                    printf("0\n");
                } else {    //交わる
                    printf("1\n");
                }
            }
        } else {
            bool bIntersect = true;
            if(LF_COUNTER_CLOCKWIZE(x0, y0, x2, y2, x3, y3) * LF_COUNTER_CLOCKWIZE(x1, y1, x2, y2, x3, y3) == 1 ) {    //同じ側にあったら交わらない
                bIntersect = false;
            }
            if(LF_COUNTER_CLOCKWIZE(x2, y2, x0, y0, x1, y1) * LF_COUNTER_CLOCKWIZE(x3, y3, x0, y0, x1, y1) == 1 ) {    //同じ側にあったら交わらない
                bIntersect = false;
            }
            if(bIntersect == true){
                printf("1\n");                
            } else {
                printf("0\n");
            }
        }
    }
    return 0;
}



Measured memory_bytes: 2760
class Dice:
  __x = 1
  __y = 0
  def __init__(self,dice):
    self.dice = dice
    
  def output(self):
    print(self.dice[0])
    
  def move(self,str):
    if str == 'N':
      temp = self.dice[0]
      self.dice[0] = self.dice[1]
      self.dice[1] = self.dice[5]
      self.dice[5] = self.dice[4]
      self.dice[4] = temp
    elif str == 'S':
      temp = self.dice[0]
      self.dice[0] = self.dice[4]
      self.dice[4] = self.dice[5]
      self.dice[5] = self.dice[1]
      self.dice[1] = temp

    elif str == 'E':
      temp = self.dice[0]
      self.dice[0] = self.dice[3]
      self.dice[3] = self.dice[5]
      self.dice[5] = self.dice[2]
      self.dice[2] = temp
      
    elif str == 'W':
      temp = self.dice[0]
      self.dice[0] = self.dice[2]
      self.dice[2] = self.dice[5]
      self.dice[5] = self.dice[3]
      self.dice[3] = temp      
      
di = list(map(int,input().split()))
m = list(input())
di = Dice(di)
for i in m:
  di.move(i)
di.output()



Measured memory_bytes: 5612
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;

ll x,y,z,k;
vector<ll>a,b,c;

vector<ll>ra,rb,rc;

//値に対する二分探索

bool isOK(ll t){
    //ここに条件を満たすか判定する操作を書く
    ll s = 0;
    for(int i=1;i<=x;i++){
        for(int j=1;j<=y;j++){
            ll now = a[i-1]+b[j-1];
            ll rem = t-now;
            ll l = lower_bound(c.begin(),c.end(),rem)-c.begin();
            s += (z-l);
        }
    }
    if(s>=k)return false;
    //ここまで
    return true;
}

ll binary_search(){
    ll ng = 0;
    ll ok = 1e18;

    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        if(isOK(mid))ok=mid;
        else ng=mid;
    }
    return ng;
}

int main(){
    cin >> x >> y >> z >> k;
    a.resize(x);
    b.resize(y);
    c.resize(z);
    rep(i,x)cin>>a[i];
    rep(i,y)cin>>b[i];
    rep(i,z)cin>>c[i];
    sort(a.rbegin(),a.rend());
    sort(b.rbegin(),b.rend());
    sort(c.begin(),c.end());
    ra.resize(x+1,0);
    rb.resize(y+1,0);
    rc.resize(z+1,0);
    rep(i,x)ra[i+1]=ra[i]+a[i];
    rep(i,y)rb[i+1]=rb[i]+b[i];
    rep(i,z)rc[i+1]=rc[i]+c[i];
    ll shikiri =  binary_search();
    reverse(c.begin(),c.end());
    vector<ll>ans;
    for(int i=0;i<x;i++){
        for(int j=0;j<y;j++){
            if(ans.size()>k)continue;
            for(int p = 0;p<z;p++){
                if(a[i]+b[j]+c[p]>shikiri){
                    ans.push_back(a[i]+b[j]+c[p]);
                }
                else{
                    break;
                }
            }
        }
    }
    sort(ans.rbegin(),ans.rend());
    while(ans.size()<k)ans.push_back(shikiri);
    rep(i,ans.size()){
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 3736
#include <stdio.h>

int main(int argc, const char * argv[])
{
    
    int month, day, i;
    int monthdata[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    
    while (1) {
        scanf("%d %d", &month, &day);
        if (month == 0) {
            break;
        } else {
            
            for (i = 1; i < month; i++) {
                day += monthdata[i - 1];
            }
            
            switch (day % 7) {
                case 1:
                    printf("Thursday\n");
                    break;
                case 2:
                    printf("Friday\n");
                    break;
                case 3:
                    printf("Saturday\n");
                    break;
                case 4:
                    printf("Sunday\n");
                    break;
                case 5:
                    printf("Monday\n");
                    break;
                case 6:
                    printf("Tuesday\n");
                    break;
                default:
                    printf("Wednesday\n");
                    break;
            }
            
        }
    }
    
    return 0;
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}


int N;
int P[222];

vint ans;

void run(int k){

    ans.pb(k);
    for(int i=k;i<N;i++)swap(P[i-k],P[i]);


}

signed main(){
    cin>>N;
    rep(i,N)cin>>P[i];
    rep(t,N){
        rep(i,N){
            if(P[0]!=0&&P[0]<P[N-1])run(N-1);
            run(1);
        }
    }

    while(P[0]!=0)run(1);


    cout<<ans.size()<<endl;
    rep(i,ans.size())cout<<ans[i]<<endl;
}


Measured memory_bytes: 1016
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define pb push_back
#pragma GCC optimize("Ofast")
struct edge{ int to, ab; };
int N, cnt, t1 = -1, t2, f, p;
vector<edge> g[100000];
int X[100000];

void dfs(int u){
	while(!g[u].empty()){
		edge e = g[u].back();
		int v = e.to;
		if(e.ab){ X[u]--; X[v]++; }
		else{
			if(u == t2) p++;
			if(v == t2) p--;
		}
		g[u].pop_back();
		rep(i, g[v].size()){
			if(g[v][i].to == u && g[v][i].ab == e.ab){
				g[v].erase(g[v].begin() + i);
				break;
			}
		}
		dfs(v);
	}
}

int main(){
	cin >> N;
	rep(i, 2*N){
		int v; cin >> v;
		v--;
		if(v != -2){
			g[i%N].pb({v, (i/N)});
			g[v].pb({i%N, (i/N)});
		}else{
			if(t1 == -1) t1 = i%N;
			else t2 = i%N;
		}
	}
	if(t1 == t2){
		rep(i, N){
			if(g[i].size() % 2 == 1) f = 1;
		}
	}else{
		rep(i, N){
			if(i==t1 || i==t2){
				if(g[i].size() % 2 == 0) f = 1;
			}else if(g[i].size() % 2 == 1) f = 1;
		}
	}
	if(f) cout << "IMPOSSIBLE" << "\n";
	else{
		dfs(t1);
		cout << "POSSIBLE" << "\n";
		if(t1 == t2) X[t1]++;
		else X[t2] = p;
		rep(i, N) cout << X[i] << " ";
		cout << "\n";
	}
	return 0;
}


Measured memory_bytes: 27872
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
using ll = long long;

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

    int current_number = 1;

    for (int i = 0; i < N; ++i) {
        if (current_number * 2 < current_number + K) {
            current_number *= 2;
        } else {
            current_number += K;
        }
    }

    cout << current_number << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,m,n;
  char a[7];
  while(fgets(a,sizeof(a),stdin)){
    if(a[0]<'1') break;
    sscanf(a,"%d",&n);
    m=1;
    for(i=0;i<n;i++){
      m=m+i+1;
    }
    printf("%d\n",m);
  }
  return 0;
}

Measured memory_bytes: 604
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use itertools_num::ItertoolsNum;
#[allow(unused_imports)]
use proconio::{fastout, input, marker::Bytes, marker::Chars, marker::Isize1, marker::Usize1};
#[allow(unused_imports)]
use std::cmp;
use std::collections::BTreeSet;
#[allow(unused_imports)]
use std::iter;
#[allow(unused_imports)]
use superslice::*;

#[fastout]
fn run() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let xy = sc.read_pairs::<i64>(n);

    let ans = [(1, 1), (1, -1), (-1, 1), (-1, -1)]
        .iter()
        .map(|(cx, cy)| {
            let z = xy.iter().map(|&(x, y)| cx * x + cy * y).collect_vec();
            z.iter().max().unwrap() - z.iter().min().unwrap()
        })
        .max()
        .unwrap();
    println!("{}", ans);
}

fn main() {
    std::thread::Builder::new()
        .name("run".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(run)
        .unwrap()
        .join()
        .unwrap();
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_pairs<T: std::str::FromStr>(&mut self, n: usize) -> Vec<(T, T)> {
        (0..n).map(|_| (self.read(), self.read())).collect()
    }
    pub fn read_pairs_1_indexed(&mut self, n: usize) -> Vec<(usize, usize)> {
        (0..n)
            .map(|_| (self.read::<usize>() - 1, self.read::<usize>() - 1))
            .collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}


Measured memory_bytes: 5608
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int n,s=0;
	cin>>n;
	if(n==1){
		cout<<0;
		return 0;
	}
	int num[n];
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		while(x%2==0){
			x/=2;
			s++;
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 384
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val seq = Seq.fill(n, 2)(sc.next)
  val x = sc.next
  
  val index = seq.indexWhere(_(0) == x)
  
  println(seq.drop(index + 1).map(_(1).toInt).sum)
}


Measured memory_bytes: 27320
#include<iostream>
#include<string>
using namespace std;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(k<s.size()){
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"...";
	}
	else{
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 3592
s=int(input())
def f(k):
  if k%2==0:
    return k//2
  else:
    return 3*k+1
n=1
li=[]
if s==1 or s==2 or s==4:
  li.append(s)
while True:
  s=f(s)
  n+=1
  if s==1 and s not in li:
    li.append(s)
  elif s==2 and s not in li:
    li.append(s)
  elif s==4 and s not in li:
    li.append(s)
  elif s==1 and s in li:
    print(n)
    exit()
  elif s==2 and s in li:
    print(n)
    exit()
  elif s==4 and s in li:
    print(n)
    exit()

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
//typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;

//ll bit[200010];
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

/*ll sum(ll i)
{
	i += 1;
	ll t = 0;
	while (i > 0)
	{
		t = max(t, bit[i]);
		i -= i & -i;
	}
	return t;
}

void update(ll i, ll x)
{
	i += 1;
	while (i <= 200005)
	{
		bit[i] = max(x, bit[i]);
		i += i & -i;
	}
}*/

/*`ll SAIKI(ll S) {
	for (ll T = S; ; T = (T - 1) & S) {

	}
}*/

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y) {
	if (y == 0) return 1;
	if (y % 2 == 1) {
		return x * pow_mod(x, y - 1) % mod;
	}
	else {
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

/*ll com(ll x, ll y) {
	return kai[x] * div_mod(kai[y] * kai[x - y] % mod) % mod;
	//毎回オーダーlog(n)かかる
}

void kaijo() {
	kai[0] = 1;
	for (ll i = 1; i <= 3004; i++) {
		kai[i] = kai[i - 1] * i % mod;
	}
}*/

ll a, b;

void solve() {
	cin >> a >> b;
	if (a > b) swap(a, b);
	rep(i, b) cout << a;
	cout << endl;
}

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

Measured memory_bytes: 256
fun main() {

    val N = readLine()!!.toLong()

    val arrow = readLine()!!.split(' ').map { it.toLong() }.toMutableList()

    var total: Long = 0

    for(i in 1 until arrow.size) {
        if(arrow[i - 1] > arrow[i]) {
            total += arrow[i - 1] - arrow[i]
            arrow[i] += arrow[i - 1] - arrow[i]
        }

    }
    print(total)
}

Measured memory_bytes: 72112
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector> 
#include <cstring>
#include <queue>
#include <ctime>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll INF = 1ll<<50;
const int maxN = 110;
const int maxK = 16;
const int MOD = 1000000007;

vector<int> rd[maxN];     //原来的图 
int vis[maxN][maxN];              //每个节点的数 
ll a[maxN];

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

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	if(n==1)
	{
		printf("%lld\n",a[1]);
		return 0;
	}
	ll tmp = a[1]/gcd(a[1],a[2]) * a[2];   //最大公倍数 
	for(int i=3;i<=n;i++)
	{
		tmp = tmp/gcd(tmp,a[i]) * a[i]; 
	}
	printf("%lld\n",tmp);
	return 0;
} 

Measured memory_bytes: 256
#include <stdio.h>
     
    int main(void)
    {
      char s[4+1];
      int i;
      
      scanf("%s", s);
      
      for (i = 1; i< 4;i++)
      {
        if (s[i] == s[i-1])
        {
          printf("Bad");
          break;
        }
      }
      if (i == 4) printf("Good");
      return 0;
    }

Measured memory_bytes: 128
n, k, *a = map(int, open(0).read().split())
town = [0]*n
tmp_posi = 0

for i in range(n):
    tmp_posi = a[tmp_posi] - 1
    if i+1 == k:
        print(tmp_posi+1)
        exit()
    if town[tmp_posi]:
        first = town[tmp_posi]
        mod = i+1 - first
        k_ = k - first
        break
    else:
        town[tmp_posi] = i+1

cicle = [ [i,t] for i, t in enumerate(town) if t >= first]
cicle = sorted(cicle, key = lambda x:x[1])

print(cicle[k_ % mod][0]+1)

Measured memory_bytes: 41108
// Created by Kshitij Anand NSIT
#include <bits/stdc++.h>
//#include <ext/numeric>
//using namespace __gnu_cxx;


using namespace std;


#define int long long
#define pb push_back
#define P pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vc vector<char>
#define vb vector<bool>
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define mp(a, b) make_pair(a, b)
#define min3(a, b, c) min(min(a, b), c)
#define min4(a, b, c, d) min(min(a, b), min(c, d))
#define max3(a, b, c) max(max(a, b), c)
#define max4(a, b, c, d) max(max(a, b), max(c, d))
#define fill(arr,val) memset(arr,val,sizeof(arr))
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define db(x)  cout<<#x<<" : "<<x<<endl


const int N = 1000000007;

void solve(){

    int n,a,b,c, ans=0, count=0, sum=0;
    cin>>n>>a;
    P arr[n];
    for(int i=0;i<n;i++){
        // cin>>arr[i];
        cin>>b>>c;

        if(sqrt(b*b + c*c) <= a)
            count++;
    }  

    cout<<count<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    
  //  int t; cin>>t; while(t--)
    {     
      solve();
    }

  return 0;
}


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

#define all(x) (x).begin(),(x).end()

using namespace std;

int main(){
	int n,l;
	int ans=0;
	
	cin >> n >> l;
	
	for(int i=0; i<n; i++){
		ans+=l+i;
	}
	
	if(l>=0)	cout << ans-l << endl;
	else{
		if(n+l-1>=0)	cout << ans << endl;
		else	cout << ans-n-l+1 << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
  int n,x;
  vector<int> m;
  cin >> n >> x;

  int min = 9999;
  int sum=0;
  for(int i=0; i<n; i++){
    int temp;
    cin >> temp;
    m.push_back(temp);
    sum += temp;
    if(min > temp){
      min = temp;
    }
  }

  x -= sum;
  cout << x / min + n;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    int t = 2 * n;
    double r = Pi * t;
    // printf("%lf\n", r);
    cout << fixed << setprecision(20) << r << endl;

    return 0;
}


Measured memory_bytes: 3788
#include <stdio.h>
#include <stdlib.h>
#define MAX (int)1e5+1

int a[MAX];

int cmp(const void *p, const void *q){
  return *(int*)q - *(int*)p;
}

int main(){
  int n,m,i,j,r;
  long long sum;
  
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  
  qsort(a,n,sizeof(int),cmp);
  
  for(r=2;r<=a[0];r*=2){
  }
  r/=2;
  
  while(1){
    for(i=0;i<n;i++)
      if(a[i]<r)break;
  	if(m-i<0)break;
    m -= i;
    for(j=0;j<i;j++)
      a[j] = a[j]>>1;
    r/=2;
  }
  
  qsort(a,n,sizeof(int),cmp);
  sum=0;
  for(i=0;i<m;i++)
    sum += a[i]>>1;
  for(;i<n;i++)
    sum += a[i];
  
  printf("%lld\n",sum);
  
  return 0;
}

Measured memory_bytes: 892
# == C ==
N, M = map(int, input().split()) # N個の展望台、M本の道
NoGoodTenbodai = set()
H = list(map(int, input().split())) # H[i]=展望台_iの標高
for i in range(M):
	A, B = map(int, input().split()) # 道_iが結ぶ展望台の組
	if H[A-1] > H[B-1]:
		NoGoodTenbodai.add(B)
	elif H[A-1] < H[B-1]:
		NoGoodTenbodai.add(A)
	else:
		NoGoodTenbodai.add(A)
		NoGoodTenbodai.add(B)
print(N-len(NoGoodTenbodai))

Measured memory_bytes: 20148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
struct drink{
    ll val,num;
}a[100005];
bool cmp(struct drink  a,struct drink  b)
{
    return a.val<b.val;
}
int main()
{
	ll m,ans=0;
	int n;
	cin>>n>>m;
	for(int i=0;i<n;i++)
        scanf("%d%d",&a[i].val,&a[i].num);
    sort(a,a+n,cmp);
    for(int i=0;i<n&&m>0;i++)
    {
        ans+=a[i].val*min(a[i].num,m);
        m-=min(a[i].num,m);
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>

int main(void){
  char s[1000][1000];
  char ans[1000000]={};
  int n,k;

  scanf("%d %d",&n,&k);

  for(int i=0;i<n;i++)
    scanf("%s",s[i]);

  for(int i=n-1;i>0;i--){
    for(int j=0;j<i;j++){
      if(strcmp(s[j],s[j+1])>0){
        char t[1000];
        strcpy(t,s[j]);
        strcpy(s[j],s[j+1]);
        strcpy(s[j+1],t);
      }
    }
  }

  for(int i=0;i<n;i++)
    printf("%s",s[i]);
  printf("\n");

  return 0;
}


Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <iostream>
#include <string>
#include <list>
// #include <vector>

class TDllist
{
    std::list<int> FList;
    // std::vector<int> FList;
public:
    void Insert(int X)
    {
        FList.push_front(X);
        // FList.insert(FList.begin(), X);
    }
    void Delete(int X)
    {
        auto It = std::find(FList.begin(), FList.end(), X);
        if(It != FList.end()){
            FList.erase(It);
        }
        // for(auto It = FList.begin();
        //     It != FList.end();
        //     ++It)
        // {
        //     if(*It == X){
        //         FList.erase(It);
        //         return;
        //     }
        // }
    }
    void DeleteFirst()
    {
        FList.pop_front();
        // FList.erase(FList.begin());
    }
    void DeleteLast()
    {
        FList.pop_back();
    }
    void Show()const
    {
        auto It = FList.begin();
        std::cout << *It;
        for(++It; It != FList.end(); ++It)
        {
            std::cout << " " << *It;
        }
        std::cout << std::endl;
    }
};

int main()
{
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    TDllist List;
    int n, X;
    std::cin >> n;
    std::string Command;
    for(int i = 0; i < n; ++i){
        // std::string Command;
        std::cin >> Command;
        if(Command == "insert"){
            // int X;
            std::cin >> X;
            List.Insert(X);
        }else
        if(Command == "delete"){
            // int X;
            std::cin >> X;
            List.Delete(X);
        }else
        if(Command == "deleteFirst")
        {
            List.DeleteFirst();
        }else
        if(Command == "deleteLast")
        {
            List.DeleteLast();
        }else{
            assert(false);
        }
    }
    List.Show();
    return 0;
}

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

int main(){
    int H,W;
    cin >> H >> W;
    vector<vector<char>> maze(H,vector<char>(W));
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> maze.at(i).at(j);
        }
    }
    typedef pair<int,int> P;
    int INF = 100000000;
    

    vector<int> dx(4);
  	dx = {1,0,-1,0};
    vector<int> dy(4);
  	dy = {0,1,0,-1};
    
    int maxmax=0;
    for(int sx=0; sx<H; sx++){
        for(int sy=0; sy<W; sy++){
          	if(maze.at(sx).at(sy)!='#'){
          	vector<vector<int>> d(H,vector<int>(W));
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    d.at(i).at(j)=INF;
                }
            }
            queue<P> que;
            que.push(P(sx,sy));
            d.at(sx).at(sy)=0;

            while(que.size()){
                P p=que.front();
                que.pop();

                for(int i=0; i<4; i++){
                    int nx=p.first+dx.at(i);
                    int ny=p.second+dy.at(i);
                    if(0<=nx && nx<H && 0<=ny && ny<W && maze.at(nx).at(ny)!='#' && d.at(nx).at(ny)==INF){
                        que.push(P(nx,ny));
                        d.at(nx).at(ny)=d.at(p.first).at(p.second)+1;
                    }
                }
            }
            int max=0;
            for(int i=0; i<H; i++){
                for(int j=0; j<W; j++){
                    if(max<d.at(i).at(j) && d.at(i).at(j)!= INF) max = d.at(i).at(j);
                }
            }
          	
            if(maxmax<max) maxmax=max;
            }
        }
    }
    cout << maxmax << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,i;
    cin>>a;
    i=a;
    while(i>=1)
    {
        if(i%10==9)
        {
            cout<<"Yes";
            return 0;
        }
        i/=10;
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main(){
  long n, a = 0; long  d; cin >> n >> d; d *= d;
  rep(i, n){
    long b, c; cin >> b >> c;
    if(b*b + c*c <= d) ++a;
  }
  cout << a << endl;
  return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main() {
    
    
    
   int n;
   cin>>n;
   
   vector<int> v(n);
   
   for(int i=0;i<n;++i)
       cin>>v[i];
       
    reverse(v.begin(),v.end());
     
     int ct,ct1=1;;
      for(int i=0;i<n-1;++i){
          ct=0;
          for(int j=i+1;j<n;++j){
              if(v[i]>=v[j])
                ct++;
          }
          if(ct==n-1-i)
             ct1++;
      }
       
      
      cout<<ct1;
    
    //for(auto it=v.begin();it!=v.end();++it)
      // cout<<*it<<" ";
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char C;
  cin >> C;
  if (C == 'a') {
    cout << "vowel" << endl;
  }
  else if(C == 'i'){
    cout << "vowel" << endl;
  }
  else if(C == 'u'){
    cout << "vowel" << endl;
  }
  else if(C == 'e'){
    cout << "vowel" << endl;
  }
  else if(C == 'o'){
    cout << "vowel" << endl;
  }
  else{
   cout << "consonant" <<endl; 
  }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	pic := make([][]bool, H+2)
	for i := 0; i < H+2; i++ {
		pic[i] = make([]bool, W+2)
		if i == 0 || i == H+1 {
			continue
		} else {
			var tmp string
			fmt.Scan(&tmp)
			for j, r := range tmp {
				switch r {
				case '#':
					pic[i][j+1] = true
				case '.':
					pic[i][j+1] = false
				}
			}
		}
	}
	isOK := true
L:
	for i := 1; i < H+1; i++ {
		for j := 1; j < W+1; j++ {
			if pic[i][j] {
				if pic[i-1][j] || pic[i+1][j] || pic[i][j-1] || pic[i][j+1] {
					continue
				} else {
					isOK = false
					break L
				}
			}
		}
	}
	if isOK {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

int main(){
  string s;
  string t;
  
   
 cin>>s;
 cin>>t;
   	
  
  long long count=0;
  long long n=0;
  while(n<=s.size()){
    if(t[n]!=s[n]){
      count++;
    }
    n++;
  }
  
  	cout<<count<<endl;
  	return 0;
}
  

Measured memory_bytes: 3932
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	int x3,y3,x4,y4;
	if(x1>=x2&&y1<=y2)
	{
		x4=x1-abs(y1-y2);
		y4=y1-abs(x1-x2);
		x3=x2-abs(y1-y2);
		y3=y2-abs(x1-x2);
	}
	if(x1<x2&&y1<=y2)
	{
		x3=x2-abs(y1-y2);
		y3=y2+abs(x1-x2);
		x4=x1-abs(y1-y2);
		y4=y1+abs(x1-x2);
	}
	if(x1<x2&&y1>y2)
	{
		x3=x2+abs(y1-y2);
		y3=y2+abs(x1-x2);
		x4=x1+abs(y1-y2);
		y4=y1+abs(x1-x2);
	}
	if(x1>=x2&&y1>y2)
	{
		x3=x2+abs(y1-y2);
		y3=y2-abs(x1-x2);
		x4=x1+abs(y1-y2);
		y4=y1-abs(x1-x2);
	}
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
	return 0;
}

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

using namespace std;

int main() {
    string s,t,answer;
    cin >> s >> t;
    int sLen = s.size();
    int tLen = t.size();
    int dp[sLen+1][tLen+1];
    for (int i=0; i<=sLen; i++)
        for (int j=0; j<=tLen; j++)
            dp[i][j] = 0;

    for (int i=1; i<=sLen; i++) {
        for (int j=1; j<=tLen; j++) {
            if (s[i-1]==t[j-1])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j], dp[i][j-1]);
            }
        }

    int i=sLen;
    int j=tLen;
    while (i>0 && j>0) {
        if (dp[i][j]==dp[i-1][j])
            i--;
        else if (dp[i][j]==dp[i][j-1])
            j--;
        else {
            answer=s[i-1]+answer;
            i--;
            j--;
        }
    }
    cout << answer;
}


Measured memory_bytes: 35456
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);

		String s =sc.next();
		long k=sc.nextLong();
		char ss[] = s.toCharArray();

		char answer= '1';

		for (int i=0;i<k && i<ss.length && answer == '1';++i){
			answer= ss[i];
		}

		System.out.println(answer);
	}

}

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

int main() {
	long long N,k;cin>>N>>k;
	long long ar [N];
	for(int i=0;i<N;i++)
	cin>>ar[i];
	long long dp[N]={0};
	dp[0]=0;
	for(int i=1;i<N;i++)
	{  dp[i]=dp[i-1]+abs(ar[i]-ar[i-1]);
		for(int j=2;i-j>=0  && j<=k;j++)
		dp[i]=min(dp[i-j]+abs(ar[i]-ar[i-j]),dp[i]);
	
	}
	cout<<dp[N-1]<<endl;
	
	return 0;
}

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

using namespace std;

int main() {
  string s; cin >> s;
  double k; cin >> k;
  double n = s.length();

  for (double i = 0; i < n; ++i) {
    if (s[i] != '1') {
      cout << s[i] << endl;
      break;
    }
    if (i + 1 == k) {
      cout << '1' << endl;
      break;
    }
  }

  return 0;
}


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

typedef long long int ll;
ll INF = 9999999999999999;
ll MOD = 1000000007;

int main(){
   ll N,M;
   cin >> N >> M;
   ll A[100010];
   vector<bool> frags(N,true);
   for(ll i = 0;i < M;i++){
       cin >> A[i];
       frags[A[i] - 1] = false;
   }
   vector<ll> dp(N,0);

   if(frags[0]){
       dp[0] = 1;
   }
   if(frags[1]){
       dp[1] = dp[0] + 1;
   }else{

   }
   for(ll i = 2;i < N;i++){
       if(frags[i]){
           dp[i] = dp[i-1] % MOD + dp[i-2] % MOD;
       }
   }
   cout << dp[N-1] % MOD << endl;
}


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

int main(){

int H,W;cin>>H>>W;
string s[H];rep(i,H)cin>>s[i];
int ans[H][W];
int h,w;
rep(i,H)rep(j,W)ans[i][j]=0;

for(int i = 0;i<H;i++){
    for(int j=0;j<W;j++){
        int count=0;
        if(s[i].at(j)=='#')cout << "#";
        else{
        for (int dh = -1; dh <= 1; ++dh) {
                for (int dw = -1; dw <= 1; ++dw) {
                    int nh = i + dh, nw = j + dw;

                    // 場外アウトしたり、0 だったりはスルー
                    if (nh < 0 || nh >= H || nw < 0 || nw >= W) continue;
                    if (s[nh].at(nw) == '.') continue;
                    if (s[nh].at(nw) == '#')count++;


                    
                }
            }
            cout << count;
        }
    }
    cout << endl;
    }

return 0;

}




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

// #define int long long
#define ll long long
#define pb push_back
#define vi vector<int>
#define vii vector<vector<int> >

template <class X> void print(X Target){ cout << Target << '\n'; }

signed main()
{
  ios::sync_with_stdio(false);
  int n, k;
  
  cin >> n >> k;
  // ????????????????????´????????????
  while (k--){
    int x, y;
    cin >> x >> y;
    // ?????´?????????????????????????±??????´??????????????????
    if (x * 2 > n) x = n + 1 - x;
    if (y * 2 > n) y = n + 1 - y;
    // ????§??????§????????????????????????????????????
    // ?°????????????????????????¨?????´??????
    print(min(x, y) % 3 == 0 ? 3 : min(x, y) % 3);
  }

  return (0);
}

Measured memory_bytes: 1200
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n,a;
    cin >> n;
    a=1;
    for(int i=2;i*i<=n;i++){
        for(int j=i*i;j<=n;j*=i){
            a=max(a,j);
        }
    }
   
    cout << a << endl;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,N) for(int i = 0;i < (int)(N);i++)
int main(){
  int n;
  string s;
  cin>>n>>s;
  int ans=0;
  rep(i,n-2){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
      ans++;
    }
  }
        cout<<ans<<endl;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder177
{
    class Program
    {
        static void Main(string[] args)
        {
            QA();
        }

        static void QA()
        {
            string[] splited = Console.ReadLine().Split(' ');

            int D = int.Parse(splited[0]);
            int T = int.Parse(splited[1]);
            int S = int.Parse(splited[2]);

            Console.WriteLine((((double)D / S) <= T) ? "Yes" : "No");
        }
    }
}


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

using namespace std;

const int mod = 1000000007;

void add(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}

char a[77];
char b[77];
int f[77][3][3];

int main() {
  int n;
  scanf("%d %s %s", &n, a, b);
  memset(f, 0, sizeof f);
  if (a[0] == b[0]) {
    for (int i = 0; i < 3; ++i) {
      f[0][i][i] = 1;
    }
  } else {
    for (int i = 0; i < 3; ++i) {
      for (int j = 0; j < 3; ++j) {
        if (j != i) {
          f[0][i][j] = 1;
        }
      }
    }
  }
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (a[i] == b[i]) {
          for (int z = 0; z < 3; ++z) {
            if (z != j && z != k) {
              add(f[i][z][z], f[i - 1][j][k]);
            }
          }
        } else {
          if (a[i] == a[i - 1] && b[i] == b[i - 1]) {
            add(f[i][j][k], f[i - 1][j][k]);
          } else {
            for (int nj = 0; nj < 3; ++nj) {
              if (nj != j) {
                for (int nk = 0; nk < 3; ++nk) {
                  if (nk != k && nk != nj) {
                    add(f[i][nj][nk], f[i - 1][j][k]);
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      add(ans, f[n - 1][i][j]);
    }
  }
  printf("%d\n", ans);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] s_in = line.split(" ");
		System.out.println(Integer.parseInt(s_in[0]) + Integer.parseInt(s_in[1])/2);
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <string.h>

#define MIN(a,b) ((b<a)?b:a)
#define MAX(a,b) ((b>a)?b:a)

int main(){
	int n;
	while(scanf("%d", &n)!=EOF){
	int c=0;
	int i,j,k;
	int t=n;
	for(i=MAX(t-27,0);i<=MIN(t,9);i++){
		t-=i;
		for(j=MAX(t-18,0);j<=MIN(t,9);j++){
			t-=j;
			for(k=MAX(t-9,0); k<=MIN(t,9) ;k++){
				c++;
			}
			t+=j;
		}
		t+=i;
	}
	printf("%d\n", c);
}
}

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

Measured memory_bytes: 6912
import java.util.Scanner;
class Main{
  public static void main(String[] args){
     Scanner scan = new Scanner(System.in);
 
     int a = scan.nextInt();
     int b = scan.nextInt();
     int c = scan.nextInt();
  
     if(a < b & b < c) System.out.println("Yes");
     else System.out.println("No");
    
    }
}
     

Measured memory_bytes: 17232
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,x,y;
	cin>>n>>k>>x>>y;
	if(n<=k){
		cout<<x*n<<endl;
	}
	else if(n>k){
		cout<<x*k+(n-k)*y<<endl;
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void){
  string s,t,u,v;
  cin>>s>>t;
  int s_len=s.length();
  u=t.substr(0,s_len);
  v=t.substr(s_len);
  int v_len=v.length();
  if(s==u && v_len==1){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
  return 0;
}

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

int main() {
	int x=0, y=0;
	int menseki, along;
	cin >> x;
	cin >> y;
	menseki = x*y;
	along = 2 * x + 2 * y;

	cout <<menseki<<" "<<along<<endl;
	return 0;
}

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

struct node{
	struct node *right;
	struct node *left;
	struct node *parent;
	int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeSearch(Node u, int k){
	if(u == NIL || u->key == k)
		return u;
	else if(u->key > k)
		return treeSearch(u->left, k);
	else if(u->key < k)
		return treeSearch(u->right, k);
}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
	Node y; // node to be deleted
	Node x; // child of y



}

void insert(int k){
	Node y = NIL;
	Node x = root;
	Node z;

	z = (Node)malloc(sizeof(struct node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while(x != NIL){
		y = x;
		if(z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}
	z->parent = y;
	if(y == NIL)
		root = z;
	else if(z->key < y->key)
		y->left = z;
	else
		y->right = z;


}

void inorder(Node u){
	if(u->left != NIL)
		inorder(u->left);
	printf(" %d",u->key);
	if(u->right != NIL)
		inorder(u->right);
}
void preorder(Node u){
	printf(" %d",u->key);
	if(u->left != NIL)
		preorder(u->left);
	if(u->right != NIL)
		preorder(u->right);
}


int main(){
	int n, i, x;
	char com[20];
	Node t;
	scanf("%d", &n);

	for ( i = 0; i < n; i++ ){
		scanf("%s", com);
		if ( com[0] == 'f' ){
			scanf("%d", &x);
			t = treeSearch(root, x);
			if ( t != NIL ) printf("yes\n");
			else printf("no\n");
		} else if ( com[0] == 'i' ){
			scanf("%d", &x);
			insert(x);
		} else if ( com[0] == 'p' ){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		} /*else if ( com[0] == 'd' ){
		  scanf("%d", &x);
		  treeDelete(treeSearch(root, x));
		  }*/
	}

	return 0;
}

Measured memory_bytes: 19364