akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  long long N;
  cin >> N;
  long long h, n, w;
  for (h = 1; h <= 3500; h++) {
    for (n = 1; n <= 3500; n++) {
      long long tmp = 4 * h * n - N * n - N * h;
      if (tmp <= 0) continue;
      if (N * h * n % tmp == 0) {
        w = N * h * n / tmp;
        cout << h << " " << n << " " << w << '\n';
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
#include <iomanip>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
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; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
//template< typename T >
//T mod_pow(T x, T n, const T &p) {
//  T ret = 1;
//  while(n > 0) {
//    if(n & 1) (ret *= x) %= p;
//    (x *= x) %= p;
//    n >>= 1;
//  }
//  return ret;
//}
/////////////////// 
//

#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
#define mp make_pair
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
//
//
//

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string s;
  ll ans = 0;
  cin >> s;
  rep(i,6){
    if(s[i]=='1'){
      ans++;
    };
  }
  pri(ans);
  return 0;
}







Measured memory_bytes: 256
s = input()
#t = '?KIH?B?R?'
p = ['KIH', 'B', 'R', '']

flg = False
for i in range(1 << 4):
    res = ''
    for j in range(4):
        res += 'A' if i >> j & 1 else ''
        res += p[j]
    if s == res:
        flg = True
        break
print('YES' if flg else 'NO')

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
using ll = long long;

int main(){
    ll c=0,d=0,e,m,n,k,o=0,p,q,x1,y1,z,max1=0,s=0,ans,r,i1=-1,x,w,h,y,j1;
    string t,u;
    
    cin>>t;
    for(ll i=0;i<3;i++){
    if(t[i]==t[i+1])o++;
    }
    if(o==0)cout<<"Good"<<endl;
    else cout<<"Bad"<<endl;
}



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

int main() {
  int N;
  scanf("%d", &N);

  string ans = "No";
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == N) ans = "Yes";
    }
  }

  printf("%s", ans.c_str());
  return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner sc = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
      	int R = Integer.parseInt(sc.next());
      	String ans = "ABC";
      	if(1200 <= R && R < 2800){
        	ans = "ARC";
        }else if(2800 <= R){
        	ans = "AGC";
        }
      	out.println(ans);
        out.close();
    }
}

Measured memory_bytes: 21844
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
 size_t strlen(const char *s);
#define rep(i,n) for(long long int i=0;i<n;i++)
#define sz(x) ((int)(x).size())

using namespace std;
struct ToUpper {
    char operator()(char c) { return toupper(c); }
};
struct ToLower {
    char operator()(char c) { return tolower(c); }
};
const int N=200010;
const int P=1000000007;
using ll = long long;

//絶対値
int ze(int a, int b){
	if(a>b){
		return a-b;
	}else{
		return b-a;
	}
}
//小さい方
long long int min(long long int a,long long int b){
	if(a>b){
		return b;
	}else{
		return a;
	}
}
//大きい方
long long int max(long long int a,long long int b){
	if(a>b){
		return a;
	}else{
		return b;
	}
}
// a^n mod 
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod 
long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}

//mod掛け算
long long mt(long long a, long long b, long long mod){
	return (a*b)%mod;
}

//メモ

/*
	memset(b, '\0', sizeof(b));
初期化*/

/*
	char s[N];
	strlen(s)
*/

/*
	if(  <  )puts("Yes");
	else puts("No");
*/

/*文字列比較
if(strcmp(name[i],s)==0)
*/

/*
	graph[a].push_back(b);//graph[a][i番目に入れた]==b
	graph[j].size()	//forで回すときとか

*/

/*添字1がa個、2がb個
  vector<vector<ll>> map(a,vector<ll>(b));
*/

int main(){
  ll n, d, ans=0;
  cin>>n>>d;
  rep(i, n){
    ll x, y;
    cin>>x>>y;
    if(x*x+y*y<=d*d){
      ans++;
    }
  }
  cout<<ans<<endl;
}   

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

using namespace std;
//DP用
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;
}
const long long INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int cost;
    int ans = 10000000;
    for(int i = -100; i <= 100; i++) {
        cost = 0;
        for(int j = 0; j < n; j++) {
            cost += pow((a[j]-i),2);
        }
        ans = min(cost,ans);
    }
    cout << ans;
    return 0;
}



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

using namespace std;

const int md = 998244353;

