akhauriyash/Code-Regression huggingface dataset:
# include<iostream>
# include<cmath>
using namespace std;
const int MAX_V=300;
const long long INF=pow(10,18);
 long long  d[MAX_V][MAX_V];
 long long d1[MAX_V][MAX_V];
 int V;
 void warshall_floyd(){
 	for(int k=0;k<V;k++)
 	  for(int i=0;i<V;i++)
 	    for(int j=0;j<V;j++)
 	      d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
 }
int main ()
{
	 int M;
	 int L;
	 cin>>V>>M>>L;
	 for(int i=0;i<V;i++)
	 {
	 	for(int j=0;j<V;j++)
	 	{
	 		if(i==j)
	 		{
	 		   d[i][j]=0;
			   d1[i][j]=0;	 			
			 }
	 		else
	 	   {
	 	   	   d[i][j]=INF;
               d1[i][j]=INF;
			}
	 		
		 }
	 }
	 for(int i=0;i<M;i++)
	{
		 int x,y,z;
		 cin>>x>>y>>z;
	     d[x-1][y-1]=z;
	     d[y-1][x-1]=z;
	}
	

	for(int k=0;k<V;k++)
 	  for(int i=0;i<V;i++)
 	    for(int j=0;j<V;j++)
 	      d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
 	      
 	
	for(int i=0;i<V;i++)
	{
		for(int j=0;j<V;j++)
		{
			
		      if(i!=j&&d[i][j]<=L)
		      {
		      	  d1[i][j] =1;
			  }

 		}
	}        
 	
	for(int k=0;k<V;k++)
 	  for(int i=0;i<V;i++)
 	    for(int j=0;j<V;j++)
 	      d1[i][j] = min(d1[i][j],d1[i][k]+d1[k][j]);	      
	
	int Q;
	cin>>Q;
	for(int i=0;i<Q;i++)
	{
		 int s,t;
		 cin>>s>>t;
		 if(d1[s-1][t-1]!=INF)
		 cout<<d1[s-1][t-1]-1<<endl;
	     else
	     cout<<"-1"<<endl;
	}
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main () {
  int H, W, N;
  cin >> H >> W >> N;
  vector<vector<long>> ans(H, vector<long> (W));
  vector<long> data(N);
  long pl = 0;
  for(int k = 0; k < N; k++)cin >> data.at(k);
  for(int i = 0; i < H; i++){
    if(i % 2 == 0){
      for(int j = 0; j < W; j++){
        ans.at(i).at(j) = pl + 1;
        data.at(pl)--;
        if(data.at(pl) == 0)pl++;
      }
    } else {
      for(int j = W - 1; j >= 0; j--){
        ans.at(i).at(j) = pl + 1;
        data.at(pl)--;
        if(data.at(pl) == 0)pl++;
      }
    }
  }
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cout << ans.at(i).at(j) << ' ';
    }
    cout << endl;
  }
  return 0;
}

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

int F(long long A, long long B){
    long long L = max(A, B);
    int dig = 0;

    while(L > 0){
        dig++;
        L /= 10;
    }

    return dig;
}

int main(){
    long long N;
    cin >> N;

    int ans = 20;
    //cout << sqrt(N) << endl;

    int count = 0;
    for(int i = 1; i <= sqrt(N); i++){
        //count++;
        if(N % i != 0){}
        else {
            ans = min(ans, F(i, N/i));
            //cout << i << "今は" << F(i, N/i) << endl;
        }
    }

    //cout << "カウントは" << count << endl;
    cout << ans << endl;

    return 0;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

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;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll n;
  cin >> n;
  map<string, ll> c;
  string a[] = {"AC", "WA", "TLE", "RE"};
  rep(i, n){
    string s;
    cin >> s;
    c[s]++;
  }
  for(auto iss: a){
    cout << iss << " x "<<c[iss]<<endl;
  }
  return 0;
}


Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline
n,m,x=map(int,input().split())
c=[]
a=[]
for _ in range(n):
	s,*t=map(int,input().split())
	c.append(s)
	a.append(t)
ans=float("inf")
for i in range(2**n):
	l=[[0]*m]
	need=0
	for j in range(n):
		if i&(1<<j):
			l.append(a[j])
			need+=c[j]
	if all(sum(t)>=x for t in zip(*l)):
		ans=min(ans,need)
print(ans if ans!=float("inf") else -1)

