akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		for (int i=0;i<200;i++) {
			for (int j=-200;j<200;j++) {
				long A = i;
				long B = j;
				A= A*A*A*A*A;
				B= B*B*B*B*B;
				if (A-B==X) {
					System.out.println(i+" "+j);
					return ;
				}
			}
		}
	}
}

Measured memory_bytes: 38832
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
		    a[i] = sc.nextInt();
		}
		Arrays.sort(a);

		// 計算
		int result = 0;
		int min = a[0];
		int nowIndex = Integer.MAX_VALUE;
		int nextIndex = 0;
		while(nowIndex != nextIndex){
		    nowIndex = nextIndex;
		    for(int i = 0; i < n; i++){
		        if(i == nowIndex) continue;
		        int now = min;
		        int r = a[i]%now;
		        if(r != 0 && r < min){
		            min = r;
		            nextIndex = i;
		        }
		    }
		    a[nextIndex] = min;
		}
		result = min;
		
		// 出力
		System.out.println(result);
        
	}
}


Measured memory_bytes: 50692
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vii = vector<ii>;
const int oo = 1e8+7;
const int nax = 3005;

int main() {
    
    int n;
    scanf("%d",&n);
    vector<ll> nums(n);
    vector<ll> runsum(n);
    
    ll run = 0;
    for(int i = 0; i < n; ++i) {
        scanf("%lld",&nums[i]);
        run += nums[i];
        runsum[i] = run;
    }
    
    // dp[s][e].first - maximum you can get if it's your turn and ends lie at s and e
    // dp[s][e].second - minimum you can get if it's your turn and ends lie at s and e
    vector<vector<ll>> dp(nax, vector<ll>(nax, -oo));

    for(int s = n-1; s >= 0; --s) {
        dp[s][s] = nums[s];
        
        for(int e = s+1; e < n; ++e) {
            //X - Y
            
            ll diff1 = ((runsum[e] - (s-1 >= 0 ? runsum[s-1] : 0)) - dp[s+1][e]) - dp[s+1][e];
            ll diff2 = ((runsum[e] - (s-1 >= 0 ? runsum[s-1] : 0)) - dp[s][e-1]) - dp[s][e-1];
            
            if(diff1 > diff2) {
                dp[s][e] = (runsum[e] - (s-1 >= 0 ? runsum[s-1] : 0)) - dp[s+1][e];
            } else {
                dp[s][e] = (runsum[e] - (s-1 >= 0 ? runsum[s-1] : 0)) - dp[s][e-1];
            }
            
            debug() << imie(s) imie(e) imie(dp[s+1][e]) imie(dp[s][e-1]) imie(dp[s][e]);
        }
    }
    
    dp[0][n-1] = dp[0][n-1] - (run - dp[0][n-1]);
    printf("%lld\n", dp[0][n-1]);
    
    return 0;
}




Measured memory_bytes: 70912
#include<stdio.h>

