akhauriyash/Code-Regression huggingface dataset:
/*
  ∧,,∧
( 'ω' )つ ＜WA,またお前か！！　
（m9 ＼ 　　
　 ＼　 ＼
　 　 ) ) ＼
　 ／／ ＼ ＼
　 (＿） 　 (＿)
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)

typedef long long LL;
typedef long double LD;

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

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int N;
    cin >> N;
    vector<pair<int, int>> coor(N, {0, 0});
    vector<LL> h(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> coor[i].first >> coor[i].second >> h[i];
    }

    LL height;
    LL temp;
    int ok;
    for (int x = 0; x <= 100; x++) {
        for (int y = 0; y <= 100; y++) {
            height = -1;
            ok = 1;

            for (int i = 0; i < N; i++) {
                if (height < 0) {
                    if (h[i] >= 1) {
                        height = h[i] + abs(x - coor[i].first) + abs(y - coor[i].second);
                        break;
                    }
                }
            }

            for (int i = 0; i < N; i++) {
                if (max(height - abs(x - coor[i].first) - abs(y - coor[i].second), 0ll) != h[i]) {
                    ok = 0;
                }
            }

            if (ok) {
                printf("%d %d %lld\n", x, y, height);
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
module RegExp : sig
  type t
  val empty_set : t
  val empty_str : t
  val char : Char.t -> t
  val app : t -> t -> t
  val union : t -> t -> t
  val star : t -> t

  val matches : t -> Char.t list -> bool
end = struct
  type t =
    { sort : sort;
      is_nullable : bool;
      derive : char -> t }
  and sort =
    | EmptySet
    | EmptyStr
    | Other

  let rec empty_set =
    { sort = EmptySet;
      is_nullable = false;
      derive = fun _ -> empty_set }

  let empty_str =
    { sort = EmptyStr;
      is_nullable = true;
      derive = fun _ -> empty_set }

  let char c =
    { sort = Other;
      is_nullable = false;
      derive = fun c' -> if c = c' then empty_str else empty_set }

  let rec union re1 re2 =
    match re1, re2 with
    | { sort = EmptySet }, _ -> re2
    | _, { sort = EmptySet } -> re1
    | _, _ ->
        { sort = Other;
          is_nullable = re1.is_nullable || re2.is_nullable;
          derive = fun c -> union (re1.derive c) (re2.derive c) }

  let rec app re1 re2 =
    match re1, re2 with
    | { sort = EmptyStr }, _ -> re2
    | { sort = EmptySet }, _ -> empty_set
    | _, _ ->
        { sort = Other;
          is_nullable = re1.is_nullable && re2.is_nullable;
          derive = fun c ->
            union
              (app (re1.derive c) re2)
              (if re1.is_nullable then re2.derive c else empty_set) }

  let star = function
    | { sort = EmptySet }
    | { sort = EmptyStr } -> empty_str
    | re0 ->
        let rec re =
          { sort = Other;
            is_nullable = true;
            derive = fun c -> app (re0.derive c) re } in re

  let matches re s =
    (List.fold_left (fun re -> re.derive) re s).is_nullable
end

let () =
  let s = read_line () in
  print_endline @@
  if
    let open RegExp in
    matches
      (* ((dream(er)?)|(erase(r)?))* *)
      (star @@
        union
          (app (char 'd') @@ app (char 'r') @@ app (char 'e') @@ app (char 'a') @@ app (char 'm') @@
            union empty_str @@ app (char 'e') @@ char 'r')
          (app (char 'e') @@ app (char 'r') @@ app (char 'a') @@ app (char 's') @@ app (char 'e') @@
            (union empty_str @@ char 'r'))) @@
      Array.to_list @@ Array.init (String.length s) (String.get s)
  then "YES"
  else "NO"


Measured memory_bytes: 6400
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}



//head



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	rep(i, n-1) {
		for(int j = i+1; j < n; j++) {
			int k = 1;
			int h = j-i;
			while(~h&1) {
				h >>= 1;
				k++;
			}
			cout << k << (j == n-1?'\n':' ');
		}
	}
}

Measured memory_bytes: 3616
M,D = map(int,input().split())
D_array = list(map(int, str(D)))

ans = 0
for i in range(2,M+1):
  for d10 in range(2,int(D_array[0])+1):
    for d1 in range(2,10):
      if int(str(d10)+str(d1)) <= D:
        if int(d1)*int(d10) == i:
          ans += 1
print(ans)

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>

int main(){
	int n;
	scanf("%d",&n);
	double  sum = 0;
	for(int i = 0;i<n;i++){
		double x;
		char type[3];
		scanf("%lf %s",&x,type);
		if(type[0] == 'B'){
			sum += x*380000.0;
		}else{
			sum += x;
		}
	}
	printf("%lf\n",sum);
	return 0;
}


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

int main(){
  char a[3];
  for (int i=0; i<3; ++i) cin >> a[i];
  if (a[0]!=a[1] && a[1]!=a[2] && a[2]!=a[0]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
#define all(v) v.begin(), v.end()
#define prt(v) cout<<v<<"\n";
#define fi(v) get<0>(v)
#define se(v) get<1>(v)
#define th(v) get<2>(v)
#define endl "\n"
template <typename T> bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1000000007;

vector<ll> Eratosthenes( const ll N )
{
    std::vector<bool> is_prime( N + 1 );
    for( ll i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<ll> P;
    for( ll i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( ll j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}
signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vl A=Eratosthenes(60000);
    ll count=0;ll now=0;
    while(count<N){
        now++;
        while(A[now]%5!=3)now++;
        cout<<A[now]<<" ";
        count++;
    }cout<<endl;


    return 0;
}


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

int main(){
	int N, M;
	while(cin >> N >> M){
		priority_queue<int, vector<int>, less<int> > q;
		long long int sum = 0;
		for(int i=0; i<N; i++){
			int temp;
			cin >> temp;
			q.push(temp);
		}
		for(int i=0; i<M; i++){
			int temp = q.top();
			q.pop();
			temp /= 2;
			q.push(temp);
		}
		while(!q.empty()){
			sum += q.top();
			q.pop();
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3908
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
	static ArrayList<Integer> listX = new ArrayList<Integer>();
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		makePrimeList(104730);
		while(true) {
			int n = (int) sc.nextLong();
			if(n == 0) break;
			
			out.println(listX.get(n-1));
		}
		out.flush();
	}
	public static void makePrimeList(int n) {
		boolean[] isntPrime = new boolean[n];
		isntPrime[0] = isntPrime[1] = true;
		int sum = 2;
		listX.add(2);
		for(int i = 3; i < n; i+= 2) {
			if(!isntPrime[i]) {
				sum += i;
				listX.add(sum);
				for(int j = i + i; j < n; j+= i) {
					isntPrime[j] = true;
				}
			}
		}
	}

	
	
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

Measured memory_bytes: 19776
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	auto n = readln.chomp.to!int;
  while (n--) {
    auto x = readln.chomp.split(":").map!(to!double);
    auto diff = abs((x[0]+x[1]/60) * 30 - x[1] * 6);
    diff = min(diff, 360 - diff);
    if (diff < 30) {
      writeln("alert");
    } else if (diff < 90) {
      writeln("warning");
    } else {
      writeln("safe");
    }
  }
}

Measured memory_bytes: 1068
import java.util.Scanner;
public class Main {
	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		double r = sc.nextDouble();
		double menseki =r*r*3.1415926535897932384626433832795,enshu =r*2*3.1415926535897932384626433832795;
		System.out.printf("%.6f %.6f\n",menseki,enshu);
	}
}

Measured memory_bytes: 18960
# 371 ms, 27032 KB
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    q = int(input())
    b = []
    c = []

    for _ in range(q):
        bi, ci = list(map(int, input().split()))
        b.append(bi)
        c.append(ci)

    dic = {}
    for aa in a:
        dic[aa] = dic.get(aa, 0) + 1

    s = sum(a)
    for i in range(q):
        if b[i] not in dic:
            print (str(s))
            continue
        s += (c[i]-b[i]) * dic[b[i]]
        dic[c[i]] = dic.get(c[i], 0) + dic[b[i]]
        del dic[b[i]]
        print(s)

def main():
    solve()

if __name__ == "__main__":
    main()

Measured memory_bytes: 27212
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
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 fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#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 SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

int N, M;
vector<VI> G;
vector<VI> V;
vector<pii>ans;
VI out;

struct UnionFind {
	VI par;
	UnionFind(int _N) :par(_N) {
		REP(i, _N)par[i] = i;
	}
	int root(int x) {
		if (par[x] == x)return x;
		return par[x] = root(par[x]);
	}
	void unite(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		if (rx == ry)return;
		par[rx] = ry;
	}
	bool same(int x, int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};

void dfs(int now, int pa) {
	for (int to : V[now]) {
		if (pa != to)dfs(to, now);
	}
	if (pa == -1)return;

	if (out[now] % 2) {
		ans.push_back(pii(now, pa));
		out[now]++;
	}
	else {
		ans.push_back(pii(pa, now));
		out[pa]++;
	}
}


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


	map<pii, bool>mp;

	cin >> N >> M;
	UnionFind uni(N);
	G.resize(N);
	V.resize(N);
	out.resize(N);
	REP(i, N)out[i] = 0;
	REP(i, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	if (M % 2) {
		cout << -1 << endl;
		return 0;
	}

	REP(i, N) {
		REP(j, G[i].size()) {
			int x = i, y = G[i][j];
			if (!uni.same(x, y)) {
				uni.unite(x, y);
				V[x].push_back(y);
				V[y].push_back(x);
				mp[pii(x, y)] = true;
			}
			else {
				if (!mp[pii(x, y)] && !mp[pii(y, x)]) {
					ans.push_back(pii(x, y));
					out[x]++;
				}
				mp[pii(x,y)] = true;
			}
		}
	}
	dfs(0, -1);

	for (auto p : ans)cout << p.first + 1 << " " << p.second + 1 << endl;

	return 0;
}



Measured memory_bytes: 32880
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

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

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   ULL a,ans=1;
   cin >> a;
   for(int i=1;i<=a;i++) ans*=i;
   cout << ans << endl;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a, b, c=0, n, k;
string s,t;
//cout<<<<endl;


int main()
{
	cin >> n ;
	vector<int> h(n);
	rep(i, n)
		cin>> h.at(i);
	c = h[0]; int t = 0;
	rep(i, n)
	{
		if (h[i] >= c)
		{
			t++;
			c = h[i];
		}
	}
	cout << t << endl;	
}


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

#define SZ 8

int fld[SZ][SZ];

void func(int x, int y){
  fld[x][y] = 0;
//  cout << "bomb: (" << x << "," << y << ")" << endl;
  for (int xx=x-3; xx<=x+3; xx++){
    if (xx<0 || xx>=SZ) continue;
    if (fld[xx][y]) func(xx, y);
  }
  for (int yy=y-3; yy<=y+3; yy++){
    if (yy<0 || yy>=SZ) continue;
    if (fld[x][yy]) func(x, yy);
  }
}

int main(void){
  int numOfData;
  int x,y;
  char c;
  
  cin >> numOfData;
  for (int i=0; i<numOfData; i++){
    for (int j=0; j<SZ; j++){
      for (int k=0; k<SZ; k++){
        cin >> c;
        fld[k][j] = c-'0';
      }
    }
    cin >> x >> y;
    x--; y--;
    func(x, y);
    cout << "Data " << (i+1) << ":" << endl;
    for (int j=0; j<SZ; j++){
      for (int k=0; k<SZ; k++){
        cout << !!fld[k][j];
      }
      cout << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3024
/*..........AAKASH GOYAL............*/
/*............DAIICT................*/
 
