akhauriyash/Code-Regression huggingface dataset:
// AOJ 0242
#include<algorithm>
#include<iostream>
#include<map>
#include<sstream>
#include<string>
#include<vector>
#define rep(i,a) for( int i = 0; i != (a); ++i )

typedef std::pair<int, std::string> P;

int main()
{
	int n;
	while( std::cin >> n, n )
	{
		std::map<std::string, int> m;

		std::cin.ignore();
		rep( i, n )
		{
			std::string s;
	
			std::getline( std::cin, s );
		
			std::istringstream iss( s );
			std::string t;
			while( iss >> t )
				--m[t];
		}

		std::string ch;
		std::cin >> ch;

		std::map<std::string, int>::iterator it = m.lower_bound( ch );
		std::vector<P> v;
		int cnt = 0;

		if( it != m.end() && it->first[0] == ch[0] )
			v.push_back( std::make_pair( it->second, it->first ) ), ++it, ++cnt;

		for( ; it != m.end() && it->first[0] == ch[0] && cnt != 5; ++it )
			v.push_back( std::make_pair( it->second, it->first ) ), ++cnt;
		
		if( !cnt )
			std::cout << "NA" << std::endl;
		else
		{
			std::sort( v.begin(), v.end() );

			rep( i, v.size() )
				std::cout << v[i].second << " \n"[i==v.size()-1];
		}
	}

	return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
const int maxn = 1e5 + 10;
int n,a[maxn];
int main() {
	scanf("%d",&n);
	for (int i = 1; i <= n; i++)
		scanf("%d",&a[i]);
	sort(a + 1,a + n + 1);
	if (n == 2) {
		printf("%d\n%d %d\n",a[2] - a[1],a[2],a[1]);
	} else if (a[n] <= 0) {
		int sum = a[n];
		for (int i = 1; i < n; i++)
			sum -= a[i];
		printf("%d\n",sum);
		int cur = a[n];
		for (int i = n - 1; i >= 1; i--) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
	} else if (a[1] >= 0) {
		int sum = -a[1];
		for (int i = 2; i <= n; i++)
			sum += a[i];
		printf("%d\n",sum);
		int cur = a[1];
		for (int i = 3; i <= n; i++) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
		printf("%d %d\n",a[2],cur);
	} else {
		int p = 1;
		for (int i = 1; i <= n; i++)
			if (a[i] >= 0) {
				p = i;
				break;
			}
		int sum = 0;
		for (int i = 1; i <= n; i++)
			sum += abs(a[i]);
		printf("%d\n",sum);
		int cur = a[1];
		for (int i = p + 1; i <= n; i++) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
		printf("%d %d\n",a[p],cur);
		cur = a[p] - cur;
		for (int i = 2; i < p; i++) {
			printf("%d %d\n",cur,a[i]);
			cur -= a[i];
		}
	}
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#define N 100005
using namespace std;
typedef long long ll;
ll x;
int n;
int a[N];
int main() {
	cin>>n;
	map<int, int> cnt;
	cnt.clear();
	for (int i = 1; i <= n; ++i) {
		cin>>a[i];
		cnt[a[i]]++;
	}
	int num = cnt.size();
	int r = 0;
	for (auto v : cnt) {
		if (v.second > 1) {
			r += v.second-1;
		}
	}
	if (r % 2 == 0) {
		cout<<num<<endl;
	} else {
		cout<<num-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 5376
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define REP(i, start, end) for (ll i = start, i##Len = (end); i < i##Len; ++i)
#define REPR(i, start, end) for (ll i = start, i##Len = (end); i > i##Len; --i)
using ll = long long;
using namespace std;

std::vector<int> get_primes_set(int max_n)
{
    std::vector<int> primes;
    std::vector<bool> is_prime(max_n + 1, 1);
    for (int i = 2; i <= max_n; ++i)
        if (is_prime[i])
        {
            primes.emplace_back(i);
            for (int j = i * 2; j <= max_n; j += i)
                is_prime[j] = 0;
        }
    return primes;
}

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    auto primes = get_primes_set(1010);
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, 0, n)
    cin >> a[i];

    auto check1 = [&]() {
        set<int> divs;
        for (auto x : a)
        {
            for (auto &p : primes)
                if (x % p == 0)
                {
                    if (divs.find(p) != divs.end())
                        return false;
                    divs.insert(p);
                    while (x % p == 0)
                        x /= p;
                }
            if (x > 1)
            {
                if (divs.find(x) != divs.end())
                    return false;
                divs.insert(x);
            }
        }

        return true;
    };

    auto check2 = [&]() {
        ll g = a[0];
        for (auto x : a)
            g = gcd(g, x);
        return g == 1;
    };

    if (check1())
    {
        cout << "pairwise coprime" << endl;
    }
    else if (check2())
    {
        cout << "setwise coprime" << endl;
    }
    else
    {
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 7324
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using ll = long long int;


class union_find{
public:
    union_find(int N){
        parent = new int[N];
        rank = new int[N];
        for(int i = 0; i < N; i++){
            parent[i] = i;
            rank[i] = 0;
        }
    }
    
    int root(int x){
        if(parent[x] == x){
            return x;
        }else{
            return parent[x] = root(parent[x]);
        }
    }
    
    void unite(int x, int y);
    bool same(int x, int y){
        return root(x) == root(y);
    }
    int parentn(int x){
        return parent[x];
    }
private:
    int *parent;
    int *rank;
};


void union_find::unite(int x, int y){
    x = root(x);
    y = root(y);
    
    if(x == y) return;
    
    if(rank[x] < rank[y]){
        parent[x] = y;
    }else{
        parent[y] = x;
        if(rank[x] == rank[y]){
            rank[x]++;
        }
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> a(m), b(m);
    for(int i = 0; i < m; i++) cin >> a[i] >> b[i];
    union_find data(n+1);
    for(int i = 0; i < m; i++) data.unite(a[i], b[i]);

    int ans = 1;
    vector<int> parentnum(n+1, 0);
    for(int i = 1; i <= n; i++){
        parentnum[data.root(i)]++;
    }
    for(int i = 1; i <= n; i++){
        if(ans < parentnum[i]) ans = parentnum[i];
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int h1,h2,m1,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << ((60*h2+m2)-(60*h1+m1))-k << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

class Main
{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
	
	String str;
	int i, q;
	int a = 0;
		
	String kob = scan.nextLine();
		
	while(true){
		str = scan.nextLine();
		if(str.equals("END_OF_TEXT")){
			break;}
		str = str.toLowerCase();
		String[] mini = str.split(" ", 0);
		
		for(int j=0; j<mini.length; j++){
			if(mini[j].equals(kob)){
				a++;}}}
		System.out.println(a);
		
	}
}


Measured memory_bytes: 26192
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#include <math.h>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef signed long long ll;

using namespace std;

ll A[200010];
ll B[200010];

int main(){
	ll N,x,K,T,cnt,k,a,b,lo,hi,ans,T1,T2,T3;
	
	cin >> N;
	rep(i,N) cin>>A[i];
	rep(i,N) cin>>B[i];
	
	K=30;
	ans=0;
	
	
	for(int k=K ; k>-1 ; --k){
		T=pow(2,k);

		cnt=0;
		int AM[200010];
		int BM[200010];
		
		rep(i, N) AM[i]= A[i]%(2*T);
		rep(i, N) BM[i]=B[i]%(2*T);
		sort(BM,BM+N);
						
		 for(int i=0 ; i < N; ++i){
			a=AM[i];
			T1=lower_bound(BM,BM+N, T-a )-BM;
			T2=lower_bound(BM,BM+N, 2*T-a )-BM;
			T3=lower_bound(BM,BM+N, 3*T-a ) -BM;
			cnt += (T2-T1)+(N-T3);
		}
		if (cnt%2!=0) ans+=T;
	}
	
	cout << ans << endl;
	
}

Measured memory_bytes: 4992
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class BMinorChange {
        public void solve(int testNumber, InputReader s, PrintWriter w) {
            char[] a = s.next().toCharArray();
            char[] b = s.next().toCharArray();
            int c = 0;
            for (int i = 0; i < a.length; i++) {
                if (a[i] != b[i])
                    c++;
            }
            w.println(c);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 36196
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, l, r, chair;
    cin >> N;
    chair = 0;
    for (int i = 0; i < N; i++){
        cin >> l >> r;
        chair += (r - l + 1);
    }
    cout << chair << endl;
}

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

const int MAX = 100;

int main() {
	
	int A[MAX]; //配列
	int n = 0; //要素数受け取り

	int count = 0; //カウンター
	int v = 0; //値保存用
	bool flag = true; //フラグ

	cin >> n;

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

	while (flag)
	{
		flag = false;

		for (int j = n - 1; j > 0; j--) {
			if (A[j] < A[j - 1]) {
				v = A[j];
				A[j] = A[j - 1];
				A[j - 1] = v;
				count++;
				flag = true;
			}
		}
	}

	for (int i = 0; i < n; i++) {
		if (i!=0) cout << " ";
		cout << A[i];
	}

	cout << endl;
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



 
int main(){
	int H,W; cin >> H >> W;
	int N; cin >> N;
	vector<int> a(N);
	rep(i,N) cin >> a[i];
	vector<vector<int>> ans(H,vector<int>(W));
	int y = 0,x = 0;
	while(true){
		rep(i,N){
			if(a[i] > 0){
				ans[y][x] = i+1;
				a[i]--;
				break;
			}
		}
		if(y-1 >= 0 && ans[y-1][x] == 0) y--;
		else if(y+1 < H && ans[y+1][x] == 0) y++;
		else{
			if(x+1 < W) x++;
			else break;
		}
	}
	rep(i,H){
		rep(j,W){
			if(j) cout << " ";
			cout << ans[i][j];
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
let () =
  print_endline @@
  Scanf.scanf "%2d %2d" @@ fun a b ->
  if 1 <= a && a <= 12 && 1 <= b && b <= 12 then "AMBIGUOUS"
  else if 1 <= a && a <= 12 then "MMYY"
  else if 1 <= b && b <= 12 then "YYMM"
  else "NA"


Measured memory_bytes: 384
/*
    author : Aryan Agarwal, IIT KGP
    created : 27-04-2020 17:19:12
*/

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

typedef long long int ll;
typedef unsigned long long ull;
#define int ll

int MOD = 1000000007; /*more than (10)^9*/  /*7 + 1e9*/
int PEG = 998244353; /*less than (10)^9*/   /*1 + 7*17*(2)^23*/
long double pie=acos(-1);

// for creating a 2d vector with n rows & m columns then initialise it with it 0
// vvi vec(n,vi(m,0));
// vector<vector<int> > vec( n , vector<int> (m, 0));
typedef vector< int > vi;
typedef vector< vi > vvi;
#define X first
#define Y second
#define pb push_back
#define sz(a) (ull)(a).size()
#define all(a) (a).begin(),(a).end()
 
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<"\n"
#define out1(a,n) F(i,1,n)cout<<a[i]<<" ";cout<<"\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pfy cout<<"YES"
#define pfn cout<<"NO"
#define pfn1 cout<<"-1"  // printf negative 1
#define pf1 cout<<"1"
#define nl cout<<"\n"

#define dbg(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>void __f(const char* name,Arg1&& arg1){std::cout<<name<<" : "<<arg1<<endl;}template <typename Arg1,typename... Args>void __f(const char* names,Arg1&& arg1,Args&&... args){const char* comma=strchr(names+1, ',');std::cout.write(names,comma-names)<<" : "<<arg1<<"\n";__f(comma+1,args...);}

ll binpow(ll x,ll y,ll p)/* (x^y)%p in O(log y) */{ll res=1;x=x%p;while (y > 0){if(y&1)res=(res*x)%p;y = y>>1;x=(x*x)%p;}return res;}
ll mod_inverse(ll n,ll p)/* Returns n^(-1) mod p */{return binpow(n,p-2,p);}
ll popcount(ll n)/*__builtin_popcount doesn't work for big no.s*/{ll ans=0;while(n){if(n%2)ans++;n/=2;}return ans;}
ll gcd(ll a, ll b)/*__gcd doesn't work for big no.s*/{if (b == 0)return a;return gcd(b, a % b);}

signed main()
{
    #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    #endif
    fast;

    int ht,st,ha,sa;
    cin>>ht>>st>>ha>>sa;

    int i=1;

    while(ht>0 && ha>0)
    {
        if(i%2)
        {
            ha-=st;
        }
        if(i%2==0)
        {
            ht-=sa;
        }
        i++;
        // dbg(ha,ht);
    }

    if(ha<=0)cout<<"Yes";
    else cout<<"No";

    return 0;
}

Measured memory_bytes: 3648
#define _USE_MATH_DEFINES
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<set>
#include<vector>


using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const long long int INF=1001001001001001001;



int main(){
	char N[200000];
	scanf("%s",N);
	long long int ans=0;
	int pend=-1;
	int gend=-1;
	int pnend=-1;
	int ima=-1;// g1 p0
	int amari=0;
	rep(i,strlen(N)){
		if((i%2)&&N[i]=='g')ans+=1;
		if(!(i%2)&&N[i]=='p')ans-=1;
	}
	/*rep(i,strlen(N) ){
		if(i==0){
			ima=(bool)(N[i]=='g');
			continue;
		}
		int nima=(bool)(N[i]=='g');
		if(ima!=nima){
			if(ima){//g->p
				gend=i-1;
			}else{//p->g
				pend=pnend;
				pnend=i-1;
				//////操作
				ans+=( (gend-pend)-(pnend-gend) )/2;
				if(( (gend-pend)-(pnend-gend) )%2 ){
					if(amari){ans++;amari--;}
				}else{
					if(amari>=2){ans++;amari-=2;}
				}
			}
		}
		if(i==strlen(N)-1){
			if(ima!=nima){
				if(ima){//g->p/
				}else{//p->g/
					//ans++;
				}
			}else{
				if(nima){//ppgg;
					ans+=(i-pnend)/2;
				}else{//ggpp
					pend=pnend;
					pnend=i;
					//////操作
					ans+=( (gend-pend)-(pnend-gend) )/2;
					if(( (gend-pend)-(pnend-gend) )%2 ){
						if(amari){ans++;amari--;}
					}else{
						if(amari>=2){ans++;amari-=2;}
					}
					
				}
			}
		}
		ima=nima;
	}*/
	printf("%lld\n",ans);
	return 0;
}

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

int main(){
    int C[4][4];
    for(int i=1; i<=3; i++){
        for(int j=1; j<=3; j++){
            cin >> C[i][j];
        }
    }
    bool a21, a32, b21, b32;
    a21 = C[2][1]-C[1][1] == C[2][2]-C[1][2] && C[2][2]-C[1][2]==C[2][3]-C[1][3];
    a32 = C[3][1]-C[2][1] == C[3][2]-C[2][2] && C[3][2]-C[2][2]==C[3][3]-C[2][3];
    b21 = C[1][2]-C[1][1] == C[2][2]-C[2][1] && C[2][2]-C[2][1]==C[3][2]-C[3][1];
    b32 = C[1][3]-C[1][2] == C[2][3]-C[2][2] && C[2][3]-C[2][2]==C[3][3]-C[3][2];
    if(a21 && a32 && b21 && b32)cout << "Yes";
    else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  string s;
  cin>>s;
  bool c=false, f=false;

  for(char ch : s){
    if(ch=='C') c=true;
    if(c && ch=='F') f=true;
  }
  if(f) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int j, m, s, e, a, b;
	scanf("%d %d %d %d", &j, &m, &s, &e);
	a = j + m + s + e;
	scanf("%d %d %d %d", &j, &m, &s, &e);
	b = j + m + s + e;
	if (a > b)
		printf("%d\n", a);
	else
		printf("%d\n", b);
	return 0;
}

Measured memory_bytes: 1020
#include <iostream>
#include <map>

using ll = long long;

ll A[int(2e5) + 100];

int main() {
    int n;
    std::map<ll, int> s;
    std::cin >> n;

    ll cnt = 0;

    ++s[0];
    for(int i = 0; i < n; ++i) {
        std::cin >> A[i + 1];

        A[i + 1] += A[i];

        cnt += s[A[i + 1]];

        ++s[A[i + 1]];
    }


    std::cout << cnt << std::endl;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

const int MAX_S = 305;
string S;
int K;

int dp[MAX_S][MAX_S][MAX_S];

int main()
{
  cin >> S;
  cin >> K;
  
  memset(dp, 0, sizeof(dp));

  //配るdpだと偶数の時がバグるので貰うdpにする
  for(int w = 0; w < S.length(); w++) {
    for(int l = 0; l+w < S.length(); l++) {
      int r = l+w;
      for(int k = 0; k <= K; k++) {
	if(l == r) {
	  dp[l][r][k] = 1;
	} else { 
	  //何もしない
	  if(l+1 < S.length()) {
	    dp[l][r][k] = max(dp[l][r][k], dp[l+1][r][k]);
	  }
	  if(r-1 >= 0) {
	    dp[l][r][k] = max(dp[l][r][k], dp[l][r-1][k]);
	  }

	  //回文を伸ばす
	  if(l+1 < S.length() && r-1 >= 0) {
	    if(S[l] == S[r]) {
	      dp[l][r][k] = max(dp[l][r][k], dp[l+1][r-1][k] + 2);
	    }
	    if(k < K) {
	      dp[l][r][k] = max(dp[l][r][k], dp[l+1][r-1][k+1] + 2);
	    }
	  }
	}
      }
    }
  }

  int ans = 0;
  for(int k = 0; k <= K; k++) {
    ans = max(ans, dp[0][S.length()-1][k]);
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
  int w,h,n;
  cin >> w >> h >> n;

  int xmin=0,xmax=w,ymin=0,ymax=h;
  for (int i = 0; i < n; i++)
  {
    int x,y,a;
    cin >> x >> y >> a;

    if(a==1) xmin = max(xmin,x);
    if(a==2) xmax = min(xmax,x);
    if(a==3) ymin = max(ymin,y);
    if(a==4) ymax = min(ymax,y);
  }

  if(xmin>xmax || ymin>ymax) cout << 0 << endl;
  else cout << (xmax-xmin)*(ymax-ymin) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;
using P = pair<int,int>;

int main() {
    int k,n;
    cin >> k >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];

    vector<bool> used(n,false);
    used[0] = true;
    priority_queue<P, vector<P>, greater<>> pq;
    pq.emplace(abs(a[0] + (k - a.back())), n-1);
    pq.emplace(abs(a[0] - a[1]), 1);

    int64 ans = 0;
    while(!pq.empty()) {
        int i,c;
        tie(c,i) = pq.top(); pq.pop();
        if (used[i]) continue;
        used[i] = true;
        ans += c;
        if (i-1 >= 0 && !used[i-1]) pq.emplace(abs(a[i]-a[i-1]), i-1);
        if (i+1 < n && !used[i+1]) pq.emplace(abs(a[i]-a[i+1]), i+1);
    }

    cout << ans << endl;
}

Measured memory_bytes: 1656
#include <iostream>
#include <string>
#include <set>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <cmath>
#include <deque>
using namespace std;
#define res(i, n) for(int (i)=0;(i)<(n);(i)++)
#define MAXA 1001
#define MAXB 1001
#define MAXH 1000000001
#define MAXW 3001
#define INF (1 << 30)
#define MAXX 16002
#define MAXY 16002
#define MAXN 100001
#define MAXM 100001
#define MAXK 100001
#define MAXV 201
#define MAXP 1000001
#define MOD 1000000007
#define EPS (1e-10)
typedef long long ll;
struct edge{
    int to, cost;
};

bool dp[MAXX];
int A[2][MAXN];
int N;

int main(){
    cin >> N;
    for(int i = 0;i < 2;i++){
        for(int j = 0;j < N;j++){
            cin >> A[i][j];
        }
    }

    for(int i = 0;i < N - 1;i++){
        A[0][i + 1] += A[0][i];
    }

    for(int i = 0;i < N;i++){
        if(i == 0){
            A[1][0] += A[0][0];
        }else{
            A[1][i] += max(A[1][i - 1], A[0][i]);
        }
    }

    printf("%d\n", A[1][N - 1]);
    return 0;
}

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

using namespace std;

int main()
{
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  string s;
  for(int i = sx; i < tx; i++) s += "R";
  for(int i = sy; i < ty; i++) s += "U";
  for(int i = sx; i < tx; i++) s += "L";
  for(int i = sy; i <= ty; i++) s += "D";
  for(int i = sx; i <= tx; i++) s += "R";
  for(int i = sy; i <= ty; i++) s += "U";
  s += "L";
  s += "U";
  for(int i = sx; i <= tx; i++) s += "L";
  for(int i = sy; i <= ty; i++) s += "D";
  s += "R";

  cout << s << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(v,a,b) for(int v=(a);v<(b);v++)
#define rrep(v,a,b) for(int v=(b)-1;v>=(a);v--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct BipartiteMatching {
	int n;
	vector<vector<int>> g;
	vector<int> match;
	vector<bool> used, alive;
	BipartiteMatching(int n) : n(n), g(n), match(n), used(n), alive(n, true) {}
	void addEdge(int u, int v) {
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	int maximumMatching() {
		int cnt = 0;
		fill(match.begin(), match.end(), -1);
		for (int v = 0; v < n; v++) {
			if (!alive[v])continue;
			if (match[v] == -1) {
				fill(used.begin(), used.end(), false);
				if (augment(v))cnt++;
			}
		}
		return cnt;
	}
	bool augment(int v) {
		used[v] = true;
		for (int u : g[v]) {
			if (!alive[u])continue;
			int w = match[u];
			if (w == -1 || (!used[w] && augment(w))) {
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
		return false;
	}
};

struct LexicographicallyBipartiteMatching :BipartiteMatching {
	LexicographicallyBipartiteMatching(int n) :BipartiteMatching(n) {}
	int maximumMatching() {
		for (int v = 0; v < n; v++)
			sort(g[v].begin(), g[v].end());
		int cnt = BipartiteMatching::maximumMatching();
		for (int v = 0; v < n; v++) {
			if (!alive[v] || match[v] == -1)continue;
			match[match[v]] = -1;
			match[v] = -1;
			fill(used.begin(), used.end(), false);
			augment(v);
			alive[match[v]] = 0;
			alive[v] = 0;
		}
		return cnt;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N; cin >> N; N--;
	vector<vector<int>> b(N, vector<int>(N));
	rep(v, 0, N) rep(u, 0, N) { cin >> b[v][u]; }

	LexicographicallyBipartiteMatching lbm(N + N);
	rep(v, 0, N)rep(u, 0, N) {
		if (b[v][u])
			lbm.addEdge(u, N + v);
	}
	int res = lbm.maximumMatching();
	dump(res);
	if (res == N) {
		cout << "yes" << endl;
		rep(v, 0, N) {
			cout << lbm.match[v] - N + 1 << endl;
		}
	}
	else {
		cout << "no" << endl;
	}
	return 0;
}

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

// Optimization

// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("O3")
#define endl '\n'

// Shortcut

#define int long long
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) Fora(iiii, a) cout << iiii << ' '; cout << endl;
#define PrintVl(a) Fora(iiii, a) cout << iiii << endl;
#define PrintA(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << ' '; cout << endl;
#define PrintAl(a, l, r) for (int iiii = l; iiii <= r; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a))
#define mset1(a) memset(a, 1, sizeof(a))
#define msetn1(a) memset(a, -1, sizeof(a))
#define msetinf(a) memset(a, 0x3f, sizeof(a))
#define gcd __gcd
#define __builtin_popcount __builtin_popcountll
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
#define div divi
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, mod1 = 998244353, mod2 = 1e9 + 9, inf = 1e9 + 7;
const ll infll = 1e18 + 7;

int n, m, k;
int ans, cnt, tmp, idx, sum, mx = -infll, mn = infll;
int x, y, z;
string s, t;
int a[N], b[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    while (n){
        if (n % 10 == 7) Ptest("Yes");
        n /= 10;
    }
    cout << "No";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
int n,m;
VVI edge(100001,VI());
bool visited[100001];
ll dp[100001];
int f(int x){
    if(visited[x]) return dp[x];
    visited[x] = true;
    int res = 0;
    rep(i,edge[x].size()){
        res = max(res,f(edge[x][i])+1);
    }
    dp[x] = res;
    return res;
}

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

    rep(i,m){
        int from ,to;
        cin >> from >> to;
        from --, to--;
        edge[from].push_back(to);
    }

    int ans = 0;
    rep(i,n){
        //memset(visited,0,sizeof(visited));
        ans = max(ans,f(i));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8704
// Sky's the limit :)
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    //int t = 1; cin >> t; while(t--)
    {
    	int n;
    	cin >> n;

    	int p = 100, y = 0;
    	while(p < n) {
    		p += p / 100;
    		y++;
    	}

    	cout << y << '\n';
    }
    
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}



Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

//const int mod = 1000000007;
const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod

//gcd(0,x)=gcd(x,0)=x, gcd(0,0)=0
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

signed main(){

    int N; cin >> N;
    vec a(N); cin >> a;
    Sort(a);
    int ans = 1;
    REP(i, N) (ans *= gcd(a[i], i)) %= mod;
    Out(ans);

    return 0;
}


Measured memory_bytes: 1024
N, M = map(int, input().split())
switches = [i for i in range(2**N)]
indexs = [list(map(int, input().split()))[1:] for i in range(M)]
lights = [int("".join(["1" if i in index else "0" for i in range(1, N+1)]), 2) for index in indexs]
rules = list(map(int, input().split()))

cnt = 0
for s in switches:
    flag = True
    for i, l in enumerate(lights):
        num = sum(int(n) for n in format(l & s, "b")) % 2
        if num != rules[i]:
            flag = False
    if flag:
        cnt += 1

print(cnt)


Measured memory_bytes: 3064
n = gets.to_i
a = gets.split.map(&:to_i)
sum = a.sum
g = {}
a.group_by{_1}.each{g[_1] = _2.count}
q = gets.to_i
q.times do
  b, c = gets.split.map(&:to_i)
  if g[b] && !g[b].zero?
    sum += (c - b) * g[b]

    if g[c]
      g[c] = g[c] + g[b]
    else
      g[c] = g[b]
    end
    g[b] = 0
  end

  puts sum
end

Measured memory_bytes: 28248
#include<iostream>
int main() {
int A,B,C,D;
std::cin >> A >> B >> C >> D;
if(A*B>C*D)
std::cout << A*B << std::endl;
else {
	if(A*B<C*D)
	std::cout << C*D << std::endl;
	else {
		std::cout << A*B << std::endl;
	}
}

			return 0;
		}
		


			
	


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
a = LIST()
arr1 = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
arr1[0] = a[0]
arr2[-1] = a[-1]
for i in range(1, n):
    arr1[i] = gcd(arr1[i - 1], a[i])
for i in reversed(range(n - 1)):
    arr2[i] = gcd(arr2[i + 1], a[i])
ans = arr1[-1]
for i in range(n): #delete a[i]
    if 0 < i < n - 1:
        ans = max(ans, gcd(arr1[i - 1], arr2[i + 1]))
    elif i == 0:
        ans = max(ans, arr2[1])
    elif i == n - 1:
        ans = max(ans, arr1[n - 2])
print(ans)

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

using namespace std;

#define int long long

void knapsack_01(int n,int W,vector<pair<int,int>>v)
{
    int m[n+1][W+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=W;j++)
        {
            if(i==0||j==0)
                m[i][j]=0;
            else if(v[i].first>j)
                m[i][j]=m[i-1][j];
            else
                m[i][j]=max(m[i-1][j],v[i].second+m[i-1][j-v[i].first]);
        }
    }
    cout<<m[n][W]<<endl;
}

int32_t main()
{
    int n,W;
    cin>>n>>W;
    vector<pair<int,int>>v;
    for(int i=0;i<n;i++){
        int w,a;
        cin>>w>>a;
        v.push_back({w,a});
    }
    v.push_back({0,0});
    sort(v.begin(),v.end());
    knapsack_01(n,W,v);
}


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

typedef long long ll;


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

    ll mod = pow(10, 9) + 7LL;

    ll N, M;

    cin >> N >> M;

    vector<ll> a(M);
    vector<bool> check(N + 1);

    for(int i = 0; i < M; i++) {
        cin >> a[i];
        check[a[i]] = true;
        if(i) {
            if(a[i] - 1 == a[i - 1]) {
                cout << 0 << endl;
                return 0;
            }
        }
    }

    vector<ll> c(N + 1);

    c[0] = 1;
    c[1] = 1;

    for(int i = 2; i <= N; i++) {
        c[i] = c[i - 1] + c[i - 2];
        c[i] %= mod;
    }

    ll count = 0;

    ll ans = 1;

    for(int i = 1; i <= N; i++) {
        if(check[i]) {
            ans *= c[count];
            ans %= mod;
            count = 0;
            i++;
        } else {
            count++;
        }
    }

    ans *= c[count];
    ans %= mod;

    cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#include <math.h>//pow(x,y)=x^y
#include <algorithm>//sort(a.begin(), a.end());reverse(a.begin(), a.end());
#define rep(i,n) for (int i=0; i <(n);i++)
#define ll long long
using namespace std;


int main() {
int N,K,sum;
sum = 0;
cin >> N >> K;
vector<int> A(N);

rep(i,N){
    cin >> A.at(i);
}
sort(A.begin(),A.end());

rep(i,K){
sum += A.at(i);
}
cout << sum << endl;

}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

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

    double n; cin >> n;

    int x = (int) n/1.08;

    bool a = (int)((x-1)*1.08) == n;
    bool b = (int)(x*1.08) == n;
    bool c = (int)((x+1)*1.08) == n;

    if(a) cout << x -1 << endl;
    else if (b) cout << x << endl;
    else if (c) cout << x + 1 << endl;
    else cout << ":(" << endl;

    return 0;
}

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;
using li=list<int>;
using lil=list<ll>;
using lis=list<string>;
using fli=forward_list<int>;
using fll=forward_list<ll>;
using fls=forward_list<string>;
using si=stack<int>;
using sl=stack<ll>;
using ss=stack<string>;
using qi=queue<int>;
using ql=queue<ll>;
using qs=queue<string>;
using pqi=priority_queue<int>;
using pql=priority_queue<ll>;
using pqs=priority_queue<string>;
using dqi=deque<int>;
using dql=deque<ll>;
using dqs=deque<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define repr(i, n) for(int i = (n); i >= 0; i--)
#define repr2(i, a, n) for(int i = (n); i >= (a); i--)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

template<typename T,typename U>
void Printarray2(T f,U n){
  for(int i=0;i<n;i++) cout<<f[i]<<endl;
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n,ans=0;cin>>n;
  string num;
  rep2(i,1,n+1){
    num=to_string(i);
    if(num.size()%2==1)ans++;
  }
  cout<<ans<<endl;
}


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

using namespace std;

int main()
{
  int n;
  cin >> n;
  string w[100];
  for (int i = 0; i < n; i++)
    cin >> w[i];
  map<string, bool> m;
  m[w[0]] = true;
  bool ok = true;
  for (int i = 1; i < n; i++)
  {
    if (m[w[i]] || w[i][0] != w[i - 1][w[i - 1].length() - 1])
      ok = false;
    m[w[i]] = true;
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

int main(int argc, char* argv[]) {
	int* n;
	n = new int[3];
	for ( int i = 0; i < 3; i++)	cin >> n[i];
	sort(n, n + 3);

	cout << n[0] << " " << n[1] << " " << n[2] << endl;

	return 0;
}

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

int main(){
	int n;

	cin >> n;

	for (int i = 1; i <= n;i++){
		int x = i;

		if (x % 3 == 0){
			cout << " " << i;
			x = 0;
		}

		while (x){
			if (x % 10 == 3){
				cout << " " << i;
				break;
			}
			x /= 10;
		}
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1160
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>

using namespace std;
typedef long long int lint;

bool AOJ0100() {
	lint n, e, p, q;
	cin >> n;
	if (n == 0) return false;

	lint* data = new lint[4001]; //?£??????????
	bool* output = new bool[4001]; //?????§????????????????????????
	vector<lint> order; //???????????????????????\??????????????????

	for (int i = 0; i <= 4000; i++) {
		data[i] = 0;
		output[i] = false;
	}

	for (lint i = 0; i < n; i++) {
		cin >> e >> p >> q;
		data[e] += p * q;
		order.push_back(e);
	}

	bool flag = false;
	for (auto itr = order.begin(); itr != order.end(); itr++) {
		if (output[*itr]) continue;
		if (data[*itr] >= 1000000) {
			flag = true;
			output[*itr] = true;
			cout << *itr << endl;
		}
	}
	if (!flag) cout << "NA" << endl;

	delete[] data;
	delete[] output;
	return true;
}

int main()
{
	while (AOJ0100()) {
	}
	return 0;
}

Measured memory_bytes: 3168
num_inputs = int(raw_input())
 
limit = 100000000000000000000000000000000000000000000000000000000000000000000000000000000
 
count = 0
while count < num_inputs:
    num1 = int(raw_input())
    num2 = int(raw_input())
 
    if num1 >= limit or num2 >= limit:
        print "overflow"
    else:
        num = num1 + num2
        if num >= limit:
            print "overflow"
        else:
            print num
    count += 1

Measured memory_bytes: 6428
from scipy.sparse.csgraph import floyd_warshall
from collections import deque
import sys
input = sys.stdin.readline
def isbipart(n,graph):  
  colors = [0 for i in range(n)]
  stack = deque([(0,1)])
  while stack:
    v,color = stack.pop()
    colors[v] = color
    for to in graph[v]:
      if colors[to] == color:
        return False
      if colors[to] == 0:
        stack.append((to,-color))
  return True

def solve():
  n = int(input())
  graph = []
  for i in range(n):
    tmp = []
    s = input()
    for j in range(n):
      tmp.append(int(s[j]))
    graph.append(tmp)
  d = floyd_warshall(graph)
  #csgraphを変換
  newgraph = [[] for _ in range(n)]
  for i in range(n):
    for j in range(n):
      if graph[i][j] == 1:
        newgraph[i].append(j)
  ans = -1 * float("Inf")
  for i in range(n):
    for j in range(n):
      ans = max(ans,d[i][j])
  if isbipart(n,newgraph):
    print(int(ans)+1)
  else:
    print(-1)
solve()

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

main(){
    int n;
    int a[200];
    cin >> n;
    for(int i = 0;i < n;i++) cin >> a[i];
    int count = 0;


    while(true){
        bool odd = false;
        for(int i = 0;i < n;i++){
            if (a[i] % 2 == 1) odd = true;
        }
        if (odd) break;

        for (int i = 0;i < n;i++) a[i] = a[i] / 2;

        count++;
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;

#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define INF 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
#define FOR(i,a,n) for(ll i=a;i<n;i++) 
#define FORE(i,a,n) FOR(i,a,n+1)
#define Endl endl
#define eNdl endl
#define enDl endl
#define endL endl

int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n),b(n),c(n-1);
    FOR(i,0,n)cin>>a[i];
    FOR(i,0,n)cin>>b[i];
    FOR(i,0,n-1)cin>>c[i];
    ll ans = 0;
    FOR(i,0,n)ans+=b[i];
    FOR(i,0,n-1)
    {
    	if(a[i] == a[i+1]-1)ans+=c[a[i]-1];
	}
	cout<<ans<<endl;
	return 0;
}

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

#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define eb emplace_back
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(), x.end()

using namespace std;
using ll = long long;
using ull = unsigned long long;
using Vi = vector<int>;

void run() {
 	int n;
 	cin >> n;
 	Vi ara(n);
 	for (auto &i : ara) 	cin >> i;
 	sort(all(ara));
 	ara.erase(unique(all(ara)), ara.end());
 	if(ara.size() == n) cout << "YES" << endl;
 	else cout << "NO" << endl; 
}

int main() 
{
    IO;
    double st = clock();
    run();
    cerr << "\n" << "time = " << (clock() - st) / CLOCKS_PER_SEC << "\n";
    return 0;
}

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

int main()
{
	string s;
	cin >> s;
	if(s=="SAT")cout<<"1\n";
	else if (s=="SUN")cout<<"7\n";
	else if (s=="MON")cout<<"6\n";
	else if (s=="TUE")cout<<"5\n";
	else if (s=="WED")cout<<"4\n";
	else if (s=="THU")cout<<"3\n";
	else cout<<"2\n";
	return 0;
}	



Measured memory_bytes: 256
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
	int n, i;
	int t;
	long sum=0, now=0;
	scanf("%d%d", &n, &t);
	for(i=0; i<n; i++){
		int s;
		scanf("%d", &s);
		if(s>=now){
			sum += t;
		}else{
			sum += s+t-now;
		}
		now = s+t;
	}
	printf("%ld\n", sum);
}


Measured memory_bytes: 128
import java.util.*;

class Main{
    //148c
    static final int DIV = 100000007;
    static final int MAX = 2000000000;
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        //int[] dif = new int[n];
        int ans=0;
        int count = 1;
        boolean poyo = false;
        for(int i = 0;i < n;i++){
            ary[i] = sc.nextInt();
            if(ary[i]==count){
                count++;
                poyo = true;
            }else{
                ans++;
            }
        }
        if(poyo){
            System.out.println(ans);
        }else{
            System.out.println(-1);
        }

    }
    
}

Measured memory_bytes: 84116