Measured memory_bytes: 9280
s = raw_input().split()
tmp_l = 0
tmp_s = 0
for i in s:
	if len(i) > tmp_l:	
		tmp_l = len(i)
		ans2 = i
	if s.count(i) > tmp_s:
		tmp_s = s.count(i)
		ans1 = i
print "{} {}".format(ans1, ans2)

Measured memory_bytes: 4204
#include <bits/stdc++.h>
using namespace std;
#define fol(i,n) for(int i=0;i<n;i++)
#define pb push_back
typedef long long ll;
typedef pair<int,int> P;
typedef vector<P> vip;

void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans1=max(a,c);
    int ans2=min(b,d);
    cout << max(ans2-ans1,0)<<endl;
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <sstream>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

    map<char,string> m;
    m['1'] = ".,!? ";
    m['2'] = "abc";
    m['3'] = "def";
    m['4'] = "ghi";
    m['5'] = "jkl";
    m['6'] = "mno";
    m['7'] = "pqrs";
    m['8'] = "tuv";
    m['9'] = "wxyz";

    rep(i,n) {
        string s;
        cin >> s;
        
        stringstream ss;
        int cnt = -1,id = -1;
        rep(j,s.size()) {
            if(s[j] == '0') {
                if(id != -1) {
                    cnt %= m['0'+id].size();
                    ss << m['0'+id][cnt];

                    cnt = -1;
                    id = -1;
                }
            }
            else {
                cnt++;
                id = (int)(s[j]-'0');
            }
        }

        cout << ss.str() << endl;
        
    }
    
    return 0;
}

Measured memory_bytes: 1228
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <string>
#include <cmath>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define MAX 510000
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
#define uni(q) unique(all(q)),q.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll x,y; cin >> x >> y;
    ll ans;
    if(x<=0 && y>=0) ans = abs(y-abs(x))+1;
    else if(x>=0 && y>=0){
        if(y>=x) ans = y-x;
        else ans = x-y+2;
    }else if(x>=0 && y<=0){
        ans = abs(x-abs(y))+1;
    }else if(x<=0 && y<=0){
        if(y>=x) ans = y-x;
        else ans = x-y+2;
    }
    if(x==0 && y>0 || y==0) ans--;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

// 整数スキャン（複数）
/*
int x;
scanf("%d",&x);
int y;
scanf("%d",&y);
int z;
scanf("%d",&y);

// n個の整数のスキャン
/*
ll a[n] = {};
rep(i,n){
    scanf("%lld",&a[i]);
}
*/

// 文字列スキャン
/*
string s;
cin >> s;
*/