#include <bits/stdc++.h>
using namespace std;

#define    int                      long long int

#define    f(i,j,n)                 for(int i = j; i <= n; i++)
#define    r(i,n,j)                 for(int i = n; i >= j; i--)
#define    mod                      1000000007
#define    speed                    ios_base::sync_with_stdio(false);
#define    upp                      cin.tie(NULL);
#define    pb                       push_back
#define    mp                       make_pair
#define    T                        int tt; cin >> tt; while(tt--)
#define    ff                       first
#define    ss                       second
#define    all(container)           container.begin() , container.end()
#define    sz(container)            (int)container.size()
#define    pii                      pair <int , int>
#define    ppi                      pair <int , pii>               
#define    sp(x)                    setprecision(x)

int32_t main()
{
    speed upp
    int a,b,c;
    cin>>a>>b>>c;
    if((a==b && a!=c) || (a==c && a!=b) || (b==c && b!=a))
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int abs(int n){
	if(n>0) return n;
	else return -n;
}

int main(void){
	int i,l,count;
	char S[100002];
	scanf("%s",S);
	
	l=strlen(S);
	count=0;
	for(i=0;i<l;i++){
		if(S[i]=='1') count++;
		else count--;
	}
	printf("%d",l-abs(count));
}

Measured memory_bytes: 256
def judge(A, B):
  i=0
  if len(A) != len(B):
    return False
  else:
    while i<len(A):
      if A[i] != B[len(B)-i-1]:
        return False
      i+=1
    return True

A=input()
B=input()
 
if judge(A, B):
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
import itertools

p = list(map(int,input().split()))
N = p[0]
M = p[1]
X = p[2]

l = [[int(i) for i in input().split()] for j in range(N)]

hoge = []
kouho = list(range(1,N+1))
for i in itertools.combinations_with_replacement(kouho, N):
    hoge.append(list(set(i)))

hoge = list(map(list, set(map(tuple, hoge))))
last_val = float('inf')
flag = False

for ls in hoge:
    ls = list(set(ls))
    ans = [0] * M
    val = 0
    for a in ls:# a = [1,2]ながさM
        for ix,i in enumerate(l[a-1][1:]):
            ans[ix] += i
        val += l[a-1][0]
    b = [i for i in ans if i >= X]
    if len(b) == len(ans):
        last_val = min(last_val, val)
        flag = True

if flag:
    print(last_val)
else:
    print(-1)


Measured memory_bytes: 178788
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		int q;
		double x0, y0, x1, y1, x2, y2, x3, y3;
		boolean flag;
		
		q = scan.nextInt();
		
		for(int i = 0; i < q; i++) {
			flag = false;
			
			x0 = scan.nextDouble();
			y0 = scan.nextDouble();
			x1 = scan.nextDouble();
			y1 = scan.nextDouble();
			x2 = scan.nextDouble();
			y2 = scan.nextDouble();
			x3 = scan.nextDouble();
			y3 = scan.nextDouble();
			
			if( ((y0 - y1) * (x2 - x0) - (x0 - x1) * (y2 - y0)) * 
				((y0 - y1) * (x3 - x0) - (x0 - x1) * (y3 - y0)) == 0
				&&
				((y2 - y3) * (x0 - x2) - (x2 - x3) * (y0 - y2)) *
				((y2 - y3) * (x1 - x2) - (x2 - x3) * (y1 - y2)) == 0) {
				
				if(x0 > x1) {
					double tmp = x0;
					x0 = x1;
					x1 = tmp;
				}
				if(y0 > y1) {
					double tmp = y0;
					y0 = x1;
					y1 = tmp;
				}
				
				if((x0 > x2 && x0 > x3) || (x1 < x2 && x1 < x3)) {
					System.out.println(0);
					
				} else if((y0 > y2 && y0 > y3) || (y1 < y2 && y1 < y3)) {
					System.out.println(0);
					
				} else {
					System.out.println(1);
					
				}
					
			} else if( ((y0 - y1) * (x2 - x0) - (x0 - x1) * (y2 - y0)) * 
				((y0 - y1) * (x3 - x0) - (x0 - x1) * (y3 - y0)) <= 0
				&&
				((y2 - y3) * (x0 - x2) - (x2 - x3) * (y0 - y2)) *
				((y2 - y3) * (x1 - x2) - (x2 - x3) * (y1 - y2)) <= 0) {
				System.out.println(1);
				
			} else {
				
				System.out.println(0);
			}
		}
		
		scan.close();
	}
}

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

