akhauriyash/Code-Regression huggingface dataset:
/*
    Author: Mohammad faisal
    Problem: Time Limit Exceeded.
    Date: 07/08/2019

*/
// #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
using namespace std;
// long long gcd(long long a,long long b)
// {
//   if(b)
//     return gcd(b,a%b);
//   else
//     return a;
// }
int main()
{
    int n,t;
    cin >> n >> t;
    vector<int>v;
    int min = 9999;
    for(int i=0;i<n;i++)
    {
      int x,y;
      cin >> x >> y;
      if(y<=t)
      {
        if(x < min)
          min = x;
      }
    }
    if(min == 9999)
      cout<<"TLE"<<endl;
    else
      cout<<min<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N;
  cin>>N;
  vector<ll> d(N);
  for(ll i=0;i<N;i++) {
   cin>>d[i];
  }
  
  ll ans=0;
  for(ll i=0;i<N-1;i++) {
for(ll j=i+1;j<N;j++) {
ans+=d[i]*d[j];
}
  }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 3596
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	int n; cin >> n;
	vector<vector<LL>> d(n, vector<LL>(n));

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

	//a+b<cとなってると、cが矛盾する
	for (int m = 0; m < n; m++) {
		for (int s = 0; s < n; s++) {
			for (int t = 0; t < n; t++) {

				if (d[s][m] + d[m][t] < d[s][t]) {
					cout << "-1" << endl;
					return 0;
				}

			}
		}
	}
	

	//a+b==cとなってるcは渡れないことにする
	for (int m = 0; m < n; m++) {
		for (int s = 0; s < n; s++) {
			for (int t = 0; t < n; t++) {
				if (s == t || t == m || s == m)continue;

				if (d[s][m] + d[m][t] == d[s][t]) {
					d[s][t] = INF2;
				}
			}
		}
	}
	

	LL ans = 0;

	//生き残った辺を足し上げていく
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			if (d[i][j] != INF2)ans += d[i][j];
		}
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef vector<vl> mt;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef vector<string> vs;
typedef vector<vs> table;


const ll e5 = 1 << 20;
const ll mod = 1000000007;
const ll e3 = 1 << 13;
const ll INF = 1ll << 50;

ll r;

int main(){
  cin >> r;
  cout << r*r*3 << endl;
}


Measured memory_bytes: 256
using System;

namespace std
{
    class Test 
    {
        static void Main(string[] args) {
         int cnt = 0;
           var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);
           for (int i = a; i <= b; i++) {
              if (c % i == 0) cnt++;  
           }
            Console.WriteLine("{0}",cnt);
        }
    } 
}


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

using i64 = int64_t;

map<i64, i64> prime_factor(i64 n) {
    map<i64, i64> res;
    for (i64 i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if (n != 1)
        res[n] = 1;
    return res;
}

int main(){
    i64 l;
    while(cin >> l, l != 0){
        auto mp = prime_factor(l);
        i64 n = 1;
        for(auto e: mp){
            n *= 2*e.second + 1;
        }
        cout << (n+1) / 2 << endl;
    }

    return 0;
}



Measured memory_bytes: 2940
#include <stdio.h>
 
#define N 128
 
int
main (
  int   argc,
  char *argv[ ]
  )
{
  int a[ N ];
  int n;
  int i;
 
  scanf ( "%d", &n );
  for ( i = 0; i < n; ++i )
  {
    scanf ( "%d", &a[ i ] );
  }
 
  while ( n-- )
  {
    printf ( "%d", a[ n ] );
    putchar ( n ? ' ' : '\n' );
  }
 
  return ( 0 );
}

Measured memory_bytes: 600
n = int(input())
l = [list(input()) for i in range(3)]
ans = 0
for i in range(n):
    s = set()
    for j in range(3):
        s.add(l[j][i])
    k = len(s)
    if k == 2:
        ans += 1
    elif k == 3:
        ans += 2
print(ans) 

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

#define ll long long int
#define vl vector<ll>

int main() {

    ll N, K;
    cin >> N >> K;

    vl A, F;
    ll a, f;
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
        cin >> a;
        A.push_back(a);
        sum += a;
    }
    for (ll i = 0; i < N; i++) {
        cin >> f;
        F.push_back(f);
    }

    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<ll>());

    ll ans = 0;
    ll L = 0;
    ll R = 10e12;
    ll med, tmp;
    ll new_a;

    if (K >= sum) {
        cout << 0 << endl;
        return 0;
    }

    while (R-L > 1) {
        med = (L + R) / 2;
        tmp = 0;
        for (int i = 0; i < N; i++) {
            // cout << "A : " << A[i] << "  F : " << F[i] << endl;
            if (A[i] * F[i] > med) {
                // new_a = floor(1.0 * med / F[i]);
                new_a = med / F[i];
                // cout << i << " " << A[i] << " " << new_a << endl;
                tmp += (A[i] - new_a);
            }
        }
        // cout << "med : " << med << "  tmp : " << tmp << endl;
        if (tmp > K) L = med;
        else R = med;
    }

    cout << R << endl;

    return 0;
}


