akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
int main(){
    string S;
    getline(cin,S);
    int K; cin >> K;

    int N = S.length();
    vector<int> V;
    REP(i,N){
        if (S[i] != 'a'){
            V.PB('z' + 1 - S[i]);
        }else{
            V.PB(0);
        }
    }


    REP(i,N-1){
        if (K >= V[i]){
            K = K - V[i];
            V[i] = 0;
        }
    }


    vector<char> ans;
    REP(i,N-1){
        if (V[i] == 0) ans.PB('a');
        else ans.PB(S[i]);
    }
    //PRINTD(K);
    if (K > 0){
        K = K % 26;
        REP(i,K){
            if (S[N-1] == 'z') S[N-1] = 'a';
            else S[N-1]++;
        }
    }

    ans.PB(S[N-1]);

    REP(i,N){
        cout << ans[i];
    }

    cout << "\n";


}


Measured memory_bytes: 1144
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <set>
#include <map>

using namespace std;

long dp[1<<16];
long score[1<<16];
int N;
long a[16][16];
const long INF = 1e+15;

typedef pair<int, int> P;
P p[1<<16];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            cin >> a[i][j];
        }
    }
    for(int i = 0; i < (1<<N); i++){
        for(int j = 0; j < N; j++){
            int m = 1<<j;
            for(int k = 0; k < j; k++){
                int n = 1<<k;
                //cout << i << ' ' << m << ' ' <<  n << endl;
                if((i&m) && (i&n)) {
                    score[i] += a[j][k];
                    //cout << 'H' << endl;
                }
            }
        }
        dp[i] = score[i];
       // cout << score[i] << endl;
    }
    
    for(int i = 0; i < (1<<N); i++){
        vector<int> v;
        for(int j = 0; j < N; j++){
            int m = 1<<j;
            if(i&m) v.push_back(j);
        }
        int c = v.size();
        
        for(int j = 0; j < (1<<c); j++){
            int l = 0;
            int r = 0;
            for(int k = 0; k < c; k++){
                int n = (1<<v[k]);
                int p = (1<<k);
                if(j&p) l += n;
                else r += n;
            }
           // cout << i << ' ' << l << ' ' << r << endl;
            dp[i] = max(dp[i], dp[l]+dp[r]);
        }
        //cout << dp[i] << endl;
    }
    //cout << dp[3] << endl;
    cout << dp[(1<<N)-1] << endl;
}

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

using namespace std;

int main () {
	int t, d, s;
	cin>>d>>t>>s;
	if (s * t >= d) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;	

}