using namespace std;

#define max(a,b) (a>b? a:b)
#define min(a,b) (a<b? a:b)
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define ONLINE_JUDGE

#pragma GCC Optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment (linker,"/stack:200000000")

typedef long long ll;

bool Finish_read;

template<class T>inline void read(T &x){Finish_read=0;x=0;T f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}

string str;
unsigned sum=700;

int main() {
    ios::sync_with_stdio(false);
    cin>>str;
    while(str.find("o")!=string::npos) {
        str[str.find("o")]='\0';
        sum+=100;
    }
    writeln(sum);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#define SWAP(type,a,b) do{type temp=a;a=b;b=temp;}while(0)
using namespace std;
int main(){
  int n[501],m[501][501],tmp[501];
  int nt,mt,a,b,sum=0;
  while(1){
    sum=0;
    for(int i=0;i<=500;i++){
      for(int j=0;j<=500;j++){
	m[i][j]=0;
      }
      n[i]=tmp[i]=0;
    }
      
    cin >> nt >> mt;
    if(nt==0&&mt==0)break;
    for(int i=0;i<mt;i++){
      cin >> a >> b;
      if(b<a)SWAP(int,a,b);

      if(a==1){
	n[b]=tmp[b]=1;
      }else{
	m[a][b]=1;
	m[b][a]=1;
      }
    }
    for(int i=2;i<=500;i++){
      if(n[i]==1){
	for(int j=2;j<=500;j++){
	  if(m[i][j]==1)tmp[j]=1;
	}
      }
    }
    for(int i=2;i<=500;i++){
      if(tmp[i]==1){
	sum++;
      }
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 2144
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;};
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];
void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);
  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n"); 
}
void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].l!=NIL) calcDepth(T[u].l , p+1);
  if(T[u].r!=NIL) calcDepth(T[u].r , p);
}
int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child;
      else T[sib].r = child;
      sib = child;
    }
  }
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  calcDepth(root, 0);
  for(i=0; i<n; i++) print(i);
  
  return 0;
}
  