Measured memory_bytes: 4848
#include <bits/stdc++.h>
#define fore(x,a,b) for(int x=a, qwerty=b; x<qwerty; x++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define pb push_back
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define fst first
#define snd second
#define mset(a,v) memset((a),(v),sizeof(a))
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
using namespace std;
typedef long long ll;
const int N=305;
int n,k;
int a[N],dp[100500],g[N];
int f(int i){
	if(i==0)return 0;
	int &r=dp[i];
	if(r!=-1)return r;
	fore(j,0,n)if(i>=a[j])f(i-a[j]);
	fore(j,0,n+1)g[j]=0;
	fore(j,0,n)if(i>=a[j])g[f(i-a[j])]=1;
	fore(j,0,n+1)if(g[j]==0){r=j;break;}
	return r;
}
int main(){FIN;
	cin>>n>>k;
	fore(i,0,n)cin>>a[i];
	memset(dp,-1,sizeof dp);
	if(f(k))cout<<"First\n";
	else cout<<"Second\n";
}

Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<iterator>
#include<utility>
using namespace std;
int main(){
  int a[5];
  for(int i=0;i<5;i++)
  cin>>a[i];
  for(int i=0;i<5;i++){
      if(a[i]==0){
          cout<<i+1<<endl;
          return 0;
      }
  } 
}

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

int main() {
  ll H = 0,N = 0,sum = 0;
  cin >> H >> N;
  vector<int>A(N);
  rep(i,N){
    cin >> A[i];
    sum += A[i];
  }
  if(sum < H){
    cout << "No";
  }
  else{
    cout << "Yes";
  }
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> g[100005];
vector<long long> dist(100005, 1LL << 60);
int n, m;
void dfs(int x) {
	for (auto &p : g[x]) {
		int to = p.first;
		long long d = p.second;
		if (dist[to] != 1LL << 60) {
			if (dist[to] != dist[x] + d) {
				cout << "No" << endl;
				exit(0);
			}
			continue;
		}
		dist[to] = dist[x] + d;
		dfs(to);
	}
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int l, r, d;
		cin >> l >> r >> d;
		l--, r--;
		g[l].emplace_back(r, d);
		g[r].emplace_back(l, -d);
	}
	for (int i = 0; i < n; i++) {
		if (dist[i] != 1LL << 60) continue;
		dist[i] = 0;
		dfs(i);
	}
	cout << "Yes" << endl;
	return 0;	
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    ll A,B;
    cin >> A >> B;
    ll K = N / (A + B);
    ll S = N - K * (A + B);
    if (S <= A){
        cout << K * A + S << endl;
    }
    else{
        cout << K * A + A << endl;
    }
}



Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll a,b,n;
	cin>>n>>a>>b;
	a--;b--;
	if((a-b)%2==0){
		cout<<abs((a-b)/2)<<endl;
		return 0;
	}
	ll la=a,ra=n-a-1;
	ll lb=b,rb=n-b-1;
	ll lmax=((la>lb)?la:lb);
	ll rmax=((ra>rb)?ra:rb);
	ll max,min;
	if(rmax<lmax){
		max=ra>rb?ra:rb;
		min=ra<rb?ra:rb;
	}else{
		max=la>lb?la:lb;
		min=la<lb?la:lb;
	}
	cout<<(min+max+1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from collections import Counter

n, k, *a = map(int, read().split())
counter = sorted(Counter(a).values())
ans = 0
for i in range(len(counter) - k):
    ans += counter[i]
print(ans)


Measured memory_bytes: 34148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++) 
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    //ll N; cin >> N;
    ll N,M; cin >> N >> M;
    //string S; cin >> S;
    //ll H,W; cin >> H >> W;
    vector<ll> A(N);
    vector<pll> pe(M);
    vector<ll> D;
  	rep(i,N)cin >> A[i];
    rep(i,M){
        int b,c;
        cin >> b >> c;
        pe[i]=make_pair(c,b);
    }
    sort(all(A));
    sort(all(pe));
    reverse(all(pe));
    int x=0;
    while(D.size()<N && x<pe.size()){
        rep(i,pe[x].second){
            D.push_back(pe[x].first);
        }
        x++;
    }
    rep(i,N){
      	if(i>=D.size())break;
        if(!chmax(A[i],D[i]))break;
    }
    ll sum=0;
    rep(i,N){
        sum+=A[i];
    }
    cout << sum;
}