Measured memory_bytes: 3512
#include <iostream>
using namespace std;
int main ()
{
    //input data
    int N;

    //stream
    cin >> N;

    string name;

    if(N <= 999){
name = "ABC";
    }else{
name = "ABD";
    }

    //calculation 
      //output
    cout << name << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define Rep(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define Repr(i, b, e) for(int (i) = (b) - 1; (i) >= (e); --(i))
#define Print(x) cout << (x) << endl 
#define Min2(a, b) ((a) < (b)) ? (a) : (b)
#define Max2(a, b) ((a) > (b)) ? (a) : (b)

typedef long long ll;

using namespace std;

int N, A[100000];
ll DP[100000][2];

int main(){
    cin >> N;
    Rep(i, 0, N) cin >> A[i];
    DP[1][0] = A[0] + A[1];
    DP[1][1] = -A[0] - A[1];
    Rep(i, 2, N){
        DP[i][0] = Max2(DP[i - 1][0] + A[i], DP[i - 1][1] + A[i]); 
        DP[i][1] = Max2(DP[i - 1][0] - 2 * A[i - 1] - A[i], DP[i - 1][1] + 2 * A[i - 1] - A[i]); 
    }
    ll m = Max2(DP[N - 1][0], DP[N - 1][1]);
    cout << m << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define vii vector<int,int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define umii unordered_map<int,int>
#define mii map<int,int>
#define pii pair<int,int>
#define rep(i,a,b) for(int i=a ; i<b ; i++)

const long long MOD = 1e9+7;

void solve() {
    ll d,t,s;
    cin >> d >> t >> s;
    double t1=(double)d/(double)s;
    if(ceil(t1)<=t)
        cout << "Yes";
    else
        cout << "No";
}

signed main() 
{
    int t=1;
    // cin>>t;
    for(int i=1; i<=t; i++) {
        solve();
    }
}

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

using namespace std;

int main()
{
    int64_t N;
    vector<int64_t> A, B;
    cin >> N;
    A.resize(N);
    for (int64_t i = 0; i < N; ++i) {
        cin >> A[i];
    }
    B.resize(N);
    for (int64_t i = 0; i < N; ++i) {
        B[A[i] - 1] = i + 1;
    }
    for (int64_t i = 0; i < N - 1; ++i) {
        cout << B[i] << " ";
    }
    cout << B[N - 1] << endl;

    return 0;
}


Measured memory_bytes: 2432
N = int(input())
word_list = []

for i in range(N):
    word = input()
    word_list.append(word)
    if i > 0:
        if word_list[i - 1][-1] != word_list[i][0] or word_list.count(word) > 1:
            print("No")
            break
else:
    print("Yes")

Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int a,b,c;
	int s;
	
	do{
		scanf("%d %d %d",&a,&b,&c);
	}while((a<1 || 100<a) || (b<1 || 100<b) || (c<1 || 100<c));
	
	if((a==b+c) ||(b==a+c) ||(c==b+a)){
		puts("Yes");
	}else{
		puts("No");
	}
	
	
	return 0;
}

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

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

    long double N, A, B, C, D, E;

    cin >> N >> A >> B >> C >> D >> E; 

    long double min = A;

    if(min > B)
    {
        min = B;
    }

    if(min > C)
    {
        min = C;
    }

    if(min > D)
    {
        min = D;
    }

    if(min > E)
    {
        min = E;
    }

    long int count = ceil(N / min);

    cout << count + 4;
}

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

int main() {
   int n;
   cin >> n;
   int p[60],q[60];
   rep(i,n)
   cin >> p[i];
   rep(i,n)
   q[i]=p[i];
   sort(q,q+n);
   int cnt=0;
   rep(i,n){
      if(q[i]!=p[i])
      cnt++;
   }
   cout << (cnt<=2 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
S = input()
count = 0
l = [0]*2019
l[0] = 1
mod = 2019
tmp = 0

for i in range(1,len(S)+1):
    tmp = (tmp + int(S[len(S)-i])*pow(10,i-1,mod))%mod
    l[tmp] += 1
    

for j in range(2019):
    if l[j] >= 2:
        count += l[j]*(l[j]-1)//2

print(count)


Measured memory_bytes: 9224
#include <iostream>

using namespace std;

int main(){
   int n = 0;
   cin >> n;
   int pos = 1;
   int res = 0;
   while(n > 0){
     int num = 0;
     cin >> num;
     if(((num % 2) == 1) && (pos % 2 == 1)){
          res++;
     }
     n--;
     pos++;
   }
   cout << res << "\n";
   return 0; 
}

Measured memory_bytes: 3632
N=input().rstrip().split(" ")
lst=input().rstrip().split(" ")
int_lst=[]
N_sum=0

for i in range(len(lst)):
    int_lst.append(int(lst[i]))
int_lst.sort(reverse=True)

for i in range(len(lst)-1):
  N_sum+=int(int_lst[i+1])

if int_lst[0] < N_sum:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;

void solve(long long N, vector<long long> A){
	vector<long long> a(N-1), b(N-1);
	SORT(A);
	ll c = N;
	rep(i,N) {
		if (A[i]>0) {
			c = i;
			break;
		}
	}
	ll cnt = 0;
	for (int i=1; i<=min(c-1,N-2); i++) {
		a[cnt] = A[N-1];
		b[cnt] = A[i];
		A[N-1] = a[cnt]-b[cnt];
		cnt++;
	}
	for (int i=max(c,1LL); i<N-1; i++) {
		a[cnt] = A[0];
		b[cnt] = A[i];
		A[0] = a[cnt]-b[cnt];
		cnt++;
	}
	a[N-2] = A[N-1];
	b[N-2] = A[0];
	cout << A[N-1]-A[0] << endl;
	rep(i,N-1) {
		cout << a[i] << " " << b[i] << endl;
	}
}

int main(){	
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, A);
	return 0;
}



Measured memory_bytes: 4992
#include<stdio.h>
#define MAX 100000

int partition(int,int);


int n;
int A[MAX];

int main(){

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


  b=partition(0,n-1);

  for(i=0;i<n;i++){
    if(i>0){
      printf(" ");
    }
    if(i==b){
      printf("[");
    }
      printf("%d",A[i]);
      if(i==b){
        printf("]");

      }   }
      printf("\n");
      return 0;
}

int partition(int p,int r){
  int a,i,j,k;
  i=p-1;
  a=A[r];
  for(j=p;j<r;j++){
    if(a >= A[j]){
      i++;
      k=A[i];
      A[i]=A[j];
      A[j]=k;
    }
  }
  k=A[i+1];
  A[i+1]=A[r];
  A[r]=k;
  return i+1;
}



Measured memory_bytes: 2144
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007

int main()
{
	string o, e;
	cin >> o >> e;
	for(int i = 0; i < e.length(); i++){
		cout << o[i] << e[i];
	}
	if(o.length() > e.length()){
		cout << o[o.length() - 1];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int s1s2s3;
  cin >> s1s2s3;
  cout << s1s2s3/100
  +s1s2s3/10-(s1s2s3/100)*10
  +s1s2s3/1-(s1s2s3/100)*100-(s1s2s3/10-(s1s2s3/100)*10) *10
  << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CBuildStairs solver = new CBuildStairs();
        solver.solve(1, in, out);
        out.close();
    }

    static class CBuildStairs {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int a[] = new int[n];
            boolean ans = true;
            for (int i = 0; i < n; i++) a[i] = in.nextInt();
            for (int i = n - 1; i >= 1; i--) {
                if (a[i] >= a[i - 1]) {
                    continue;
                }
                if (a[i - 1] - a[i] == 1) {
                    a[i - 1]--;
                    continue;
                }
                ans = false;
                break;

            }
            out.println(ans == true ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 39708
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int compare_string(const void *a, const void *b) {
  return *(char *)a-*(char *)b;
}


int main(){
	
	int i,j,k=0,count;
	
	char S[100010];
	scanf("%s",S);
	
	
	qsort(S,strlen(S),sizeof(char),compare_string);
	
	for(i=0;i<=25;i++){
		
		count=0;
		
		for(j=k;j<strlen(S);j++){
			if(S[j]=='a'+i){
				count++;
				k=j+1;
				break;
			}
		}
		if(count==0){
			printf("\n%c\n\n",'a'+i);
			return 0;
		}
	}
	
	printf("\nNone\n\n");
	
	return 0;
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

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

  ll N;
  cin>>N;
  map<ll,ll> cnt;
  rep(i,1<<N){
    ll s;
    cin>>s;
    cnt[s]++;
  }
  vector<P> ps;
  for(P p : cnt){
    ps.push_back(P(p.fi,p.se));
  }
  sort(all(ps)); reverse(all(ps));
  priority_queue<ll> que;
  que.push(1<<N);
  rep(i,ps.size()){
    ll sz=ps[i].se;
    if(que.size()<sz){
      cout<<"No"<<endl;
      return 0;
    }
    vector<ll> st;
    while(sz>0){
      ll v=que.top(); que.pop();
      for(ll j=1;j<v;j<<=1)st.push_back(j);
      sz--;
    }
    rep(j,st.size())que.push(st[j]);
  }
  cout<<"Yes"<<endl;

  return 0;
}


Measured memory_bytes: 22772
#include <iostream>
#include <string>
int main()
{
    std::string S;
    std::cin>>S;
    if(S[2]==S[3] && S[4]==S[5]){
    std::cout<<"Yes"<<std::endl;
    }
    else {
    std::cout<<"No"<<std::endl;
    }
}

Measured memory_bytes: 3560
from bisect import bisect_right
n,m,k = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
cumA, cumB = [0], [0]

for i in range(len(A)):
    cumA.append(cumA[-1]+A[i])
for i in range(len(B)):
    cumB.append(cumB[-1]+B[i])

ans = 0
for i in range(n+1):
    tmp = cumA[i]
    if tmp > k:
        break
    else:
        rest = k-tmp
        ans = max(ans, i+bisect_right(cumB, rest)-1)
print(ans)

Measured memory_bytes: 132784
n=int(input())
imax=0
amax=0
amax2=amax
for i in range(n):
    ai=int(input())
    if amax<ai:
        adummy=amax
        amax=ai
        imax=i
        amax2=adummy
    elif amax2<ai:
        amax2=ai
if imax==0:
    print(amax2)
    for i in range(1,n):
        print(amax)
elif imax==n-1:
    for i in range(n-1):
        print(amax)
    print(amax2)
else:
    for i in range(imax):
        print(amax)
    print(amax2)
    for i in range(n-imax-1):
        print(amax)
    


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int n; ll m;
	cin >>n >>m;

	repr(i, m / n, 1){
		if((m - (i * (n-1))) % i == 0){
			cout << i <<"\n"; return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;

const int M = 3e3;
double dp[M][M], p[M];

int main()
{

	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%lf", &p[i]);
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i + 1][j + 1] += dp[i][j] * p[i];
			dp[i + 1][j]     += dp[i][j] * (1 - p[i]);
		}
	}
	double ans = 0;
	for (int j = (n + 1) / 2; j <= n; j++) {
		ans += dp[n][j];

	}
	printf("%.10lf\n", ans);

	return 0;
}


Measured memory_bytes: 68992
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
using namespace std;
typedef long long LL;

string s;
LL n;

int main(){
	ios::sync_with_stdio(false);
	cin >> s; n = s.length();
	for(LL i = 0;i < n;i ++) cout << (s[i] == 'P' ? 'P' : 'D'); cout << '\n';
	return 0;
}

Measured memory_bytes: 3744
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
int main()
{
    int n, k, d, x;
    cin >> n >> k;
    vector<vector<int>> v(n, vector<int>(k, 0));
    for (int i = 0; i < k; i++)
    {
        cin >> d;
        for (int j = 0; j < d; j++)
        {
            cin >> x;
            x--;
            v[x][i]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        int flag = 0;
        for (int j = 0; j < k; j++)
        {
            if (v[i][j] != 0)
            {
                flag = 1;
                break;
            }
        }
        if (flag == 0)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int D = sc.nextInt();

		int range = 2 * D + 1;

		int ans = N / range;
		if (N % range != 0) {
			ans ++;
		}
		System.out.println(ans);
	}


}

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

int main(){
        
        int a,b,c;
        
        cin>>a>>b>>c;
        
        if( a > b ) swap (a,b);
        if( b > c ) swap (b,c);
        if( a > b ) swap (a,b);
        
        cout<<a<<" "<<b<<" "<<c<<endl;
        
        return 0;
         
}


Measured memory_bytes: 3080
using System;
using System.Linq;

namespace id_0642cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var vsa = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int[] seq = new int[vsa.Length];
            seq[0] = vsa[0];
            for(int i = 1; i < vsa.Length; i++)
            {
                if (vsa[i] == 0) { seq[i] = 0; }
                else { seq[i] = seq[i - 1]+1; }
            }
            Console.WriteLine(seq.Max() + 1);
        }
    }
}



Measured memory_bytes: 18332
package main

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

const pi = math.Pi

var mod int = pow(10, 9) + 7
var Umod uint64 = 1000000007
var ans, cnt, sum int

func main() {
	reader.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	A := make([]int, N)
	B := make([]int, N-1)
	for i := 0; i < N-1; i++ {
		B[i], _ = strconv.Atoi(read())
	}

	A[0] = B[0]
	for i := 1; i < N-1; i++ {
		A[i] = B[i-1]
		if B[i-1] > B[i] {
			A[i] = B[i]
		}
	}
	A[len(A)-1] = B[len(B)-1]
	for i := 0; i < N; i++ {
		ans += A[i]
	}
	fmt.Println(ans)
}

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

var reader = bufio.NewScanner(os.Stdin)

func read() string {
	reader.Scan()
	return reader.Text()
}

func lcm(x, y int) int {
	return (x / gcd(x, y)) * y
}

func gcd(x, y int) int {
	if x%y == 0 {
		return y
	} else {
		r := x % y
		return gcd(y, r)
	}
}

var fac [1000000]int
var finv [1000000]int
var inv [1000000]int

func combination_init() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1

	// invは a^(-1) mod p
	// pをaで割ることを考える

	// p/a*(a) + p%a = p
	// p/a*(a) + p%a = 0          (mod p)
	// -p%a = p/a*(a)             (mod p)
	// -p%a *a^(-1)= p/a          (mod p)
	// a^(-1)= p/a * (-p%a)^(-1)  (mod p)
	// a^(-1) =

	for i := 2; i < 1000000; 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
	}
}

