akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<int> D(N);
  rep(i,N) cin>>D[i];

  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      ans+=D[i]*D[j];
    }
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
import Foundation
var inl=readLine()!.components(separatedBy:" ")
var n=Int(inl[0])!
var a=Int(inl[1])!
var b=Int(inl[2])!
var c=a+b
var s=0
s+=(n/c)*a
if(n%c>a){
  s+=a
}else{
  s+=n%c
}
print(s)

Measured memory_bytes: 14176
#include <bits/stdc++.h>
#define first "First"
#define second "Second"
using namespace std;
const int maxN = 1e2+2;
const int maxK = 1e5+5;
int N, K;
int a[maxN];
bool f[maxK];
int main() {
    cin >> N >> K;
    for(int i = 1; i <= N; ++i) cin >> a[i];
    memset(f, false, sizeof(f));
    for(int i = 1; i <= K; ++i)
        for(int j = 1;j <= N; ++j)
            if (i - a[j] >= 0) f[i] |= !f[i-a[j]];
    puts(f[K]?first:second);
}


Measured memory_bytes: 384
N,M = map(int,input().split())

AB = [list(map(int,input().split())) for i in range(N)]
AB.sort()
ans = 0
for _ in range(N):
    if AB[_][1] >= M:
        ans += AB[_][0]*M
        break
    else:
        ans += AB[_][0]*AB[_][1]
        M -= AB[_][1]
print(ans)

Measured memory_bytes: 27756
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
typedef long long ll;
string S;

int main(){
	cin >> S;

	if((S.size()%2 == 0) != (S[0] == S[S.size()-1]))
		cout << "Second" << endl;
	else
		cout << "First" << endl;
	return 0;
}


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

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcount //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
signed main()
{
    rootdada;

    int n;
    cin >> n;
    int l = n % 10;
    if (l == 2 || l == 4 || l == 5 || l == 7 || l == 9)
        cout << "hon" << endl;
    else if (l == 0 || l == 1 || l == 6 || l == 8)
        cout << "pon" << endl;
    else
    {
        cout << "bon" << endl;
    }
}

Measured memory_bytes: 3652
#include <iostream>

int main(){
  int h, w;
  while(1){
    std::cin >> h >>  w;
    if(h==0 && w == 0)
      return 0;
    for(int i=0; i<h; i++){
      for(int j=0; j<w; j++){
        if(i == 0 || i == h-1 || j == 0 || j == w-1)
          std::cout << '#';
        else
          std::cout << '.';
      }
      std::cout << '\n';
    }
    std::cout << '\n';
  }
  return 0;
}



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

int main() {
  int N, A, count, min = 10000;
  cin >> N;
  for ( int i = 0; i < N; i++ ) {
    cin >> A;
    count = 0;
    while ( A % 2 == 0 ) {
      A /= 2;
      count++;
    }
    if ( min > count )
        min = count;
  }
  cout << min << endl; 
}


Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    n, k = map(int, input().split())
    cnt = 0
    for b in range(k + 1, n + 1):
        cnt += count_a(n, k, b)
    print(cnt)

def count_a(n, k, b):
    assert b > k
    fulls = (n + 1) // b
    rest = (n + 1) % b
    cnt = fulls * (b - k)
    cnt += max(0, rest - k)
    if k == 0:
        cnt -= 1
    return cnt

