akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define PI 3.1415926535897
#define EPS (1e-10)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N;
int T, A;
int H[1010];


signed main(){
	cin >> N;
	cin >> T >> A;
	rep(i, 0, N) cin >> H[i];

	int ans = -1;
	double erf = INF;
	rep(i, 0, N){
		if(abs(A-(T-H[i]*0.006)) < erf){
			erf = abs(A-(T-H[i]*0.006));
			ans = i;
		}
	}

	cout << ans+1 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
    int A, B, K;
    cin >> A >> B >> K;
    int count = 0;
    for (int i = min(A, B); i > 0; i--) {
        if (A%i==0 && B%i==0) {
            count++;
        }
        if (count == K) {
            cout << i << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

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

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

    ll L = 1;
    rep(i, N) {
        ll T;
        cin >> T;
        L = lcm(L, T);
    }

    cout << L << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
	static void main() throws Exception{
		char[]s=sc.nextLine().toCharArray(),t=sc.nextLine().toCharArray();
		int ans=0;
		for(int i=0;i<s.length;i++) {
			ans+=s[i]!=t[i]?1:0;
		}
		pw.println(ans);
	}
	public static void main(String[] args) throws Exception{
		sc=new MScanner(System.in);
		pw = new PrintWriter(System.out);
		int tc=1;
//		tc=sc.nextInt();
		while(tc-->0)
			main();
		pw.flush();
	}
	static PrintWriter pw;
	static MScanner  sc;
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void shuffle(int[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			int tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
	static void shuffle(long[]in) {
		for(int i=0;i<in.length;i++) {
			int idx=(int)(Math.random()*in.length);
			long tmp=in[i];
			in[i]=in[idx];
			in[idx]=tmp;
		}
	}
}

Measured memory_bytes: 37884
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define mod1 998244353 
#define inf 1000000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'



int main()
{
    fastio;
    #ifdef APNA_IO
        start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);    
    #endif

    ll n;cin>>n;
    cout<<1LL*180*(n-2);

    #ifdef APNA_IO
        end_routine();
    #endif
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <limits>
#include <iomanip>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    vector<vector<int>> data(N, vector<int>(2));
    for(int i=0;i<N;i++){
        cin >> data[i][0] >> data[i][1]; // x -  y
    }
    //
    double total=0;
    double cnt=0;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            double num = (data[i][0] - data[j][0])*(data[i][0] - data[j][0]) + (data[i][1] - data[j][1])*(data[i][1] - data[j][1]);
            double distance = sqrt(num);
            total += distance;
            cnt++;
        }
    }
    double average = total /cnt ;
    cout << fixed << setprecision(10) << average *(N-1)<< endl;
}

Measured memory_bytes: 3696
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<string> S(N);
    for (auto&& s : S) {
        cin >> s;
    }

    ll ans = 0;
    for (ll k = 0; k < N; k++) {
        ll ok = true;
        for (ll i = 0; i < N; i++) {
            for (ll j = 0; j < N; j++) {
                ll ii = (i + k) % N;
                ll jj = (j - k + N) % N;
                ok &= S[i][j] == S[jj][ii];
            }
        }
        if (ok) {
            ans++;
        }
    }

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



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
float PHI = 1.6180339;
const float  PI_F=3.14159265358979f;
#define MAX 100000 
#define endl "\n"    
#define manhunt 32 
//typedef long long float;
//#define int long long
typedef pair<int, int> pii;
//#define float unsigned long long
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
 
bool sortbysec(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second<b.second; 
}
 
bool sortbysec1(const pair<int,int> &a, 
                   const pair<int,int> &b) 
{ 
       return a.second>b.second; 
}

const int maxn = 30;
int mat[maxn][maxn];
int h, w;
int vis[maxn][maxn];
struct node
{
    int x,y,mov=0;
};
queue<node>q;
 
bool isv(int i, int j, int mov)
{
  if(i >= 1 && i <= h && j >= 1 && j <= w && mat[i][j] == 1 && vis[i][j] == 0)
  {
    vis[i][j] = 1;
    q.push({i, j, mov + 1});
  }
}

int bfs(int stx,int sty,int dst,int ddt)
{
    while(!q.empty())q.pop();
    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            vis[i][j]=0;
        }
    }
    q.push({stx,sty,0});
    vis[stx][sty]=1;
    int ans=0;
    while(!q.empty())
    {
        node c=q.front(); q.pop();
        int a=c.x;
        int b=c.y;
        int p=c.mov;
        if(a==dst && b==ddt)
        {
            ans=p;
            break;
        }
        isv(a+1,b,p);
        isv(a-1,b,p);
        isv(a,b+1,p);
        isv(a,b-1,p);
    }
    return ans;
}

