akhauriyash/Code-Regression huggingface dataset:
n=1000000
p=[1]*(n+1)
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n+1,i):
            p[j]=0
p=[i for i in range(n+1) if p[i]==1]
while 1:
    try:n=int(input())
    except:break
    for i in range(len(p)):
        if p[i]==n:
            print(p[i-1],p[i+1])
            break 
        elif p[i]>n:
            print(p[i-1],p[i])
            break 

Measured memory_bytes: 18564
#include<stdio.h>
int main(){
  int n,x=0,i,d[200010];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
    x^=d[i];
  }
  for(i=0;i<n;i++)printf("%d ",d[i]^x);
  printf("\n");
  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(i, n) a[idx][i] = v[i]; idx++; PER = a;} while(next_permutation(ALL(v)));} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (n == m) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,o,n) for(long long i = o;i<n;i++)
#define oneforall ios::sync_with_stdio(false);cin.tie(0);
#define all(v) (v).begin(),(v).end()
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define int long long 
const long long INF=1e18;
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;
typedef vector<pair<long, long > > vpll;
typedef vector<pair<int, int > > vpii;
#define FORR(x,arr) for(auto& x:arr)

ll mo=1000000007;
ll comb(ll N_, ll C_) {
    const int NUM_=100043;
    static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];
    if (fact[0]==0) {
        inv[1]=fact[0]=factr[0]=1;
        for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
        for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
    }
    if(C_<0 || C_>N_) return 0;
    return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
    }
int32_t main() {
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall
	oneforall 
	oneforall

	ini(n);
	ins(n1);
	int tmp = 0;
	FOR(i,0,1000){
		string x = to_string(i);
		if(i<10) x = '0'+x;
		if(i<100)x = '0'+x;
		int one = 0;
		FOR(i,0,n){
			if(n1[i] == x[0]){
				one++;
				FOR(i1,i+1,n){
					if(n1[i1] == x[1]){
						one++;
						FOR(i2,i1+1,n){
							if(n1[i2] == x[2]){
								one++;
								break;
							}
						}
						break;
					}
				}
				break;
			}
		}
		if(one == 3){tmp++;}//out(x);}
	}
	out(tmp);
	















	return 0;
}