Measured memory_bytes: 3268
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

int main() {
    long long n, m;

    std::cin >> n >> m;

    std::vector<long long> v(n);

    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }

    long long ans = 0;

    for (int i = 0; i < n - 1; i++) {
        if (v[i] > m) {
            ans += v[i] - m;
            v[i] = m;
        }
        if (v[i] + v[i + 1] > m) {
            ans += v[i] + v[i + 1] - m;
            v[i + 1] = m - v[i];
        }
    }

    std::cout << ans << std::endl;
    
    
    return 0;
}

Measured memory_bytes: 1152
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>

using namespace std;

using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;

#define ALL(v) v.begin(), v.end()
#define endl '\n'
#define SYNC ios_base::sync_with_stdio(false); cin.tie(NULL); cerr.tie(NULL);
#define REP(i , n) for(int i =0 ; i < n ;i++)
#define REPN(i , n) for(int i = 1; i <= n ; i++)
#define cot(x) cerr << #x << " " << x << " ";
#define cotd(x) cerr << #x << " " << x << endl;
#define her 	cerr << " here \n"; 
#define pp push_back
#define fi first 
#define se second
#define un(x) x.erase(unique(ALL(x)), x.end())

template<typename T > void check(T & a, const T & b) { if (a >= b) { a %= b; } }
template<typename T>T gcd(T u, T v) { if (u == v)return u; if (u == 0)return v; if (v == 0)return u; if (~u & 1) { if (v & 1) return gcd(u >> 1, v); else return gcd(u >> 1, v >> 1) << 1; }if (~v & 1)return gcd(u, v >> 1); if (u > v)return gcd((u - v) >> 1, v); return gcd((v - u) >> 1, u); }
LL mulmod(LL a, LL b, const LL & m) { LL q = (LL)(((LD)a*(LD)b) / (LD)m); LL r = a*b - q*m; if (r>m)r %= m; if (r<0)r += m; return r; }
template <typename T, typename S>T expo(T e, S n) { T x = 1, p = e; while (n) { if (n & 1)x = x*p; p = p*p; n >>= 1; }return x; }
template <typename T>T powerL(T e, T n, const T & m) { T x = 1, p = e; while (n) { if (n & 1)x = mulmod(x, p, m); p = mulmod(p, p, m); n >>= 1; }return x; }

