akhauriyash/Code-Regression huggingface dataset:
/**
                 MD.Faysal Hasan
                Comilla Univesity               **/

#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<string>
#include<stdlib.h>
using namespace std;

#define         rep(i,n)       for ( i=0 ; i<n ; ++i )
#define         rep1(i,n)      for ( i=1 ; i<=n ; ++i )
#define         sajo(str)      sort(str.begin(),str.end())
#define         rev(str)       reverse(str.begin(),str.end())
#define         usajo(str)     sort(str.rbegin(),str.rend())
#define         input(a)       for(auto &it : a) cin>>it
#define         pi             2*acos(0.0)
#define         nel            printf("\n")
#define         longmx         92233720368547758
#define         gcd(a,b)       __gcd(a,b)
#define         lcm(a,b)       (a/gcd(a,b))*b
#define         yes            cout<<"Yes"<<"\n"
#define         no             cout<<"No"<<"\n"
#define         vcl            vector<ll>
#define         vpl            vector<pair<ll,ll>>
#define         pb             push_back
#define         mkp(x,y)       make_pair(x,y)
#define         ff             first
#define         sc             second
#define         spc            ' '
#define         nn             '\n'
#define         ikarus_101     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef         long long int  lli;
typedef         long long      ll;

int main(){ikarus_101

    ll ans,sum,tot,cnt,mx,mn,idx,chk,tmp,mid,lft,rgt,pos;
    ll tc,n,m,a,b,c,d,g,h,l,r,x,y,i,j,k;

    cin>>a;
    cout<<fixed<<setprecision(40)<<2.0*pi*double(a)<<nn;
    return 0;
}


Measured memory_bytes: 3788
#include <iostream>

int solve(int a, int b)
{
    for (auto i : {1, 2, 3})
    {
        if (i != a && i != b)
        {
            return i;
        }
    }

    return 0;
}

int main()
{
    int a, b;
    std::cin >> a >> b;

    std::cout << solve(a, b) << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;

using ll = long long;

int main()
{
  ll k, a, b;
  scanf("%lld %lld %lld", &k, &a, &b);
  if ((b - a <= 2) || (k<a-1)) {
    printf("%lld\n", k+1);
    return 0;
  }
  ll count = k - (a-1);
  ll cookies = a;
  cookies += (b-a)*(count / 2LL);
  if ((count % 2LL) == 1) cookies++;
  if (cookies > k+1) {
    printf("%lld\n", cookies);
  }
  else {
    printf("%lld\n", k+1);
  }
  return 0;
}


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

int main(){
	int A,B,C,D,P;
	cin>>A>>B>>C>>D>>P;

		if(P<=C){
			if(P*A<B){
				cout<<P*A<<endl;
			}else{ 
				cout<<B<<endl;
			}
		}else{
			if(P*A<B+D*(P-C)){
				cout<<P*A<<endl;
			}else{
				cout<<B+D*(P-C)<<endl;
			}
		}

return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int cnt = 0;
		for ( int i = 0; i < n; i++ ) {
			if(in.nextInt() >= k)cnt++;
		}
		System.out.println(cnt);
		in.close();
	}
}

Measured memory_bytes: 48852
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

/*
 *変数
 */
int n;

/*
 *解 
 */
void solve(){
    if(n>=1000)printf("ABD");
    else printf("ABC");
}

/*
 *入力 
 */
int main(){
       std::cin.tie(0);
       std::ios::sync_with_stdio(false);
       std::cin>>n;
       solve();
       return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    
    ll h, w; cin >> h >> w;
    vvl c(10, vl(10, 0));
    REP(i, 10) REP(j, 10){
        cin >> c[i][j];
    }
    vvl a(h, vl(w, 0)); REP(i, h) REP(j, w) cin >> a[i][j];
    
    vl v(10);
    REP(i, 10){
        v[i] = i;
    }
    v.erase(v.begin()+1);
    vl mv(10, LINF); mv[1] = 0;
    do{
        ll sum = 0;
        REP(i, 9){
            ll id = v[i]; // index
            if(i == 0){
                sum += c[id][1];
            }
            else{
                sum += c[id][v[i-1]];
            }
            mv[id] = min(mv[id], sum);
        }
    }while(next_permutation(v.begin(), v.end()));
    
    ll ans = 0;
    REP(i, h) REP(j, w){
        if(a[i][j] == -1) continue;
        ans += mv[a[i][j]];
    }
    cout << ans << endl;
    return 0;
    return 0;
}


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