func combination(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[y] * finv[x-y] % mod) % mod
	//return fac[x] / (fac[y] * fac[x-y])
}

func permutation(x, y int) int {
	if x < y {
		return 0
	}
	if fac[0] != 1 {
		combination_init()
	}
	return fac[x] * (finv[x-y] % mod) % mod
	//return fac[x] / fac[x-y]
}

func max(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Max(float64(x[i]), float64(res)))
	}
	return res
}

func min(x ...int) int {
	var res int = x[0]
	for i := 1; i < len(x); i++ {
		res = int(math.Min(float64(x[i]), float64(res)))
	}
	return res
}
func pow(x, y int) int { return int(math.Pow(float64(x), float64(y))) }
func abs(x int) int    { return int(math.Abs(float64(x))) }
func floor(x int) int  { return int(math.Floor(float64(x))) }
func ceil(x int) int   { return int(math.Ceil(float64(x))) }

type SortBy []int

func (a SortBy) Len() int           { return len(a) }
func (a SortBy) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a SortBy) Less(i, j int) bool { return a[i] < a[j] }

type PriorityQueue []int

func (h PriorityQueue) Len() int            { return len(h) }
func (h PriorityQueue) Less(i, j int) bool  { return h[i] < h[j] }
func (h PriorityQueue) Swap(i, j int)       { h[i], h[j] = h[j], h[i] }
func (h *PriorityQueue) Push(x interface{}) { *h = append(*h, x.(int)) }
func (h *PriorityQueue) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define mpr make_pair
typedef pair < int , int > pii;
int n,fa[100005],cnt;
multiset < int > st[100005],con[100005];
map < int , int > ect[100005];
vector < pii > q;
int anscestor(int x){
	if(fa[x]!=x) fa[x]=anscestor(fa[x]);
	return fa[x];
}
int main(){
	scanf("%d",&n);
	int xb,x2,u,v;
	for(xb=0;xb<n*2-2;++xb){
		scanf("%d%d",&u,&v);--u;--v;
		st[u].insert(v);
		st[v].insert(u);
		++ect[u][v];
		++ect[v][u];
		if(ect[u][v]==2) q.push_back(mpr(u,v));
		fa[u]=u;
		fa[v]=v;
	}
	for(xb=0;xb<n;++xb) con[xb].insert(xb);
	set < int >::iterator it;
	map < int , int >::iterator it2;
	while(!q.empty()){
		u=q.back().first;
		v=q.back().second;
		q.pop_back();
		u=anscestor(u);
		v=anscestor(v);
		if(u==v) continue;
		if(con[u].size()+st[u].size()>con[v].size()+st[v].size()) swap(u,v);
		for(it=st[u].begin();it!=st[u].end();++it){
			if(con[v].find(*it)==con[v].end()) st[v].insert(*it);
		}
		for(it=con[u].begin();it!=con[u].end();++it){
			con[v].insert(*it);
		}
		for(it2=ect[u].begin();it2!=ect[u].end();++it2){
			ect[v][it2->first]+=it2->second;
			ect[it2->first][v]+=it2->second;
			if(ect[v][it2->first]==2) q.push_back(mpr(v,it2->first));
		}
		fa[u]=v;
		++cnt;
	}
	if(cnt==n-1) printf("YES"); else printf("NO");
	return 0;
}