int main(){
	SYNC; 
	int n , c, k; 
	cin >> n >> c >> k; 
	vi t(n); 

	REP(i , n){
		cin >> t[i]; 
	}

	sort(ALL(t)); 

	int ans = 0; int ptr = 0; 

	while(ptr < n){
		int i = ptr; int cnt = 0; 
		while(ptr < n && cnt < c && t[ptr] - t[i] <= k){
			ptr++; 
			cnt++; 
		}
		//cerr << i << " " << ptr << " " << cnt << endl; 
		ans++; 
	}

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

Measured memory_bytes: 640
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict

N, K, L = map(int, input().split())
G1 = [[] for i in range(N)]
for i in range(K):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    G1[p].append(q)
    G1[q].append(p)
gids = [0]*N
done = [False]*N
def dfs1(i, gid):
    gids[i] = gid
    done[i] = True
    for nex in G1[i]:
        if done[nex]: continue
        dfs1(nex, gid)
gid = 0
for i in range(N):
    if not done[i]:
        dfs1(i, gid)
        gid += 1

G = [[] for i in range(N)]
for i in range(L):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    G[r].append(s)
    G[s].append(r)
done = [False]*N
D = []
gid = 0
def dfs(i, gid):
    D[gid][gids[i]] += 1
    done[i] = True
    for nex in G[i]:
        if done[nex]: continue
        dfs(nex, gid)
for i in range(N):
    if not done[i]:
        D.append(defaultdict(int))
        dfs(i, gid)
        gid += 1
ans = [0]*N
done = [False]*N
gid = 0
def dfs2(i, gid):
    done[i] = True
    ans[i] = D[gid][gids[i]]
    for nex in G[i]:
        if done[nex]: continue
        dfs2(nex, gid)
for i in range(N):
    if not done[i]:
        dfs2(i, gid)
        gid += 1
print(*ans)


Measured memory_bytes: 118180
#include <stdio.h>
int main(void)
{
	int n;
	int a[10001];
	int max=-1000002;
	int min=1000002;
	int x;
	int y;
	long long z=0;

	scanf("%d", &n);
	for (x = 0; x < n; x++)
	{
		scanf("%d", &a[x]);
	}
	
	for (y=0; y < n ; y++ )
	{
		if (max<a[y])
		{
			max=a[y];
		}
		if (min>a[y])
		{
			min=a[y];
		}
		z=z+a[y];

	}

	printf("%d %d %lld\n", min, max, z);

	return 0;

}

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

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(v) (v).begin(),(v).end()
#define endl '\n'

using namespace std;

const int N = 2005;
const int MOD = 1e9 + 7;
const int INF = 2000000000;
const ll INFLL = 1LL * INF * INF;

int n, m, up[N][N], dw[N][N], lf[N][N], rg[N][N];
char a[N][N];
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
            if (a[i][j] != '#') up[i][j] = up[i - 1][j] + 1, lf[i][j] = lf[i][j - 1] + 1;
        }
    }
    for (int i = n; i >= 1; i--) {
        for (int j = m; j >= 1; j--) {
            if (a[i][j] != '#') dw[i][j] = dw[i + 1][j] + 1, rg[i][j] = rg[i][j + 1] + 1;
        }
    }
    int res = 0;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] != '#') res = max(res, up[i][j] + dw[i][j] + lf[i][j] + rg[i][j] - 3);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 66944
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
using P   = pair<ll, ll>;
using mat = vector<vector<ll>>;
typedef string::const_iterator State;
class ParseError {};

void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

const ll INF = 1e16;
const ll INM = 114514;
const ll MOD = 1e9 + 7;
const ld EPS = 1e-12;

template <typename T>
void dump(T x) { cout << x << endl; }
void dumpf(ld x, int t) { cout << setprecision(t) << fixed << x << endl; }
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
	fill((T *)array, (T *)(array + N), val);
}
inline ll mod(ll a, ll b) {
	if (a > 0) return a % b;
	if (a % b == 0) return 0;
	ll x = -a / b + 1;
	a += x * b;
	return a % b;
}
ll powm(ll a, ll b, ll c) {
	if (b == 0)
		return 1;
	else if (b % 2 == 0) {
		ll d = powm(a, b / 2, c);
		return (d * d) % c;
	} else
		return (a * powm(a, b - 1, c)) % c;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};

