akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double INF=1e+10;
const long double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		// if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int p[210000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)scanf("%d",p+i);
	std::sort(p,p+a);
	for(int i=0;i<a-1;i++)if(p[i]==p[i+1]){
		printf("NO\n");return 0;
	}
	printf("YES\n");
}

Measured memory_bytes: 896
import java.util.*

class ModInt {
    var v: Long
        private set
    constructor(v: Int){
        this.v = v.toLong() % MOD
    }
    constructor(v: Long){
        this.v = v % MOD
    }

    override fun toString() = v.toString()
    override fun equals(other: Any?): Boolean {
        return if (other is ModInt) v == other.v else false
    }
    override fun hashCode() = 31*17 + v.hashCode()

    operator fun unaryPlus() = this
    operator fun unaryMinus() = ModInt(MOD-this.v)

    private operator fun plus(o: Long) = ModInt(this.v + o)
    operator fun plus(o: ModInt) = this.plus(o.v)
    operator fun plus(o: Int) = this.plus(o.toLong())
    private operator fun minus(o: Long) = this.plus(-o)
    operator fun minus(o: ModInt) = this.plus(-o)
    operator fun minus(o: Int) = this.plus(-o)
    private operator fun times(o: Long) = ModInt(this.v*o)
    operator fun times(o: ModInt) = this.times(o.v)
    operator fun times(o: Int) = this.times(o.toLong())
    private operator fun div(o: Long) = this.times(pow(o, MOD-2))
    operator fun div(o: ModInt) = this.div(o.v)
    operator fun div(o: Int) = this.div(o.toLong())

    operator fun inc() = this.plus(1)
    operator fun dec() = this.minus(1)

    companion object{
        const val MOD = 1000000007

        private fun pow(b:Long, e: Int): ModInt{
            if (b==1L) return ModInt(1)
            var ans = 1L
            var b = b; var e = e
            while (e!=0){
                if (e%2==1) ans = (ans*b)%MOD
                b = (b*b)%MOD
                e /= 2
            }
            return ModInt(ans)
        }
        fun pow(b: Int, e: Int): ModInt = pow(b.toLong(), e)
        fun pow(b: ModInt, e: Int): ModInt = pow(b.v, e)
    }
}

val fctrls = mutableListOf<ModInt>()

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    val n = scn.nextInt()
    val k = scn.nextInt()
    val arr = IntArray(n){scn.nextInt()}
    arr.sort()

    var ans = ModInt(0)
    for (i in 0..n-k) ans -= comb(n-i-1, k-1)*arr[i]
    for (i in k-1 until n) ans += comb(i, k-1)*arr[i]
    print(ans)
}

fun factorial(n: Int): ModInt{
    if (n in fctrls.indices) return fctrls[n]
    else if (fctrls.size==0) fctrls.add(ModInt(1))
    for (i in fctrls.size..n){
        fctrls.add(fctrls[i-1]*i)
    }
    return fctrls[n]
}

fun comb(n: Int, k: Int): ModInt = factorial(n)/(factorial(k)* factorial(n-k))


Measured memory_bytes: 53268
a,b,c,d,e,f=map(int,input().split())
su=[False]*(f+1)
wa=[False]*(f+1)
a*=100
b*=100
e=(100*e)/(100+e)
for i in range(f+1):
    for j in range(f+1):
        if i*c+j*d<=f:
            su[i*c+j*d]=True
        if i*a+j*b<=f:
            wa[i*a+j*b]=True
ans=-1
x,y=a,0
for i in range(1,f+1):
    for j in range(f+1):
        if wa[i] and su[j] and i+j<=f and ans<=100*j/(i+j)<=e:
            ans=100*j/(i+j)
            x,y=i,j
print(x+y,y)

Measured memory_bytes: 43100
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>
#include <fstream>
using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const int BINF = 100000000000000001;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
const double pi = 3.14159265359;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
#define RSORT(v) std::sort(v.rbegin(), v.rend())


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
    }
    int count = 0;
    for (int i = 0; i < N; ++i) {
        if (a[i] == count+1)count++;
    }
    if (count == 0) {
        cout << -1 << endl;
        return 0;
    }
    cout << N - count << endl;
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
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;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int cnt = 0;
    for (int i = 0; i < (int)s.size(); i++)
    {
        if (s[i] == 'o')
        {
            cnt++;
        }
    }
    cnt += 15 - (int)s.size();
    if (cnt >= 8)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
}

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

long** new_matrix(int r, int c) {
    long **matrix = new long*[r];
    for (int i = 0; i < r; ++i) {
        matrix[i] = new long[c];
        for (int j = 0; j < c; ++j) {
            cin >> matrix[i][j];
        }
    }
    return matrix;
}

