akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) (y) < 0 || h <= (y) || (x) < 0 || w <= (x)
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

struct p {
    ll a, b;
    p(ll x, ll y) :a(x), b(y) {};
    bool operator<(p x) {
        if (a == x.a)return b > x.b;
        return a < x.a;
    }
};

int main() {
    init();

    int n, t; cin >> n >> t;
    vector<p> ab;
    FOR(i, 0, n) {
        ll a, b; cin >> a >> b;
        ab.emplace_back(a, b);
    }

    vector<vector<VL>> dp(n + 1, vector<VL>(t, VL(2)));
    FOR(i, 0, n)FOR(j, 0, t)FOR(k, 0, 2) {
        chmax(dp[i + 1][j][k], dp[i][j][k]);
        if (j + ab[i].a < t)chmax(dp[i + 1][j + ab[i].a][k], dp[i][j][k] + ab[i].b);
        if (k == 0)chmax(dp[i + 1][j][0], dp[i][j][1] + ab[i].b);
    }

    ll ans = max(dp[n][t - 1][0], dp[n][t - 1][1]);
    cout << ans << "\n";
}


Measured memory_bytes: 492928
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();
		if (a < b && b < c)
			System.out.println("Yes");
		else
			System.out.println("No");
		scanner.close();
	}
}

Measured memory_bytes: 17160
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 16 18:40:19 2019