main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

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

    ll Q;
    cin >> Q;
    priority_queue<ll> basic;
    priority_queue<ll, vector<ll>, greater<ll>> apply;
    basic.push(-inf);
    apply.push(inf);
    ll f = 2*inf, x = -inf, pre;
    while (Q--) {
        ll q;
        cin >> q;
        if (q == 1) {
            ll a, b;
            cin >> a >> b;

            pre = x;

            basic.push(a);
            f += abs(x-a) + b;

            ll c = basic.top();
            ll d = apply.top();
            if (c > d) {
                basic.pop(); apply.pop();
                apply.push(c); basic.push(d);
            }

            if (basic.size() == apply.size() + 2) {
                apply.push(basic.top());
                basic.pop();
            }

            x = basic.top();
            f -= (x-pre) * (basic.size() != apply.size());

        } else {
            cout << x << " " << f - 2*inf << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 3828
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    n = ni()
    a = nl()
    g = [1000] * (n+1)
    for i in range(n):
        g[i+1] = max(g[i], max(g[j+1]//a[j]*a[i] + g[j+1]%a[j] for j in range(i+1)))
    print(g[-1])
    return

solve()


Measured memory_bytes: 9204
N = int(input())
C = []
S = []
F = []

for i in range(N-1):
    c,s,f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

# ci : i -> i+1
# fi : frequency of departure from i-th station
# si : first train time. sec from start.
res = []

for i in range(N-1):
    total = S[i] + C[i]
    for j in range(i+1, N-1):
        if total < S[j]:
            total = S[j] + C[j]
        elif (total - S[j]) % F[j] == 0:
            total += C[j]
        else:
            total += F[j] - (total % F[j])
            total += C[j]
    res.append(total)

res.append(0)

print("\n".join([str(e) for e in res]))

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int N, M;
    cin >> N;
    map<string, int> mapsi;
    for (int n = 0; n < N; ++n) {
        string tmp;
        cin >> tmp;
        ++mapsi[tmp];
    }
    cin >> M;
    for (int m = 0; m < M; ++m) {
        string tmp;
        cin >> tmp;
        --mapsi[tmp];
    }
    int Res = 0;
    for (auto tmp: mapsi) {
        if (tmp.second > 0) Res = max(Res, tmp.second);
    }
    cout << Res << "\n";

    return 0;
}


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

four = [4*i for i in range(26)]
seven = [7*i for i in range(15)]

exist = False
for f in four:
    for s in seven:
        sm = f+s
        if sm == N:
            exist = True
            
if exist:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.math;

void main() {
    int a, b, c, x, y;
    scan(a, b, c, x, y);

    int ans = 1<<30;

    foreach (i ; 0 .. 2 * 10^^5 + 1) {
        int xr = max(0, x - i / 2);
        int yr = max(0, y - i / 2);
        int tmp = xr * a + yr * b + i * c;
        ans = min(ans, tmp);
    }

    writeln(ans);
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    string a;
    cin>>a;
    for(register int i=0;i<a.size();i++)
    {
        if(a[i]=='C')
        for(register int j=i+1; j<=a.size(); j++)
        if(a[j]=='F')
        {
            cout<<"Yes";
            return 0;
        }
    } 
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
// 
#include <bits/stdc++.h>
using namespace std;
#define ll 		long long int
#define pii 	pair<int,int>
#define vi 		vector<int>
#define mii 	map<int,int>
#define pb 		push_back
#define mp 		make_pair
#define ff 		first
#define ss 		second
#define MOD 	1000000007
 
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin>>n;
	int a[n],i;
	for(i=0;i<n;i++)
		cin>>a[i];

	if(n==1)
		return 0;
	int dp[n]={0};
	dp[1]=abs(a[1]-a[0]);
	for(i=2;i<n;i++)
		dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);

	cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

    	sc.close();
	}
}

Measured memory_bytes: 76124
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    struct P
    {
        public int left;
        public int sq;
        public P(int left,int sq)
        {
            this.left = left;
            this.sq = sq;
        }
    }
    static void Main(string[] args)
    {
        var str = ReadLine();
        var stack = new Stack<int>();
        var sum = 0;
        var stack2 = new Stack<P>();
        for(var i = 0; i < str.Length; i++)
        {
            var s = str.Substring(i, 1);
            switch (s)
            {
                case "\\":
                    stack.Push(i);
                    break;
                case "/":
                    if (stack.Count == 0) break;
                    var p = stack.Pop();
                    sum += i - p;
                    var then = i - p;
                    while (stack2.Count!=0&&stack2.Peek().left > p)
                        then += stack2.Pop().sq;
                    stack2.Push(new P(p, then));
                    break;
            }
        }
        var list = stack2.Select(p => p.sq).Reverse().ToArray();
        if (list.Length != 0)
            WriteLine($"{sum}\n{list.Length} {string.Join(" ", list)}");
        else
            WriteLine($"0\n0");
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}



Measured memory_bytes: 18888
use std::io::*;
use std::str::*;

// const MOD: i32 = 1000000007;

fn read<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let s = stdin
        .bytes()
        .map(|c| c.unwrap() as char)
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok()
}