long cij(int i, int j, int m, long **a, long **b) {
    long tmp = 0;
    for (int k = 0; k < m; ++k) {
        tmp += a[i][k] * b[k][j];
    }
    return tmp;
}

void print(int n, int m, int l, long **a, long **b) {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < l; ++j) {
            cout << cij(i, j, m, a, b);
            if (j == l - 1) {
                cout << endl;
            } else {
                cout << " ";
            }
        }
    }
}

void delete_matrix(int r, long** matrix) {
    for (int i = 0; i < r; ++i) {
        delete[] matrix[i];
    }
    delete[] matrix;
}

int main() {
    int n, m, l;
    cin >> n >> m >> l;

    long** nm = new_matrix(n, m);
    long** ml = new_matrix(m, l);

    print(n, m, l, nm, ml);

    delete_matrix(n, nm);
    delete_matrix(m, ml);
    return 0;
}

Measured memory_bytes: 1348
#include <bits/stdc++.h>
using namespace std;
#include <string>
int main() {
  int A,B;
  cin >> A >> B;
  
  string SA = "",SB = "";
  for (int i = 0; i < A; i++) SB = SB + to_string(B) ;
  for (int i = 0; i < B; i++) SA = SA + to_string(A);

  if (SA <= SB) cout << SA << endl;
  if (SA > SB) cout << SB << endl;
}


Measured memory_bytes: 256
s = input()
if s.count('N') > 0 and s.count('S') == 0:
    print('No')
    exit()
if s.count('S') > 0 and s.count('N') == 0:
    print('No')
    exit()
if s.count('W') > 0 and s.count('E') == 0:
    print('No')
    exit()
if s.count('E') > 0 and s.count('W') == 0:
    print('No')
    exit()
print("Yes")

Measured memory_bytes: 3064
#include <cstdio>
#include <cassert>
#include <algorithm>

using namespace std;

const int maxn = 1e6 + 10;

template<typename ty> bool Chkmax(ty &x, const ty &y) { return x < y ? x = y, 1 : 0; }
template<typename ty> bool Chkmin(ty &x, const ty &y) { return x > y ? x = y, 1 : 0; }

char s[maxn], t[maxn];
int q[maxn], l, r;

bool check(int n)
{
	for (int i = 1; i <= n; ++ i)
		if (s[i] != t[i]) return false;
	return true;
}

int main()
{
	int n;
	scanf("%d", &n);
	fread(s, 1, n + 1, stdin);
	fread(t, 1, n + 1, stdin);
	if (check(n)) return puts("0"), 0;
	int ans = 0, tag = 0;
	l = 1, r = 0;
	for (int i = n, j = n + 1; i; -- i)
	{
		if (t[i] == t[i - 1]) continue;
		if (j > i) j = i + 1;
		for (-- j; j && s[j] != t[i]; -- j);
		if (!j) return puts("-1"), 0;
		q[++ r] = j - (-- tag);
		while (l <= r && q[l] + tag >= i) ++ l;
		Chkmax(ans, r - l + 1);
	}
	printf("%d\n", ans + 1);
	return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef priority_queue<int> Pr;
int const MOD = 1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


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

    int n,d,ans=0; cin>>n>>d;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= d; j++){
            int p=j/10,q=j%10;
            if(p>=2&&q>=2&&p*q==i)ans++;
        }
    }
    cout<<ans<<'\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
	int n; cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; ++i) {
		cin >> w[i];
	}
	int ans = INF;
	for (int i = 1; i < n; ++i) {
		int s1 = 0;
		int s2 = 0;
		for (int j = 0; j < i; ++j) {
			s1 += w[j];
		}
		for (int k = i; k < n; ++k) {
			s2 += w[k];
		}
		ans = min(ans , abs(s1 - s2));
	}
	cout << ans << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define ll long long
const ll mod = 1000000007;


int main() {
    ll n, m;
    cin >> n >> m;

    vector<ll> x(n), y(m);
    r(i, n) {
        cin >> x[i];
    }
    r(i, m) {
        cin >> y[i];
    }

    ll X = 0;
    r(i, n) {
        X += (2*i-n+1)*x[i];
        X %= mod;
    }

    ll Y = 0;
    r(i, m) {
        Y += (2*i-m+1)*y[i];
        Y %= mod;
    }

    cout << X*Y%mod << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <cmath>
using namespace std;
using std::swap;

int N,t=0;
std::vector<int> flo;

int main()
{	
	cin >> N;
	flo.resize(N);
	for (int i = 0; i < N; ++i) { 
		cin >> flo[i];
	}
	while (1) {
		int i = 0;
		if (*max_element(flo.begin(), flo.end()) == 0)break;
		while(i<N) {
			if (flo[i] == 0)++i;
			else {
				++t;
				while (i < N&&flo[i]>0) {
					--flo[i];
					++i;
				}
			}
		}
	}
	cout << t << "\n";
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

const int MXN = 2e5, IINF = 1e9 + 10, INF = 1e18 + IINF + 10, MOD = 1000000007;
const ld PI = 4.0 * atanl(1.0), PREC = .000001;
const char nl = '\n';

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define rall(x) x.end(), x.begin()
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)(x).size()
#define ins insert

int n, m, t, a[MXN];

void fast() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }

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

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

