akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define leading zero str.erase(0, min(str.find_first_not_of('0'), str.size()-1));
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
string text="abcdefghijklmnopqrstuvwxyz";
const int maxn=1e6+7;
//        .--------------.
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'
ll bin_pow(ll a,ll b,ll m)
{
    ll res=1;
    a%=m;
    while(b>0)
    {
        if(b&1)
            res=res*a%m;
        b>>=1;
        a=a*a%m;
    }
    return res;
}
bool miller_rabin(ll d,ll n)
{
    ll a=2+rand()%(n-4);
    ll x=bin_pow(a,d,n);
    if(x==1 || x==n-1)
        return true;
    while(d!=n-1)
    {
        x=(x*x)%n;
        d*=2;
        if(x==1)
            return false;
        if(x==n-1)
            return true;
    }
    return false;
}
bool prime(ll n,ll k)
{
    if(n==1 || n==4)
        return false;
    if(n<=3)
        return true;
    ll d=n-1;
    while(d%2==0)
        d/=2;
    for(int i=0; i<k; i++)
    {
        if(!miller_rabin(d,n))
            return false;
    }
    return true;
}
int n;
string s;
ll ans = 0;

void solve(ll x,ll y){
    if(x==n+1){
        ans += y;
        return;
    }
    ll cur = 0;
    for(ll i=x;i<=n;i++){
        cur = (10*cur) + (s[i]-'0');
        solve(i+1,y+cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(i%2==0)cout<<s[i];
    }
}


Measured memory_bytes: 3704
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    int l, r;
    int ans = 2018;
    cin >> l >> r;
    if ((l / 2019) < (r / 2019)) {
        ans = 0;
    } else {
        l %= 2019;
        r %= 2019;
        if (l >= r) {
            ans = 0;
        } else {
            for (int i = l; i < r; i++) {
                for (int j = i + 1; j <= r; j++) {
                    ans = min(ans, (i * j) % 2019);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
#include<string>
using namespace std;
#define l long long
#define pb push_back
#define mem(a,n) memset(a,n,sizeof(a))
#define find(v,n) find(v.begin(),v.end(),n)
#define sort1(v) sort(v.begin(),v.end())
#define lb(v,i,n) lower_bound(v.begin()+i,v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mod 998244353
#define reverse(s) reverse(s.begin(),s.end())
//#define pi pair<l,l> 
const double pi=3.141592653589793;
bool isprime(l n)
{
	for(l i=2;i*i<=n;i++)
	{
		if(n%i==0)
			return false;
	}
	return true;
}
vector<l> fact(l n)
{
	vector<l> v;
	for(l i=1;i*i<=n;i++)
	{
		if(n%i==0)
		{
			v.pb(i);
		}
	}
	return v;
}
l power(l a,l b)
{
	l ans=1;
	while(b>0)
	{
		if(b&1)
		{
			ans=(ans*a)%mod;
		}
		b>>=1;
		a=(a%mod*a%mod)%mod;
	}
	return ans;
}//prefixsums
void frooty()
{
	l a,b;
	cin>>a>>b;
	if(b>=(2*a)&&b<=(4*a)&&b%2==0)
		cout<<"Yes"<<"\n";
	else
		cout<<"No"<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int q=1;
	//cin>>q;
	while(q--)
	{
		frooty();
	}
}

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

int main(){
  double N,D,x,y;
  int cnt=0;
  cin >> N >> D;
  
  for(int i=0; i<N; i++){
      cin >> x >> y;
    if((x*x)+(y*y)<=D*D){
    cnt++;
    }      
  }
  cout << cnt << endl;
  
return 0;
}


Measured memory_bytes: 3684
using System;
using System.Linq;
class abc124_c{
  static void Main(){
    var cin=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    var a=cin[0];
    var b=cin[1];
    var coin=0;
    
    for(int i=0;i<2;i++){
      if(a<b){
        coin+=b;
        b--;
      } else {
        coin+=a;
        a--;
      }
    }
    
    Console.WriteLine(coin);
    return;
  }
}


Measured memory_bytes: 13268
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
void swap(int *x,int *y){
    int tmp;
    tmp=*x;
    *x=*y;  
    *y=tmp;
}

int gcd(int a,int b){
    if(a<b) swap(&a,&b);
    if(b<1) return -1;

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


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

    int ans=0;

    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                int ij=gcd(i,j);
                ans+=gcd(ij,k);
            }
        }
    }
    printf("%d",ans);

    return 0;
}


Measured memory_bytes: 1720
_ = int(input())
h = [int(word) for word in input().split()]

prev_hi = h[0]
satisfies = False

for hi in h:
    if hi - 1 >= prev_hi:
        prev_hi = hi - 1
    elif hi >= prev_hi:
        prev_hi = hi
    else:
        break
else:
    satisfies = True

print('Yes' if satisfies else 'No')


Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;
#define inf 1e9

int main() {
    string s;
    cin>>s;
    int ans=0;
    rep(i,3) {
        if (s[i]=='1') ans++;
    }
    cout<<ans<<endl;
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;

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

int solve(int a) {
    int res = 0;
    while(a > 0) {
        res += a % 10;
        a /= 10;
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    int ans = INF;
    rrep(i, n - 1) {
        int a = i, b = n - a;
        ans = min(ans, solve(a) + solve(b));
    }
    cout << ans << endl;

    return 0;
}

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

#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))
using namespace std;

long long maxElement(const long long* array, size_t size) {
	assert(array != NULL);
	assert(size >= 1);

	long long max = array[0];
	for (size_t i = 1; i < size; ++i) {
		if (max < array[i]) {
			max = array[i];
		}
	}

	return max;
}

int main() {
	int N, M;
	cin >> N >> M;

	long long x[N], y[N], z[N];
	long long x_tmp, y_tmp, z_tmp;

	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> z[i];
	}

	long long max = 0;
	long long a1[N], a2[N], a3[N], a4[N], a5[N], a6[N], a7[N], a8[N];
	for (int i = 0; i < N; i++) {
		a1[i] = x[i] + y[i] + z[i];
		a2[i] = x[i] - y[i] + z[i];
		a3[i] = x[i] + y[i] - z[i];
		a4[i] = x[i] - y[i] - z[i];
		a5[i] = -x[i] + y[i] + z[i];
		a6[i] = -x[i] - y[i] + z[i];
		a7[i] = -x[i] + y[i] - z[i];
		a8[i] = -x[i] - y[i] - z[i];
	}

	sort(a1, a1 + SIZE_OF_ARRAY(a1));
	sort(a2, a2 + SIZE_OF_ARRAY(a2));
	sort(a3, a3 + SIZE_OF_ARRAY(a3));
	sort(a4, a4 + SIZE_OF_ARRAY(a4));
	sort(a5, a5 + SIZE_OF_ARRAY(a5));
	sort(a6, a6 + SIZE_OF_ARRAY(a6));
	sort(a7, a7 + SIZE_OF_ARRAY(a7));
	sort(a8, a8 + SIZE_OF_ARRAY(a8));
	long long plus1, plus2, plus3, plus4, plus5, plus6, plus7, plus8;
	plus1 = 0;
	plus2 = 0;
	plus3 = 0;
	plus4 = 0;
	plus5 = 0;
	plus6 = 0;
	plus7 = 0;
	plus8 = 0;
	long long minus1, minus2, minus3, minus4, minus5, minus6, minus7, minus8;
	minus1 = 0;
	minus2 = 0;
	minus3 = 0;
	minus4 = 0;
	minus5 = 0;
	minus6 = 0;
	minus7 = 0;
	minus8 = 0;
	for (int i = 0; i < M; i++) {
		plus1 += a1[i];
		plus2 += a2[i];
		plus3 += a3[i];
		plus4 += a4[i];
		plus5 += a5[i];
		plus6 += a6[i];
		plus7 += a7[i];
		plus8 += a8[i];
		minus1 -= a1[i];
		minus2 -= a2[i];
		minus3 -= a3[i];
		minus4 -= a4[i];
		minus5 -= a5[i];
		minus6 -= a6[i];
		minus7 -= a7[i];
		minus8 -= a8[i];
	}
	long long array[16] = {
	    minus1,
	    minus2,
	    minus3,
	    minus4,
	    minus5,
	    minus6,
	    minus7,
	    minus8,
	    plus1,
	    plus2,
	    plus3,
	    plus4,
	    plus5,
	    plus6,
	    plus7,
	    plus8};
	cout
	    << maxElement(array, SIZE_OF_ARRAY(array)) << endl;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e5+5;
const int mod = 1e9+7;
using namespace std;

void solve() {
	ll n,ans=1; cin >> n;
	if (n >= 400 && n <= 599) ans = 8;
	else if (n <= 799) ans = 7;
	else if (n <= 999) ans = 6;
	else if (n <= 1199) ans = 5;
	else if (n <= 1399) ans = 4;
	else if (n <= 1599) ans = 3;
	else if (n <= 1799) ans = 2;
	else if (n <= 1899) ans = 1;
	cout << ans << '\n';
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"
using namespace std;
 
////////////// Prewritten code follows. Look down for solution. ////////////////

#define fs first
#define sc second
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define len(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef pair<ll, ll> pll;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
template<typename T>
inline T mod(T n, T mod){ T res = n%mod; if(res < 0) res += mod; return res; }
 
////////////////////////// Solution starts below. //////////////////////////////

const int N = 2e5+5;
vi adj[N];
ll cnt[N];
bitset<N> vis;

void dfs(int v){
  vis[v] = 1;
  for(int u : adj[v]){
    if(!vis[u]){
      cnt[u] += cnt[v];
      dfs(u);
    }
  }
}

int main(){
  fastio;
  int n, q;
  cin >> n >> q;
  for(int i = 0; i < n-1; i++){
    int a, b;
    cin >> a >> b;
    adj[a].pb(b);
    adj[b].pb(a);
  }
  for(int j = 0; j < q; j++){
    int v, p;
    cin >> v >> p;
    cnt[v] += 1LL*p;
  }
  dfs(1);
  for(int i = 1; i <= n; i++){
    cout << cnt[i] << ' ';
  }
  cout << '\n';
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
  int N,M;
  cin>>N>>M;
  vector<vector<ll>> cake(8,vector<ll>(N));
  REP(i,N) {
    ll a,b,c;
    cin>>a>>b>>c;
    cake[0][i] =   a + b + c;
    cake[1][i] =   a + b - c;
    cake[2][i] =   a - b + c;
    cake[3][i] =   a - b - c;
    cake[4][i] = - a + b + c;
    cake[5][i] = - a + b - c;
    cake[6][i] = - a - b + c;
    cake[7][i] = - a - b - c;
  }
  REP(i,8) {
    sort(ALL(cake[i]),greater<ll>());
  }
  ll ans = 0;
  REP(i,8) {
    ll sum = 0;
    REP(j,M) {
      sum += cake[i][j];
    }
    ans = max(ans,sum);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f;

    float ret = -1;
    int maxX = 0, maxY = 0;
    float x = 0, y = 0;

    for (int i = 0; i < 30; i++) {
        for (int j = 0; j < 30; j++) {

            x = 100 * a * i + 200 * b * j;
            if (x > f) break;

            for (int k = 0; ; k++) {
                if (x + c * k > f) break;

                for (int l = 0; ; l++) {
                    y  = c * k + d * l;
                    if (x + y > f) break;

                    if (x != 0 && (100 * y) / x <= e) {
                        if (ret < (100 * y) / (x + y)) {
                            ret = (100 * y) / (x + y);
                            maxX = x;
                            maxY = y;
                        }
                    }                   
                }
            }
        }
    }

    cout << (maxX + maxY) << " " << maxY << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
    char b;
    scanf("%c",&b);
    if(b=='A'){
        printf("%c",'T');
    }
    if(b=='T'){
        printf("%c",'A');
    }
 
    if(b=='G'){
        printf("%c",'C');
    }
 
    if(b=='C'){
        printf("%c",'G');
    }
}

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

int main() {
  long long N, ans = 0;
  cin >> N;
  for (int p = 1; (N - p) / p > p; p++) {
    if (N % p == 0) ans += N / p - 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.run();
    }
    
    int n;
    int m;
    int c;
    int[] b;
    int[][] a;
    int ans;
    

    public void run() {
        // 入力情報取得
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        c = sc.nextInt();
        b = new int[m];
        a = new int[n][m];
        for (int i = 0; i < m; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                a[i][j] = sc.nextInt();                
            }
        }
        sc.close();

        // 解答処理
        solve();
    }
    
    private void solve() {
        ans = 0;
        check();
        System.out.println(ans);
    }

    private void check() {
        for(int i = 0;i<n;i++) {
            int score = 0;
            for (int j = 0; j < m; j++) {
                score += a[i][j] * b[j];
            }
            if (score + c > 0) {
                ans++;                
            }
        }
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
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; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    
    ll res = 0;
    rep (i, n - 1) {
        if (a[i] + a[i + 1] <= x) continue;
        ll t = a[i] + a[i + 1] - x;
        res += t;
        a[i + 1] = max(0LL, a[i + 1] - t);
    }
    
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>

int main(){
	std::string str;
	std::cin >> str;
	bool a[3] ={false,false,false};
	
	for(char c:str){
		switch(c){
			case 'a':
				a[0] = true;
				break;
			case 'b':
				a[1] = true;
				break;
			case 'c':
				a[2] = true;
				break;
		}
	}
	if(a[0]&a[1]&a[2]){
		std::cout << "Yes" << std::endl;
	}else{
		std::cout << "No" << std::endl;
	}
}

Measured memory_bytes: 256
use std::io;
#[allow(unused_imports)]
use std::cmp;
use std::collections::LinkedList;

fn read_list() -> LinkedList<String> {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    s.split(' ').map(|x| x.to_string()).collect::<LinkedList<String>>()
}

fn pop_parse<T: std::str::FromStr>(list: &mut LinkedList<String>) -> T {
    list.pop_front().expect("").trim().parse::<T>().ok().unwrap()
}

fn align(s: &Vec<bool>, a: bool, b: bool) -> Option<Vec<bool>> {
    let mut ans = vec![a, b];
    for i in 1..s.len() {
        let next = ans[i-1] ^ ans[i] ^ s[i];
        ans.push(next);
    }
    if ans.pop().unwrap() == a && ans[s.len()-1] ^ a ^ s[0] == b {
        Some(ans)
    } else {
        None
    }
}

fn main() {
    let _: i32 = pop_parse(&mut read_list());
    let s: String = pop_parse(&mut read_list());
    let vs: Vec<bool> = s.into_bytes().into_iter()
        .map(|x| match x as char {
            'o' => true,
            'x' => false,
            _   => panic!(),
        }).collect();
    let mut ans: Option<Vec<bool>> = None;
    for (a,b) in vec![(true,true), (true,false), (false,true), (false,false)] {
        match align(&vs, a, b) {
            Some(v) => ans = Some(v),
            None => {},
        }
    }
    let ans = match ans {
        Some(v) => String::from_utf8(
            v.into_iter().map(|x| if x {'S' as u8} else {'W' as u8}).collect()).unwrap(),
        None => String::from("-1"),
    };
    println!("{}", ans);
}


Measured memory_bytes: 4352
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int n, m;
    int h, r;
    int[][] dolls;
    int[] dp;

    void run(){
	while(sc.hasNext()){
	    n = sc.nextInt();
	    if(n==0) break;
	    input();
	    sort();
	    // show();
	    solve();
	}
    }

    void solve(){
	dp = new int[n+m];
	Arrays.fill(dp, 1);
	for(int i=0; i<dp.length; i++){
	    if(i!=0)
		for(int k=i-1; k>=0; k--)
		    if(dolls[k][0]<dolls[i][0] && dolls[k][1]<dolls[i][1])
			dp[i] = Math.max(dp[i], dp[k]+1);	    
	}

	// showDP();
	int ans = 0;
	for(int i=0; i<dp.length; i++)
	    ans = Math.max(ans, dp[i]);

	System.out.println(ans);
    }

    void show(){
	for(int i=0; i<n+m; i++)
	    System.out.printf("%3d %3d\n", dolls[i][0], dolls[i][1]);
	System.out.println("-----------------");
    } 

    void showDP(){
	for(int i=0; i<dp.length; i++)
	    System.out.println(dp[i]);
	System.out.println("-----------------");
    }

    void sort(){
	Arrays.sort(dolls, new Comparator<int[]>(){
		public int compare(int[] a, int[] b){
		    int x1 = a[0];
		    int x2 = b[0];
		    if(x1 != x2) return x1-x2;
		    else return a[1]-b[1];
		}
	    }
	    );
    }
    
    void input(){
	int[][] d = new int[n][2]; // tmp
	for(int i=0; i<n; i++){
	    d[i][0] = sc.nextInt();
	    d[i][1] = sc.nextInt();
	}
	
	m = sc.nextInt();
	dolls = new int[n+m][2];
	for(int i=0; i<n; i++){
	    dolls[i][0] = d[i][0];
	    dolls[i][1] = d[i][1];
	}
	for(int i=n; i<n+m; i++){
	    dolls[i][0] = sc.nextInt();
	    dolls[i][1] = sc.nextInt();
	}
    }
}
	
	    

       

Measured memory_bytes: 23604
////////////////////////// Author
////////////////////////// Nasim Hossain Rabbi
////////////////////////// JU-CSE28
////////////////////////// CF - imnasim3.1415
////////////////////////// UVA - imnasim3.1415
////////////////////////// Mail - imnasim3.1415@gmail.com
#include<bits/stdc++.h>
using namespace std;
#define E end()
#define B begin()
#define sz size()
#define EM empty()
#define clr clear()
#define sqr(a) (a*a)
#define mk make_pair
#define pb push_back
string en="\n";
string t="hello";
string Y="YES\n";
string N="NO\n";
#define rep(i,n) for(i=0;i<n;i++)
#define Rep(i,n) for(i=1;i<=n;i++)
#define per(i,n) for(i=n-1;i>=0;i--)
#define peR(i,n) for(i=n;i>0;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define all(cont) cont.begin(),cont.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define pi 3.1415926535897932384626433832795
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define vp(vi,x) cin>>x; vi.pb(x);
#define srch(a,x) binary_search(all(a),x)
#define LB(a,x) (lower_bound(all(a),x)-a.B)
#define UB(a,x) (upper_bound(all(a),x)-a.B)
typedef long long LL;
typedef unsigned long long ULL;
bool isprm(LL a){for(LL i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
template<typename T>inline T gcd(T a,T b){if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<typename T>inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}
int main()
{
//    fast;
    LL i,j,k,n,m,l,s=0,x,y,tc=1,c=0;
    while(cin>>n)
    {
        vi a;
        s=0;
        rep(i,n)
        {
            vp(a,x);
        }
        sort(all(a));
        n--;
        rep(i,n)
        {
            s+=a[i];
        }
        x=a[n];
        s+=(x/2);
        cout<<s<<en;
    }
}



Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

//--------------------------------------------------------------------

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

    int sum = 0;
    for(int i=1;i<=n;i++){
        if( to_string(i).size() % 2 == 1)
            sum++;
    }

    cout<<sum<<endl;
    
    // cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;

const int INF = (int)1e9;

struct Edge {
  int from, to, cost, company;
  Edge(int from_, int to_, int cost_, int company_)
    : from(from_), to(to_), cost(cost_), company(company_) { }
};

int compute_fee(const vector<pair<int,int>> &v, int d) {
  int r = 0;
  int pre = 0;
  for(int i = 0; i < (int)v.size(); ++i) {
    if(d <= v[i].first) {
      r += (d-pre)*v[i].second;
      break;
    }
    else {
      r += (v[i].first - pre)*v[i].second;
      pre = v[i].first;
    }
  }
  return r;
}

int main() {
  while(true) {
    int N, M, C, S, G; cin >> N >> M >> C >> S >> G;
    --S; --G;
    if(N == 0) break;
    vector<Edge> edge;
    for(int i = 0; i < M; ++i) {
      int x,y,d,c; cin >> x >> y >> d >> c;
      --x; --y; --c;
      edge.emplace_back(x,y,d,c);
    }
    vector<pair<int,int>> pr[C];
    for(int i = 0; i < C; ++i) {
      int p; cin >> p;
      pr[i].resize(p);
    }
    for(int i = 0; i < C; ++i) {
      for(int j = 0; j < (int)pr[i].size() - 1; ++j) {
        cin >> pr[i][j].first;
      }
      pr[i][pr[i].size()-1].first = INF;
      for(int j = 0; j < (int)pr[i].size(); ++j) {
        cin >> pr[i][j].second;
      }
    }
    int cost[N][N];
    for(int i = 0; i < N; ++i) {
      for(int j = 0; j < N; ++j) {
        cost[i][j] = INF;
      }
      cost[i][i] = 0;
    }
    for(int c = 0; c < C; ++c) {
      int dist[N][N];
      for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
          dist[i][j] = INF;
        }
        dist[i][i] = 0;
      }
      for(int i = 0; i < (int)edge.size(); ++i) {
        int x = edge[i].from;
        int y = edge[i].to;
        if(edge[i].company == c) {
          dist[x][y] = min(dist[x][y], edge[i].cost);
          dist[y][x] = min(dist[y][x], edge[i].cost);
        }
      }
      for(int k = 0; k < N; ++k)
        for(int i = 0; i < N; ++i)
          for(int j = 0; j < N; ++j)
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
          if(dist[i][j] != INF) {
            cost[i][j] = min(cost[i][j], compute_fee(pr[c], dist[i][j]));
          }
        }
      }
    }
    for(int k = 0; k < N; ++k)
      for(int i = 0; i < N; ++i)
        for(int j = 0; j < N; ++j)
          cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
    if(cost[S][G] == INF) cout << -1 << endl;
    else cout << cost[S][G] << endl;
  }
}

Measured memory_bytes: 1656
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>

struct Data
{
    std::string city;
    int score, id;

    Data(std::string city = "", int score = 0, int id = 0) : city(city), score(score), id(id) {}
};

int cmp(const Data& x, const Data& y)
{
    if (x.city < y.city)
        return 1;
    else if (x.city > y.city)
        return 0;
    else
        return x.score > y.score;
}

int n, p;
std::string s;
Data d[100010];

int main()
{
    std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);
    std::cin >> n;
    for (int i = 1; i <= n; ++i)
        std::cin >> s >> p,
        d[i] = Data(s, p, i);
    std::sort(d + 1, d + n + 1, cmp);
    for (int i = 1; i <= n; ++i)
        std::cout << d[i].id << std::endl;
    return 0;
}

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

int main(){
    int abc[3];
    cin >> abc[0] >> abc[1] >> abc[2];

    //sort(d.begin(),d.end());
    int flag=0;
    rep(i,3){
        rep(j,3){
            if(i==j) continue;
            if(abc[i]==abc[j]){
                flag++;
            }
        }
    }
    if(flag==2){
        cout << "Yes";
    }else{
        cout << "No";
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
	vec v(N), c(N);
	rep(i, N) cin >> v[i];
    rep(i, N) cin >> c[i];

	int res = 0;
	rep(i, N){
		if(v[i] > c[i]) res += v[i]-c[i];
	}

	cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 4352
import sys
readline = sys.stdin.readline

N = int(readline())
dp = [[0] * 3 for i in range(N + 1)]

for i in range(N):
  a,b,c = map(int,readline().split())
  dp[i + 1][0] = max(dp[i][1],dp[i][2]) + a
  dp[i + 1][1] = max(dp[i][2],dp[i][0]) + b
  dp[i + 1][2] = max(dp[i][0],dp[i][1]) + c
  
print(max(dp[N]))

Measured memory_bytes: 28764
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
           int w,a,b;
           cin>>w>>a>>b;
           if(a+w<b){
            cout<<b-(a+w)<<endl;
           }
           else if(a<=b+w){
             cout<<0<<endl;
           }
           else{
             cout<<a-(b+w)<<endl;
           }
          }

Measured memory_bytes: 3604
import sys
ABCD = input()

for bit in range(2 ** 3):
    N = ABCD[0]
    for i in range(3):
        if bit & (1 << i):
            N += '+'
        else:
            N += '-'
        N += ABCD[i + 1]
    if eval(N) == 7:
        print(N + '=7')
        sys.exit()

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

using namespace std;


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string a;
  cin >> a;
  int n = a.size();
  bool ok = false;
  for (int i = 0; i < n; i++) {
    if (ok) {
      break;
    }
    if (i + 1 < n && a[i] == a[i + 1]) {
      cout << i + 1 << ' ' << i + 2 << '\n';
      ok = true;
      break;
    }
    if (i + 2 < n && a[i] == a[i + 2]) {
      cout << i + 1 << ' ' << i + 3 << '\n';
      ok = true;
      break;
    }
  }
  if (!ok) {
    cout << "-1 -1" << '\n';
  }
  return 0;
}

Measured memory_bytes: 3700
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<queue>
#include<iostream>
#include<map>
using namespace std;
typedef long long ll;
typedef double lf;
typedef unsigned un;
typedef int in;
#define mian main
#define maxn 100+10
#define maxm 100000+10
#define _(a) read(a)
#define non void
#define inf 2147483647
#define bre break
#define con continue
#define prq priority_queue
#define re register
#define bu bool
#define cz char
#define cst const
#define ope operator
#define inl inline
#define upp upper_bound
#define low lower_bound
#define next_per next_permutation
template<typename T>inl T Max(T a,T b){return a>b?a:b;}
template<typename T>inl T Min(T a,T b){return a<b?a:b;}
template<typename T>inl T Abs(T a){return a<0?-a:a;}
template<typename T>inl non read(T &a){a=0;T k=1;char c=getc(stdin);while(c<'0'||c>'9')k=c=='-'?-1:k,c=getc(stdin);while(c>='0'&&c<='9')a=a*10+(c^48),c=getc(stdin);if(c!='.'){a*=k;return;}T t=0.1;while(c<'0'||c>'9')c=getc(stdin);while(c>='0'&&c<='9')a+=t*(c^48),c=getc(stdin),t*=0.1;a*=k;}
template<typename T>non write(T a,cz t=' '){if(a==0){putc(48,stdout),putc(t,stdout);return;}if(a<0){a=-a;putc('-',stdout);}cz c[30];in le=0;while(a){c[++le]=a%10+48;a/=10;}for(re in i=le;i>=1;--i)putc(c[i],stdout);putc(t,stdout);}
string s[60];
cz dx[]={-1,0,1,-1,1,-1,0,+1},dy[]={-1,-1,-1,0,0,1,1,1};
in n,m;
in main()
{
	read(n),read(m);
	for(re in i=0;i<n;++i)cin>>s[i];
	for(re in i=0;i<n;++i)
	{
		for(re in j=0;j<m;++j)
		{
			in count=0;
			if(s[i][j]!='#')
			{
				for(in k=0;k<8;++k)
          	      	if(0<=i+dx[k]&&i+dx[k]<n&&0<=j+dy[k]&&j+dy[k]<m&&s[i+dx[k]][j+dy[k]]=='#')++count;
                cout<<count;
            }
            else cout<<s[i][j];
		}
		cout<<endl;
	}
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string S;
int X, Y;

int main(){
	cin >> S;
	cin >> X >> Y;

	int nf=0;
	vector<int> nx, ny;
	for(int i=0; i<S.size(); i++){
		if(S[i]=='F') nf++;
		else{
			if(nx.size()==ny.size()) nx.push_back(nf);
			else ny.push_back(nf);
			nf=0;
		}
	}
	if(nx.size()==ny.size()) nx.push_back(nf);
	else ny.push_back(nf);

	X-=nx[0];

	//cout << nx[0] << endl;

	vector<bool> x(10000), y(10000);
	int x_sum=0, y_sum=0;
	x[0] = y[0] = true;
	for(int i=1; i<nx.size(); i++){
		x_sum += nx[i];
		//cout << nx[i] << endl;
		for(int j=0; j<x.size(); j++){
			if(j+nx[i]<x.size()) x[j+nx[i]] = x[j+nx[i]] || x[j];
		}
	}

	//cout << endl;
	for(int i=0; i<ny.size(); i++){
		y_sum += ny[i];
		//cout << ny[i] << endl;
		for(int j=0; j<y.size(); j++){
			if(j+ny[i]<y.size()) y[j+ny[i]] = y[j+ny[i]] || y[j];
		}
	}

	int px = (X+x_sum)/2;
	int py = (Y+y_sum)/2;
	//cout << px << " " << py << endl;
	if((X+x_sum)%2==0&&0<=px&&px<=x_sum&&x[px]&&
			(Y+y_sum)%2==0&&0<=py&&py<=y_sum&&y[py]) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
if b<=0:
  if c<0:
    print(a*c)
  elif c>=0:
    print(b*c)
elif a >=0:
  if d<=0:
    print(a*d)
  elif d>0:
    print(b*d)
elif a<=0 and b>=0:
  if d<=0:
    print(a*c)
  elif c>=0:
    print(b*d)
  else:
    print(max(a*c,b*d))
     


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

int main() {
	int h, w; cin >> h >> w;
	map<char, int> a;
	REP(i, h * w) {
		char c; cin >> c;
		a[c - 'a']++;
	}
	int cnt1, cnt2, cnt3;
	cnt1 = cnt2 = cnt3 = 0;
	for (auto x : a) {
		if (x.second % 4 == 1) cnt1++;
		if (x.second % 4 == 2) cnt2++;
		if (x.second % 4 == 3) cnt3++;
	}
	bool ok = false;
	if (h % 2 && w % 2) {
		if (cnt1 == 1 && cnt3 == 0)
			if (cnt2 <= (h / 2) + (w / 2))
				ok = true;
	}
	else if (h % 2 == 0 && w % 2 == 0) {
		if (cnt1 == 0 && cnt2 == 0 && cnt3 == 0)
			ok = true;
	}
	else if (h % 2 == 0 && w % 2) {
		if (cnt1 == 0 && cnt3 == 0)
			if (cnt2 <= h / 2)
				ok = true;
	}
	else if (h % 2 && w % 2 == 0) {
		if (cnt1 == 0 && cnt3 == 0)
			if (cnt2 <= w / 2)
				ok = true;
	}
	cout << (ok ? "Yes" : "No") << '\n';
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF LONG_LONG_MAX

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    vll x(n),y(n);
    rep(i,n) cin>>x[i]>>y[i];
    vll sx,sy;
    sx=x, sy=y;
    sort(all(sx));
    sort(all(sy));
    sx.erase(unique(all(sx)), sx.end());
    int w = sx.size();
    sy.erase(unique(all(sy)), sy.end());
    int h = sy.size();
    unordered_map<ll,int> zipx,zipy;
    rep(i,w) zipx[sx[i]] = i;
    rep(i,h) zipy[sy[i]] = i;
    vector<vi> sum(h+1,vi(w+1));
    rep(i,n){
        int tx = zipx[x[i]];
        int ty = zipy[y[i]];
        sum[ty+1][tx+1]++;
    }
    rep(i,h+1)rep(j,w) sum[i][j+1]+=sum[i][j];
    rep(j,w+1)rep(i,h) sum[i+1][j]+=sum[i][j];
    ll ans=INF;
    rep(a,w)rep(b,w)rep(c,h)rep(d,h){
        if (a<b || c<d) continue;
        ll dx = sx[a]-sx[b];
        ll dy = sy[c]-sy[d];
        int cnt = sum[c+1][a+1]-sum[c+1][b]-sum[d][a+1]+sum[d][b];
        if (cnt>=k) chmin(ans,dx*dy);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<set>
#define ll long long
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define fion(n) fixed<<setprecision(n)
#define endl "\n"
#define OR ||
#define AND &&
#define NOT !
#define line(s) getline(cin,s)
#define MOD 1000000007
#define fdarst(a,n) (a[a.size()-1]>=n&&a[lower_bound(ALL(a),n)-a.begin()]==n?lower_bound(ALL(a),n)-a.begin():-1)
#define fist(s,t) ((int)s.find(t))
#define START int main(){cin.tie(0);ios::sync_with_stdio(false);
#define END }
using namespace std;
START
ll n; cin >> n;
vector<ll> a(n);
rep(i, 0, n)cin >> a[i];
sort(ALL(a));
cout << a[0];
rep(i, 1, n)cout << ' ' << a[i];
cout << endl;
END


Measured memory_bytes: 18424
a, b, c, d = gets.split('').map(&:to_i)

# 0 が +, 1 が - とする

1.upto(8) do |i|
  x1 = 0
  x2 = 0
  x3 = 0
  x1 = 1 if i > 4
  x2 = 1 if [3, 4, 7, 8].include?(i)
  x3 = 1 if i.even?

  tmp = 0
  tmp = x1 == 0 ? a + b : a - b
  tmp = x2 == 0 ? tmp + c : tmp - c
  tmp = x3 == 0 ? tmp + d : tmp - d
  if tmp == 7
    puts a.to_s + (x1 == 0 ? '+' : '-') + b.to_s + (x2 == 0 ? '+' : '-') + c.to_s + (x3 == 0 ? '+' : '-') + d.to_s + '=7'
    exit
  end
end


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

int main(){
    int a,b;
    cin>>a>>b;
    if(a==b){cout<<"Draw"<<endl;return 0;}
    if(a==1)a=14;
    if(b==1)b=14;
    cout<<(a>b?"Alice":"Bob")<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
    int X;
    cin >> X;
    if(X == 3 || X == 5 || X == 7) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  int n, a;
  std::cin >> n >> a;
  if (n % 500 <= a)
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
import sys

if sys.platform in ['ios','win32','darwin']:
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = int(input())
for h in range(1, 3501):
	for n in range(1, 3501):
		if 4*h*n-n*N-h*N != 0 and (h*n*N)%(4*h*n-n*N-h*N)==0 and (4*h*n-n*N-h*N)>0:
			w = int((h*n*N)//(4*h*n-n*N-h*N))
			print(h, n, w)
			sys.exit()

Measured memory_bytes: 40940
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

class UnionFind {
public:
  vector<int> par, siz;
    
  UnionFind(int sz_) {
    init(sz_);
  }

  void init(int sz_) {
    par.resize(sz_);
    siz.resize(sz_, 1);
    rep(i, sz_) par[i] = i;
  }

  int root(int x) { 
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }

  bool merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  int size(int x) {
    return siz[root(x)];
  }
};


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n, q;
  cin >> n >> q;
  UnionFind uf(n);
  
  while (q--) {
    int c, x, y;
    cin >> c >> x >> y;

    if (c) cout << uf.issame(x, y) << '\n';
    else uf.merge(x, y);
  }

  
  return 0;
}


Measured memory_bytes: 3252
#include<bits/stdc++.h>
using namespace std;
bitset<2000005>bs;
int n,sum;
int main()
{
	cin>>n;
	bs[0]=1;
	for(int i=1,x;i<=n;i++)
	{
		scanf("%d",&x);
		bs|=bs<<x;
		sum+=x;
	}
	for(int i=(sum+1)>>1;i<=sum;i++)
		if(bs[i])
			return printf("%d\n",i),0;
	puts("徐熙来AKKING");
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef tuple<ll,int,int> tup;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vp;
int n;
int main(int argc,char const* argv[])
{
  cin >> n;
  if(n==1)
    {
      cout << "Hello World" << endl;
      return 0;
    }
  else if(n==2)
    {
      int a,b;
      cin >> a >> b;
      cout << a+b << endl;
      return 0;
    }
  return 0;
}


Measured memory_bytes: 256
import sys

N = int(input())
C = []
pre = 0
for _ in range(N):
    c = int(sys.stdin.readline())
    if pre == c:
        continue
    else:
        C.append(c)
        pre = c

ans = 1
dic = {}
for c in C:
    if c in dic.keys():
        a = dic[c]
        dic[c] += ans
        ans += a
    else:
        dic[c] = ans

print(ans % (10 ** 9 + 7))


Measured memory_bytes: 29452
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


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

int n;
cin >> n;
int res = 0;
rep(i,n) {
    int a;
    cin >> a;
    if(i % 2 == 0 && a % 2 == 1) res++;
}
cout << res << endl;
return 0;
}

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

int a[1000000];

int sosuu(){
	a[0] = 0;
	a[1] = 0; 
	int k;
	for(int i = 2;i<1000000;i++){
		k = 0;
		a[i] = a[i - 1];
		for(int j=2;j<=sqrt(i);j++){
			if(i%j == 0){
				k++;
				break;
			}
		}
		if(k==0){
			a[i]++;
		}
	}
	return 0;

}

int main(){
	int n;
	sosuu();
	while (true)
	{
		cin >> n;
		if (cin.eof()) { break; }
		cout << a[n] << endl;
	}
	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:

int n, m;
int a[510];

bool ok[510][510];
R dp[510][510];

int main(void) {
	cin >> n >> m;
	rep(i, n) cin >> a[i];

	ok[0][0] = true;
	rep(i, n)rep(j, m) {
		if (ok[i][j] == false) continue;

		R cur = 0.0;
		rep(k, i, n) {
			cur += a[k];
			chmax(dp[k + 1][j + 1], dp[i][j] + 1.0 * cur / (k + 1 - i));
			ok[k + 1][j + 1] = true;
		}
	}

	cout.precision(20);
	cout << fixed << dp[n][m] << endl;
	return 0;
}


Measured memory_bytes: 6996