fn main() {
    let n: usize = read().unwrap();
    let m: usize = read().unwrap();
    let x: usize = read().unwrap();

    let mut l = 0;
    let mut r = 0;
    for i in 0..m {
        let tmp: usize = read().unwrap();
        if tmp > x {
            r += 1;
        }
        if tmp < x {
            l += 1;
        }
    }
    println!("{}",
             std::cmp::min(r, l)
             );
}


Measured memory_bytes: 4352
n = int(input())
la = list(map(int, input().split()))
MOD = (10**9+7)
ans = 0
nn = 0
for i in range(n):
  ans %= MOD
  ans += la[i]%MOD
  nn %= MOD
  nn += (la[i]**2)%MOD
ans = (ans**2-nn+10**9+7)*pow(2, -1, MOD)%MOD
print(ans)

Measured memory_bytes: 31384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)

int main(){
	string s;cin>>s;
	int n=s.size();

	int l[n+1]={},r[n+1]={};

	for(int i=0;i<n;i++) if(s[i]=='<') l[i+1]=l[i]+1;
	for(int i=n-1;i>=0;i--) if(s[i]=='>') r[i]=r[i+1]+1;
/*
	rep(i,n+1) cout<<max(l[i],r[i])<<" ";
	cout<<"\n";
*/
	ll ans=0;
	rep(i,n+1) ans+=max(l[i],r[i]);

	cout<<ans<<"\n";

}

Measured memory_bytes: 4740
import numpy as np

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

b = np.array(a)
c = np.count_nonzero(b)
if len(b) != c:
    print(0)
    exit()
ans = 1

for i in a:
    if i == 0:
        print(0)
        exit()
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()

print(ans)

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

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

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

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

    if (N >= 2 && M >= 2) {
        cout << (N - 2) * ll(M - 2) << "\n";
        return 0;
    }

    if (N > M) swap(N, M);
    assert(N == 1);

    if (M == 1) cout << "1\n";
    else cout << M - 2 << "\n";

    return 0;
}



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

int main(){
    string S;
    cin >> S;
    if(S.size() == 2){
        cout << S << endl;
    }else{
        cout << S[2] << S[1] << S[0] << endl;
    }
   
}


Measured memory_bytes: 256
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*
import kotlin.comparisons.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt()
    val v = readListOfDouble().sorted()

    val ans = v.reduce { v1, v2 -> (v1 + v2) / 2.0 }
    println(ans)
    
    pw.flush()
}

