akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using graph = vector<vector<int>>;

vector<int> articulation_point(const graph& G) {
	int n = G.size(), idx = 0;
	vector<int> low(n), ord(n), art;
	function<void(int)> dfs = [&](int v) {
		low[v] = ord[v] = ++idx;
		bool ok = false;
		for (auto w : G[v]) {
			if (ord[w]) {
				low[v] = min(low[v], ord[w]);
				continue;
			}
			dfs(w);
			low[v] = min(low[v], low[w]);
			if (ok) continue;
			if ((ord[v] == 1 && ord[w] != 2) || (ord[v] != 1 && low[w] >= ord[v])) {
				art.push_back(v);
				ok = true;
			}
		}
	};
	for (int u = 0; u < n; ++u) {
		if (ord[u] == 0) idx = 0, dfs(u);
	}
	return art;
}

int main()
{
	ios::sync_with_stdio(false), cin.tie(0);
	int n, m;
	cin >> n >> m;
	graph G(n);
	for (int i = 0; i < m; i++) {
		int s, t;
		cin >> s >> t;
		G[s].push_back(t);
		G[t].push_back(s);
	}
	auto ap = articulation_point(G);
	sort(ap.begin(), ap.end());
	for (auto v : ap) {
		printf("%d\n", v);
	}
	return 0;
}



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

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int N=scan.nextInt();
		int a=N/100;
		int b=(N%100)/10;
		int c=N-(a*100+b*10);
		String ans="No";
		if(a==7||b==7||c==7){
			ans="Yes";
		}
		System.out.println(ans);

	}

}

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