int main() {
    int n;
    scanf("%d",&n);
    if(n>8){
        puts(":(");
        return 0;
    }
    scanf("%d",&n);
    if(n>8){
        puts(":(");
    }else{
        puts("Yay!");
    }




    //int ans = 0;

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


Measured memory_bytes: 256
use std::vec::Vec;
use std::collections::HashSet;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn read_touple<T: std::str::FromStr + Copy>() -> (T, T) {
  let v: Vec<T> = read_vec();
  assert_eq!(v.len(), 2);
  (v[0], v[1])
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let mut set = HashSet::new();

    for &c in &s {
      set.insert(c);
    }

    let ans = if set.len() == 2 {
       "Yes"
    } else {
      "No"
    };

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;


void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

long long int func(vector<ll> &a,vector<ll> &f,ll mid){
	ll n = a.size();
	vector<ll> cost(n);
	ll res = 0;
	rep(i, n) cost[i] = a[i] * f[i];
	rep(i,n){
		if(cost[i] > mid){
			res += (cost[i] - mid + f[i] - 1) / f[i];
		}
	}
	return res;
}

int main() {
	long long int n, k;
	cin >> n >> k;
	vector<ll> a(n);
	vector<ll> f(n);
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> f[i];
	sort(all(a));
	sort(all(f));
	reverse(all(f));

	ll l = -1, r = 1e18;
	while(l+1<r){
		ll mid = (l + r) / 2;
		if (func(a,f,mid) > k)
			l = mid;
		else
			r = mid;

	}
	cout << r << endl;

	return 0;
}

Measured memory_bytes: 4992
import sys
a,b,c = map(int, input().split())

cnt = 0
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit()
for _ in range(int(1e5)):
    cnt += 1
    aa = (b+c)//2
    bb = (a+c)//2
    cc = (a+b)//2
    if aa%2==1 or bb%2==1 or cc%2==1:
        print(cnt)
        break
    a = aa
    b = bb
    c = cc
else:
    print(-1)

    


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <random>

using namespace std;




int main()
{
	int A,B;
	int ans;

	cin >> A >> B;

	if ( B % A == 0) ans = A + B;
	else ans = B - A;


	printf("%d", ans);

	return 0;
}



Measured memory_bytes: 256
#include"bits/stdc++.h"
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ld           long double
#define vi           vector<int>
#define pii          pair<int,int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;

const int N = 13;
int n, m, x;
int c[N], a[N][N];

int al[N], ans = INF;

void rec(int id, int cost)
{
    if( id>=n )
    {
        bool ls = false;
        rep(i,0,m-1)
        {
            if( al[i]<x )
                ls = true;
        }
        if( !ls )
            ans = min( ans, cost );
        return;
    }
    rep(i,0,m-1)
        al[i] += a[id][i];
    rec( id+1, cost + c[id] );
    rep(i,0,m-1)
        al[i] -= a[id][i];
    rec( id+1, cost );
}

short rain()
{
    // ifstream fin("ip.txt"); ofstream fout("op.txt");
    // int t;cin>>t;rep(test,1,t)
    {
        cin >> n >> m >> x;
        rep(i,0,n-1)
        {
            cin >> c[i];
            rep(j,0,m-1)
                cin >> a[i][j];
        }
        mem( al, 0 );
        rec( 0, 0 );
        if( ans==INF )
            ans = -1;
        cout << ans << endl;
    }

    return 0;
}

signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int start = 1000*clock()/CLOCKS_PER_SEC;
    cout << fixed << setprecision(15);           rain();
    cerr << 1000*clock()/CLOCKS_PER_SEC-start << "ms\n";
}

Measured memory_bytes: 3664
#include "bits/stdc++.h"
using namespace std;

struct edge {
	long long To;
	long long Cost;
};

typedef pair<long long, long long> P;
typedef pair<P, long long> PL;

int main() {
	long long N, M, L, INF = 1000000000000000;
	static vector<edge> V[300];
	cin >> N >> M >> L;
	for (int i = 0; i < M; i++) {
		long long A, B, C;
		cin >> A >> B >> C;
		if (L < C) continue;
		A--, B--;
		V[A].push_back({ B, C });
		V[B].push_back({ A, C });
	}
	static P Dist[300][300] = {};
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			Dist[i][j] = { INF, INF };
		}
	}
	for (int i = 0; i < N; i++) {
		priority_queue<PL, vector<PL>, greater<PL> > PQ;
		PQ.push({ {0, 0}, i });
		Dist[i][i] = { 0, 0 };
		while (!PQ.empty()) {
			PL p = PQ.top();
			PQ.pop();
			long long v = p.second;
			if (Dist[i][v] < p.first) continue;
			for (edge E : V[v]) {
				long long X = Dist[i][v].first, Y = Dist[i][v].second + E.Cost;
				if (Y > L) {
					X++;
					Y = E.Cost;
				}
				P NEXT = { X, Y };
				if (Dist[i][E.To] > NEXT) {
					Dist[i][E.To] = NEXT;
					PQ.push({ NEXT, E.To });
				}
			}
		}
	}
	long long Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		long long S, T;
		cin >> S >> T;
		S--, T--;
		P ANS = Dist[S][T];
		if (ANS == P{ INF, INF }) {
			cout << -1 << endl;
		}
		else cout << ANS.first << endl;
	}
}

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

using namespace std;

#define rep(i, j, k) for (int i = j; i < (int)k; i++)
#define pb push_back
#define mt make_tuple
#define all(x) x.begin(), x.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef complex<ld> point;
typedef vector<int> vi;

inline void fileIO(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}

template <class T, class S>
inline bool smin(T &a, S b) {
  return (T)b < a ? a = b, 1 : 0;
}
template <class T, class S>
inline bool smax(T &a, S b) {
  return a < (T)b ? a = b, 1 : 0;
}

constexpr int MOD = 924844033;
constexpr int N = 500 + 10;

template <typename T>
inline T mod(T &v) {
  return v = (v % MOD + MOD) % MOD;
}
template <typename S, typename T>
inline S add(S &l, T r) {
  return mod(l += r);
}

int n, p, s;

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