int main() {
  fast();
  int k;
  cin >> n >> k;
  FOR(i, 0, n) cin >> a[i];
  vi dp(n + 1, INF);
  dp[0] = 0;
  FOR(i, 0, n) {
    FOR(j, 1, k + 1)
    if (i - j >= 0) dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
  }
  cout << dp[n - 1];
  return 0;
}



Measured memory_bytes: 4008
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}

	return i
}
func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	k := nextInt()
	list := make([]int, n)
	kitaichiMap := map[int]float64{}
	var work int
	var kitaichiMax float64
	//var kiNow float64
	var kitaichiWork float64
	kitaichiWork = -1.0

	for i := 0; i < n; i++ {
		work = nextInt()
		//kiNow = (float64(work + 1)) / 2.0
		list[i] = work
		_, ok := kitaichiMap[work]
		if ok == false {
			kitaichiMap[work] = (float64(work + 1)) / 2.0

		}
		if i >= k-1 {
			if kitaichiWork < 0 {
				kitaichiWork = 0
				for j := 0; j <= i; j++ {
					kitaichiWork += kitaichiMap[list[j]]
				}

			} else {
				kitaichiWork -= kitaichiMap[list[i-k]]
				kitaichiWork += kitaichiMap[work]
			}
			//for j := i; c < k; j-- {
			//	kitaichiWork += kitaichiMap[list[j]]
			//	c++
			//}
			if kitaichiWork > kitaichiMax {
				kitaichiMax = kitaichiWork
			}
		}
	}

	fmt.Println(kitaichiMax)
}


Measured memory_bytes: 3072
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

int main(){
    // 引数の受け取り
    int A,B,C;
    scanf("%d %d %d", &A, &B, &C);

    if((max(max(A,B),C)*2)==(A+B+C)){
    
    printf("Yes");
    }else {
    printf("No");
    }
    return 0;
}


Measured memory_bytes: 256
//Atcoder AISing Programing Contest 2020 B問題

#include <stdio.h>

int main(void) {
    int sizeN;
    int count = 0;

    scanf("%d", &sizeN);

    int num[sizeN];

    for (int i = 0; i < sizeN; i++) {
        scanf("%d", &num[i]);
        if (i % 2 == 0 && num[i] % 2 == 1) {
            count++;
        }
    }

    printf("%d", count);

    return 0;
}


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

struct rectangle{
  int h, w;
  bool operator<(const rectangle &a)const{
    if(w*w + h*h == a.w*a.w + a.h*a.h)
      return h < a.h;
    return w*w + h*h < a.w*a.w + a.h*a.h;
  }
};


int main(){
  vector<rectangle> ans;
  for(int i = 1; i <= 150; i++) {
    for(int j = i + 1; j <= 150; j++) {
      rectangle r;
      r.h = i, r.w = j;
      ans.push_back(r);
    }
  }
  sort(ans.begin(), ans.end());
  for(int i = 0; i < 20; i++) {
    //cout << ans[i].h << " " << ans[i].w << endl;
}
  int h, w;
  while(cin >> h >> w, h){
    rectangle r;
    r.h = h, r.w = w;
    for(int i = 0; i < ans.size(); i++){
      if(r < ans[i]){
	cout << ans[i].h << " " << ans[i].w << endl;
	break;
      }
    }
  }
  return 0;
}

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

using namespace std;

#define eps (1e-10)
#define equals(a,b) (fabs((a)-(b))<eps)
struct point{
    double x,y;
    point(){}
    point(double x,double y):x(x),y(y){}
    point operator + (point &p){return point(x+p.x,y+p.y);}
    point operator - (point &p){return point(x-p.x,y-p.y);}
    point operator * (double k){return point(x*k,y*k);}
    point operator / (double k){return point(x/k,y/k);}

    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}

    bool operator < (const point &p){
        return x!=p.x?x<p.x:y<p.y;
    }
    bool operator == (const point &p){
        return fabs(x-p.x)<eps&&fabs(y-p.y)<eps;
    }
};
//内积
double dot(point a,point b)
{
    return a.x*b.x+a.y*b.y;
}
//外积
double cross(point a,point b){
    return a.x*b.y-a.y*b.x;
}