int main(){
  ll N,M;
  cin  >> N >>M;
  vector<pair<ll,ll>> T;
  for(ll i=0;i<N;i++){
    ll a;
    cin >> a;
    T.push_back(make_pair(a,1));
  }
  for(ll i=0;i<M;i++){
    ll b,c;
    cin >> b >> c;
    T.push_back(make_pair(c,b));
  }
  sort(T.begin(),T.end());
  reverse(T.begin(),T.end());
  ll ans=0;
  ll count=0;
  for(ll i=0;i<N;i++){
    if(count+T[i].second>N){
      ans+=T[i].first*(N-count);
      break;
    }
    else{
      ans+=T[i].first*T[i].second;
      count+=T[i].second;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7436
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;
typedef vector<pii> vpii;
#define reps(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define all(g) (g).begin(),(g).end()
#define pb push_back
const int mod = 1e9 + 7;
#define INF 1<<25
/*
input case
output case
*/

int N;
vl prime_cubes;
vi primes;

const ll MAX = pow(1e10, 1.0 / 3) + 10;
const int MAX2 = 1e5 + 10;

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

void build_primes(){
    reps(i,2,MAX){
        if (is_prime(i)) { prime_cubes.pb(1ll*i*i*i);}
    }
    reps(i,2,MAX2){
        if (is_prime(i)) { primes.pb(i);}
    }
}

ll norm(ll x){
    for (ll q:prime_cubes){
        if (q > x){ break;}
        while(x % q == 0){
            x /= q;
        }
    }
    return x;
}

const ll inf = 1e12;

ll mul(ll a, ll b) {
    return a * b;
    // if (inf / b < a)
    //     return inf;
    // else
    //     return a * b;
}

ll contr(ll x){
    ll y = 1;
    for(int p: primes){
        if (1ll * p * p >x){ break;}
        // 最高で2回まで素数で割る
        // if (x % p == 0 and (x / p) % p == 0){
        if (x % p == 0){
            if ((x / p) % p == 0){
                y = mul(y, p);
                x /= p;
                x /= p;
            }else{
                y = mul(y, mul(p, p));
                x /= p;
            }
        }
        // if (x % (p * p) == 0){
        //     y = mul(y, p);
        //     x /= (p * p);
        // }else if (x % p == 0){
        //     y = mul(y, mul(p,p));
        //     y *= (p * p);
        //     x /= (p);
        // }
    }
    if (x != 1){
        y = mul(y, mul(x, x));
    }
    return y;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    build_primes();
    map<ll, int> cnt;
    rep(i,N){
        ll x;
        cin >> x;
        x = norm(x);
        cnt[x]++;
    }
    int ans = 0;
    set<ll> used;
    for (auto pr: cnt){
        ll x = pr.first;
        int c = pr.second;
        ll y = contr(x);
        if (used.count(x)){
            continue;
        }
        if (x == y){
            ans += 1;
        }else{
            if (cnt.count(y)){
                ans += max(c,cnt[y]);
                used.insert(y);
                used.insert(x);
            }else{
                used.insert(x);
                ans += c;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int N;

int main()
{
    cin >> N;
    vector<int> p(4), t(4);
    for (int i = 0; i < 4; i++)
    {
        cin >> p[i];
    }
    for (int i = 0; i < 4; i++)
    {
        cin >> t[i];
    }

    int ans = inf;

    for (int i = 0; i <= N; i++)
    {
        for (int j = 0; j <= N; j++)
        {
            for (int k = 0; k <= N; k++)
            {
                for (int l = 0; l <= N; l++)
                {
                    int cnt = t[0] * i + t[1] * j + t[2] * k + t[3] * l;
                    if (cnt >= N)
                    {
                        ans = min(ans, p[0] * i + p[1] * j + p[2] * k + p[3] * l);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll l, r, m = 2019;
	cin >> l >> r;
	ll cnt = r - l + 1;
	if(cnt > 2*2019)
		cout << "0";
	else
	{
		ll i, j, mn = 100000000000;
		fr(i,l,r)
			fr(j,i+1, r+1)
			{
				if((((i%m)*(j%m))%m) < mn)
					mn = ((i%m)*(j%m))%m;
			}
		cout << mn;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#include <numeric>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	vector<int>p(n);
	REP(i, n) {
		cin >> p[i];
	}
	int prob[3] = { 0 };
	REP(i, n) {
		if (p[i] <= a) {
			prob[0]++;
		}
		else if (p[i] <= b) {
			prob[1]++;
		}
		else {
			prob[2]++;
		}
	}
	int m = 100000000;
	REP(i, 3) {
		m = min(m, prob[i]);
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
n=int(input())
s=list(map(str,input()))
if n%2==0:
    num=int(n/2)
    Sx=s[0:num]
    Sy=s[num:n]
    if Sx==Sy:
      print("Yes")
    else:
      print("No")
else:
  print("No")

Measured memory_bytes: 9080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#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()


int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    ll m = 0;
    REP(i, n){
        ll ai;
        cin >> ai;
        if(ai > m + 1){
            const ll k = (ai - (m + 2)) / (m + 1);
            assert(ai - k * (m + 1) >= m + 2);
            ans += k + 1;
            ai = 1;
        }
        m = max(m, ai);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;
    int saveTime = 1 + min({
                           (A - 1) % 10,
                           (B - 1) % 10,
                           (C - 1) % 10,
                           (D - 1) % 10,
                           (E - 1) % 10,
                       });
    int ans = 0;
    ans += ceil(A / 10.0);
    ans += ceil(B / 10.0);
    ans += ceil(C / 10.0);
    ans += ceil(D / 10.0);
    ans += ceil(E / 10.0);
    ans *= 10;
    cout << ans - (10 - saveTime) << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define long long long
#define size 5005
const long MOD = 1e9+7;
pair<int,int>pos[size];
signed main()
{
    long test;
    test=1;
    // cin>>test;
    while(test--){
    long i,j,b,n,x,k,ans,most,index,c,maxi=0,temp,aw,bw,w,count,sum;
    cin>>n;
    k=n/15;
    cout<<n*800-k*200;
    
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int w = 0;
		if(a > b) {
			w = b;
			b = a;
			a = w;
			if(b > c) {
				w = c;
				c = b;
				b = w;
			}
			if(a > b) {
				w = b;
				b = a;
				a = w;
			}
		} else if(b > c){
			w = c;
			c = b;
			b = w;
			if(a > b) {
				w = b;
				b = a;
				a = w;
			}
		}
		System.out.println(a + " " + b + " " + c);
	}
}

Measured memory_bytes: 26156
#require "pry-byebug"
def is_kaibun(str)
  result = true
  ary = str.split("")

  if 2 <= str.length
    loop do
      first = ary.shift
      last = ary.pop
      if first != last
        result = false
        break
      end
      if ary.length < 3
        break
      end
    end
  end
  result
end

S=gets.chomp
result = is_kaibun(S)
if result != true
  puts "No"
  exit
end

N = S.length
end_pos = (N - 1) / 2
s_sub = S.slice(0, end_pos)
#puts "S:#{S}, N:#{N}, end_pos:#{end_pos}, s_sub:#{s_sub}"
result = is_kaibun(s_sub)
if result != true
  #puts "2"
  puts "No"
  exit
end

start_pos = (N - 1 + 3) / 2
#puts "S:#{S}, N:#{N}, start_pos:#{start_pos}, s_sub:#{s_sub}"
s_sub = S.slice(start_pos..N)
result = is_kaibun(s_sub)
if result != true
  #puts "3"
  puts "No"
  exit
end

puts "Yes"


Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define to edge[i].v
#define mp make_pair
#define rint register int
#define debug(x) cerr<<#x<<"="<<x<<endl
#define fgx cerr<<"-------------"<<endl
#define N 1000000
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
int b[N],cnt[N],c0[N],c1[N],c2[N],pre[N],nxt[N];
inline int qpow(int x,int y){int A=1;for(;y;y>>=1,x=(ll)x*x%mod)if(y&1)A=(ll)A*x%mod;return A;}
struct node{int l,r,sum;}a[N];
void build(int l,int r,int o)
{	a[o].l=l; a[o].r=r; a[o].sum=0;
	if(l==r) return;
	int mid=(l+r)>>1;
	build(l,mid,o+o); build(mid+1,r,o+o+1);
}
void add(int pos,int k,int o)
{	if(a[o].l==pos&&pos==a[o].r){(a[o].sum+=k)%=mod;return;}
	int mid=(a[o].l+a[o].r)>>1;
	if(pos<=mid) add(pos,k,o+o);
	else add(pos,k,o+o+1);
	a[o].sum=(a[o+o].sum+a[o+o+1].sum)%mod;
}
int query(int l,int r,int o)
{	if(l>r) return 0;
	if(l==a[o].l&&a[o].r==r) return a[o].sum;
	int mid=(a[o].l+a[o].r)>>1;
	if(r<=mid) return query(l,r,o+o);
	else if(l>mid) return query(l,r,o+o+1);
	else return (query(l,mid,o+o)+query(mid+1,r,o+o+1))%mod;
}
int main()
{	int n,ans=0; cin>>n; c0[0]=c1[0]=pre[1]=1; nxt[n]=n;
	for(rint i=1;i<=n;i++) scanf("%d",&b[i]),cnt[b[i]]++;
	for(rint i=n-1;i>=1;i--) cnt[i]+=cnt[i+1]-1;
	for(rint i=1;i<=n;i++) c0[i]=(ll)c0[i-1]*cnt[i]%mod,c1[i]=(ll)c1[i-1]*max(cnt[i]-1,1)%mod;
	for(rint i=1;i<=n;i++) c1[i]=(ll)c1[i]*qpow(c0[i],mod-2)%mod,c2[i]=qpow(c1[i],mod-2);
	for(rint i=2;i<=n;i++) pre[i]=(cnt[i]==1?i:pre[i-1]);
	for(rint i=n-1;i>=1;i--) nxt[i]=(cnt[i+1]==1?i:nxt[i+1]);
	build(1,n,1); for(rint i=1;i<=n;i++)
	(ans+=(ll)query(pre[b[i]],b[i],1)*c1[b[i]]%mod)%=mod,add(b[i],c2[b[i]],1);
	build(1,n,1); for(rint i=1;i<=n;i++)
	(ans+=mod-(ll)query(b[i]+1,nxt[b[i]],1)*c2[b[i]]%mod)%=mod,add(b[i],c1[b[i]],1);
	ans=(ll)ans*qpow(2,mod-2)%mod;
	build(1,n,1); for(rint i=1;i<=n;i++) (ans+=query(b[i]+1,n,1))%=mod,add(b[i],1,1);
	printf("%d",(ll)ans*c0[n]%mod);
	return 0;
}


Measured memory_bytes: 26880
#include<iostream>
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;

int main() {
    int N, M, X, ans = 1e9;
    cin >> N >> M >> X;
    int C[N], A[N][M];
    rep(i, N) {
        cin >> C[i];
        rep(j, M) cin >> A[i][j];
    }

    rep(i, (1 << N)) {
        int cur[M] = {};
        int sum = 0;
        rep(j, N) {
            if (i & (1 << j)) {
                sum += C[j];
                rep(k, M) {
                    cur[k] += A[j][k];
                }
            }
        }
        bool ok = true;
        rep(j, M) {
            if (cur[j] < X) ok = false;
        }
        if (ok && sum < ans) ans = sum;
    }
    cout << (ans < 1e9 ? ans : -1) << endl;
}

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

int N, T;

int main(){
  cin >> N >> T;
  int cost = 1e9, time = 1e9;
  for(int i = 0; i < N; i++){
    int c, t; cin >> c >> t;
    if(t <= T) {
      time = t;
      cost = min(cost, c);
    }
  }
  if(time > T) cout << "TLE" << endl;
  else cout << cost << endl;
}

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

#define MAXN 5000005
#define ll long long int

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    for(auto &x:a)cin>>x;
    for(int i=k;i<n;i++){
        if(a[i]>a[i-k]){
            cout<<"Yes\n";
        }
        else{
            cout<<"No\n";
        }
    }
    return 0;
}


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

#ifdef LOCAL
    #define D(a) cerr << #a << " = " << a << endl
#else 
    #define D(a) 8 
#endif
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define all(a) (a).begin(),(a).end()
#define dforn(i,n) dforsn(i,0,n)
#define forn(i,n) forsn(i,0,n)
#define si(a) int((a).size())
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first
#define endl '\n'
using pii = pair<int,int>;
using vi = vector<int>;
using ll = long long;

int main() {
	fastio;
	
    int n; cin >> n;
    map<string, int> m;
    vi c(26, 50);
    forn(_, n) {
        string s; cin >> s;
        vi a(26);
        for (char x : s)
            a[int(x-'a')]++; 
        forn(i, 26) 
            c[i] = min(c[i], a[i]);
    }
    string ans;
    forn(i, 26) forn(j, c[i]) ans += char('a'+i);
    cout << ans << endl;
	return 0;
}


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

typedef pair<int,int> PAIR;
typedef long long ll;

int main(){
	int N;
	ll K;
	cin>>N>>K;
	vector<PAIR> VEC;
	int a,b;
	for(int i=0;i<N;i++){
		cin>>a>>b;
		VEC.push_back(make_pair(a,b));
	}
	sort(VEC.begin(),VEC.end());
	int S=VEC.size();
	long long sum=0;
	for(int i=0;i<S;i++){
		sum+=(VEC[i].second);
	//	cout<<(VEC[i].first)<<" "<<(VEC[i].second)<<endl;
		if(sum>=K){
			cout<<VEC[i].first;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 1400
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	std::vector<int> b(n);
	std::vector<int> c(n);
	rep(i,n) std::cin >> a[i];
	rep(i,n) std::cin >> b[i];
	rep(i,n) std::cin >> c[i];
	std::sort(all(a));
	std::sort(all(b));
	std::sort(all(c));

	std::vector<int> d(n,0);
	std::vector<int> p(n,0);

	rep(i,n) {
		// end - ub
		d[i] = c.end() - std::upper_bound(all(c), b[i]);
	}
	for(int i=n-2;i>=0;i--) {
		d[i] += d[i+1];
	}

	int count = 0;
	rep(i,n) {
		count += d[std::upper_bound(all(b),a[i])-b.begin()];
	}

	print(count);

	return 0;
}


Measured memory_bytes: 4224
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef pair<int, int> pii;

int main() {
	string str;
	cin >> str;
	
	vector<int> start[26];
	vector<pii> end[26];
	
	REP(i, 26) {
		int cnt = str[0] == 'a' + i;
		if (cnt) start[i].push_back(0);
		
		FOR(j, 1, str.size()) {
			if (cnt) {
				if (str[j] != 'a' + i) {
					end[i].push_back(pii(j - 1, cnt));
					cnt = 0;
				}
				else
					cnt++;
			}
			else {
				if (str[j] == 'a' + i) {
					start[i].push_back(j);
					cnt = 1;
				}
			}
		}
		if (cnt) end[i].push_back(pii(str.size() - 1, cnt));
	}

	REP(i, 26) {
		REP(j, start[i].size()) {
			if (j + 1 < start[i].size() && end[i][j].second == 1 && end[i][j + 1].second == 1 &&
				start[i][j + 1] - start[i][j] + 1 == 3)
			{
				cout << start[i][j] + 1 << " " << start[i][j + 1] + 1 << endl;
				return 0;
			}
			
			if (end[i][j].second >= 2) {
				cout << start[i][j] + 1 << " " << end[i][j].first + 1 << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1" << endl;
	return 0;
}

Measured memory_bytes: 2296
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
 	
int main() {

	int N,T;
	cin>>N>>T;
	int res=1001;
	fx(N){
		int ans,time;
		cin>>ans>>time;
		if(time<=T&&ans<res){
			res=ans;
		}
	}
	if(res>1000){
ce("TLE")
}else{
	ce(res)
}
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;
#define sqr(x) ((x)*(x))
int main()
{
  int n;
  cin>>n;
  vector<int> vec(n);
  for(auto&& e: vec) 
  {
    cin>>e;
  }
  vector<int> ans(100);
  for (int i = 1; i <= 100; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      ans[i-1]+=sqr(vec[j]-i);
    }
  }
  cout<<*min_element(ans.begin(), ans.end());
}

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

class Graph { 
	int V; 
	list<int>* adj; 
	void DFSUtil(int v, bool visited[]); 

public: 
	Graph(int V); 
	void addEdge(int v, int w); 
	int NumberOfconnectedComponents(); 
}; 

int Graph::NumberOfconnectedComponents() 
{ 
	bool* visited = new bool[V]; 
	int count = 0; 
	for (int v = 0; v < V; v++) 
		visited[v] = false; 

	for (int v = 0; v < V; v++) { 
		if (visited[v] == false) { 
			DFSUtil(v, visited); 
			count += 1; 
		} 
	} 
	return count; 
} 

void Graph::DFSUtil(int v, bool visited[]) 
{ 
	visited[v] = true; 
	list<int>::iterator i; 
	for (i = adj[v].begin(); i != adj[v].end(); ++i) 
		if (!visited[*i]) 
			DFSUtil(*i, visited); 
} 

Graph::Graph(int V) 
{ 
	this->V = V; 
	adj = new list<int>[V]; 
} 

void Graph::addEdge(int v, int w) 
{ 
	adj[v].push_back(w); 
	adj[w].push_back(v); 
} 

int main() 
{ 
	int n, m, x, y;
	cin >> n >> m;
	Graph g(n); 
	for (int i=0; i<m; i++)
	{
		cin >> x >> y;
		g.addEdge(x-1, y-1);
	} 
	cout << g.NumberOfconnectedComponents()-1 << endl; 

	return 0; 
} 


Measured memory_bytes: 13472
mod=10**9+7
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
from itertools import combinations
import bisect
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a,b=mi()
l=list(mi())
l=sorted(l)
c=0
for i in range(b):
  c+=l[i]
print(c)

Measured memory_bytes: 68152
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>

#pragma GCC optimize("O3")

using namespace std;
using ll = long long;
using ull = unsigned long long;

#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define repd(i, n) for(ll i = (n) - 1; i >= 0; --i)
#define FOR(i, a, b) for(ll i = a; i <= ll(b); ++i)
#define FORD(i, a, b) for(ll i = a; i >= ll(b); --i)
#define loop while(true)
#define asort(array, size) std::sort(array, array + size)
#define cauto const auto&
#define bit(n) (1LL << (n))

int main()
{
    int N;
    cin >> N;
    auto L = new int[N];
    rep(i, N) {
        cin >> L[i];
    }
    int count = 0;
    rep(i, N) {
        FOR(j, i + 1, N) {
            FOR(k, j + 1, N) {
                if (L[i] == L[j] || L[i] == L[k] || L[j] == L[k]) continue;
                if (L[i] + L[j] > L[k] && L[j] + L[k] > L[i] && L[k] + L[i] > L[j]) ++count;
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        sc.close();

        int count = 0;
        for(int x=0; x<=k; x++) {
            for(int y=0; y<=k; y++) {
                if(s-(x+y) >= 0 && s-(x+y) <= k) {
                    if(x+y+(s-(x+y)) == s) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


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

int main(){
  int N;
  cin>>N;
  vector<int> a(N);
  int64_t ans=0;
  for(int i=0;i<N;++i){
    cin>>a.at(i);
    ans=ans+a.at(i)-1;
  }

  cout<<ans<<endl;
}

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

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

  sort(ALL(a));

  float ans=0;
  for(int i=0;i<n;i++){
    if(i == 0){
      ans += a[i]/powf(2,n-1);
    }
    else{
      ans += a[i]/powf(2,n - i);
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 384
#include<iostream>
using namespace std;
int N;
int A[100];
int B[99];

int main()
{
	int i;
    cin >> N;
	for (i=0; i<N; i++) {
		cin >> B[i];
	}
	A[0] = B[0];
	for (i=0; i<N-1; i++) {
		// A[i],A[i+1]は両方ともB[i]以下
		if (A[i]>B[i]) A[i] = B[i];
		A[i+1] = B[i];
	}
	int sum = 0;
	for (i=0; i<N; i++) {
		sum+=A[i];
//printf("A[%d]=%d ", i, A[i]);
	}
//printf("\n");
    // 出力
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<iostream>
#include<map>
using namespace std;
map<int,string> name;
map<int,string>::iterator it;
int d[1000000];
int main()
{
   int n,m,i,a; string b; 
   cin>>n>>m;
   int s=0,ss=0;
   memset(d,0,sizeof(d));
   for(i=0;i<m;i++)
   {   cin>>a>>b;
      if(!name.count(a))
      name[a]=b;
      if(b=="AC")
      name[a]=b;
      if(name[a]!="AC")
      d[a]++;
   }
   s=0;
   for(i=1;i<=n;i++)
   {
   	if(name[i]=="AC")
   	{
	   ss++;
   	   s+=d[i];
   	}
   }
   printf("%d %d\n",ss,s);
}

Measured memory_bytes: 15232
from heapq import heappushpop, heapify

N, M = map(int, input().split(' '))
A = list(map(int, input().split(' ')))

heap = [-a for a in A]
heapify(heap)

for _ in range(M):
    heappushpop(heap, (-1 * heap[0] // 2) * -1)

print(-1 * sum(heap))


Measured memory_bytes: 20392
import java.util.*;
public class Main {
	public static void myout(Object text){//standard output
		System.out.println(text);
	}
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String tmp = sc.next();
		//int tmp = sc.nextInt();
		//Long tmp = sc.nextLong();
      int N = sc.nextInt();
      Long output = new Long(0);
      Long[] list = new Long[90];
      list[0] = new Long(2);
      list[1] = new Long(1);
      if(N == 1){
        myout(list[1]);
        return;
      }
      for(int i = 2; i <= N; i++){
        list[i] = list[i - 1] + list[i - 2];
      }
      myout(list[N]);
	}
}


Measured memory_bytes: 22100
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<set>
#include<functional>
#include<list>
#include<bitset>
#include <numeric>
using namespace std;
typedef long long ll;

int main() {
	int n, k,x;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x;
	}
	cout << ceil(((double)(n - 1)) / ((double)(k - 1)));
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
  public static void main(String args[]) {
    String S;
    Scanner sc = new Scanner(System.in);
    S=sc.next();
   if(S.equals("hi")){
       System.out.println("Yes");
   }else if(S.equals("hihi")){
     System.out.println("Yes");
   }else if(S.equals("hihihi")){
     System.out.println("Yes");
   }else if(S.equals("hihihihi")){
     System.out.println("Yes");
   }else if(S.equals("hihihihihi")){
     System.out.println("Yes");
   }else{     System.out.println("No");
}

  }

}

Measured memory_bytes: 23636
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    s = input()
    t = input()

    ret = "No"
    if s == t[:-1]:
        ret = "Yes"

    return ret


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 9124
#include <bits/stdc++.h>
#define ll                      long long int
#define vll                     vector<ll>
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define ld                       double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll>>
#define vll                     vector<ll>
#define pll                     pair<ll,ll>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define test                    ll T;cin>>T;while(T--)
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int main()
{
fastIO
string s;
cin>>s;
if(s[0]=='S')
    cout<<"Cloudy";
else if(s[0]=='C')
    cout<<"Rainy";
else
    cout<<"Sunny";



return 0;
}

Measured memory_bytes: 256
r=[]
for _ in range(5):
  r.append(int(input()))

k=int(input())

i=0
while i<4:
  j=i+1
  while j<5:
    if abs(r[i]-r[j])>k:
      print(":(")
      exit()
    
    j+=1
  i+=1
  
print("Yay!")


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

const int N = 1e5+5;
int n, a[N], cnt, ans;

int main()
{
    //freopen("a.inp","r",stdin);

    cin >> n;
    for(int i=1; i<=n; ++i) cin >> a[i];
    for(int i=2; i<=n; ++i) {
        if (a[i-1] >= a[i]) cnt += 1; else cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans;
}


Measured memory_bytes: 640
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<iostream>
using namespace std;

char a[105], b[105];
bool cmp(int x, int y)
{
	return x > y;
}
int main()
{
	scanf("%s", a);
	scanf("%s", b);
	int len1 =  strlen(a);
	int len2 =  strlen(b);
	sort(a, a + len1);
	sort(b, b + len2, cmp);
	if(strcmp(a,b) < 0) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
ll mod = 1e9 + 7;

int main() {
  ll N, K;
  cin >> N >> K;
  vector<ll> as;
  vector<ll> sorted;
  ll a;
  for(int i = 0; i < N; ++i) {
    cin >> a;
    as.push_back(a);
    sorted.push_back(a);
  }
  ll count = 0;
  for(int i = 0; i < as.size() - 1; ++i) {
    for(int j = i + 1; j < as.size(); ++j) {
      if(as[i] > as[j])
        count++;
    }
  }
  count *= K;
  count %= mod;

  sort(sorted.begin(), sorted.end());
  auto factor = K * (K - 1) / 2;
  factor %= mod;
  for(auto a : as) {
    auto lb = lower_bound(sorted.begin(), sorted.end(), a) - sorted.begin();
    count += (lb * factor) % mod;
    count %= mod;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int A, B, X;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &X);
	if (A + B >= X && A <= X)
		printf("YES\n");
	else
		printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>

void yosinaga_sayuri(int n) {
	int a;
	if (scanf("%d", &a) != 1) exit(1);
	if (n > 1) {
		yosinaga_sayuri(n - 1);
		putchar(' ');
	}
	printf("%d", a);
}

int main(void) {
	int n;
	if (scanf("%d", &n) != 1) return 1;
	yosinaga_sayuri(n);
	putchar('\n');
	return 0;
}



Measured memory_bytes: 2064
#include <iostream>
using namespace std;
int main(void){
    
    //変数：各得点を「 score 」と合計得点「 totalScore 」を置く
    int score , totalScore = 0;
    
    //繰返し：問題数が10問あるから10回繰返し
    for(int i = 0; i < 10; i++){
        //入力：各得点を「 score 」を入力
        cin >> score;
        
        //計算：各問題の得点を合計得点に足していく
        totalScore += score;
    }
    
    //出力:合計得点「 totalScore 」を出力する
    cout << totalScore << endl;
    
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define bit(k) (1LL<<(k))
const int INF = 1e9;

int main(void){
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n);
    int res = INF;
    rep(i,n){
        a[i].resize(m);
        cin >> c[i];
        rep(j,m) cin >> a[i][j];
    }
    rep(mask, 1<<n) {
        int cost = 0;
        vector<int> b(m);
        rep(i,n){
            if (bit(i) & mask) {
                cost += c[i];
                rep(j,m){
                    b[j] += a[i][j];
                }
            }
        }
        bool ok = true;
        rep(j,m) {
            if (b[j] < x) ok = false;
        }
        if (ok) {
            res = min(res, cost);
        }
    }
    cout << ((res == INF) ? -1 : res) << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_mdvector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_mdvector(int n, Ts ... ts){
        return vector<decltype(make_mdvector(ts...))>(n, make_mdvector(ts...));
    }

    template<class T>
    istream& operator>>(istream& is, vector<T>& v){
        for (auto &&x : v) { is >> x; } return is;
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    ll N;
    void run();
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_A.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}

void solver::run(){
    ll A, B, C;
    is >> A >> B >> C;
    if(!is) return;
    ll ans = 0;
    ll nA = A % 2 ? B*C : 0;
    ll nB = B % 2 ? A*C : 0;
    ll nC = C % 2 ? A*B : 0;
    ans = min({nA, nB, nC});
    os << ans << endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  int H,W;
  cin>>H>>W;
  int A[H][W]={};
  int B[H][W]={};
  rep(i,H) rep(j,W) cin>>A[i][j];
  rep(i,H) rep(j,W) cin>>B[i][j];
  rep(i,H) rep(j,W) A[i][j]=abs(A[i][j]-B[i][j]);
  int X[2][80][12801]={};
  rep(i,H){
    rep(j,W) rep(k,12801) X[i%2][j][k]=0;
    rep(j,W){
      if(i==0&&j==0){
        X[i%2][j][A[i][j]]=1;
      }else if(i==0&&j>0){
        rep(k,12801){
          if(X[i%2][j-1][k]){
            X[i%2][j][k+A[i][j]]=1;
            X[i%2][j][abs(k-A[i][j])]=1;
          }
        }
      }else if(i>0&&j==0){
        rep(k,12801){
          if(X[(i+1)%2][j][k]){
            X[i%2][j][k+A[i][j]]=1;
            X[i%2][j][abs(k-A[i][j])]=1;
          }
        }
      }else{
        rep(k,12801){
          if(X[(i+1)%2][j][k]){
            X[i%2][j][k+A[i][j]]=1;
            X[i%2][j][abs(k-A[i][j])]=1;
          }
        }
        rep(k,12801){
          if(X[i%2][j-1][k]){
            X[i%2][j][k+A[i][j]]=1;
            X[i%2][j][abs(k-A[i][j])]=1;
          }
        }
      }
    }
  }
  rep(i,12801){
    if(X[(H+1)%2][W-1][i]){
      cout<<i<<endl;
      break;
    }
  }
}




Measured memory_bytes: 8320
use proconio::{input, fastout};
use proconio::marker::Usize1;

#[derive(Debug, Clone)]
pub struct UnionFind {
    parent: Vec<usize>,
    rank: Vec<usize>,
    size: Vec<usize>,
}

impl UnionFind {
    pub fn new(n: usize) -> Self {
        let parent = (0..n).collect::<Vec<usize>>();
        Self {
            parent,
            rank: vec![0; n],
            size: vec![1; n],
        }
    }

    pub fn find(&mut self, x: usize) -> usize {
        if x == self.parent[x] {
            x
        } else {
            self.parent[x] = self.find(self.parent[x]);
            self.parent[x]
        }
    }

    pub fn unite(&mut self, a: usize, b: usize) {
        let ra = self.find(a);
        let rb = self.find(b);
        if self.rank[ra] > self.rank[rb] {
            self.parent[rb] = ra;
            self.size[ra] += self.size[rb];
        } else if self.rank[ra] < self.rank[rb] {
            self.parent[ra] = rb;
            self.size[rb] += self.size[ra];
        } else if ra != rb {
            self.parent[rb] = ra;
            self.size[ra] += self.size[rb];
            self.rank[ra] += 1;
        }
    }

    pub fn size (&mut self, x: usize) -> usize {
        let rx = self.find(x);
        self.size[rx]
    }

    pub fn is_equal(&mut self, a: usize, b: usize) -> bool {
        self.find(a) == self.find(b)
    }

}


#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        ab: [(Usize1, Usize1); m],
    }

    let mut uf = UnionFind::new(n);

    let mut ans = vec![];
    let mut num = n * (n - 1) / 2;
    ans.push(num);

    for (a, b) in ab.into_iter().rev() {
        if !uf.is_equal(a, b) {
            let size_a = uf.size(a);
            let size_b = uf.size(b);
            uf.unite(a, b);

            num -= size_a * size_b;
        }
        ans.push(num);
    }

    for i in ans.into_iter().rev().skip(1) {
        println!("{}", i);
    }
}


Measured memory_bytes: 7960
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

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

template<typename T> map<T,int> prime_factor(T n){
    map<T,int> res;
    for (T i=2;i*i<=n;++i){
        while (n%i==0){
            ++res[i]; n/=i;
        }
    }
    if (n!=1) res[n]=1;
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin >> N;
    map<ll,int> m=prime_factor(N);
    int ans=0;
    for (auto x:m){
        int p=x.second;
        ll lb=0,ub=INF;
        while(ub-lb>1){
            ll mid=(ub+lb)>>1;
            (mid*(mid+1)/2<=p?lb:ub)=mid;
        }
        ans+=lb;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s;
    cin >>s;
    int n =s.length();
    int ans =1000;
    
    for(int i=0;i<=n-3;i++){
        int a = s[i]-'0';
        int b = s[i+1]-'0';
        int c = s[i+2]-'0';
        int x = a*100+b*10+c;
        ans = min(ans,abs(x-753));
    }
    cout <<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
A, B, C = list(map(int, input().split()))
m = max(A, B, C)
T = m * 3 if (A + B + C + m) % 2 == 0 else(m + 1) * 3  # 目標値
print(str((T-A-B-C)//2))


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

int main() {
  long in; cin >> in;
  int ins[in];
  vector<long> ans, ansrev;
  ans.reserve(in/1.5);
  ansrev.reserve(in/1.5);
  for(long i=0; i<in; i++){
    int a; cin >> a;
    ins[i]=a;
  }
  for(long i=0; i<in; i++){
    if(i%2==0){ //偶数 ansrev
      ansrev.push_back(ins[i]);
    }else{ // 奇数 ans
      ans.push_back(ins[i]);
    }
  }
  if(in%2==0){
    for(auto iter=ans.rbegin(); iter!=ans.rend(); iter++){printf("%d ", *iter);}
    for(auto iter=ansrev.begin(); iter!=ansrev.end(); iter++){printf("%d ", *iter);}
    printf("\n");
  }else{
    for(auto iter=ansrev.rbegin(); iter!=ansrev.rend(); iter++){printf("%d ", *iter);}
    for(auto iter=ans.begin(); iter!=ans.end(); iter++){printf("%d ", *iter);}
    printf("\n");
  }
}


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

using namespace std;

typedef long double ld;
typedef long long ll;

const int mod = 1e9 + 7;

int add(int x, int y) {
  x += y;
  if (x >= mod)
    x -= mod;
  return x;
}

int mul(ll x, ll y) {
  return x * y % mod;
}

void udd(int &x, int y) {
  x = add(x, y);
}

int n;
vector<pair<int, int>> q;

void read() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    q.emplace_back(x, 1);
  }

  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    q.emplace_back(x, -1);
  }
}

void kill() {
  sort(q.begin(), q.end());
  int ans = 1;
  int cur = 0;
  for (auto e : q) {
    int t = e.second;
    if (cur * t < 0) {
      ans = mul(ans, abs(cur));
    }
    cur += t;
  }

  cout << ans << endl;
}

int main() {
#ifdef LOCAL
  assert(freopen("a.in", "r", stdin));
#endif

  ios_base::sync_with_stdio(false);

  read();
  kill();
}



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

int N, num_bb = 0;
vector<int> A(200010);


int main(){
    cin >> N;
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
        if(A[i] != i+1-num_bb) ++num_bb;
    }

    if(num_bb == N) 
        cout << -1 << endl;
    else
        cout << num_bb << endl;
    
    return 0;

}



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

#define F first
#define S second
#define pii pair<int, int>
#define mod 1000000007

int N, A[2099], Z, W, ans = 0;

int main() {
   // freopen("input.in","r",stdin);
 	//freopen("output.out","w",stdout);
    cin >> N >> Z >> W;
    for(int i = 0;i < N;i++) {
        cin >> A[i];
    }
    ans = abs(A[N-1]-W);
    for(int i = 0;i < N-1;i++) {
            int maxm = abs(A[N-1]-A[N-2]);
            int minm = min(abs(A[N-1]-A[i]), maxm);
            for(int j = N-3;j > i;j--) {
                if(abs(A[j]-A[N-1]) > maxm) {
                    minm = min(minm, abs(A[j]-A[N-1]));
                    maxm = max(maxm, abs(A[j]-A[N-1]));
                }
                break;
            }
            ans = max(ans, minm);
        }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair < int,int > PII;
typedef pair < ll,ll > PLL;
#define pb push_back
//#all(x) (x).begin(),(x).end()

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 440;


int n;
ll ara[N];
ll dp[N][N] ;
ll cum[N] ;

ll F(int i,int j)
{
    if(i > j )
        return 1e17;
    if(i == j ) return 0;
    //if(j - i == 1) return ara[i] ;

    ll &r = dp[i][j] ;
    if(r != -1) return r;

    r = 1e18;
    for(int x = i; x <= j; x++)
    {
        r = min(r, F(i,x) + F(x+1,j) + cum[j] - cum[i-1]) ;
    }
    return r;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n ;
    memset(dp,-1,sizeof dp);

    for(int i = 1; i <= n; i++)
        cin >> ara[i], cum[i] = cum[i-1] + ara[i];
    cout << F(1,n) << endl;
    return 0;
}




Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, x, mx ,mn;
  int a[100] = {};
  double Sum,Sum2,Sum3;
  int Sum4;
  while(1){
    cin >> n;
    if(n == 0) break;
    for(int i=0;i<n;i++)cin >> a[i];
    mx = a[0];
    mn = a[0];
    for(int i=0;i<n;i++){
      mx = max(mx,a[i]);
      mn = min(mn,a[i]);}
    Sum = 0;
    for(int i=0;i<n;i++) Sum += a[i];
    Sum2 = Sum - mx - mn;
    Sum3 = Sum2 / (n-2);
    Sum4 = Sum3;
    cout <<  Sum4 << endl;
    for(int i =0; i<n;i++)a[i] = 0;
    

  }

  return 0;
}


Measured memory_bytes: 3072
#include <iostream>
using namespace std;
int main()
{
    int num,score1=0,score2=0;
    string str1,str2;
    cin>>num;
    for(int i=0;i<num;i++)
    {
        cin>>str1>>str2;
        if(str1==str2)
        {score1++;score2++;}
        else if(str1>str2)
            score1+=3;
        else
            score2+=3;
    }
    cout<<score1<<" "<<score2<<endl;
    return 0;
}


Measured memory_bytes: 3208
from sys import stdin
from itertools import groupby
n,p = [int(x) for x in stdin.readline().rstrip().split()]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
li = prime_factorize(p)
lin = []
for key, value in groupby(li):
    lin.append((key,len(list(value))))
point = 1
for i in lin:
    if i[1] >= n:
        point *= i[0]**(i[1]//n)
print(point)

Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

#print(a,b,c)

result=0
temp=30
for item in a:
  result+=b[item-1]
  if item==temp+1:
    result+=c[temp-1]
  
  temp=item
  
print(result)

Measured memory_bytes: 3064