#ifndef LOCAL
  // fileIO("superposition");
#endif

  cin >> n;
  int ans = 0;
  rep(i, 1, n + 1) {
    cin >> p;
    if (p == i)
      s++;
    else {
      ans += (s + 1) / 2;
      s = 0;
    }
  }
  ans += (s + 1) / 2;

  cout << ans << endl;

  return 0;
}

// 1 2 0 1 2

Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#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>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL;
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};



int main(){
    string s;
    cin>>s;
    if(s[0]==s[1]&&s[1]==s[2]){
        cout<<s<<endl;
        return 0;
    }
    if(s[0]>s[1]){
        cout<<s[0]<<s[0]<<s[0]<<endl;
    }else if(s[0]<s[1])cout<<char(s[0]+1)<<char(s[0]+1)<<char(s[0]+1)<<endl;
    else if(s[1]>s[2])cout<<s[1]<<s[1]<<s[1]<<endl;
    else cout<<char(s[1]+1)<<char(s[1]+1)<<char(s[1]+1)<<endl;
    





    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

void solve()
{
	double a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f)
	{
		double x, y;
		if(a != 0)
		{
			y = a / (a * e - b * d) * (f - c * d / a);
			x = (c - b * y) / a;
		}
		else
		{
			y = d / (b * d - a * e) * (c - a * f / d);
			x = (f - e * y) / d;
		}
		printf("%.3f %.3f\n", x, y);
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
#define adrep(i,s,n) for (int i=(s);i<(n);i++)
using namespace std;
typedef long long ll;

int main(){

  int N=0;
  cin>>N;
  
  std::map<std::string, int> mp;
  
  rep(i,N){

  	string s;
    cin>>s;
    
	mp[s]++;
 
  }
  int mx=0;
  for(auto p: mp)mx=max(mx,p.second);
  for(auto p: mp){

    if (p.second!=mx)continue;
    cout<< p.first <<endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 25216
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

ll dp[200100][3];

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

  int x = n % 2 + 1;
  fill((ll*)dp, (ll*)dp + sizeof(dp) / sizeof(ll), -LINF);
  dp[0][0] = 0;

  for(int i = 0; i < n; ++i){
  	for(int j = 0; j <= x; ++j){
  		if(j < x)dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j]);
  		ll cur = dp[i][j];
  		if((i + j) % 2 == 0)cur += a[i];
  		dp[i + 1][j] = max(dp[i + 1][j], cur);
  	}
  }

  cout << dp[n][x] << endl;
  return 0;
}


Measured memory_bytes: 9552
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;

public class Main {

     static Scanner scanner;

     public static void main(String[] args) {
         scanner = new Scanner(System.in);

         int N=gi();
         int M=gi();
         List<Edge>[] G=new ArrayList[N+1];
         Map<Integer,Integer> map=new HashMap<Integer,Integer>();

         for (int i=0; i<N+1;i++) {
        	 G[i]=new ArrayList<Edge>();

         }
         for (int i=0; i<M;i++) {
        	 int a=gi();
        	 int b=gi();
        	 G[a].add(new Edge(a, b, 1l));
        	 G[b].add(new Edge(b, a, 1l));
         }

         int[] d=new int[N+1];
         for(int i=0; i<N+1;i++) {
        	 d[i]=Integer.MAX_VALUE;
         }
         Queue<Integer> q=new ArrayBlockingQueue<Integer>(N+1);
         q.add(1);
         d[1]=0;
         while(!q.isEmpty()) {
        	 int v=q.poll();
        	 List<Edge> l=G[v];
        	 for (int i=0; i<l.size();i++) {
        		 Edge e=l.get(i);
        		 int to=e.to;
        		 if(d[to]==Integer.MAX_VALUE) {
        		     q.add(to);
        		     map.put(to, e.from);
                     d[to]=d[e.from]+1;
        		 }
        	 }
         }

         StringBuilder ans=new StringBuilder();
         ans.append("Yes");
    	 ans.append(System.lineSeparator());
         for(int i=2;i<=N;i++) {
        	 ans.append(map.get(i));
        	 ans.append(System.lineSeparator());
         }
         System.out.println(ans);
     }

     public static class Edge implements Comparable {
    	    private int from;
    	    private int to;
    	    private long cost;

    	    public Edge(int f, int t, long c) {
    	    	this.from=f;
    	    	this.to=t;
    	    	this.cost=c;
    	    }

			@Override
			public int compareTo(Object o) {
                if(this.cost>((Edge)o).cost) {
                	return 1;
                } else if(this.cost<((Edge)o).cost) {
                	return -1;
                }
				return 0;
			}
    	}

     // 文字列として入力を取得
     public static String gs() {
          return scanner.next();
     }

     // intとして入力を取得
     public static int gi() {
          return Integer.parseInt(scanner.next());
     }

     // longとして入力を取得
     public static long gl() {
          return Long.parseLong(scanner.next());
     }

     // doubleとして入力を取得
     public static double gd() {
          return Double.parseDouble(scanner.next());
     }
}

Measured memory_bytes: 88744
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll ZERO = 0;
const int INF = 1e9;
const ll MOD = 1000000007;
const double PI = 3.1415926535897;

int H,W;
char maze[1010][1010];
bool visited[1010][1010];
int d[1010][1010];

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

void bfs() {
    queue<pair<int,int>> que;
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            if(maze[i][j] == '#') {
                que.push(make_pair(i,j));
            }
        }
    }
    while(!que.empty()) {
        pair<int,int> p = que.front();
        que.pop();
        for(int i = 0;i < 4;i++) {
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];
            if(0 <= ny && ny < H && 0 <= nx && nx < W && visited[ny][nx] == false) {
                visited[ny][nx] = true;
                d[ny][nx] = min(d[ny][nx],d[p.first][p.second] + 1);
                que.push(make_pair(ny,nx));
            }
        }
    }
}