/*



 */



Measured memory_bytes: 4724
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))


def get_sum(array):
    score_array = [0]
    for i, a in enumerate(array):
        score_array.append(score_array[i]+a)
    return max(score_array)

def get_max(array, q, mod):
    if q == 0:
        m_score = get_sum(array[:mod])
    else:
        m_score = get_sum(array+array[:mod])
        m_score = sum(array)*(q-1) + m_score
    return m_score

max_score = -float('inf')

for i in range(n):
    score = 0
    score_mv_array = []
    pos = i
    start_pos = p[pos]-1
    for j in range(k):
        pos = p[pos]-1
        if j!=0 and pos == start_pos:
            len_mv = j
            q, mod = divmod(k-j, len_mv)
            score += get_max(score_mv_array, q, mod)
            max_score = max(score, max_score)
            break
        score += c[pos]
        score_mv_array.append(c[pos])
        max_score = max(score, max_score)

print(max_score)

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

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

int main() {
    ll a, b, c; 
    cin >> a >> b >> c; 
    cout << ((a + b + 2 * sqrtl(a * b) < c) ? "Yes":"No") << endl;
}


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

int main() {
    int N,n = 0;
    cin >> N;
    int a[N];
    int b[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        if (a[i] == (n+1)) {
            b[n] = a[i];
            n++;
        }
    }
    if (n == 0) { cout << -1 << endl; }
    else { cout << (N-n) << endl; }

    return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

using namespace std;
const int MAX_L = 1e3 + 5;
const int mod = 1e9 + 7;
int W, H;
char m[MAX_L+1][MAX_L+1];
int dp[MAX_L+1][MAX_L+1];

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

}

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

	for (int x = 0; x < H;x++){
		for (int y = 0;y < W;y++){
			cin >> m[x][y];
		}
	}

	dp[0][0] = 1;
	for (int i = 0; i < H;i++){
		for (int j = 0;j < W;j++){
			for(int r : {i, i +1} ){
				int c = j;
				if (r ==  i)
					c +=1;
				if (r < H and c < W and m[r][c] == '.')
					add_self(dp[r][c], dp[i][j]);
			}
		}
	}

	cout << dp[H-1][W-1];
	return 0;
}


Measured memory_bytes: 8564
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    int a,b,x;
    cin>>a>>b>>x;
    if(x<a||a+b<x){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
    return 0;
}


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