@author: Yamazaki Kenichi
"""

N,A,B,K = map(int,input().split())
mod = 998244353
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inv = [0, 1] # 逆元テーブル計算用テーブル
for i in range(2, N+1):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)
def a(r,b):
    return cmb(N,r,mod)*cmb(N,b,mod)
ans = 0
R = K//A
for i in range(R+1):
    if (K-A*i)%B == 0:
        ans += a(i,(K-A*i)//B) % mod
print(ans%mod)

Measured memory_bytes: 38868
#include<stdio.h>
unsigned prime[15] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47}, over[5], divisor[5] = {3,5,15,25,75};

int main(){
    unsigned N;
    scanf("%u", &N);
    unsigned power, _N;
    for (size_t i = 0; i < 15; i++){
        power = 1, _N = N;
        while(_N /= prime[i]) power += _N;
        for (size_t j = 0; j < 5; j++){
            if(power >= divisor[j]) over[j]++;
        }
    }
    printf("%u\n", over[4] + over[3]*(over[0] - 1) + over[2]*(over[1] - 1) + (over[1]*(over[1] - 1)>>1)*(over[0] - 2));
	return 0;
}

Measured memory_bytes: 1732
import math
n, y = [int(i) for i in input().split()]

for i in range(min(n, math.ceil(y/10000))+1):
    # print(i)
    for j in range(min(n-i,math.ceil((y-10000*i)/1000))+1):
        # print("{} {}".format(i, j))
        if int((y - 10000*i - 5000*j)/1000) == n-i-j and n-i-j >= 0:
            print("{} {} {}".format(i, j, n-i-j))
            exit()
print("-1 -1 -1")


Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

int main() {

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

	Int n;
	cin >> n;

	deque<Int> ans;
	Int temp;
	if (n % 2) {
		for (Int i = 0; i < n; i++) {
			cin >> temp;
			if (i % 2) {
				ans.push_back(temp);
			}
			else {
				ans.push_front(temp);
			}
		}
	}
	else {
		for (Int i = 0; i < n; i++) {
			cin >> temp;
			if (i % 2) {
				ans.push_front(temp);
			}
			else {
				ans.push_back(temp);
			}
		}

	}

	for (Int i = 0; i < n; i++) {
		printf("%lld ", ans[i]);
	}

}

Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(int (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main()
{	
	string s;
	cin >> s;
	bool b = true;

	for(int i = 0; i < s.size(); i++){
		if(i % 2 == 0){
			if(s[i] == 'L') b = false;
		}
		else{
			if(s[i] == 'R') b = false;
		}
	}

	if(b){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    vector<ll> Fo, Se;
    ll N;
    cin>>N;
    ll A;
    rep(i, N){
        cin>>A;
        Fo.push_back(i+1+A);
        Se.push_back(i+1-A);
    }
    Fo.push_back(1000000); Se.push_back(10000000);
    ll count=0; ll fcount=0; ll scount=0; ll thisval=Fo[0];
    ll f=0, s=0;
    sort(all(Fo));
    sort(all(Se));
    while(true){
        while(Fo[f]>Se[s] && s<N) s++;
        while(Fo[f]<Se[s] && f<N) f++;
        if(f>=N || s>=N) break;
        if(Fo[f]==Se[s]){
            fcount=0; scount=0; thisval=Fo[f];
            while(Fo[f]==thisval && f<N) f++, fcount++;
            while(Se[s]==thisval && s<N) s++, scount++;
            count+=fcount*scount;
        }
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 6576
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int x, a, b; cin >> x >> a >> b;
    x -= a;

    cout << x % b << endl;

    return 0;
}


Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [a, b, x] = nextIntArray()
    let ans
    if (x / a <= a * b / 2) {
        console.log(Math.atan(a * b * b / 2 / x) * 180 / Math.PI);
    } else {
        console.log(90 - (Math.atan(a * a * a / 2 / (a * a * b - x)) * 180 / Math.PI));

    }
}
Main()


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/06/29  Problem: ABC 132 C / Link: http://abc132.contest.atcoder.jp/tasks/abc132_c  ----- */


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

	LL N; cin >> N;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	SORT(a);
	int mid = N / 2;

	LL ans = a[mid]-a[mid-1];
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000
int L[MAX/2+2],R[MAX/2+2];
int cnt;
void merge(int A[],int n,int l,int mid,int r) {
    int n1 = mid - l;
    int n2 = r - mid;
    for(int i = 0;i < n1;++i) L[i] = A[l + i];
    for(int i = 0;i < n2;++i) R[i] = A[mid + i];
    L[n1] = R[n2] = SENTINEL;
    int i = 0,j = 0;
    for(int k = l;k < r;++k) {
        cnt++;
        if(L[i] <= R[j]) A[k] = L[i++];
        else A[k] = R[j++];
    }
}
void mergesort(int A[],int n,int l,int r) {
    if(l + 1 < r) {
        int mid = (l+r)/2;
        mergesort(A,n,l,mid);
        mergesort(A,n,mid,r);
        merge(A,n,l,mid,r);
    }
    return;
}
int main() {
    int A[MAX],n,i;
    cnt = 0;
    scanf("%d",&n);
    for(int i = 0;i < n;++i) scanf("%d",&A[i]);
    mergesort(A,n,0,n);
    for(int i = 0;i < n;++i) {
        if(i) printf(" ");
        printf("%d",A[i]);
    } 
    printf("\n");
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 7016
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
double x[4],y[4];
while(cin>>x[0]>>y[0]){
  rep(i,3)cin>>x[i+1]>>y[i+1];
  double s123,s12p,s13p,a;
  s123=(x[1]-x[0])*(y[2]-y[0])-(y[1]-y[0])*(x[2]-x[0]);
  s12p=(x[1]-x[0])*(y[3]-y[0])-(y[1]-y[0])*(x[3]-x[0]);
  s13p=(x[3]-x[0])*(y[2]-y[0])-(y[3]-y[0])*(x[2]-x[0]);
  
  a=(s12p+s13p)/s123;
  
  if(s123*s12p>0&&s123*s13p>0&a>0&&a<1)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 1220
import java.util.*;


 class Main
 { 
	public static void main(String args[])
 	{ 

		Scanner sc =new Scanner(System.in);
		long l = sc.nextInt();
		long r = sc.nextInt();
		
		long res = Integer.MAX_VALUE;
		
		loop: for(long i = l; i <= r; i++){
			for(long j = i+1; j <= r; j++){
				res = Math.min(res, i*j%2019);
				
				if(res == 0) break loop;
			}
		}
		
		System.out.println(res);

 	}
 }

Measured memory_bytes: 21844
#include<fstream>
#include<string>
#include<iostream>
#include<sstream>
#include<iterator>
#include<cmath>
#include<stdio.h>
 
using namespace std;
 
int main(){
 int N;
 cin >> N;
string S;
string T;
 cin >> S >> T;
  int i;
  char c;
  char d;
  for(i=0;i<N;i++){
   c = S[i];
   d = T[i];
   cout << c << d;} 
  return 0;
}


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

const int MAX_N=55556;

int prime[MAX_N];
bool is_prime[MAX_N + 1];

void sieve() {
  int p=0;
  for (int i=0;i<=MAX_N;i++) {
    is_prime[i]=true;
  }
  is_prime[0]=is_prime[1]=false;
  for (int i=2;i<=MAX_N;i++) {
    if (is_prime[i]) {
      prime[p++] = i;
      for (int j=2*i;j<=MAX_N;j+=i) {
        is_prime[j]=false;
      }
    }
  }
  return ;
}

int main() {
  int n; cin>>n;
  sieve();
  int cnt=0;
  rep(i, MAX_N+1) {
    if (is_prime[i]&&i%5==1) {
      printf("%d", i);
      cnt++;
      if (cnt==n) {
        printf("\n");
        break;
      }
      else printf(" ");
    }
  }
  return 0;
}

Measured memory_bytes: 384
from itertools import combinations
original_vals = []
original_labels = []

while True:
    n, x = list(map(int, input().split()))
    if n+x == 0:
        break
    l = [ i for i in range(1,n+1)]
    original_vals.append(l)
    original_labels.append(x)

for i,row in enumerate(original_vals):
    cs = list(combinations(row, 3))
    count = 0
    for c in cs:
        if sum(c) == original_labels[i]:
            count += 1
    print(count)

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

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

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep_op(i, a, n) for (int i = a; i < n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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

const int MOD = 1000000007;

const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

int main()
{
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    rep(i, m) cin >> a[i];
    int left_p = 0;
    int right_p = 0;

    rep(i, m)
    {
        if (a[i] < x)
        {
            left_p++;
        }
        else if (a[i] > x)
        {
            right_p++;
        }
    }
    cout << min(left_p, right_p) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{


	public static int gcd(int a, int b){

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

	public static int gcd_roop(int a, int b){

		while(true){
			if(b==0)return a;
			int t;
			t=a;
			a=b;
			b=t%b;
		}

	}



	public static void main(String[] args){

		int a, b;

		Scanner scan=new Scanner(System.in);
		a=scan.nextInt();
		b=scan.nextInt();

		System.out.println(gcd_roop(a, b));
		scan.close();

	}

}

Measured memory_bytes: 26052
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pii pair<int,int>
/**==Info==
*Program:4
*Problem:Small Mutilply
*Date:2017-11-18
*Algorithm:Teacher's Dijkstra
*Stats:WA*/

bool debug=false;

template<typename T> struct pq_small{
	priority_queue<T,vector<T>,greater<T> > pq;
	void push(T x){
		pq.push(x);
	}

	void pop(){
		pq.pop();
	}

	int size(){
		return pq.size();
	}

	bool empty(){
		return pq.empty();
	}

	T top(){
		return pq.top();
	}
};

int dis[100005];
int main(int argc,char* argv[]){
	int k;
	cin>>k;
	for(int i=0;i<k;i++) dis[i]=1e9;
	pq_small<pii> pq;
	pq.push(make_pair(1,1));
	dis[1]=1;
	while(!pq.empty()){
		pii last=pq.top();
		pq.pop();
		if(dis[last.second]!=last.first) continue;
		for(int i=0;i<10;i++){
			int nxt=(10*last.second+i)%k;
			if(dis[nxt]>dis[last.second]+i){
				dis[nxt]=dis[last.second]+i;
				pq.push(make_pair(dis[nxt],nxt));
			}
		}
	}
	cout<<dis[0];
	return 0;
}



Measured memory_bytes: 2804
#include <bits/stdc++.h>
#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2) % mod;
}
/*--------Library Zone!--------*/

int n;
char c[505][505];
signed main() {
	cin >> n;
	rep(i, n)rep(j, n)cin >> c[i][j];
	int ans = 0;
	rep(i, n)rep(j, n)if (c[i][j] == '#')goto yes;
	cout << -1 << endl; return 0;
yes:;
	rep(i, n) {
		rep(j, n) {
			if (c[j][i] == '.') {
				ans++;
				break;
			}
		}
	}
	int mi = inf;
	rep(i, n) {
		int cnt = 0;
		rep(j, n) {
			if (c[j][i] == '#')goto ok;
		}
		cnt++;
	ok:;
		rep(j, n) {
			if (c[i][j] == '.')cnt++;
		}
		mi = min(cnt, mi);
	}
	if (mi == inf)cout << -1 << endl;
	else cout << mi + ans << endl;
}

Measured memory_bytes: 512
n=list(map(int,input()))
i=n[0]
  
if n[0]>=n[1]:
  if n[0]==n[1]<n[2]:
    n[0],n[1],n[2]=i+1,i+1,i+1
  elif n[0]==n[1]==n[2]:
    n[0]=i
  else:
    n[1],n[2]=i,i
else:
  n[0],n[1],n[2]=i+1,i+1,i+1

for i in n:
  print(i,end='')

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

const int mod =  1e9+7;


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

    vector<string> grid(n);

    for(auto &i:grid)   cin>>i;

    int dp[n+1][m+1] = {};

    dp[1][1] = 1;

    for(int i = 1 ; i<=n ; i++)
    {
        for(int j=1 ; j<=m ; j++)
        {
            if(i == 1 and j == 1)
                continue;
            if(grid[i-1][j-1] == '.')
                dp[i][j] = dp[i-1][j] + dp[i][j-1],
                dp[i][j] %= mod;
            else    
                dp[i][j] = 0;
        }
    }

    cout<<dp[n][m];

}

Measured memory_bytes: 9472
import math
for _ in range(int(input())):
    xa, ya, ra, xb, yb, rb = map(float, input().split())
    d = math.sqrt((xb - xa) ** 2 + (yb - ya) ** 2)
    if ra + rb < d:
        print(0)
    elif d + ra < rb:
        print(-2)
    elif d + rb < ra:
        print(2)
    else:
        print(1)


Measured memory_bytes: 5668
#include<algorithm>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include  <stdio.h>
#include   <math.h>
#include   <time.h>
#include   <vector>
#include   <bitset>
#include    <queue>
#include      <set>
#include      <map>
using namespace std;

const int N=100005;

int n,a[N],f[N][32];

int main()
{
	memset(f,1,sizeof f);
	cin>>n;
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	f[0][0]=0;
	for(int i=0;i<n;i++)
	{
		int Num0=0,Num1=0,sz=a[i+1];
		while(sz>1)
		{
			if(sz%2==0)
				Num0++,sz/=2;
			else if(sz%2==1)
				Num0++,Num1++,sz=sz/2+1;
		}
		if(Num1)
			Num1=1,Num0--;
		for(int j=0;j<=30;j++)
		{
			if(Num0>=j)
				f[i+1][Num0+Num1]=min(f[i+1][Num0+Num1],f[i][j]+max(Num0+Num1-j,0));
			else if(Num1+Num0>=j)
				f[i+1][Num0+Num0-j+Num1]=min(f[i+1][Num0+Num0-j+Num1],f[i][j]+max(Num0+Num1-j,0));
			else
				f[i+1][Num0]=min(f[i+1][Num0],f[i][j]+max(Num0+Num1-j,0));
		}
	}
	int Ans=1e9;
	for(int j=0;j<=30;j++)
		Ans=min(Ans,f[n][j]);
	cout<<Ans<<endl;
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int n;
    double tax = 1.08;
    cin >> n;
    int before1 = n / tax;
    int before2 = ceil(n / tax);
    bool ans = true;
    if (int(before1 * tax) == n)cout << before1 << endl;
    else if (int(before2 * tax) == n)cout << before2 << endl;
    else cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
    int x = 0, y = 0, z = 0;
    cin >> x >> y >> z;
    int count = 1;
    int buf = y + 2*z;
    while ((buf += y+z) <= x) {
        count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect
N=int(input())
a = []
for n in range(N):
    a.append(int(input()))

r = [-1]*N

mind = float("inf")
for n in range(N):
    ind = bisect.bisect_left(r, a[n])
    r[ind-1] = a[n]
    mind = min(mind, ind)

# print(r)
print(N-mind+1)

Measured memory_bytes: 52952
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
 
int N;
int X[101];

int main(){
	cin >> N;
  int sum = 0;
  rep(i,N){cin>>X[i]; sum+=X[i];}
  int center1 = sum/N;
  int center2 = sum/N+1;
  long long int sum1=0, sum2=0;
  rep(i,N){
    sum1+=pow((X[i]-center1),2);
  }
  rep(i,N){
    sum2+=pow((X[i]-center2),2);
  }
  if(sum1<sum2){
    cout << sum1;
  }else{
    cout << sum2;
  }
}


Measured memory_bytes: 256
k,x = map(int ,input().split())
arr =[]

for i in range(x,x-k,-1):
  arr.append(i)
  
for i in range(x,x+k,1):
  arr.append(i)

arr=list(set(arr))
arr.sort()
for  i in arr:
	print(i,end = ' ')

Measured memory_bytes: 38256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Logger;

public class Main {
	public static void main(String[] args) {
		printAnswer();
	}

	private static void printAnswer() {
		Logger logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);

		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int numberOfDataset = Integer.parseInt(br.readLine());
			String dataset = br.readLine();
			for(int i = 0; i < numberOfDataset; i++){
			dataset = dataset.replaceAll("Hoshino","Hoshina");
			System.out.println(dataset);
			dataset = br.readLine();
			}
		} catch (IOException e) {
			logger.info("Error:  Reading input data is failed.");
		}
	}
}

Measured memory_bytes: 24700
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
using namespace std;

int main()
{
    int n,w;
    cin>>n>>w;
    vector<ll> wt(n);
    vector<ll> val(n);
    for(int i=0;i<n;i++)
    {
        cin>>wt[i]>>val[i];
    }
    ll dp[n+1][w+1];
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=w;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j]=0;
            }
            else if(wt[i-1]<=j)
            {
                dp[i][j]=max(val[i-1]+dp[i-1][j-wt[i-1]],dp[i-1][j]);
            }
            else
            {
                dp[i][j]=dp[i-1][j];
            }
        }
    }
    cout<<dp[n][w]<<endl;
    return 0;
}


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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
const long long mod = 1e9 + 7;

int cnt[31];
signed main()
{
   cin.tie(0);
   ios::sync_with_stdio(false);

   int n, m, a, b, ans = 0;
   cin >> n >> m;

   rep(i, n)
   {
      cin >> a;
      rep(i, a)
      {
         cin >> b;
         ++cnt[b];
      }
   }

   reps(i, 30)
   {
      if (cnt[i] == n)
      {
         ++ans;
      }
   }
   cout << ans << '\n';
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 1000005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 998244353;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    set<ll>st;
        vector<ll>d{-1,0,1};
        queue<ll>q;
        f1(9) {
            q.push(i);
        }
        while (!q.empty()) {
            ll now = q.front();
            st.insert(now);
            q.pop();
            ll md = now % 10;
            if (st.size() > 200000) {
                break;
            }
            for (auto i:d) {
                if (md + i >= 0 && md + i <= 9) {
                    q.push(now * 10 + md + i);
                }
            }
        }
    int t;
    while (cin >> t) {
        for (auto &i : st) {
            t--;
            if (t == 0) {
                cout << i << endl;
                break;
            }
        }
        
    }

    
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF (1LL<<60)

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N, K; cin >> N >> K;
	vector<ll> x(N, 0LL);
	rep (i, N){
		cin >> x[i];
	} // end rep

	ll res = INF;
	rep (left, N - K + 1){
		int right = left + K - 1;
		if (x[right] <= 0){
			res = min(res, abs(x[left]));
		}else
		if (x[left] >= 0){
			res = min(res, x[right]);
		}else{
			res = min(res, abs(x[left]) * 2LL + x[right]);
			res = min(res, abs(x[left]) + 2LL * x[right]);
		} // end fi
	} // end rep
	
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!(k: usize);
    println!("{}", k / 2 * ((k + 1) / 2));
}

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

int main(){
	char c;
	cin >> c;
	bool flag = false;
	
	if(c == 'a'){
		flag = true;
	}
	else if(c == 'i'){
		flag = true;
	}
	else if(c == 'u'){
		flag = true;
	}
	else if(c == 'e'){
		flag = true;
	}
	else if(c == 'o'){
		flag = true;
	}
	else{
		flag = false;
	}
	
	if(flag == true){
		cout << "vowel" <<endl;
	}
	else{
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
def main():
    s = input()
    s_l = len(s)
    cnt = 0
    for i in range(s_l//2):
        if s[i] != s[::-1][i]:
        # if s[i] != s[s_l-i-1]:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 8916
def dfs(v, visited):
    for u in edges[v]:
        if u in visited:
            continue
        visited.add(u)
        if matched[u] == -1 or dfs(matched[u], visited):
            matched[u] = v
            return True
    return False

e = int(input())
edges = [set() for _ in range(e)]
matched = [-1] * e

red = []
blue = []
for _ in range(e):
    x, y = map(int, input().split())
    red.append((x, y))
for _ in range(e):
    x, y = map(int, input().split())
    blue.append((x, y))

for i in range(e):
    for j in range(e):
        if red[i][0] < blue[j][0] and red[i][1] < blue[j][1]:
            edges[j].add(i)

print(sum(dfs(s, set()) for s in range(e)))


Measured memory_bytes: 3188
from collections import deque

class StronglyConnectedComponents():
    def __init__(self, n):
        self.n = n
        self.graph = [[] for _ in range(n)]
        self.rev = [[] for _ in range(n)]

    def add_edge(self, fr, to):
        self.graph[fr].append(to)
        self.rev[to].append(fr)

    def scc_id(self):
        group = [0] * self.n
        order = []
        for s in range(self.n):
            if group[s]: continue
            stack = deque([s])
            group[s] = -1
            while stack:
                node = stack.pop()
                for adj in self.graph[node]:
                    if group[adj]: continue
                    group[adj] = -1
                    stack.append(node)
                    stack.append(adj)
                    break
                else:
                    order.append(node)
        cnt = 0
        for s in order[::-1]:
            if group[s] != -1: continue
            stack = deque([s])
            group[s] = cnt
            while stack:
                node = stack.pop()
                for adj in self.rev[node]:
                    if group[adj] != -1: continue
                    group[adj] = cnt
                    stack.append(adj)
            cnt += 1
        return group, cnt

    def scc(self):
        group, cnt = self.scc_id()
        res = [[] for _ in range(cnt)]
        for i, g in enumerate(group):
            res[g].append(i)
        return res

import sys
input = sys.stdin.buffer.readline

N, M = map(int, input().split())

scc = StronglyConnectedComponents(N)

for _ in range(M):
    a, b = map(int, input().split())
    scc.add_edge(a, b)

res = scc.scc()
print(len(res))

for r in res:
    print(len(r), *r)

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

#ifdef DEBUG
#include "../include/debug.hpp"
#else
#define debug(...) 42
#define rdfile(...) 42
#endif

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    // rdfile("_input.txt");

    string S;
    cin >> S;
    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }

    return 0;
}

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

using namespace std;

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

    if (s.find('a') != string::npos && s.find('b') != string::npos && s.find('c') != string::npos){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N, D;
	cin >> N >> D;
	int X[N][D];
	for(int i = 0; i < N; i++)
		for(int j = 0; j < D; j++) cin >> X[i][j];

	int ans = 0;
	for(int i = 0; i < N - 1; i++) {
		for(int j = i + 1; j < N; j++) {
			double tmp = 0;
			for(int d = 0; d < D; d++) tmp += (X[i][d] - X[j][d]) * (X[i][d] - X[j][d]);
			tmp = sqrt(tmp);
			if(tmp == (int)tmp) ans++;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<string>
#include<vector>
#include<stack>
#include<iomanip>
#include<map>
#define rep(i,n) for(int i=0;i<((int)n);i++)
#define drep(i,n) for(int i=((int)n)-1;i>-1;i--)
#define Rep(i,n0,n) for(int i=n0;i<((int)n);i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<((int)n);j++)
#define W(x) cout<<x<<endl;
#define Debug(x) cout<<"#DEBUG "<<x<<endl;
#define INF (1<<29)
#define INF2 (long long)8*(long long)INF*(long long)INF
#define mod 1000000007

typedef long long ll;

using namespace std;


int min(int x,int y){if(y<x)return y;else return x;}
int max(int x,int y){if(y>x)return y;else return x;}
int fact(int x){int i=1;rep(j,x){i*=(j+1);} return i;}
long long fact(long long x){long long i=1;rep(j,x){i*=(j+1);} return i;}
int gcd(int x, int y){if(x%y==0)return y;else if(y%x==0)return x;else return gcd(x%y,y%x);}
ll gcd(ll x, ll y){if(x%y==0)return y;else if(y%x==0)return x;else return gcd(x%y,y%x);}
void say(bool x){if(x){cout<<"Yes"<<endl;}else {cout<<"No"<<endl;}return;}


int main()
{
    int a,b,n;
    cin >> n >> a >> b;
    if((b-a)%2==0)W("Alice")
    else W("Borys")
    return 0;
}


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

int main(){
    int n;cin>>n;
    vector<long long> lucas(n+1);
    lucas.at(0)=2;
    lucas.at(1)=1;
    for(int i=2;i<n+1;i++){
        lucas.at(i)=lucas.at(i-1)+lucas.at(i-2);
    }
    cout<<lucas.at(n)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

typedef boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000>> cpp_dec_float_1000;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }

void solve(void)
{
  auto start = std::chrono::system_clock::now();

  int64_t a, b; cin >> a >> b;
  auto c = boost::integer::gcd(a, b);
  // auto c2 = std::min(a, b);
  // int64_t res{1};
  ull ans{1};
  for(int64_t i = 2; i <= c; ++i){
    auto rap = std::chrono::system_clock::now();
    auto time = std::chrono::duration_cast<std::chrono::milliseconds>(rap - start).count();
    if((int)time > 1500){
      ++ans;
      break;
    }
    if(c % i != 0){
      continue;
    }
    ++ans;
    while (c % i == 0){
      c /= i;
    }
    
  }
  cout << ans << CRLF;
  return;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
N,A,B=map(int,input().split())
H=[]
import copy
import math

for i in range(N):
  h=int(input())
  H.append(h)
def isok(k):
  I=H
  I=[i-B*k for i in H]
  count=0
  for i in range(N):
    if I[i]>0:
      count+=math.ceil(I[i]/(A-B))
  if count<=k:
    return True
  else:
    return False

start=0
end=sum(H)//B
while end-start>1:
  mid=(start+end)//2
  if isok(mid):
    end=mid
  else:
    start=mid
print(end)

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

using namespace std;

#define MAXN 100005
#define INF 1000000000000000LL
#define MOD 10007
#define pb push_back

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

int n, m;
vi grafo[MAXN];
int p[MAXN];
int grau[MAXN];

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

	cin >> n >> m;

	int x, y;

	for(int i = 1; i <= m; i++){
		cin >> x >> y;
		grafo[x].pb(y);
		grau[y]++;
	}

	queue <int> fila;

	for(int i = 1; i <= n; i++){
		if(grau[i] == 0) fila.push(i);
	}

	int res = 0;

	while(!fila.empty()){
		x = fila.front();
		fila.pop();

		for(auto filho : grafo[x]){
			p[filho] = max(p[filho], p[x] + 1);
			res = max(res, p[filho]);
			grau[filho]--;

			if(grau[filho] == 0) fila.push(filho);
		}
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
ll N;
ll A[205000];
ll sum[200500];
ll ans = 1e18;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> A[i];
        sum[i] = sum[i-1] + A[i];
    }
    for(int i = 1; i < N; i++) {
        ll r = sum[N] - sum[i];
        chmin(ans, abs(sum[i] - r));
    }
    cout << ans << endl;
    return 0;
}


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

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

int main()
{
	ios::sync_with_stdio(false);
	ll a,b;
	cin>>a>>b;
	ll x=gcd(a,b),res=0;
	for(ll i=2;i*i<=x;i++){
		if(x%i==0)res++;
		while(x%i==0)x/=i;
	}
	if(x>1)res++;
	cout<<res+1<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

vector<ll> V;
map<ll,bool> MAP;

int ans = -1;

void recursive(ll N,int index,int count){

	//printf("N:%lld index:%d count:%d\n",N,index,count);

	if(N == 1){ //?????????????????´???
		ans = max(ans,count);
		return;
	}

	if(N < V[index] || index == (int)V.size())return;

	if(N%V[index] == 0){

		recursive(N,index+1,count); //????????????

		//?????????????????????????????£????????????????????¨??????
		while(N%V[index] == 0){
			if(V[index] == 2 || V[index] == 28 || V[index] == 2222 || V[index] == 8828){
				//printf("\nN:%lld V[index]:%lld count:%d\n",N,V[index],count);
			}

			N /= V[index];
			recursive(N,index+1,++count);
		}

	}else{
		recursive(N,index+1,count);
	}
}

int main(){

	ll POW[18];

	for(int i = 0; i <= 17; i++){
		POW[i] = pow(10,i);
	}



	ll tmp;
	int limit;

	//2??¨8??????????????????????????§18????????´??°?????????
	for(int length = 1; length <= 18; length++){
		limit = pow(2,length);
		for(int state = 0; state < limit; state++){
			tmp = 0;
			for(int loop = 0; loop < length; loop++){
				if(state & (1 << loop)){
					tmp += 8*POW[loop];
				}else{
					tmp += 2*POW[loop];
				}
			}
			MAP[tmp] = true;
			V.push_back(tmp);
		}
	}

	sort(V.begin(),V.end());

	ll N;
	scanf("%lld",&N);
	if(N == 1){
		printf("-1\n");
		return 0;
	}

	recursive(N,0,0);

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

	return 0;
}

Measured memory_bytes: 39680
#include <set>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 200001
#define pb push_back
using namespace std;
int fa[N],c[N],n,siz[N],u[N],v[N],qi[N<<1],qfa[N<<1],qsiz[N<<1],qn,Q;vector<int> vc[N],seg[N<<2];long long ans[N];
struct edge{int v,next;edge(){}edge(int _v,int _next){v=_v;next=_next;}}e[N<<1];int head[N],sz;
void init(){memset(head,-1,sizeof(head));sz=0;}void insert(int u,int v){e[++sz]=edge(v,head[u]);head[u]=sz;}
int get(int a){return fa[a]?get(fa[a]):a;}void merge(int a,int b)
{
	if((a=get(a))==(b=get(b)))return;qi[++qn]=a;qfa[qn]=fa[a];qsiz[qn]=siz[a];qi[++qn]=b;qfa[qn]=fa[b];qsiz[qn]=siz[b];
	if(siz[a]<siz[b])swap(a,b);fa[b]=a;siz[a]+=siz[b];
}
void add(int l,int r,int p){for(l+=Q-1,r+=Q-1;l<=r;l>>=1,r>>=1){if(l&1)seg[l++].pb(p);if(!(r&1))seg[r--].pb(p);}}
void undo(){for(int _=2;_;--_)fa[qi[qn]]=qfa[qn],siz[qi[qn]]=qsiz[qn],--qn;}set<int> st;
void dfs(int x)
{
	for(int i=0;i<seg[x].size();++i)merge(u[seg[x][i]],v[seg[x][i]]);
	if(x>=Q)
	{
		if(x-Q+1<=n)
		{
			st.clear();for(int i=0;i<vc[x-Q+1].size();++i)for(int j=head[vc[x-Q+1][i]];~j;j=e[j].next)if(c[e[j].v]^x-Q+1)st.insert(get(e[j].v));
			for(set<int>::iterator it=st.begin();it!=st.end();++it)ans[x-Q+1]-=1ll*siz[*it]*(siz[*it]+1)/2;
		}
	}
	else dfs(x<<1),dfs(x<<1|1);for(int i=0;i<seg[x].size();++i)undo();
}
int main()
{
	init();scanf("%d",&n);for(int i=1;i<=n;++i)scanf("%d",c+i),siz[i]=1;Q=1;while(Q<n)Q<<=1;
	for(int i=1;i<n;++i)
	{
		scanf("%d%d",&u[i],&v[i]),insert(u[i],v[i]),insert(v[i],u[i]);
		if(c[u[i]]>c[v[i]])swap(u[i],v[i]);add(1,c[u[i]]-1,i);add(c[u[i]]+1,c[v[i]]-1,i);add(c[v[i]]+1,n,i);
	}
	for(int i=1;i<=n;++i)vc[c[i]].pb(i);for(int i=1;i<=n;++i)if(!vc[i].empty())ans[i]=1ll*n*(n+1)/2;dfs(1);
	for(int i=1;i<=n;++i)printf("%lld\n",ans[i]);fclose(stdout);return 0;
}

Measured memory_bytes: 94612
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a,b,c,d,n,k;
    cin>>n;
    map<string,int>m;
    string s;
    while(n--)
    {
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<'\n';
    cout<<"WA x "<<m["WA"]<<'\n';
    cout<<"TLE x "<<m["TLE"]<<'\n';
    cout<<"RE x "<<m["RE"]<<'\n';
    return 0;
}

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


//defines...
#define ll long long
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define in insert
#define pi 2*acos(0.0)1
#define srt(s) sort(s.begin(),s.end())
#define rsrt(s) sort(s.rbegin(),s.rend())
#define all(x) x.begin(),x.end()

const ll mod=1e9+7;
const ll MX=2e5+5;

//code goes from here...



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

    freopen("output.txt", "w", stdout);
#endif

    boost
    //---------------------------------
    ll n;
    cin >> n;
    vector <double> v(n);
    for(ll i=0;i<n;i++) cin >> v[i];
    srt(v);
    double ans=(v[0]+v[1])/2;
    for(ll i=2;i<n;i++) 
    {
        ans+=v[i];
        ans/=2;
    }    
    cout << fixed << ans << endl;
    //---------------------------------
    
    return 0;
}


Measured memory_bytes: 3744
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	string s;cin>>s;
	ll n = s.size();

	ll ans=0;
	ll count=0;
	char prev = '0';
	For(i,0,n){
		if(s[i]=='A') count++;
		else if(s[i]=='C'){
			if(prev=='B') ans+=count;
			else count = 0;
		}else if(s[i]=='B'){
			if(i<=n-2 && s[i+1]=='C'){
				
			}
			else{
				count=0;
			}
		}
		prev = s[i];
	}
	cout<<ans<<endl;











	
}

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

int main() {
    string s;
    cin >> s;
    int a=0,b=0;
    for (int i=0;i<s.size();i+=2){
        if(s[i]=='0') a++;
        if(s[i]=='1') b++;
    }
    for (int i=1;i<s.size();i+=2){
        if(s[i]=='1') a++;
        if(s[i]=='0') b++;
    }
    cout << min(a,b) << endl;
    return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
        	double a = scan.nextDouble();
        	double sum = a;
        	for(int i = 2;i < 11;i++){
        		if(i % 2 == 0){
        			a *= 2.0;
        		}else{
        			a /= 3.0;
        		}
        		sum += a;
        	}
        	System.out.printf("%.7f\n",sum);
        }
    }
}

Measured memory_bytes: 19564
N, K = map(int,input().split())

if K == 2:
    ans = len('{:b}'.format(N))
elif K == 8:
    ans = len('{:o}'.format(N))
elif K == 10:
    ans = len(str(N))
else:
    nn = N
    out = ''
    while nn>0:
        out = str(nn%K)+out
        nn = int(nn/K)
    ans = len(out)



print(ans)

Measured memory_bytes: 3064
def divide_the_problems(N: int, D: list)->int:
    D.sort()
    return D[N//2]-D[N//2-1]


if __name__ == "__main__":
    N = int(input())
    D = [int(s) for s in input().split()]

    ans = divide_the_problems(N, D)
    print(ans)


Measured memory_bytes: 14428
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
signed main() {
	int n, a, b, c=0, d=0, e=0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		int p; cin >> p;
		if (p <= a)c++;
		else if (p <= b)d++;
		else e++;
	}
	cout << min(c, min(d, e)) << endl;
}

Measured memory_bytes: 256