int main() {
    cin >> H >> W;
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            cin >> maze[i][j];
        }
    }
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {
            if(maze[i][j] == '#') {
                visited[i][j] = true;
                d[i][j] = 0;
            }
            else {
                visited[i][j] = false;
                d[i][j] = INF;
            }
        }
    }
    bfs();
    int ret = 0;
    for(int i = 0;i < H;i++) {
        for(int j = 0;j < W;j++) {  
            ret = max(ret,d[i][j]);
        }
    }
    cout << ret << endl;
}

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

#define ll long long

void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

int upll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;
}

int downll(const void*a, const void*b){
  return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;
}

void sortup(ll*a,int n){
  qsort(a,n,sizeof(ll),upll);
}

void sortdown(ll*a,int n){
  qsort(a,n,sizeof(ll),downll);
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}


/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  long int n;
  scanf("%ld",&n);
  long int N=n;
  int ans=0;

  for(long int i=2;i*i<=N;i++){
    int cnt=0;
    while(n%i==0){
      cnt++;
      n/=i;
    }
    
    for(int j=1;j<100;j++){
      if(cnt<j*(j+1)/2){
        ans+=j-1;
        break;
      }
    }
  }

  if(n!=1){
    ans++;
  }

  printf("%d\n",ans);

  return 0;
}

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

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

ll lcm(ll a, ll b)
{
   return a * b / gcd(a, b);
}

int main() {

    ll a, b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>	// 入出力
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか
#include<limits.h>

using namespace std;


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

	unsigned long int max = 1;
	for (int i = 0; i < 9; ++i) {
		max *= 10;
	}
	max += 7;

	if (N == M + 1 || M == N + 1) {
		long int nPn = 1;
		long int mPm = 1;

		for (unsigned long int i = 1; i <= N; ++i) {
			nPn = (nPn * i) % max;
		}
		for (unsigned long int i = 1; i <= M; ++i) {
			mPm = (mPm * i) % max;
		}
		
		cout << (nPn*mPm) % (long int)max << endl;
		return 0;
	}

	if (N == M) {
		unsigned long int nPn = 1;

		for (unsigned long int i = 1; i <= N; ++i) {
			nPn = (nPn * i) % max;
		}

		cout << (nPn*nPn * 2) % max << endl;
		return 0;
	}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long n,x;
  cin>>n>>x;
  long long t=n-x,ans=0,tmp;
  while(x){
    ans+=t/x*x*3;
    tmp=x;
    x=t%x;
    t=tmp;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

lint gcd(lint a, lint b) { return b ? gcd(b, a%b) : a; }

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	lint A, ans = 0;
	for (int i = 0; i < N; i++) {
		cin >> A;
		ans = gcd(A, ans);
	}

	cout << ans << "\n";

	return 0;
}

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

int main() {
	int n, arr[100005];
	long long sum = 0;
	map<int, int> mps;
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		scanf("%d", &arr[i]);
		mps[arr[i]]++;
		sum += arr[i];
	}
	int q;
	scanf("%d", &q);
	while(q--){
		int b, c;
		scanf("%d %d", &b, &c);
		if(!mps[b]){
			printf("%lld\n", sum);
			continue;
		}
		int x = mps[b];
		sum -= (long long) x * b;
		sum += (long long) x * c;
		mps[c] += x;
		mps[b] = 0;
		printf("%lld\n", sum);
	}
	
	return 0; 
}