int main() {
	IOS();
	ll a;
	cin >> a;
	dump(a * a * 3);
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

public class S
{

    private const long DP_INIT_MINUS1 = -1;
	private const long MOD = 1000000007;

    private static double[,] dp;


    public static void Main()
	{
		/*
        var input = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        var N = input[0];
        var M = input[1];
        */

        solver(int.Parse(Console.ReadLine()), Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse));
    }

    public static void solver(int N, double[] coins){

        /*
            たぶんdp[N][N]
            [枚数][ここまでの表枚数]

            ある時点でのコイン枚数xについて、
            ここまでの表の枚数がy,x枚目のコインの表率をpとしたとき
            dp[x][y]は
            ・dp[x-1][y]*(1-p)、裏で変動しないことによるもの
            ・dp[x-1][y-1]*p、表による変動、1枚前の表枚数-1から遷移する
            この二つの合計値になる
            
        
         */

        dp = new double[N+1,N+1];
        
        // i: コイン枚数
        for(int i = 0; i <=N; i++){
            
            // k: 表枚数
            for(int k = 0; k <=N; k++){
                if(i == 0){
                    dp[i,k] = k == 0 ? 1 : 0;
                    continue;
                }

                // すべて裏
                if(k == 0){
                    dp[i,k] = dp[i-1,k] * (1-coins[i-1]);
                    continue;
                }

                dp[i,k] = (dp[i-1,k-1] * coins[i-1]) + (dp[i-1,k] * (1-coins[i-1]));
            }

        }



        
        double sum = 0.0;

        for(int k = (N/2) + 1; k <= N; k++){
            sum += dp[N,k];
        }

        Console.WriteLine(sum);


    }

}

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