vector<int> solveOne(int n) {
	vector<vector<int>> G(n);
	
	int m;
	ignore = scanf("%d", &m);
	for (int i = 0, u, v; i < m; i++) {
		ignore = scanf("%d %d", &u, &v);
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	vector<int> w;
	w.push_back(1000000000LL * 1000000000LL % md);
	for (int i = 1; i < n; i++) {
		w.push_back(w.back() * 1LL * w.front() % md);
	}
	
	vector<int> res, grp(n);
	for (int i = n - 1; i >= 0; i--) {
		set<int> bad;
		for (int u : G[i]) {
			if (u < i) continue;
			bad.insert(grp[u]);
		}
		
		int g = 0;
		while (bad.count(g) == 1) g++;
		
		grp[i] = g;
		
		if (res.size() < g + 1) {
			res.resize(g + 1);
		}
		
		res[g] = (res[g] + w[i]) % md;
	}
	
	return res;
}

int main() {
	int n;
	ignore = scanf("%d", &n);
	
	auto v1 = solveOne(n);
	auto v2 = solveOne(n);
	auto v3 = solveOne(n);
	
	size_t n1 = v1.size();
	size_t n2 = v2.size();
	size_t n3 = v3.size();
	
	size_t N = max({n1, n2, n3});
	
	vector<vector<bool>> taken12(N, vector<bool>(N, false));
	auto taken13 = taken12;
	auto taken23 = taken12;
	
	int ans = 0;
	for (size_t s = 0; s < n1 + n2 + n3; s++)
		for (size_t i1 = 0; i1 < n1 && i1 <= s; i1++)
			for (size_t i2 = 0; i2 < n2 && i1 + i2 <= s; i2++) {
				size_t i3 = s - i1 - i2;
				if (i3 >= n3) continue;
				
				if (taken12[i1][i2]) continue;
				if (taken13[i1][i3]) continue;
				if (taken23[i2][i3]) continue;
				
				taken12[i1][i2] = true;
				taken13[i1][i3] = true;
				taken23[i2][i3] = true;
				
				ans = (ans + v1[i1] * 1LL * v2[i2] % md * v3[i3]) % md;
			}
	
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 6852
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  vector<string> s(n);
  vl t(n);
  rep(i,n)cin>>s[i]>>t[i];
  string x;cin>>x;
  bool ok=false;
  ll ans=0;
  rep(i,n){
    if(ok)ans+=t[i];
    if(s[i]==x)ok=true;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b) {if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b) {if(a<b) a=b;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> b(n-1);
    REP(i,n-1) cin >> b[i];
    int ans = b[0]+b[n-2];
    REP(i,n-2) ans += min(b[i],b[i+1]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INFTY 1<<20
typedef long long int ll;
const int MOD=1000000007;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ta,ao;
    if(a%d==0) ta = a/d;
    else ta = a/d+1;

    if(c%b==0) ao = c/b;
    else ao = c/b+1;
    if(ao<=ta)cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

int main() {
  std::string s;
  std::cin >> s;
  for (int i = 0; i < s.size(); ++i) {
    if (((i+1)%2 == 0 && s[i] == 'R') ||
        ((i+1)%2 == 1 && s[i] == 'L')) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256
N = int(input())
l = [1] * N
i = 0
d = {1:0,2:0,3:0}
for s in input():
    n = 1
    if s == "G":
        n = 2
    elif s == "B":
        n = 3
    l[i] = n
    d[n] += 1
    i += 1
cnt = d[1] * d[2] * d[3]
for j in range(1,(N - 1) // 2 + 1):
    for k in range(N - (2 * j)):
        if l[k] * l[k+j] * l[k+j+j] == 6:
            cnt -= 1
print(cnt)



Measured memory_bytes: 73752
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int n;
  cin >> n;
  ll sum = 0, x = 1;
  while (true)
  {
    if (sum + x >= n) break; 
    sum += x;
    x++;
  }
  if (sum + x == n) {
    rep(i,x) cout << i+1 << endl;
  } else {
    int rem = n - sum;
    //cout << rem << endl << x;
    rep(i,x-rem-1) cout << i+1 << endl;
    for (int i = x-rem; i < x; i++)
    {
      cout << i+1 << endl;
    }
     
  }
  return 0;
}

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

int main(void)
{
    char s[10001];
    int n,i,length;

    scanf("%d",&n);
    scanf("%s",s);

    length=strlen(s);

    for(i=0;i<length;i++)
    {
        s[i]=s[i]+n;
        if(s[i]>'Z') s[i]-=26;
    }

    printf("%s",s);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define All(v) v.begin(), v.end()
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, K; cin >> N >> K;
    string S; cin >> S;
    if(S[K-1]=='A') S[K-1] = 'a';
    else if(S[K-1]=='B') S[K-1] = 'b';
    else S[K-1] = 'c';
    cout << S << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,m;

int main() {
	scanf("%d", &n);
	ll ans = n*(n+1ll)/2-n;
	printf("%lld", ans);
	return 0;
}


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

#define ll long long

int main()
{
    ll n;
    cin>>n;
    ll s=0;
    ll gc[n+1][n+1];
    ll p,q,r;
    memset(gc,-1,sizeof(gc));
    for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=n;j++)
		{
			for(ll k=1;k<=n;k++)
			{
				if(gc[i][j]==-1)
				{
					p=__gcd(i,j);
				}
				else
				{
					p=gc[i][j];
				}
				if(gc[p][k]==-1)
				{
					q=__gcd(p,k);
				}
				else
				{
					q=gc[p][k];
				}
				s+=q;
			}
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 3936
n,t = map(int,input().split())
out = 1001
o = t+1
outnum = 1001
for i in range(n):
  c, tim = map(int,input().split())
  if tim <= t and c < out:
    out = c
    outnum = i
if outnum == 1001:
  print('TLE')
else:
  print(out)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef  long long LL;
typedef  unsigned long long ULL;
typedef  double db;
typedef  long double ld;
#pragma comment(linker, "/STACK:102400000,102400000")
#define fuck(x) cout<<x<<endl
#define fuck1(x,y) cout<<x<<" "<<y<<endl
#define lson root<<1,l,mid
#define rson root<<1|1,mid+1,r
#define MP(a,b) make_pair(a,b)
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
const int INF = 0x3f3f3f3f3f,mod = 1e9+7;
const double eps  =1e-6,PI = acos(-1);
template<typename T> inline void read(T &x){
    x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

int main(){
    int N;
    cin>>N;
    int tot = 0;
    for(int i = N;i>=1;i--){
        int num = 0;
        int k = i;
        while(k){
            k = k/10;
            num++;
        }
        if(num&1)tot++;
    }
    fuck(tot);
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.AbstractCollection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.HashMap;
import java.util.LinkedList;

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

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            Map<Integer, Map<Integer, Integer>> lines = new HashMap<>();

            for (int i = 0; i < N - 1; i++) {
                int v1 = in.nextInt();
                int v2 = in.nextInt();
                long w = in.nextLong();
                if (!lines.containsKey(v1)) {
                    lines.put(v1, new HashMap<>());
                }
                if (!lines.containsKey(v2)) {
                    lines.put(v2, new HashMap<>());
                }
                lines.get(v1).put(v2, (int) (w % 2));
                lines.get(v2).put(v1, (int) (w % 2));
            }

            int[] black = new int[N + 1];
            Arrays.fill(black, -1);
            black[1] = 0;
            LinkedList<Integer> que = new LinkedList<>();
            que.add(1);
            while (!que.isEmpty()) {
                int current = que.removeFirst();
                if (!lines.containsKey(current)) {
                    continue;
                }
                for (Map.Entry<Integer, Integer> entry : lines.get(current).entrySet()) {
                    if (black[entry.getKey()] != -1) {
                        continue;
                    }
                    que.add(entry.getKey());
                    black[entry.getKey()] = (black[current] + entry.getValue()) % 2;
                }
            }
            for (int i = 1; i <= N; i++) {
                out.println(black[i]);
            }
        }

    }
}



Measured memory_bytes: 119972
#include <stdio.h>
#include <math.h>
int main() {
    // double money=100;
    // long long count=0, x;
    // scanf("%ld",&x);
    // for(;money<x;count++) {
    //     money*=1.01;
    //     money=floor(money);
    // }
    // printf("%ld",count);
    long long money=100,count=0,x;
    scanf("%ld",&x);
    while(1) {
        if (money>=x) {
            printf("%ld",count);
            return 0;
        }
        money+=money/100;
        count++;
    }
}


Measured memory_bytes: 1732
#include <bits/stdc++.h>
#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set

using namespace std;

const ll MOD = 1000000007;

int main() {
  std::cout << std::fixed << std::setprecision(10);

  ll t, x;
  scanf("%lld %lld", &t, &x);

  cout << (t * 1.0 / x) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
	long n,t;
  	cin>>n>>t;
  	long sum = 0;
  	while(t--){
    	long a;
      	cin>>a;
      	sum+=a;
    }
  	if(sum>n){
      cout<<-1<<endl;
    }
  	else {
      cout<<n-sum<<endl;
    }
  	return 0;
}

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

int main() {
	int N;
	cin >> N;
	int (*coord)[100] = new int[100][100];
	int xs[100];
	int ys[100];
	int x, y, h;
	int k = 0;
	while (cin >> x >> y >> h)
	{
		xs[k] = x;
		ys[k++] = y;
		coord[x][y] = h;
	}
	
	long long int pre_H;
	long long int H = 1;
	long long int max_H = 1000000000 + 201;
	int i = 0;
	int Cx = 0;
	int Cy = 0;
	for (Cx = 0; i < N && Cx <= 100; Cx++)
		for (Cy = 0; i < N && Cy <= 100; Cy++)
		{
			long long int temp_H = 0;
			for (i = 0; i < N; i++)
			{
				if (coord[xs[i]][ys[i]] > 0)
				{
					H = abs(xs[i] - Cx) + abs(ys[i] - Cy) + coord[xs[i]][ys[i]];
					if (temp_H == 0)
						temp_H = H;
					if (H != temp_H || H > max_H) 
						break;
				}
				else
				{
					max_H = abs(xs[i] - Cx) + abs(ys[i] - Cy) + coord[xs[i]][ys[i]];
					if (temp_H != 0 && temp_H > max_H)
						break;
				}
			}
				
		}
	delete[] coord;
	cout << Cx - 1 << ' ' << Cy - 1 << ' ' << H;
}

Measured memory_bytes: 3216
$<.readlines.drop(1).map {|a| a.split.map(&:to_f)}.each do |xa, ya, ra, xb, yb, rb|
  l = Math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
  r = ra - rb
  puts case
       when l < r  then 2
       when l < -r then -2
       when l > ra + rb then 0
       else 1
       end
end


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

int main() {
	int64_t a, b, n;
	cin >> a >> b >> n;
	if(b <= n) {
		cout << (a*(b-1))/b << endl;
	}
	if(b > n) {
		cout << (a*n)/b << endl;
	}
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int> > pipii;
typedef priority_queue<pii,vector<pii>,greater<pii>> minpq;
typedef priority_queue<pii> maxpq;
//const double PI = acos(-1);
const int mod = 1000000007;





int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    vi arr(n);
    fo(i,n) cin>>arr[i];
    sort(all(arr));
    int sum=0;
    fo(i,k){
        sum+=arr[i];
    }
    cout<<sum<<endl;
 



	
	
	
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    double L;
    cin>>L;
    double ans = pow((L/3),3);
    cout << setprecision(20) << ans << endl;
    return 0;
}

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

int main() {
    int n,len,sum=0;
    cin>>n;
    len = 1+log10(n);
    for(int i=1;i<len;i++)
    {
        if(i%2==1)
            sum += 9*pow(10,i-1);
    }
    if(len%2==1)
    sum += (n-pow(10,len-1))+1;
    cout<<sum;
    
	return 0;
}

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

int main()
{
    int64_t n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n>k){
    cout<<(k*x)+((n-k)*y);
    }
    else cout<<n*x;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstring>
#include <cmath>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
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; }

const int INF = 1e9;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, u, v;
  cin >> n >> u >> v;
  u--, v--;
  vector<vector<int>> to(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<int> dist1(n, INF), dist2(n, INF);
  dist1[u] = 0;
  queue<int> que;
  que.push(u);
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (auto next : to[now]) {
      if (chmin(dist1[next], dist1[now]+1))
        que.push(next);
    }
  }
  dist2[v] = 0;
  que.push(v);
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (auto next : to[now]) {
      if (chmin(dist2[next], dist2[now]+1))
        que.push(next);
    }
  }
  int ans = 0;
  rep(i, n) {
    if (dist1[i] < dist2[i])
      chmax(ans, dist2[i]-1);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define INF 10001000
using namespace std;
int n,k,m,a,b,c,d,e,DS[105][105];

int main(){
    while(1){
        fill(DS[0],DS[104],INF);
        for(int i=1;i<105;i++)DS[i][i]=0;
        cin >> n >> k;
        if(n==0&&m==0)break;
        for(int i=0;i<k;i++){
            cin >> m;
            if(m==0){
                cin >> a >> b;
                if(DS[a][b]!=INF)cout << DS[a][b] << endl;
                else cout << -1 << endl;
            }else{
                cin >> c >> d >> e;
                if(DS[c][d]>e||DS[d][c]>e){
                    DS[c][d]=e;
                    DS[d][c]=e;
                }
                for(int s=1;s<=n;s++){
                    for(int j=1;j<=n;j++){
                        DS[s][j]=min(DS[s][j],DS[s][c]+DS[c][j]);
                        DS[j][s]=min(DS[j][s],DS[j][d]+DS[d][s]);
                        DS[j][s]=DS[s][j]=min(DS[j][s],DS[s][j]);
                    }
                }
            }
        }


    }
return 0;
}

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

using namespace std;

typedef long long ll;
ll n, b[100005], fa[100005], length[100005], f[100005];
bool islead[100005];
struct lala
{
	ll v, id;
	friend bool operator < (lala a, lala b)
	{
		return a.v > b.v;
	}
}a[100005];

ll ef(ll ls, ll rs, ll val)
{
	if (ls == rs) return ls;
	ll mid = (ls + rs) / 2;
	if (a[mid].v <= val) return ef(ls, mid, val);
	else return ef(mid + 1, rs, val);
}

int main()
{
	cin >> n;
	for (ll i = 1; i <= n; i++) 
	{
		cin >> a[i].v;
		a[i].id = i;
		b[i] = a[i].v;
	}
	sort(a + 1, a + n + 1);
	for (ll i = 1; i <= n; i++)
	{
		length[i] = 1;
	}
	for (ll x = 1; x <= n; x++)
	{
		ll i = ef(1, n, a[x].v - n + length[x] * 2);
		if (a[i].v == a[x].v - n + length[x] * 2 && a[x].v > a[i].v)
		{
			fa[x] = i;
			length[i] += length[x];
			f[i] += f[x] + length[x];
		}
	}
	if (f[n] != a[n].v)
	{
		cout << "-1" << endl;
		return 0;
	}
	for (ll i = 1; i < n; i++)
	{
		cout << a[i].id << " " << a[fa[i]].id << endl;
	}
	return 0;
}
/*
7 10 15 13 18 11 14 19
*/


Measured memory_bytes: 6144
/**
SXR0aXAkI0JwbXptI3FhI3Z3I293bCNqY2IjUG0jMCNicG0jVHFkcXZvLyNCcG0jQW10bjBhY2phcWFicXZvLyNNYm16dml0MSNWdyNhdGN1am16I2tpdiNhbXF9bSNQcXUjVnd6I0F0bW14MSNQcWEjaXptI2l0dCNicHF2b2EjUXYjYnBtI3BtaWRtdmEjaXZsI3d2I21pemJwMSNFcHcjcWEjYnBtem0ja2l2I3F2Ym16a21sbSNRdiNQcWEjeHptYW12a20jbXtrbXhiI0lhI3BtI3htenVxYmJtYnBHI1BtI3N2d2VtYnAjRXBpYiMraXh4bWl6bWJwI2J3I1BxYSNrem1pYmN6bWEjSWEsI0ptbnd6bSN3eiNJbmJteiN3eiNKbXBxdmwjYnBtdTEjVnd6I2FwaXR0I2JwbXwja3d1eGlhYSNJY29wYiN3biNwcWEjc3Z3ZXRtbG9tI017a214YiNpYSNQbSNlcXR0bWJwMSNQcWEjYnB6d3ZtI2x3YnAjbXtibXZsI1dkbXojYnBtI3BtaWRtdmEjSXZsI3d2I21pemJwLyNpdmwjUG0jbm1tdG1icCNWdyNuaWJxb2NtI3F2I29jaXpscXZvI0l2bCN4em1hbXpkcXZvI2JwbXUvI053eiNQbSNxYSNicG0jVXdhYiNQcW9wMSNCcG0jQWN4em11bSMrcXYjb3R3enwsMQ==
*/
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>

#define F first
#define S second
#define endl '\n'
#define pb push_back

const long long MOD = 1e9 + 7;
const long long MAXN = 1e6 + 1;
using namespace std;

typedef long long ll;

long long readInt() {
    bool minus1 = false;
    long long result = 0;
    char ch;
    ch = getchar();
    while (true) {
        if (ch == '-') break;
        if (ch >= '0' && ch <= '9') break;
        ch = getchar();
    }
    if (ch == '-') minus1 = true; else result = ch-'0';
    while (true) {
        ch = getchar();
        if (ch < '0' || ch > '9') break;
        result = result*10 + (ch - '0');
    }                                     
    if (minus1)
        return -result;
    else
        return result;
}

int a_cnt[MAXN];
int b_cnt[MAXN];

int main() {
	#ifdef IZI_KATKA
	assert(freopen("input", "r", stdin));
    assert(freopen("output", "w", stdout));
    #endif
    string a;
    string b;
    cin >> a >> b;
    for (int i = 0; i < a.size(); i++) {
		a_cnt[i+1] += a_cnt[i] + (a[i] == 'A');
    }
    for (int i = 0; i < b.size(); i++) {
		b_cnt[i+1] += b_cnt[i] + (b[i] == 'A');    	
    }
	int q =readInt();
	while(q--) {
		int L1 = readInt(), R1 = readInt(), L2 = readInt(), R2 = readInt();
		int cnt_A_a = a_cnt[R1] - a_cnt[L1 - 1]; 
		int cnt_B_a = R1-L1+1 - cnt_A_a;
		int cnt_A_b = b_cnt[R2] - b_cnt[L2 - 1];
		int cnt_B_b = R2-L2+1 - cnt_A_b;
		int mn;
		mn = min(cnt_A_a, cnt_B_a);
		cnt_A_a -= mn;
		cnt_B_a -= mn;
		mn = min(cnt_A_b, cnt_B_b);
		cnt_A_b -= mn;
		cnt_B_b -= mn;
		cnt_A_a %= 3;
		cnt_A_b %= 3;
		cnt_B_a %= 3;
		cnt_B_b %= 3;
		if (cnt_A_a == cnt_A_b && cnt_B_b == cnt_B_a) {
			cout << "YES\n";
			continue;
		}
		if ((cnt_A_a + cnt_B_a * 2) % 3 == (cnt_A_b + cnt_B_b * 2) % 3) {
			cout << "YES\n";
			continue;
		}
		cout << "NO\n";
	}
    return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int dx[] = {0, 0, 1, -1};
constexpr int dy[] = {1, -1, 0, 0};

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

    int n;
    ll a[1010];

    cin >> n;

    a[0] = 0;
    a[n + 1] = 0;

    REP(i, n)
    cin >> a[i + 1];

    bool m = true;
    for (int i = 1; i <= n; i++)
        if (a[i] >= 0)
            m = false;

    if (m)
    {
        ll mi = LLONG_MIN;
        for (int i = 1; i <= n; i++)
            mi = max(mi, a[i]);

        cout << mi << endl;
        cout << n - 1 << endl;

        int i = 1;
        while (a[i] != mi)
        {
            cout << 1 << endl;
            i++;
        }

        for (int j = n; j > i; j--)
            cout << j - i + 1 << endl;

        return 0;
    }

    ll sum1 = 0;
    ll sum2 = 0;

    V v1;
    V v2;

    for (int i = 1; i <= n; i++)
    {
        if (a[i] < 0)
            continue;

        if (i % 2)
        {
            sum1 += a[i];
            v1.push_back(i);
        }
        else
        {
            sum2 += a[i];
            v2.push_back(i);
        }
    }

    V res;

    int len = n;

    if (sum1 > sum2)
    {
        int p = 1;
        for (int i = 1; i < v1[0]; i++)
            res.push_back(p), len--;

        int i = 0;
        while (i + 1 < v1.size())
        {
            for (int j = (v1[i + 1] - v1[i]) / 2; j > 0; j--)
                res.push_back(p + j);

            len -= v1[i + 1] - v1[i];

            i++;
        }

        for (int i = v1[v1.size() - 1] + 1; i <= n; i++)
            res.push_back(len), len--;
    }
    else
    {
        int p = 1;
        for (int i = 1; i < v2[0]; i++)
            res.push_back(p), len--;

        int i = 0;
        while (i + 1 < v2.size())
        {
            for (int j = (v2[i + 1] - v2[i]) / 2; j > 0; j--)
                res.push_back(p + j);

            len -= v2[i + 1] - v2[i];

            i++;
        }

        for (int i = v2[v2.size() - 1] + 1; i <= n; i++)
            res.push_back(len), len--;
    }

    REP(i, len / 2)
    res.push_back(2);

    cout << max(sum1, sum2) << endl;

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

    for (int i : res)
        cout << i << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    
    long a=sc.nextLong();
    long b=sc.nextLong();
    long x=sc.nextLong();
    sc.close();
    b=b/x*x;
    if(a%x>0){
      a=(a/x+1)*x;
    }
    System.out.println((b-a)/x+1);
  }
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <utility>
#include <climits>
#include <bitset>

using namespace std;
#define li long long int
#define FOR(i, a, b) for (int i = a ; i < b ; ++i)
#define REP(i, n) for (int i = 0 ; i < n ; ++i)

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

li N = 0;

inline li dfs(li n) {
    if (n > N) return 0;

    bool hasSeven = false;
    bool hasFive = false;
    bool hasThree = false;
    li a = n;
    while(a > 0) {
        if (a % 10 == 7) { hasSeven = true; };
        if (a % 10 == 5) { hasFive = true; };
        if (a % 10 == 3) { hasThree = true; };
        a = a / 10;
    }
    li ret = (hasSeven && hasFive && hasThree) ? 1 : 0;
    ret += dfs(n * 10 + 7);
    ret += dfs(n * 10 + 5);
    ret += dfs(n * 10 + 3);

    return ret;
}

int main(void) {
    cin >> N;

    li ans = dfs(0);
    cout << ans;

    return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  int C = nextInt();
  cout << (A+B+C - max(A, max(B,C))) << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define Mp                          make_pair
#define sep                         ' '
#define endl                        '\n'
#define debug(x)                    cerr << #x << " = " << x << endl
#define SZ(x)                       ll(x.size())
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define set_random                  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, mn = INF, A;
set<pll> st;

int main() {
    fast_io;

    cin >> n;
    for (ll i = 0; i < n; i++) {
        cin >> A;
        auto it = st.lower_bound({A, -INF});
        if (it == st.begin()) {
            st.insert({A, i});
        } else {
            it = prev(it);
            st.erase(it);
            st.insert({A, i});
        }
    }
    cout << st.size() << endl;

    return 0;
}
/*

*/


Measured memory_bytes: 6528
using System;
using System.IO;

namespace AizuOnline
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var H = new int[1000];
            var W = new int[1000];
            var i = 0;

            while (true)
            {
                var x = Console.ReadLine().Split(' ');

                H[i] = Convert.ToInt32(x[0]);
                W[i] = Convert.ToInt32(x[1]);
                if (H[i] == 0)
                {
                    break;
                }
                i++;
            }

            for (int m = 0; m < H.Length && H[m] != 0; m++)
            {
                for (int k = 0; k < H[m]; k++)
                {
                    for (int j = 0; j < W[m]; j++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 8948
// https://atcoder.jp/contests/abc139/tasks/abc139_c

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    int cont = 0;
    long prev;
    cin >> prev;
    for (int i = 1; i < n; i++)
    {
        long h;
        cin >> h;
        if (h <= prev)
        {
            cont++;
        }
        else
        {
            ans = max(ans, cont);
            cont = 0;
        }
        prev = h;
    }
    ans = max(ans, cont);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e9
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;

int n,ans;
vector<int> vec;
signed main(){
    cin>>n;
    rep(i,n){
        int a;
        cin>>a;
        vec.push_back(a);
    }
    sort(vec.begin(),vec.end());
    vec.push_back(INF);
    int abc_n=0;
    int idx=0;
    for(int i=0;i<112345;i++){
        while(vec[idx]<i){
            idx++;
        }
        if(n/2==idx)ans++;
    }
    cout<<ans<<endl;

}

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


def solve(N: int, A: "List[int]"):
    count = 0
    for n in range(1, N):
        if A[n - 1] <= A[n]:
            continue
        need = A[n - 1] - A[n]
        count += need
        A[n] += need 
    print(count)

    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 93220
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const ll mod = 1e9 + 7;
int main()
{
	SPEED
	ll n, k;
	cin >> n >> k;
	vector<ll> arr(n+1);
	arr[0] = 0;
	for (ll i = 1; i < n+1; ++i)
	{
		arr[i] = i + arr[i-1];
	}

	ll ans = 0;
	for (ll i = k; i < n+1; ++i)
	{
		ll mini = arr[i-1];
		ll maxi = arr[n] - arr[n-i];
		//cout << "k : " << i << " max : " << maxi << " min : " << mini << '\n';
		ans += (maxi - mini + 1);
		ans = ans%mod;
	}

	ans++;
	ans = ans%mod;
	cout << ans;

	return 0;
}

Measured memory_bytes: 4716
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <array>
#include <cassert>
#include <utility>
#include <vector>
#include <atcoder/all>

template <class InputIterator>
std::ostream& range_output(std::ostream& os_arg, InputIterator first_arg, InputIterator last_arg){ if(first_arg != last_arg){ do{ os_arg << *(first_arg++); if(first_arg == last_arg) break; os_arg << ' '; } while(true); }  return os_arg; }
template <class Tp> std::ostream& operator << (std::ostream& os_arg, const std::vector<Tp>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class Tp, std::size_t Size> std::ostream& operator << (std::ostream& os_arg, const std::array<Tp, Size>& arr_arg){ return range_output(os_arg, arr_arg.cbegin(), arr_arg.cend()); }
template <class S, class T> std::ostream& operator << (std::ostream& os_arg, const std::pair<S, T>& pair_arg){ return os_arg << '(' << pair_arg.first << ", " << pair_arg.second << ')'; }

#ifndef ONLINE_JUDGE
    template <typename Head> void dump_out(Head head_arg){ std::cerr << head_arg << '\n'; }
    template <typename Head, typename... Tail>
    void dump_out(Head head_arg, Tail... tail_args){ std::cerr << head_arg << ", "; dump_out(tail_args...); }
    #define dump(...) do { std::cerr << "[in line " << __LINE__ << "] " << #__VA_ARGS__ << " : "; dump_out(__VA_ARGS__); } while(false)
#else
    #define dump(...) (void(0))
#endif


constexpr int max(int a, int b){ return (a > b) ? a : b; }
constexpr int id(void){ return std::numeric_limits<int>::min(); }
using seg_tree_t = atcoder::segtree<int, max, id>;



int main(void){
    std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); 
    std::cout << std::fixed << std::setprecision(16);
    int n, q; std::cin >> n >> q;
    std::vector<int> A(n); for(auto& itr : A) std::cin >> itr;
    seg_tree_t ST(A);
    while(q--){
        char c; int x, y; std::cin >> c >> x >> y;
        if(c == '1') ST.set(x - 1, y);
        else if(c == '2') std::cout << ST.prod(x - 1, y) << '\n';
        else{
            const int r = ST.max_right(x - 1, [&](int v){ return v < y; });
            std::cout << r + 1 << '\n';
        }
    }

    return 0;
}

Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;
typedef pair<llint, vector<int> > T;

llint D;
llint c[30], csum;
llint s[400][30];
vector<int> ans;
vector<T> vec;

llint score(vector<int> ans, llint n)
{
	llint last[26];
	for(int i = 0; i < 26; i++) last[i] = -1;
	
	llint ret = 0, sub = 0;
	for(int i = 0; i < n; i++){
		llint x = ans[i];
		ret += s[i][x];
		sub -= (i-last[x]) * c[x];
		sub += csum;
		ret -= sub;
		last[x] = i;
	}
	return ret;
}

void search(vector<int> &ret)
{
	llint cur = score(ret, D);
	for(int t = 0; t < 2; t++){
		llint x = rand() % D, y = rand() % D;
		swap(ret[x], ret[y]);
		llint nxt = score(ret, D);
		if(nxt < cur) swap(ret[x], ret[y]);
		else cur = nxt;
		
		x = rand() % D, y = rand() % 26;
		llint tmp = ret[x];
		ret[x] = y;
		nxt = score(ret, D);
		if(nxt < cur) ret[x] = tmp;
		else cur = nxt;
	}
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	srand(time(NULL));
	
	cin >> D;
	for(int i = 0; i < 26; i++) cin >> c[i];
	for(int i = 0; i < D; i++){
		for(int j = 0; j < 26; j++){
			cin >> s[i][j];
		}
	}
	for(int i = 0; i < 26; i++) csum += c[i];
	
	ans.resize(D);
	for(int i = 0; i < D; i++){
		llint max_val = -inf, max_j;
		for(int j = 0; j < 26; j++){
			ans[i] = j;
			llint res = score(ans, i+1);
			if(res > max_val){
				max_j = j;
				max_val = res;
			}
		}
		ans[i] = max_j;
	}
	search(ans);
	
	const int M = 100;
	llint res = score(ans, D);
	for(int i = 0; i < M; i++) vec.push_back(T(res, ans));
	
	for(int t = 0; t < 3000; t++){
		vector<T> nvec;
		for(int i = 0; i < vec.size(); i++){
			vector<int> tmp = vec[i].second;
			search(tmp);
			nvec.push_back(vec[i]);
			nvec.push_back(T(score(tmp, D), tmp));
		}
		sort(nvec.rbegin(), nvec.rend());
		nvec.resize(M);
		vec = nvec;
	}
	ans = vec.front().second;
	
	for(int i = 0; i < D; i++) cout << ans[i]+1 << endl;
	
	return 0;
}


Measured memory_bytes: 3876