Measured memory_bytes: 8328
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Scanner;

class Col{
	int id;
	String name;
	int num;
	Col(String name,String num, int id){
		this.name = name;
		this.num = Integer.parseInt(num);
		this.id = id;
	}
}
class Com implements Comparator<Col> {
	@Override
	public int compare(Col c1, Col c2) {
		int swi = c1.name.compareTo(c2.name);
		if(swi<=-1) {
			return -1;
		}else if(swi>=1) {
			return 1;
		}else if(c1.num < c2.num) {
			return 1;
		}else {
			return -1;
		}
	}
}

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] first = splitInt(sc.nextLine(), " ");
		
		String[] a = new String[2];
		Col[] cArray = new Col[first[0]];
		for(int i=0; i<first[0]; i++) {
			a = sc.nextLine().split(" ");
			cArray[i] = new Col(a[0], a[1], i+1);
		}
		Arrays.sort(cArray,new Com());
		for(Col c:cArray) {
			 System.out.println(c.id);
		}
		
	}
	public static int[] splitInt(String str, String split) {
		String[] array = str.split(split);
		int[] array2 = new int[array.length];
	
		for(int i=0; i<array.length; i++) {
				array2[i] = Integer.parseInt(array[i]);
		}
		return array2;
	}
}

Measured memory_bytes: 19668
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a[10000], count = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		while (a[i] % 2 == 0) {
			count++;
			a[i] /= 2;
		}
	}

	cout << count << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;

const int MD = 998244353;
const int MN = 333333;
int a, b, n;
ll k;
int c[MN], inv[MN];

void first() {
    inv[1] = 1;
    for (int i = 2; i < MN; i++) {
        inv[i] = ll(inv[MD % i]) * (MD - MD / i) % MD;
    }
    c[0] = 1;
    for (int i = 0; i < n; i++) {
        c[i + 1] = ll(c[i]) * inv[i + 1] % MD * (n - i) % MD;
    }
}