/****** Declared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % MOD
        }
    }
    return v.map { it.toList() }.toList()
}

// should be a >= b
fun gcd(a: Long, b: Long): Long = 
    if(b == 0L) a else gcd(b, a % b)

// shoud be a >= b
fun lcm(a: Long, b: Long): Long = 
    a / gcd(a, b) * b

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


Measured memory_bytes: 36120
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define hetu int t;cin >> t;while(t--) 

void solve()
{
    int  n,x,t;
    cin >> n >> x >> t;
    int  ans=0;
    int temp=0;
    while(1)
    {
        if(temp>=n)
        break;
        else
        {
            temp+=x;
            ans+=t;
        }
    }
    cout << ans << endl;

}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    //hetu
    solve();
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;
typedef long long int ll;

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int n, m;
  cin >> n >> m;
  P(n * (n - 1) / 2 + m * (m - 1) / 2);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/rope>
using namespace __gnu_cxx;
using namespace std;
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int, int>
#define debug(a) cout << #a": " << a << endl;
#define eularMod(a, b) a < b ? a : a % b + b
inline int lowbit(int x){ return x & -x; }
typedef long long LL;
typedef unsigned long long ULL;
const int N = 1e5 + 10;
const int mod = (int) 1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const double eps = 1e-6;

int k;
int dis[N];
bool inq[N];

int cal(int x) {
    int res = 0;

    for (; x; x /= 10)
        res += x % 10;

    return res;
}

queue<int> Q;

void spfa() {
    mst(dis, 0x3f);

    dis[1] = 1;
    inq[1] = true;

    Q.push(1);

    for (;!Q.empty();) {
        int u = Q.front();
        Q.pop();

        inq[u] = false;

        int v = (u + 1) % k;

        if (dis[v] > dis[u] + 1) {
            dis[v] = dis[u] + 1;

            if (!inq[v])
                Q.push(v);
        }

        v = (u * 10) % k;

        if (dis[v] > dis[u]) {
            dis[v] = dis[u];

            if (!inq[v])
                Q.push(v);
        }
    }
}

int main() {
#ifdef purple_bro
    freopen("in.txt", "r", stdin);
//    freopen("out.txt","w",stdout);
#endif
    scanf("%d", &k);

    spfa();

    printf("%d\n", dis[0]);
    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{   
    int N; cin>>N;
    vint a(N);
    REP(i,N) cin>>a[i];

    int ans=0;
    for(int i=0,j=i;i<N;i=j){
        while(j<N and a[i]==a[j]) j++;
        ans+=(j-i)/2;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
//2020-08-27, Thu

#include<iostream>
using namespace std;

int main(){
    int n, ans = 0;
    cin >> n;
    int a[n];

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    while (1) {
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) {
                a[i] /= 2;
                count++;
            }
        }
        
        if (count == n) {
            ans++;
        } else {
            break;
        }
        
    }
    
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3556
#include<cstdio>
int main()
{
	int n,a,b;
	scanf("%d",&n);
	if (n == 1) printf("Hello World\n");
	else if (n == 2){ 
		scanf("%d",&a);
		scanf("%d",&b);
		printf("%d\n",a + b);}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
//#include <bits/stdc++.h>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
//#define int ll
typedef long long ll;

//const int MOD = 1000000007;
//const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "Yes" : "No";
}

int main(){
    string s; cin >> s;
    
    int a= -1,b= -1;
    rep(i,s.size()-1){
        if(s.size() == 2 and s[0] == s[1]){
            a = 1;
            b = 2;
            break;
        }
        if(s[i] == s[i+1] or s[i] == s[i+2]){
            if(i != s.size()-2) {
                a = i+1;
                b = i+3;
            }
            else{
                a = i;
                b = i+2;
            }
            break;
        }
           
    }
    
    cout << a << " " << b << endl;
}





Measured memory_bytes: 512
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int i = 1;
		int x;

		while(i<=n){
			x = i;
			if(x%3==0){
				System.out.print(" "+i);
				i++;
				continue;
			}
			while(x!=0){
				if(x%10==3){
					System.out.print(" "+i);
					break;
				}
				x /= 10;
			}
			i++;
		}
		System.out.println();
	}
}

Measured memory_bytes: 28708
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){if(y==0)return 1;int ret=modpow(x,y>>1,md);ret=(ll)ret*ret%md;if(y&1)ret=(ll)ret*x%md;return ret;}
int n;
int d[100005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>d[i];
	sort(d+1,d+n+1);
	int dif=d[n/2+1]-d[n/2];
	cout<<dif<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main(void){
	double ax,ay,bx,by,cx,cy,a,b,c,z,s=0;
	scanf("%lf,%lf",&ax,&ay);
	scanf("%lf,%lf",&bx,&by);
	while(scanf("%lf,%lf",&cx,&cy)!=EOF){
		a=sqrt((bx-cx)*(bx-cx)+(by-cy)*(by-cy));
		b=sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
		c=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
		z=(a+b+c)/2;
		s+=sqrt(z*(z-a)*(z-b)*(z-c));
		bx=cx;by=cy;
	}
	printf("%.9lf\n",s);
	return 0;
}

Measured memory_bytes: 656
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d; 
int h;
int main() {
  cin>>a>>b;
  c=__gcd(a,b);
  d=sqrt(c);
  for(int i=2;i<=d;i++){
    if(c%i==0){
      while(c%i==0)
        c=c/i;
      h++;
    }
  }
  if(c!=1)
    h++;
  cout<<h+1;
}


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

int main(void){
  while(1){
    int H,W;
    cin>>H>>W;
    if(H==0&&W==0)break;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        cout<<"#";
      }cout<<endl;
    }
    cout<<endl;
  }
}



Measured memory_bytes: 3088
import java.util.*;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = Long.parseLong(sc.next().replace(".", ""));
        System.out.println(a * b / 100);
    }
}

Measured memory_bytes: 27036
#include <stdio.h>

int main(){
	int A, B, K, i;
	scanf("%d%d%d", &A, &B, &K);
	for(i = 0; i < K; i++){
		if(i % 2 == 0){
			A /= 2;
			B += A;
		}
		else{
			B /= 2;
			A += B;
		}
	}
	printf("%d %d\n", A, B);
	return 0;
}

Measured memory_bytes: 128
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.math;
import std.regex;
import std.range;

void main() {
	auto w = readln.chomp.to!(dchar[]);
	auto s = w.sort().uniq;
	foreach(s_i; s) {
		if(w.count(s_i) % 2 == 1) {
			"No".writeln;
			return;
		}
	}
	"Yes".writeln;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
S = str(input())
S += "x"*4001
c = Counter(S)
after_happen = {}
after_happen[0] = c.copy()
after_happen[0][S[0]] -= 1

for i in range(1, N):
    after_happen[i] = after_happen[i-1].copy()
    after_happen[i][S[i]] -= 1
# print(after_happen)
ans = 0
rgb = set(["R", "G", "B"])
for i in range(N-2):
    for j in range(i+1, N-1):
        # 同じ文字ならcontinue
        if S[i] == S[j]:
            continue
        # jより後ろにtargetがいくつ存在するか確認する, after_happen[j] := jより後ろの情報
        target = rgb - set([S[i], S[j]])
        target = list(target)[0]
        ans += after_happen[j][target]
        if S[j+(j-i)] == target:
            ans -= 1
print(ans)


Measured memory_bytes: 70812
s=list(input())

length1 = int((len(s)-1)/2-1)
length2 = int((len(s)+3)/2-1)

if s == list(reversed(s)) and s[:length1+1] == list(reversed(s[:length1+1])) and s[length2:] == list(reversed(s[length2:])):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<functional>
#include<map>
#include<iomanip>
#include<limits>
#include<queue>
#include<set>
#include<cstdio>
#include<climits>
#include<cstring>

using namespace std;

int main(){

    int N,Y;
    cin >> N >> Y;

    int res10000 = -1;
    int res5000  = -1;
    int res1000  = -1;

    for(int a = 0;a <= N;a++){
    	for(int b = 0;b <= N-a;b++){
    	     int c = N - a - b;
    		 if(10000*a + 5000*b + 1000*c == Y){
    			  res10000 = a;
    			  res5000  = b;
    			  res1000  = c;
    			  break;
    		 }
    	}
    }

    cout << res10000 << " " << res5000 << " " << res1000 << endl;

    return 0;

}


Measured memory_bytes: 256
/***************************************************
 * Problem Name : Iroha and Haiku.cpp
 * Problem Link :
 * OJ           :
 * Verdict      : Trying
 * Date         : 2019-11-17
 * Problem Type :
 * Author Name  : Saikat Sharma
 * University   : CSE, MBSTU
 ***************************************************/
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <list>
#include <unordered_map>
#include <unordered_set>
#include <cstdlib>
#include <deque>
#include <stack>
#include <bitset>
#include <cassert>
#include <map>
#include <set>
#include <cassert>
#include <iomanip>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;