int main(){
	int a,b,c,d;
  	cin >> a >> b >> c >> d;
  
  	if ((a+b) > (c+d)){
    	cout << "Left" << endl;
    }
  
  	else if ((a+b) == (c+d)){
    	cout << "Balanced" << endl;
    }
  
  	else {
    	cout << "Right" << endl;
    }
  
  return 0;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
int pow2[10000]={1};

struct E{
    int cost;
    int to;
};
vector<E> edges[100010];
int color[100010]={};
int N;
void solve(int n){
    for(auto e:edges[n]){
        if(color[e.to]==0){
            if(e.cost%2==1){
                if(color[n]==1){
                    color[e.to]=2;
                }else{
                    color[e.to]=1;
                }
            }else{
                if(color[n]==1){
                    color[e.to]=1;
                }else{
                    color[e.to]=2;
                }
            }
            solve(e.to);
        }
    }
}
int main(){
    cin>>N;
    for(int i=0;i<N-1;i++){
        int u,v,w;
        cin>>u>>v>>w;
        edges[u].push_back(E{w,v});
        edges[v].push_back(E{w,u});
    }
    color[1]=1;
    solve(1);
    for(int i=1;i<=N;i++){
        cout<<color[i]-1<<endl;
    }
    return 0;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

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


int main()
{
  int N; cin >> N;
  double ans = 0;

  double jpy = 0.0, btn = 0.0;
  REP(i, N) {
    double x;
    string u;
    cin >> x >> u;
    if (u == "JPY") jpy += x;
    else btn += x;
  }
  cout << fixed << setprecision(20) << (jpy + btn * 380000.0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int A,B,add,sub,mul;
    scanf("%d %d",&A,&B);
    add=A+B;
    sub=A-B;
    mul=A*B;
    if(add>sub){
        if(add>mul){
            printf("%d\n",add);
        }
        else{
            printf("%d\n",mul);
        }
    }
    else{
        if(sub>mul){
            printf("%d\n",sub);
        }
        else{
            printf("%d\n",mul);
        }
    }
    return 0 ;
}


Measured memory_bytes: 128
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

#define MOD 1000000007

void solve(int test_case) {//213
	int n;
	cin>>n;
	cout<<n*(n+1)/2;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3580
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    A=list(map(int,input().split()))

    cnt=0
    for i in range(N):
        if A[i]%2!=0:
            continue
        else:
            while A[i]%2==0:
                A[i]=A[i]//2
                cnt+=1

    print(cnt)

resolve()

Measured memory_bytes: 4148
/*input

*/

#include <bits/stdc++.h>
#include <unistd.h>

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 1e18
#define M 1000000007
#define pie 3.141592653589793238
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define UQ(x) (x).resize(distance((x).begin(),unique(x.begin(),x.end())))

using namespace std;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
mt19937_64 rnd64(chrono::high_resolution_clock::now().time_since_epoch().count());

ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2) ans*=a, ans%=(mod);
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(ll* a,ll n,ll val){
	for(ll i=0;i<n;i++)
		a[i]=val;
}

void solve(){
	ll i,j,_;
	ll n,k;
	cin>>n>>k;
	ll a[n];
	rep(i,0,n) cin>>a[i];
	ll l = 1, r = 1e9+1, ans = r;
	while(l <= r) {
		ll mid = (l+r) / 2;
		ll now = 0;
		rep(i,0,n) {
			now += a[i]/mid;
			if(a[i]%mid == 0) now--;
		}
		if(now > k) {
			l = mid + 1;
		}else {
			r = mid - 1;
			ans = min(ans, mid);
		}
	} 
	cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(0);
 	cin.tie(0);
	ll T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}




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

#define FOR(i,a,b) for(int i = (a);i < (int) (b);i++)
#define PB push_back
#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int N,K;
list<int> edge [2001];
const int INF = 1e9;

void bfs(int start,vector<int>& distance)
{
	queue< pair<int,int> > q;
	q.push(MP(start,0));

	while(q.empty() != true){
		int node = q.front().first;
		int cost = q.front().second;
		q.pop();

		if(distance [node] <= cost) continue;
		distance [node] = cost;

		for(auto&& it : edge [node]){
			q.push(MP(it,cost + 1));
		}
	}
}

int solve1()
{
	int res = INF;
	FOR(i,1,N + 1){
		vector<int> distance(N + 1,INF);
		bfs(i,distance);

		int cnt = 0;
		FOR(i,1,N + 1){
			if(distance [i] > K / 2){
				cnt++;
			}
		}
		res = min(cnt,res);
	}

	return res;
}

int solve2(int par,int cur)
{
	int res = INF;
	for(auto&& it : edge [cur]){
		if(it != par){
			vector<int> distance1(N + 1,INF),distance2(N + 1,INF);
			bfs(cur,distance1);
			bfs(it,distance2);

			int cnt = 0;
			FOR(i,1,N + 1){
				if(distance1 [i] > K / 2 && distance2 [i] > K / 2){
					cnt++;
				}
			}
			res = min({solve2(cur,it),cnt,res});
		}
	}

	return res;
}

int main()
{
	scanf("%d%d",&N,&K);
	FOR(i,0,N - 1){
		int a,b;
		scanf("%d%d",&a,&b);
		edge [a].PB(b);
		edge [b].PB(a);
	}

	int ans;
	if(K % 2 == 0){
		ans = solve1();
	}
	else{
		ans = solve2(0,1);
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 25248
#include<bits/stdc++.h>
using namespace std;
int n ;
int a = 0 , b = 0 , c = 0 ;
int ans = 0 ;
string s ;
int main()
{
cin >> n ; 
while (n--)
{
cin >> s; 
int len = s.size()-1;
if(s[0]=='B'&&s[len]=='A')c++;
else if(s[0] == 'B') b++;
else if(s[len] == 'A') a++;
for(int i = 0 ; i < len-1 ; i++)
{
    if(s[i]=='A'&&s[i+1]=='B'){
        ans++;
    }
}
}
 if(c == 0) ans += min(a, b);
    else if(a == 0 && b == 0 && c > 0) ans += c - 1;
    else ans += c + min(a, b);
 
    cout << ans << endl;

}

Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))

res = []
for i in range(n):
    for j in range(len(b) - 1, -1, -1):
        if b[j] == j + 1:
            res.append(b.pop(j))
            break
    else:
        print('-1')
        exit()

for i in res[::-1]:
    print(i)


Measured memory_bytes: 63492
//abc152_a.cpp
//Sun Jan 19 20:45:32 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	if (n==m){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
//	printf("%.4f\n",ans);
}

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

int main() {
	string str;
	int q;

	cin >> str >> q;

	for( int i = 0; i < q; ++i ) {
		string op;
		cin >> op;

		if( op == "print" ) {
			int a, b;
			cin >> a >> b;

			cout << str.substr( a, (b+1)-a ) << endl;
		}
		else if( op == "reverse" ) {
			int a, b;
			cin >> a >> b;

			reverse( str.begin() + a, str.begin() + (b+1) );
		}
		else if( op == "replace" ) {
			int a, b;
			string s;
			cin >> a >> b >> s;

			str.replace( a, (b+1)-a, s );
		}
	}
}



Measured memory_bytes: 3168
#include <stdio.h>

int main( void )
{
	int H, W, H_Cou, W_Cou;
	
	while(1)
	{
		scanf( "%d %d", &H, &W );
		
		if( H == 0 && W == 0 )
		{
			break;
		}
		else
		{
			for( H_Cou = 0; H_Cou < H; H_Cou++ )
			{
				if( H_Cou % 2 == 0 )
				{
					for( W_Cou = 0; W_Cou < W; W_Cou++ )
					{
						if( W_Cou % 2 == 0 )
						{
							printf( "#" );
						}
						else
						{
							printf( "." );
						}
					}
				}
				else
				{
					for( W_Cou = 0; W_Cou < W; W_Cou++ )
					{
						if( W_Cou % 2 == 0 )
						{
							printf( "." );
						}
						else
						{
							printf( "#" );
						}
					}
				}
				printf( "\n" );
			}
			printf( "\n" );
		}
	}
	return 0;
}

Measured memory_bytes: 572
#include<stdio.h>
#define MAX 20

int main()
{
  int n;
  scanf("%d",&n);
  int i,c[n],v[n];
  for(i=0;i<n;i++)
    {
      scanf("%d",&v[i]);
    }
  for(i=0;i<n;i++)
    {
      scanf("%d",&c[i]);
    }
  int sum=0;
  for(i=0;i<n;i++)
    {
      if(c[i]<v[i])sum+=v[i]-c[i];
    }

  printf("%d",sum);
  
}


Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ld p = 3.141592653;
    ld n;
    cin>>n;
    cout(3)<<p*n*2<<endl;
}

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

int main() {
	int N, M;
	cin >> N >> M;
	int D[51][2];
	int i;
	for (i = 0; i < M; i++)	{
		cin >> D[i][1] >> D[i][2];
	}
	for (i = 0; i < N; i++) {
		int j;
		int k = 0;
		for (j = 0; j < M; j++) {
			if (D[j][1] == i + 1 || D[j][2] == i + 1) {
				k++;
			}
		}
		cout << k << endl;
	}
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define abdelrahman010 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int N = 1e6 + 5;
int n , k , a[N];
int ans = 1e9;
int main()
{
    abdelrahman010
    cin >> k >> n;
    for(int i = 0;i < n;i++)
        cin >> a[i];
    sort(a , a + n);
    ans = min(a[n - 1] - a[0] , a[0] + k - a[1]);
    for(int i = 1;i < n - 1;i++)
        ans = min(ans , min(k - a[i] + a[i - 1] , a[i] + k - a[i + 1]));
    ans = min(ans , min(a[n - 1] - a[0] , k - a[n - 1] + a[n - 2]));
    cout << ans;
    return 0;
}

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

int main()
{
    int a, b; cin >> a >> b;
    if (a * b % 2 == 1) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#                         author:  kagemeka 
#                         created: 2019-11-10 12:28:14(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n, *w = sys.stdin.read().split()
    n = int(n)
    for i in range(1, n):
        if w[i][0] == w[i-1][-1] and not w[i] in w[:i]:
            continue
        else:
            print('No')
            exit()
    
    print('Yes')


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> v1;
int main(){
	int n;
	long long int a,b,c,d;
	int i,j,k;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>a;
		v1.push_back(a);
	}
	v1.push_back(0);
	sort(v1.begin(),v1.end(),greater<int>());
	a=v1[0],b=0,c=0,d=0;
	for(i=0;i<=n;i++){
		if(a==v1[i])b++;
		else{
			if(b>=2){
				if(c==0)c=a;
				else d=a;
			}
			if(d==0 && b>=4)d=a;
			a=v1[i],b=1;
		}
		if(d!=0)break;
	}
	c=c*d;
	cout<<c<<endl;
	return 0;
}
	


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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  string s;cin>>s;
  if(s[s.size()-1]!='s'){
    cout<<s<<'s'<<endl;
  }else{
    cout<<s<<"es"<<endl;
  }
  return 0;
}

Measured memory_bytes: 3620
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

#[fastout]
fn main() {
    input! {//
        n:usize,
       mut p:[Usize1;n],
    }

    let mut cnt = 0;
    for i in 0..n {
        if i != p[i] {
            cnt += 1;
        }
    }
    if cnt == 0 || cnt == 2 {
        println!("YES");
        return;
    }
    println!("NO");
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mn=1e5+10;
int a[mn],b[mn],c[mn*2];
int n;
bool leq(int x){
    int i;
    for(i=1;i<=n;i++)b[i]=a[i]>x?1:-1;
    for(i=1;i<=n;i++)b[i]+=b[i-1];
    memset(c,0,sizeof(c));
    for(i=1;i<=n;i++)c[mn+b[i]]++;
    ll tot=0;
    int cur=0;
    for(i=0;i<mn;i++)cur+=c[i];
    for(i=0;i<n;i++){
        tot+=cur;
        if(b[i+1]<b[i]){
            cur--;
            c[b[i+1]+mn]--;
            cur-=c[b[i]+mn-1];
        }
        else{
            c[b[i+1]+mn]--;
            cur+=c[b[i+1]+mn-1];
        }
    }
    //tot+=cur;
    return (tot>=(1LL*n*(n+1)/2)/2+1);
}
int main(){
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)scanf("%d",a+i);
    int l=1,r=1e9;
    while(l!=r){
        int mid=l+r>>1;
        if(!leq(mid))l=mid+1;
        else r=mid;
    }
    printf("%d",l);
}

Measured memory_bytes: 1792
import java.util.*;


public class Main {
	
	static int n, l, r, max;
	static String s, now;
	
	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		s = sc.next();
		sc.close();
		
		l = 0; r = 0;
		max = 0;
		now = "";
		
		for(;l<n;l++) {
			
			if(l>r) {
				r=l;
				now = "";
			}
			if(now.length()>0) {
				now = now.substring(1);
			}
			while(check(r)) {
				now += s.charAt(r);
				max = Math.max(max, r - l + 1);
				r++;
			}
			
		}
		System.out.println(max);
		
	}
	
	static boolean check(int x) {
		char c = s.charAt(x);
		int len = now.length() + 1;
		if(s.indexOf(now + c, l + len)==-1) return false;
		else return true;
	}
	
}