int main(void)
{
    int n,i=1,keta=0;
  
    scanf("%d",&n);
  while(1)
  {
  	if(i<=9||(i>=100&&i<=999)||(i>=10000&&i<=99999))
      keta++;
    if(i==n)
      break;
    i++;
  }
  printf("%d",keta);
 return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int main(void){
    int n,i,j;
    scanf("%d",&n);
    for(i=1;i<n+1;i++){
        if(i%3==0){
            printf(" %d",i);
            continue;
        }
        else{
            j=i;
            while(j>0){
                if(j%10==3){
                    printf(" %d",i);
                    break;
                }
                j=j/10;
            }
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 1816
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<numeric>
#include<queue>
#include<stack>
#include<map>
#include<unordered_map>
#include<set>
#include<bitset>
#include<random>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define pb push_back
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;

ll n = 0, m = 0, ans = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok;
ll dx[9] = { 0,1,0,-1,0,1,1,-1,-1 }, dy[9] = { 0,0,1,0,-1,1,-1,1,-1 };
#define endl '\n'
#pragma endregion
#define MAX 222222


ll dp[MAX][2][111];



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


  cin >> s;
  cin >> m;
  dp[0][0][0] = 1;
  rep(i, s.length()) {
    ll digit = s[i] - '0';
    
    rep(j, digit) rep(k, m) {
      (dp[i + 1][1][(k + j) % m] += dp[i][0][k]) %= mod;
    }
    rep(j, 10) rep(k, m) {
      (dp[i + 1][1][(k + j) % m] += dp[i][1][k]) %= mod;
    }
    rep(k, m) (dp[i + 1][0][(k + digit) % m] += dp[i][0][k]) %= mod;
  }

  cout << (dp[s.length()][0][0] + dp[s.length()][1][0] + mod - 1) % mod << endl;


  return 0;
}

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

int main(){
    string s;
    cin>>s;
    if (s[2]==s[3]&&s[4]==s[5])
    {
        /* code */
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    
    
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
int main()
{
	ll n;
	cin>>n;
	ll a[n];
	rp(i,0,n)cin>>a[i];
	bool s=true;
	rp(i,0,n){
		if(a[i]%2==0&&a[i]%3!=0&&a[i]%5!=0)
		s=false;
	}
	if(s)
	cout<<"APPROVED";
	else
	cout<<"DENIED";
}


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

using namespace std;

int main() {
	int N, K, C;
	cin >> N >> K >> C;
	string s;
	cin >> s;

	vector<int> tap;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'o') { tap.emplace_back(i + 1); }
	}
	if (tap.size() < K) { return 0; }

	vector<int> L(K, -1), R(K, 0);
	L[0] = tap[0];
	int idx = 0;
	for (int i = 1; i < K; ++i) {
		while (idx < tap.size() && L[i - 1] + C >= tap[idx]) { ++idx; }
		if (idx < tap.size()) { L[i] = tap[idx]; }
	}
	R.back() = tap.back();
	idx = tap.size() - 1;
	for (int i = K - 2; i >= 0; --i) {
		while (idx >= 0 && tap[idx] + C >= R[i + 1]) { --idx; }
		if (idx >= 0) { R[i] = tap[idx]; }
	}


	vector<int> ans;
	for (int i = 0; i < K; ++i) {
		if (L[i] > 0 && L[i] == R[i]) { ans.emplace_back(L[i]); }
	}
	for (auto v : ans) { cout << v << endl; }

	return 0;
}


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

using namespace std;
#define pi acos(-1)
#define _terminated return 0
#define endl "\n"
#define yes cout << "yes" << endl 
#define no cout << "no" << endl 
#define booster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<long> > v2l;

const int mod = 1e+5;
const int mx = 2e+5;
const ll inf = 1e18;

void upper_bubble_sort(){
     int i,j,temp,number_of_input;
     int array[100];
     cin >> number_of_input;
     for(i=0; i<number_of_input; i++)
         cin >> array[i];
         for(i=0; i<number_of_input; i++){
             for(j=0; j<(number_of_input-i-1); j++){
               if(array[j] > array[j+1]){
                 temp = array[j];
                 array[j] = array[j+1];
                 array[j+1] = temp;
                }
              }
         }
    for(i=0; i<number_of_input; i++)
      cout << array[i] << endl;
}
void bst(void){
          int low,high,mid,keynum,num,array[100];
          cin >> keynum;
          low = 1;
	         high = num;
         	do{
		        mid = (low + high) / 2;
		         if(keynum < array[mid])
			         high = mid - 1;
		         else if (keynum > array[mid])
			         low = mid + 1;
	         } 
          while (keynum != array[mid] && low <= high);
	        if(keynum == array[mid]){
            cout << "number located at " << mid +1 << endl;}
         else
           no;
        }

int solvio1(int p){
     while (p >= 10) 
     p /= 10; 
     return p; 
} 
void solve(){ 
    int i,j,n;   
    cin >> n; 
    int tot[10][10] = {}; 
    for (i = 1; i <= n; i++) { 
        int pro1  = i % 10; 
        int pro = solvio1(i); 
        tot[pro][pro1]++; 
    } 
    int ans = 0; 
    for(i=0; i<10; i++)
    for(j=0;j<10;j++)
      ans = ans + tot[i][j] * tot[j][i];
      cout << ans << endl; 
} 

    
int main(){
    booster;
    solve();
    _terminated;
}

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

int main() {
  int x;
  cin >> x;
  vector<long long> p5(2001);
  for(int i=-1000;i<1001;i++){
    p5[i+1000]=pow(i,5);
  }
  for(int i=0;i<2002;i++){
    for(int j=0;j<2002;j++){
      if(p5[i]-p5[j]==x){
        cout << i-1000 << " " << j-1000;
        return 0;
      }
    }
  }
}


Measured memory_bytes: 4116
#include <iostream>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;

	if ((n + 1) / 2 >= k) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	system("pause");

    return 0;
}


Measured memory_bytes: 504
X, N = map(int, input().split())
p_list = list(map(int, input().split()))

if N == 0:
  print(X)
else:
  p_list = sorted(p_list)
  all_range = list(range(102))
  A = [i for i in all_range if i not in p_list]
  B = [abs(i - X) for i in A]

  low = X - min(B)
  high = X + min(B)

  output = 0
  if high > 101:
    output = low
  if low < 0:
    output = high

  if output != 0:
    print(output)
  elif high in p_list:
    print(low)
  elif low in p_list:
    print(high)
  else:
    print(low)

Measured memory_bytes: 9220
#include<stdio.h>
#define N 101

int main()
{
    char s[N];
    int n;
    int check = 0;
    scanf("%s", s);
    for (n = 0; s[n] != '\0'&&check==0;n++){
        if(n%2==1){
            if(s[n]!='L'&&s[n]!='U'&&s[n]!='D'){
                check = 1;
            }
        }else{
            if (s[n] != 'R' && s[n] != 'U' && s[n] != 'D'){
                check = 1;
            }
        }
    }
    if(check==0)
        printf("Yes\n");
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <cmath>
#include <numeric>
#include <stack>
#include <iomanip>
#include <complex>
#include <functional>
#include <tuple>

using namespace std;

#define Rep(i,a,b) for(ll i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")

using ll = long long;

constexpr int inf = 1e9 + 7;
constexpr ll infll = 1ll << 60ll;
constexpr ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

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

    void Cout(long long x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const T& x, const char* end = "\n") { std::cout << x << end; }
    template <typename T> void Cout(const std::vector<T>& x, const char* sep = " ", const char* end = "\n") { for (std::size_t i = 0, sz = x.size(); i < sz; i++) { std::cout << x[i] << (i == sz - 1 ? end : sep); } }

    // 標準入出力
    struct inp {
        std::size_t sz;
        inp(std::size_t _sz = 1) : sz(_sz) {}
        template <typename T> operator T () const { T a; std::cin >> a; return a; }
        template <typename T> operator std::vector<T>() const { std::vector<T> a(sz); for (std::size_t i = 0; i < sz; i++) std::cin >> a[i]; return a; }
    };

    // 2次元用の標準入出力
    template<typename T>
    struct inpn {
        std::size_t szi, szj;
        inpn(std::size_t _szi, std::size_t _szj) : szi(_szi), szj(_szj) {}
        operator std::vector<std::vector<T>>() const {
            std::vector<std::vector<T>> a(szi, std::vector<T>(szj));
            for (std::size_t i = 0; i < szi; ++i)
                for (std::size_t j = 0; j < szj; ++j) cin >> a[i][j];
            return a;
        }
    };

    inp inp1; // input one
}

int main() {

    ll n = inp1;

    pair<ll, ll> ans;

    for (ll a = -200; a <= 200; ++a) {
        for (ll b = -200; b <= 200; ++b) {
            if (a * a * a * a * a - b * b * b * b * b == n) {
                ans = { a, b };
                break;
            }
        }
    }

    cout << ans.first << " " << ans.second << endl;

    return 0;
}


Measured memory_bytes: 3580
/* tempate
 *
 *
 */

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    vector<ll> b(n - 1);
    ll res = 0;
    rep(i, n - 1) cin >> b[i];
    rep(i, n - 1){
        if(i == 0) continue;
        if(i == n - 2) res += b[i];
        res += min(b[i - 1], b[i]);
    }
    res += b[0];
    if(n == 2) res += b[0];
    cout << res;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  int N; cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a[i];
  vector<bool> b(N, false);
  b[0] = true;

  int ans = 0;
  int n = 0;
  
  while(b[a[n]-1] == false) {
    b[a[n]-1] = true;
    n = a[n]-1;
    ans++;
    if(n == 1) {
      cout << ans << endl;
      return 0;
    }
  }

  cout << -1 << endl;

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Edge{
	Edge(int arg_from,int arg_to){
		from = arg_from;
		to = arg_to;
	}
	int from,to;
};


int main(){

	int N,K;

	cin >> N >> K;

	int M = 0;
	vector<Edge> G;

	for(int base = 1; base <= N; base*=2){

		for(int adj = base+1; adj <= N; adj++){
			if((base&adj)){
				G.push_back(Edge(base,adj));
				M++;
			}
		}
	}

	cout << M << endl;

	for(int i = 0; i < G.size(); i++){

		cout << G[i].from << " " << G[i].to << endl;
	}

	int sum;
	string buf;
	bool FLG;

	for(int loop = 0; loop < K; loop++){

		sum = 0;
		FLG = false;

		for(int base = 1; base <= N; base*=2){

			cout << base << endl;

			cin >> buf;
			if(buf[0] == 'Y'){
				FLG = true;
				break;
			}
			if(buf[0] == 'N' && buf[1] == 'e')sum += base;
		}
		if(FLG)continue;

		cout << sum << endl;
		cin >> buf;
	}

	return 0;
}



Measured memory_bytes: 3332
/*بسم الله الرحمن الرحيم*/
/*“Dengan menyebut nama Allah yang Maha Pengasih lagi Maha Penyayang”*/
/*“In the name of Allah, Most Gracious, Most Merciful”*/
/********************************************************************************************************\__
                                                                                                          |
        author  :   Althafa Dhia Syauqi   ||    email   :    daltafa@gmail.com                              ||
        SMAN 10 Samarinda, Kalimantan Timur.                                                    ||
                                                                                                          ||
/********************************************************************************************************/
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define rep_k(i,n) for(int x=i;x<n;x++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep_n(i,n) for(int i=1;i<=(n);i++)
#define rep_all(k) for(auto x:k)
#define endl '\n'
#define mod 1e9+7
#define pb push_back
#define READ(f)         freopen(f, "r", stdin)
#define WRITE(f)        freopen(f, "w", stdout)
#define maxSort         sort(all(v),greater<int>())
#define rSort           sort(v.rbegin(),v.rend())
#define FOREACH(i,c) for (typeof((c).end()) i = (c).begin(); i != (c).end(); ++i)
#define RESET(c,v) memset(c, v, sizeof(c))
#define sqr(x)          ((x)*(x))
#define qube(x)         ((x)*(x)*(x))
using namespace std;
void optimization()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
ll t,maks=0,temp,ans=0;
int main()
{
	optimization();
    cin>>t;
  rep(i,t)
    {
       cin >> temp;
        ans+=temp;
    maks=max(maks,temp);
    }
  ans-=maks/2;
  cout<<ans<<endl;
}


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

mt19937 mt(time(nullptr));
// uniform_int_distribution< int > rand_int(0, 10) // rand[0, 10] inclusive

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed;
  int h, w, k;
  cin >> h >> w >> k;
  vector< string > m(h);
  for (int i=0; i<h; ++i) cin >> m[i];
  int h2=1, w2=1;
  for (int i=0; i<h; ++i) h2 *= 2;
  for (int i=0; i<w; ++i) w2 *= 2;
  int ans = 0;
  for (int i=0; i<h2; ++i) {
    for (int j=0; j<w2; ++j) {
      int cur = 0;
      int k2=1;
      for (int k=0; k<h; ++k) {
	int l2=1;
	for (int l=0; l<w; ++l) {
	  if (m[k][l]=='#') {
	    if (!(i&k2) && !(j&l2)) cur++;
	  }
	  l2 *= 2;
	}
	k2 *= 2;
      }
      if (cur==k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3652
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    int n;
    scanf("%d", &n);
    int pt = 0;
    int px = 0;
    int py = 0;
    for (int i = 0; i < n; i++) {
        int t, x, y;
        scanf("%d %d %d", &t, &x, &y);
        int dt = t - pt;
        int dx = abs(x - px);
        int dy = abs(y - py);
        int dd = dt - dx - dy;
        if (dd < 0 || dd % 2 != 0) {
            printf("No\n");
            return EXIT_SUCCESS;
        }
        pt = t;
        px = x;
        py = y;
    }
    printf("Yes\n");
    return EXIT_SUCCESS;
}


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

long long mod = 1000000007LL;

typedef pair<long long, long long> ii;
int main(){
	//freopen("i.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n; set<int> s;
	cin >> n;
	for(int i = 0;i < n;i++){
		int x; cin >> x;
		s.insert(x);
	}
	
	if(s.size() == n) cout << "YES";
	else cout << "NO";
	
}


Measured memory_bytes: 9600
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

long long gcd(long long a, long long b) {return b?gcd(b, a%b):a;}

ll ans;
ll t[205][205];

int main(void) {
    ll k;
    cin >> k;

    for (ll i=1; i<=k; i++) for (ll j=1; j<=k; j++) {
        t[i][j] = gcd(i, j);
    }

    for (ll i=1; i<=k; i++) {
        for (ll j=1; j<=k; j++) {
            for (ll l=1; l<=k; l++) {
                ans += gcd(t[i][j], l);
            }
        }
    }
    

    cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3944
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int main()
{
  int n;
  cin >> n;
  vecll a(n,0);
  map<int, ll> mp;
  REP(i,n){
    cin >> a[i];
    mp[a[i]]++;
  }
  map<int, ll> v;
  ll sum = 0;
  REPvec(itr,mp){
    ll tmp = (itr->second)*(itr->second - 1)/2;
    v[itr->first] = tmp;
    sum += tmp;
    // cout << itr->first << " " << itr->second << " " <<tmp << endl;
  }


  ///////////////
  REP(i,n){
    ll tmp = sum - v[a[i]];
    ll tmp2 = (mp[a[i]] - 1)*(mp[a[i]] - 2)/2;
    cout << tmp + tmp2 << endl;
  }
  
}


Measured memory_bytes: 18944
#pragma region Macros
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define REV(x) reverse(ALL(x))
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define SP << " " <<
#define INF2 1000000000000000037
#define INF  1000000007
#define lwb(x,n) distance(x.begin(),lower_bound(ALL(x),(n)))
#define upb(x,n) distance(x.begin(),upper_bound(ALL(x),(n)))
#define fora(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#ifdef _MY_DEBUG
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define de(...) CHOOSE((__VA_ARGS__,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define de(...)
#endif
using namespace std;
using ll = long long;
using ld = long double;
template<class T = ll> using v = vector<T>;
template<class T = ll> using vv = vector<vector<T>>;
template<class T = ll> using vvv = vector<vector<vector<T>>>;
template<class T> bool maxi(T &a, const T &b){ if(a<b){a=b;return 1;}return 0;}
template<class T> bool mini(T &a, const T &b){ if(b<a){a=b;return 1;}return 0;}
template<class T> ll sumer(const T& a){ return accumulate(ALL(a),0LL); }
template<class T> void UNIQUE(vector<T> &a){ SORT(a);a.erase(unique(ALL(a)),a.end());}
template<class T, class U> ostream &operator<<(ostream &os, const pair<T,U> &pe) { os << pe.first << " " << pe.second; return os;}
template<class T> ostream &operator<<(ostream &os, const v<T> &ve) { rep(i,ve.size()) os<< (i?" ":"")<<ve[i]; return os;}
ll topbit(ll a) { return a==0?-1:63-__builtin_clzll(a);}
ll botbit(ll a) { return a==0?64:__builtin_ctzll(a);}
ll popcount(ll a) { return __builtin_popcountll(a);}
#define dame {cout<< retword <<"\n"; return;}
#pragma endregion
//--MODIFS---------------------------------
#pragma region Modifs
#define retword "-1"
#define MOD  1000000007
using P  = pair<ll,ll>;
using TP  = tuple<ll,ll,ll>;
#pragma endregion
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll A,B,N;
    cin>>A>>B>>N;
    ll n=(N+1)/B;
    ll x=n*B-1;
    ll ans=A*x/B-A*(x/B);
    maxi(ans, A*N/B-A*(N/B));
    cout<< ans <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // ll Qkai; cin>>Qkai; rep(QQ,Qkai) Main();
    Main();
}
//-----------------------------------------

Measured memory_bytes: 3652
#include <stdio.h>

int main(void)
{
	int i, sco, c[3];
	float pa;
	
	while (scanf("%d %d %d", &c[0], &c[1], &c[2]) != EOF){
		
		sco = c[0] + c[1];
		pa = 0;
		
		for (i = 1; i <= 10; i++){
			
			if (i == c[0] || i == c[1] || i == c[2]){
				i++;
			}
			if (i == c[0] || i == c[1] || i == c[2]){
				i++;
			}
			if (i == c[0] || i == c[1] || i == c[2]){
				i++;
			}
			if (sco + i <= 20){
				pa++;
			}
		}
		pa = pa / 7.0;
		
		if (pa >= 0.5){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return (0);
}

Measured memory_bytes: 580
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  int n,d,a;cin>>n>>d>>a;
  dump(n,d,a);

  vector<pii> xh;
  rep(i, n){
    int x,h;
    cin>>x>>h;
    xh.pb(mp(x, h));
  }
  sort(all(xh));

  vector<int> x(n), h(n);
  rep(i, n){
    x[i] = xh[i].first;
    h[i] = xh[i].second;
  }
  dump(xh);
  dump(x);
  dump(h);

  int ans = 0;
  vector<int> im(n+1);
  int carry = 0;
  rep(i, n){
    cerrendl;
    carry += im[i];
    int r = h[i] - carry;
    if (r<=0) continue;

    int c = divceil(r, a);

    int left = i;
    int right = n;
    auto isright = [&](int j) {
      if (x[j]<= x[i] + 2*d){
        return false;
      }
      else{
        return true;
      }
    };
    while (right-left>1){/*{{{*/
      int mid = (right+left)/2;
      if (isright(mid)) { right = mid;}
      else{ left = mid; }
    }/*}}}*/

    dump(i, r, c, carry, right);
    im[right] -= a*c;
    carry += a*c;

    ans += c;
    dump(carry, ans);
  }
  dump(im);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 8684
import math
def solve(input_text):
    for line in input_text:
        op=line[1]
        a=int(line[0])
        b=int(line[2])
        ans=0
        
        if op=='+':
            ans=a+b
        if op=='-':
            ans=a-b
        if op=='*':
            ans=a*b
        if op == '/':
            ans =math.floor(a/b)
        print(ans)
    
def answer():
    input_text=[]
    line=[]
    
    while True:
        
        line = input()
        line= line.split(' ')
        if line[1]=='?':
            break
        input_text.append(line)
    
    solve(input_text)

if __name__ =='__main__':
    answer()


Measured memory_bytes: 5660
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sync ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD  1000000007
#define ll long long 
int powm(int base,int exp,int mod=MOD) {int ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
int32_t main()
{
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
		cin>>a[i];
	int count=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(j>i && a[i]>a[j])
				count++;
		}
	}
	int count1=0;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(a[i]>a[j])
				count1++;
		}
	}
	int ans=((k*(k-1)/2)%MOD*(count1))%MOD;
	count=(k*count)%MOD;
	cout<<(ans+count)%MOD<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

class UnionFind {
public:
	vector<int> par;//親の番号
    vector<int> rank;//木の深さ
 
	UnionFind(int n){//全ての要素に対して自身が根となるように初期化, 木の深さは0になる
		rep(i,n){
            par.push_back(i);
            rank.push_back(0);
        }
	}
 
	int find(int x) {//木の根を求める
		if(par[x]==x){
            return x;
        }else{
            return par[x]=find(par[x]);
        }
	}
 
	void unite(int x,int y){//xとyの属する集合を併合
        x=find(x);
        y=find(y);
        if(x==y) return;
        if(rank[x]<rank[y]){//木の深さが小さい方を大きい方へ繋げる
            par[x]=y;
        }else{
            par[y]=x;
            if(rank[x]==rank[y]) rank[x]++;
        }
    }

    bool same(int x,int y){//xとyが同じ集合に属するか否か
        return find(x)==find(y);
    }
};
//x以下の要素への最小index, ソートしてから使ってね
template <class T> 
int former(const vector<T> &v, T x){
  return upper_bound(v.begin(), v.end(), x) - v.begin() - 1;
}
//x以上の要素への最小index
template <class T> 
int latter(const vector<T> &v, T x){
  return lower_bound(v.begin(), v.end(), x) - v.begin();
}
//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}
//nCk
template <class T>
T comb(T n,T k){
    T ans=1;
    FOR(i,n-k+1,n+1){
        ans*=i;
    }
    FOR(i,1,k+1){
        ans/=i;
    }
    return ans;
}
//a,bの最大公約数
template <class T>
T gcd(T a,T b) {
	if (b == 0) return a;
	else return gcd(b, a % b);
}
//素因数分解
template <class T>
map<T,T> prime_factor(T x){
    map<T,T> ans;
    for(T i=2;i*i<=x;i++){
        while(x%i==0){
            x/=i;
            ans[i]++;
        }
    }
    if (x!=1){
        ans[x]=1;
    }
    return ans;
}
//約数列挙
template <class T>
vector<T> divisor(T x){
    vector<T> res;
    for(T i=1;i*i<=x;i++){
        if(x%i==0){
            res.push_back(i);
            if(i!=x/i){
                res.push_back(x/i);
            }
        }
    }
    return res;
}
//素数判定
template <class T>
bool is_prime(T x){
    for(T i=2;i*i<=x;i++){
        if(x%i==0){
            return false;
        }
    }
    return x!=1;
}

const ll inf=1e9+7;

ll mult(ll n,ll m){//n^m%infを求める
    if(m==1){
        return n%inf;
    }else if(m%2==0){//オーバーフロー防止のためにn^(m/2)*n^(m/2)を考える
        ll t=mult(n,m/2);
        return (t*t)%inf;
    }else{//奇数の時はn^(m-1)*nを考える
        ll t=mult(n,m-1);
        return (t*n)%inf;
    }
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> t(n+1,0),x(n+1,0),y(n+1,0);
    FOR(i,1,n+1){
        cin>>t[i]>>x[i]>>y[i];
    }
    bool flag=true;
    rep(i,n){
        int dl=abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        int dt=t[i+1]-t[i];
        if(dl>dt){
            cout<<"No"<<endl;
            return 0;
        }
        if((dt-dl)%2==1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 1408
n, m, x = map(int, input().split())
buf = []
for i in range(n):
    buf.append(list(map(int, input().split())))

import numpy as np
skill = np.array([0 for i in range(m + 1)])
ans_buf = []

for i in range(1, 2 ** n):
    flag = True
    two = str(bin(i))
    two = two[2:].zfill(n)

    for j in range(n):
        if two[j] == '1':
            skill += np.array(buf[j])
    
    for j in range(m):
        if skill[j + 1] < x:
            flag = False
    if flag:
        ans_buf.append(skill)
    skill = np.array([0 for i in range(m + 1)])


ans = [i[0] for i in ans_buf]
if ans == []:
    ans = [-1]
ans = min(ans)
print(ans)


Measured memory_bytes: 27972
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>
#include <utility>


using namespace std;
typedef long long ll;

//最小公倍数
ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//最大公倍数
ll lcm(ll x,ll y){
  return x/gcd(x,y)*y;
}

//階乗
ll kaijo(ll k){
    ll sum = 1;
    for (ll i = 1; i <= k; ++i)
    {
        sum *= i;
        sum%=1000000000+7;
    }
    return sum;
}

//for(int i = ; i < ; i++){}

ll lmax(ll s,ll t){
  if(s>t){
    return s;
  }
  else{
    return t;
  }
}

ll lmin(ll s,ll t){
  if(s<t){
    return s;
  }
  else{
    return t;
  }
}
// ここから開始

int main(){
  int n; 
  cin>>n;
  vector<int> v1;
  vector<int> v2;
  vector<int> v;
  for(int i = 0; i < n; i++){
    int a;
    cin>>a;
    v.push_back(a);
    if(i%2==0){
      v1.push_back(a);
    }
    else{
      v2.push_back(a);
    }
  }
  sort(v.begin(),v.end());
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  // for(int i = 0; i < n; i++){
  //   if(i%2==0){
  //     cout<<v1[i/2]<<" ";
  //   }
    
  // } 
 
  int cnt = 0;
  for(auto a: v1){
    for(int i = 1; i < n; i+=2){
      if(a==v[i]){
        cnt++;
        break;
      }
    } 
  }
  cout<<cnt<<endl;
  return 0;
}


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

int main() {
  int N, Alice, Bob;
  int max, l;
  cin >> N;
  
  vector<int> a(N);
  
  for(int i = 0; i < N ; i++) {
     cin >> a.at(i);
  }
  
  Alice = 0;
  Bob = 0;
  for(int i = 0; i < N ; i++) {
    max = 0;
    for(int j = 0; j < N; j++) {
      if(max < a.at(j)) {
        max = a.at(j);
        l = j;
      }
    }
    Alice += a.at(l);
    a.at(l) = 0; 
    
    max = 0;
    for(int k = 0; k < N; k++) {
      if(max < a.at(k)) {
        max = a.at(k);
        l = k;
      }
    }
    Bob += a.at(l);
    a.at(l) = 0;
  }
  if(Alice-Bob > 0) {
    cout << Alice-Bob << endl;
  }
  else {
    cout << Bob-Alice << endl;
  }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,K;
    cin >> N >> K;
    if(N % K)cout << 1 << endl;
    else     cout << 0 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
ll dp[2001][2001];
int main(){
    ll n,A[200001];
    cin>>n;
    rep(i,n) cin>>A[i];
    vector<P> B;
    rep(i,n) B.push_back(P(A[i],i));
    sort(all(B));
    rep(i,n)rep(j,n-i) dp[i+1][j]=max(dp[i][j]+abs(j+i-B[i].second)*B[i].first,dp[i][j+1]+abs(j-B[i].second)*B[i].first);
    cout<<dp[n][0]<<"\n";
}


Measured memory_bytes: 26252
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<stack>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#define INF 0x3f3f3f3f
#define mod 1000000009
#define e  2.718281828459045
#define eps 1.0e18
#define PI acos(-1)
#define lowbit(x) (x&(-x))
#define memset(x,y) memset(x,y,sizeof(x))
#define lson i << 1,l,m
#define rson i << 1 | 1,m + 1,r
#define ll long long
using namespace std;
int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("text1.in","r",stdin);
	//freopen("text1.out","w",stdout);
	int s,w;
	cin>>s>>w;
	if(s>w) cout<<"safe"<<endl;
	else cout<<"unsafe"<<endl;
	return 0;
}




Measured memory_bytes: 3648
from fractions import gcd

A, B, C, D = map(int, input().split())

# A以上B以下の整数のうち、CでもDでも割り切れないものの個数を出力せよ。

LCM = (C * D) // gcd(C, D)

by_C = B // C - (A - 1) // C
by_D = B // D - (A - 1) // D
by_LCM = B // LCM - (A - 1) // LCM
    
print(B - A + 1 - by_C - by_D + by_LCM)

Measured memory_bytes: 63980
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;
typedef long long ll;


int main(){

 int n; cin>>n;
 vector<int>v(n);

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

vector<int>left(n,0);
vector<int>right(n,0);

for(int i=1;i<n;i++)
    left[i] = max(left[i-1],v[i-1]);

 for(int i=n-2;i>=0;i--)
    right[i] = max(right[i+1],v[i+1]);

 for(int i=0;i<n;i++)
 cout<<max(left[i],right[i])<<endl;


return 0;
}


Measured memory_bytes: 5608
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
int main()
{
	int n;
	cin>>n;
	vector<int> d;
	d.resize(n);
	int i;
	for(i=0;i<n;i++)
		cin>>d[i];
	int ans = 0;
	sort(d.begin(),d.end());
	ans = d[(n/2)] - d[(n/2)-1];
	cout<<ans<<'\n';
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
const ld pi = 3.14159265358979323846;
//ll MOD = 1e9 + 7;
ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}
const ll N = 1e6;
vll cnt(N+1);
void solve(){
    ll n;
    cin>>n;
    ll a[n];
    vll c(N+1);
    fo(i,n){
        cin>>a[i];
        c[a[i]]++;
    }

    if(c[1]){
        if(c[1]==1){
            cout<<1<<nl;
        }
        else cout<<0<<nl;
        return;
    }
    ll ans = 0;
    fo(j,n){
        if(c[a[j]]>1)continue;
        ll f = 1,f2 = 0;
        for(ll i = 2;i*i<=a[j];i++){
            if(a[j]%i == 0){
                f2 = 1;
                if(c[i]){f = 0;break;}
                else if(c[a[j]/i]){f= 0;break;}
            }
            
        }

        ans += f;
    }
    cout<<ans<<nl;
    
}





int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll t = 1;
    //cin>>t;
    while(t--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";


}


Measured memory_bytes: 20360
#include<iostream>
#include<algorithm>
#include <cstdlib>
using namespace std;
int main() {
	int A, B, C, dif, cng1, cng2;
	cin >> A >> B >> C;
	if (A % 2) {
		cout << 0;
	} else {
		cng1 = 0;
		dif = abs(B - A);
		while (dif%2==0 && dif != 0) {
			dif /= 2;
			cng1 ++;
		}
		cng2 = 0;
		dif = abs(C - B);
		while (dif%2==0 && dif != 0) {
			dif /= 2;
			cng2 ++;
		}
		if (cng1 == 0 && cng2 == 0) cout << -1;
		else cout << min(cng1, cng2);
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main() {
  int N;
  string S;
  cin>>N>>S;
  map<char,int>cnt;
  for(int i=0;i<N;i++){
    cnt[S[i]]++;
  }
  int64_t sum=1;
  for(auto c:cnt){
    sum*=(c.second+1);
    sum%=1000000007;
  }
  cout<<(sum-1)<<endl;
  return 0;
}

Measured memory_bytes: 3744
#include <iostream>

using namespace std;
int main() 
{
    int n, a, b;
    cin >> n;
    if (n == 1) {
        cout << "Hello World" << endl;
    } else if (n == 2) {
        cin >> a;
        cin >> b;
        cout << (a + b) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String[] spl1 = s1.split(" ");
		int N = Integer.parseInt(spl1[0]);
		int X = Integer.parseInt(spl1[1]);
		String s2 = sc.nextLine();
		String[] spl2 = s2.split(" ");
		int[] L = new int[N];
		for(int i = 0;i < N;i++){
			L[i] = Integer.parseInt(spl2[i]);
		}
		sc.close();

		int cnt = 1;
		int D = 0;
		for(int i = 0;i < N;i++){
			D += L[i];
			if(D > X)break;
			cnt++;
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 23380
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
  d[i] += 1

max = 0
for i in set(a):
  if max < d[i]+d[i-1]+d[i+1]:
    max = d[i]+d[i-1]+d[i+1]
print(max)

Measured memory_bytes: 21472
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int count=0;
    rep(i,s.size()){
        if(s[i]=='2')count++;
    }
    cout<<count<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;
// << fixed << setprecision
// --------------------------------------
int n, m;

class UnionFind {
public:
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}

  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x != y) {
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }
  int size(int x) {
    return -data[find(x)];
  }

  int count() {
    int c = 0;
    REP(i, data.size()) {
      if(data[i] < 0) c++;
    }
    return c;
  }
};

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

  cin >> n >> m;

  UnionFind uf(n);

  REP(i, m) {
    int x, y, z;
    cin >> x >> y >> z;
    x--; y--;
    uf.unite(x, y);
  }

  cout << uf.count() << endl;
}


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

int main() {
  int a, b, c; cin >> a >> b >> c;
  int p5=(a==5) + (b==5) + (c==5);
  int p7=(a==7) + (b==7) + (c==7);
  if (p5 == 2 && p7 == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
vector<int>a(n);
vector<int>ans(n);
int sum = 0;
for(int i = 0;i<n;i++){
    cin >> a[i];
    sum ^= a[i];
}
for(int i = 0;i<n;i++)
    cout << (sum ^ a[i]) <<' ';
    return 0;
}

Measured memory_bytes: 4604
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef long long int lli;
using namespace std;

signed main() {
    int N;
    lli K;
    cin >> N >> K;
    vector<lli> A(N, 0);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int cnt[41] = {};
    for (int b = 0; b <= 40; b++) {
        for (int i = 0; i < N; i++) {
            if (!(A[i] & (1LL << b))) { // bth bit of A[i] = 0
                ++cnt[b];
            }
        }
    }

    lli maxX = 0;
    for (int b = 40; b >= 0; --b) {
        if ((maxX | (1LL << b)) <= K && N - cnt[b] <= cnt[b]) {
            maxX |= 1LL << b;
        }
    }

    lli ans = 0;
    for (int i = 0; i < N; i++) {
        ans += maxX ^ A[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024