int main() {
    cin >> n >> a >> b >> k;
    first();
    int ans = 0;
    for (int i = 0; i <= n; i++) {
        ll rm = k - ll(i) * a;
        if (rm < 0 || rm % b || rm / b > n) continue;
        ans += ll(c[i]) * c[rm / b] % MD;
        if (ans >= MD) ans -= MD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b;
  cin >> a >> b;
  for(int i=0; i<21; i++) {
    if((a-1)*i+1>=b) {
      pr(i);
      return;
    }
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define F first
#define S second
//cout<<fixed<<setprecision(11);
const string nl="\n";
const ll MOD=1000000007;
const ll ARR_MAX = 1e5+1;
const ll INF=1e10+1;

void solve(){
    int n,k;cin>>n>>k;
    ll dp[n+1]; //dp[i]=minimum cost required to reach rock i-1.
    ll h[n+1];
    // h[0]=0;
    for(int i=0;i<n;i++){
    	cin>>h[i];
    	dp[i+1]=INF;
    }
    dp[0]=0;
    for(int i=0;i<n;i++){
    	for(int j=1;j<=k && i+j<n;j++){
    		dp[i+j]=min(dp[i+j],dp[i]+max(h[i+j]-h[i],h[i]-h[i+j]));
    	}
    }
    cout<<dp[n-1]<<nl;
}

int main(){
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
N = int(input())
a = list(map(int, input().split()))
dic = {}
ans = 0
for i in range(N):
    if not a[i] in dic:
        dic[a[i]] = 0
    dic[a[i]] += 1

for k, v in dic.items():
    if k < v:
        ans += v-k
    if k > v:
        ans += v

print(ans)

Measured memory_bytes: 68264
#include <string>
#include <iostream>
#include <vector>

int main() {
    int cnt[4][3][10] = {};
    
    int n;
    std::cin >> n;

    for (int i = 0; i < n; ++i) {
        int b, f, r, v;
        std::cin >> b >> f >> r >> v;

        b--; f--; r--;

        cnt[b][f][r] += v;
    }

    for (int b = 0; b < 4; ++b) {
        for (int f = 0; f < 3; ++f) {
            for (int r = 0; r < 10; ++r) {
                std::cout << ' ' << cnt[b][f][r];
            }
            std::cout << std::endl;
        }
        if (b + 1 != 4) std::cout << std::string(20, '#') << std::endl;
    }
}



Measured memory_bytes: 3148
#include <iostream>

using namespace std;

const int NMAX = 300 + 5;

int N, M;
bool active[NMAX][NMAX];
int mat[NMAX][NMAX];

int freq[NMAX];

pair <int, int> getAns() {
    for (int i = 1; i <= N; ++ i)
        for (int j = 1; j <= M; ++ j)
            if (active[i][j]) {
                ++ freq[mat[i][j]];
                break;
            }

    pair <int, int> maximum = {-1, -1};
    for (int i = 1; i <= M; ++ i) {
        maximum = max(maximum, {freq[i], i});
        freq[i] = 0;
    }
    return maximum;
}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin >> N >> M;
    for (int i = 1; i <= N; ++ i) {
        for (int j = 1; j <= M; ++ j) {
            cin >> mat[i][j];
            active[i][j] = true;
        }
    }

    int ans = N;
    for (int i = 1; i <= M; ++ i) {
        auto it = getAns();
        ans = min(ans, it.first);

        for (int j = 1; j <= N; ++ j)
            for (int k = 1; k <= M; ++ k)
                if (mat[j][k] == it.second)
                    active[j][k] = false;
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 768
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input! {
        n: isize,
        k: isize,
    }
    println!("{}", cmp::min(n % k, k - n % k));
}


Measured memory_bytes: 4352
import sys

input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

total = 0

for i in range(n):
	if i == 0:
		total = a[i]
	else:
		total = total ^ a[i]
		
b = []
for i in range(n):
	b.append(str(a[i] ^ total))

print(' '.join(b))

Measured memory_bytes: 35740
N = int(input())


hash = {}
end = int(N ** (1/2))
for i in range(2, end + 1):
    while N % i == 0:
        hash[i] = hash.get(i, 0) + 1
        N = N // i
if N != 1:
        hash[i] = hash.get(i, 0) + 1


count = 1
res = 0
for i in hash.values():
    count = 1
    while i >= count:
        res += 1
        i -= count
        count += 1

print(res)

Measured memory_bytes: 63356
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
		/*#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif*/
fast();
//ll  t;cin>>t;while(t--)

{  ll n,f=0;
	cin>>n;
	
	map<string ,ll >m;
	string ss;
	cin>>ss;
	m[ss]=1;
	char c=ss[ss.length()-1];
	for(int i=1;i<n;i++)
	{
		string s;
		cin>>s;
		ll len=s.length();
		if(m[s] || (s[0]!=c))
		{
            f=1;
		}
		c=s[len-1];
		m[s]=1;
	}
	if(f)
		No
	else
		Yes

}
return 0;
}

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

int findSumOfDigits(int n){
  int sum = 0;
  while(n>0){
    sum += n %10;
    n /= 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n ;
    if(n%findSumOfDigits(n)==0)
    {cout << "Yes" << endl;}
    else cout <<"No"<< endl;
   }

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static int digit(int num) {
		if (num == 0) {
			return 1;
		} else {
			int cnt = 0;
			while (num > 0) {
				++cnt;
				num /= 10;
			}
			return cnt;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int a = sc.nextInt(), b = sc.nextInt();
			System.out.println(digit(a + b));
		}
		sc.close();
	}
}


Measured memory_bytes: 26600
dp = [[], []]
n_max = 0
$<.each_line.with_index do |l, i|
  xs = l.split(?,).map(&:to_i)
  n_max = [n_max, xs.size].max
  k = n_max - xs.size
  xs.each_with_index do |x, j|
    j += k
    dp[(i+1)%2][j] = x
    dp[(i+1)%2][j] = [dp[(i+1)%2][j], x + dp[i%2][j]].max if dp[i%2][j]
    dp[(i+1)%2][j] = [dp[(i+1)%2][j], x + dp[i%2][j-1]].max if j > 0
  end
end
p dp[1][n_max-1]

Measured memory_bytes: 8756
#include <bits/stdc++.h>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const int MOD = 1000000007;

long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}

bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main() {
  ll N,ans=1;
  string S;
  cin >> N >> S;
  
  for(int i=1;i<N;i++){
    if(S[i-1]!=S[i]) ans++;
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3732
n, m = map(int, input().split())
maxi = 10**5
mini = 0
for _ in range(m):
    s,t = map(int,input().split())
    maxi = min(maxi,t)
    mini = max(mini,s)
print(maxi - mini +1) if maxi - mini +1 > 0 else print(0)

Measured memory_bytes: 43608
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

#define CIN_ONLY if(1)
struct cww{cww(){
    CIN_ONLY{
        ios::sync_with_stdio(false);cin.tie(0);
    }
}}star;
#define fin "\n"
#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define DEBUG if(0)
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l,T r)
{bool a=l>r;if(a)l=r;return a;}
template <typename T>inline bool chmax(T &l,T r)
{bool a=l<r;if(a)l=r;return a;}
template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
    
int main(){
    LL N,K;
    cin>>N>>K;
    vector<LL> cnt(1123456);
    REP(i,N){
        int a,b;
        cin>>a>>b;
        cnt[a]+=b;
    }
    REP(i,1123456){
        K-=cnt[i];
        if(K<=0){
            cout<<i<<endl;
            return 0;
        }
        
    }
    
    return 0;
}


Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll maxn=2e5+1;
const ll INF=4e18;
void solve()
{
	ll A1,A2,A3;
	cin>>A1>>A2>>A3;
	if(A1+A2+A3>=22)
	{
		cout<<"bust\n";
	}
	else
	{
		cout<<"win\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: 256
## main

loop do
  n = gets.strip.to_i
  break if n == 0

  m = gets.strip.to_i

  nbrs = n.times.map{[]}

  m.times do
    a, b = gets.strip.split(' ').map{|s| s.to_i - 1}
    nbrs[a] << b
    nbrs[b] << a
  end
  #p nbrs

  frds = n.times.map{nil}

  for f0 in nbrs[0]
    frds[f0] = true
    for f1 in nbrs[f0]
      frds[f1] = true if f1 != 0
    end
  end

  puts frds.compact.length
end

Measured memory_bytes: 6140
#include<bits/stdc++.h>
#include <iostream> 
#include <string> 
#define lli long long int
#define deb1(x) cout<<#x<<" :: "<<x<<"\n";
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define deb2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define deb3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define deb(v) for(lli i=0;i<v.size();i++) {cout<<v[i]; (i==v.size()-1) ? cout<<"\n":cout<<" "; }
#define all(a) a.begin(),a.end()
#define ll long long
using namespace std;
#define f first
#define sd second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define sz(x) (ll)x.size()
#define vl vector<lli>
#define pii pair<lli,lli>
lli mod=1e9+7;
using namespace std;
lli t,n,u,x,y,m;
const lli N = 100001;
int main(){
    fast
     t=1;
   // cin>>t;
    while(t--){
        lli a,b,c,d;
        cin>>a>>b>>c>>d;
        x=max(a,b);
        y=max(c,d);
        lli ans=x*y;
        x=min(a,b);
        ans=max(ans,x*y);
         x=max(a,b);
         y=min(c,d);
         ans=max(ans,x*y);
          x=min(a,b);
          y=min(c,d);
          ans=max(ans,x*y);
        cout<<ans<<endl;    
    }
}

Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <bitset>
#include <iomanip>
#include <deque>
#include <tuple>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    cin >> s;

    s[3] = '8';
    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream> 
#include <string> 
#include <vector> 
#include <cmath> 
#include <algorithm> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
#include <functional> 
#include <set> 
#include <sstream> 
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <list>
#include <cassert>
 
using namespace std; 


int main(){

	int a,b,c;
	cin>>a>>b>>c;

	int cnt[1100]={};
	cnt[a]++;
	cnt[b]++;
	cnt[c]++;
	if(cnt[5]==2 && cnt[7]==1){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}

}

Measured memory_bytes: 764
n = int(input())
a = list(map(int, input().split()))
ret = 0
for i in range(1, n - 1):
    if a[i - 1] < a[i] < a[i + 1] or a[i + 1] < a[i] < a[i - 1]:
        ret += 1
print(ret)

Measured memory_bytes: 3060