const int INF = 1000002020;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main(){
  int h, w;
  cin >> h >> w;
  int ans = 0;
  vector<string> s(h);
  rep(i, h) cin >> s[i];
  rep(ci, h)rep(cj, w){
    if(s[ci][cj] == '#') continue;
    vector<vector<int>> dist(h, vector<int>(w, INF));
    queue<P> q;
    auto update = [&](int i, int j, int x){
      if(dist[i][j] != INF) return;
      dist[i][j] = x;
      q.push(P(i,j));
    };
    update(ci, cj, 0);
    while(!q.empty()) {
      int i = q.front().first;
      int j = q.front().second; q.pop();
      rep(d, 4){
        int ni = i + di[d], nj = j + dj[d];
        if(ni<0 || ni>= h || nj < 0 || nj >= w ) continue;
        if(s[ni][nj] == '#') continue;
        update(ni, nj, dist[i][j]+1);
      }
    }
    rep(i ,h)rep(j, w){
      if(dist[i][j] == INF)continue;
      ans = max(ans, dist[i][j]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
  	cin >> s;
  	int cnt0 = 0;
  	int cnt1 = 0;
  	for (auto &c : s) {
      	if (c == '0') {
          	++cnt0;
        } else {
          	++cnt1;
        }
    }
  	cout << 2 * min(cnt0, cnt1) << endl;
  	return 0;
}

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

using namespace std;

int main()
{
    string S[3];
    for (string &s: S)
        cin>>s;
    int c = 0;
    while (true)
    {
        if (S[c].empty())
            break;
        char t = S[c][0];
        S[c].erase(S[c].begin());
        c = t-'a';
    }
    cout<<"ABC"[c]<<endl;
}


Measured memory_bytes: 384
using System;
class Program
{
    static void Main(string[] args)
    {
        while (true)
        {
            char[] data = Console.ReadLine().ToCharArray();
            if (data[0] == '0') break;
            int sum = 0;
            for (int i = 0, count = data.Length; i < count; i++)
            {
                sum += (int)Char.GetNumericValue(data[i]);
            }
            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 5620
def main():
    import sys
    input=sys.stdin.readline
    s=input()
    alpha="abcdefghijklmnopqrstuvwxyz"
    l=len(s)
    alpha2={j:i for i,j in enumerate(alpha)}
    memo=[[0]*26 for _ in range(l,-1,-1)]
    for i in range(26):
        memo[l][i]=l+1
    for i in range(l-1,-1,-1):
        for x,y in alpha2.items():
            if s[i]==x:
                memo[i][y]=i+1
            else:
                memo[i][y]=memo[i+1][y]
    
    search=[1]*(l+2)
    search[l+1]=0
    for i in range(l-1,-1,-1):
        m=max([memo[i][j] for j in range(26)])
        if m!=l+1:
            search[i]=search[m]+1
    
    n,seq=0,0
    ans_len=search[0]
    ans=""
    temp=0
    for i in range(ans_len):
        for j in range(26):
            n=memo[temp][j]
            seq=search[n]+i
            if seq+1==ans_len:
                ans+=alpha[j]
                temp=memo[temp][j]
                break
    print(ans)
if __name__=='__main__':
    main()

Measured memory_bytes: 75276
a, b = map(int, input().split())
if b > 0 and a < 0:
    ans = 2
elif b <= 0:
    if b == 0:
        ans = 2
    else:
        ans = (a - b) % 2
else:
    if b == 0:
        ans = 2
    else:
        ans = 1
if ans == 0:
    print("Negative")
elif ans == 1:
    print("Positive")
else:
    print("Zero")

Measured memory_bytes: 3572
fun main(args: Array<String>) {
    val s = readInputLine().toCharArray()
    
    var isCDetected = false
    
    for (c in s) {
        if (c == 'C') {
            isCDetected = true
        }
        if (c == 'F' && isCDetected) {
            println("Yes")
            return
        }
    }
    
    println("No")
}
 
fun readInputLine(): String {
    return readLine()!!
}


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

const ll INF = 1LL << 60;
const int MOD = 1e9 + 7;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, b, e) for (int i = (b); i <= (e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

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

    multimap<ll, ll> m;
    REP(i, N) {
        ll tmp1, tmp2;
        cin >> tmp1; cin >> tmp2;
        m.emplace(tmp1, tmp2);
    }

    ll cnt = 0;
    ll ans = 0;
    for (auto e : m) {
        if (cnt + e.second <= M) {
            cnt += e.second;
            ans += e.first * e.second;
        } else {
            ans += e.first * (M - cnt);
            break;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6528
a,b,c=[int(i) for i in input().split()]

num=0
#s=[i for i in range(1,c+1) if c%i==0]
# print(s)

for i in range(1,c+1):
    if c%i==0:
        if i>=a and i<=b:
            num=num+1
print(num)

Measured memory_bytes: 7756
// C.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int dp[2] = {};
	for (char c : s) {
		int a = dp[0], b = dp[1];
		if (c == '.') {
			dp[0] = a;
			dp[1] = b + 1;
		} else {
			dp[0] = a + 1;
			dp[1] = min(a, b);
		}
	}
	int ans = min(dp[0], dp[1]);
	cout << ans << endl;
}


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

vector<int> p;
vector<int> rank;

int find(int x){
  if(x != p[x]){
    p[x] = find(p[x]);
  }
  return p[x];
}

void link(int x, int y){
  if(rank[x] > rank[y]){
    p[y] = x;
  }else{
    p[x] = y;
    if(rank[x] == rank[y]){
      rank[y]++;
    }
  }
}
void unite(int x, int y){
  link(find(x), find(y));
}
bool same(int x, int y){
  return find(x) == find(y);
}

int main(void){
  int n, q;
  cin >> n >> q;
  p.resize(n, 0);
  rank.resize(n, 0);
  for(int i=0; i < n; i++){ p[i] = i; rank[i] = 0; }
  while(q--){
    int com, x, y; cin >> com >> x >> y;
    if(com == 0) unite(x, y);
    else{
      if(same(x, y)) cout << 1 << endl;
      else cout << 0 << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1280
#include <stdio.h>

int main(){
    int num1, num2, num3, num4;

    scanf("%d %d %d", &num1,&num2,&num3);

    num4 = num2 / num1;

    if(num4 >= num3) {
        printf("%d",num3);
    }else{
        printf("%d",num4);
    }
}

Measured memory_bytes: 128
n = int(input())
a = [tuple(map(int, input().split())) for _ in range(n)]

s = set(map(lambda x: sum(map(abs, x)) % 2, a))
if len(s) >= 2:
    print(-1)
    exit()

if next(iter(s)) == 0:
    m = 33
else:
    m = 32

d = [2 ** i for i in range(32)]
if m > len(d):
    d.append(1)

print(m)
print(*d)

def fetch(x, y, i=31):
    if i == 0:
        return {(1, 0): 'R', (-1, 0): 'L', (0, 1): 'U', (0, -1): 'D'}[(x, y)]
    if abs(x - d[i]) + abs(y) < d[i]:
        return fetch(x - d[i], y, i - 1) + 'R'
    if abs(x + d[i]) + abs(y) < d[i]:
        return fetch(x + d[i], y, i - 1) + 'L'
    if abs(y - d[i]) + abs(x) < d[i]:
        return fetch(x, y - d[i], i - 1) + 'U'
    if abs(y + d[i]) + abs(x) < d[i]:
        return fetch(x, y + d[i], i - 1) + 'D'

for x, y in a:
    if m == 33:
        print(fetch(x + 1, y) + 'L')
    else:
        print(fetch(x, y))

Measured memory_bytes: 48220
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

std::vector<std::pair<int64_t, int64_t>> FactorizeIntoPrimeFactors(const int64_t N) {
  std::vector<std::pair<int64_t, int64_t>> result;
  if (N <= 0LL || N == 1LL) {
    return result;
  }
  int64_t remaining = N;
  for (int64_t i = 2LL; i * i <= remaining; ++i) {
    int64_t count = 0LL;
    while (remaining % i == 0LL) {
      ++count;
      remaining /= i;
    }
    if (count > 0LL) {
      result.push_back(std::pair<int64_t, int64_t>(i, count));
    }
  }
  if (remaining > 1) {
    result.push_back(std::pair<int64_t, int64_t>(remaining, 1));
  }
  return result;
}

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

  // const int64_t L = static_cast<int64_t>(T.length());
  int64_t N;
  cin >> N;
  std::vector<std::pair<int64_t, int64_t>> factors = FactorizeIntoPrimeFactors(N);

  constexpr int64_t kLim = 256;
  vector<int64_t> lookup(kLim + 1);
  lookup[0] = 0;
  for (int64_t i = 1; i <= kLim; ++i) {
    lookup[i] = lookup[i - 1] + i;
  }

  // for(int32_t i=0; i<static_cast<int32_t>(factors.size()); ++i) {
  //   cout << factors[i].first << ", " << factors[i].second << endl;
  // }
  int64_t count = 0;
  int64_t prime_count = static_cast<int64_t>(factors.size());
  for (int64_t prime_index = 0; prime_index < prime_count; ++prime_index) {
    // const int64_t prime = factors[prime_index].first;
    const int64_t prime_count = factors[prime_index].second;
    for (int64_t sub_count = 1; sub_count < kLim; ++sub_count) {
      if (lookup[sub_count] <= prime_count && prime_count < lookup[sub_count + 1]) {
        count += sub_count;
        break;
      }
    }
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")
int main(){

   // freopen("input.txt","r",stdin);	
    IOS;
    clock_t clk = clock();
    ll n;cin>>n;

    n = (n*(n-1))/2;
    cout<<n;   



    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


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

int main() {
  string s;
  cin >> s;
  
  bool ans = true;
  
  if(s.at(0) != 'A') ans = false;
  
  int i, count = 0, keep;
  for(i = 2; i < s.size() - 1; i++){
    if(s.at(i) == 'C'){
      count++;
      keep = i;
    }
  }
  
  if(count != 1) ans = false;
  
  for(i = 1; i < s.size(); i++){
    if(i != keep){
      if(s.at(i) >= 'A' && s.at(i) <= 'Z'){
        ans = false;
      }
    }
  }
  
  if(ans) cout << "AC"<< endl;
  else cout << "WA" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<vector<int>> A(N,vector<int>(3)),h(N,vector<int>(3));
  for(int i = 0; i < N; ++i) cin >> A[i][0] >> A[i][1] >> A[i][2];
  for(int i = 0; i < 3; ++i) h[0][i] = A[0][i];
  for(int i = 1; i < N; ++i){
    h[i][0] = A[i][0] + max(h[i-1][1],h[i-1][2]);
    h[i][1] = A[i][1] + max(h[i-1][0],h[i-1][2]);
    h[i][2] = A[i][2] + max(h[i-1][0],h[i-1][1]);
  }
  cout << *max_element(begin(h[N-1]),end(h[N-1]));
  return 0;
}

Measured memory_bytes: 11136
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
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;
}

double dp[302][302][302];

int main() {
    int n;
    cin >> n;
    vi a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    map<int, int> sushi;
    for (int i = 0; i < n; ++i) {
        sushi[a[i]]++;
    }
    for (int z = 0; z <= n; ++z) {
        for (int y = 0; y <= n; ++y) {
            for (int x = 0; x <= n; ++x) {
                if (x + y + z == 0)
                    continue;
                double expeat = double(n) / double(x + y + z);
                dp[x][y][z] += expeat;
                if (x > 0)
                    dp[x][y][z] += (dp[x - 1][y][z]) * double(x) / double(x + y + z);
                if (y > 0)
                    dp[x][y][z] += (dp[x + 1][y - 1][z]) * double(y) / double(x + y + z);
                if (z > 0)
                    dp[x][y][z] += (dp[x][y + 1][z - 1]) * double(z) / double(x + y + z);
            }
        }
    }

    cout << fixed << setprecision(14) << dp[sushi[1]][sushi[2]][sushi[3]] << "\n";
    return 0;
}

Measured memory_bytes: 215296
int main() {
    int i,red,green,blue,k;
    scanf("%d%d%d",&red,&green,&blue);
    scanf("%d",&k);

    for(i=0;i<k;i++){
        if(blue<=green){
            blue*=2;
        }else if(green<=red){
            green*=2;
        }else{
            blue*=2;
        }
    }
    if(green>red && blue>green){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

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

int main(){
	int h, w, k;
	cin >> h >> w >> k;
	
	vector<vector<char>> c(h, vector<char>(w));
	int black = 0;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
			if (c[i][j] == '#') black++;
		}
	}
	/*
	vector<int> l(h, 0), r(w, 0);
	rep(i, h) {
		rep(j, w) {
			if (c[i][j] == '#') {
				l[i]++;
				r[j]++;
			}
		}
	}
	*/
	int cnt = 0;
	for (int bitl = 0; bitl < (1<<h); bitl++) {
		bitset<6> sl(bitl);
		for (int bitr = 0; bitr < (1<<w); bitr++) {
			bitset<6> sr(bitr);
			
			int bcnt = black;
			rep(i, h) {
				rep(j, w) {
					if (sl.test(i) || sr.test(j)) {
						if (c[i][j] == '#') bcnt--;
					}
				}
			}
			if (bcnt == k) cnt++;
		}
	}
	
	cout << cnt << endl;
}


Measured memory_bytes: 3624