akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll a,b;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>a>>b;
    cout<<max(a + b, max(a - b, a * b));
    return 0;
}

Measured memory_bytes: 256
package main

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

func calc(lW, lE, rW, rE int) int {
	return lW + rE
}

func main() {
	defer stdout.Flush()
	_ = readInt()
	s := readString()
	rW := 0
	rE := 0
	for _, r := range s {
		if r == 'W' {
			rW++
		} else if r == 'E' {
			rE++
		} else {
			panic("not W and E")
		}
	}
	lW := 0
	lE := 0
	min := 3*100000 + 100
	for _, r := range s {
		if r == 'W' {
			rW--
		} else if r == 'E' {
			rE--
		}
		x := calc(lW, lE, rW, rE)
		if x < min {
			min = x
		}
		if r == 'W' {
			lW++
		} else if r == 'E' {
			lE++
		}
	}
	println(min)
}

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer([]byte{}, 10000000)
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	i, err := strconv.Atoi(readString())
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}


Measured memory_bytes: 1792
a, b = raw_input().split()
x = int(a + b)
y = int(b + a)
ans = "No"
n = 1
while n * n <= x:
    if x == n * n:
        ans = "Yes"
    n += 1
n = 1
while n * n <= y:
    if x == n * n:
        ans = "Yes"
    n += 1
print ans

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