int main(){
    int a,b,c ;
    cin >> a >> b >> c ;
    if(a>b){ int d = a ; a = b ; b = d ; }
    if(b>c){ int d = b ; b = c ; c = d ; }
    int d = c-a+c-b ;
    if(d%2==0) cout << d/2 << endl ;
    else cout << d/2+2 << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

vector<ll> v(1010, 0);

void primeFac(int x) {
  int tmp = x;
  while (x > 1) {
    for (int i = 2; i <= tmp; i++) {
      if (x % i == 0) {
        x /= i;
        v.at(i)++;
        break;
      }
    }
  }
}

int main() {
  int n; cin >> n;
  for (int i = 1; i <= n; i++) {
    primeFac(i);
  }

  ll ans = 1;
  for (int i = 2; i <= n + 1; i++) {
    ans = (v.at(i) + 1) * ans % 1000000007;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP
*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define PB push_back
#define IN insert
#define MP make_pair
#define PI acos(-1)
#define LW(v) sort(v.begin(),v.end());
#define HI(v) sort(v.begin(),v.end(),greater<long long>());
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie (0);
    long long t,r=1,i=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    multiset<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n;
    l(i,1,n)
    {
        cin>>a;
        s.IN(a);
    }
    l(i,1,n+1)
    {
        cout<<s.count(i)<<endl;
    }
}


Measured memory_bytes: 13064
#include <iostream>
#define llint long long
using namespace std;

llint s;
bool used[5];

int main(void)
{
	cin >> s;
	if(s <= 4) used[s] = true;
	
	for(int i = 2;; i++){
		if(s%2) s = 3*s+1;
		else s /= 2;
		for(int j = 1; j <= 4; j++){
			if(s == j){
				if(used[j]){
					cout << i << endl;
					return 0;
				}
				used[j] = true;
			}
		}
	}
	return 0;
}

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

double T,ans=1e9;
int D,ta,tb,da,db;

int main(){
  cin>>T>>D>>ta>>tb>>da>>db;
  for(int i=0;i<=D;i+=da){
    for(int j=0;i+j<=D;j+=db){
      if(i==0&&j==0)continue;      
      double k=(double)(ta*i+tb*j) / (double)(i+j);
      ans=min(ans, abs(T-k));
    }
  }
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

int main() {
    int N,M;cin>>N>>M;
    vector<ll> a(N);
    vector<P> bc(M);
    rep(i,N) cin>>a[i];
    sort(a.begin(),a.end());
    rep(i,M) {
        int b,c;cin>>b>>c;
        bc[i] = P(c,b);
    }
    sort(bc.begin(),bc.end());
    reverse(bc.begin(),bc.end());

    int now = 0;
    ll ans = 0;
    rep(i,M) {
        ll c = bc[i].first,b = bc[i].second;
        int plc = lower_bound(a.begin(),a.end(),c) - a.begin();
        if(plc - now <= b) {
            ans += c * (plc - now);
            for (int j = plc;j<N;j++) {
                ans += a[j];
            }
            cout<<ans<<endl;
            return 0;
        } else {
            ans += b * c;
            now += b;
        }
        // cout<<ans<<endl;
    }
    for (int j = now;j<N;j++) {
        ans += a[j];
    }
    cout<<ans<<endl;
}

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

int main() {
  int n;
  string s;
  cin>>n>>s;
  int vec[26]={0},vecb[26]={0};
  int p,q,ans=0;
  for(int i=0;i<n-1;i++){
    for(int j=0;j<26;j++){
      vec[j]=0;
      vecb[j]=0;
    }
    for(int j=0;j<=i;j++){
      p=0;
      for(char x='a';x<='z';x++){
        if(x==s[j]){
          vec[p]++;
        }
        p++;
      }
    }
    for(int j=i+1;j<n;j++){
      p=0;
      for(char x='a';x<='z';x++){
        if(x==s[j]){
          vecb[p]++;
        }
        p++;
      }
    }
    q=0;
    for(int j=0;j<26;j++){
      if(vec[j]>0&&vecb[j]>0){
        q++;
      }
    }
    ans=max(ans,q);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

struct P {
	int x;
	int y;
};

void add(vector<vector<bool>>& map, vector<vector<int>>& d, queue<P>& s, int x, int y, int v, int h, int w)
{
	if (x < 0 || w <= x) return;
	if (y < 0 || h <= y) return;
	if (!map[y][x]) return;
	if (d[y][x] != -1) return;

	s.push({ x, y });
	d[y][x] = v;
}

int search(vector<vector<bool>>& map, int h, int w, int sx, int sy, int ex, int ey)
{

	vector<vector<int>> dist(h, vector<int>(w, -1));
	queue<P> s;
	dist[sy][sx] = 0;
	s.push({ sx, sy });
	while (!s.empty()) {
		P p = s.front();
		s.pop();

		if (p.x == ex && p.y == ey) break;

		int v = dist[p.y][p.x] + 1;
		add(map, dist, s, p.x - 1, p.y, v, h, w);
		add(map, dist, s, p.x + 1, p.y, v, h, w);
		add(map, dist, s, p.x    , p.y + 1, v, h, w);
		add(map, dist, s, p.x    , p.y - 1, v, h, w);
	}

	return dist[ey][ex];
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int h, w; cin >> h >> w;
	int size = h * w;

	vector<vector<bool>> map(h, vector<bool>(w));
	FOR_LT(i, 0, h) {
		FOR_LT(j, 0, w) {
			char c; cin >> c;
			if (c == '.') map[i][j] = true;
		}
	}

	int ans = 0;
	FOR_LT(s, 0, size) {
		FOR_LT(e, 0, size) {
			if (s == e) continue;
			int sx = s % w;
			int sy = s / w;
			int ex = e % w;
			int ey = e / w;

			if (!map[sy][sx] || !map[ey][ex]) continue;

			int ca = search(map, h, w, sx, sy, ex, ey);
			ans = max(ans, ca);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main()
{
    int w, h, x, y, r;
 
    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);
     
    if(w < x + r || 0 > x - r || h < y + r || 0 > y - r){
        printf("No\n");
    }
    if(w >= x + r && 0 <= x - r && h >= y + r && 0 <= y - r){
        printf("Yes\n");
    }
 
    return 0;
}

Measured memory_bytes: 1816
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Map<String, Long> map = new HashMap<>();
		long total = 0;
		for ( int i = 0; i < n; i++ ) {
			char[] s = in.next().toCharArray();
			Arrays.sort(s);
			String key = new String(s);
			Long cnt = (map.containsKey(key) ? map.get(key) + 1 : 1);
			map.put(key, cnt);
			total += cnt - 1;
		}

		System.out.println(total);
		in.close();
	}
}

Measured memory_bytes: 52776
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define PI 3.141592653589793
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  N++;
  string S;
  cin >> S;
  vll v(0);
  for(int i = 0; i < N; i++){
    if(S.at(i) == '0') v.push_back(i);
  }
  ll now = N-1;
  vll ans(0);
  while(true){
    ll target = now - M;
    auto ite = lower_bound(ALL(v), target);
    if(*ite == now){
      cout << -1 << endl;
      return 0;
    }
    ans.push_back(now - *ite);
    now = *ite;
    if(now == 0) break;
  }
  ll anum = ans.size();
  for(int i = anum-1; i >= 0; i--){
    cout << ans.at(i);
    if(i == 0) cout << endl;
    else cout << ' ';
  }
}

Measured memory_bytes: 2628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define ps push
#define pf push_front
#define mp make_pair
#define And &&
#define Or ||
#define ppb pop_back
#define ppf pop_front
#define inf INT_MAX
#define sz(name) name.size()
#define len(name) name.length()
#define ig cin.ignore()
#define Sort(name) sort(name.begin(),name.end())
#define For(name,start,finish) for(int name=start;name<finish;name++)
#define fast_in_out ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//int row[]={-1,0,1,0};
//int col[]={0,1,0,-1};

const ll N=2e5+10;
const ll M=1e9+7;

ll Max(ll a,ll b){if(a>b)return a;return b;}
ll Min(ll a,ll b){if(a>b)return b;return a;}
ll big_mul(ll a,ll b,ll m){ll x=0,y=a%m;while(b>0){if(b&1)x=(x+y)%m;y=(2*y)%m;b>>=1;}return x%m;}
ll big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=(x*y)%m;y=(y*y)%m;b>>=1;}return x%m;}
ll Big_mod(ll a,ll b,ll m){ll x=1,y=a%m;while(b>0){if(b&1)x=big_mul(x,y,m);y=big_mul(y,y,m);b>>=1;}return x%m;}
ll mod_inverse(ll a,ll m){return big_mod(a,m-2,m);}  //a^-1 mod m = a^(m-2) mod m


vector<ll> vec;
vector<pair<ll,pair<ll,ll> > >  tree(5*N);

void build_tree(ll index,ll l,ll r)
{

    if(l==r)
    {
        tree[index]=make_pair(vec[l],make_pair(l,r));
        return;
    }

    int mid=(l+r)/2;

    build_tree(2*index+1,l,mid);
    build_tree(2*index+2,mid+1,r);

    tree[index].second.first=l;
    tree[index].second.second=r;
    tree[index].first=Max(tree[2*index+1].first,tree[2*index+2].first);

}

ll ans(ll index,ll a,ll b)
{

    ll l=tree[index].second.first;
    ll r=tree[index].second.second;


    if(a>r||b<l)
        return 0;

    if(a<=l&&b>=r)
        return tree[index].first;


    return Max(ans(2*index+1,a,b),ans(2*index+2,a,b));

}


int main()
{
    fast_in_out;

    int n;
    cin>>n;

    For(i,0,n)
    {
        ll a;
        cin>>a;
        vec.pb(a);
    }

    build_tree(0,0,n-1);

    For(i,0,n)
    {
        ll p=ans(0,0,i-1);
        ll q=ans(0,i+1,n-1);

        cout<<Max(p,q)<<endl;
    }



    return 0;
}


Measured memory_bytes: 26736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> // sort
#include <map> // pair
#include <queue>
#include<iomanip>
#include <cmath>
#include <set>
#include <unordered_set>

#define ABS(x) ((x)>0?(x):-(x))
#define MIN(x,y) ((x)>(y)?(y):(x))
#define MAX(x,y) ((x)<(y)?(y):(x))

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

#define INF 1000000000

using namespace std;
typedef long long ll;

ll newton(long long int a, long long int  b)
{
	if(a==b)
		return a;
	while(a != 0 && b != 0)
	{
		if(a > b)
		{
			b += a;
			a = b-a;
			b -= a;
		}
		b %= a;
	}
	return a;
}

struct UnionFind {
	vector<int> p;
	UnionFind(int N):p(N)
	{
		for(int i=0; i< N; i++)
		{
			p[i] = i;
		}
	}
	int root(int x)
	{
		if(p[x] == x)
			return x;
		return p[x] = root(p[x]);
	}
	void unite(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		if(rx == ry) return;
		p[rx] = ry;
	}
	bool issame(int x, int y)
	{
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

//大きな数に対する割り算をするとき、MODを指定することで掛け算の値に変換できる

ll div2mul_calc(ll a, ll b, ll m)
{
	if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll d = div2mul_calc(a, b / 2, m);
        return (d * d) % m;
    } else {
        return (a * div2mul_calc(a, b - 1, m)) % m;
    }
}
ll div2mul(ll n, ll mod)
{
	return div2mul_calc(n, mod-2, mod);
}

ll twoRow(ll a, ll b, ll mod)
{
	ll ret = 1;
	for(ll i = 1 ;i <= a+b;++i)
	{
		ret *= i;
		ret %= mod;
	}
	for(ll i = 1 ;i <= a;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	for(ll i = 1 ;i <= b;++i)
	{
		ret *= div2mul(i,mod);
		ret %= mod;
	}
	return ret;
}

struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};

vector< ll > divisor(ll n) {
  vector< ll > ret;
  for(ll i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return (ret);
}
/*
小数の桁数を指定する
	cout << setprecision(8)<< mp[0]-mx << endl;
*/

int main()
{
	ll i,j,k,a,b,ans = 0;
	ll N,M;
	cin >> N;
	
	cout << (N-1)/2 << endl;
	return 0;
}




















Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int len,c[10],a[500005],b[500005],n;
int work(int i,int j,int k){
	int cnt=0;
	if(i==0) cnt++;
	if(j==0) cnt++;
	if(k==0) cnt++;
	if(cnt>=2) return 0;
	return 1;
}
int calc(int i,int j,int k){
	len=3;
	c[1]=i; c[2]=j; c[3]=k;
	sort(c+1,c+len+1);
	return c[2];
}
int check(int x){
	for(int i=1;i<=2*n+1;++i)
		if(a[i]>=x) b[i]=1;
		else b[i]=0;
	int p0=1e9+7,p1=1e9+7;
	for(int i=1;i<2*n-1;++i)
		if(b[i]==b[i+1]){
			if(b[i]) p1=min(p1,min(abs(n-i),abs(n-i-1)));
			else p0=min(p0,min(abs(n-i),abs(n-i-1)));
		}
	if(p0==1e9+7 && p1==1e9+7) return b[1];
	return p0>p1;
}
int main(){
//	freopen("pyramid.in","r",stdin);
//	freopen("pyramid.out","w",stdout);
	int l,r,mid;
	scanf("%d",&n);
	for(int i=1;i<=2*n-1;++i)
		scanf("%d",a+i);
	l=r=a[1];
	for(int i=2;i<=2*n-1;++i)
		l=min(l,a[i]),r=max(r,a[i]);
	int ans=l;
	while(l<=r){
		int mid=(l+r+1)/2;
		if(check(mid)) l=mid+1,ans=mid;
		else r=mid-1;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int r,t,n;//(7,5)
vector <int> x,y,ans;
int posi[6][7]={{0,0,0,0,0,0,0},{1,6,11,16,21,26,31},{2,7,12,17,22,27,32},{3,8,13,18,23,28,33}
            ,{4,9,14,19,24,29,34},{5,10,15,20,25,30,35}};

int main(){

    cin >> n;
    for(int i=0;i<n;i++){
        x.clear();
        y.clear();
        ans.clear();
        cin >> r >> t;

        x.push_back(t/30);
        if(t%30!=0)x.push_back(t/30+1);
        y.push_back(r/100);
        if(r%100!=0)y.push_back(r/100+1);


        for(int i=0;i<y.size();i++){
            for(int j=0;j<x.size();j++){
                ans.push_back(posi[y[i]][x[j]]);
            }
        }

        sort(ans.begin(),ans.end());
        if(ans.size()==1)printf("%d\n",ans[0]);
        else if(ans.size()==2)printf("%d %d\n",ans[0],ans[1]);
        else printf("%d %d %d %d\n",ans[0],ans[1],ans[2],ans[3]);
    }

return 0;
}

Measured memory_bytes: 3196
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    int N;
    std::cin >> N;

    uint64_t A[N];
    uint64_t B[N];

    std::vector<uint64_t> plus;
    std::vector<uint64_t> minus;

    for (int i = 0; i < N; ++i) {
        std::cin >> A[i];
    }

    int64_t total = 0;
    for (int i = 0; i < N; ++i) {
        std::cin >> B[i];
        total += (A[i] - B[i]);
        if (A[i] < B[i]) {
            minus.push_back(B[i] - A[i]);
        } else if (B[i] < A[i]) {
            plus.push_back(A[i] - B[i]);
        }
    }

    if (total < 0) {
        std::cout << -1 << std::endl;
        return 0;
    } else if (minus.size() == 0) {
        std::cout << 0 << std::endl;
        return 0;
    }

    std::sort(plus.begin(), plus.end(), std::greater<uint64_t>());

    int m_pos = 0;
    int p_pos = 0;
    while (m_pos < minus.size()) {
        if (minus[m_pos] <= plus[p_pos]) {
            plus[p_pos] = plus[p_pos] - minus[m_pos];
            ++m_pos;
        } else {
            minus[m_pos] = minus[m_pos] - plus[p_pos];
            ++p_pos;
        }
    }

    std::cout << minus.size() + (p_pos + 1) << std::endl;

    return 0;
}

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



int main()
{
  int x, n= 0;
  cin >>x>>n;
  vector<int> p(n);
  int ans =10000;
  int anS = 0;
  if(n == 0){
    cout << x << endl;
    return 0;
  }
  

  for (int i = 0; i < n; i++)
  {
    cin >> p.at(i);   
  }
  
  bool flag = false;

  for (int i = -10; i <= 150; i++)
  {
    for (int j = 0; j < n; j++)
    {
      if(i == p.at(j)){
        flag = true;
      }
    }
    
    
    for (int k = 0; k < n; k++)
    {
      if(flag == true)
        break;

      if (i != p.at(k))
      {
        int min =abs(x-i);
        if(ans > min){
          ans = min;
          anS = i;
        }
        else if (ans == min)
        {
          ans = min;
          if(anS > i){
            anS = i;
          }
        }
      }
    }
    flag = false;
  }

  cout << anS << endl;
}


Measured memory_bytes: 3628
n,m,x = map(int,input().split())
a=list(map(int,input().split()))
cnt1, cnt2 = 0, 0
for i in range(m):
  if 0 <= a[i] < x:
    cnt1 += 1
  if x < a[i] <= a[-1]:
    cnt2 += 1
print(min(cnt1, cnt2))

Measured memory_bytes: 8992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A44 {
    class Program {
        static void Main(string[] args) {

            int n = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());
            int y = int.Parse(Console.ReadLine());
            var result = Method(k, x, y, n);
            Console.WriteLine(result);
        }

        private static int Method(int k, int x, int y, int n) {

            var result = 0;

            if (n <= k) {//k泊以内
                result += x * n;//k泊以内の宿泊料金×宿泊日数
            } else {//k泊以上
                result += x * k;
                result += (n - k) * y;//k泊以上の宿泊料金×宿泊日数
            }
            return result;
        }
    }
}



Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
typedef pair<double,double> PDD;
const LL MOD = 1e9+7;
const int INF = 1<<30;
int MAXN = 1e5+2;
const double eps = 1e-13;

int a[100009],b[100009];

int main(){
	DRII(n,k);
	REP(i,n)RII(a[i],b[i]);
	LL cmax=0;
	REPP(bi,-1,31){
		int k2=k;
		if(bi>=0){
			if(k2&(1<<bi)){
				k2^=(1<<bi);
				k2|=(1<<bi)-1;
			}
		}
		LL ans=0;
		REP(i,n){
			if((a[i]|k2)==k2)ans+=b[i];
		}
		cmax=max(cmax,ans);
	}
	printf("%lld\n",cmax);
}


Measured memory_bytes: 1024
a,b,m=map(int, input().split())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
buf=min(A)+min(B)
for i in range(m):
    x,y,c=map(int, input().split())
    cp=A[x-1]+B[y-1]-c
    if buf>=cp:
        buf=cp
print(buf)

Measured memory_bytes: 18736
N = int(input())
list1 = []
for i in range(N+1):
  if i%3 ==0 or i%5 ==0:
    list1.append(i)

total1 =0
total2 = 0
for i in list1:
  total1 += i
for i in range(N+1):
  total2 += i
print(total2 -total1)

Measured memory_bytes: 27192
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    int MOD = (int)998244353;

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int m = sc.nextInt();
        int k = sc.nextInt();

        long res = 0;

//        long pos = 1;
        long col = m;

        for (int i=0; i<n-k-2; i++) {
            col *= (m-1);
            col %= MOD;
        }

        Comb comb = new Comb(n, MOD);

        for (int i=k; 0<=i; i--) {
            long pat = comb.nCk1(n-1, i);
            pat %= MOD;
            if (!(n-k-1==0 && i==k)) col *= (m-1);
            col %= MOD;
            res += (pat * col) % MOD;
            res %= MOD;
        }

        System.out.println(res % MOD);

    }

    public class Comb {
        int n;   //　要素数
        int MOD;
        long[] facts;

        public Comb(int n, int MOD){
            this.n = n;
            this.MOD = MOD;
            facts = new long[n+1];
            facts[0] = 1;
            for (int i=1; i<n+1; i++){
                facts[i] = facts[i-1] * i % MOD;
            }
        }

        // O(log(MOD))
        public long modpow(long a, long b){
            if (b==0) return 1;
            else if (b==1) return a;
            long x = modpow(a, b/2);
            return b%2 == 0 ? x * x % MOD : x * (x*a%MOD) % MOD;
        }

        // 逆元。x^(-1)≡x^(p-2) (MOD p) xとpは互いに素。
        public long inv(long n){
            return modpow(n, MOD-2);
        }

        public long nCk1(int n, int k){
            return n < k ? 0 : facts[n] * (inv(facts[n-k]) * inv(facts[k]) % MOD) % MOD;
        }

        // O(k)
        public long nCk2(int n, int k) {
            long ret = 1;
            for (int i=0; i<k; i++) {
                ret = ret * (n - i) % MOD * inv(k - i);
                ret %= MOD;
            }
            return ret % MOD;
        }

    }

}



Measured memory_bytes: 38516
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<numeric>
#include<algorithm>
#include<tuple>
#include<cmath>

typedef unsigned long long ll;

ll DENOM = 1000000000LL + 7LL;
using namespace std;

int main(){
    ll n;
    cin >> n;
    vector<char> ret;
    while(n>0){
        char a = 'a' + ( (n-1) % 26);
        n = (n-1) / 26;        
        ret.push_back(a);
    }
    reverse(ret.begin(),ret.end());
    for(auto it = ret.begin(); it != ret.end(); ++it){
        cout << *it ;
    }
    cout << endl;
}

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

bool solve() {
    ll N;
    cin >> N;
    vector<ll> A(N), B(N);
    for ( int i = 0; i < N; i++ ) cin >> A[i];
    for ( int i = 0; i < N; i++ ) cin >> B[i];
    ll s = 0, sp = 0, sn = 0, cn_e = 0;
    for ( int i = 0; i < N; i++ ) {
        ll d = A[i] - B[i];
        s += d;
        if ( d > 0 ) sp += d;
        if ( d < 0 ) {
            sn += d;
            if ( (-d) % 2 != 0 ) cn_e++;
        }
    }
    if ( cn_e > 0 ) {
        s += cn_e;
        sn += cn_e;
        cn_e = 0;
    }
    if ( sp > 0 ) {
        s += sp;
        sn += sp * 2;
        sp = 0;
    }
    if ( sn < 0 ) {
        s += (-sn);
        sn = 0;
    }
    if ( s > 0 ) return false;
    return true;
}

int main() {
    string ans = solve() ? "Yes" : "No";
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 100005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll n,m,inn[N]; vector<ll> vc[N]; ll dp[N];
ll findans(ll i,ll p){
	if(dp[i]!=-1){
		return dp[i];
	}
	ll an=0;
	for(auto it:vc[i]){
		if(it!=p){
			an=max(an,findans(it,i)+1);
		}
	}
	return dp[i]=an;
}
int main(){
	
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

	ll i,j,k,l;
	cin>>n>>m;
	for(i=1;i<=m;i++){
		cin>>k>>l;
		vc[k].ps(l);
		inn[l]+=1;
	}
	memset(dp,-1,sizeof(dp));	
	ll an=0;
	for(i=1;i<=n;i++){
		an=max(an,findans(i,i));
	}
	cout<<an;
	return 0;
}

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

int main() {
        string s,t;
        cin>>s>>t;
        if(t.substr(0,s.size())==s)
        {
            cout<<"Yes"<<endl;
        }
        else
        {
            cout<<"No"<<endl;
        }
    
    return 0;
}

Measured memory_bytes: 3604
n,m=map(int,input().split())

ac=[False]*n
wa=[0]*n

for i in range(m):
    p,s=input().split()
    p=int(p)-1

    if s=="AC":
        ac[p]=True
    else:
        if not ac[p]:
            wa[p]+=1

a=0
b=0

for i in range(n):
    if ac[i]:
        a+=1
        b+=wa[i]

print(a,b,sep=" ")


Measured memory_bytes: 10452
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <bits/stdc++.h>   
#include <stdio.h>    
 
using namespace std;
     
#define F first
#define S second
#define lb lower_bound               
#define ub upper_bound
#define pb push_back
#define pf push_front    
#define ppb pop_back
#define mp make_pair
#define bpp __builtin_popcountll                                                                                        
#define sqr(x) ((x) * (x)) 
#define al 0x3F3F3F3F
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define in insert
#define ppf pop_front
#define endl '\n'
//#define int long long
 
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
 
const int mod = (int)1e9 + 7;
const int N = (int)2e5 + 123;
const ll inf = (ll)3e18 + 1;

const double pi = acos (-1.0);
const double eps = 1e-7;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};

int n, l, mn = mod, sum;

inline void boost () {                    
   ios_base :: sync_with_stdio (NULL);
   cin.tie (NULL), cout.tie (NULL);          
}                                                     

inline void Solve () {
   cin >> n >> l;
   int a = l * n + n * (n - 1) / 2;
   for (int i = 1; i <= n; i ++) {
      if (mn > abs (l + i - 1))
         mn = abs (l + i - 1), sum = a - (l + i - 1);
   }
   cout << sum;

}                                     

main () {                                       
// freopen (".in", "r", stdin);    
// freopen (".out", "w", stdout);              
   boost ();
   int tt = 1;
// cin >> tt;   
   while (tt --) {
      Solve ();
   }                                               
   return 0;      
}


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

int main() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    long long ans = 0;
    long long r[n],g[n],b[n];

    for(int i=0;i<n;i++){
        r[i]=0;
        g[i]=0;
        b[i]=0;
    }

    if(s[0]=='R')r[0]=1;
    else if(s[0]=='G')g[0]=1;
    else b[0]=1;

    for(int i=1;i<n;i++){
        if(s[i]=='R')r[i]++;
        else if(s[i]=='G')g[i]++;
        else b[i]++;

        r[i]+=r[i-1];
        g[i]+=g[i-1];
        b[i]+=b[i-1];
    }

    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            for(int j=i+1;j<n;j++){
                if(s[j]=='G'){
                    ans+=b[n-1]-b[j];
                }
                if(s[j]=='B'){
                    ans+=g[n-1]-g[j];
                }
            }
        }
    }

    for(int i=0;i<n;i++){
        if(s[i]=='G'){
            for(int j=i+1;j<n;j++){
                if(s[j]=='R'){
                    ans+=b[n-1]-b[j];
                }
                if(s[j]=='B'){
                    ans+=r[n-1]-r[j];
                }
            }
        }
    }

    for(int i=0;i<n;i++){
        if(s[i]=='B'){
            for(int j=i+1;j<n;j++){
                if(s[j]=='R'){
                    ans+=g[n-1]-g[j];
                }
                if(s[j]=='G'){
                    ans+=r[n-1]-r[j];
                }
            }
        }
    }

    for(int i=1;i<n;i++){
        if(2*i>n)break;
        for(int j=0;j<n;j++){
            if(j+2*i>n-1)break;
            if(s[j]!=s[j+i]&&s[j+i]!=s[j+2*i]&&s[j]!=s[j+2*i]){
                //cout << s[j] << s[j+i] << s[j+2*i] << endl;
                ans--;
            }
            
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3700
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

typedef unsigned int uint;
typedef long long llong;
typedef unsigned long long ullong;
typedef long double ldouble;

typedef vector<llong> vecllong;
typedef vector<vecllong> vvecllong;

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)

int main(void) {
    llong N, C;

    cin >> N >> C;

    vecllong x(N+2, 0), v(N+2, 0);

    FORS(i, 1, N+1) {
        cin >> x[i] >> v[i];
    }

    llong ans = 0;

    vecllong right(N+2, 0);
    llong sum = 0;
    FORS(i, 1, N+1) {
        sum += v[i];
        right[i] = max(right[i - 1], sum - x[i]);
    }
    vecllong left(N+2, 0);
    sum = 0;
    for(llong i = N; i >= 1; i--) {
        sum += v[i];
        left[i] = max(left[i + 1], sum - 2*(C - x[i]));
    }

    FOR(i, N+1) {
        ans = max(ans, left[i + 1] + right[i]);
    }

    sum = 0;
    FORS(i, 1, N+1) {
        sum += v[i];
        right[i] = max(right[i - 1], sum - 2*x[i]);
    }
    sum = 0;
    for(llong i = N; i >= 1; i--) {
        sum += v[i];
        left[i] = max(left[i + 1], sum - (C - x[i]));
    }

    FOR(i, N+1) {
        ans = max(ans, left[i + 1] + right[i]);
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3328
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
    print(1)
    exit()
elif x2 == 0:
    print(2)
    exit()
elif x3 == 0:
    print(3)
    exit()
elif x4 == 0:
    print(4)
    exit()
elif x5 == 0:
    print(5)
    exit()

Measured memory_bytes: 9124
#include <iostream>
using namespace std;
  
int main()
{ 
    int a, b, res;
    char s;
    cin >> a >> s >> b;
    while(s != '?')
    {
        switch(s)
        {
            case '+': res = a+b;break;
            case '-': res = a-b;break;
            case '*': res = a*b;break;
            case '/': res = a/b;break;
        }
        cout << res << endl;
        cin >> a >> s >> b;
    }
    
} 


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

#define MAXN 1000

using namespace std;

int main() {
#ifdef orange
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	char info;
	cin >> info;
	if (info <= 90) {
		cout << 'A' << "\n";
	} else {
		cout << 'a' << "\n";
	}

}



Measured memory_bytes: 3604
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
#cythonを使うために実行
#%load_ext Cython
#%%code
def resolve():
    H,W=map(int, input().split())
    l="#"*(W+2)
    print(l)
    for i in range(H):
        s=input()
        print("#"+s+"#")
    print(l)
#%%submit!
resolve()


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int x = stdIn.nextInt(); //動物の数
		
		int y = stdIn.nextInt(); //足の本数
		
		boolean flag = false;
		
		
		for(int i = 0; i <= x; i++) {
			for(int j = 0; j <= x-i; j++) {
				
				if(i*2+j*4 == y && i+j == x) {
					flag = true;
				}
				
			}
		}
		
		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		
		
	}

}


Measured memory_bytes: 35672
import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val n: Int = io.StdIn.readInt()
    val children = Array.fill(n)(Seq(-1,-1))
    val parent: Array[Option[Int]] = Array.fill(n)(None)
    val depth = new Array[Int](n)
    val height = new Array[Int](n)

    for {
      _ <- 0 until n
      l = io.StdIn.readLine()
    } {
      val Seq(i, c1, c2): Seq[Int] = l.split(" ", 3).map(_.toInt)
      children(i) = Seq(c1, c2)
      if (c1 != -1) parent(c1) = Some(i)
      if (c2 != -1) parent(c2) = Some(i)
    }

    def dep: Memoized[Int, Int] = Memoized {i =>
      parent(i) match {
        case None => 0
        case Some(x) => 1 + dep(x)
      }
    }
    def hgt: Memoized[Int, Int] = Memoized {i =>
      children(i) match {
        case Seq(-1, -1) => 0
        case Seq(x,  -1) => 1 + hgt(x)
        case Seq(-1,  y) => 1 + hgt(y)
        case Seq(x,   y) => 1 + (hgt(x) max hgt(y))
      }
    }
    (0 until n) foreach { i =>
      depth(i) = dep(i)
      height(i) = hgt(i)
    }

    for (i <- 0 until n) {
      val p = parent(i).getOrElse(-1)
      val s: Int = if (p == -1) -1 else children(p).filterNot(_ == i).head
      val deg: Int = children(i).filterNot(_ == -1).length
      val t = if (p == -1) "root" else if (deg == 0) "leaf" else "internal node"
      println(s"node $i: parent = $p, sibling = $s, degree = $deg, depth = ${depth(i)}, height = ${height(i)}, $t")
    }
  }

  case class Memoized[Arg, Ret](f: Arg => Ret) extends (Arg => Ret) {
    val cache: mutable.Map[Arg, Ret] = mutable.Map[Arg, Ret]()
    def apply(arg: Arg): Ret = cache.getOrElseUpdate(arg, f(arg))

  }
}