#define __FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define __FileRead freopen ("input.txt", "r", stdin)
#define __FileWrite freopen ("output.txt", "w", stdout)
#define SET(a,v) memset(a,v,sizeof(a))
#define SZ(v) (int)v.size()
#define pii pair<int,int>
#define pil pair <int, ll>
#define pli pair <ll, int>
#define pll pair <ll, ll>
#define debug cout <<"######\n"
#define debug1(x) cout <<"### " << x << " ###\n"
#define debug2(x,y) cout <<"# " << x <<" : "<< y <<" #\n"
#define nl cout << "\n";
#define sp cout << " ";
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define ss(n) scanf("%s", n)
#define pf(n) scanf("%d", n)
#define pfl(n) scanf("%lld", n)
#define all(v) v.begin(), v.end()
#define rall(v) v.begin(), v.end()
#define srt(v) sort(v.begin(), v.end())
#define r_srt(v) sort(v.rbegin(), v.rend())
#define rev(v) reverse(v.begin(), v.end())
#define Sqr(x) ((x)*(x))
#define Mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define pb push_back
#define mk make_pair
#define MAX 100005
#define INF 1000000009
#define MOD 1000000007

template<class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T>>;
template<typename T>
using ordered_set  = tree<T, null_type, less<T>, rb_tree_tag,
      tree_order_statistics_node_update>;

