akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;

const int H = 20000;
const int M = 2000;


int main(){
  string a,b,c;

  while(cin >> a >> b >> c){
    int ans = a.size() + b.size() + c.size();

    vector<bool> match_ab(2*H+1,true);
    vector<bool> match_ac(2*H+1,true);
    vector<bool> match_bc(2*H+1,true);

    REP(i,a.size()){
      REP(j,b.size()){
        if(a[i] != '?' and b[j] != '?' and a[i] != b[j]){
          match_ab[i-j+H] = false;
        }
      }
    }

    REP(i,a.size()){
      REP(j,c.size()){
        if(a[i] != '?' and c[j] != '?' and a[i] != c[j]){
          match_ac[i-j+H] = false;
        }
      }
    }
    
    REP(i,b.size()){
      REP(j,c.size()){
        if(b[i] != '?' and c[j] != '?' and b[i] != c[j]){
          match_bc[i-j+H] = false;
        }
      }
    }

    FORE(i,-2*M,2*M){
      FORE(j,-2*M,2*M){
        if(match_ab[i+H] and match_ac[j+H] and match_bc[j-i+H]){
          int l = min<i64>({0, i, j});
          int r = max<i64>({a.size(), b.size() + i, c.size() + j});
          chmin(ans, r-l);
        }
      }
    }
    
    puts_all(ans);
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Here your code !
    string S;
    cin >> S;
    
    
    bool flg = false;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'A'){
            if(S[i + 1] == 'C')
                flg = true;
                break;
        }
    }
    
    if(flg){
        cout << "Yes\n";
    }else{
        cout << "No\n";
    }
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int a,b;cin>>a>>b;
    if (a%3==0||b%3==0||(a+b)%3==0)cout<<"Possible";
    else cout<<"Impossible";
    return 0;
}


Measured memory_bytes: 256
function main(input: string) {
  const arrInput: number[] = input
    .split("\n")[1]
    .split(" ")
    .map((elm: string) => Number(elm));
  const ave: number = Math.floor(
    arrInput.reduce((sum: number, num: number) => sum + num) / arrInput.length
  );
  console.log(calcMinEnergy(ave, arrInput));
}

const calcMinEnergy = (base: number, arrInput: number[]) => {
  const baseEnergy: number = energy(base, arrInput);
  if (baseEnergy > energy(base - 1, arrInput)) {
    return calcMinEnergy(base - 1, arrInput);
  } else if (baseEnergy > energy(base + 1, arrInput)) {
    return calcMinEnergy(base + 1, arrInput);
  }
  return baseEnergy;
};

const energy = (base: number, arrInput: number[]) =>
  arrInput.reduce(
    (sum: number, num: number) => (sum += Math.pow(num - base, 2)),
    0
  );

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 9548
#include<stdio.h>

int main(){
 char s,c,r,a,b,d;

 scanf("%c %c %c\n",&s,&c,&r);
 scanf("%c %c %c",&a,&b,&d);
 
 if(s==a){
 
 	if(c==b && r==d){
    printf("3");
    }
    else if(c==b && r!=d){
    printf("2");
    }
    else if(c!=b && r==d){
    printf("2");
    }
    else{ 
    printf("1");
    }
 }
 else{
  	if(c==b && r==d){
    printf("2");
    }
    else if(c==b && r!=d){
    printf("1");
    }
    else if(c!=b && r==d){
    printf("1");
    }
    else{ 
    printf("0");
    }
 }
 return 0;
}
 

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

//関数
void Eerase(vector<set<long>> &path,long a,long b){//二つの頂点が繋がってたら消す。
    set<long>::iterator ite2;;
    ite2=path.at(a).find(b);
    if(ite2!=path.at(a).end()){
        path.at(a).erase(b);
    }
    ite2=path.at(b).find(a);
    if(ite2!=path.at(b).end()){
        path.at(b).erase(a);
    }
}