Measured memory_bytes: 125944
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

from collections import defaultdict, Counter
from math import pi, sqrt
from bisect import bisect_left, bisect_right

def req_S(h, w):
    tmp_s = []
    a_w = w
    for a_h in range(1, h):
        # b, cが横のパターン
        b_h = (h-a_h)//2
        c_h = h-b_h-a_h
        b_w, c_w = w, w
        S = [a_w*a_h, b_w*b_h, c_w*c_h]
        tmp_s.append(max(S)-min(S))
        # b, cが縦のパターン
        b_w = w//2
        c_w = w-b_w
        b_h, c_h = h-a_h, h-a_h
        S = [a_w*a_h, b_w*b_h, c_w*c_h]
        tmp_s.append(max(S)-min(S))
    return tmp_s

#### START
h, w = map(int,input().split())

all_S = req_S(h, w) + req_S(w, h)
print(min(all_S))


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

using namespace std;

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

	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	sort(a, a+n);

	int count = 1;

	for(int i=1;i<n;i++){
		if(a[i] != a[i-1]){
			count++;
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}


void MAIN() {
    LL N;
    scanf("%lld", &N);
    LL ans = 0;
    for (LL t=1; t*t<=N; t++) {
	if ((N-t) % t == 0) {
	    LL m = (N-t)/t;
	    if (m >= 1 && N/m == N%m) {
		ans += m;
	    }
	}
    }
    printf("%lld\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
from functools import reduce

def cmb(n, r):
    r = min(r, n - r)
    if r == 0:
        return 1
    over = reduce(lambda a, b: a * b % mod, range(n, n - r, -1))
    under = reduce(lambda a, b: a * b % mod, range(1, r + 1))
    return over * pow(under, mod-2, mod) % mod

x, y = [int(i) for i in input().split()]
if (x + y) % 3 or x > 2 * y or y > 2 * x:
    print(0)
else:
    mod = 10**9 + 7
    print(cmb((x + y) // 3, (2 * x - y) // 3))

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,x) for (register int (i)=(1);(i)<=(x);(i)++)
#define repd(i,x) for (register int (i)=(x);(i)>=(1);(i)--)
#define foreach(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
using namespace std;
int n,i,j,a[100005],x,mod=998244353,ans=1;
int main()
{
	scanf("%d",&n);
	rep(i,n){
		scanf("%d",&x);
		if((x==0)!=(i==1)){
			puts("0");
			return 0;
		} 
		a[x]++;
	}
	rep(i,n){
		rep(j,a[i]) ans=1ll*ans*a[i-1]%mod;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e8+7;


int main() {
    
    int n, k;
    scanf("%d%d",&n,&k);
    
    string s;
    getline(cin, s);
    getline(cin, s);
    
    vii segments;
    
    char prev = '2';
    int start = -1;
    
    for(int i = 0; i < n; ++i) {
        char c = s[i];
        if(c != prev && c == '0') {
            start = i;
        } else if(c != prev && c == '1' && start != -1) {
            segments.push_back(ii(start, i-1));
        }
        prev = c;
    }
    
    if(s[n-1] == '0') {
        segments.push_back(ii(start, n-1));
    }
    
    
    if((int)segments.size() <= k) {
        cout << n << endl;
        return 0;
    }
    
    int ans = 0, run = 0;
    int i1 = 1, i2 = k;
    
    ans = max(ans, run);
    
    debug() << imie(segments);
    
    while(i2 < (int)segments.size()-1) {
        run = segments[i2+1].first - segments[i1-1].second - 1;
        ans = max(ans, run);
        i1++; i2++;
    }
    
    ans = max(ans, segments[k].first);
    ans = max(ans, n-segments[(int)segments.size()-1-k].second-1);
    
    cout << ans << endl;
    
    return 0;
}




Measured memory_bytes: 1020
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
signed main()
{
    SPEED;
    int k,n;
    cin>>k>>n;
    int a[n],mn=k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    mn=a[n-1]-a[0];
    for(int i=1;i<n;i++)
    {
        mn=min(mn,k-a[i]+a[i-1]);
    }
    cout<<mn;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

ll mod = 1000000007;

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

ll inv(ll x){
  ll res = 1;
  ll k = mod - 2;
  ll y = x;
  while(k){
    if(k&1)res = (res*y)%mod;
    y = (y*y) % mod;
    k /= 2;
  }
  return res;
}


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

  int a;
  cin >> a;
  cout << a + a*a + a*a*a << endl;
}

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

int intcmp(const void *a, const void *b) {
	return *(int *)a - *(int *)b;
}

int main() {
	int i, N, T=0;
	scanf("%d", &N);
	int L[2 * N];
	for (i = 0; i < 2 * N; i++) {
		scanf("%d", &L[i]);
	}

	qsort(L, 2 * N, sizeof(int), intcmp);
	for (i = 0; i < N; i++) {
		T += L[2 * i];
	}
	printf("%d\n", T);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        List<Integer> a = new ArrayList<>();
        List<Integer> b = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a.add(sc.nextInt());
            b.add(sc.nextInt());
        }
        Collections.sort(a, Comparator.reverseOrder());
        int aMax = a.get(0);
        Collections.sort(b, Comparator.reverseOrder());

        int ans = 0;
        for (int i : b) {
            if (i < aMax || h <= 0) {
                break;
            }
            h -= i;
            ans++;
        }
        if (h <= 0) {
            System.out.println(ans);
            return;
        }
        if (h % aMax == 0) {
            ans += h / aMax;
        } else {
            ans += h / aMax + 1;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 92644
/*
数列の逆順
2018/02/01
*/

#include<stdio.h>
#include<stdlib.h>

int main(void){
  int a[100];/*数列の配列*/
  int i;
  int n;

  scanf("%d",&n);

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


Measured memory_bytes: 2076
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int[] h=ir.nextIntArray(10);
 Arrays.sort(h);
 for(int i=0;i<3;i++) out.println(h[9-i]);
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}
 
 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}
 
 private boolean isSpaceChar(int c){return !(c>=33&&c<=126);}
 
 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}
 
 public boolean hasNext(){skip(); return hasNextByte();}
 
 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }
 
 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }
 
 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public double nextDouble(){return Double.parseDouble(next());}

 public int[] nextIntArray(int n){
  int[] a=new int[n];
  for(int i=0;i<n;i++) a[i]=nextInt();
  return a;
 }

 public long[] nextLongArray(int n){
  long[] a=new long[n];
  for(int i=0;i<n;i++) a[i]=nextLong();
  return a;
 }

 public char[][] nextCharMap(int n,int m){
  char[][] map=new char[n][m];
  for(int i=0;i<n;i++) map[i]=next().toCharArray();
  return map;
 }
}
}

Measured memory_bytes: 24252
#  Ordinary Number
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(1, N-1):
    if A[i-1]< A[i]< A[i+1] or A[i+1] < A[i] < A[i-1]:
        count = count + 1
    else:
        pass

print(count)

Measured memory_bytes: 3060
n=int(input())
s=input()
dp=[[0]*(n+1) for i in range(n+1)]
for i in range(n-1,-1,-1):
    for j in range(n-1,i,-1):
        if s[j]==s[i] and dp[i+1][j+1]+1<=j-i:
            dp[i][j]=dp[i+1][j+1]+1
ans=0
for i in range(n):
    for j in range(n):
        ans=max(ans,dp[i][j])
print(ans)

Measured memory_bytes: 270164
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    A, B, C, D = read_values()

    dp = [[0 for _ in range(D - B + 1)] for _ in range(C - A + 1)]
    dp[0][0] = 1

    for i in range(C - A):
        dp[i + 1][0] = dp[i][0] * B % mod
    for j in range(D - B):
        dp[0][j + 1] = dp[0][j] * A % mod

    for i in range(1, C - A + 1):
        for j in range(1, D - B + 1):
            dp[i][j] = (dp[i - 1][j] * (B + j)) % mod + (dp[i][j - 1] * (A + i)) % mod - (dp[i - 1][j - 1] * (A + i - 1) * (B + j - 1)) % mod
            dp[i][j] %= mod

    print(dp[C - A][D - B] % mod)


if __name__ == "__main__":
    main()



Measured memory_bytes: 153560
#include <iostream>
using namespace std;
int main(){
    int number, queries, quantifier, numb1, numb2;
    cin >> number >> queries;
    int parents[number] = {};
    for(int i = 0; i < number; i++) {
        parents[i] = i;
    }
    for (int i = 0; i < queries; i++) {
        cin >> quantifier >> numb1 >> numb2;
        if (quantifier == 0) {
            int pickles = parents[numb2];
            for (int i = 0; i < number; i++) {
                if (parents[i] == pickles) {
                    parents[i] = parents[numb1];
                }
            }
        } else {
            if (parents[numb1] == parents[numb2]) {
                cout << "1" << endl;
            } else {
                cout << "0" << endl;
            }
        }
    }

}


Measured memory_bytes: 3136
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

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

    int n,a, mn = INF, mx = 0;
    cin >> n;
    map<int, vector<int> > mp;
    rep(n){
        cin >> a;
        if(a < mn) mn = a;
        if(a > mx) mx = a;
        mp[a-1].pb(i);
        mp[a].pb(i);
        mp[a+1].pb(i);
    }

    int ans = 0;
    reppp(i, mn, mx){
        ans = max(ans, (int)mp[i].size());
    }
    cout << ans;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)