template <typename T> string toString ( T Number ) {
    stringstream ss;
    ss << Number;
    return ss.str();
}
template<typename T> int toInt (T str) {
    stringstream ss;
    ss << str;
    int num;
    ss >> num;
    return num;
}
ll lcm (ll a, ll b) {
    return a * b / __gcd (a, b);
}
/************************************ Code Start Here ******************************************************/
int main () {
    //~ __FastIO;
    //~ cout << setprecision (10);
    //~ cout << fixed;
    vector<int>vec (3);
    cin >> vec[0] >> vec[1] >> vec[2];
    sort (all (vec) );

    if (vec[0] == vec[1] && vec[2] > vec[1]) cout << "YES\n";
    else cout << "NO\n";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 102
int G[N][N],color[N],f[N],d[N],n,time;

void DFS_V(int u){
  int i,j;
  color[u] = -1;
  d[u] = ++time;
  for(i = 1; i < n+1; i++){
    if(G[u-1][i-1] == 1){
      if(color[i] == 0){
	DFS_V(i);
      }
    }
  }
  color[u] = 1;
  f[u] = ++time;
}

void DFS(void){
  int i;
  for(i = 1; i < n+1; i++){
    color[i] = 0;
    time = 0;
  }
  for(i = 1; i < n+1; i++){
    if(color[i] == 0){
      DFS_V(i);
    }
  }
}

int main(){
  int i,j,u,n2,v;
  scanf("%d",&n);
  
  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      G[i][j] = 0;
    }
  }
  
  for(i = 0; i < n; i++){
    scanf("%d %d",&u,&n2);
    for(j = 0; j < n2; j++){
      scanf("%d",&v);
      G[u-1][v-1] = 1;
    }
  }
  DFS();
  for(i = 1; i < n+1; i++){
    printf("%d %d %d\n",i,d[i],f[i]);
  }
  return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