void Verase(vector<set<long>> &path,long a){//一つの頂点を全消し
    set<long>::iterator ite3;;
    while(path.at(a).size()>0){
        ite3=path.at(a).begin();
        Eerase(path,a,*ite3);
    }
}

    
//main関数
int main() {
    
    
    //入力
    long N,M;
    cin>>N>>M;
    vector<long> A(M),B(M);
    for(int i=0;i<M;i++){
        cin>>A.at(i)>>B.at(i);
        A.at(i)--;
        B.at(i)--;
    }
    
    
    
    //計算
    vector<set<long>> path(N, set<long>());
    for(int i=0;i<M;i++){
        path.at(A.at(i)).insert(B.at(i));
        path.at(B.at(i)).insert(A.at(i));
    }
    
    set<long>::iterator ite;;
    
    vector<long> ansr(M),ansl(M);//>>答えの長さ
    long lengthr=1,lengthl=1;
    ansr.at(0)=0;
    ite=path.at(0).begin();//1つ目をとる
    ansl.at(0)=*ite;
    Eerase(path,ansr.at(0),ansl.at(0));//繋がってたら消す。
    
    bool ryet=(path.at(ansr.at(0)).size()>0),lyet=(path.at(ansl.at(0)).size()>0);
    
    
    while(ryet || lyet){
        if(ryet){
            lengthr++;
            ite=path.at(ansr.at(lengthr-2)).begin();
            ansr.at(lengthr-1)=*ite;
            Verase(path,ansr.at(lengthr-2));
            Eerase(path,ansr.at(lengthr-1),ansl.at(lengthl-1));
            //display(path,N);
        }
        ryet=(path.at(ansr.at(lengthr-1)).size()>0);
        lyet=(path.at(ansl.at(lengthl-1)).size()>0);
        if(lyet){
            lengthl++;
            ite=path.at(ansl.at(lengthl-2)).begin();
            ansl.at(lengthl-1)=*ite;
            Verase(path,ansl.at(lengthl-2));
            Eerase(path,ansr.at(lengthr-1),ansl.at(lengthl-1));
            //display(path,N);
        }
        
        ryet=(path.at(ansr.at(lengthr-1)).size()>0);
        lyet=(path.at(ansl.at(lengthl-1)).size()>0);
      //display(path,N);
    }
    
    //出力
    cout<<lengthr+lengthl<<endl;
    for(int i=lengthr-1;i>0;i--){
        cout<<ansr.at(i)+1<<" ";
    }
    cout<<1;
    for(int i=0;i<lengthl;i++){
        cout<<" "<<ansl.at(i)+1;
    }
    cout<<endl;
}

Measured memory_bytes: 18048
#include <stdio.h>
int main()
{
	int k,i,ii,iii,s,cnt=0;
	scanf("%d %d",&k,&s);
	for(i=0; i<=k; ++i)
	{
		for(ii=0; ii<=k; ++ii)
		{
			iii=s-i-ii;
			if(0<=iii && iii<=k) cnt=cnt+1;
		}
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long[] A = new long[N];
        for (int i = 0; i < N; i++) {
            A[i] = scan.nextLong();
        }
        long all_gcd = gcd(A);
        if (1 < all_gcd) {
            System.out.println("not coprime");
            return;
        }
        if (this.pairwise_coprime(A)) {
            System.out.println("pairwise coprime");
            return;
        }
        System.out.println("setwise coprime");
    }

    private boolean pairwise_coprime(long[] A) {
        int len = A.length;
        HashMap<Long, HashSet<Long>> primes = new HashMap<>();
        for (int i = 0; i < len; i++) {
            long current = A[i];
            for (long j = 2; j * j <= A[i]; j++) {
                if (current % j != 0) {
                    continue;
                }
                if (primes.containsKey(j)) {
                    return false;
                }
                HashSet<Long> set = new HashSet<>();
                primes.put(j, set);
                while (current % j == 0) {
                    current /= j;
                    set.add(A[i]);
                }
            }
            if (1 < current) {
                if (primes.containsKey(current)) {
                    return false;
                }
                primes.put(current, new HashSet<>());
            }
        }
        for (long x : primes.keySet()) {
            if (1 < primes.get(x).size()) {
                return false;
            }
        }
        return true;
    }

    private long gcd(long x, long y) {
        if (y == 0) {
            return x;
        }
        return gcd(y, x % y);
    }

    private long gcd(long[] A) {
        long gcd = A[0];
        for (int i = 0; i < A.length; i++) {
            gcd = this.gcd(gcd, A[i]);
        }
        return gcd;
    }
}


Measured memory_bytes: 69108
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    string S;
    cin >> S;
    int a = stoi(S.substr(0, 2)), b = stoi(S.substr(2, 2));
    if(1 <= a && a <= 12){
        if(1 <= b && b <= 12){
            cout << "AMBIGUOUS" << endl;
        }else{
            cout << "MMYY" << endl;
        }
    }else{
        if(1 <= b && b <= 12){
            cout << "YYMM" << endl;
        }else{
            cout << "NA" << endl;
        }
    }
}

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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

string f(string s) {
  string res;
  res += s[0];
  for (int i=1; i<s.size(); i++) {
    if (res[res.size()-1] != s[i]) {
      res.push_back(s[i]);
    }
  }
  return res;
}

signed main() {
  ll N, K;
  string s;
  cin >> N >> K >> s;
  s = f(s);
  rep(i, K) {
    if (s.size() == 1) {
      continue;
    } else if (s.size() >= 3){
      auto it = s.begin();
      s.erase(it);
      it = s.begin();
      s.erase(it);
    } else {
      // s.size() == 2
      auto it = s.begin();
      s.erase(it);
    }
  }
  cout << N - s.size() << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);
	if (a == b && b != c)
	{
		printf("Yes");
		return 0;
	}
	else if (a == c && c != b)
	{
		printf("Yes");
		return 0;
	}
	else if (b == c && c != a)
	{
		printf("Yes");
		return 0;
	}
	printf("No");
	return 0;
}


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