Measured memory_bytes: 87372
n = int(input())
class Union_Find():
    def __init__(self, num):
        self.par = [-1]*(num+1)
        self.siz = [1]*(num+1)

    def same_checker(self, x, y):
        return self.find(x) == self.find(y)

    def find(self, x):
        if self.par[x] < 0:
            return x
        else:
            x = self.par[x]
            return self.find(x)

    def union(self, x, y):
        rx = self.find(x)
        ry = self.find(y)
        if rx != ry:
            if self.par[rx] < self.par[ry]:
                self.par[ry] = rx
                self.siz[rx] += self.siz[ry]
            elif self.par[rx] > self.par[ry]:
                self.par[rx] = ry
                self.siz[ry] += self.siz[rx]
            else:
                self.par[rx] -= 1
                self.par[ry] = rx
                self.siz[rx] += self.siz[ry]
        return

    def size(self, x):
        return self.siz[self.find(x)]

city = []
for i in range(n):
    city.append(list(map(int, input().split())) + [i])

road = []
city.sort()
for i in range(n-1):
    road.append((city[i+1][0] - city[i][0], city[i][2], city[i+1][2]))

city.sort(key = lambda x: x[1])
for i in range(n-1):
    road.append((city[i+1][1] - city[i][1], city[i][2], city[i+1][2]))

