akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double ld;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)


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

    ll count=1;
    ll sizeS = S.size();
    string checkS="",s="",temp="";
    checkS.push_back(S[0]);
    // cout << checkS << endl;
    for(ll i=1;i<sizeS;){
        do{
            if(i == sizeS) break;
            s.push_back(S[i++]);
        }while(checkS == s);
        // cout << s << endl;
        if(i != sizeS){
            count++;
        }else{
            if(checkS != s){
                count++;
            }
        }
        checkS = s;
        s = temp;
    }

    cout << count << endl;

}




Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000000 + 7;
const int N = 1e5 + 10;
ll n,m;
ll v[N];
ll fact[N];
ll add(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a+b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}
 
ll mul(ll a, ll b, ll m = MOD){
	if(a >= m) a %= m;
	if(b >= m) b %= m;
	if(a < 0) a += m;
	if(b < 0) b += m;
	ll res = a*b;
	if(res >= m or res <= -m) res %= m;
	if(res < 0) res += m;
	return res;
}
ll subs(ll a, ll b) {
    return ((a % MOD) - (b % MOD) + MOD) % MOD;
}
ll bpow(ll a, ll b) {
    ll ret = 1;
    while(b) {
        if(b & 1) {
            ret = mul(a, ret);
        }
        a = mul(a, a);
        b >>= 1;
    }
    return ret;
}
ll inv(ll a) {
    return bpow(a, MOD - 2);
}
ll comb(ll a, ll b) {
    ll num = fact[a];
    ll den = mul(fact[a - b], fact[b]);
    ll i = inv(den);
    ll ret = mul(num, i);
    return ret;
}
void getf() {
    fact[0] = fact[1] = 1;
    for(ll i = 2; i < N; ++i) {
        fact[i] = mul(fact[i - 1], i);
    }
}
int main() {
    getf();
    cin>>n>>m;
    for(int i = 0; i < n; ++i) {
        cin>>v[i];
    }
    sort(v, v + n);
    vector<ll> q;
    ll tempn = n - 1;
    ll tempm = m - 1;
    while(tempn >= tempm) {
        ll c = comb(tempn, tempm);
        q.emplace_back(c);
        tempn--;
    }
    // reverse(q.begin(), q.end());
    int sz = (int) q.size() - 1;
    ll forw = 0, back = 0;
    for(int i = 0, k = 0; i < n; ++i, ++k) {
        // cout<<v[i]<<" "<<q[k]<<endl;
        ll mt = mul(v[i], q[k]);
        forw = add(forw, mt);
        if(k == sz) break;
    }
    for(int i = n - 1, k = 0; i >= 0; --i, ++k) {
        ll mt = mul(v[i], q[k]);
        back = add(back, mt);
        if(k == sz) break;
    }
    // cout<<back<<" "<<forw<<endl;
    ll ans = subs(back, forw);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 2428
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc *bufio.Scanner

func nextString() string {
	sc.Scan()
	i := sc.Text()
	return i
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	w := nextString()
	ans := 0
	for sc.Scan() {
		s := sc.Text()
		if s == "END_OF_TEXT" {
			break
		}
		s = strings.ToLower(s)
		if s == w {
			ans++
		}
	}
	fmt.Println(ans)
}



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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

const int MOD = 1'000'000'007;

int main() {
  int s;
  cin >> s;
  // dp[i] : 整数 i までの該当する数列の数
  vector<int> dp(s + 1, 0);
  dp.at(0) = 1;
  for (int i = 1; i <= s; i++) {
    ll x = 0;
    for (int j = i - 3; j >= 0; j--) {
      x += dp.at(j);
      x %= MOD;
    }
    dp.at(i) = x;
  }
  cout << dp.at(s) << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+100;
const int mod = 1e9+7;
int main() {
	string s;
	cin >> s;
	bool ans=false,pos;
	for(int i = 0; i < s.size()-1; i++){
		if(s[i]==s[i+1]){
			cout << i+1 << " " << i+2;
			return 0;
		}
	}
	for(int i = 0; i < s.size()-2; i++){
		if(s[i]==s[i+2]){
			cout << i+1 << " " << i+3;
			return 0;
		}
	}
	cout << "-1 -1";
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(void){
	int n,a,sum,ans;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		sum=0;ans=-100000;
		while(n--){
			scanf("%d",&a);
			sum+=a;
			if(sum>ans)ans=sum;
			if(sum<0)sum=0;
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 600
n,m = map(int,input().split())
a,b =min(n,m),max(n,m)


if a==1:
    if b==1:
        print(1)
    else:
        print(b-2)
elif a ==2:
    print(0)
if a>=3:
    print((a-2)*(b-2))

Measured memory_bytes: 3060
f = [0,1,1,2,3,5,8,13,21,34,55,89]
h,w,k = map(int,input().split())
a = [0]*(w+2)
b = [0]*(w+2)
a[1] =     1
for i in range(h):
  for j in range(1,w+1):
    b[j] =(f[j-1]*f[w-j+1]*a[j-1] + f[j]*f[w-j+1]*a[j] + f[j]*f[w-j]*a[j+1])%1000000007
  for j in range(1,w+1):
    a[j] = b[j]   

    
    
print(a[k])


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

static const int MAX=1000;
static const int VMAX=10000;

int n, A[MAX],s;
int B[MAX],T[VMAX+1];

int solve() {
  int ans=0;
  bool V[MAX];
  for (int i=0; i<n; i++) {
    B[i]=A[i];
    V[i]=false;
  }
  sort(B,B+n);
  for (int i=0; i<n; i++) {
    T[B[i]]=i;
  }
  for (int i=0; i<n; i++) {
    if (V[i]) {
      continue;
    }
    int cur=i;
    int S=0;
    int m=VMAX;
    int an=0;
    while (true) {
      V[cur]=true;
      an++;
      int v=A[cur];
      m=min(m,v);
      S+=v;
      cur=T[v];
      if (V[cur]) {
        break;
      }
    }
    ans+=min(S+(an-2)*m,m+S+(an+1)*s);
  }
  return ans;
}
int main() {
  cin>>n;
  s=VMAX;
  for (int i=0; i<n; i++) {
    cin>>A[i];
    s=min(s,A[i]);
  }
  int ans;
  ans = solve();
  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3168
#include <set>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>

using namespace std;
int main()
{
	double a,b;
	scanf("%lf%lf",&a,&b);
	printf("%.0lf",ceil((a+b)/2));

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int z = sc.nextInt();
		int w = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0 ; i < n ; i++) a[i] = sc.nextInt();
		if(n == 1) {
			System.out.println(Math.abs(a[n - 1] - w));
			return;
		}
		int ans = Math.max(Math.abs(a[n - 1] - w), Math.abs(a[n - 1] - a[n - 2]));
		System.out.println(ans);
	}
}


Measured memory_bytes: 25316
#include <iostream>
#include <vector>
#include <string.h>

using namespace std;
bool IsMSPrime[300100];
vector<int> MSPrime;

void calc()
{
	memset(IsMSPrime, 1, sizeof(bool) * 300100);
	MSPrime.push_back(6);
	for(int i = 6; i < 300100; i += 6)
	{
		IsMSPrime[i] = false;
	}
	for(int i = 1;7 * i + 6 < 300100; ++i)
	{
		int temp1 = 7 * i + 1;
		int temp2 = 7 * i + 6;
		if(IsMSPrime[temp1])
		{
			MSPrime.push_back(temp1);
			for(int j = 2 * temp1; j < 300100; j += temp1)
			{
				IsMSPrime[j] = false;
			}
		}
		if(IsMSPrime[temp2])
		{
			MSPrime.push_back(temp2);
			for(int j = 2 * temp2; j < 300100; j += temp2)
			{
				IsMSPrime[j] = false;
			}
		}
	}
}

void solve()
{
	calc();
	int n;
	while(cin >> n, n != 1)
	{
		cout << n << ":";
		int size = MSPrime.size();
		for(int i = 0; i < size; ++i)
		{
			if(n % MSPrime[i] == 0)
			{
				cout << " " << MSPrime[i];
			}
			if(n < MSPrime[i])
			{
				break;
			}
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 0
# A - Rounding
# X,A は 0 以上 9 以下の整数です。
# X が A 未満の時 0、
# A 以上の時 10
# を出力してください。
def a_rounding
    x,a = gets.chomp.split(/\s/).map{|x| x.to_i}
    print x < a ? 0 : 10
end

a_rounding


Measured memory_bytes: 1916
#include<stdio.h>
#include<string.h>
int main(){
int K;
char S[100];
  scanf("%d",&K);
  scanf("%s",&S);
  if(strlen(S)<=K)
    printf("%s",S);
  else if(strlen(S)>K){
    for(int i=0;i<K;i++)
      printf("%c",S[i]);
    printf("...");}
  return 0;
}

Measured memory_bytes: 2148
import java.io.BufferedReader; 
import java.io.IOException; 
import java.io.InputStreamReader; 
import java.util.*;
public class Main  
{ 
    public static void main(String[] args) throws IOException  
    { 
        //Enter data using BufferReader 
        BufferedReader reader =  
                   new BufferedReader(new InputStreamReader(System.in)); 
         
      int[][] m = new int[3][3];
        // Reading data using readLine 
      	for (int i = 0;i < 3; ++i) {
         	 String input = reader.readLine(); 
          	String[] vs = input.split(" ");
          	for (int j = 0; j < vs.length; ++j) {
             	m[i][j] =  Integer.valueOf(vs[j]);
            }
        }
      
      	int n = Integer.valueOf(reader.readLine());
        int[] marks = new int[n];
      	for (int i = 0; i < n; ++i) {
          	marks[i] = Integer.valueOf(reader.readLine());
        }
      	
      	Set<Integer> set = new HashSet<>();
      for (int i = 0; i < n; ++i) {
        set.add(marks[i]);
      }
        
      
      	for (int i = 0;i < 3; ++i) {
            int row = 0;
          	for (int j = 0; j < 3; ++j) {
              if (set.contains(m[i][j])) {
                m[i][j] = -1;
                row++;
                if (row == 3) {
                  System.out.println("Yes");
                 	return; 
                }
              }
            }
        }
                  
        for (int i = 0;i < 3; ++i) {
            int col = 0;
          	for (int j = 0; j < 3; ++j) {
              if (m[j][i] == -1) {
                col++;
                if (col == 3) {
                  System.out.println("Yes");
                 	return; 
                }
              }
            }
        }
          
                  int dig = 0;
                  int rDig = 0;
        for (int i = 0; i < 3; ++i) {
        	if (m[i][i] == -1) {
              dig++;
              if (dig == 3) {
                  System.out.println("Yes");
                 	return; 
                }
            }
             
          	if(m[2 - i][i] == -1){
              rDig++;
              if (rDig == 3) {
                  System.out.println("Yes");
                 	return; 
                }
            }
        }
        // Printing the read line 
        System.out.println("No");         
    } 
} 

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define F first
#define S second
#define STP(x) setprecision(x)
#define watch(x) cout << (#x) << " is " << (x) << "   =="
#define Yala_Besor3a ios_base::sync_with_stdio(0),ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

using namespace std;

const int OO = 0x3f3f3f3f, NegOO = -1 * OO, N = 2e5 + 5, M = 1e3 + 5, mod = 1e9 + 7;

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    Yala_Besor3a;
    int a;
    cin>>a;
    cout<<a+(a*a)+(a*a*a)<<endl;
    return 0;
}

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

using namespace std;

int main(void) {
    long n, m;
    cin >> n >> m;

    vector<vector<int>> G(n);
    for(int i=0; i<m; i++) {
        long a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
    }

    vector<int> r, d(n, 1e9);

    for(int i=0; i<n; i++) {
        set<int> s;

        auto dfs = [&](auto dfs, int cur) -> int {
            s.insert(cur);

            for(auto &v: G[cur]) {
                if(s.count(v)) {
                    d[cur] = 0;
                    r.push_back(v);
                    return v;
                }
            }

            for(auto &v: G[cur]) {
                int t = dfs(dfs, v);
                if(t == -1) continue;
                if(t == -2) return t;

                d[cur] = d[v] + 1;
                r.push_back(v);
                if(t == cur) return -2;

                return t;
            }

            return -1;
        };

        if(dfs(dfs, i) == -2) {
            vector<int> rr;

            rr.push_back(r.back());
            while(1) {
                int v = rr.back();
                int mi = 1e9;
                for(auto &w: G[v]) {
                    mi = min(mi, d[w]);
                    if(w == r.back())
                        goto r;
                }
                for(auto &w: G[v])
                    if(mi == d[w])
                        rr.push_back(w);
            }
r:
            cout << rr.size() << endl;;
            for(auto &w: rr)
                cout << w+1 << endl;
            return 0;
        }
    }

    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int n,m;
  cin>>n;
  map<string,int>words;
  for(int i=0;i<n;i++){
  	string x;
  	cin>>x;
  	words[x]++;
  }
  cin>>m;
  for(int i=0;i<m;i++){
  	string x;
  	cin>>x;
  	words[x]--;
  }
  map<string,int>::iterator it;
  int best = 0;
  for(it=words.begin();it!=words.end();it++){
  	if(it->second>best){
  		best=it->second;
  	}
  }
  cout<<best<<endl;
}




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

void solve(long long N, long long M){
    ll ret = (N)*(N-1)/2 + M*(M-1)/2;
    printf("%lld\n",ret);

}

// 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 N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    solve(N, M);
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N;
    cin >> N;
    vector<pll> P(N);
    REP(i,0,N) {
        ll x, l;
        cin >> x >> l;
        P[i].first = x + l;
        P[i].second = x - l;
    }

    ASC(P);
    ll cnt = 1, k = 0;
    REP(i,1,N) {
        if(P[k].first <= P[i].second) {
            k = i;
            ++cnt;
        }
    }
    PR(cnt);

    return 0;
}

/*



*/

Measured memory_bytes: 4784
// Problem : A - Payment
// Contest : AtCoder - AtCoder Beginner Contest 173
// URL : https://atcoder.jp/contests/abc173/tasks/abc173_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<long,long> pl;
typedef pair<ll,ll> pll;
typedef vector<long> vl;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vl> vvl;
typedef vector<vb> vvb;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll,ll> umll;

#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define REV(i,a,b) for(long long i=a;i>=b;i--)
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define tc ll tests;cin>>tests;while(tests--)
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define coutv(v) for(auto it: (v))cout<<it<<" ";newl;
#define cout2d(v) for(auto it: (v)) {for(auto j:it) cout<<j<<" ";newl;}
#define cinv(v,n) vll (v)(n);FOR(i,0,(n)){cin>>v[i];}
#define cinvg(v,n) (v).resize(n);FOR(i,0,(n)){cin>>v[i];}
#define cin2d(v,n,m) vvll (v)(n,vll(m,0));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define cin2dg(v,n,m) (v).resize(n,vll(m));FOR(i,0,n){FOR(j,0,m){cin>>v[i][j];}}
#define newl cout<<"\n"
#define mod 1000000007
#define INF LLONG_MAX/2

int main()
{
    io;
    ll n;
    cin>>n;
    cout<<(1000-n%1000)%1000;
    return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>

#define B_NUM 4
#define F_NUM 3
#define R_NUM 10

int
main(void)
{
	int i, n, b, f, r, v;
	char sha[B_NUM+1][F_NUM+1][R_NUM+1] = {};

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d%d%d%d", &b, &f, &r, &v);
		sha[b][f][r] += v;
	}

	for (b = 1; b <= B_NUM; b++) {
		for (f = 1; f <= F_NUM; f++) {
			for (r = 1; r <= R_NUM; r++)
				printf(" %d", sha[b][f][r]);
			printf("\n");
		}
		if (b < B_NUM)
			printf("####################\n");
	}

	return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
int main() {
  long long x, k, d; cin >> x >> k >> d;
  if(x < 0) {
    if(x /d *-1 >= k) {
      cout << (x + k * d)  *-1 << endl;
    }
    else {
      if((k + x/d) %2 == 0) {
        cout << (x + (x /d *d *-1)) *-1 << endl;
      }
      else {
        cout << x + ((x /d -1) *d *-1) << endl;
      }
    }
  }
  else {
    if(x /d >= k) {
      cout << x - k * d << endl;
    }
    else {
      if((k - x /d) %2 == 0) {
        cout << x - (x /d *d) << endl;
      }
      else {
        cout << (x - ((x /d +1) *d)) *-1 << endl;
      }
    }
  }
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int a;
int d = 1;
int main(){
	cin >> a;
	if (a == 2){
		int b;
		int c;
		cin >> b >> c;
		for (int i = 0; i < 100000001; i++){

			if (b % d == 0 && c % d == 0){
				cout << d << endl;
				d++;
			}
			else d++;
		}
	}
	if (a == 3){
		int f;
		int g;
		int h;
		cin >> f >> g>> h;
		for (int i = 0; i < 100000001; i++){
			if (f % d == 0 && g % d == 0 && h % d == 0){
				cout << d << endl;
				d++;
			}
			else d++;
		}

	}


	return 0;
}


Measured memory_bytes: 3096
import sys
def sign(x):
    if x>0: s=1
    elif x==0: s=0
    else: s=-1
    return s

def f(p1,p2,p3):
    s = sign((p3[1]-p1[1])*(p2[0]-p1[0])-(p2[1]-p1[1])*(p3[0]-p1[0]))
    return s

for s in sys.stdin:
    D =map(float, s.split(","))
    p1=D[0:2]; p2=D[2:4]; p3=D[4:6]; p4=D[6:8]
    x = f(p1,p3,p2) != f(p1,p3,p4) and f(p2,p4,p1) != f(p2,p4,p3)
    print ["NO","YES"][x]

Measured memory_bytes: 4260
def main():
    N = int(input())
    H = list(map(int, input().strip().split()))
    
    max_move = 0
    n_move = 0
    for i in range(N-1):
        if H[i] >= H[i+1]:
            n_move += 1
        else:
            n_move = 0
        max_move = max(n_move, max_move)
    print(max_move)


if __name__ == "__main__":
    main()


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

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
bool comp(pair<LL,LL> & a,pair<LL,LL> & b)
{
	return (a.second < b.second);
}
int main() {
	// #ifndef ONLINE_JUDGE
 //    freopen("input.txt", "r", stdin);
 //    freopen("output.txt", "w", stdout);
	// #endif
	off;
	LL n,ai,b;
	cin>>n;
	LL ind = 0;
	vector<pair<LL,LL> > a(n);
	rep(i,0,n)
	{
		cin>>ai>>b;
		if(ai<= b)
		{
			a[ind].first = ai;
			a[ind].second = b;
			ind++;
		}
	}
	sort(ALL(a),comp);
	LL ti = 0;
	LL allocated = 0;
	rep(i,0,ind)
	{
		if((ti + a[i].first) <= a[i].second)
		{
			ti += a[i].first;
			allocated++;
		}
	}
	// cout<<"ind "<<ind<<" ti "<<ti<<"\n";
	// cout<<"allocated "<<allocated<<"\n";
	if(allocated == n)
		cout<<"Yes\n";
	else
		cout<<"No\n";
  	return 0;
}

Measured memory_bytes: 3328
#include<stdio.h>
int main()
{
	long n,t;
	long a,b=0;
	double ans=0;
	scanf("%ld %ld",&n,&t);
	long i;
	for(i=0;i<n;i++)
	{
		scanf("%ld",&a);
		if((a-b)<t)
			ans+=(a-b);
		else
			ans+=t;
		b=a;
	}
	printf("%.0lf\n",ans+t);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const ll mod = 1000000007;
const int MAX_N = 10010;

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

    Graph G(n);
    rep(i, n-1) {
        int a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    queue<int> Q;

    vector<int> c(n);
    vector<int> deg(n);
    rep(i, n) {
        cin >> c[i];
        deg[i] = G[i].size();
        if(G[i].size() == 1) {
            Q.push(i);
        }
    }

    sort(c.begin(), c.end());

    vector<int> ans(n);
    int sum = 0;
    rep(i, n) {
        int v = Q.front();
        Q.pop();
        ans[v] = c[i];
        if(i < n-1) {
            sum += c[i];
        }
        rep(j, G[v].size()) {
            int to = G[v][j];
            deg[to]--;
            if(deg[to] == 1) {
                Q.push(to);
            }
        }
    }

    cout << sum << "\n";

    rep(i, n) {
        cout << ans[i] << " ";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 1024
// Problem : B - Crane and Turtle
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define f first
#define s second

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e6 + 1;

void solve(){
	ll a , b;
	 cin >> a >>b;
	 if(b%2 == 0){
	 	b = b/2;
	 }
	 else {
	 	cout <<"No\n";
	 	return;
	 }
	 ll x = b  - a;
	 ll y = a + a - b;
	 if(x >= 0 && y >=0 ) cout <<"Yes\n";
	 else cout <<"No\n";
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


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

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

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = 998244353;
const LL N = 2e5+1;

int main() {
	fastio();

	LL n;
	cin >> n;

	vector<LL> a(n);
	
	LL sum = 0;
	unordered_map<LL, LL> mp;
	for (auto &e : a) {
		cin >> e;
		mp[e]++;
		sum += e;
	}

	LL q;
	cin >> q;

	while (q--) {
		LL b, c;
		cin >> b >> c;
		
		LL change = 0;
		if (mp.count(b) != 0) {
			LL cnt = mp[b];
			mp.erase(b);
			mp[c] += cnt;

			change = (c-b)*cnt;
		}
		sum += change;
		cout << sum << "\n";

	}
}

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

#define int long long
typedef pair<int, int> P;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;

  vector<int> cnt1(100001, 0);
  vector<int> cnt2(100001, 0);
  int e = 0, o = 0;
  for ( int i = 0; i < N; i++ ) {
    int a;
    cin >> a;
    if ( i%2 ) cnt1[a]++, o++;
    else cnt2[a]++, e++;
    if ( i == N-1 && cnt1[a]+cnt2[a] == N ) {
      cout << N/2 << endl;
      return 0;
    }
  }

  vector<P> a, b;
  for ( int i = 0; i < 100001; i++ ) {    
    a.emplace_back(P{cnt1[i], i});
    b.emplace_back(P{cnt2[i], i});
  }

  sort(a.begin(), a.end(), greater<P>());
  sort(b.begin(), b.end(), greater<P>());

  if ( a[0].second == b[0].second ) {
    cout << min(o-a[0].first+e-b[1].first,
		o-a[1].first+e-b[0].first) << endl;    
  } else {
    cout << o-a[0].first+e-b[0].first << endl;
  }
  
  return 0;
}


Measured memory_bytes: 5220
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;i--)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);i--)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};

string st[20]={
"yotta",
"zetta",
"exa",
"peta",
"tera",
"giga",
"mega",
"kilo",
"hecto",
"deca",
"deci",
"centi",
"milli",
"micro",
"nano",
"pico",
"femto",
"ato",
"zepto",
"yocto"
};

int offset[20]={
24,
21,
18,
15,
12,
9,
6,
3,
2,
1,
-1,
-2,
-3,
-6,
-9,
-12,
-15,
-18,
-21,
-24
};

int main() {
	int n=in();
	string a,b;
	rep(i,n){
		cin>>a>>b;
		bool no=true;
		int off=0;
		rep(i,20){
			if(st[i]==b){
				no=false;
				off=offset[i];
			}
		}
		if(!no){
			cin>>b;
		}
		int i;
		rep0(i,sz(a)){
			if(a[i]=='.'){
				off+=i-1;
				a=a.substr(0,i)+a.substr(i+1);
				break;
			}
		}
		if(i==sz(a)){
			off+=sz(a)-1;
		}
		rep0(i,sz(a)){
			if(a[i]!='0'){
				break;
			}
		}
		if(i<sz(a)){
			a=a.substr(i);
			off-=i;
		}
		if(sz(a)>1)a=a.substr(0,1)+"."+a.substr(1);
		cout<<a<<" * "<<"10^"<<off<<" "<<b<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

semi = []
def dfs(s):
	if int(s) > N:
		return 0

	ret = 1 if all(s.count(c) > 0 for c in "753") else 0
	for c in "753":
		ret += dfs(s + c)
	return ret

print(dfs("0"))


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

bool is_prime(int x){
    if (x==2)
    {
        return true;
    }else if (x<2||x%2==0)
    {
        return false;
    }else
    {
        for (int i = 3; i <sqrt(x)+1 ; i+=2)
        {
            if(x%i==0){
                return false;
            }
        }
        
    }

    return true;
}

int main()
{

    int N,ans=0;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        if(is_prime(tmp)){
            ans++;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3020
n = gets.strip.to_i
as = n.times.map{gets.strip.to_s}
as.sort!
rh = {}
i = 1
num = 1
as.each do |a|
  if a == as[i]
    num+= 1
  else
    rh[a] = num
    num = 1
  end
    i+= 1
end
max_number =  rh.max{ |x, y| x[1] <=> y[1] }[1]

rh.each do |r|
  if max_number == r[1]
    puts r[0]
  end
end


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

using std::pair;
using std::vector;
using std::string;

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

#define fst first
#define snd second
#define pb(a) push_back(a)
#define mp(a, b) std::make_pair(a, b)
#define debug(...) fprintf(stderr, __VA_ARGS__)

template <typename T> bool chkmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> bool chkmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int oo = 0x3f3f3f3f;
const int mo = 1e9 + 7;

string procStatus() {
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}

template <typename T> T read(T& x) {
    int f = 1; x = 0;
    char ch = getchar();
    for(;!isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - 48;
    return x *= f;
}

const int N = 200000;

int n, m;
int x[N + 5], y[N + 5], c[N + 5];

void add(int x, int y) {
    ++ x;
    while(x <= N) {
        c[x] = (c[x] + y) % mo; 
        x += (x & -x);
    }
}
int query(int x) {
    int res = 0;
    ++ x;
    while(x > 0) {
        res = (res + c[x]) % mo;
        x -= (x & -x);
    }
    return res;
}

int main() {
#ifdef Wearry
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif

    read(n), read(m);
    for(int i = 1; i <= n; ++i) read(x[i]);
    for(int i = 1; i <= m; ++i) read(y[i]);

    int l = 1, r = n;
    while(l <= n && x[l] < y[1]) ++ l;
    while(r >= 1 && x[r] > y[m]) -- r;

    if(l > r) return puts("1"), 0;

    vector<int> d;
    vector<pii> vec;

    for(int i = l; i <= r; ++i) {
        int lst = std::upper_bound(y + 1, y + m + 1, x[i]) - y - 1;
        int nxt = std::lower_bound(y + 1, y + m + 1, x[i]) - y;

        d.pb(y[nxt] - x[i]);
        vec.pb(mp(x[i] - y[lst], y[nxt] - x[i]));
    }

    std::sort(d.begin(), d.end());
    std::sort(vec.begin(), vec.end());

    d.erase(std::unique(d.begin(), d.end()), d.end());
    vec.erase(std::unique(vec.begin(), vec.end()), vec.end());

    add(0, 1);
    for(int i = 0; i < (int) vec.size(); ++i) {
        int j = i;
        while(j + 1 < (int) vec.size() && vec[j + 1].fst == vec[i].fst) {
            ++ j;
        }
        for(int k = j; k >= i; --k) {
            int id = std::lower_bound(d.begin(), d.end(), vec[k].snd) - d.begin() + 1;
            add(id, query(id-1));
        }
        i = j;
    }
    printf("%d\n", query(N));

    return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>

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

using namespace std;

struct Edge {
    long long w;
    int to;

    Edge(){}
    Edge(long long w, int to){
        this->w = w;
        this->to = to;
    }
};

int main(){
    int n; cin >> n;
    vector<vector<Edge> > array(n, vector<Edge>());
    vector<int> ans(n,-1);
    int from,to;
    long long w;
    for(int i = 0; i < n-1; i++){
        cin >> from >> to >> w;
        array[from-1].push_back(Edge(w,to-1));
        array[to-1].push_back(Edge(w,from-1));
    }
    queue<int> q;
    q.push(0);
    ans[0] = 0;
    while(!q.empty()){
        from = q.front();
        q.pop();
        // cout << from << endl;
    // for(int i = 0; i < n; i++){
    //     cout << ans[i] << " ";
    // }
    // cout << endl;
        // ans[from] = 0;
        for(int i = 0; i < array[from].size();i++){
            Edge e = array[from][i];
            if(ans[e.to] != -1)
                continue;
            if(e.w%2 == 0){
                ans[e.to] = ans[from];
            } else {
                // cout << "...." << endl;
                // cout << ans[from] << endl;
                ans[e.to] = 1 - (ans[from]);
                // cout <<ans[e.to] << endl;
            }
            q.push(e.to);
        }
    }
    for(int i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
    // for(int i = 0; i < n; i++){
    //     cout << ans[i] << " ";
    // }
    // cout << endl;
}



Measured memory_bytes: 8320
#include<cstdio>
typedef long long ll;
const int maxn=4;
int value[maxn+10];
ll cost[maxn+10],n,ans;
void prework(){
	value[1]=1; value[2]=2; value[3]=4; value[4]=8;
}
int main(){
	prework();
	for(int i=1;i<=maxn;++i) scanf("%lld",&cost[i]);
	scanf("%lld",&n); n<<=2;
	for(int i=maxn;i>=1;--i){
		bool goodthan=0;
		for(int j=1;j<i;++j) if(value[i]*cost[j]<value[j]*cost[i]){
			goodthan=1; break;
		}
		if(goodthan) continue;
		ans+=n/value[i]*cost[i]; n%=value[i];
	}
	printf("%lld",ans); return 0;
}

Measured memory_bytes: 128
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}


fn main() {
    input! {
        N: u32,
        A: [i64; N],
    }
    let mut res:i64 = 0;
    for i in 0..N {
        if i % 2 == 1 {
            res = res - A[i as usize];
        } else {
            res = res + A[i as usize];
        }
    }
    print!("{} ", res);
    for i in 0..N-1 {
        res = (A[i as usize] - res / 2) * 2;
        print!("{} ", res);
    }
    println!("");
}



Measured memory_bytes: 5372
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> vec(n,0);
  for(int i=1;i<n;i++){
    int a; cin >> a;  vec.at(a-1)++;
  }
  for(int x : vec) cout << x << endl;
 
    
}

Measured memory_bytes: 3996
A, B, M = map(int,input().split())
reizo = list(map(int, input().split()))
densi = list(map(int, input().split()))

min_r = min(reizo)
min_d = min(densi)
max_all = min_r + min_d

for i in range(M):
  x, y, c = map(int,input().split())
  discount = reizo[x - 1] + densi[y -1] - c
  if max_all > discount:
    max_all = discount

print(max_all)

Measured memory_bytes: 18736
use proconio::input;
use std::cmp::{max, min};

const MAX_L: u32 = 100_000;
const BASE_SIZE: usize = 1 << 10;

fn main() {
    input! {
        n: usize,
        vw: [(u32, u32); n],
        q: usize,
        vl: [(usize, u32); q],
    }
    let dp = make_dp(&vw);
    for vlq in vl {
        println!("{}", calc(&vw, vlq.0 - 1, vlq.1, &dp));
    }
}

fn make_dp(vw: &Vec<(u32, u32)>) -> Vec<Vec<u32>> {
    let mut dp = Vec::<Vec<u32>>::new();

    dp.push(
        (0..=MAX_L)
        .map(|i| if i < vw[0].1 { 0 } else { vw[0].0 })
        .collect()
    );

    let n = min(vw.len(), BASE_SIZE - 1);
    for c in 1..n {
        let p = (c - 1) / 2;
        dp.push(
            (0..=MAX_L)
            .map(|i| {
                let w = vw[c].1;
                let v = if i < w { 0 } else { dp[p][(i - w) as usize] + vw[c].0 };
                max(dp[p][i as usize], v)
            })
            .collect()
        );
    }

    dp
}

fn calc(
    vw: &Vec<(u32, u32)>,
    u: usize, 
    l: u32,
    dp: &Vec<Vec<u32>>
) -> u32 {
    if u < dp.len() {
        dp[u][l as usize]
    } else {
        let p = (u - 1) / 2;
        let w = vw[u].1;
        let pv1 = calc(vw, p, l, dp);
        let pv2 = if l < w { 0 } else { calc(vw, p, l - w, dp) + vw[u].0 };
        max(pv1, pv2)
    }
}


Measured memory_bytes: 410956
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  ll i,N,K,M=0,mid;
  cin>>N;
  vector<ll> v(N),cpv(N);
  string ss;
  rep(i,N){
    cin>>v[i];
    cpv[i]=v[i];
    if(M<v[i]){
      M=v[i];
    }
  }
  vsort(cpv);
  if(cpv[N-2]==cpv[N-1]){
    rep(i,N){
      cout<<M<<endl;
    }
  }else{
    rep(i,N){
      if(v[i]!=M){
        cout<<M<<endl;
      }else{
        cout<<cpv[N-2]<<endl;
      }
    }
  }
  return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = -1;
    for(int i = 1; i <= 1010; i++){
        if(floor(i * 0.08) == a){
            if(floor(i * 0.10) == b){
            	ans = i;
            	break;
            }
        }
    }

    cout << ans << endl;
}

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

int main() {
  unsigned long M;
  unsigned long long ans = 0ul;
  unsigned long long sum = 0ull;
  std::cin >> M;
  std::vector<unsigned long long> d(M);
  std::vector<unsigned long long> c(M);
  for (auto i = 0ul; i < M; ++i) { std::cin >> d[i] >> c[i]; }

  for (auto i = 0ul; i < M; ++i) {
    auto mul = d[i] * c[i];
    ans += c[i] - 1;
    while (mul >= 10) {
      ans += mul / 10;
      mul = mul / 10 + mul % 10;
    }
    d[i] = mul;
  }

  for (auto i = 0ul; i < M; ++i) {
    sum += d[i];
  }
  ans += M - 1;
  while (sum >= 10) {
    ans += sum / 10;
    sum = sum / 10 + sum % 10;
  }

  std::cout << ans << std::endl;

  return 0;
}


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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB emplace_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





//int dx[]={-1,1,0,0};
//int dy[]={0,0,-1,1};
//int dx[]= {-1,0,1,-1,1,-1,0,1};
//int dy[]= {1,1,1,0,0,-1,-1,-1};






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int n;
    cin >> n;
    cout << n/2+(n & 1);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	ll a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n, greater<ll>());
	ll ans = a[0];
	rep(i, (n - 2) / 2) ans += a[i + 1] * 2;
	if (n % 2) ans += a[n / 2];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5220
#include<stdio.h>

int main(){
  int i,j,A[100],N,count=0,temp=0;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }

  for(i=0;i<N;i++){
    for(j=N-1;j>=i+1;j--){
      if(A[j] < A[j-1]){
	temp=A[j];
	A[j]=A[j-1];
	A[j-1]=temp;
	count++;
      }
      
    }
  }
  
  for(i=0;i<N;i++){
    if(i > 0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2140
<?php

$s = fgets(STDIN);

$a = [];
$z = [];
for($i=0; $i<strlen($s); $i++){
  if ($s[$i] == 'A'){
    array_push($a, $i);
  } else if ($s[$i] == 'Z'){
    array_push($z, $i);
  }
}

echo max($z)-min($a)+1;

?>

Measured memory_bytes: 14840
N = int(input())
a_list = list(map(int, input().split()))
q, r = divmod(N, 2)
n = q + r
count = 0

for i in range(1,n+1):
    #print(i)
    if a_list[2*i - 2]%2 == 1:
        count += 1
    #print(2*i-1, count)
print(count)

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

int main() {
  std::string x(10, ' ');
  scanf("%s", &x[0], x.size());
  int year = std::stoi(x.substr(0, 4));
  int month = std::stoi(x.substr(5, 7));
  if (year > 2019) {
    printf("TBD");
    return 0;
  }
  if (month >= 5) {
    printf("TBD");
    return 0;
  }
  printf("Heisei");
}


Measured memory_bytes: 256