akhauriyash/Code-Regression huggingface dataset:
// Problem : A - The Number of Even Pairs
// Contest : AtCoder Beginner Contest 159
// URL : https://atcoder.jp/contests/abc159/tasks/abc159_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

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

typedef long long   ll;
const ll mod = 1e9 + 7;

#define speedup_IO      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n)     for(ll i = a; i < n; i++)
#define ford(i,n,a)     for(ll i = n-1; i >= a; i--)
#define pb              push_back
#define lb              lower_bound
#define ub              upper_bound
#define pll             pair<ll,ll>
#define all(a)          (a).begin(),(a).end()
#define reset(a,x)      memset(a,x,sizeof(a))

ll mypow(ll base, ll exp) {ll res = 1; while (exp) {if (exp & 1) res = (res * base) % mod; exp >>= 1, base = (base * base) % mod;} return res;}
ll gcd(ll a, ll b)  { return b ? gcd(b, a % b) : a;            }
ll mult(ll a, ll b) { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return ((a % mod) * (b % mod)) % mod; }
ll add(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + b % mod) % mod;        }
ll sub(ll a, ll b)  { if (a < 0) {a += mod;} if (b < 0) {b += mod;} return (a % mod + mod - b % mod) % mod;  }

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

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

const ll inf = 1e18;
const int nax = 1e5 + 5;