int32_t main()
{
    FAST
    cout << fixed << setprecision(17);

    cin>>h>>w;

    for(int i=1;i<=h;i++)
    {
        for(int j=1;j<=w;j++)
        {
            char c;
            cin>>c;
            if(c=='.')
            mat[i][j]=1;
            else
            mat[i][j]=-1;
        }
    }
  int ans = 0;
  for(int i = 1; i <= h; ++ i)
  {
    for(int j = 1; j <= w; ++ j)
    {
      for(int x = 1; x <= h; ++ x)
      {
        for(int y = 1; y <= w; ++ y)
        {
          if(mat[i][j] == 1 && mat[x][y] == 1)
          {
            ans = max(ans, bfs(i, j , x, y));
          }
        }
      }
    }
  }

cout << ans << '\n';
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string s;cin>>s;
  int i,sum=0;
  for(i=0; i<s.size(); ++i) sum+=(int)(s[i]-'0');
  if(sum%9==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,a,b) for(int i=(int)(a-1);i>=b;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

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

#define INF INT_MAX/3

int l[51];

int main(){
    cin.sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    rep(i, n) cin >> l[i];
    sort(l, l + n);
    int sum = 0;
    repr(i, n, n - k) sum += l[i];
    cout << sum << endl;
    return 0;
}

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

int main() {
    int D, N;
    
    cin >> D >> N;
    
    switch (D) {
        case 0:
            if (N == 100) {
                N++;
            }
            cout << N << "\n";
            break;
        case 1:
            if (N == 100) {
                N++;
            }
            cout << N * 100 << "\n";
            break;
        case 2:
            if (N == 100) {
                N++;
            }
            cout << N * 10000 << "\n";
            break;
        default:
            break;
    }
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
from collections import deque
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(H, W, Ch, Cw, Dh, Dw, walkable):
    N = HEIGHT * WIDTH
    visited = [0] * N

    start = (Ch + 1) * WIDTH + (Cw + 1)
    goal = (Dh + 1) * WIDTH + (Dw + 1)
    toVisit = []
    toVisit.append(start)

    currentDistance = 0
    while True:
        nextJumpOrigin = []
        while toVisit:
            p = toVisit.pop()
            if p == goal:
                return currentDistance
            if visited[p]:
                continue

            visited[p] = 1
            nextJumpOrigin.append(p)
            for d in [-1, +1, -WIDTH, +WIDTH]:
                if walkable[p + d] and not visited[p + d]:
                    toVisit.append(p + d)

        # no continuous cell
        for origin in nextJumpOrigin:
            for dx in [-2, -1, 0, +1, +2]:
                for dy in [-WIDTH * 2, -WIDTH, 0, WIDTH, WIDTH * 2]:
                    p = origin + dx + dy
                    if not walkable[p]:
                        continue
                    if visited[p]:
                        continue
                    toVisit.append(p)

        currentDistance += 1
        if not toVisit:
            return -1


def readMap(H, W):
    global SENTINEL, HEIGHT, WIDTH
    SENTINEL = 2
    HEIGHT = H + SENTINEL * 2
    WIDTH = W + SENTINEL * 2
    data = [0] * (HEIGHT * WIDTH)
    ok = ord(".")
    for i in range(H):
        S = input().strip()
        y = (i + SENTINEL) * WIDTH
        for j in range(W):
            data[y + (j + SENTINEL)] = 1 if S[j] == ok else 0
    return data


def main():
    # parse input
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    D = readMap(H, W)
    print(solve(H, W, Ch, Cw, Dh, Dw, D))


# tests
T1 = """
4 4
1 1
4 4
..#.
..#.
.#..
.#..
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
1
"""

T2 = """
4 4
1 4
4 1
.##.
####
####
.##.
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
-1
"""

T3 = """
4 4
2 2
3 3
....
....
....
....
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
0
"""

T4 = """
4 5
1 2
2 5
#.###
####.
#..##
#..##
"""
TEST_T4 = """
>>> as_input(T4)
>>> main()
2
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


Measured memory_bytes: 94312
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>

using namespace std;

void fail() {
    cout << "NO" << endl;
    exit(0);
}

class QuickFind {
public:
    QuickFind(int N) : V_NUM(N) {
        par.resize(V_NUM);
        iota(par.begin(), par.end(), 0);
        group.resize(V_NUM);
        for (int i = 0; i < N; ++i) group[i] = {i};
    }

    int find(int v) {
        return par[v] == v ? v : par[v] = find(par[v]);
    }

    void merge(int u, int v) {
        u = find(u);
        v = find(v);
        if (u == v) return;
        if (group[u].size() < group[v].size()) swap(u, v);

        par[v] = u;
        copy(group[v].begin(), group[v].end(), back_inserter(group[u]));
        group[v].erase(group[v].begin(), group[v].end());
    }

    int V_NUM;
    vector<vector<int>> group;
    vector<int> par;
};

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

    vector<int> in(H * 2, 0), out(H * 2, 0);
    QuickFind qf(H * 2);
    for (int i = 0; i < N; ++i) {
        int A, B, C, D;
        cin >> A >> B >> C >> D;
        --A, --B, --C, --D;

        // (C, A)と(D, B)をペアで考える。
        // (0, A)と(A, *), (C, *)と(0, C)は同じ頂点にする。
        // するとピースは辺になり、条件は
        //     (0, A)を始点、(0, B)を終点とするオイラー路に分解できる
        // と言い換えられる。

        int from, to;
        if (C < 0) {
            from = A;
        } else {
            from = C + H;
        }

        if (D < 0) {
            to = B + H;
        } else {
            to = D;
        }

        ++out[from];
        ++in[to];
        qf.merge(from, to);
    }

    for (auto& g : qf.group) {
        if (g.empty()) continue;
        if (g.size() == 1) {
            if (in[g[0]] != 0) fail();
        } else {
            bool start = false;
            for (auto i : g) {
                int d = out[i] - in[i];
                if ((i < H && d < 0) || (i >= H && d > 0)) fail();
                if (i < H && d > 0) start = true;
            }
            if (!start) fail();
        }
    }
    cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
#define debug(x) cout << x << endl
const int INF = 1e9;
const LL INF64 = 1e18;

const int NMAX = 1e5 + 5;

LL grid[55][55];
LL h, w;
LL dx[] = {0, 1, 0, -1};
LL dy[] = {1, 0, -1, 0};

bool isValid(LL x, LL y){
	if(x < 0 || y < 0 || x >= h || y >= w) return false;
	return true;
}

bool check(LL x, LL y){
	for(int i = 0; i < 4; i++){
		LL tempx = x + dx[i], tempy = y + dy[i];
		if(!isValid(x + dx[i], y + dy[i])) continue;
		if(grid[tempx][tempy] == 1) return true;;
	}
	return false;
}

int main(){
	cin >> h >> w;
	LL x = 0, y = 0;
	bool ans = 1;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			char c;
			cin >> c;
			if(c == '.') grid[i][j] = 0;
			else grid[i][j] = 1;
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(grid[i][j] == 1){
				if(!check(i, j)) ans = 0;
			}
		}
	}
	if(ans) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 17:52:43 2019

@author: nakamuratakayuki
"""

N = int(input())
Hlist = list(map(int, input().split()))
c = 1
for i in range(1,N):
    if Hlist[i] >= max(Hlist[:i]):
        c += 1
print(c)

Measured memory_bytes: 2940
#define NDEBUG
#include <cassert>
#include <deque>
#include <functional>
#include <utility>

template <typename Key, typename T, class Compare = std::greater<Key>>
class _01Heap {
public:
	using key_type = Key;
	using mapped_type = T;
	using value_type = std::pair<key_type, mapped_type>;
	using reference = value_type &;
	using const_reference = const value_type &;
	using key_compare = Compare;
	using container_type = std::deque<value_type>;
	using size_type = typename container_type::size_type;
	class value_compare {
		friend class _01Heap;
		const key_compare comp;
		value_compare() : comp() {}

	public:
		constexpr bool operator()(const_reference x, const_reference y) const {
			return comp(x.first, y.first);
		}
	};

private:
	const value_compare comp;
	container_type dq;
	size_type size_;

public:
	_01Heap() : comp(), dq(), size_(0) {}
	const_reference top() const {
		assert(size_);
		return dq.front();
	}
	void pop() {
		assert(size_);
		--size_;
		dq.pop_front();
	}
	void push(const_reference x) {
		if (!size_)
			dq.push_front(x);
		else {
			assert(!comp(x, dq.front()) || !comp(dq.back(), x));
			if (comp(x, dq.front()))
				dq.push_back(x);
			else
				dq.push_front(x);
		}
		++size_;
	}
	size_type size() const noexcept { return size_; }
	bool empty() const noexcept { return !size_; }
};


struct edge {
	int to;
	int cost;
};
#include<iostream>
#include<vector>
#include<limits>
#include<tuple>
int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int k;
	std::cin >> k;
	std::vector<std::vector<edge>> G(k);
	for (int i = 0;i < k;++i) {
		G[i].push_back({ i * 10 % k,0 });
		G[i].push_back({ (i + 1) % k,1 });
	}
	_01Heap<int, int> Q;
	static constexpr int INF = std::numeric_limits<int>::max();
	std::vector<int> d(k, INF);
	Q.push({ 1,1 });
	d[1] = 1;
	int v, c;
	while (!Q.empty()) {
		std::tie(c, v) = Q.top();Q.pop();
		if (d[v] < c) continue;
		for (const auto &e : G[v]) {
			if (c + e.cost < d[e.to]) {
				d[e.to] = c + e.cost;
				Q.push({ d[e.to],e.to });
			}
		}
	}
	std::cout << d[0] << std::endl;
	return 0;
}

Measured memory_bytes: 6528
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
int X[101010];

i64 invs[101010];
i64 fact[101010], facti[101010], sums[101010];

i64 modpow(i64 x, int p = MOD - 2)
{
	if (p == 0) return 1;
	i64 tmp = modpow(x, p / 2);
	tmp = tmp * tmp % MOD;
	if (p % 2 == 1) tmp = tmp * x % MOD;
	return tmp;
}

int main()
{
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) scanf("%d", X + i);

	for (int i = 1; i <= N; ++i) invs[i] = modpow(i);
	fact[0] = facti[0] = 1;
	for (int i = 1; i <= N; ++i) {
		fact[i] = fact[i - 1] * i % MOD;
		facti[i] = facti[i - 1] * invs[i] % MOD;
	}
	sums[0] = 0;
	for (int i = 1; i <= N; ++i) sums[i] = (sums[i - 1] + invs[i]) % MOD;

	i64 ret = 0;
	for (int i = 1; i < N; ++i) ADD(ret, (X[i] - X[i - 1]) * sums[i]);
	ret = ret * fact[N - 1] % MOD;
	printf("%lld\n", ret);
	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}

int main() {
  int N;
  cin>>N;
  VEC<string>S(N);
  VEC<int>T(N);
  REP(i,0,N)cin>>S[i]>>T[i];
  string X;cin>>X;
  bool sleep=false;
  int cnt=0;
  REP(i,0,N){
    if(sleep){
      cnt+=T[i];
    }
    if(S[i]==X){
      sleep=1;
    }
  }
  cout<<cnt<<endl;

  return 0;
}


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

using namespace std;

long long a,b,c;

int main()
{
    cin>>a>>b>>c;

    if ((c-a-b)<0) return !printf("No\n");
    if ((c-a-b)*(c-a-b)> 4*a*b) return !printf("Yes\n");

    return !printf("No\n");
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

int main() {
    ll n, k;
    cin >> n >> k;
    if (k == 0)
        cout << n * n << endl;
    else {
        ll ans = 0;
        for (ll b = k + 1; b <= n; ++b) {
            ans += (n + 1) / b * (b - k) + max(0LL, (n + 1) % b - k);
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		//scan.useDelimiter("\\r\\n");

		int dataSet = scan.nextInt();
		BigDecimal[] ans = new BigDecimal[dataSet];

		for (int i = 0; i < dataSet; i++) {
			ans[i] = scan.nextBigDecimal().add(scan.nextBigDecimal());
		}

		for (int i = 0; i < dataSet; i++) {
			if (String.valueOf(ans[i]).toCharArray().length > 80) {
				System.out.println("overflow");
			} else {
				System.out.println(ans[i]);
			}

		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <iomanip>
/*cout <<setprecision(11)<<ret<<endl;で、数字部分を計11桁表示*/
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
//Shift+Command+bでデバッグ
//その後ターミナルで./a.outを実行
//入力を貼り付ける

//////////////////
//  A
int main(void){
    int a,b;cin>>a>>b;
    cout<<a*b<<endl;
    return 0;
}
//////////////////
//  B
/*int main(void){

    return 0;
}*/
//////////////////
//  C
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/
//////////////////
//  E
/*int main(void){

    return 0;
}*/
//////////////////
//  F
/*int main(void){

    return 0;
}*/


Measured memory_bytes: 3192
#!/usr/bin/env python3
import sys


def g(n: int):
    # 0 1 11 00 100 001 111 000 1000 0001 1011 0000 1100 0001 1111 0000
    # 0110
    # 0010
    # 00001010
    # 0000000010101010

    ans = 0
    ans += [0, 1, 1, 0][n % 4]
    for i in range(1, 64):
        k = n % 2 ** (i + 1)
        if k < 2 ** i:
            continue
        if k % 2 == 0:
            ans += 1 << i
    return ans


def solve(A: int, B: int):
    print(g(B) ^ g(A - 1))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
sz;
k;
char x[18],buf[2200000];
A,B,p,T;
long ans;
main()
{
	sz=read(0,buf,2200000);
	sz-=2;
	while(1)
	{
		A=B=0;
		p=1;
		while(1)
		{
			k=buf[sz--];
			if(k<'0')break;
			B+=(k-'0')*p;
			p*=10;
		}
		p=1;
		if(sz<0)break;
		while(1)
		{
			k=buf[sz--];
			if(k<'0')break;
			A+=(k-'0')*p;
			p*=10;
		}
		T=(-A-ans)%B;
		ans+=T+(T<0)*B;
	}
	sz=17;
	do
	{
		x[--sz]=ans%10+'0';
		ans/=10;
	}while(ans);
	write(1,x+sz,17-sz);
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 300005;
const ll INF = 1000000009000000009;

int n, qq;
int v[N], w[N];

vector<pair<int, ll> > vv[N];

void dfs(int x, int d)
{
    if (x > n)
        return;
    if (d > 11)
        return;
    vv[x] = vv[x / 2];
    for (int i = 0; i < vv[x / 2].size(); ++i)
    {
        vv[x].push_back(m_p(min(N, vv[x / 2][i].fi + v[x]), vv[x / 2][i].se + w[x]));
    }
    sort(vv[x].begin(), vv[x].end());
    for (int i = 1; i < vv[x].size(); ++i)
        vv[x][i].se = max(vv[x][i].se, vv[x][i - 1].se);
    dfs(x * 2, d + 1);
    dfs(x * 2 + 1, d + 1);
}

void solv()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i)
        scanf("%d%d", &w[i], &v[i]);
    vv[0].push_back(m_p(0, 0));
    dfs(1, 0);
    //return;
    scanf("%d", &qq);
    while (qq--)
    {
        int g, m;
        scanf("%d%d", &g, &m);
        vector<pair<int, int> > v;
        while (g)
        {
            if (!vv[g].empty())
                break;
            v.push_back(m_p(::v[g], w[g]));
            g /= 2;
        }
        ll ans = 0;
        for (int x = 0; x < (1 << sz(v)); ++x)
        {
            int sv = 0;
            ll sw = 0;
            for (int i = 0; i < sz(v); ++i)
            {
                if ((x & (1 << i)))
                {
                    sv += v[i].fi;
                    sw += v[i].se;
                    sv = min(sv, N);
                }
            }
            int i = upper_bound(all(vv[g]), m_p(m - sv, INF)) - vv[g].begin() - 1;
            if (i >= 0)
                ans = max(ans, sw + vv[g][i].se);
        }
        printf("%lld\n", ans);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


Measured memory_bytes: 188804
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<cmath>
#include<list>

#define ll long long
#define N 150005
#define pb push_back
#define Sca(a) scanf("%d",&a)
#define Scs(a) scanf("%s",&a)
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define Scal(a) scanf("%ld",&a)
#define Scall(a) scanf("%lld",&a)
#define Pri(a) printf("%d",a)
#define Prs(a) printf("%s",a)
#define Pril(a) printf("%ld",a)
#define Prill(a) printf("%lld",a)
#define FAST_IO ios::sync_with_stdio(false)
using namespace std;
const int INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
using namespace std;

template<class T>
void tomax(T &a, T b) {
    a = max(a, b);
}

template<class T>
void tomin(T &a, T b) {
    a = min(a, b);
}

int main() {int a,b,h,m,c,d,t;
    double e,ans;
    scanf("%d%d%d%d",&a,&b,&h,&m);
    c=60*h+m;
    d=12*m;
    if(c<d)
        t=c,c=d,d=t;//找出时针，分针，走过大的角度
    e=(c-d)*2*pi/720;//c-d，让大角减小角
    ans=sqrt(a*a+b*b-2*a*b*cos(e));//余弦定理
    printf("%.12lf\n",ans);
    return 0;
}

Measured memory_bytes: 4076
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String ans = "Christmas";
		int D = sc.nextInt();
		for (int i = 0; i < 25 - D; i++) {
			ans += " Eve";
		}
		System.out.println(ans);
	}
}

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

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        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();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 21716
import java.util.Scanner;

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

Measured memory_bytes: 27076
(let ((x (read))
      (y (read))
      (z (read)))

  (format t "~A~%"
          (concatenate 'string (list
                                 (car (concatenate 'list (symbol-name x)))
                                 (car (concatenate 'list (symbol-name y)))
                                 (car (concatenate 'list (symbol-name z)))))))


Measured memory_bytes: 24108
n = gets.chomp.to_i
ds = n.to_s.size

cnt = 0
1.step(ds - 1, 2) do |i|
  cnt += (10 ** i) - (10 ** (i - 1))
end

if ds.odd?
  cnt += n - (10 ** (ds - 1)) + 1
end

p cnt


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


int main() {

	ll n;
	cin >> n;

	ll yakusu = 1, sqrtn = sqrt(n);
	
	rep(i, sqrtn) if (n % (i + 1) == 0) yakusu = i+1;


	cout << yakusu + n / yakusu-2 << endl;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        String abc="ABC";
        int ans=0;
        boolean flag;
        for(int i=0;i<n-2;i++){
            flag=true;
            for(int j=0;j<3;j++){
                if(s.charAt(i+j)!=abc.charAt(j))flag=false;
                
            }
            if(flag)ans++;
        }
        System.out.println(ans);

    }



}

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

using namespace std;

typedef long long LL;

const int N = 110;

int n, d;
int dem[N][N];

bool check(int a, int b)
{
    int r = 0;
    for(int i = 1; i <= d; i++)
    {
        int t = abs(dem[a][i] - dem[b][i]);
        r += t * t;
    }

    for(int i = 0; i <= 1000; i++)
        if(i * i == r)
            return true;

    return false;
}

int main()
{
    cin >> n >> d;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= d; j++)
            cin >> dem[i][j];

    int res = 0;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j < i; j++)
            if(check(i, j))
                res++;

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

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

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

  vector<vector<int>> edges(N);

  REP(i, N-1){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }

  vector<int> c(N);
  int ans = 0;

  REP(i,N){
    cin >> c[i];
    ans += c[i];
  }
  
  sort(ALL(c));
  reverse(ALL(c));
  ans -= c[0];

  vector<int> stack;
  stack = {0};
  vector<bool> visited(N, false);
  vector<int> assign(N);
  int cur = 0;

  while (!stack.empty()){
    int from = stack.back();
    stack.pop_back();
    visited[from] = true;
    assign[from] = c[cur];
    cur++;

    FOREACH(to, edges[from]){
      if (visited[to]) continue;
      stack.push_back(to);
    }
  }

  cout << ans << endl;
  REP(i, N){
    cout << assign[i];

    if (i == N-1){
      cout << endl;
    }else{
      cout << " ";
    }
  }
}

Measured memory_bytes: 1024
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    ll a[2 * 100005];
    ll ans = 0;
    map<ll, ll> mp;
    mp[0] = 1;

    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i - 1];

        ans += mp[a[i]];

        mp[a[i]]++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 14336
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    vector<int> a(26, 0);
    string s; cin >> s;
    rep(i, 4) {
        a[s[i] -'A']++;
    }
    int cnt = 0;
    int flg = 0;
    rep(i, 26) {
        if(a[i] == 0) continue;
        if(a[i] == 1 || a[i] > 2) flg = 1;
    }
    if(flg) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<map>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;
long long n,a,tot = 0,x = 0, y = 0;
map<int, int> cnt;
int main()
{
	scanf("%lld",&n);
	for(long long i = 1; i <= n; i++){
		scanf("%lld",&a);
		cnt[a]++;
		if(cnt[a] == 2){
			if(a > x) {y = x; x = a;}
			else if(a > y){ y = a;}
			tot++;
			cnt[a] = 0;
		}
	}
	if(tot < 2) printf("0\n");
	else{
		printf("%lld\n",x * y);
	}
	return 0;
}

Measured memory_bytes: 4864
#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    vector<int> v(N);
    for(auto& e : v)
        cin >> e;
    sort(v.begin(), v.end(), greater<int>());

    int ans = 0;
    for(int i = 0; i < N - 1; ++i)
        ans += v[i] - v[i + 1];

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

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  map<ll, ll> mp;
  rep(i, n) {
    ll a;
    cin >> a;
    mp[a]++;
  }
  ll kif = 0;
  vll mk(1000005, 0);
  for(auto& kv : mp){
    ll a = kv.first;
    for (ll j = 2 * a; j <= 1000004; j += a) {
      mk[j] = 1;
    }
    bool ng = mp[a] > 1 || mk[a] == 1;
    if (!ng) {
      //cout << as[i] << endl;
      kif++;
    }
  }

  cout << kif << endl;

  return 0;
}


Measured memory_bytes: 23580
#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
#define PI 3.14159265358979323846
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };

int X,Y;

signed main(){
    cin>>X>>Y;
    if(abs(X-Y)<=1)cout<<"Brown"<<endl;
    else cout<<"Alice"<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define ll long long
#define cases ll t;cin>>t;while(t--)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)

ll sm(ll a,ll b){
    ll n=b-a+1;
    return (n%mod*(a%mod+b%mod))/2;
}


int main(){
    fast;
    ll i,j,k,n,l,r,m;
    cin>>n>>k;
    ll ans=0;
    while(k<=n+1){
        l=sm(0,k-1);
        r=sm(n-k+1,n);
        ans=(ans%mod +((r%mod-l%mod)+mod)%mod)%mod;
        ans=(ans+1)%mod;
        k++;
    }
    cout<<ans;

    return 0;
}



Measured memory_bytes: 3652
n = int(input().split()[0])
a_list = list(map(int, input().split()))

max_a = max(a_list)

max_amari = max_a - 1
m = max_a * 2 - 1

amari_list = []
shou_list = []

for a in a_list:
    amari_list.append(a - 1)

ans = sum(amari_list)
print(ans)

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

const int SIZE = 10 + 11;

typedef long long Int;
typedef map<Int, Int> IntMap;

Int n, a, d;
Int m;
Int x[SIZE];
Int y[SIZE];
Int z[SIZE];
Int k;

bool input() {
  if (cin >> n >> a >> d) {
    if (cin >> m) {
      for (Int i = 0; i < m; ++i) {
        cin >> x[i] >> y[i] >> z[i];
      }
      cin >> k;
      return true;
    }
  }
  return false;
}

Int solve() {
  IntMap arr;

  for (Int i = 0; i < m; ++i) {
    arr[y[i]] = a + (y[i] - 1) * d;
    arr[z[i]] = a + (z[i] - 1) * d;
  }
  arr[k] = a + (k - 1) * d;

  for (Int i = 0; i < m; ++i) {
    if (x[i]) { // update
      arr[y[i]] = arr[z[i]];
    } else { // swap
      Int c = arr[y[i]];
      arr[y[i]] = arr[z[i]];
      arr[z[i]] = c;
    }
  }

  return arr[k];
}

int main() {
  while (input()) cout << solve() << endl;
  return 0;
}

Measured memory_bytes: 1192
if __name__ == '__main__':
    lis = list(map(int, input().split()))
    A = lis[0]
    B = lis[1]
    
    if (A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0):
        print("Possible")
    else:
        print("Impossible")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
// #define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long a, b, c;
  Solver() {
    S002 reader;
    reader >= a >= b >= c;
  }
  long test(long x, long y, long z, long d) {
    if( d >= 100000 ) {
      return -1000000;
    }
    if( x % 2 == 1 or y % 2 == 1 or z % 2 == 1 ) {
      return 0;
    }
    return 1 + test(y/2 + z/2, x/2 + z/2, x/2 + y/2, d + 1);
  }
  void solve() {
    long res = test(a, b, c, 0);
    printf("%ld\n", res < 0 ? -1 : res);
  }
  ~Solver() { fprintf(stderr, "--end--\n"); }
};
 
int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}



Measured memory_bytes: 256
c = [list(map(int, input().split())) for i in range(3)]



for a1 in range(101):
    flag = True
    b1 = c[0][0] - a1
    b2 = c[1][0] - a1
    b3 = c[2][0] - a1
    a2 = c[0][1] - b1
    if a2 != (c[1][1] - b2) or a2 != (c[2][1] - b3):
        flag = False
    a3 = c[0][2] - b1
    if a3 != (c[1][2] - b2) or a3 != (c[2][2] - b3):
        flag = False

    if a1 < 0 or a2 < 0 or a3 < 0 or b1 < 0 or b2 < 0 or b3 < 0:
        flag = False

    if flag:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 3064