int main(){
    int n;
    cin>>n;
    
    int total=0;
    for(int i=1; i<=n; i++){
        if(i%2==1){
            total++;
        }
    }

    double ans = (double)total/n;

    cout<<fixed;
    cout<<setprecision(10)<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
struct SEG{
	ll seg[1<<19],la[1<<19];
	SEG(void){for(int i=0;i<1<<19;i++)seg[i]=0,la[i]=0;}
	void lazy(int l,int r,int k){
		seg[k]+=la[k];
		if(r-l>0){
			la[k*2+1]+=la[k];
			la[k*2+2]+=la[k];
		}
		la[k]=0;
	}
	void add(int a,int b,int l,int r,int k,ll x){
		lazy(l,r,k);
		if(r<a||b<l)return;
		if(a<=l&&r<=b){
			la[k]+=x;
			lazy(l,r,k);
			return;
		}
		add(a,b,l,(l+r-1)/2,k*2+1,x);
		add(a,b,(l+r+1)/2,r,k*2+2,x);
		seg[k]=max(seg[k*2+1],seg[k*2+2]);
	}
	ll que(int a,int b,int l,int r,int k){
		lazy(l,r,k);
		if(r<a||b<l)return -INF;
		if(a<=l&&r<=b)return seg[k];
		return max(que(a,b,l,(l+r-1)/2,k*2+1),que(a,b,(l+r+1)/2,r,k*2+2));
	}
};
struct t{
	ll a,b,c;
	bool operator<(const t &q)const{
		return a<q.a;
	}
};
ll n,m,ans;
vector<t>q;
SEG seg;
int main(void){
    scanf("%lld%lld",&n,&m);
    for(int i=0;i<m;i++){
		ll l,r,x;
		scanf("%lld%lld%lld",&l,&r,&x);
		q.PB(t{l,l-1,x});
		q.PB(t{r+1,l-1,-x});
	}
	sort(q.begin(),q.end());
	int p=0;
	for(int i=1;i<=n;i++){
		while(p<q.size()&&q[p].a<=i){
			seg.add(0,q[p].b,0,(1<<18)-1,0,q[p].c);
			p++;
		}
		ans=max(ans,seg.que(0,i-1,0,(1<<18)-1,0));
		seg.add(i,i,0,(1<<18)-1,0,seg.que(0,i-1,0,(1<<18)-1,0));
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 22764
fun main(arr:Array<String>) {
    val n = readLine()!!.toLong()

    val tran = (1..5).map { readLine()!!.toLong() }

    val timeTable = mutableListOf(State(0, n/tran[0] - 1 + if (n % tran[0] == 0L) 0 else 1))
    for(i in (1 until tran.count())) {
        val startTime = timeTable.last().startTime + 1
        var endTime = timeTable.last().endTime + 1
        if(tran[i] < tran[i-1]) {
            val diff = n / tran[i] + if(n%tran[i] == 0L) 0 else 1
            endTime = Math.max(startTime + diff  - 1, endTime)
        }
        timeTable.add(State(startTime, endTime))
    }
    println(timeTable.last().endTime + 1)
}

class State(val startTime:Long, val endTime:Long)


Measured memory_bytes: 33656
S = input()
Q = int(input())
Query = [list(map(str, input().split())) for i in range(Q)]

rev_flag = 0

bef = ''
aft = ''

for i in range(Q):
    if Query[i][0] == '1':
        rev_flag = (rev_flag + 1) % 2
    if Query[i][0] == '2':
        if Query[i][1] == '1':
            if rev_flag == 0:
                bef = Query[i][2] + bef
            elif rev_flag == 1:
                aft = aft + Query[i][2]
        elif Query[i][1] == '2':
            if rev_flag == 1:
                bef = Query[i][2] + bef
            elif rev_flag == 0:
                aft = aft + Query[i][2]

S = bef + S + aft
if rev_flag == 1:
    S = S[::-1]

print(S)

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

using namespace std;

class LcaByDoubling {
    int N;
    int logN;
    vector<vector<int>> table;
    vector<int> depths;

    // dp[i][j] = 2**j th parent node from i th node
    vector<vector<int>> dp;

    void calc_depth(int node, int par, int depth) {
        depths[node] = depth;
        dp[node][0] = par;
        for (int next : table[node]) {
            if (next == par) continue;
            calc_depth(next, node, depth + 1);
        }
    }

    void calc_dp() {
        for (int k = 1; k < logN; k++) {
            for (int i = 0; i < N; i++) {
                if (dp[i][k-1] == -1) dp[i][k] = -1;
                else dp[i][k] = dp[dp[i][k-1]][k-1];
            }
        }
    }

public:
    LcaByDoubling(const vector<vector<int>> &table, int root) : table(table) {
        N = table.size();
        logN = (sizeof(int) * 8) - __builtin_clz(N);
        depths.resize(N);
        dp.resize(N);
        for (int i = 0; i < N; i++) dp[i].resize(logN, -1);
        calc_depth(root, -1, 0);
        calc_dp();
    }

    // O(logN)
    int lca(int u, int v) {
        // Assume depths[u] <= depths[v]
        if (depths[u] > depths[v]) swap(u, v);

        // Equalize depth
        int diff = depths[v] - depths[u];
        for (int k = 0; k < logN; k++) {
            if ((diff >> k) & 1) v = dp[v][k];
        }

        if (u == v) return u;

        // Popup both nodes just below the lca
        for (int k = logN - 1; k >= 0; k--) {
            if (dp[u][k] != dp[v][k]) {
                u = dp[u][k];
                v = dp[v][k];
            }
        }

        return dp[u][0];
    }
};

// Verified at http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C
int main() {
    int N;
    cin >> N;
    vector<bool> is_root(N, true);
    vector<vector<int>> table(N);

    for (int i = 0; i < N; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int c;
            cin >> c;
            is_root[c] = false;
            table[i].push_back(c);
            table[c].push_back(i);
        }
    }

    int root = -1;
    for (int i = 0; i < N; i++) if (is_root[i]) root = i;

    auto solver = new LcaByDoubling(table, root);

    int Q;
    cin >> Q;
    for (int q = 0; q < Q; q++) {
        int u, v;
        cin >> u >> v;
        cout << solver->lca(u, v) << endl;
    }

    return 0;
}


Measured memory_bytes: 27368
#![allow(non_snake_case)]
#![allow(unused_imports)]
use proconio::input;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::cmp::max;
use std::cmp::min;


fn main() {
    input! {
        A1: i64,
        A2: i64,
        A3: i64,
    }

    let ans = if A1 + A2 + A3 >= 22 { "bust" } else { "win" };
    println!("{}", ans);
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll a, b;
  cin >> a >> b;
  ll c = min(a, b);
  for (ll i = c; c > 0;i+=c){
    if(i%a==0&&i%b==0){
      print(i);
      break;
    }
    else{
      continue;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MOD 1000000007LL
#define STR_EQ(s1,s2)       strcmp(s1,s2)==0
#define rep(i,n) for(int i=0;i<(n);i++)
#define invrep(i,n) for(int i=(n-1);i>=0;i--)
//#define MOD 998244353LL
//#define MOD 1000000009LL
const long long INF = 1LL << 60;
typedef long long ll;
ll llabs(ll a){if(a<0)return -a;return a;}//abs
void swap(ll *a,ll *b){ll tmp=*a;*a=*b;*b=tmp;}//swap
int fact(int a){int r=1;for(int i = 1;i<=a;i++)r*=i;return r;}//factral
ll addm(ll a, ll b){ll x = (a%MOD+b%MOD)%MOD;if (x < 0) x+=MOD;return x;}//addmod,submod
ll mulm(ll a, ll b){return(a%MOD*b%MOD)%MOD;}//mulmod
ll lpow(ll x,ll n){ll ans = 1;while(n){if(n&1) ans*=x;x*=x;n>>=1;}return ans;} //power
ll powm(ll x,ll n){x%=MOD;ll ans = 1;while(n){if(n&1) ans=mulm(ans,x);x=mulm(x,x);n>>=1;}return ans;} //power mod
ll lgcd(ll a, ll b){if(a==b) return a;if(a<b) swap(&a,&b);if (b == 0) return a;return lgcd(b, a%b);}//gcd
ll llcm(ll a, ll b){return a*b/lgcd(a,b);};//lcm
ll legcd(ll a,ll b,ll *x,ll *y){if(b==0){*x=1;y=0;return a;}ll q = a/b;ll g = legcd(b,a-q*b,x,y);ll z = *x-q*(*y);*x=*y;*y=z;return g;}//extra_gdd
ll divm(ll a,ll b){ll x,y;a%=MOD;b%=MOD;legcd(b,MOD,&x,&y);x%=MOD;if(x<0) x+=MOD;return x;}//divmod_with_extra_gdd
ll permutation(ll n, ll m){if(n<m) return 0;if(n-m < m) m = n-m;int ans = 1;for(int i = 0;i<m;i++) ans*=(n-i);return ans;}//nPm
ll combination(ll n, ll m){return permutation(n,m)/m;}//nCm
int acmpinum(const void * left, const void * right){
	if (*(int *)left > *(int *)right) return 1;
	else if (*(int *)left < *(int *)right) return -1;
	else return 0;
}//qsort(int配列,配列の長さ,sizeof(int),acmpinum);
int dcmpinum(const void * left, const void * right){
	if (*(int *)left > *(int *)right) return -1;
	else if (*(int *)left < *(int *)right) return 1;
	else return 0;
}//qsort(int配列,配列の長さ,sizeof(int),dcmpinum);
int acmpllnum(const void * left, const void * right){
	if (*(ll *)left > *(ll *)right) return 1;
	else if (*(ll *)left < *(ll *)right) return -1;
	else return 0;
}//qsort(ll配列,配列の長さ,sizeof(ll),acmpllnum);
int dcmpllnum(const void * left, const void * right){
	if (*(ll *)left > *(ll *)right) return -1;
	else if (*(ll *)left < *(ll *)right) return 1;
	else return 0;
}//qsort(ll配列,配列の長さ,sizeof(ll),dcmpllnum);
int cmpchar(const void* left, const void* right) {
    char *left_char = (char *)left;
    char *right_char = (char *)right;
    return strcmp( left_char, right_char );
}//qsort(文字列配列,1,文字列の長さ,cmpchar);

int main(){
    int N;
    scanf("%d",&N);
    int L[2*N];
  	int ans=0;
  	rep(i,2*N) scanf("%d",&L[i]);
  	qsort(L,2*N,sizeof(int),acmpinum);
  	for(int i = 0;i<2*N;i+=2) ans+=L[i];
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define f(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define sz(a) ((int)a.size())
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}

ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijoMOD(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll div_num(ll n){
  vl div(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      div[i]++;
    }
  }
  if(n!=1)div[n]++;
  ll num=1;
  for(ll i=0;i<=n;i++){
    num*=div[i];
  }
  return num;
}
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(begin(ret), end(ret));
  return (ret);
}

int keta_wa(int x){
  int tot=0;
  while(x>0){
    tot +=x%10;
    x/=10;
  }
  return tot;
}
long long lopow(ll a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a ;
        a = a * a ;
        n >>= 1;
    }
    return res;
}

        
//vc alp ={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//vc Alp ={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
//cout<<""<<endl;
int main(){
  string S;cin>>S;
  map<ll,ll> mp;
  ll siz =S.size();

  reverse(all(S));
  ll now=S[0]-'0';
  ll ten=1;
  mp[now]++;
  for(int i=1;i<siz;i++){
    ten *=10;  
    ten%=2019;
    ll han= now+ten*(S[i]-'0');
    
    han %=2019;
    mp[han]++;
    
    now=han;
  
  }
  ll ans=0;
  for(auto x:mp){
    if(x.first==0)ans+=x.second;
    if(x.second!=1)ans += x.second*(x.second -1)/2;
   
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i,j,n) for(int i = (int)(j); i < (int)(n); i++)
#define mrep(i,n) for (int i = (int)(n); i > 0; i--)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20)
ll INF = 1LL << 60;
ll mod = 1e9 + 7;
ll modn = 998244353;

int main() {
	int n; cin >> n;
	vint l(n);
	rep(i,n) cin >> l[i];
	int ans=0;
	rep(i,n-2) {
		rrep(j,i+1,n-1) {
			rrep(k,j+1,n) {
				if(l[i]!=l[j]&&l[j]!=l[k]&&l[i]!=l[k]) {
					int ma=l[i]+l[j]+l[k];
					ma-=max(l[i],max(l[j],l[k]))*2;
					if(ma>0) ans++;
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
N,D = [int(i) for i in input().split()]
XY = []
count = 0

for i in range(N):
  XY.append([int(i) for i in input().split()])

for xy in XY:
  dd = xy[0]**2+xy[1]**2
  if dd <= D**2:
    count +=1

print(count)

Measured memory_bytes: 42376
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


int f[200000], mod = inf;
signed main(){
  int n, m;cin >> n >> m;
  rep(i,m){
    int tmp;cin >> tmp;
    f[tmp] = 1;
  }
  vector<int> dp(n+1);
  dp[0] = dp[1] = 1;
  if(f[1] == 1)dp[1] = 0;
  repi(i,2,n+1){
    if(f[i] == 1)continue;
    dp[i] = dp[i-1] + dp[i-2];
    dp[i] %= mod;
  }
  cout << dp[n] << endl;
  return 0;
}






Measured memory_bytes: 1792
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    string n;
    cin >> n;
    
    if(n[0] == n[2])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}



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

int main() {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    if(s[0] == 'a' && s[1] == 'b' && s[2] == 'c') {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
    
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n, a;
  cin >> n;
  unordered_set<int> us;
  rep(i, n) {
    cin >> a;
    if (us.find(a) == us.end())
      us.insert(a);
    else
      us.erase(a);
  }

  cout << us.size() << endl;
  return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int main(){
  LL N, Q;
  scanf("%lld%lld", &N, &Q);
  VL xs;
  xs.PB(1);
  LL p = 1;
  FOR(i,1,70){
	xs.PB(xs[i-1] + p);
	if(xs.back() > 1e10) break;
	p *= N;
  }

  REP(i,Q){
	LL a, b;
	scanf("%lld%lld", &a, &b);

	if(N == 1){
	  printf("%lld\n", min(a, b));
	  continue;
	}

	if(a == 1 || b == 1){
	  cout << 1 << endl;
	  continue;
	}

	int da = upper_bound(ALL(xs), a) - begin(xs) - 1;
	int db = upper_bound(ALL(xs), b) - begin(xs) - 1;
	while(a != b){
	  if(a == 1 || b == 1 || da == 0 || db == 0){
		a = b = 1;
		break;
	  }

	  if(a > b){
		a = (a - xs[da]) / N + xs[da-1];
		--da;
	  }
	  else{
		b = (b - xs[db]) / N + xs[db-1];
		--db;
	  }
	}
	
	printf("%lld\n", a);
  }

  return 0;
}


Measured memory_bytes: 1280
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp_ITP1_4_D_2
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputLine1 = Console.ReadLine();
            var inputLine2 = Console.ReadLine();
            string[] inputValue = inputLine2.Split(' ');
            var inputData = new List<long>() {};

            for(int i = 0; i < int.Parse(inputLine1); i++)
            {
                inputData.Add(int.Parse(inputValue[i]));
            }

            Console.WriteLine("{0} {1} {2}",inputData.Min(), inputData.Max(),inputData.Sum());
        }
    }
}



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

using namespace std;

int main(){
    int ans = 0;
    vector<int>v(3);

    for(int i = 0;i < 3;i++)
        cin >> v[i];
    
    sort(v.begin(),v.end(),greater<int>());

    for(int i = 0;i < 2;i++){
        ans *= 10;
        ans += v[i];
    }

    cout << ans + v[2] << endl;
    

    return 0;
}

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

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> a(n+1);
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }

    ll loop = 1;
    ll end_cnt = 1;
    vector<ll> mp(n+1, 0);
    vector<ll> rt;
    rt.push_back(1);
    do{
        end_cnt++;
        mp[loop] = 1;
        loop = a[loop];
        rt.push_back(loop);
    }while(mp[loop] == 0);

    ll start = 0;
    ll pre_cnt = 0;
    for(ll i = 0; i < rt.size(); i++){
        pre_cnt++;
        if(rt[i] == loop){
            start == i;
            break;
        }
    }

    ll ans = 0;
    if(k <= pre_cnt){
        ans = rt[k];
    } else {
        k -= pre_cnt;
        ans = rt[pre_cnt+(k%(end_cnt-pre_cnt))];
    }

    cout << ans << endl;

    return 0;
}

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

#define ff first
#define ss second
#define PI acos(-1)
#define pb push_back
#define int long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define all(x) x.begin(),x.end()
#define pii pair<long long,long long>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int M = (1e9)+7;
const int N = 3005;

int dp[N][N][4];
int grid[N][N];

signed main()
{
    FAST
    int tc=1;
    //cin>>tc;
    for(int ti=1;ti<=tc;ti++)
    {
        int n,m,kk,x,y,v;
        cin>>n>>m>>kk;
        for(int i=0;i<kk;i++)cin>>x>>y>>v,grid[x][y] = v;
        for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)
        {
            int top = 0;
            for(int k=0;k<4;k++)top = max(top,dp[i-1][j][k]);
            dp[i][j][0] = max(dp[i-1][j][0],top);
            dp[i][j][1] = max(grid[i][j] + dp[i][j-1][0],dp[i][j-1][1]);
            dp[i][j][1] = max(dp[i][j][1], grid[i][j] + top);
            dp[i][j][2] = max(grid[i][j] + dp[i][j-1][1],dp[i][j-1][2]);
            dp[i][j][3] = max(grid[i][j] + dp[i][j-1][2],dp[i][j-1][3]);
        }
        int ans = 0;
        for(int i=0;i<4;i++)ans = max(ans,dp[n][m][i]);
        cout<<ans<<endl;
    }
    return 0;
}


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

using namespace std;

int N, W, dp[101][10001];
pair<int, int> mono[101];//f:weight s:price

int main()
{
	cin >> N >> W;

	for (int a = 1; a <= N; a++)
	{
		cin >> mono[a].second >> mono[a].first;
	}

	for(int a = 0;a<W;a++)
	{
		dp[0][a] = 0;
	}
	for(int a = 0;a<N;a++)
	{
		dp[a][0] = 0;
	}

	for(int a = 1;a<=N;a++)
	{
		for(int b = 1;b<=W;b++)//dp[a][b]
		{
			if (b - mono[a].first >=0)
			{
				dp[a][b] = max(dp[a-1][b], dp[a - 1][b - mono[a].first] + mono[a].second);
			}
			else
			{
				dp[a][b] = dp[a - 1][b];
			}
		}
	}

	cout << dp[N][W] << endl;

	return 0;
}

Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
int INF = 1000000;
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> d(m);
  for (int i = 0; i < m; i++){
    cin >> d[i];
  }
  vector<int> dp(n + 1, INF);
  dp[0] = 0;
  for (int i = 1; i <= n; i++){
    for (int j = 0; j < m; j++){
      if (i - d[j] >= 0){
        dp[i] = min(dp[i], dp[i - d[j]] + 1);
      }
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()
#define chmax(x,y) x=max(x,y)




int main(){
    int n; cin>>n;
    vector<ll> p(87);
    p[0]=2;
    p[1]=1;
    rep(i,85){
        p[i+2]=p[i+1]+p[i];
    }
    cout<<p[n]<<endl;
}

Measured memory_bytes: 3592
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	h := nextInt()
	w := nextInt()
	l := make([]string, h)

	for i := 0; i < h; i++ {
		l[i] = nextStr()
	}

	for j := 0; j < w+2; j++ {
		fmt.Printf("#")
	}
	fmt.Printf("\n")
	for i := 0; i < h; i++ {

		fmt.Printf("#%s#\n", l[i])
	}
	for j := 0; j < w+2; j++ {
		fmt.Printf("#")
	}

}

// ---- readfunc
func scanInit() {
	const cap = 200 * 1024 // Default=64
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
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: 1800
def main(n: int, m: int, a: list) -> None:
    s = sum(a)

    if s > n:
        print(-1)
    else:
        print(n - s)


if __name__ == "__main__":
    n, m = map(int, input().split())
    a = list(map(int, input().split()))

    main(n, m, a)


Measured memory_bytes: 10040
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long[][]	map = null;
		long		max = Integer.MIN_VALUE;

		if ((map = parseMap()) != null) {
			for (int y = 1; y < map.length; y++) {
				for (int x = 1; x < map[y].length; x++) {
					for (int i = y; i < map.length; i++) {
						for (int j = x; j < map[y].length; j++) {
							max = Math.max(max, map[i][j] - map[y-1][j] - map[i][x-1] + map[y-1][x-1]);
						}
					}
				}
			}

			System.out.println(max);
		}
	}

	private static long[][] parseMap() {
		int			len = parseNum();
		long[][]	map = null;
		String		str = null;

		if (len > 0) {
			map = new long[len+1][len+1];

			for (int y = 1; y <= len; y++) {
				if ((str = parseStdin()) != null) {
					String[]	lines = str.split(" ");
					for (int x = 1; x <= lines.length; x++) {
						map[y][x] = map[y-1][x] + map[y][x-1] - map[y-1][x-1] + (long)Integer.parseInt(lines[x-1]);
					}
				}
			}
		}
 
		return map;
	}

	private static int parseNum() {
		int		param = 0;
		String	strin = null;

		if ((strin = parseStdin()) != null) {
			param = Integer.parseInt(strin);
		}
 
		return param;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (tmp != null) {
            	if (!tmp.isEmpty()) {
            		stdin = tmp;
            	}
        	}
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

Measured memory_bytes: 24064
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    //long long int ans;
    long long int l[87];
    l[0] = 2;
    l[1] = 1;
    for(int i=2;i<=n;i++){
        l[i] = l[i-1] + l[i-2];
    }
    
    cout << l[n] << endl;
}


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

using namespace std;

#define MAX_N 3001
#define UNDEF -1
#define MAX_INT 2147483647

typedef struct
{
	unsigned short int node1;
	unsigned short int node2;
	unsigned short int length;
	unsigned int distance;
} Road;

typedef struct
{
	unsigned int distance;
	bool decided;
} Node;

int N,M,K;
vector<Road> I;
vector<Node> J;
Road Rtemp;
Node Ntemp;

Road* MAKEROAD(const unsigned short int node1,const unsigned short int node2,const unsigned short int length,const unsigned int distance)
{
	Rtemp.node1 = node1;
	Rtemp.node2 = node2;
	Rtemp.length = length;
	Rtemp.distance = distance;
	return &Rtemp;
}

Node* MAKENODE(const unsigned int distance,const bool decided)
{
	Ntemp.distance = distance;
	Ntemp.decided = decided;
	return &Ntemp;
}

int main(void)
{
	cin >> N >> M >> K;
	int _a,_b,_i;
	for(int i = 0;i < M;i++)
	{
		cin >> _a >> _b >> _i;
		I.push_back(*MAKEROAD(_a,_b,_i,MAX_INT));
	}
	for(int i = 0;i < K;i++)
	{
		cin >> _a;
		I.push_back(*MAKEROAD(0,_a,0,MAX_INT));
	}
	for(int i = 0;i < N+1;i++)
	{
		J.push_back(*MAKENODE(MAX_INT,false));
	}
	J.begin()->distance = 0;
	int mindist = 0;
	auto mindist_itr = J.begin();
	int mindist_i = 0;
	bool chg = false;
	while(true)
	{
		mindist = MAX_INT;
		chg = false;
		for(auto itr = J.begin();itr < J.end();itr++)
		{
			if(!(itr->decided) && itr->distance < mindist)
			{
				mindist_itr = itr;
				mindist = itr->distance;
				chg = true;
			}
		}
		if(!chg)
			break;
		else
		{
			mindist_itr->decided = true;
			mindist_i = mindist_itr - J.begin();
			for(auto itr = I.begin();itr < I.end();itr++)
			{
				if(itr->node1 == mindist_i)
				{
					if(J[itr->node2].distance > J[mindist_i].distance + itr->length)
					{
						J[itr->node2].distance = J[mindist_i].distance + itr->length;
					}
				}
				if(itr->node2 == mindist_i)
				{
					if(J[itr->node1].distance > J[mindist_i].distance + itr->length)
					{
						J[itr->node1].distance = J[mindist_i].distance + itr->length;
					}
				}
			}
		}
	}
	for(auto itr = I.begin();itr < I.end();itr++)
	{
		_a = J[itr->node1].distance + J[itr->node2].distance + itr->length;
		if(_a % 2 == 1)
			_a++;
		itr->distance = _a / 2;
	}
	unsigned int result = 0;
	for(auto itr = I.begin();itr < I.end();itr++)
	{
		result = max(result,itr->distance);
	}
	for(auto itr = J.begin();itr < J.end();itr++)
	{
		result = max(result,itr->distance);
	}
	cout << result << endl;
	return 0;
}

Measured memory_bytes: 4496
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
int H, W;
string S[1010];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int d[1010][1010];
bool visited[1010][1010];
int sx, sy, gx, gy;
typedef pair<int, int> P;
typedef pair<int, P> PP;
int dijkstra() {
    rep(i, 1010) rep(j, 1010) d[i][j] = INF;
    priority_queue<PP, vector<PP>, greater<PP>> que, que2;
    d[sx][sy] = 0;
    que.push({0, {sx, sy}});
    que2.push({0, {sx, sy}});
    while(que.size()) {
        while(que.size()) {
            PP p = que.top(); que.pop();
            int x = p.second.first;
            int y = p.second.second;

            int cost0 = p.first;
            if(cost0 > d[x][y]) continue;
            bool search = false;
            
            rep(k, 4) {
                int xx = x + dx[k];
                int yy = y + dy[k];
                if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
                if(S[xx][yy] == '#') continue;
                if(d[xx][yy] == INF) {
                    d[xx][yy] = d[x][y];
                    search = true;
                    que.push({d[xx][yy], {xx, yy}});
                    que2.push({d[xx][yy], {xx, yy}});
                }
            }
            if(!search) que2.push({d[x][y], {x, y}});
        }
        while(que2.size()) {
            PP p = que2.top(); que2.pop();
            int x = p.second.first;
            int y = p.second.second;
            
            int cost0 = p.first;
            
            if(cost0 > d[x][y] || (cost0 == d[x][y] && visited[x][y])) continue;
            visited[x][y] = true;
            //cout << x << " " << y << " " << cost0 << " " << d[x][y] << " " << d[gx][gy] << endl;
            rep(k, 25) {
                int xx = x + 2 - k % 5;
                int yy = y + 2 - k / 5;
                if(xx < 0 || xx >= H || yy < 0 || yy >= W) continue;
                if(S[xx][yy] == '#') continue;
                if(d[xx][yy] == INF) {
                    d[xx][yy] = d[x][y] + 1;
                    que.push({d[xx][yy], {xx, yy}});
                }
            }
        }
    }
    return d[gx][gy];
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin >> H >> W;
    cin >> sx >> sy;
    cin >> gx >> gy;
    sx--; sy--; gx--; gy--;
    rep(i, H) cin >> S[i];
    int ans = dijkstra();
    if(ans == INF) {
        ans = -1;
    }
    // rep(i, H) {
    //     rep(j, W) {
    //         cout << d[i][j];
    //     }
    //     cout << endl;
    // }
    cout << ans << endl;

    return 0;
}
// ...##
// ..##..
// .##...

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

using namespace std;

int main()
{
    set <int> m;
    int q;
    cin>>q;
    while(q--)
    {
        int a;
        cin>>a;
        if(a==0)
        {
            int x;
            cin>>x;
            m.emplace(x);
            cout<<m.size()<<endl;
        }
        else
        {
            int x;
            cin>>x;
            cout<<m.count(x)<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 12448
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <fstream>

using namespace std;

int main(){
	int h,w;
	cin>>h>>w;
	char C[202][101];
	for(int i=1;i<=h;i++){
		string x;
		cin>>x;
		for(int j=1;j<=w;j++){
			C[i][j]=x[j-1];
		}
	}
	char ans[202][101];
	for(int i=1;i<=2*h;i++){
		for(int j=1;j<=w;j++){
			ans[i][j]=C[(i+1)/2][j];
		}
	}
	for(int i=1;i<=2*h;i++){
		for(int j=1;j<=w;j++){
			cout<<ans[i][j];
		}
		cout<<endl;
	}
	return 0;
}

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

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
  cerr << endl;
  rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
    if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
      cerr << "INF";
    } else
      cerr << v[i][j];
    cerr << (j == v[i].size() - 1 ? '\n' : ' ');
  }
  cerr << endl;
}
/*
   typedef __int128_t Int;
   std::ostream &operator<<(std::ostream &dest, __int128_t value) {
   std::ostream::sentry s(dest);
   if (s) {
   __uint128_t tmp = value < 0 ? -value : value;
   char buffer[128];
   char *d = std::end(buffer);
   do {
   --d;
 *d = "0123456789"[tmp % 10];
 tmp /= 10;
 } while (tmp != 0);
 if (value < 0) {
 --d;
 *d = '-';
 }
 int len = std::end(buffer) - d;
 if (dest.rdbuf()->sputn(d, len) != len) {
 dest.setstate(std::ios_base::badbit);
 }
 }
 return dest;
 }

 __int128 parse(string &s) {
 __int128 ret = 0;
 for (int i = 0; i < s.length(); i++)
 if ('0' <= s[i] && s[i] <= '9')
 ret = 10 * ret + s[i] - '0';
 return ret;
 }
 */

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main(signed argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);

  int ans=0;
  int a, b; cin >> a >> b;
  rep(i,a,b+1){
    string s=to_string(i);
    string t=s;
    reverse(all(t));
    ans+=s==t;
  }
  cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{

    int a,i,j,k,z,count=0;
    scanf("%d",&a);
    int ara[a],ara2[a];
    for(i=0;i<a;i++)
    {
        scanf("%d",&ara[i]);
        ara2[i]=ara[i];

    }
     for(k=1;k<a;k++){
     for(i=0; i<a-1; i++)
     {
         if(ara[i]>ara[i+1])
         {
             z=ara[i]+ara[i+1];
             ara[i+1]=z-ara[i+1];
             ara[i]=z-ara[i+1];

         }

     }
     }
     for(j=0; j<a; j++)
     {
         if(ara[j]!=ara2[j])
         {
             count++;
         }
     }
     if(count==2 ||count==0){
         printf("YES\n");
     }
     else{
         printf("NO\n");
     }



}





Measured memory_bytes: 1624
""" AtCoder """

N, Y = map(int, input().split())

for x in range(N + 1):
    for y in range(N - x + 1):
        z = N - x - y
        if x * 10000 + y * 5000 + z * 1000 == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)


Measured memory_bytes: 2940
# define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;

# define INF ((int)(1<<30))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12

template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,-1,1,0 }, dy[4] = { 1,0,0,-1 };

int n;
int a[20][20];
int memo[2 << 16];

int dp(const int bit)
{
	for (int i = 0; i < n; i++)
	{
		if (!(bit & (1 << i)))break;
		if (i == n - 1)return 0;
	}
	if (memo[bit] != -1)return memo[bit];
	int ans = INT_MAX;
	for (int i = 0; i < n; i++)
	{
		if (bit & (1 << i))continue;
		int mini = a[i][0];
		for (int j = 0; j < n; j++)
		{
			if (bit & (1 << j))
			{
				mini = min(mini, a[i][j + 1]);
			}
		}
		ans = min(ans, dp(bit | (1 << i))+mini);
	}
	return memo[bit] = ans;
}

int main()
{
	
	while (cin >> n&&n)
	{
		memset(memo, -1, sizeof memo);
		REP(i, n)
		{
			REP(j, n+1)
			{
				cin >> a[i][j];
			}
		}
		cout << dp(0) << endl;
	}
}

Measured memory_bytes: 3524
N, M = map(int, input().split())
A = sorted(map(int, input().split()), reverse=True)
# print(A)
v_min = sum(A) / (4 * M)
# print(v_min)
cnt = 0
for item in A:
    if item >= v_min:
        cnt += 1
    else:
        break
if cnt >= M:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int N;
  cin>>N;
  VL A(N);
  rep(i,N) cin>>A[i];
  VL B(N),C(N);
  rep(i,N) B[i]=N-i+A[i];
  rep(i,N) C[i]=N-i-A[i];
  map<ll,int> M;
  map<ll,int> M2;
  rep(i,N) M[B[i]]++;
  ll ans=0;
  rep(i,N){
    ans+=M2[B[i]];
    M2[C[i]]++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 42244
from collections import Counter


def main(N=None, A=None):
    if not N:
        N = int(input())
        A = list(map(int, input().split()))
    count = Counter(A)
    for i in range(1, N+1):
        print(count[i])


if __name__ == "__main__":
    # main(5, [1, 1, 2, 2])
    # main(10, [1, 1, 1, 1, 1, 1, 1, 1, 1])
    main()


Measured memory_bytes: 34180
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int k = scan.nextInt();
		int count = 0;
		while(n > 0) {
			n /= k;
			count++;
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int a;
  cin >> a;
  
  if (a == 25) cout << "Christmas" << endl;
  else if (a == 24) cout << "Christmas Eve" << endl;
  else if (a == 23) cout << "Christmas Eve Eve" << endl;
  else if (a == 22) cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;
int main() {
	int c[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	int a[3], b[3];
	bool flag = 0;
	for (a[0] = 0; a[0] <= 100; a[0]++) {
		int tmp = 0;
		for (int i = 0; i < 3; i++) {
			b[i] = c[0][i] - a[0];
		}
		for (int i = 1; i < 3; i++) {
			if (c[i][0] - b[0] == c[i][1] - b[1] && c[i][1] - b[1] == c[i][2] - b[2])tmp++;
		}
		if (tmp == 2) {
			flag = 1;
			break;
		}
	}
	if (flag)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
typedef long long int ll;
ll cnt,n;
ll rekkyo(string s){
 if(s!=""){
  if(stoll(s)>n) return cnt;
  ll k=s.size(),se=0,f=0,t=0;
  for(ll i=0;i<k;i++) {
    if(s[i]=='7') se++;
    if(s[i]=='5') f++;
    if(s[i]=='3') t++;
  }
  if(se>=1&&f>=1&&t>=1) cnt++;
 }
  rekkyo(s+"3");
  rekkyo(s+"7");
  rekkyo(s+"5");
}
int main(){
  cin >> n;
  string s="";
  rekkyo(s);
  cout <<cnt<<endl;
  return 0;
}


Measured memory_bytes: 256