#endif

	int x,n;
	cin>>x>>n;
	set<int> st;
	for(int i=-1;i<=101;i++)
	{
		st.insert(i);
	}


	for(int i=0;i<n;i++)
	{
		int temp;
		cin>>temp;
		st.erase(temp);
	}

	auto it1=st.lower_bound(x);
	auto it2=it1;
	it2--;
	int ans=0;
	if(abs(*(it2)-x)<=abs(*it1)-x)
	{
		ans=*(it2);
	}
	else
	{
		ans=*(it1);
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll ans;
int n;
int a[200004],m[200004];
int main(){
	cin>>n;
	for (int i=0;i<n;i++) cin>>m[i],ans+=a[m[i]],a[m[i]]++;
	for (int i=0;i<n;i++)
		cout<<ans-(a[m[i]]-1)<<"\n";
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e4 + 5);
const ll MOD = (ll)(1e9 + 7);

/////////////////////////////////////////////////////////////
class ModuloOperator {
 public:
  ll modulo;

  ModuloOperator(ll modulo) { this->modulo = modulo; }

  ll add(ll a, ll b) {
    ll ret = a + b;
    ret %= modulo;
    return ret;
  }

  ll sub(ll a, ll b) {
    ll ret = a - b;
    if (ret < 0)
      ret += modulo;
    else
      ret %= modulo;
    return ret;
  }

  ll mul(ll a, ll b) {
    ll ret = a * b;
    ret %= modulo;
    return ret;
  }

  ll div(ll a, ll b) { return mul(a, pow(b, modulo - 2)); }

  ll pow(ll x, ll y) {
    ll res = 1LL;

    x %= modulo;

    while (y > 0) {
      if (y & 1) {
        res = mul(res, x);
      }

      y = y >> 1;
      x = mul(x, x);
    }

    return res;
  }
};
/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
unordered_map<ll, ll> prime_factorization(ll n) {
  unordered_map<ll, ll> res;
  for (ll i = 2; i * i <= n; ++i) {
    while (n % i == 0) {
      res[i] += 1;
      n /= i;
    }
  }
  if (n != 1) res[n] = 1;
  return res;
}
/////////////////////////////////////////////////////////////

int n;
ll a[MAX_N];

unordered_map<ll, unordered_map<ll, ll>> pf_cache;

ModuloOperator mo(MOD);

unordered_map<ll, ll> cached_prime_factorization(ll target) {
  if (pf_cache.find(target) != pf_cache.end()) {
    return pf_cache[target];
  }

  return pf_cache[target] = prime_factorization(target);
}

void update_lcm(unordered_map<ll, ll>& lcm, ll target) {
  auto primes = cached_prime_factorization(target);

  // printf("target: %lld\n", target);

  // for (auto& e : primes) {
  //   printf("primes- %lld: %lld\n", e.first, e.second);
  // }

  for (auto& e : primes) {
    lcm[e.first] = max(lcm[e.first], e.second);
  }
}

ll calc_actual(unordered_map<ll, ll>& lcm) {
  ll ret = 1LL;

  for (auto& e : lcm) {
    // printf("lcm- %lld: %lld\n", e.first, e.second);
    ll power = mo.pow(e.first, e.second);

    ret = mo.mul(ret, power);
    // printf("ret: %lld\n", ret);
  }

  return ret;
}

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  unordered_map<ll, ll> lcm;

  for (int i = 0; i < n; ++i) {
    update_lcm(lcm, a[i]);
  }

  ll ans = 0LL;

  ll lcm_actual = calc_actual(lcm);

  // printf("%lld\n", lcm_actual);

  for (int i = 0; i < n; ++i) {
    ans = mo.add(ans, mo.div(lcm_actual, a[i]));
  }

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

  return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N,M;
    cin >> N >> M;
    if(M>0)
    {
        cout << (2*M+N)*(N-1)/2 << endl;
    }
    else
    {
        bool chk=true;
        int sum=0;
        for(int i=M; i<N+M; i++)
        {
            sum+=i;
            if(i==0)
            {
                chk=false;
            }
        }
        if(chk)
        cout << sum-(N+M-1) << endl;
        else
        cout << sum << endl;
    }
    
}

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

#define N 1024
#define SQ(X) \
  ( (X) * (X) )

int
main (
  int   argc,
  char *argv[ ]
  )
{
  int i;

  for ( ; ; )
  {
    double avg = 0., alpha = 0.;
    int d[ N ];
    int n;

    scanf ( "%d", &n );
    if ( n == 0 ) break ;

    for ( i = 0; i < n; ++i )
    {
      scanf ( "%d", &d[ i ] );
    }

    for ( i = 0; i < n; ++i )
    {
      avg += d[ i ];
    }
    avg /= n;

    for ( i = 0; i < n; ++i )
    {
      alpha += SQ( d[ i ] - avg );
    }
    alpha /= n;

    printf ( "%.4f\n", sqrt ( alpha ) );
  }

  return ( 0 );
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		double c = b - 1;
		double d = a - 1;
		int ans = (int)Math.ceil(c / d);
		System.out.println(ans);

		sc.close();

	}

}


Measured memory_bytes: 21332
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc147_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if(s.Substring(i,1)!=s.Substring(s.Length-1-i,1))
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt/2);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 13140
//package april2020;

import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		
		int s = scn.nextInt();
		int w = scn.nextInt();
		
		if(w>=s) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}
	}
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }

}


Measured memory_bytes: 32524
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class C
{
	public static void Main()
	{
		string ABCD = Console.ReadLine();
		int[] abcd = new int[4];
		for(int i = 0; i < 4; i++)
			abcd[i] = (int)ABCD[i] - (int)'0';

		for(int b = 0; b < 8; b++)
		{
			int result = abcd[0];  // a
			char[] op = new char[3];
			for(int i = 0; i < 3; i++)
			{
				if(((b >> i) & 1) == 0)
				{
					op[i] = '+';
					result += abcd[i + 1];  // b or c or d					
				}
				else
				{
					op[i] = '-';
					result -= abcd[i + 1];  // b or c or d					
				}			
			}
			if(result == 7)
			{
				Console.WriteLine("{0}{1}{2}{3}{4}{5}{6}=7",
					abcd[0],op[0],abcd[1],op[1],abcd[2],op[2],abcd[3]);
				return;
			}
		}
	}	
}





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