point project(point a,point b,point c)
{
    point base=b-a;
    double r=dot(base,c-a)/base.norm();
    base=base*r;
    return a+base;
}

int main()
{
    point a,b;
    cin>>a.x>>a.y>>b.x>>b.y;
    int q;
    cin>>q;
    point temp;
    for(int i=0;i<q;i++){
        cin>>temp.x>>temp.y;
        point linshi=project(a,b,temp);
        linshi=(linshi-temp)*2.0;
        point res=temp+linshi;
        printf("%.10f %.10f\n",res.x,res.y);
    }
    return 0;
}



Measured memory_bytes: 3288
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n, ans=0,tmp=0;
    cin >> n;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];
    rep(i,n-1){
        if(h[i] >= h[i+1]) tmp++;
        else tmp = 0;
        ans = max(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}

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


int main(void){

    string N; cin >> N;

    reverse(N.begin(), N.end());

    int num = N.at(0) - '0';

    switch(num){
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;
        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;
        case 3:
            cout << "bon" << endl;
            break;
        default:
            break;
    }

    return 0;
}

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

namespace AOJ
{
  class Program
  {
    static void Main(string[] args)
    {
      var str="";
      while((str = Console.ReadLine()) != null){
      var z = str.Split(' ').Select( i => int.Parse(i)).ToArray();  
      double a = z[0],b = z[1],c = z[2],d = z[3],e = z[4],f = z[5]; 
      double y = (d*c - a*f)*1.000/(d*b - a*e);
      double x = (c - b*y)*1.000/a;
      Console.WriteLine("{0:F3} {1:F3}",x,y);
      }
    }
  }
}

Measured memory_bytes: 5980
#include <stdio.h>

int EuclideanAlgorithm(int a, int b)
{
    return b? EuclideanAlgorithm(b,a%b):a;
}

int main()
{
    int A,B,C;
    scanf("%d %d %d", &A, &B, &C);
    printf("%s\n", C%EuclideanAlgorithm(A,B)? "NO":"YES");
    
    return 0;
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int main(void){
    for(int n, m, res; cin >> n >> m, n; cout << res << endl){
        res = inf;
        vvi costs(n, vi(n, inf));
        vi edge(m);

        rep(i, m){
            int a, b, w; cin >> a >> b >> w;
            a--, b--;

            costs[a][b] = costs[b][a] = w;
            edge[i] = w;
        }

        rep(i, m){
            int lb = edge[i];
            int slim = 0;

            vi minCost(n, inf), used(n);

            minCost[0] = 0;
            while(1){
                int v = -1;
                rep(u, n){
                    if(!used[u] && (v == -1 || minCost[u] < minCost[v])) v = u;
                }
                if(v == -1) break;

                used[v] = true;
                slim = max(slim, minCost[v]);

                rep(u, n){
                    if(costs[v][u] >= lb) minCost[u] = min(minCost[u], costs[v][u] - lb);
                }
            }

            res = min(res, slim);
        }

        if(res > 10000000) res = -1;
    }

	return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>

using namespace std;
typedef long long ll;
const int N = 5010;

int n, k;
int p[N], c[N];

int main()
{
	scanf("%d%d", &n, &k);
	
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &p[i]);
	}
	
	for(int i = 1; i <= n; i++)
	{
		scanf("%d", &c[i]);
	}
	
	ll ans = -1e18;
	
	for(int i = 1; i <= n; i++)		// 枚举起点 
	{
		ll circle_sum = 0;
		int circle_cnt = 0;
		int v = i;
		
		while(true)
		{
			circle_cnt++;
			circle_sum += c[p[v]];
			v = p[v];
			if(v == i)	break;
		}
		
		/*
		ll path = 0;
        
        if(k >= circle_cnt)
        {
        	if(circle_sum < 0)
			{
				continue;
			}
        	else
        	{
        		int q = k / circle_cnt, r = k % circle_cnt;
        		path += circle_sum * q;
        		int cnt = 0;
        		while(true)
        		{
        			path += c[p[v]];
        			cnt++;
        			v = p[v];
					if(cnt == r)	break;
				}
			}
		}
		else
		{
//			int q = k / circle_cnt, r = k % circle_cnt;
//    		path += circle_sum * q;
    		int cnt = 0;
    		while(true)
    		{
    			path += c[p[v]];
    			cnt++;
    			v = p[v];
				if(cnt == k)	break;
			}
		}
		
		ans = max(ans, path);
		*/

		ll path = 0;
        int cnt = 0;

        while(true)
		{
            cnt++;
            path += c[p[v]];

            if(cnt > k)	break;
            
            int num = (k - cnt) / circle_cnt;
			ll score = path + max(0ll, circle_sum) * num;
            ans = max(ans, score);
            
            v = p[v];
			
			if (v == i) break;
        }
	}
	
	printf("%lld\n", ans);
	
	
	return 0;
} 

Measured memory_bytes: 3812
#define _USE_MATH_DEFINES

#include <array>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <utility>
#include <tuple>
#include <algorithm>
#include <limits>
#include <fstream>
#include <numeric>
#include <stack>
#include <queue>
#include <list>
#include <cstring>
#include <unordered_set>
#include <cmath>
#include <iomanip>

namespace
{
	template<int N>
	std::array<int, N> GetValue(std::istream& stream)
	{
		std::string buf;
		std::getline(stream, buf);

		std::stringstream sstr(buf);
		std::array<int, N> retval;

		for (int i = 0; i < N; ++i)
		{
			std::getline(sstr, buf, ' ');
			retval[i] = std::stoi(buf);
		}

		return retval;
	}

	std::vector<int> GetValue(std::istream& stream, int num, char delim)
	{
		std::string buf;
		std::getline(stream, buf);
		std::stringstream sstr(buf);

		std::vector<int> retval;
		retval.reserve(num);

		std::string input;;
		for (int i = 0; i < num && std::getline(sstr, input, delim); ++i)
		{
			retval.push_back(std::stoi(input));
		}

		return retval;
	}

	int GetValue(std::istream& stream)
	{
		int in;
		stream >> in;

		return in;
	}

	std::vector<std::string> GetValueString(std::istream& stream, int num, char delim)
	{
		std::string buf;
		std::vector<std::string> retval;
		retval.reserve(num);

		std::getline(stream, buf);
		std::stringstream sstr(buf);

		for (int i = 0; i < num && std::getline(sstr, buf, delim); ++i)
		{
			retval.push_back(std::move(buf));
		}

		return retval;
	}

	template<typename T>
	void PrintLine(const std::vector<T>& sequence)
	{
		std::cout << sequence[0];

		for (size_t i = 1; i < sequence.size(); ++i)
		{
			std::cout << ' ' << sequence[i];
		}

		std::cout << std::endl;
	}

	template<typename T>
	void Print(const std::vector<T>& sequence)
	{
		for (const auto& e : sequence)
		{
			std::cout << e << '\n';
		}

		std::cout << std::flush;
	}

	struct Point
	{
		double x;
		double y;
	};

	void KochCurve(int level, const Point& p1, const Point& p2)
	{
		if (0 == level)
		{
			return;
		}

		Point s = { (2 * p1.x + p2.x) / 3, (2 * p1.y + p2.y) / 3 };
		Point t = { (p1.x + 2 * p2.x) / 3, (p1.y + 2 * p2.y) / 3 };
		double diff_x = t.x - s.x;
		double diff_y = t.y - s.y;
		double theta = 60.0 / 180 * M_PI;
		Point u = {
			std::cos(theta) * diff_x - std::sin(theta) * diff_y + s.x,
			std::sin(theta) * diff_x + std::cos(theta) * diff_y + s.y
		};

		KochCurve(level - 1, p1, s);
		std::cout << s.x << ' ' << s.y << '\n';
		KochCurve(level - 1, s, u);
		std::cout << u.x << ' ' << u.y << '\n';
		KochCurve(level - 1, u, t);
		std::cout << t.x << ' ' << t.y << '\n';
		KochCurve(level - 1, t, p2);
	}
}

int main(int argc, char* argv[])
{
	auto file = (argc == 1) ? std::ifstream() : std::ifstream(argv[1]);
	std::istream& stream = (argc == 1) ? std::cin : file;
	if (argc == 1)
	{
		std::cin.tie(0);
		std::ios::sync_with_stdio(false);
	}

	int num = GetValue<1>(stream)[0];

	Point p1 = { 0, 0 };
	Point p2 = { 100, 0 };

	std::cout << std::fixed << std::setprecision(8);

	std::cout << p1.x << ' ' << p1.y << '\n';
	KochCurve(num, p1, p2);
	std::cout << p2.x << ' ' << p2.y << '\n';
}



Measured memory_bytes: 3300
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long A, long long B){
  int ans=0;
  for (int i = A; i <= B; i++) {
    string a = to_string(i);
    reverse(all(a));
    if(a == to_string(i))ans++;
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
}


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

#define debug(x) cerr<<#x<<'='<<x<<'\n'
int a[200001];
int b[200001];
int r[200001];
bool cmp(const int &x, const int &y) {
	return a[x]<a[y];
}
int main(void) {
	int n;
	scanf("%d", &n);
	for (int i=1; i<=n; i++) {
		scanf("%d%d", a+i, b+i);
		r[i]=i;
	}
	sort(r+1, r+1+n, cmp);
	int ans=a[r[1]]-1;
	for (int i=2; i<=n; i++) {
		ans+=min(a[r[i]]-a[r[i-1]]-1, b[r[i-1]]-b[r[i]]-1);
	}
//	debug(ans);
	ans+=n+b[r[n]];
	cout<<ans;
	return 0;
}

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

int main() {
    int a, b, c;  cin >> a >> b >> c;
    cout << max({a+b, a-b, a*b}) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const ll mod = 1e9+7;

int main() {
	ll n;
	cin>>n;
	ll a[n],i,s=0;
	for(i=0;i<n;i++) {
		cin>>a[i];
		s+=a[i];
	}
	ll t[n];
	for(i=0;i<n;i++) {
		t[i] = (s-a[i]);
		if(t[i]<0)
			t[i] += mod;
		t[i] %= mod;
		s -= a[i];
		if(s<0)
			s+=mod;
		s %= mod;
	}
	ll ans =0;
	for(i=0;i<n;i++) {
		ll temp = ((a[i]%mod) * (t[i]%mod))%mod;
		ans += temp;
		if(ans<0)
			ans += mod;
		ans %= mod;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6760
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie();
    string s;
    cin>>s;
    if(s[0] == 'R' && s[1] == 'R' && s[2] == 'R') {
        cout<<"3";
        return 0;
    }
    if((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')){
        cout<<"2";
        return 0;
    }
    if(s[0] == 'R' || s[1] == 'R' || s[2] == 'R'){
        cout<<"1";
        return 0;
    }
    cout<<"0";
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] a = new int[N];
    int max = 0;
    int min = Integer.MAX_VALUE;
    for(int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
      max = Math.max(max, a[i]);
      min = Math.min(min, a[i]);
    }
    String ans = "No";
    if(max == min) {
      if((max + 1 == N) || (N >= 2 * max)) ans = "Yes";
    } else {
      if(max == min + 1) {
      int s = 0;
      for(int i = 0; i < N; i++) {
        if(a[i] == min) s++;
      }
      if((max > s) && (N >= s + (2 * (max - s)))) ans = "Yes";
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 52696
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
//#include<bits/stdc++.h>
using namespace std;
#define Base1   101LL
#define Base2   10000079LL
#define Base3   10000103LL
#define MOD1    1000000007LL
#define MOD2    1000000009LL
#define MOD3    1000000021LL
#define mx 100000//Number of charter of main string
#define mx1 25000// Number off character of total charcater
#define mx2 500// Number of pattern and number of ch of each pattern
 
 int dx[]= {1,-1,0,0};
 int dy[] = {0,0,1,-1};
 
int main(){

  char c;
  cin>>c;
  cout<<(char)(c+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug != false) {
            return;
        }
        System.out.println(str);
    }

    public static void main(String[] args) {

        long L;
        long R;
        long[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            L = sc.nextLong();
            R = sc.nextLong();
        }

        if((R - L) > 2019 ){
            System.out.println(0);
            return;
        }

        long temp = 2019;
        for(long j=L;j < R;j++){
            for(long i = j+1;i < R+1;i++){
                long k = (j* i)%2019;
                if(temp > k){
                    temp = k;
                }
                //debug("k,j,i"+k+":"+j+":"+i);
                if(temp == 0){
                    break;
                }

            }
        }
        System.out.println(temp);
    }


}


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

bool is_uruu(int y){
	if(y % 4 == 0){
		if(y % 100 == 0){
			if(y % 400 == 0) return true;
			else return false;
		}else return true;
	}else return false;
}

int main(){
	int month[] = {31,28,31,30,31,30,31,31,30,31,30,31};
	int a,b,c,d,e,f;
	while(cin >> a >> b >> c >> d >> e >> f,a >= 0){
		int x = c,y = f;
		for(int i = 0;i < a;i++){
			if(is_uruu(i)) x += 366;
			else x += 365;
		}
		for(int i = 0;i < d;i++){
			if(is_uruu(i)) y += 366;
			else y += 365;
		}
		for(int i = 0;i < b - 1;i++){
			if(i == 1 && is_uruu(a)) x += 29;
			else x += month[i];
		}
		for(int i = 0;i < e - 1;i++){
			if(i == 1 && is_uruu(d)) y += 29;
			else y += month[i];
		}
		cout << y - x << endl;
	}
	return 0;
}

Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
#define N 200005
#define LL long long
const int mo = 1e9+7;
LL dp[70][2][2][2],num1[70],num2[70] ;
LL dfs(int pos,bool L,bool R,bool flg) {
	if(!pos) return 1;
	if(~dp[pos][L][R][flg]) return dp[pos][L][R][flg];
	LL res = 0;
	int up1 = L? num1[pos]:0,up2 = R? num2[pos]:1;

	if(up2) res += dfs(pos-1,num1[pos] == 1 && L,num2[pos] == 1 && R,1),res %= mo;

	if(up1==0 && up2 && flg) res += dfs(pos-1,num1[pos] == 0 && L,num2[pos] == 1 && R,1),res %= mo;

	if(!up1) res += dfs(pos-1,num1[pos] == 0 && L,num2[pos] == 0 && R,flg),res %= mo;

	return dp[pos][L][R][flg] = res;
}

LL Solve(LL L,LL R) {
	int cot1 = 0,cot2 = 0;
	while(L) num1[++cot1] = L&1,L >>= 1;
	while(R) num2[++cot2] = R&1,R >>= 1;
	return dfs(cot2,1,1,0);
}
int main() {
	memset(dp,-1,sizeof(dp));
	LL L,R;
	cin >>L>>R;
	cout<<Solve(L,R);
	return 0;
}

Measured memory_bytes: 256
n = input()
if len(n) < 3:
    print(1000- int(n))
else:   
    value = n[-3]+n[-2]+n[-1]
    #print(value)
    value_int = int(value)
    if value == '000':
        print(0)
    else:
        print(1000 - value_int)

Measured memory_bytes: 9048
use std::cmp;

const INF: usize = 1e18 as usize;

fn dfs(n: usize, p: usize, x: &Vec<usize>, edges: &Vec<Vec<usize>>) -> usize {
    let l = x[n] + 1;
    let mut dp = vec![vec![]; 2];
    let mut cur = 0;
    let mut tar = 1;
    dp[cur] = vec![INF; l];
    dp[cur][0] = 0;

    for &m in edges[n].iter() {
        if m == p {
            continue;
        }
        dp[tar] = vec![INF; l];
        let w = dfs(m, n, x, edges);
        let b = x[m];
        for i in 0..(x[n] + 1) {
            if dp[cur][i] != INF {
                if i + w <= x[n] {
                    dp[tar][i + w] = cmp::min(dp[tar][i + w], dp[cur][i] + b);
                }
                if i + b <= x[n] {
                    dp[tar][i + b] = cmp::min(dp[tar][i + b], dp[cur][i] + w);
                }
            }
        }

        cur ^= 1;
        tar ^= 1;
    }
    *dp[cur].iter().min().unwrap()
}

fn main() {
    let mut sc = Scanner::new();
    let n = sc.read();
    let mut graph = vec![vec![]; n];
    for i in 0..(n - 1) {
        let p = sc.read::<usize>() - 1;
        graph[p].push(i + 1);
        graph[i + 1].push(p);
    }
    let x = sc.read_vec(n);

    if dfs(0, INF, &x, &graph) != INF {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 30972
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;

#define FOR(_i, s, e) for(_i = s; _i < e; ++_i)
#define FOR_INV(_i, s, e) for(_i = e - 1; _i >= s; --_i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;


using pos = std::pair<LONG, LONG>;



int main(){
    LONG i, j, k;

    LONG N;
    cin >> N;

    multiset<LONG, greater<LONG>> colors;

    LONG A;
    FOR(i, 0, N){
        cin >> A;

        auto it = colors.upper_bound(A);
        if(it != colors.end()){
            colors.erase(it);
        }
        colors.insert(A);
    }

    cout << colors.size() << endl;

}


Measured memory_bytes: 5240
#include<iostream>
#define f(i,x,n) for(int i =x;i<n;i++)
#define MOD int(1e9+7)
using namespace std;

char cell[1001][1001];

int solve(int r,int c){
    int dp[r][c];
    f(i,0,r){
        f(j,0,c){
            if(cell[i][j] == '#'){
                dp[i][j] = 0;
                continue;
            }
            if(i == 0 || j == 0){
                if(i == 0 && j == 0){
                    dp[i][j] = 1;
                }
                else if(i == 0){
                    dp[i][j] = dp[i][j-1]%MOD;
                }
                else{
                    dp[i][j] = dp[i-1][j]%MOD;
                }
            }
            else{
                dp[i][j] = (dp[i-1][j]+dp[i][j-1])%MOD;
            }
       }
    }
    return (dp[r-1][c-1])%MOD;
}

int main(){
int r,c;
cin>>r>>c;
f(i,0,r){
    f(j,0,c){
        cin>>cell[i][j];
    }
}

int value =  solve(r,c);
cout<<value<<endl;
return 0;
}

Measured memory_bytes: 8452
#include <iostream>
using namespace std;
int main(){
    string s, p;
    cin >> s;
    cin >> p;
    for(int i = 0; i < p.size() - 1; i++){
        s += s[i];
    }
    int flag = 0;
    for(int i = 0; i < s.size(); i++){
        for(int j = 0; j < p.size(); j++){
            if(s[i + j] == p[j]){
                if(j == p.size() - 1) flag = 1;
            }
            else break;
        }
        if(flag){
            cout << "Yes" << endl;
            break;
        }
    }
    if(!flag) cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 3204
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;

int main(){
   int N;
   cin >> N;
   string s;
   cin >> s;
   int cnt[2];
   memset(cnt,0,sizeof(cnt));
   for(int i=0;i<(int)s.size();i++){
      if(s[i]=='R') cnt[0]++;
      else cnt[1]++;
   }
   if(cnt[0]>cnt[1]){
      cout << "Yes"<<endl;
   }
   else{
      cout <<"No"<<endl;
   }

  return 0;
}


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

int main() {
    vector<int> A(3);
    cin >> A.at(0) >> A.at(1) >> A.at(2);

    if (A.at(0) == A.at(1) && A.at(1) == A.at(2)) {
        cout << "No";
    }
    else if (A.at(0) == A.at(1)) {
        cout << "Yes";
    }
    else if (A.at(0) == A.at(1)) {
        cout << "Yes";
    }
    else if (A.at(1) == A.at(0)) {
        cout << "Yes";
    }
    else if (A.at(1) == A.at(2)) {
        cout << "Yes";
    }
    else if (A.at(2) == A.at(0)) {
        cout << "Yes";
    }
    else if (A.at(2) == A.at(1)) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }
}

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

#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;

int L[MAX / 2 + 2], R[MAX / 2 + 2];

llong merge(int A[], int n, int left, int mid, int right){
    int i, j, k;
    llong cnt = 0;
    int n1 = mid -left;
    int n2 = right - mid;

    for(i = 0; i < n1; i++) L[i] = A[left + i];
    for(i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    i = j = 0;
    
    for(k = left; k < right; k++){
        if(L[i] <= R[j]){
            A[k] = L[i++];
        }else {
            A[k] = R[j++];
            cnt += n1 - i;
        }
    }
    return cnt;
}

llong mergeSort(int A[], int n, int left, int right){
    int mid;
    llong v1, v2, v3;

    if(left + 1 < right){
        mid = (left + right) / 2;
        v1 = mergeSort(A, n, left, mid);
        v2 = mergeSort(A, n, mid, right);
        v3 = merge(A, n, left, mid, right);
        return v1 + v2 + v3;
    }else return 0;
}

int main(){
    int A[MAX], n, i;

    cin >> n;
    for(i = 0; i < n; i++){
        cin >> A[i];
    }

    llong ans = mergeSort(A, n, 0, n);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4664
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    ll n, v[5];
    cin >> n;
    fore(i,0,5) cin >> v[i];
    ll mn = *min_element(v, v+5);
    ll ans = 5;
    if (mn < n) {
        ans += (n-1)/mn;
    }
    cout << ans << endl;
}


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

vector<int64_t> calculated(87, 0);

int64_t lucas_number(int);

int main()
{
  int n;
  cin >> n;
  
  int64_t result = lucas_number(n);
  cout << result << endl;
}

int64_t lucas_number(int n) {
  if (n == 0) {
    return 2;
  }
  if (n == 1) {
    return 1;
  }
  
  if (calculated.at(n) != 0) {
    return calculated.at(n);
  }
  
  return calculated.at(n) = lucas_number(n - 1) + lucas_number(n - 2);
}

Measured memory_bytes: 3560
#include<stdio.h>
main(void)
{
	int n,a,flag=1,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a);
		if((flag==1)&&(a%2==0)){
			if((a%3!=0)&&(a%5!=0))flag=0;
		}
	}
	if(flag==0)printf("DENIED\n");
	else printf("APPROVED\n");		
}

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

//int numberofPaths(int h,int w,int a,int b);

int main()
{
    ll n,i,len1,h,t,cnt=0,cnt1=0,x,m,flag=0,k,h1=0,h2=0,od=0,ev=0,y;
    double w;
   /* freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);*/
	cin>>n>>m;
	ll a[n+1];
	for(i=0;i<=n;i++)
    {
        a[i]=1;
    }
    map <int,int> mp;
    for(i=0;i<=n;i++)
    {
        mp.insert({i,0});
    }
    t=1;
    auto it=mp.find(t);
    it->second=1;

	while(m--)
    {
       cin>>x>>y;
       auto it=mp.find(x);
       if(it->second==1&&a[x]!=0)
       {

           auto itr = mp.find(y);
           itr->second=1;
       }
       if(it->second==1&&a[x]==1){
        it->second--;
       }
       a[x]--;
       a[y]++;
    }
    for(i=0;i<=n;i++)
    {
        auto it= mp.find(i);
        if(it->second==1&&a[i]!=0)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;


	return 0;
}


Measured memory_bytes: 5760
import sys
import math
import bisect

def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        if i % 2 == 0 and A[i] % 2 == 1:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9048