int main()
{
	speedup_IO;

	int t = 1;
	//cin >> t;
	while (t--)
	{
		ll n,m;
		cin>>n>>m;
		
		ll ans = (n*(n-1))/2 + (m*(m-1))/2;
		cout<<ans;
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <string>
using namespace std;
#define lli long long int
#define MAX_Q 100000000
/*
list[i]:l=1,r=i+1に対応する値
*/
vector<int> solve(const string &S)
{
    vector<int> ans;
    int count = 0;
    int state = 0;
    ans.push_back(0);
    for (int i = 0; i < S.length(); i++)
    {
        if (S[i] == 'A')
        {
            state = 1;
        }
        else if (state == 1 && S[i] == 'C')
        {
            state = 0;
            count++;
        }
        else
        {
            state = 0;
        }
        ans.push_back(count);
    }
    /*
    for (auto &&i : ans)
    {
        cout << i << endl;
    }
    */
    return ans;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    int N;
    int Q;
    cin >> N >> Q >> S;
    vector<int> list = solve(S);
    int l;
    int r;
    vector<int> ans;
    for (int i = 0; i < Q; i++)
    {
        cin >> l >> r;
        ans.push_back(list[r] - list[l]);
    }
    for (auto &&i : ans)
    {
        cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 1864
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T>bool even(T n) { return ! (n & 1); }
template<class T>bool odd(T n) { return n & 1; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
ll intpow(ll a,ll n){ll p=1;while(n){if(n&1)p*=a;a*=a;n>>=1;}return p;}
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N, X, Y;
        cin >> N >> X >> Y;
        vll ans(N+1);
        rep(i, 1, N+1) {
                rep(j, i, N+1) {
                        if (i <= X and Y <= j) {
                                ans[X - i + j - Y + 1]++;
                        } else if (X <= i and i <= Y and Y <= j){
                                ll tmp = min(j-i, i-X + j-Y + 1);
                                ans[tmp]++;
                        } else if (i <= X and X <= j and j <= Y) {
                                ll tmp = min(j-i, Y-j + X-i + 1);
                                ans[tmp]++;
                        } else if (X <= i and i <= Y and X <= j and j <= Y) {
                                ll tmp = min(j-i, i-X + Y-j + 1);
                                ans[tmp]++;
                        } else {
                                ans[j-i]++;
                        }
                }
        }
        rep(i, 1, N) {
                cout << ans[i] << endl;
        }
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>

int main(void) {
    int d;
    int e;
    int qu;
    int re;
    double min;
    double diff;

    while (1) {
        min = 1e09;
        std::cin >> d >> e;
        if (d == 0 && e == 0) {
            break;
        }
        for (int i = 1; i <= d; i++) {
            diff = e - sqrt(i * i + (d - i) * (d - i));
            if (diff < 0) {
                diff *= (-1);
            }
            if (diff < min) {
                min = diff;
            }
        }
        std::cout << min << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3272
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
#define PB push_back
#define MP make_pair
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=1e5+10;
struct node {
	int id; ll d;
	node(int id=0,ll d=0): id(id),d(d) {}
	friend bool operator <(node A,node B) { return A.d<B.d; }
};
priority_queue<node> que;
map<ll,int> mp;
int n,sz[N];
ll d[N];
vector< pair<int,int> > E;
vector<int> son[N];
ll dfs(int u) {
	ll tot=0;
	for(int i=0;i<son[u].size();++i) tot+=dfs(son[u][i])+sz[son[u][i]];
	return tot;
}
int main() {
	rd(n);
	for(int i=1;i<=n;++i) {
		rd(d[i]),mp[d[i]]=i;
		que.push(node(i,d[i]));
		sz[i]=1;
	}
	while(que.size()>1) {
		int u=que.top().id; que.pop();
		mp.erase(d[u]);
		ll t=d[u]-(n-sz[u]*2ll);
		if(!mp.count(t)) {
			printf("-1");
			return 0;
		}
		int f=mp[t];
		E.PB(MP(f,u));
		son[f].PB(u);
		sz[f]+=sz[u];
	}
	int rt=que.top().id;
	if(dfs(rt)!=d[rt]) {
		printf("-1");
		return 0;
	}
	for(int i=0;i<E.size();++i) printf("%d %d\n",E[i].first,E[i].second);
	return 0;
}

Measured memory_bytes: 17008
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll, ll>;
constexpr ll INF = (1LL << 60);
constexpr ll MOD = (1e9 + 7);
//constexpr ll MOD = (998244353);

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


int main() {
	ll n;
	cin >> n;
	vector<vector<ll>> abc = vector<vector<ll>>(n, vector<ll>(3));
	vector<vector<ll>> dp = vector<vector<ll>>(n + 1, vector<ll>(3));
	rep(i, n) {
		cin >> abc[i][0] >> abc[i][1] >> abc[i][2];
	}
	dp[0] = vector<ll>{ 0,0,0 };

	rep(i, n) {
		rep(j, 3) {
			dp[i + 1][j] = max(dp[i][(j + 1) % 3] + abc[i][j], dp[i][(j + 2) % 3] + abc[i][j]);
		}
	}
	cout << max(max(dp[n][0],dp[n][2]),dp[n][1]) << endl;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000010;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    int x, y;
    cin >> x >> y;
    COMinit();
    if ((2 * x - y) % 3 != 0 || (2 * y - x) % 3 != 0) {
        cout << 0 << endl;
    } else {
        int a = (2 * x - y) / 3;
        int b = (2 * y - x) / 3;
        cout << COM(a + b, a) << endl;
    }
    return 0;
}

Measured memory_bytes: 23680
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;

#define REP(x,l,u) for(ll x = l;x<u;x++) // for loop
#define RREP(x,l,u) for(ll x = l;x>=u;x--) // reverse for loop

/**
 *  debugging stuff
 */
string to_string(string s) {return s;}
string to_string(char c) {return string(1,c);}
template <typename A, typename B> string to_string(pair<A,B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(vector<A> v) { string s = "("; int first = 1; for (A a : v) { if (!first) { s += ", "; } first = 0; s += to_string(a); } s += ")"; return s; }
template <typename A> string to_string(set<A> v) { string s = "("; int first = 1; for (A a : v) { if (!first) { s += ", "; } first = 0; s += to_string(a); } s += ")"; return s; }

/**
 *  more debugging stuff
 */
void debug_out() {cerr << endl;}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); }

#ifndef ONLINE_JUDGE
#define debug(...) do { cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__); } while (false)
#else
#define debug(...) do { } while (false)
#endif

typedef long long ll;
typedef double db;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL; 
typedef pair<ll,ll> PLL;
typedef vector<string> VS;

template <typename A, typename B> void in(A & a, B & b) { in(a); in(b); }
template <typename A, typename B, typename C> void in(A & a, B & b, C & c) { in(a); in(b); in(c); }

const ll inf = (ll)1e18 + 5;

VLL stones;
VLL memoize;

ll cost(ll index) {

    if (memoize[index] != -1) return memoize[index];

    if (!index) {
        return 0;
    } else if (index == 1) {
        return abs(stones[index] - stones[index - 1]);
    }

    memoize[index] = min(cost(index - 2) + abs(stones[index] - stones[index - 2]), cost(index - 1) + abs(stones[index] - stones[index - 1]));

    return memoize[index];
}

namespace SOLVE {	
	void main() {
		ll N;

        cin >> N;

        REP(i,0,N) {
            ll stone;
            cin >> stone;

            stones.push_back(stone);
        }

        memoize.resize(N, -1);

        // start from the back
        ll min_cost = cost(N - 1);

        cout << min_cost << endl;

	}
}

signed main() {
	ll t;
	t = 1;
    // cin >> t;
	REP(i,0,t) {
		SOLVE::main();
	}

	return 0;
}

Measured memory_bytes: 6644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion
#pragma region chminmax
template <typename T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
#pragma endregion

int main()
{
    int n;
    cin >> n;
    int half = (n + 1) / 2;
    vector<double> p(n);
    rep(i, n) cin >> p[i];

    vector<vector<double>> dp(n + 1, vector<double>(n + 1));
    dp[0][0] = 1.;
    rep(i, n)
    {
        rep(j, i + 1)
        {
            dp[i + 1][j + 1] += dp[i][j] * p[i];
            dp[i + 1][j] += dp[i][j] * (1. - p[i]);
        }
    }

    double res = 0.;
    for (int k = half; k <= n; k++)
    {
        res += dp[n][k];
    }
    cout << fixed << setprecision(10) << res << endl;
    return 0;
}

Measured memory_bytes: 70784
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),* $(,)*) => {
        #[cfg(debug_assertions)]
        eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*);
    };
}

fn main() {
    input! {
        mut s: Chars,
    }
    if s[s.len() - 1] == 's' {
        s.push('e');
        s.push('s');
        println!("{}", s.iter().collect::<String>());
    } else {
        s.push('s');
        println!("{}", s.iter().collect::<String>());
    }
}


Measured memory_bytes: 2152
#include <cstdio>
#include <algorithm>
using namespace std;

int h,w;
int dist[15][15];

int main() {
  scanf("%d%d",&h,&w);
  for (int i=0; i<10; i++) {
    for (int j=0; j<10; j++) {
      scanf("%d",&dist[i][j]);
    }
  }

  for (int k=0; k<10; k++) {
    for (int j=0; j<10; j++) {
      for (int i=0; i<10; i++) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }

  int sum=0, x;
  for (int i=0; i<h; i++) {
    for (int j=0; j<w; j++) {
      scanf("%d",&x);
      if (x != -1) {
        sum += (int) dist[x][1];
      }
    }
  }
  printf("%d\n", sum);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<ll> va(n), vb(n), vc(n);
    ll ans = 0;
    rep(i, 0, n)
        cin >> va[i];
    rep(i, 0, n)
        cin >> vb[i];
    rep(i, 0, n)
        cin >> vc[i];
    sort(begin(va), end(va));
    sort(begin(vb), end(vb));
    sort(begin(vc), end(vc));
    rep(i, 0, n)
    {
        ll low1 = lower_bound(va.begin(), va.end(), vb[i]) - va.begin();
        ll low2 = vc.end() - upper_bound(vc.begin(), vc.end(), vb[i]);
        ans += low1 * low2;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2560
var n;
var t = [];
var x = [];
var s = [];

function time(s){
	s = s.split(':');
	return (+s[0]) * 60 + (+s[1]);
}

function same(a, b){
	return a[0] === b[0] && a[1] === b[1];
}

function main(){
	while(n = scan()){
		rep(1000, function(i){
			x[i] = [];
		});

		rep(n, function(){
			var v = [scan_string(), time(scan_string())];
			if(t.length === 0 || !same(t[t.length - 1], v)){
				t.push(v);
			}
			scan_string();
			x[scan()].push(t.length - 1);
		});

		rep(t.length, function(i){
			s[i] = 0;
		});
		rep(x[0].length, function(i){
			if(i % 2){
				rep(x[0][i - 1], x[0][i], function(j){
					s[j + 1] = t[j + 1][1] - t[j][1];
				});
			}
		});
		rep(t.length - 1, function(i){
			s[i + 1] += s[i];
		});

		var ans = 0;
		rep(1, 1000, function(i){
			var a = 0;
			rep(x[i].length, function(j){
				if(j % 2){
					a += s[x[i][j]] - s[x[i][j - 1]];
				}
			});
			ans = Math.max(a, ans);
		});
		print(ans);

		t = [];
	}
}

function rep(a, b, c, u){
	if(c === u){
		c = b;
		b = a;
		a = 0;
	}
	for(var i = a; i < b; ++i){
		if(c(i) === false){
			break;
		}
	}
}

var input = '';

function scan(){
	return +input.pop();
}
function scan_string(){
	return input.pop();
} 
function print(val){
	console.log(val);
}
 
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
	input += chunk;
});
process.stdin.on('end', function(){
	input = input.trim().split(/\s+/).reverse();
	main();
});

Measured memory_bytes: 26096
<?php
	while(true) {
		$stdin = trim(fgets(STDIN));
		if($stdin === '') {
			break;
		}
		$val = explode(',', $stdin);
		$number = $val[0];
		$weight = $val[1];
		$height = $val[2];

		$bmi = $weight / ($height * $height);
		if ($bmi >= 25) {
			printf("%d\n", $number);
		}
	}

Measured memory_bytes: 15284
#include <iostream>
#include <algorithm>

int main() {
    using namespace std;

    int N;
    cin >> N;

    long long a[200];
    for (int i=0; i<N; i++) {
        cin >> a[i];
    }
    bool flg = true;
    int count = 0;
    while (flg) {
        for (int i=0; i<N; i++) {
            if (a[i] % 2 != 0) {
                flg = false;
                break;
            }

            a[i] /= 2;
        }

        if (flg) {
            count++;
        }
    }


    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc125/tasks/abc125_b

package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)

	gains := make([]int, N)
	for i := range gains {
		fmt.Scanf("%d", &gains[i])
	}
	for i := range gains {
		var c int
		fmt.Scanf("%d", &c)
		gains[i] -= c
	}

	ans := 0
	for _, g := range gains {
		if g > 0 {
			ans += g
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
struct edge { int u, v, i; };
ostream& operator<<(ostream& os, const edge& e) {
    os << "(" << e.u << ", " << e.v << ")";
    return os;
}
template <bool Directed> struct graph {
    int n;
    vector<edge> edges;
    vector<vector<edge>> adj;
    graph(int n) : n(n), adj(n + 1) {}
    void add_edge(int u, int v) {
        int i = edges.size();
        edges.push_back({u, v, i});
        adj[u].push_back({u, v, i});
        if(not Directed) adj[v].push_back({v, u, i});
    }
};
template <bool Directed> vector<int> bfs(graph<Directed>& g, int s) {
    vector<int> d(g.n + 1, -1);
    d[s] = 0;
    queue<int> q({s});
    while(not q.empty()) {
        int u = q.front(); q.pop();
        for(edge& e : g.adj[u]) {
            if(d[e.v] == -1) {
                d[e.v] = d[u] + 1;
                q.push(e.v);
            }
        }
    }
    return d;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m, q;
    cin >> n >> m >> q;
    graph<0> g(n);
    for(int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g.add_edge(u, v);
    }
    auto d = bfs(g, 1);
    vector<bool> erased(m);
    vector<int> r(q), ans(q);
    for(int i = 0; i < q; i++) {
        cin >> r[i];
        r[i]--;
        erased[r[i]] = true;
    }
    set<int> visited;
    function<void(int)> dfs = [&](int u) {
        visited.insert(u);
        for(edge& e : g.adj[u]) {
            if(not visited.count(e.v) and d[u] + 1 == d[e.v] and not erased[e.i]) {
                dfs(e.v);
            }
        }
    };
    dfs(1);
    for(int i = q - 1; i >= 0; i--) {
        ans[i] = n - visited.size();
        erased[r[i]] = false;
        int u = g.edges[r[i]].u, v = g.edges[r[i]].v;
        if(d[u] + 1 == d[v] and visited.count(u)) {
            dfs(v);
        }
        if(d[v] + 1 == d[u] and visited.count(v)) {
            dfs(u);
        }
    }
    for(int i = 0; i < q; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 24832
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


MOD = 10**9+7
N, M = _li()

a_list = []
for _ in range(M):
    a_list.append(_i())
a_list.append(-1)

ans = [1, 1]
a_index = 0
if a_list[a_index] == 1:
    ans[1] = 0
    a_index += 1

for i in range(2, N+1):
    if i == a_list[a_index]:
        ans = [ans[1], 0]
        a_index += 1
    else:
        ans = [ans[1], ans[0] + ans[1] % MOD]
    if ans[0] + ans[1] == 0:
        break
print(ans[1] % MOD)



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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */
// int i = c - '0';

int main() {
    /* code */
    int N;
    cin >> N;
    vector<int> A(N - 1);
    REP(i, N - 1) { cin >> A[i]; }
    vector<int> Res(N);
    REP(i, N - 1) { Res[A[i] - 1]++; }
    REP(i, N) { cout << Res[i] << endl; }
    return 0;
}

Measured memory_bytes: 4856
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>

using namespace std;

int main()
{
	int H, W;
	while(true) {
		cin >> H >> W;
		if(H == 0 && W == 0)
			break;

		for(int i = 0; i < H;++i) {
			for(int j = 0; j < W;++j) {
				if(i % 2 == 0) {
					if(j % 2 == 0)
						cout << '#';
					else
						cout << '.';
				}
				else {
					if(j % 2 == 0)
						cout << '.';
					else
						cout << '#';
				}
			}
			cout << endl;
		}
		cout << endl;
	}

	return 0;
}

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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.1415926535897932384626
#define bits(n) __builtin_popcount(n)


void solve()
{
    string s,t;
    cin>>s>>t;
    bool ok=true;
    if(s.length()==t.length()-1)
    {
        for(int i=0;i<s.length();i++)
        {
            if(s[i]!=t[i])
            {
                cout<<"No";
                ok=false;
                break;

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

ll x, y;

signed main()
{
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> x >> y;
    if (abs(x - y) <= 1)
    {
        cout << "Brown";
    }
    else
    {
        cout << "Alice";
    }
}


Measured memory_bytes: 256
//g++ -std=c++0x your_file.cpp -o your_program
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#define fname ""
#define mp make_pair
#define F first
#define pb push_back
#define S second
#define ub upper_bound
#define lb lower_bound
#define inf 2000000000
#define INF 2000000000000000000ll
#define ll long long
#define ull unsigned long long
using namespace std;

const int maxn = 101010;

int main() {
	int n;
	cin >> n;
	int x, cnt = 0;
	for (int i = 1; i <= n; i++) {
		scanf("%d", &x);
		cnt += (x % 2);
	}
	if (cnt % 2 == 1) 
		puts("NO");
	else
		puts("YES");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int  n;
  cin>>n;
  int d=n/2*2;
  vector<pair<int ,int>> vp;
  for(int  i=1;i<=n;i++)
  {for(int j=i+1;j<=n;j++)
    {
    if(i+j==d+1)continue;
    vp.emplace_back(i,j);
    
    }}
  cout<<(int) vp.size()<<'\n';
  for(auto e:vp)
    cout<<e.first<<" "<<e.second<<'\n';
  return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define fs first
#define sc second
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  set<int>b;
  rep(i,n)
  b.insert(a[i]);
  cout <<b.size()<<endl;
}

Measured memory_bytes: 256
from fractions import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

n=int(input())
a=list(map(int, input().split()))
A=lcm(a)
ans=0

for i in a:
    ans+=A//i

print(ans%(10**9+7))


Measured memory_bytes: 6112
#include<iostream>
#include<string>
#include <vector>
#include<algorithm>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define vsort(v) sort(v.begin(), v.end())
#define ll long long
const ll MOD = 1e9 + 7;

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	vi h(n);
	int p;
	double l = 10000.0;
	rep(i, n) {
		cin >> h[i];
		double x = a - t + h[i] * 0.006;
		if (x < 0) x = -x;
		if (x < l) {
			l = x;
			p = i;
		}
	}
	cout << p + 1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define pair_ordered_set tree< pair<ll,ll> , null_type,less< pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update>
pair_ordered_set st;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i],st.insert({a[i],i});
    for(ll i=0;i<n;i++){
        st.erase({a[i],i});
        auto val = *(st.find_by_order(n/2 - 1));
        cout<<val.first<<"\n";
        st.insert({a[i],i});
    }
}

Measured memory_bytes: 16256
/*
 * author: Tran Minh Khoa
 * Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int inf = (int) 1e9 + 7;
const long long INF = (long long) 1e18 + 7;

const int N = 123456;
const int M = 1010;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sz(a) (int) a.size()
#define all(a) a.begin(), a.end()
#define sqrt(x) (x) * (x)

#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define DEBUG(x) cerr << #x << " = " << x << '\n';
#define PR(x, a, b) { cerr << #x << " = "; REP(i, a, b) cerr << x[i] << ' '; cerr << '\n'; }
                 
int main() {
  #ifdef KM777
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
  #endif
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr); cout.tie(nullptr);
  
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  vector<long long> dp(n);
  dp[0] = 0;
  dp[1] = abs(h[1] - h[0]);
  for (int i = 2; i < n; i++) {
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[n - 1] << '\n';
        
  return 0;
}

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

int main(void){
    int n, m;
    cin >> n >> m;
    
    int c[51] = {0};
    int a, b;
    int i;
    for(i = 1; i <= m; i++){
        cin >> a >> b;
        c[a]++;
        c[b]++;
    }
    
    for(i = 1; i <= n; i++){
        cout << c[i] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define pint pair<int,int>
using namespace std;

int main(){
	int a,b,c;	cin>>a>>b>>c;
	if(a+b>=c-1)	cout<<b+c;
	else	cout<<a+b+1+b;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i = 0; i < (n); ++i )
#define rep_rev(n,i) for(ll i = n; i >= 0; --i )
using namespace std;
using P = pair<int, int>;
const long long INF = 1LL << 60;

int main(){
  ll N, A, B; cin >> N >> A >> B;
  ll ans;
  if((N == 1 && B-A > 1) || A > B) ans = 0;
  else if(A == B) ans = 1;
  else ans = (N-2)*(B-A) + 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
<?php
    
    $stdin = trim(fgets(STDIN));
    
    for($i = 0;$i < $stdin;$i++) {
        $line = fgets(STDIN);
        $inputs = array();
        $inputs[] = explode(' ', trim($line));
        sort($inputs[0]);
        if(($inputs[0][0]*$inputs[0][0]+$inputs[0][1]*$inputs[0][1])==$inputs[0][2]*$inputs[0][2]){
            echo("YES\n");
        }else{
            echo("NO\n");
        }
    }

Measured memory_bytes: 6580
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main()
{
   int A, B;
   cin>>A>>B;
   int res;

   if(B%A==0){
       res = A+B;
   } else{
       res = B-A;
   }

   cout << res << endl;
}

Measured memory_bytes: 256
import Control.Applicative

c_in_r w h x y r | (x+r)<=w && (x-r)>=0 && (y+r)<=h && (y-r)>=0 = "Yes"
				 | otherwise 									= "No"

main = do
	[w,h,x,y,r] <- (map(read::String->Int) . words) <$> getLine
	putStrLn $ c_in_r w h x y r

Measured memory_bytes: 3524
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,w,dp[2][1<<16],cnt,ans;
string s[1000];

int DP(int i,int j,int k,int now){
  now%=2;
  int L=0,res=0,sut=0,mask=0;

  if(j){
    int mask=0;
    r(l,j)mask<<=1,mask|=1;
    L = __builtin_popcount(mask&k);
    if( L < s[i].size()){
      if(L&&s[i][L-1]==s[i][L]&&(k&1))res+=2;
    }
    sut=L;
  }

  mask=(1<<25)-1;
  r(l,j)mask<<=1;
  int sum = __builtin_popcount(mask&k);
  if((k&(1<<(w-1)))&&s[i-1][s[i-1].size()-sum]==s[i][sut])res+=2;

  int nex=0;
  r(l,w-1)nex|=1,nex<<=1;
  nex&=(k<<1);

  if(w-j-1>=s[i].size()-sut){
    dp[(now+1)%2][nex] = max(dp[(now+1)%2][nex],dp[now%2][k]);
  }
  if(s[i].size()-sut-1>=0&&s[i].size()-sut-1<=w-j-1){
    dp[(now+1)%2][nex|1] = max(dp[(now+1)%2][nex|1] , dp[now%2][k]+ res);
  }
}

signed main(){
  memset(dp,-1,sizeof(dp));
  dp[0][0]=0;
  cin>>n>>w;
  r(i,n)cin>>s[i+1];
  r(i,w)s[0]+='z'+1; n++;
  for(int i=1;i<n;i++){
    for(int j=0;j<w;j++){
      for(int k=0;k<(1<<w);k++){
        if(dp[cnt%2][k]==-1)continue;
        DP(i,j,k,cnt);
      }
      r(k,1<<w)dp[cnt%2][k]=-1;
      cnt++;
    }
  }
  r(i,1<<w) ans=max(ans,dp[cnt%2][i]);
  cout<<ans<<endl;
}


Measured memory_bytes: 3724
#include<bits/stdc++.h>
using namespace std;
#define db(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<'\n'
const int N = 3e3;
string s1, s2, res;
int mem[N+9][N+9];

int dp(int i, int j) {
	if(i<=0 || j<=0) return 0;
	if(mem[i][j] != -1) return mem[i][j];
	if(s1[i]==s2[j]) {
		return mem[i][j] = dp(i-1, j-1) + 1;
	}
	else return mem[i][j] = max(dp(i-1, j), dp(i, j-1));
}
void getLCS(int i, int j) {
	if(i<=0 || j<=0) return;
	if(s1[i] == s2[j]) {
		res.push_back(s1[i]);
		getLCS(i-1, j-1);
	}
	else {
		if(mem[i-1][j]>=mem[i][j-1]) {
			getLCS(i-1, j);
		}
		else {
			getLCS(i, j-1);
		}
	}
}
int main(){
	ios_base::sync_with_stdio(0);
	int a,b,n,T,cas=0;
	cin>>s1>>s2;
	s1 = " "+s1;
	s2 = " "+s2;
	memset(mem, -1, sizeof(mem));
	dp(s1.size()-1, s2.size()-1);
	getLCS(s1.size()-1, s2.size()-1);
	reverse(res.begin(), res.end());
	// if(res.empty()) cout<<"The answer is (an empty string).\n";
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 35968
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n, x;
  cin >> n >> x;
  vector<int> a(n);
  rep (i,0,n){
    cin >> a[i];
    x -= a[i];
  }
  cout << n + x / (*min_element(ALL(a))) << endl;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int k = Integer.parseInt(in.next());
            int ans = 1;

            for (int i = 0; i < n; i++) {
                ans = Math.min(ans * 2, ans + k);
            }

            // 出力
            out.println(ans);

        }

    }
}



Measured memory_bytes: 21716
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <set>
#include <string>

#ifndef ONLINE_JUDGE
	#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#else
	#define DEBUG(x) do {} while(0);
#endif

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define FOR(i, A, N) for(int (i) = (A); (i) < (N); (i)++)
#define REP(i, N) for(int (i) = 0; (i) < (N); (i)++)

using namespace std;
typedef long long ll;
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }

int n,m;
const int mod = 1000000007;
ll modpow(ll a, ll e) {
	if (e == 0) return 1;
	ll x = modpow(a * a % mod, e >> 1);
	return e & 1 ? x * a % mod : x;
}

ll A[3333];
ll dp[3333][3333];

int main() {
	ll inv2 = modpow(2, mod-2);
	int n,q;
	scanf("%d%d", &n, &q);
	REP(i, n) scanf("%lld", A+i);
	REP(i, n) REP(j, n) dp[i][j] = A[i]>A[j];
	REP(i, q) {
		int x,y;
		scanf("%d%d", &x, &y);
		x--;y--;
		ll o = dp[x][y];
		dp[x][y] = (inv2*dp[x][y]+inv2*dp[y][x])%mod; 
		dp[y][x] = (inv2*dp[y][x]+inv2*o)%mod;
		for(int i = 0; i < n; i++) {
			if(i == x || i == y)
				continue;
			ll ix = dp[i][x];
			ll xi = dp[x][i];
			dp[i][x] = (inv2*dp[i][x]+inv2*dp[i][y])%mod;
			dp[x][i] = (inv2*dp[x][i]+inv2*dp[y][i])%mod;
			dp[i][y] = (inv2*dp[i][y]+inv2*ix)%mod;
			dp[y][i] = (inv2*dp[y][i]+inv2*xi)%mod;
		}
		
	}
	ll sum = 0;
	REP(i, n) REP(j, n) if(i < j) sum = (sum+(mod+dp[i][j])%mod+mod)%mod;
	REP(i, q) sum = (2*sum)%mod;
	printf("%lld\n", sum);

	return 0;
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
const int mod=1000000007;

vector<bool> p(1010,true);

void era(){
	p[0]=false;
	p[1]=false;
	for(int i=2;i<1010;++i){
		if(p[i]){
			for(int j=i+i;j<1010;j+=i) p[j]=false;
		}
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n+1);
	ll ans=1;
	era();
	for(int i=1;i<=n;++i){
		int k=i;
		for(int j=2;j<=i;++j){
			if(p[j]){
				while(k%j==0){
					a.at(j)++;
					k/=j;
				}
			}
		}
	}
	for(int i=2;i<=n;++i){
		if(a.at(i)){
			ans*=a.at(i)+1;
			ans%=mod;
		}
	}
	cout << ans << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<tuple<string, int, int>>sp(n);
  for(int i=0; i<n; i++){
    cin >> get<0>(sp[i]) >> get<1>(sp[i]);
    get<1>(sp[i])=-get<1>(sp[i]);
    get<2>(sp[i])=i+1;
  }
  sort(sp.begin(), sp.end());
  for(int i=0; i<n; i++)cout << get<2>(sp[i]) << endl;
  return 0;
}

Measured memory_bytes: 888
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 100100
#define PI 3.141592653589793238
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
ll spf[1000001];
void sieve()
{
    spf[1]=1;
    ll n=1000000;
    for(ll i=1;i<=n;i++)
        spf[i]=i;
    for(ll i=4;i<=n;i+=2)
        spf[i]=2;
    for(ll i=3;i*i<=n;i++)
    {
        if(spf[i]==i)
        {
            for(ll j=i*i;j<=n;j+=i)
                if(spf[j]==j)
                    spf[j]=i;
        }
    }
}
void solve(){
//    sieve();
//    for(ll i=1;i<=100;i++)
//    {
//        cout<<"i:= "<<i<<" spf= "<<spf[i]<<endl;
//    }
    ll n;cin>>n;
    ll a[n+1];
    for(ll i=1;i<=n;i++)cin>>a[i];
    sort(a+1,a+n+1);
    ll ans=0;
    unordered_map<ll,ll> pf;
    ll i=1;
    while(i<=n)
    {
        ll j=i;
        while(j<=n and a[j]==a[i])j++;
        ll first=a[i];
        if(j-i>=2)
            pf[first]=1;
        else
        {
            bool flag=true;
            for(ll k=1;k*k<=first;k++)
            {
                if(first%k==0)
                {
                    ll a=k,b=first/k;
                    if(pf.count(a) or pf.count(b))
                    {
                        flag=false;
                        break;
                    }
                }
            }
            if(flag)
            {
//                cout<<first<<endl;
                ans++;
            }
            pf[first]=1;
        }
        i=j;
    }
    cout<<ans<<endl;
}
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

//    cin.tie(NULL);cout.tie(NULL);
//    ll t;cin>>t;while(t--)
    solve();
    return 0;
}


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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 5;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const ll N = 1e6+5;
string s;
vector<ll> v[N];
ll a,b;

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> a >> b;
  if (a < b ) {
    rep(i,b) cout << a;
  } else {
    rep(i,a) cout << b;
  }
  cout << endl;
  return 0;
  }


Measured memory_bytes: 23680
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define dcml(n) fixed<<setprecision(n)
using namespace std;
int main(void){
    ll N,D;cin>>N>>D;
    ll X[N][D];
    WREP(i,N,j,D)cin>>X[i][j];
    ll cnt=0;
    REP(i1,N-1){
        FOR(i2,i1+1,N){
            ll l0=0;
            //if(i1==i2)continue;
            REP(j,D){
                l0+=(X[i1][j]-X[i2][j])*(X[i1][j]-X[i2][j]);
            }
            ld d0=sqrt(l0);
            if(d0==(ll)(d0))cnt++;
        }
    }
    cout<<cnt<<"\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;
#include <functional>

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 100;

int N;

class Edge{
public:
	int from, to, cost;
	Edge(int from = 0, int to = 0, int cost = 0) :
		from(from), to(to), cost(cost){}

	bool operator < (const Edge &e) const{
		return cost < e.cost;
	}
	bool operator >(const Edge &e) const{
		return cost > e.cost;
	}

};

static const int INFTY = (1 << 21);

class Node{
public:
	vector<Edge> edges;
	int dist;
	Node(){
		dist = INFTY;
	}
};

class Graph{
public:
	vector<Node> nodes;
	Graph(int n) {
		rep(i, n) { Node n;  nodes.push_back(n); }
	}
};

class Data{

public:
	int dist; Edge edge;
	Data(int dist, Edge edge) {
		this->dist = dist;
		this->edge = edge;
	}

	bool operator < (const Data &d) const{
		return dist < d.dist;
	}
	bool operator >(const Data &d) const{
		return dist > d.dist;
	}

};

int main() {

	cin >> N;
	Graph g(N);

	rep(i, N){
		int no; cin >> no;
		int n_edge; cin >> n_edge;

		rep(j, n_edge){
			int from = no;
			int to; cin >> to;
			int cost; cin >> cost;
			Edge e(from, to, cost);
			g.nodes[no].edges.push_back(e);
		}
	}

	int i = 0;
	g.nodes[i].dist = 0;

	priority_queue<Data, vector<Data>, greater<Data> > pq;
	for (auto e : g.nodes[i].edges){
		int dist = g.nodes[i].dist + e.cost;
		Data d(dist, e);
		pq.push(d);
	}

	int ret = 0;
	while (!pq.empty()){
		Data d = pq.top(); pq.pop();
		Node *n = &g.nodes[d.edge.to];
		if (n->dist != INFTY){ continue; }
		n->dist = d.dist;

		for (auto e : n->edges){
			int dist = n->dist + e.cost;
			Data d(dist, e);
			pq.push(d);
		}
	}

	rep(i, N){
		cout << i << " " << g.nodes[i].dist << endl;
	}
}

Measured memory_bytes: 3196
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

long gcd(long a, long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    b %= a;
  }
}

void solve() {
  long N;
  cin >> N;
  vector<long> A(N);
  rep (i, N) cin >> A[i];
  long ans = A[0];
  rep (i, N) ans = gcd(ans, A[i]);
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x;
	bool f=false;
	cin>>x;
	for(ll i=x;i<1000005;i++){
		for(ll j=2;j<100005;j++){
			if(i%j==0 && i!=j){
				f=true;
			}
		}
		if(f==false){
			cout<<i<<endl;
			return 0;
		}
		f=false;
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 10000

int main() {
	int count,i,tmp,n,a[N],flag;

	count = 0;

	scanf("%d", &n);

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

	flag = 1;
	while (flag) {
		flag = 0;
		for (i = 1;i < n; i++) {
			if (a[i] < a[i - 1]) {
				tmp = a[i];
				a[i] = a[i - 1];
				a[i - 1] = tmp;
				count++;
				flag = 1;
			}
		}
	}
	for (i = 0; i < n; i++) {
		printf("%d", a[i]);
		if(i < n -1)
			putchar(' ');
	}
	printf("\n");
	printf("%d\n", count);

	return 0;
}


Measured memory_bytes: 2140
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var NMX = ReadLine().Split().Select(int.Parse).ToArray();
        var N = NMX[0];
        var M = NMX[1];
        var X = NMX[2];
        var map = new int[N + 1];

        var A = ReadLine().Split().Select(int.Parse).ToArray();
        foreach (var item in A)
        {
            map[item] = 1;
        }
        WriteLine(Math.Min(map.Take(X + 1).Sum(), map.Skip(X).Sum()));
    }
}

Measured memory_bytes: 13396