Measured memory_bytes: 44268
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 100100100100;


ll combination(ll n, ll r){
    if(n < r) return 0;
    if(r == 0||r == n) return 1;
    else if(r == 1) return n;
    return (combination(n - 1, r - 1) + combination(n - 1, r));
}

bool checkKaibun(string str){
    string checkStr = str;
    reverse(checkStr.begin(), checkStr.end());
    if(str == checkStr) return true;
    else return false;
}

int keta(ll num){
    int digits = 0;
    while(num > 0){
        num /= 10;
        digits++;
    }
    return digits;
}


int main(){
    //偶数回出てきた数字は消す
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N)cin >> a[i];
    sort(all(a));
    int ans = 0;
    int index = 0;
    while(1){
        if(index == N)break;
        int count = 0;
        int num = a[index];
        while(a[index] == num && index < N){
            count++;
            index++;
        }
        ans += count % 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        String[] str = sc.next().split("");

        str[k-1] = str[k-1].toLowerCase();
        String result = "";
        for (String s : str) result += s;
      
        System.out.println(result);
    }
}


Measured memory_bytes: 39444
# C - Low Elements
def main():
    N, *P = map(int, open(0).read().split())
    ans, cur_min = 0, P[0]
    for i in P:
        if i <= cur_min:
            ans += 1
            cur_min = i
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 25116
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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 int MOD = 1000000007;
int main() {
    int K, X;
    cin >> K >> X;
    vector<int> ve;
    rep(i, -1000000, 1000001) {
        if(X - K < i && i < X + K) {
            ve.push_back(i);
        }
    }
    rep(i, 0, ve.size()) {
        cout << ve[i];
        if(i != ve.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}

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

using namespace std;


int main(){

    string s;
    cin >> s;
    int c = 0;
    for(int i = 0;i < s.size() - 1;i++)
    {
        if(s[i] != s[i+1]) c++;
    }
    cout << c << endl;
    return 0;
}

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

int main()
{
	int n,k,x,y;
	int sum = 0;
	int j = 1;
	cin >> n >> k >> x >> y;

	for(int i = 0; i < n; i++, j++){
			if(j <= k){
				sum += x;
			}
			if(j > k){
				sum += y;
			}
	}
	
	cout << sum << endl;

	return 0;
}


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

#define ll long long
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();
    int t=1;
   // cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;

        if(b%a==0)
        {
            cout<<a+b;
        }
        else
            cout<<b-a;
    }
}