#define INF 1000000000000


signed main()
 {
   int n;
   cin>>n;
   int a[n];
   rep(i,n){
     a[i]=0;
   }
   rep(i,n-1){
     int k;
     cin>>k;
     a[k-1]++;
   }
   rep(i,n){
     cout<<a[i]<<endl;
   }

 }


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

char a[101][101],b[102][102];

int main(){
 int H,W;
  cin >> H >> W;
  for(int i=0;i<H;++i){
    for(int j=0;j<W;j++){
    cin >> a[i][j];
    }
  }
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;j++){
      b[i][j] = '#';
    }
  }
  for(int i=0;i<H;++i){
    for(int j=0;j<W;j++){
      b[i+1][j+1] = a[i][j];
    }
  }
  for(int i=0;i<H+2;i++){
    for(int j=0;j<W+2;++j){
      cout << b[i][j] ;
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

 int main()
 {

 int a[10000], min, max, n, i;
 long long sum = 0;
 scanf("%d", &n);
for(i = 0; i < n; i++){
 scanf("%d", &a[i]);
 sum += a[i];
 }
 max = min = a[0];
for(i = 1; i < n; i++){
if(a[i] > max)max = a[i];
 if(a[i] < min)min = a[i];
 }
 printf("%d %d %lld\n", min, max, sum);

 return 0;
 }


Measured memory_bytes: 2144
from math import sqrt

N = int(input())

def divset(n:int) -> list:
    l = []
    if n <= 0:
        return l
    
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            l.append((i, n // i))
    return l


l = divset(N)
ans = l[0]
n = ans[0] + ans[1]
for e in l[1:]:
    if e[0] + e[1] < n:
        ans = e
        n = e[0] + e[1]

print(n - 2)


Measured memory_bytes: 3444
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String name=sc.next();//入力
		String[] sign=new String[n];
		for(int i=0;i<n;i++){
			sign[i]=sc.next();
		}//
		int ans=0;
		String test="";
		for(int i=0;i<n;i++){//看板の数
			for(int j=0;j<=sign[i].length()-name.length()+1;j++){//最初に取り出す文字。=なのはsign-nameだと必要な分まで引いてしまうから
				if(test.equals(name)){//signの長さがnameと最初から同じだとループで不具合
					test="";
					break;
				}
				for(int k=1;k<=(sign[i].length()-1-j)/(name.length()-1);k++){//次の文字までの数.-1されているのは配列番号と合わせるため
					for(int l=0;l<name.length();l++){//testに格納する数
						test+=sign[i].charAt(l*k+j);
					}
					if(test.equals(name)){
						ans++;
						break;
					}
					else test="";
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 55632
n = int(input())
s = input()
a = [int(num) for num in s.split()]
s = input()
b = [int(num) for num in s.split()]
s = input()
c = [int(num) for num in s.split()]

isa = []
isb = []
isc = []
for i in range(n + 1):
    isa.append(False)
    isb.append(False)
    isc.append(False)

for i in range(1, a[0] + 1):
    isa[a[i]] = True
for i in range(1, b[0] + 1):
    isb[b[i]] = True
for i in range(1, c[0] + 1):
    isc[c[i]] = True

C = c[0]
CA = 0
ABC = 0
for i in range(1, n + 1):
    if isc[i] & isa[i]:
        CA += 1
    if isa[i] & isb[i] & isc[i]:
        ABC += 1

print(C - CA + ABC)

Measured memory_bytes: 7780
#include <bits/stdc++.h>
using namespace std;
#include<algorithm>
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
ll gcd(ll a,ll b){
	if(b==0){
		return a;
	}
	return gcd(b,a%b);
}
int main() {
	ll n,m;
	cin>>n>>m;
	ll ch[100010];
	for(ll i=0;i<n;i++){
		cin>>ch[i];
		ch[i]/=2;
	}
	ll cnt=0;
	for(ll i=0;i<n;i++){
		ll now=0;
		while(ch[i]%2==0){
			now++;
			ch[i]/=2;
		}
		if(i==0){
			cnt=now;
			continue;
		}
		if(now!=cnt){
			cout << 0;
			return 0;
		}
	}
	while(cnt!=0){
		cnt--;
		m/=2;
	}
	ll lcm=ch[0];
	for(ll i=1;i<n;i++){
		ll now=gcd(max(lcm,ch[i]),min(lcm,ch[i]));
		//cout << now<<endl;
		//cout << lcm<<endl;
		//cout << ch[i]<<endl;
		now=lcm/now*ch[i];
		if(now>m){
			cout << 0;
			return 0;
		}
		lcm=now;
	}
	cout << (m+lcm)/(2*lcm);
	// your code goes here
	return 0;
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[]) {
    int N, K, Q;
    cin >> N >> K >> Q;
    vector<int> correct(N);
    for (auto i = 0; i < Q; ++i) {
        int A_i;
        cin >> A_i;
        correct[A_i - 1] += 1;
    }
    for (auto i = 0; i < N; ++i) {
        cout << (correct[i] + K - Q > 0 ? "Yes" : "No") << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a <= k) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>

int main(){
    std::string N;
    std::cin >> N;

    if(N.size()==1){
        std::cout << N[0] << std::endl;
        return 0;
    }
    int sum2=0;
    for(int i=0;i<N.size();i++){
        sum2+=N[i]-48;
    }
    for(int i=0;i<N.size();i++){
        if(N[i]!='9'){
            int sum=N[0]-49;
            sum+=9*(N.size()-1);
            if(sum>sum2){
                std::cout << sum << std::endl;
            }else{
                std::cout << sum2 << std::endl;
            }
            return 0;        
        }
            
    }
    int sum=0;
    sum+=9*(N.size());
    
    std::cout << sum << std::endl;
    
}


Measured memory_bytes: 256
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll d=nxt(),t=nxt(),s=nxt();
    if(s*t>=d)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    
	printclock;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;

  vector<int> h(N);
  rep(i, N) cin >> h[i];

  int ans = 0;
  rep(i, N) {
    if (h[i] >= K)
      ans++;
  }

  cout << ans << endl;
}

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

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    vector<int> ans(n);

    int prime;
    if(s != 144701) prime = 144701;
    else prime = 144497;

    if(k == 0) {
        rep(i, n) cout << prime << " ";
        cout << endl;
        return 0;
    }

    int kusa;
    if(s == 1 || s == 2) kusa = s+1;
    else kusa = s-1;

    rep(i, n) {
        if(i < k) ans[i] = s;
        else ans[i] = kusa;
    }

    //output
    rep(i, n) cout << ans[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

template <class Iit>
void vout(const Iit &begin,const Iit &end,ostream &out) {
    for(auto it = begin; it != end; it++) {
        auto tmp = it;
        if (++tmp == end) out << *it << '\n';
        else out << *it << " ";
    }
}

int main(void)
{
    IOS
    int N; cin >> N;
    vector<int> T(3);
    REP(i,3) cin >> T[i];
    vector<int> L(N);
    REP(i,N) cin >> L[i];

    int ans = 1 << 30;
    vector<int> use(N);
    bool loop = true;
    while(loop) {
        int tmp = 0;
        vector<int> l(3);
        vector<int> connect(3);
        REP(i,N) {
            if (use[i] != 3) {
                l[use[i]] += L[i];
                connect[use[i]]++; 
            }
        }
        REP(i,3) {
            if (connect[i] == 0) {
                tmp = 1<< 30; 
                break;
            }
            tmp += abs(T[i] - l[i]) + (connect[i] -1) * 10;
        }
        if (ans > tmp) {
            ans = min(ans,tmp);
            //cerr << ans << " ";
            //vout(ALL(use),cerr);
        }
        use[0]++;
        REP(i,N) {
            if (use[i] == 4) {
                if (i == N-1) {
                    loop = false;
                } else {
                    use[i] = 0;
                    use[i+1]++;
                }
            }
        }
    }
    
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
int n;
int a[100005],id[100005];
int L[100005],R[100005];
ll ans=0;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	REP(i,n){
		cin>>a[i];id[a[i]]=i;
	}
	REP(i,n) L[i]=i-1,R[i]=i+1;
	R[n+1]=n+1;L[n+1]=n;L[0]=0;R[0]=1;
	for (int i=1;i<n;++i){
		int p=id[i];
		int l1,l2,r1,r2;
		l1=L[p];l2=L[L[p]];r1=R[p];r2=R[R[p]];
		L[R[p]]=L[p];R[L[p]]=R[p];
		//printf("Number:%d Place:%lld  %lld,%lld,%lld,%lld\n",i,p,l1,l2,r1,r2);
		// count ans
		ans+=(ll)i*((r2-r1)*(p-l1)+(l1-l2)*(r1-p));
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <cstdint>
#include <boost/range/irange.hpp>
using namespace std;
using namespace boost;

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

    int N,M,R;
    cin >> N >> M >> R;

    vector<vector<int>> D(N, vector<int>(N, 1e9));
    
    for( int i : irange(0, N) )
    {
        for( int j : irange(0, N) )
        {
            if(i == j) D[i][j] = 0;
            //else D[i][j] = 1e9;
        }
    }

    vector<int> rs(R);
    for( int& r : rs )
    {
        cin >> r;
        r--;
    }
    sort(rs.begin(), rs.end());

    for( int i : irange(0, M) )
    {
        int a, b, c;
        cin >> a >> b >> c;
        a--; b--;
        D[a][b] = c;
        D[b][a] = c;
    }

    for( int i : irange(0, N) )
    {
        for( int j : irange(0, N) )
        {
            for( int k : irange(0, N) )
            {
                D[j][k] = min(D[j][k], D[j][i] + D[i][k]);
            }
        }
    }

    int mini = 1e9;
    do{
        int s, cost = 0;
        for( int i : irange(0, R) )
        {
            if(i)
            {
                cost += D[s][rs[i]];
                s = rs[i];
            }
            else s = rs[i];
        }
        mini = min(mini, cost);
    }while(next_permutation(rs.begin(), rs.end()));

    cout << mini << endl;

    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long
#define MAX 200005
#define MOD 1000000007
using namespace std;
vector<int> adj[200007];
ll sz[200007], dp[200007], f[200007];
int n;
ll modpow(ll a, ll b)
{
    if (b == 0) return 1;
    ll u = modpow(a, b / 2);
    u = (u * u)%MOD;
    if (b%2) u = (a * u)%MOD;
    return u;
}
void init(){
    f[0]=1;
    for(int i=1;i<=200006;i++){
        f[i] = f[i-1]*i;
        f[i] %= MOD;
    }
}
void dfs1(int u, int p){
    sz[u]=1;
    for(auto v:adj[u]){
        if(v==p) continue;
        dfs1(v,u);
        sz[u]+=sz[v];
    }
    dp[1] = dp[1] * modpow(sz[u],MOD-2)%MOD;
}
void dfs2(int u, int p){
    for(auto v:adj[u]){
        if(v==p) continue;
        dp[v] = dp[u]%MOD * sz[v]%MOD * modpow(n-sz[v],MOD-2)%MOD;
        dfs2(v,u);
    }
}
int main()
{
    init();
    int a, b;
    cin >> n;
    dp[1] = f[n];
    for(int i=0;i<n-1;i++){
        cin >> a >> b;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    dfs1(1,-1);
    dfs2(1,-1);
    for(int i=1;i<=n;i++) cout << dp[i] << endl;
}


Measured memory_bytes: 18548
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

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

vector<pair<ll, ll>> primeFactorization(ll n) {
    vector<pair<ll, ll>> result;
    for (ll i = 2; i * i <= n; i++) {
        ll num = 0;
        while (n % i == 0) {
            n /= i;
            num++;
        }
        if (num != 0) {
            result.push_back({ i, num });
        }
    }

    if (n != 1) {
        result.push_back({ n, 1 });
    }

    return result;
}

int main() {
    ll A, B;
    cin >> A >> B;
    ll g = gcd(A, B);
    vector<pair<ll, ll>> primes = primeFactorization(g);
    cout << primes.size() + 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){

  int N;
  cin>>N;
  vector<int>A(N);
  vector<int>A2(N);
  for(int i=0;i<=N-1;i++){
    cin>>A[i];
  }
  for(int i=0;i<=N-1;i++){
  
    A2[A[i]-1]=i+1;
  }
  for(int i=0;i<=N-1;i++){
  
    cout<<A2[i]<<" ";
  }
  return 0;
}

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

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

    int len = t.size();

    if(t[0] == '?')
    {
        if(t[1] == 'D' || t[1] == '?')
        {
            t[0] = 'P';
        }
        else
        {
            t[0] = 'D';
        }
    }
    for (int i = 1; i < len - 1; i++)
    {
        if(t[i] == '?')
        {
            if(t[i - 1] == 'P')
            {
                t[i] = 'D';
            }
            else
            {
                if(t[i + 1] == '?')
                {
                    t[i] = 'P';
                }
                else if(t[i + 1] == 'P')
                {
                    t[i] = 'D';
                }
                else
                {
                    t[i] = 'P';
                }
                
            }
        }
    }
    if(t[len - 1] == '?')
    {
        t[len - 1] = 'D';
    }
    cout << t << endl;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
#define INF 1e12
const int MOD = 1000000007;
typedef pair<ll,ll> P;

int main(void){
    ll A,B,C,X,Y,ans = 0;
    cin >> X >> Y >> A >> B >> C;
    vector<ll> re(A);
    vector<ll> bu(B);
    vector<ll> cl(C);
    REP(i,A) cin >> re[i];
    REP(i,B) cin >> bu[i];
    REP(i,C) cin >> cl[i];
    // 前処理
    sort(re.begin(), re.end(), greater<>());
    re.erase(re.begin()+X, re.end());
    sort(bu.begin(), bu.end(), greater<>());
    bu.erase(bu.begin()+Y, bu.end());
    sort(cl.begin(), cl.end(), greater<>());
    vector<ll> sum(X+Y+C);
    sum.insert(sum.begin(),re.begin(),re.end());
    sum.insert(sum.begin()+X,bu.begin(),bu.end());
    sum.insert(sum.begin()+X+Y,cl.begin(),cl.end());
    sort(sum.begin(),sum.end(),greater<>());
    ll i = 0;
    while(i < X+Y){
        ans += sum[i];
        i++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10580
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <stack>

using std::vector;
using std::printf;
using std::cout;
using std::endl;


template<typename T>
void dump(vector<T> vec) {
    for (auto x : vec) {
        std::cout << x << " ";
    }
    std::cout << std::endl;
}

// ---------------------------

int main() {
    long long N, K;
    std::cin >> N >> K;

    size_t arr_max = 2000+1;

    vector<int> AA(N);
    for (int i = 0; i < N; ++i) {
        std::cin >> AA[i];
    }

    // dump<int>(AA);

    vector<long long> arr1(arr_max, 0);

    long long ret1 = 0;
    long long ret2 = 0;
    for (int i = 0; i < N; ++i) {
        arr1[AA[i]]++;
        for (int j = AA[i]+1; j < arr_max; ++j) {
            ret1 += arr1[j];
        }
    }
    for (int i = 0; i < N; ++i) {
        for (int j = AA[i]+1; j < arr_max; ++j) {
            ret2 += arr1[j];
        }
    }

    long long MOD = 1000000007;
    long long ret = 0;

    // cout << MOD << endl;
    ret = (K * (K-1) / 2LL) % MOD;
    // cout << ret << endl;
    ret = (ret * ret2) % MOD;
    // cout << ret << endl;
    ret = ret + (ret1 * K) % MOD;
    // cout << ret << endl;
    ret = (ret + MOD) % MOD;
    // cout << ret << endl;
    // ret = (ret * (K+1) / 2) % MOD;
    // cout << ret << endl;
    // ret = ( ret + (((ret1 - ret2) * K) % MOD + MOD) ) % MOD;
    // cout << ret << endl;

    // for (long long i = 0; i < K; ++i) {
    //     ret += ret1 + i * ret2;
    //     ret = ret % MOD;
    // }

    // printf("%d %d\n", ret1, ret2);
    printf("%d", (int)ret);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
main(){
    int N,A;
    ll sum[2] = {},cnt[2] = {};
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A;
        sum[0] += A;
        sum[1] += A;
        if(i&1){
            if(sum[0] <= 0){
                cnt[0] += llabs(sum[0]-1);
                sum[0] = 1;
            }
            if(sum[1] >= 0){
                cnt[1] += llabs(sum[1]+1);
                sum[1] = -1;
            }
        }else{
            if(sum[1] <= 0){
                cnt[1] += llabs(sum[1]-1);
                sum[1] = 1;
            }
            if(sum[0] >= 0){
                cnt[0] += llabs(sum[0]+1);
                sum[0] = -1;
            }
        }
//        cout << cnt[0] << " " << cnt[1] << endl;
    }
    cout <<endl<< min(cnt[0],cnt[1]) << endl;
}

Measured memory_bytes: 256
N,X = map(int,input().split())
x = list(map(int,input().split()))

def gcd(x1,x2):
    while x2 != 0:
        x1,x2 = x2, x1%x2
    return x1

for i in range(len(x)):
    x[i] = abs(x[i]-X)

ans = x[0]
for i in range(1,len(x)):
    ans = gcd(ans,x[i])
print(ans)

Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define codefor int test;scanf("%d",&test);while(test--)
#define yn(ans) if(ans)printf("Yes\n");else printf("No\n")
#define YN(ans) if(ans)printf("YES\n");else printf("NO\n")
#define vector2d(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define umap unordered_map
#define uset unordered_set
using namespace std;
using ll = long long;
const int MOD=1000000007;
//入力系
void scan(int& a){scanf("%d",&a);}
void scan(long long& a){scanf("%lld",&a);}
template<class T> void scan(T& a){cin>>a;}
template<class T> void scan(vector<T>& vec){for(auto&& it:vec)scan(it);}
void in(){}
template <class Head, class... Tail> void in(Head& head, Tail&... tail){scan(head);in(tail...);}
//出力系
void print(const int& a){printf("%d",a);}
void print(const long long& a){printf("%lld",a);}
void print(const double& a){printf("%.15lf",a);}
template<class T> void print(const T& a){cout<<a;}
template<class T> void print(const vector<T>& vec){if(vec.empty())return;print(vec[0]);for(auto it=vec.begin();++it!= vec.end();){putchar(' ');print(*it);}}
void out(){putchar('\n');}
template<class T> void out(const T& t){print(t);putchar('\n');}
template <class Head, class... Tail> void out(const Head& head,const Tail&... tail){print(head);putchar(' ');out(tail...);}
//デバッグ系
template<class T> void dprint(const T& a){cerr<<a;}
template<class T> void dprint(const vector<T>& vec){if(vec.empty())return;cerr<<vec[0];for(auto it=vec.begin();++it!= vec.end();){cerr<<" "<<*it;}}
void debug(){cerr<<endl;}
template<class T> void debug(const T& t){dprint(t);cerr<<endl;}
template <class Head, class... Tail> void debug(const Head& head, const Tail&... tail){dprint(head);cerr<<" ";debug(tail...);}
ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }

int main(){
    int sx,sy,tx,ty;
    in(sx,sy,tx,ty);
    string s;
    rep(i,ty-sy)s.push_back('U');
    rep(i,tx-sx)s.push_back('R');
    rep(i,ty-sy)s.push_back('D');
    rep(i,tx-sx)s.push_back('L');
    s.push_back('L');
    rep(i,ty-sy+1)s.push_back('U');
    rep(i,tx-sx+1)s.push_back('R');
    s.push_back('D');s.push_back('R');
    rep(i,ty-sy+1)s.push_back('D');
    rep(i,tx-sx+1)s.push_back('L');
    s.push_back('U');
    out(s);
}

Measured memory_bytes: 3664
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

typedef long long ll;
const int MAXN = 1e5 + 10;
int N;
ll p[MAXN], pn;
bool np[MAXN * 10];
map<ll, int> cnt;
int ans;

inline void init(int n) {
	register int i, j;
	np[1] = 1; 
	for(i = 2; i <= n; ++i) {
		if(!np[i])
			p[++pn] = i;
		for(j = 1; j <= pn && i * p[j] <= n; ++j) {
			np[i * p[j]] = 1;
			if(i % p[j] == 0)
				break;
		}
	}
}

int main() {
	register int i, j; ll a; init(1e5);
	scanf("%d", &N);
	for(i = 1; i <= N; ++i) {
		ll x = 1, y = 1, t;
		scanf("%lld", &a);
		for(j = 1; j <= pn && p[j] * p[j] * p[j] <= a; ++j) {
			if(a % p[j] == 0) {
				t = 0;
				while(a % p[j] == 0) a /= p[j], ++t;
				if(t % 3 == 1) x *= p[j], y *= p[j] * p[j];
				if(t % 3 == 2) x *= p[j] * p[j], y *= p[j];
			}
		}
		x *= a;
		if((ll) sqrt(a) * (ll) sqrt(a) == a)
			y *= (ll) sqrt(a);
		else
			y *= a * a;
		if(x == 1) ans += (++cnt[1] == 1);
		else ans += (++cnt[x] > cnt[y]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 12928
import copy
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)

N = int(input())
graph = [[int(a) for a in list(input().rstrip())] for _ in range(N)]
INF = 10**9

dis = copy.deepcopy(graph)
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        if dis[i][j] == 0:
            dis[i][j] = INF

for k in range(N):
    for i in range(N):
        for j in range(N):
            dis[i][j] = min(dis[i][j], dis[i][k]+dis[k][j])

state = [[] for _ in range(N)]
for i in range(N):
    for j in range(N):
        if graph[i][j] == 1:
            state[i].append(j)

D = [INF for _ in range(N)]
checked = [False for _ in range(N)]
D[0] = 0
checked[0] = True
ok = True

def dfs(p, d, ok):
    for np in state[p]:
        if checked[np]:
            c = d + 1 - D[np]
            if c > 1 and c % 2 == 1:
                ok = False
        else:
            checked[np] = True
            D[np] = d+1
            ok = dfs(np, d+1, ok)
    return ok

ok = dfs(0, 0, ok)

if not ok:
    print(-1)
else:
    ans = 0
    for i in range(N):
        for j in range(N):
            ans = max(ans, dis[i][j]+1)
    print(ans)

Measured memory_bytes: 44528
#include <cstdio>
#include <cstdlib>

const int MAXN=100011;

int N;
char str[MAXN];

bool isWolf[MAXN];

void Shift(){
	for(int i=2;i<N;++i){
		if(isWolf[i-1]){
			if(str[i-1]=='x')
				isWolf[i]=isWolf[i-2];
			else	isWolf[i]=!isWolf[i-2];
		}
		else{
			if(str[i-1]=='o')
				isWolf[i]=isWolf[i-2];
			else	isWolf[i]=!isWolf[i-2];
		}
	}
}

bool Test(int a){
	int p=a-1;if(p<0)	p+=N;
	int n=a+1;if(n>=N)	n-=N;
	if(isWolf[a]^(str[a]=='o'))
		return isWolf[p]==isWolf[n];
	return isWolf[p]!=isWolf[n];
}

bool Test(){
	bool ret=true;
	for(int i=0;i<N;++i){
		ret&=Test(i);
	}
	return ret;
}

void Show(){
	for(int i=0;i<N;++i){
		if(isWolf[i])
			printf("W");
		else	printf("S");
	}
	puts("");
	exit(0);
}

int main(){
	
	scanf("%d", &N);
	
	scanf("%s", str);
	
	isWolf[0]=false;isWolf[1]=false;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=false;isWolf[1]=true;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=true;isWolf[1]=false;
	Shift();
	if(Test())	Show();
	
	isWolf[0]=true;isWolf[1]=true;
	Shift();
	if(Test())	Show();
	
	puts("-1");
	
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

int main(int argc, char **argv) {
	ll res = 0, a, m = 0;
	REP(i, 5) {
		cin >> a;
		res += ((a+9)/10*10);
		if (a % 10 != 0) m = max(m, 10 - a%10);
	}
	cout << (res-m) << endl;
	return 0;
}


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define endl "\n"
#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007
//グリッドグラフの範囲チェック
bool range_validation(int y,int x,int h,int w){
    return y>=0 && y<h && x>=0 && x < w;
}
//ビットカウント
int popcount(long bits){
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

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

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

  int n;
  cin >> n;
  int x[n],y[n];
  REP(i,n) cin >> x[i] >> y[i];

  map<pair<int,int>,int> val_cnt;
  int max = 0;
  REP(i,n){
    REP(j,n){
      if(i!=j){
        chmax(max,++val_cnt[make_pair(x[j]-x[i],y[j]-y[i])]);
      }
    }
  }

  cout << n-max << endl;
  return 0;
}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}
const int INF = 1e18;

signed main() {
    int N, M;
    cin >> N >> M;
    vi H(N);
    rep(i, N) cin >> H[i];
    vi mx(N, 0);

    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        mx[a] = max(mx[a], H[b]);
        mx[b] = max(mx[b], H[a]);
    }

    int res = 0;
    rep(i, N) {
        if(H[i] > mx[i]) res++;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4760
#include <bits/stdc++.h>
using namespace std;
long long p,a[1000],b,r=30,d,i,j;
long double m,f,l,n,k;
string ss;
char c;
int main()
{
	cin >> d >> ss;

	p=ss.size();

	for(i=0;i<p;i++)
    {
        n=ss[i];
        n+=d;
        if(n>90)
        {
            while(n>90)
            {
                n-=26;
            }
        }

        c=n;

        cout << c;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define hell 1000000007
#define PI 3.14159265358979323846
#include <fstream>
using namespace std;

int main()
{
    //  freopen("timber_input.txt", "r", stdin);
   // freopen("out3_test.txt", "w", stdout);
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
   // cin>>t;
    while(t--) {
    ll n,i,j,k;
    cin>>n>>k;
    ll arr[n+1],dp[n+1];

    for(i=0;i<n;i++)
        cin>>arr[i];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(i=2;i<n;i++)
    {
        dp[i]=hell;
        for(j=i-1;j>=max(0ll,i-k);j--)
            dp[i]=min(dp[i],abs(arr[i]-arr[j])+dp[j]);
    }
    cout<<dp[n-1];
    }

}


Measured memory_bytes: 5156
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

void eratosthenes(vector<int> &n){	
	n[1] = 1;
	for (int i = 2;i <= (120000/2); i++){
		n[i * 2] = 1;
	}
	int p = 3;
	while(p * p <= 120000){
		for (int i = p; i <= (120000/p); i++){
			n[i * p] = 1;
		}
		p++;
		while(n[p] == 1)p++;
	}
	return;
}

bool isPrime(int n){
	if (n < 2) return false;
	if (n == 2) return true;
	for (int i = 2; i <= sqrt(n) + 1; i++){
		if (n % i == 0) return false;
	}
	return true;
}
		
int main(){
	vector<int> era(120000);
	eratosthenes(era);
	vector<int> Primelist(120001);
	int index = 1;
	for (int i = 1; i <= era.size(); i++){
		if (era[i] == 0){
			Primelist[index] = i;
			index++;
		}
	}
	while(1){
		int n,p; cin >> n >> p;
		if (n + p == -2) break;
		index = 1;
		while(n >= Primelist[index]){
			index++;
		}
		
		vector<int> list(120000);
		for (int i = 1; i <= p; i++){
			for (int j = i; j <= p; j++){
				list[(i-1) * p + j] = Primelist[index + i - 1] + Primelist[index + j - 1];
			}
		}
		sort(list.begin(),list.end());
		index = 0;
		while(list[index] == 0){
			index++;
		}
		cout << list[index + p - 1] << endl;
		
	}

return 0;
}

Measured memory_bytes: 4108
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var S = ReadLine();
            var dp = new long[S.Length, 2];
            var sn = S[0] - '0';
            dp[0, 0] = sn;
            dp[0, 1] = sn - 1;
            for(var i=1;i<S.Length;++i)
            {
                sn = S[i] - '0';
                dp[i, 0] = dp[i - 1, 0] + sn;
                dp[i, 1] = dp[i - 1, 1] + 9;
                if (sn != 0)
                    dp[i, 1] = Max(dp[i, 1], dp[i - 1, 0] + sn - 1);

            }
            WriteLine(Max(dp[S.Length - 1, 0], dp[S.Length - 1, 1]));
            //Out.Flush();
        }
    }
}

Measured memory_bytes: 11092
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sc.next());
		}

		int count = 0;
		for (Integer aInt : a) {
			while (aInt % 2 == 0) {
				aInt /= 2;
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 34584
import math
import sys
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


n = int(input())
if n==1:
    print(0)
    sys.exit()
ans = 0
array = factorization(n)
#print(array)

array2 = [row[1] for row in array]

for i in array2:
    ans += math.ceil(math.sqrt(2*i+9/4)-1/2)-1
    #print(math.ceil(math.sqrt(2*i+9/4)-1/2)-1)

print(ans)


Measured memory_bytes: 9488