int main()
{
  ll n, t, sum=0, minv=LLONG_MAX, asum=0;
  cin >> n;
  vecll a(n);
  forll(i, 0, n){
	cin >> a[i];
	sum += a[i];
  }
  asum = a[0];
  if (n == 2){
	cout << abs(a[1] - a[0]) << endl;
	return 0;
  }
  
  forll(i, 1, n-1){
	asum += a[i];
	minv = min(minv, abs(sum - asum - asum));
  }
  cout << minv << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
int N, Q;

struct Node {
  vi edges;
  ll count;

  Node() : count(0)
  {}
};

vector<Node> nodes;

void dfs(int v, int parent) {

  for (auto u : nodes[v].edges) {
    if (u == parent) continue;

    nodes[u].count += nodes[v].count;
    dfs(u, v);
  }

}

int main(int argc, char** argv) {
  cin >> N >> Q;

  nodes.resize(N);

  for (int i=0; i<N-1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--; // convert to 0-indexed
    nodes[a].edges.push_back(b);
    nodes[b].edges.push_back(a);
  }

  for (int i=0; i<Q; i++) {
    int p, x;
    cin >> p >> x;
    p--; // convert to 0-indexed

    nodes[p].count += x;
  }

  dfs(0, -1);

  for (int i=0; i<N; i++) {
    const Node& v = nodes[i];
    cout << v.count;
    if (i<N-1) {
      cout << " ";
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 24320
#include<iostream>

using namespace std;


int main(void) {
	int x, y, z,sum,n,count_l,count_h;
	while (cin >> x >> y >> z) {
		sum = x + y;
		n = 20 - sum;
		if (sum < 10) cout << "YES" << endl;
		else {
			count_l = n;
			count_h = 10 - n;
			if (x <= n)count_l--;
			else count_h--;
			if (y <= n)count_l--;
			else count_h--;
			if (z <= n)count_l--;
			else count_h--;
			if(count_l>=count_h) cout << "YES" << endl;
			else cout << "NO" << endl;
		}
	}
}

Measured memory_bytes: 1152
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)[::-1]
sum_a=sum(a)
flag=True
for i in range(m):
    if a[i] <sum_a/(4*m):
        flag=False
        break
if flag==True:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);

	        int N = sc.nextInt();
	        long ans=1;
	        long[] a = new long[N];
	        for (int i=0 ; i<N; i++) {
	            a[i] = Long.parseLong(sc.next());
	            if((long)(Math.pow(10, 18)/ans)<a[i]) {
	            	ans=-1;
	            } else if(ans!=-1){
	            	ans=ans*a[i];
	            }
	            if(a[i]==0) {
	            	System.out.println(0);
	            	return;
	            }
	        }
	        if(ans>(long)Math.pow(10, 18))ans=-1;
    		System.out.println(ans);
	    }
	}