Measured memory_bytes: 256
const main = stdin => {
  const input = stdin.trim().split('\n')
  const S = input[0]

  const date = S.split('/')

  if (date[1] > 4) {
    console.log('TBD')
  } else {
    console.log('Heisei')
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


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

#define endl '\n'
#define int long long

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int h, w; cin >> h >> w;
	vector<int> row(h, 0), col(w, 0);
	map<pair<int, int>, int> mapp;
	map<int, int> rows, cols;
	int m; cin >> m;
	for(int i = 0; i < m; i ++) {
		int r, c; cin >> r >> c;
		mapp[{r, c}] ++;
		row[r - 1] ++;
		col[c - 1] ++;
	}
	int rmax = -1, cmax = -1, rans = -1, cans = -1;
	for(int i = 0; i < h; i ++) {
		if(rmax < row[i]) {
			rmax = row[i];
			rans = i + 1;
		}
	}
	for(int i = 0; i < w; i ++) {
		if(cmax < col[i]) {
			cmax = col[i];
			cans = i + 1;
		}
	}
	for(int i = 0; i < h; i ++) {
		if(row[i] == rmax) rows[i + 1] ++;
	}
	for(int i = 0; i < w; i ++) {
		if(col[i] == cmax) cols[i + 1] ++;
	}
	bool subtract = true;
	for(auto i : rows) {
		for(auto j : cols) {
			if(mapp[{i.first, j.first}] == 0) {
				cout << cmax + rmax << endl;
				return 0;
			}
		}
	}
	cout << cmax + rmax - 1 << endl;

	return 0;
}

Measured memory_bytes: 64148
#include<iostream>
#include<string>
#include<vector>
using namespace std;

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

    vector<int> A(N);
    vector<int> B(N);

    int counter = 0;
    for (int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
    }

    for(int i = 0; i < N; i++){
        if(H <= A[i] && W <= B[i]) counter++;
    }

    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef long long ll;

ll n, a, b, h[100000];

bool p(ll c) {
    ll r = 0;
    for (ll i = 0; i < n; i++) {
        ll t = h[i] - b * c;
        if (t > 0) {
            if (t % (a - b)) r += t / (a - b) + 1;
            else r += t / (a - b);
        }
    }
    return r <= c;
}

int main() {
    cin >> n >> a >> b;
    for (ll i = 0; i < n; i++) cin >> h[i];
    ll l = 0,r = 2000000000;
    while(r - l > 1) {
        int m = (l + r) / 2;
        if(p(m)) {
            r = m;
        } else {
            l = m;
        }
    }
    cout << r << endl;
}

Measured memory_bytes: 1024