int main(){
    char b;
    cin >> b;
    switch(b){
        case 'A':
            cout << 'T' << endl;
            break;
        case 'T':
            cout << 'A' << endl;
            break;
        case 'G':
            cout << 'C' << endl;
            break;
        case 'C':
            cout << 'G' << endl;
            break;
        default:
            break;
    }

    return 0;
}

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

using i64 = long long;

const int N = 1e5 + 5, C = 4096;

map<i64, i64> van, mp;
vector<i64> v, primes;
bitset<N> bit, mo;
int n, ant;

static void find(i64 x) {
	i64 &dual = van[x];
	i64 sqr, tx;
	int cnt;

	tx = x;
	dual = 1;
	for (auto i: primes) {
		if (x % i == 0) {
			cnt = 1;
			x/= i;
			if (x % i == 0) {
				cnt+= 1;
				x/= i; }
	
			switch (cnt) {
			case 1: {
				dual*= i * i;
				break; }
			case 2: {
				dual*= i;
				break; } } } }

	if (x == 1) {
		van[dual] = tx;
		return; }
	sqr = sqrt(x) + 0.5;

	if (sqr * sqr == x) {
		dual*= sqr;
		van[dual] = tx;
		return; }

	dual*= x * x;
	van[dual] = x; }

int main() {
#ifdef HOME
	freopen("agc3d.in", "r", stdin);
	freopen("agc3d.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	i64 drop;

	cin >> n;
	v.resize(n);
	for (auto &i: v)
		cin >> i;

	bit = 3;
	for (int i = 2; i * i < N; ++i) if (!bit[i])
		for (int j = i * i; j < N; j+= i)
			bit[j] = 1;
	for (int i = 0; i < C; ++i) if (!bit[i])
		primes.push_back(i);

	mo = 0, mo.flip();
	for (int i = 2; i * i < N; ++i)
		for (int j = i * i; j < N; j+= i * i)
			mo[j] = 0;

	for (int i = 2; i < C; ++i) if (!bit[i]) {
		for (auto &j: v)
			while (j % (1LL * i * i * i) == 0)
				j/= 1LL * i * i * i; }

	for (int i = 0; i < v.size(); ++i) if (v[i] == 1) {
		if (ant == 0)
			ant = 1;
		swap(v[i--], v.back());
		v.pop_back(); }
	n = v.size();

	for (int i = 0; i < n; ++i) {
		mp[v[i]]+= 1;
		find(v[i]); }

	for (int i = 0; i < n; ++i) {
		i64 &x = mp[v[i]];
		i64 &y = mp[van[v[i]]];

		drop = max(x, y);
		ant+= drop;
		x-= drop;
		y-= drop; }

	cout << ant << endl;

	return 0; }


Measured memory_bytes: 26112
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  ll A;
  cin >> A;
  if (A > 100000) {
    cout << 1;
    return 0;
  }
  rep(i, A/100+1) {
    rep(j, A / 100 + 1) {
      rep(k, A / 100 + 1) {
        rep(l, A / 100 + 1) {
          rep(m, A / 100 + 1) {
            rep(n, A / 100 + 1) {
              if (i * 100 + j * 101 + k * 102 + l * 103 + m * 104 + n * 105 == A) {
                cout << 1;
                return 0;
              }
            }
          }
        }
      }
    }
  }
  cout << 0;
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
def ABC67_B():
    N, K = LI()
    L = LI()
    L.sort(reverse=True)
    ans = sum(L[:K])
    print(ans)
    return

def ABC100_C():
    def factorization_2(n):
        arr = defaultdict(int)
        temp = n
        i = 2
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr[i] = cnt
        if temp != 1:
            arr[temp] = 1
        if arr == []:
            arr[n] = 1
        return arr[2]
    N = I()
    A = LI()
    ans = 0
    for a in A:
        ans += factorization_2(a)
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    ABC100_C()

"""

"""

Measured memory_bytes: 5488