road.sort()

ans = 0
tree = Union_Find(n)
for i in range(len(road)):
    cost, a, b = road[i]
    if tree.same_checker(a, b):
        continue
    else:
        tree.union(a, b)
        ans += cost

print(ans)


Measured memory_bytes: 48036
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> S(H);
    rep(i, H)
    {
        cin >> S[i];
    }
    vector<vector<int>> right_near(H, vector<int>(W, W)), left_near(H, vector<int>(W, -1)), up_near(H, vector<int>(W, -1)), down_near(H, vector<int>(W, H));
    rep(h, H) rep(w, W)
    {
        if (S[h][w] == '#')
        {
            left_near[h][w] = w;
            right_near[h][w] = w;
            up_near[h][w] = h;
            down_near[h][w] = h;
        }
    }

    rep(h, H) rep(w, W - 1)
        left_near[h][w + 1] = max(left_near[h][w + 1], left_near[h][w]);

    rep(h, H) for (int w = W - 1; w >= 1; w--)
        right_near[h][w - 1] = min(right_near[h][w - 1], right_near[h][w]);

    rep(h, H - 1) rep(w, W)
        up_near[h + 1][w] = max(up_near[h + 1][w], up_near[h][w]);

    for (int h = H - 1; h >= 1; h--)
        rep(w, W)
            down_near[h - 1][w] = min(down_near[h - 1][w], down_near[h][w]);

    int ans = 0;
    rep(h, H) rep(w, W)
    {
        int count = 0;
        if (S[h][w] == '.')
        {
            count = right_near[h][w] - left_near[h][w] - 1;
            count += down_near[h][w] - up_near[h][w] - 1;
        }
        ans = max(ans, count - 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 67328
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll N;
	cin>>N;
	for(ll i=1;i<=N;i++){
		if(((ll)(i*1.08))==N){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<":("<<endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, K: int, A: "List[int]"):
    ans = []
    for a0, a1 in zip(A, A[K:]):
        ans.append(YES if a0 < a1 else NO)
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(*solve(N, K, A), sep="\n")

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()


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

int main(){
 long long int n,l=2,k=1,o;
  cin >> n;
  for (int i=0; i<n-1; i++){
  o=k;
  k=l+k;
  l=o;
  }
  cout << k << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define print printf("==================\n");
typedef    long long ll;
typedef   unsigned long long ull;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define readf                freopen("in.txt", "r", stdin);
#define writef               freopen("out.txt", "w", stdout);
typedef pair<ll,ll   > payar;
priority_queue<int, vector<int>,  greater<int> > pq; ///accending
vector< pair<int,payar  > > vpp;
vector< pair<int,  pair<int,payar  > > > own;
vector < payar >  vp;
#define pi aco 10e12;
#define EPS 1e-9
#define  mod   1000000007
#define  mod2  998244353
#define all(x) x.begin(),x.end()
#define endl "\n"
const int N=1e6+5;


int main()
{
    IOS;

	ll a , b, c;
  cin>>a>>b>>c;
  if( (a+b+c)>=22){
    cout<<"bust\n";
  }
  else{
    cout<<"win\n";
  }

    return 0;
}


Measured memory_bytes: 256
Scanf.scanf "%d %d" (fun n aa ->
    let x = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x - aa)) in
    let rec loop i a b c =
        if i = n then a, b, c else
        if x.(i) < 0 then loop (i + 1) (-x.(i) :: a) b c else
        if x.(i) > 0 then loop (i + 1) a b (x.(i) :: c) else
                          loop (i + 1) a (b * 2) c
    in
    let a, b, c = loop 0 [] 1 [] in
    let build l =
        let arr = Array.make 2501 0 in
        arr.(0) <- 1;
        let rec loop = function
            | [] -> arr
            | hd :: tl ->
                for j = 2500 - hd downto 0 do
                    arr.(hd + j) <- arr.(hd + j) + arr.(j)
                done;
                loop tl
        in
        loop l
    in
    let mi = build a in
    let pl = build c in
    let rec loop i acc =
        if i = 2501 then acc else
            loop (i + 1) (acc + mi.(i) * pl.(i) * b)
    in
    loop 0 (-1) |> Printf.printf "%d\n"
)

Measured memory_bytes: 384
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;

void ColoringDominoes() {

	int n;
	cin >> n;
	string s1, s2;
	cin >> s1 >> s2;
	const int mod = 1000000007;
	ll res = 0;
	int type;
	if (s1[0] == s2[0]) {
		res += 3;
		type = 0;
	}
	else {
		res += 6;
		type = 1;
	}

	for (int i = (res == 3 ? 1 : 2); i < n; i++)
	{
		if (s1[i] == s2[i]) {
			if (type == 0) {
				res *= 2;
				res %= mod;
			}
			type = 0;
		}
		else {
			if (type == 0) {
				res *= 2;
				res %= mod;
			}
			else {
				res *= 3;
				res %= mod;
			}
			type = 1;
			i++;
		}
	}

	cout << res << endl;
}

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



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			1000000007

ll mod_pow(ll a,ll b) {
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) {
	return mod_pow(a , mod-2);
}

void solve() {
	
	int n , m, k;
	
	cin >> n >> m >> k;
	
	int a[n];
	int b[m];
	
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	for(int i = 0; i < m; ++i) {
		cin >> b[i];
		
		if(i != 0) {
			b[i] += b[i-1];
		}
	}
	
	int mx = 0;
	int sm = 0;
	
	for(int i = 0; i <= n; ++i) {
		
		if(i != 0)  {
			sm += a[i-1];
		}
		
		if(sm > k) {
			break;
		}
		
		auto u = upper_bound(b,b+m, k - sm) - b;
		
		mx = max(mx , i + u);
	}
	
	cout<< mx;
}

signed main() {
    fast;
    
    int t = 1;
    
    //cin >> t;
    
    while(t--) {
        solve();
    }
 
    return 0;
}


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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	cout << 800*n - 200*(n/15) << endl;
	return 0;
}


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

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

using namespace std;

typedef long long int lli;

int main () {
    int N;
    cin >> N;
    vector<int> a(N);
    REP (i, 0, N) cin >> a[i];
    vector<int> nl(100010, 0);
    REP (i, 0, N) {
        nl[a[i]]++;
        nl[a[i] + 1]++;
        nl[a[i] + 2]++;
    }
    int ans = 0;
    REP (i, 0, 100010) {
        ans = max(ans, nl[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()

d = defaultdict(int)

for _ in range(N):
    A = li()
    for i in range(1, len(A)):
        d[A[i]] += 1

ans = 0

for key, value in d.items():
    if value == N:
        ans += 1

print(ans)

Measured memory_bytes: 9328
#include<bits/stdc++.h>
#define inf 1000000007
#define ll long long
using namespace std;
vector<int> dp(2010,-1);
ll int solve(ll int n){
if(n==0){return 1LL;}
if(n==3){return 1LL;}
if(n<3){return 0LL;}
else if(dp[n]!=-1){return dp[n]%inf;}
else{
	int i=0,ans=0;
  	for(i = 3;i<=n;i++){
    	ans = (ans + solve(n-i))%inf;
    }
  return dp[n] = ans%inf;
}
}
int main(){
  ll int n=0;
  cin >> n;
  cout << solve(n)%inf;
}

Measured memory_bytes: 3600
#include <stdio.h>
int main()
{
    int n, m, i, j, min, max, f;
    int a[100005], b[100005], c[200005];
    scanf("%d %d", &n, &m);
    for (i = 0, j = 0, max = 0, min = 5000000, f = 0; i < m; i++)
    {
        scanf("%d %d", &a[i], &b[i]);
        c[j++] = a[i];
        c[j++] = b[i];
        if (b[i] < min)
            min = b[i];
        if (a[i] > max)
            max = a[i];
    }
    if (max > min)
    {
        printf("0\n");
        return 0;
    }
    f = min - max;
    printf("%d\n", f + 1);
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) V.begin(), V.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main()
{
  string s; cin >> s;
  int k; cin >> k;
  set<string> m;
  for(int i = 0; i < s.size(); i++){
    for(int j = 1; j <= k; j++){
      string t = s.substr(i, j);
      m.insert(t);
    }
  }
  int i = 0;
  for(auto itr = m.begin(); itr != m.end(); itr++){
    if(i == k-1){
      cout << *itr << endl;
      break;
    }
    i++;
  }
  system("pause");
}


Measured memory_bytes: 1912
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_lr(i,l,r) for(int i=(l);i<(r);i++)
#define all(x) (x).begin(),(x).end()
#define V vector
typedef V<int> vi;
typedef V<vi> vvi;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
constexpr int INF = INT_MAX >> 1;
constexpr ll LINF = 5000000000000000LL;
constexpr int MOD = 1000000007;

int main() {

	int n, k;
	cin >> n >> k;
	vi a(n);
	rep(i, n)cin >> a[i];
	rep_lr(i, k + 1, n + 1) {
		if (a[i - 1] > a[i - k - 1])cout << "Yes" << endl;
		else cout << "No" << endl;
	}
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define rFORe(i, a, n) for(int (i) = (int)(n); (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 1, (n))
#define REPo(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rREPe(i, n) rFORe((i), 1, (n))
#define rREPo(i, n) rFORe((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fi first
#define se second
#define dup(x, y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using vp = vector<P>;
using vt = vector<T>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int n;
  cin >> n;
  set<string> st;
  REP(i, n) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;

  return 0;
}

Measured memory_bytes: 19224
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


bool check_prime(long long n)
{
	int flag = 0;
	for (long long i = 2; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			flag = 1;
			break;
		}
	}
	if (n == 1)
		return false;
	else if (flag == 0 || n == 2 || n == 3)
	{
		return true;
	}
	else
	{
		return false;
	}

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n;
	cin >> n;
	int a[n];
	map<int, int>mt;
	zip(i, 0, n)
	{
		cin >> a[i];
		mt[a[i]]++;
	}
	int ans = 0;
	for (auto itr = mt.begin(); itr != mt.end(); itr++)
	{
		ans += itr->ss % 2;
	}

	cout << ans << en;

	return 0;
}



Measured memory_bytes: 10576
import java.util.*;
class Main{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n % 1000 == 0) System.out.println(0);
        else System.out.println(1000 - n % 1000);
        in.close();
    }
}

Measured memory_bytes: 35512
#include <iostream>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for (int c = 1; c <= 3; c++) {
        if ((a * b * c) % 2 == 1) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

Measured memory_bytes: 256