Measured memory_bytes: 384
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    dp = [[0] * (N+1) for _ in range(4)]
    dp[0][0] = 1
    for i in range(N):
        dp[0][i+1] = (dp[0][i] * 8)%mod
        dp[1][i+1] = (dp[0][i] + (dp[1][i] * 9)%mod)%mod
        dp[2][i+1] = (dp[0][i] + (dp[2][i] * 9)%mod)%mod
        dp[3][i+1] = ((dp[1][i] + dp[2][i])%mod + (dp[3][i] * 10)%mod)%mod
    print(dp[3][-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 96416
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    string s,t;
    cin>>s>>t;
    cout<<t<<s;
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Solve.Answer();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var nm = IO.ReadSplitInt;
            var cnt = new int[nm[0]];

            for (int i = 0; i < nm[1]; i++)
            {
                var ab = IO.ReadSplitInt;
                cnt[ab[0] - 1]++;
                cnt[ab[1] - 1]++;
            }
            for (int i = 0; i < nm[0]; i++)
            {
                WriteLine(cnt[i]);
            }
        }

        public class IO
        {
            #region Input
            public static string ReadString => ReadLine();
            public static int ReadInt => int.Parse(ReadLine());
            public static long ReadLong => long.Parse(ReadLine());
            public static double ReadDouble => double.Parse(ReadLine());

            public static List<string> ReadSplitString => ReadLine().Split().ToList();
            public static List<int> ReadSplitInt => ReadLine().Split().Select(s => int.Parse(s)).ToList();
            public static List<long> ReadSplitLong => ReadLine().Split().Select(s => long.Parse(s)).ToList();
            public static List<double> ReadSplitdouble => ReadLine().Split().Select(s => double.Parse(s)).ToList();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");

            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }

        public static long GCD(long x, long y)
        {
            #region
            if (x < y)
            {
                var tmp = x;
                x = y;
                y = tmp;
            }
            while (true)

            {
                if (x % y == 0)
                {
                    return y;
                }
                else
                {
                    var tmp = x;
                    x = y;
                    y = tmp % y;
                }
            }
            #endregion
        }

        public static long Choice2(long n)
        {
            #region
            if (n <= 1)
                return 0;
            if (n == 2)
                return 1;
            else
                return n * (n - 1) / 2;
            #endregion
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define sort(v,n) sort(v,v+n);
#define vsort(v) sort(v.begin(),v.end());
#define ll long long
#define pb(a) push_back(a)
#define fi first
#define se second
#define inf 999999999
using namespace std;
typedef pair<int,int> p;
typedef pair<ll,ll> lp;
bool is_uruu(int y) {
        return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
}
const ll MOD=1e9+7;
//---------------------------------------------------------------------------//

int main(){
        string s;
        cin>>s;
        cout<<s.substr(0,5);
        cout<<" ";
        cout<<s.substr(6,7);
        cout<<" ";
        cout<<s.substr(14.5)<<endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)
MOD = 1_000_000_007
N = int(input())
G = [[] for _ in range(N+1)]
for _ in range(N - 1):
    x, y = list(map(int, input().split()))
    G[x].append(y)
    G[y].append(x)

def dfs(v, root):
    w, b = 1, 1
    for u in G[v]:
        if u == root:
            continue
        child_w, child_b = dfs(u ,v)
        w *= child_w + child_b
        b *= child_w
    w %= MOD
    b %= MOD
    return w, b

print(sum(dfs(1, None)) % MOD)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,m,a,b,ans;
bool memo[8][8];
vector<int> v;

main() {
    cin >> n >> m;
    rep(i,m) {
        cin >> a >> b;
        a--,b--;
        memo[a][b] = memo[b][a] = true;
    }
    rep1(i,n-1) v.pb(i)
    do {
        int hoge = 0;
        rep(i,v.size()) {
            if (!memo[hoge][v[i]]) goto LoopBreak;
            hoge = v[i];
        }
        ans++;
        LoopBreak:;
    } while(next_permutation(all(v)));
    cout << ans << endl;
}




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

const int INF = 1e9;
vector<int> G[100010];
int dp[100010];

int dfs(int v){
	if(dp[v] != INF) return dp[v];
	vector<int> arr;
	dp[v] = G[v].size();
	for(int i=0; i<G[v].size(); i++){
		arr.push_back(dfs(G[v][i]));
	}
	sort(arr.begin(), arr.end());
	for(int i=0; i<arr.size(); i++){
		if(dp[v] < arr[i] + arr.size() - i){
			dp[v] = arr[i] + arr.size() - i;
		}
	}
	return dp[v];
}

int main(){
	int N; cin >> N;
	for(int i=1; i<N; i++){
		int a; cin >> a; a--;
		G[a].push_back(i);
	}
	fill(dp, dp+N, INF);
	cout << dfs(0) << "\n";
	return 0;
}

Measured memory_bytes: 17024
#include <stdio.h>
#include <ctype.h>

int main() {

  char ch[1200];
  int i,n;
  n=0;
  char a[1200];

  while(1) {
    scanf("%c",&a[n]);
    if(a[n] == '\n') {
      break;
    }
    ch[n] = a[n];
    if('A' <= a[n] && a[n] <= 'Z') {
      ch[n] = a[n] + 32;
    } else if(a[n] >= 'a' && a[n] <= 'z') {
      ch[n] = a[n] - 32;

    }
    
    
    n = n +1;
    
  }
  
  for(i=0; i<n ; i++) {
    printf("%c" ,ch[i]);
  }
  printf("\n"); 
  return 0;
  
}


Measured memory_bytes: 2096
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
  #include "dbgtoki.hpp"
  #define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
  #define DUMP(i) 
#endif
 
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());

using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

struct Edge{
public:
  int from,to,cost;
  Edge(){}
  Edge(int _from,int _to,int _cost){
    from = _from;
    to = _to;
    cost = _cost;
  }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;


const int EPS = 1e-9;
const int MOD = 1e9+7;



int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> V;
  string s;
  cin >> s;
  REP(i,SZ(s)){
    if(s[i] == '1')V.push_back(1);
    else if(s[i] == '0')V.push_back(0);
    else{
      if(V.size() != 0){
	V.pop_back();
      }
    }
  }

  REP(i,SZ(V)){
    cout << V[i];
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

void swap(int *a, int *b){
  int t;
  t = *a;
  *a = *b;
  *b = t;
}

int main(void){
  int a,b;
  long long int gcd,lcm;
  int r;
  while(scanf("%d %d",&a,&b) != EOF){
    int x = a;
    int y = b;
    if(a<b) swap(&a,&b);
    while(1){
      r = a/b;
      r = a-r*b;
      if(r==0) break;
      a = b;
      b = r;
    }
    gcd = b;
    lcm = (long)(x/gcd)*y;
      printf("%lld %lld\n",gcd,lcm);
  }  
  return 0;
}

Measured memory_bytes: 596
# A - AKIBA
substring = ['', 'KIH', 'B', 'R']
akihabara = []

for i in range(16):
	b = format(i, 'b')
	bin_str = b.zfill(4)
	s = ''

	for j in range(4):
		s += substring[j]
		
		if bin_str[j] == '1':
			s += 'A'

	akihabara.append(s)

if input() in akihabara:
	print('YES')
else:
	print('NO')

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

int main(){
  int n;
  cin >> n;
  vector<int> cum;
  int tmp;
  cin >> tmp;
  cum.push_back(tmp);
  for(int i=0; i<n-1; i++){
    cin >> tmp;
    cum.push_back(cum.at(i)+tmp);
  }
  int SUM = cum.at(n-1);
  int ans = 100000000;
  for(auto c : cum){
    ans = min(abs((SUM-c)-c),ans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll h[1000000];
ll v[1000000];
ll a[1000000];
ll acopy[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	cin>>N>>M;
	cin>>S>>T;
	ll L=N/gcd(N,M)*M;
	ll n=N/gcd(N,M);
	ll m=M/gcd(N,M);
	for(int i =0;i<gcd(N,M);i++){
		if(S[n*i]!=T[m*i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<L<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int N;
  string S,T;
  cin>>N>>S>>T;
  for(int i=0;i<N;i++){
     cout<<S.at(i)<<T.at(i);
  }
}

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

int cou = 0;

int K,S;

int main()
{
	cin >> K >> S;
	for(int x = 0;x <= K;x++)
	{
		for(int y = 0;y <= K;y++)
		{
			int t = S - x - y;
			if(0 <= t && t <= K) cou++;
		}
	}
	cout << cou++;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
SS ss;
#define debug ss
#endif

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

vstring h(vstring s,int n){
	if(n==0)return s;
	vstring ss;
	ss.PB(s[0]);
	ss.PB(s[3]);
	ss.PB(s[1]);
	ss.PB(s[4]);
	ss.PB(s[2]);
	ss.PB(s[5]);
	return h(ss,n-1);
}

vstring g(vstring s,int n){
	int pos[6][6]={
		{0,1,2,3,4,5},
		{1,5,2,3,0,4},
		{2,1,5,0,4,3},
		{3,1,0,5,4,2},
		{4,0,2,3,5,1},
		{5,4,2,3,1,0},
	};
	vstring res;
	rep(i,6)res.PB(s[pos[n][i]]);
	return res;
}

int main() {
	IL{
		int n;
		cin>>n;
		if(n==0)break;
		vector<vstring> dice;
		vstring rotdice[40][24];
		rep(i,n){
			string s;
			vstring v;
			rep(i,6){
				cin>>s;
				v.PB(s);
			}
			dice.PB(v);
		}
		rep(k,n){
			rep(i,6){
				vstring v=g(dice[k],i);
				rep(j,4){
					rotdice[k][i*4+j]=h(v,j);
				}
			}
		}
		int ng[40]={};
		rep(i,n)repn(j,i+1,n-1){
			rep(k,24){
				if(rotdice[j][k]==dice[i])ng[j]=1;
			}
		}
		int res=0;
		rep(i,n)res+=ng[i];
		cout<<res<<endl;
	}
	return 0;
}

Measured memory_bytes: 972
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

int main() {

    int A, P;
    cin >> A >> P;

    P += A * 3;
    int pie = P / 2;
    cout << pie << endl;

}

































Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back

#define INT 1.01

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

    int64_t X;
    cin >> X;

    int64_t v = 100;
    int ret = 0;
    while(true){
    //rep(ret, INF){
        if(X<=v){
            cout << ret << endl;
            break;
        }
        ret ++;
        v *= INT;
        //v += 0.01*v;
    }

    //cout << ret << endl;

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#define ALL(a) (a).begin(),(a).end()

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

ll myPow(ll x, ll n, ll m){
  if(n == 0)
    return 1;
  if(n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;
 
	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}
 
	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}
 
	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい]
	}
 
	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}
 
		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);
 
		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;
 
		return true;
	}
};




long long fac[510000], finv[510000], inv[510000];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 510000; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main() {
  // 前処理
  //COMinit();

	ll N;
  cin>>N;
  ll H[N];
  FOR(i,0,N-1){
    cin>>H[i];
  }

  ll ans=1;
  ll max=H[0];
  FOR(i,1,N-1){
    if(H[i]>=max){
      ans++;
      max=H[i];
    }
      
  }


  cout<<ans<<endl;


  return 0;
 
}


Measured memory_bytes: 256
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)
from numba import njit, i8


# @njit(i8[:](i8,i8,i8[:]))
@njit
def loof(a,N):
    M = np.zeros(2019,dtype=np.int16)
    M[0] += 1
    T = 0
    r = 1
    T += a[-1] * r
    T %= 2019
    M[T] += 1
    for i in range(N-2,-1,-1):
        r *= 10
        r %= 2019
        T += a[i] * r
        T %= 2019
        M[T] += 1
    return M


# @njit
# def pow_mod(a,n,mod):
#     memo = np.array([1])
#     if n >= 1:
#         for i in range(n-1):
#             memo = np.append(memo,memo[-1]*a%mod)
#         return memo
#     else:
#         return memo[0]


def main():
    S = input().rstrip()
    S = list(map(int,list(S)))
    a = np.array(S)

    N = len(a)

    # memo = pow_mod(10,N,2019)
    M = loof(a,N)

    res = 0

    for m in M:
        res += m * (m-1) // 2

    print(res)


main()


Measured memory_bytes: 112988
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,l;
    
    cin>>n>>l;
    string p;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
    {
        cin>>s[i];
    }
    sort(s.begin(),s.end());
    for (int i = 0; i < n; i++)
    {
        cout<<s[i];
    }
    
    cout<<p<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int t[25],n,cnt,a;
int main(){

  while(cin>>n&&n){
    for(int i=0;i<n;i++)cin>>t[i];

    cnt=32;
    a=0;

    while(cnt>0){

      cnt-=((cnt-1)%5);
      if(cnt<0)cnt=0;
      cout<<cnt<<endl;

      cnt-=t[a];
      a++;
      if(a==n)a=0;

      if(cnt<0)cnt=0;
      cout<<cnt<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N, K; cin >> N >> K;
	long long int dp[65536][110] = {};
	long long int DP[65536][110] = {}; // 累積和
	long long int a[65536] = {}; // 個数を管理
	long long int A[65536] = {}; // 累積の個数
	long long int P = 1e9 + 7; 
	int j = 1;
	for(int i = 1; i * i < N; i++){
		a[i] = 1; A[i] = i; j ++; 
	}
	int k = N / j;
	for(int i = j; i < j + k; i++){
		A[i] = N / (k + (j - i)); 
		a[i] = A[i] - A[i-1]; 
	}
	for(int i = 1; i < j + k; i++){
		dp[i][1] = a[i]; 
		DP[i][1] = A[i]; 
	}
	for(int p = 2; p <= K; p++){
		for(int i = 1; i < j + k; i++){
			dp[i][p] = (a[i] * (DP[j+k-i][p-1])) % P; 
			DP[i][p] = (DP[i-1][p] + dp[i][p]) % P; 
		}
	}
	cout << DP[j+k-1][K] << endl; 
}

Measured memory_bytes: 57600
#define _ITERATOR_DEBUG_LEVEL 1


#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int n, m, i, j, k, ans = 0;
	map<string, int> ca, cb;
	string s;
	cin >> n;
	while (n--) {
		cin >> s;
		ca[s]++;
	}
	cin >> m;
	while (m--) {
		cin >> s;
		cb[s]++;
	}

	ans = 0;
	for (auto p : ca) {
		ans = max(ans, p.second - cb[p.first]);
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
n = []
for i in range(5):
    n.append(int(input()))
k = int(input())

flag = 0
i = 0
while i < 5:
    j = 1
    while i + j < 5:
        if n[i + j] - n[i] > k:
            print(':(')
            flag = 1
            break
        else:
            j += 1
    if flag == 1:
        break
    if i + j == 5:
        i += 1
if i == 5:
    print('Yay!')

Measured memory_bytes: 3064
code = r"""
# distutils: language=c++
from libcpp.set cimport set
from libcpp.vector cimport vector
from libc.stdio cimport getchar, printf
from cython.operator cimport dereference as deref
from cython.operator cimport preincrement as preinc, predecrement as predec
from cython.operator cimport postincrement as postinc, postdecrement as postdec
cdef int cin() nogil:
    cdef int b, c = 0
    while 1:
        b = getchar() - 48
        if b < 0: break
        c = c * 10 + b
    return c
cdef int n = cin(), i
cdef long c
cdef vector[long] a = vector[long](n)
for i in range(n): a[cin() - 1] = i
cdef set[long] s = set[long]([-1, n])
cdef set[long].iterator it
for i in range(n):
    it = s.lower_bound(a[i])
    c += (deref(postdec(it)) - a[i]) * (a[i] - deref(it)) * (i + 1)
    s.insert(a[i])
printf('%ld\n', c)
"""
import os, sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    open('solve.pyx', 'w').write(code)
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 22368
#include <iostream>
#include <string>
using namespace std;
     
    int main(){
      string s;
      cin >> s;
      if(s == "Sunny") cout << "Cloudy" << endl;
      else if(s == "Cloudy") cout << "Rainy" << endl;
      else cout << "Sunny" << endl;
      
      return 0;
    }

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

const char NL = '\n';
const int MOD = 1e9 + 7;

void solve()
{
    ll x, k, d; cin >> x >> k >> d;
    ll pos = abs(x);
    ll q = pos / d;
    ll times = min(k, q);
    k -= times;
    pos -= d * times;
    ll ans = LONG_LONG_MAX;
    if (k == 0 || k % 2 == 0) {
        cout << pos << NL;
    } else {
        cout << min(pos + d, abs(pos - d)) << NL;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){
    int N;
    vector<int> a;

    cin >> N;
    a.resize(N);
    for(int i=0; i<N; i++)
        cin >> a[i];

    int cnt = 0;
    for(int i=0; i<N; i++){
        while(a[i] % 2 == 0){
            cnt++;
            a[i] /= 2;
        }
    }

    cout << cnt << endl;

    return 0;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

using namespace std;

/* global */
const int MOD = 1e9 + 7;
const int MAX = 510000;

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

	int n;
	cin >> n;

	vector<int> a(n);
	rep (i, 0, n)
		cin >> a[i];

	sort(a.begin(), a.end(), greater<int>());

	ll sub = LLONG_MAX;
	ll mid = a[0] / 2;
	pair<int, int> res;
	res.first = a[0];

	rep (i, 1, n) {
		ll tmp = abs(mid - a[i]);
		if (sub > tmp) {
			sub = tmp;
			res.second = a[i];
		}
	}

	cout << res.first << " " << res.second << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
  int a, b;

  scanf("%d %d", &a, &b);

  if (a<b)
    printf("a < b\n");
  else if (a>b)
    printf("a > b\n");
  else
    printf("a == b\n");

  return 0;
}


Measured memory_bytes: 2040
n=int(input())
balls=list(map(int,input().split()))
ans=[0]*n;m=0;al=[]
for i in range(n)[::-1]:
  d=i+1
  c=n//d
  mal=2
  check=0
  while d*mal<=n:
    check+=ans[d*mal-1]
    mal+=1
  check%=2
  if check!=balls[i]:
    ans[i]=1
    al.append(str(d))
    m+=1
print(m)
print(" ".join(al))


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  for (int i=0; i<N; i++) {
    int v=A[i];
    int j=i-1;
    while (j>=0 && A[j]>v) {
      A[j+1]=A[j];
      j--;
      A[j+1]=v;
    }
    for (int i=0; i<N; i++) {
      cout << (i==0?"":" ") << A[i] << flush;
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 3088
#include<stdio.h>
     
    int main(void){
    	int A,B,SUM;
    	scanf("%d %d",&A,&B);
    	SUM=A+B;
    	if(SUM<24)
    	printf("%d \n",SUM);
    	else
    	printf("%d \n",SUM%24);
    	return 0;
    }

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

int A[MAX], n;

int partition(int p, int r) {
  int x, i, j, t;
  x = A[r];
  i = p - 1;
  for (j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      t = A[i];
      A[i] = A[j];
      A[j] = t;
    }
  }
  t = A[i + 1];
  A[i + 1] = A[r];
  A[r] = t;
  return i + 1;
}

int main() {
  int i, q;

  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &A[i]);

  q = partition(0, n - 1);

  for (i = 0; i < n; i++) {
    if (i) printf(" ");
    if (i == q) printf("[");
    printf("%d", A[i]);
    if (i == q) printf("]");
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 3456
#include<iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	int i = 1;
	while (++i <= n) {
		int x = i;
		if (x % 3 == 0) {
			cout << " " << i;
			continue;
		}
		while (x) {
			if (x % 10 == 3) {
				cout << " " << i;
				break;
			}
			x /= 10;
		}
	}
	cout << endl;
	return 0;
}



Measured memory_bytes: 3100
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>

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


using namespace std;



int main() {

	int n;
	bool m = 1,f=0;
	long long int a = 0, b = 0;

	cin >> n;
	for (int i = 0; i < n; i++) {
		long long int x;
		cin >> x;

		if (m) {
			if (f&&x < a) {
				b++; m = 0; f = 0;
			}
			else if (!f&&x > a) {
				b++; m = 0;
			}

		}


		else if (!m) {
			if (a < x)f = 1;
			if(a!=x)m = 1;
		}
		a = x;
		//cout << m;;
		
	}
	cout << b << endl;

	return 0;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int x, y, ans = 0;

  cin>>x>>y;

  if(x<=3) {
    ans += (4 - x);
  }
  if(y<=3) {
    ans += (4 - y);
  }

  if(x==1 && y==1) {
    ans += 4;
  }

  cout<<ans*100000<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000000



int main(){
	
	int N;
	cin>>N;
	
	cout<<N/3<<endl;
	
		
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    ll a, b; cin >> a >> b;
    ll k = a % b;
    while (k != 0){
        a = b;
        b = k;
        k = a % b;
    }
    ll x = b;
    int ans = 1;
    repp(i,sqrt(x)+1,2){
        int c = i;
        bool t = false;
        while (x % c == 0){
            x /= c;
            t = true;
        }
        if (t) ans++;
    }
    if (x != 1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll modpow(ll a, ll n, ll mod_) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod_;
        a = a * a % mod_;
        n >>= 1;
    }
    return res;
}

const ll MAX_SIZE = 200005;
array<ll, MAX_SIZE> fac, inv, finv;
void finit() {
    // combination init
    fac[0] = 1;
    for (ll i = 1; i < MAX_SIZE; i++) fac[i] = fac[i - 1] * i % MOD;
    finv[MAX_SIZE - 1] = modpow(fac[MAX_SIZE - 1], MOD - 2, MOD);
    for(ll i = MAX_SIZE - 1; i > 0; i--) finv[i - 1] = finv[i] * i % MOD;
    
    //inv init
    repe(i, 1, MAX_SIZE) inv[i] = modpow(i, MOD - 2, MOD);
}

ll perm(ll a, ll b) { return fac[a] * finv[a - b] % MOD; }

ll comb(ll a, ll b) { return fac[a] * finv[b] % MOD * finv[a - b] % MOD; }

int main() {
    init();
    finit();
    ll N, K;
    cin >> N >> K;
    if(N>K){
        cout << 0 << endl;
        return 0;
    }

    cout << comb(K, N) << endl;
}


Measured memory_bytes: 7860
#include <iostream>
#include <algorithm>
#define INF 1000000000
using namespace std;

int main(){
  int N;
  int l,r;
  cin >> N;
  int cnt=0;
  for(int i=0;i<N;i++){
    cin >> l >> r;
    cnt+=r-l+1;
  }
  cout << cnt;
}


Measured memory_bytes: 256
//
//  main.cpp
//  Judge Status Summary
//
//  Created by Bryan on 05/07/20.
//  Copyright © 2020 mac. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <string>
#include <map>
using namespace std;

int main()
{
    int N;
    scanf ("%d", &N);
    map <string,int> mp;
    string temp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    while (N--)
    {
        cin>>temp;
        mp[temp]++;
    }
    printf ("AC x %d\n",mp["AC"]);
    printf ("WA x %d\n",mp["WA"]);
    printf ("TLE x %d\n",mp["TLE"]);
    printf ("RE x %d\n",mp["RE"]);
    
}


Measured memory_bytes: 3792
n = int(input())
h_l = [list(map(int,input().split())) for i in range(n)]
dp = [[h_l[0][i] for i in range(3)]] + [[0,0,0] for i in range(n-1)]
for j in range(1,n):
    for i in range(3):
        dp[j][i] = max(dp[j][i],dp[j-1][i-1]+h_l[j][i])
        dp[j][i] = max(dp[j][i],dp[j-1][i-2]+h_l[j][i])
print(max(dp[n-1]))

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

/*.....DEFINITIONS...... */
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define T() int tt; cin>>tt; while(tt--)
#define mp make_pair
#define pb push_back
#define lchild (2*node+1)
#define rchild (2*node+2)
#define f first
#define s second
#define br cout<<"\n"
#define MOD (1000000007LL)
#define all(v) (v).begin(), (v).end()
#define eps 1e6
#define sll(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define what_is(x) cerr << #x << " is " << x << "\n";

using namespace std;

/*.....TYPEDEFS ....*/
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

/*....USEFUL FUNCTIONS....*/
ll pwr(ll base, ll exp, ll mod=MOD){ll res=1; while(exp>0){if(exp%2){res=(res*base)%mod;}base=(base*base)%mod;exp/=2;}return res;}
ll gcd(ll a, ll b){ if(b==0)return a; else gcd(b, a%b);}
bool isPrime(ll n){if(n<=1)return false;if(n<=3)return true;if (n%2==0||n%3==0)return false;for(int i=5; i*i<=n; i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}

/*---------Solution below this line --------*/

const int N = 1234567;

int n;
long long x, y, c1, c2;
vector<pair<pii,int> > v;
int p[N];
vector<pair<ll, pii> >all;  

int root(int a){
	while(p[a]!=a){
		p[a] = p[p[a]];
		a = p[a];
	}
	return a;
}

void un(int x, int y){
	int a = root(x);
	int b = root(y);
	p[a] = p[b];
}



int main(){
	//FIO
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	
	scanf("%d", &n);
	for(int i=0; i<n; ++i){
		scanf("%d %d", &x, &y);
		v.push_back({{x,y},i});
		p[i] = i;
	}
	
	sort(all(v));
	for(int i=0; i<n-1; ++i){
		c1 = abs(v[i].first.first - v[i+1].first.first);
		c2 = abs(v[i].first.second - v[i+1].first.second);
		all.push_back({c1,{v[i].second, v[i+1].second}});
		all.push_back({c2,{v[i].second, v[i+1].second}});
	}
	
	sort(all(v), [&](pair<pii,int> left, pair<pii,int> right){
		return left.first.second < right.first.second;	
	});
	
	for(int i=0; i<n-1; ++i){
		c1 = abs(v[i].first.first - v[i+1].first.first);
		c2 = abs(v[i].first.second - v[i+1].first.second);
		all.push_back({c1,{v[i].second, v[i+1].second}});
		all.push_back({c2,{v[i].second, v[i+1].second}});
	}
	
	sort(all(all));
	
	long long res = 0;
	for(int i=0; i<all.size(); ++i){
		x = all[i].second.first;
		y = all[i].second.second;
		long long cost = all[i].first;
		if(root(x)!=root(y)){
			res += cost;
			un(x,y);
		}
	}
	
	printf("%lld\n", res);
	
	
	
		
	
return 0;
}


Measured memory_bytes: 13036
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

s = inp()
t = inp()

total = 10**9

for i in range(len(s)-len(t)+1):
    count = 0
    for j in range(i,len(t)+i):
        if s[j] != t[j-i]:
            count += 1
    total = min(count,total)

print(total)

Measured memory_bytes: 9164
#include <iostream>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>

using namespace std;

typedef long long LL;

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define dumpMap(m) { for (auto it: m) cout << it.first << "=>" << it.second << ' '; }

const int MOD = 1000000007;

double dp[3000][3000];

int main()
{
    int A, B;
    cin >> A >> B;

    double ans = max(0, A-2*B);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=1e2+1;
char s[101][101];
int dp[101][101];
int H,W;
int dpsolve(int i,int j)
{
	if(i==H-1&&j==W-1) return 0;
	if(dp[i][j]!=-1) return dp[i][j];
	int ans=1e3;
	if(i<(H-1)&&s[i][j]==s[i+1][j]) ans=min(ans,dpsolve(i+1,j));
	else if(i<(H-1)) ans=min(ans,1+dpsolve(i+1,j));
	if(j<(W-1)&&s[i][j]==s[i][j+1]) ans=min(ans,dpsolve(i,j+1));
	else if(j<(W-1)) ans=min(ans,1+dpsolve(i,j+1));
	dp[i][j]=ans;
	return ans;
}
void solve()
{
	cin>>H>>W;
	for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			cin>>s[i][j];
			dp[i][j]=-1;
		}
	}
	int ans=dpsolve(0,0);
	/*for(int i=0;i<H;i++)
	{
		for(int j=0;j<W;j++)
		{
			cout<<dp[i][j]<<" ";
		}
		cout<<"\n";
	}*/
	if(s[0][0]=='#') ans++;
	ans=ceil((1.0*ans)/2);
	cout<<ans<<"\n";
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll T=1,p=0;
	//cin>>T;
	do
	{
		solve();
		p++;
	}while(p<T);
	return 0;
}



Measured memory_bytes: 384
#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define LOCAL 1

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define dbg(...) cout<<#__VA_ARGS__ ": ["; for(auto e: __VA_ARGS__){cout<<e<<", ";} cout<<"]\n"
#define dbg1(...) cout<<#__VA_ARGS__ " "<< __VA_ARGS__ 
#else
#define dbg(...) 1;
#define dbg1(...) 1;
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
constexpr ll R=2e5+69, INF=2e9+6969, mod = 1e9+7;

ll ans,n,t[R],sum;

int main()
{
	scanf("%lld", &n);
	for(int i=0;i<n;++i)
	{
		scanf("%lld", &t[i]);
		sum += t[i];
		sum %= mod;
	}
	for(int i=0;i<n;++i)
	{
		sum -= t[i];
		sum %= mod;
		sum += mod;
		sum %= mod;
		ans += (t[i]*sum)%mod;
		ans %= mod;
	}
	printf("%lld\n", ans);
	return 0;
}


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

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define INFO(a) cout<<"info "<<a<<endl
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x,v) lower_bound((x).begin(),(x).end(),(v))-(x).begin();
#define uboundv(x,v) upper_bound((x).begin(),(x).end(),(v))-(x).begin();
#define ite iterator
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define lmid(l, r) ((l)+(r)-1)/2
#define rmid(l, r) ((l)+(r))/2+1
#define mp make_pair

typedef long long ll;
typedef long double LD;

using namespace std;

#define N 100005

int go(int a) {
    int ans=0;
    while(a) {
        ans += a%10;
        a = a/10;
    }
    return ans;
}
int calc(int a, int b) {
    return go(a)+go(b);
}
int main() {
	ios::sync_with_stdio(0);
    IN(n);
    int ans=INT_MAX;
    FI(n-1) {
        ans = min(ans, calc(i, n-i));
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
    cin.tie(NULL); cout.tie(NULL);
    ios_base:: sync_with_stdio(false);
    ll n;cin>>n;
    ll cnt[4]={0};
    for(ll i=0,x;i<n;i++)cin>>x,cnt[x%4]++;
    ll req = cnt[1] + cnt[3];
    if(req==cnt[0]+1){
        if(cnt[2]==0)cout<<"Yes";
        else cout<<"No";

        return 0;
    }

    cout<<(cnt[0]>=req?"Yes":"No");
}





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

using namespace std;

unsigned int bitmask[10] = {0b0000000001,0b0000000010,0b0000000100,0b0000001000,0b0000010000,0b0000100000,0b0001000000,0b0010000000,0b0100000000,0b1000000000};

int main(void) {
    unsigned int row, col, a[10][10000],b[10000];
    while (true) {
        cin >> row >> col;
        if (row == 0 && col == 0) break;
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                cin >> a[i][j];
            }
        }
        for(int i = 0;i < col;i++) {
            b[i] = 0;
            for(int j = 0;j < row;j++) {
                if(a[j][i] == 1)
                    b[i] = b[i] | bitmask[j];
            }
        }
        unsigned  int end = (unsigned int)pow(2,row);
        int result = 0;
        for(unsigned int i = 0;i < end;i++) {
            int subr = 0;
            for(int j = 0;j < col;j++) {
                int count[2] = {0};
                unsigned  int current = b[j] ^ i;
                for(int k = 0;k < row;k++) {
                    if(bitmask[k] & current) count[1]++;
                    else count[0]++;
                }
                subr += max(count[0],count[1]);
            }
            result = max(result,subr);
        }
        cout << result << endl;
    }
}


Measured memory_bytes: 3696
#include<stdio.h>
int main(void)
{
	int a[4],k,max=0,i;
	for(i=0; i<3; i++)
	{
		scanf("%d", &a[i]);
		if(max<a[i])
		{
			max=a[i];
			a[4]=i;
		}
	}
	scanf("%d", &k);
	for(i=0; i<k; i++)
	a[a[4]]*=2;
	for(i=0; i<3; i++)
	{
		if(i!=a[4])
		a[a[4]]+=a[i];
	}
	printf("%d\n", a[a[4]]);
	
	return 0;
}

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

int main(){
  int a,b; cin>>a>>b;
  int d = a/b;
  int r = a%b;
  double f = (double)a/b;
  printf("%d %d %.6f",d,r,f);
}


Measured memory_bytes: 3200