Measured memory_bytes: 60372
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
ll f(ll b, ll n) {
    ll ans = 0;
    while(n) {
        ans += n % b;
        n /= b;
    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n, s;
    cin >> n >> s;
    if(n == s) {
        cout << n + 1 << endl;
        return 0;
    }
    ll b;
    for(b = 2; b * b <= n; b++) {
        if(f(b, n) == s) {
            cout << b << endl;
            return 0;
        }
    }
    for(ll d1 = n / b; d1 >= 1; d1--) {
        ll d0 = s - d1;
        ll min_b = n / (d1 + 1) + 1, max_b = n / d1, rem = n % d1;
        if(d0 % d1 == rem and rem <= d0 and d0 <= rem + d1 * (max_b - min_b)) {
            cout << max_b - d0 / d1 << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
UKV = [list(map(int,input().split())) for _ in range(N)]

seen = [False]*N
first_time = [-1]*N
last_time = [-1]*N
time = 0
def dfs(G, v):
    global seen
    global first_time
    global last_time
    global time
    seen[v-1] = True
    time += 1
    first_time[v-1] = time
    for next_v in G[v]:
        if seen[next_v-1]:
            continue
        dfs(G, next_v)
    time += 1
    last_time[v-1] = time

G = {}
for ukv in UKV:
    G[ukv[0]] = sorted(ukv[2:])
for i in range(1,N+1):
    if seen[i-1]:
        continue
    dfs(G, i)

for i in range(1,N+1):
    print(i,first_time[i-1],last_time[i-1])


Measured memory_bytes: 5720
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    fix20;
    int n,k;
    cin >> n >> k;
    vector<double> p(n);
    rep(i,n) cin >> p.at(i);
    vector<double> E(n);
    rep(i,n) E.at(i) = (1.0 + p.at(i))/2.0;
    double tmp = 0;
    rep(i,k) tmp += E.at(i);
    double ans = tmp;
    for(int i=k;i<n;i++){
        tmp += E.at(i);
        tmp -= E.at(i-k);
        ans = max(ans,tmp);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>
#include<math.h>

int main(void){
    int i,n,now,m;
    double max,h,w,bmi,tmp;

    while(scanf("%d",&m),m){
        for(i=0;i<m;i++){
            scanf("%d%lf%lf",&n,&h,&w);
            bmi=w/((h/100)*(h/100));
            if(!i){
                now=n;
                max=fabs(bmi-22.0);
            }
            tmp=fabs(bmi-22.0);
            if(max>tmp){
                max=tmp;
                now=n;
            }else if(max==tmp){
                if(now>n)now=n;
            }
        }
        printf("%d\n",now);
    }
    return 0;
}

Measured memory_bytes: 628