akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  int n; cin >> n;
  vector<int> d(n);
  rep(i, n) cin >> d[i];

  sort(ALL(d));

  vector<int> dp(n, INF);
  rep(i, n) *lower_bound(ALL(dp), d[i]) = d[i];
  cout << distance(dp.begin(), lower_bound(ALL(dp), INF)) << endl;
}


Measured memory_bytes: 3500
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<class T>//ex) auto dp = make_vec(4,4,4,INF);
vector<T> make_vec(size_t s, T val) { return vector<T>(s, val); }
template<class... Size>
auto make_vec(size_t s, Size... tail) {
	return vector<decltype(make_vec(tail...))>(s, make_vec(tail...));
}


template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	for (const auto& e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& st) {
	for (const auto& e : st) os << e << " ";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& mp) {
	for (const auto& e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T&& h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head&& h, Tail&&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif
int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int H, W;
	cin >> H >> W;

	vector<vector<Int>> A(H+1, vector<Int>(W+1));
	vector<vector<Int>> B(H+1, vector<Int>(W+1));
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			cin >> A[i][j];
		}
	}
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			cin >> B[i][j];
		}
	}

	auto dp = make_vec(H+1, W+1, 13000, 0);

	//auto dp = make_vec(H + 1, W + 1, 200, 0);
	dp[0][0][abs(A[0][0]-B[0][0])] = 1;

	
	for (Int i = 0; i < H; i++) {
		for (Int j = 0; j < W; j++) {
			for (Int k = 0; k < 13000; k++) {
			//for (Int k = 0; k < 200; k++) {
				if (dp[i][j][k]) {
					dp[i + 1][j][k + abs(A[i + 1][j] - B[i + 1][j])] = 1;

					/*if (k - abs(A[i + 1][j] - B[i + 1][j]) >= 0) {
						dp[i + 1][j][k - abs(A[i + 1][j] - B[i + 1][j])] = 1;
					}*/
					dp[i + 1][j][abs(k - abs(A[i + 1][j] - B[i + 1][j]))] = 1;


					dp[i][j + 1][k + abs(A[i][j + 1] - B[i][j + 1])] = 1;
					/*if (k - abs(A[i][j + 1] - B[i][j + 1]) >= 0) {
						dp[i][j + 1][k - abs(A[i][j + 1] - B[i][j + 1])] = 1;
					}*/
					dp[i][j + 1][abs(k - abs(A[i][j + 1] - B[i][j + 1]))] = 1;

				}

				//DMP(dp);
			}
			//DMP(dp[i][j]);
		}
	}



	//DMP(dp);

	Int ans;
	for (Int k = 0; k < 13000; k++) {
		if (dp[H-1][W-1][k]) {
			cout << k << "\n";
			return 0;
		}
	}

}


Measured memory_bytes: 337920
import java.util.Scanner;
 
public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    long N = scanner.nextLong();
    long A = scanner.nextLong();
    long B = scanner.nextLong();
    
    long answer = A*(N/(A+B));
    answer += Math.min(N%(A+B),A); 
    
    System.out.println(answer);
  }
}

Measured memory_bytes: 23892
#[doc = " use std::str::FromStr;"]
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn main() {
   let b: String = read(); 
   let b = b.chars().next().unwrap();
   println!("{}",
       match b {
           'A' => 'T',
           'T' => 'A',
           'C' => 'G',
           'G' => 'C',
           _   => panic!()
       });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    double t,x; cin>>t>>x;
    cout<<fixed<<setprecision(10)<<t/x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LOCAL
#pragma region Macros
typedef long long ll;
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const long double INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

const int MAX=50;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<ll> A(N);
    for (int i=0;i<N;++i){
        long double a; cin >> a;
        a+=1e-10;
        A[i]=(ll)(INF*a);
    }
    vector<vector<ll>> cnt(MAX,vector<ll>(MAX,0));
    for (int i=0;i<N;++i){
        int p=0,q=0;
        while(A[i]%2==0) ++p,A[i]/=2;
        while(A[i]%5==0) ++q,A[i]/=5;
        ++cnt[p][q];
    }
    ll ans=0;
    for (int i=0;i<MAX;++i){
        for (int j=0;j<MAX;++j){
            for (int k=0;k<MAX;++k){
                for (int l=0;l<MAX;++l){
                    if (i+k>=18&&j+l>=18){
                        if (i==k&&j==l) ans+=cnt[i][j]*(cnt[i][j]-1);
                        else ans+=cnt[i][j]*cnt[k][l];
                    }
                }
            }
        }
    }
    cout << ans/2 << '\n';
}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
const int mod = 1e9+7;

int main() {
  int n;
  cin >> n;
  
  int ans = mod;
  rep(i,46298) {
    if (i * 108 / 100 == n) {
      ans = i;
      break;
    }
  }
  if (ans == mod)
    cout << ":(" << endl;
  else
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define MAX_N (200000)

typedef struct {
  int A;
  int B;
} st_work;

int b_sort(const void *a, const void *b) {
  return (((st_work*)a)->B - ((st_work*)b)->B);
}

int main(void) {
  int N;
  scanf("%d", &N);

  st_work work[MAX_N];
  for(int i = 0; i < N; i++) {
    scanf("%d %d", &work[i].A, &work[i].B);
  }
  qsort(work, N, sizeof(st_work), b_sort);

  int now = 0;
  bool ok = true;
  for(int i = 0; i < N; i++) {
    now += work[i].A;
    if(now > work[i].B) {
      ok = false;
      break;
    }
  }
  if(ok)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}


Measured memory_bytes: 3324
// C++ implementation of the approach 
#include <bits/stdc++.h> 
using namespace std; 
#define MOD (int)(1e9 + 7) 

// Function to find the count of integers 
// obtained by replacing '?' in a given 
// string such that formed integer 
// gives remainder 5 when it is divided by 13 
int modulo_13(string s, int n) 
{ 
	long long dp[n + 1][13] = { { 0 } }; 

	// Initialise 
	dp[0][0] = 1; 

	for (int i = 0; i < n; i++) { 
		for (int j = 0; j < 10; j++) { 
			int nxt = s[i] - '0'; 

			// Place digit j at ? position 
			if (s[i] == '?') 
				nxt = j; 

			// Get the remainder 
			for (int k = 0; k < 13; k++) { 
				int rem = (10 * k + nxt) % 13; 
				dp[i + 1][rem] += dp[i][k]; 
				dp[i + 1][rem] %= MOD; 
			} 
			if (s[i] != '?') 
				break; 
		} 
	} 

	// Return the required answer 
	return (int)dp[n][5]; 
} 

// Driver code 
int main() 
{ 
	string s = "?44"; 
  	cin>>s;
	int n=s.size(); 
	cout << modulo_13(s, n); 

	return 0; 
} 


Measured memory_bytes: 14024
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a,long long b)
{
	return b==0?a:gcd(b,a%b);
}
int main()
{
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	if(c==1||d==1)
	{
		cout<<0;
		return 0;
	}
	long long ans=0,t=(c*d)/gcd(c,d);
	ans+=(b/c-a/c);
	if(a%c==0)
	{
		ans++;
	}
	ans+=(b/d-a/d);
	if(a%d==0)
	{
		ans++;
	}
	ans-=(b/t-a/t);
	if(a%t==0)
	{
		ans--;
	}
	cout<<b-a+1-ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }
    int n;
    cin >> n;

    // int ans = 0;

    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            if (n == i * j)
            {
                sayYes();
                return;
            }
        }
    }
    sayNo();
    // cout << ans << endl;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
ll gcd(ll a, ll b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  ll N,X; cin >> N >> X;
  cout << 3 * (N-gcd(N,X)) << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long unsigned int ll;

const int INF = pow(2,30);
const int MAX_N = pow(10,2);
const int MAX_W = pow(10,5);

ll dp[MAX_N+1][MAX_W+1] = {};

int main() {
  int N, W; cin >> N >> W;
  ll a[N+1][2]; for (int i=1; i<=N; i++) for (int j=0; j<2; j++) cin >> a[i][j];

  for (int i=1; i<=N; i++) for (int j=0; j<=W; j++) {
    if (j>=a[i][0]) dp[i][j] = max(dp[i-1][j-a[i][0]]+a[i][1], dp[i-1][j]);
    else dp[i][j] = dp[i-1][j];
  }
  
  cout << dp[N][W] << endl;
  return 0;
}

Measured memory_bytes: 78336
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
using namespace std;

typedef int64_t ll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define vll vector<ll>
#define all(v) v.begin(), v.end()


ll N;

bool is_753(ll n) {
	ll flag[3] = { 0 };
	rep(i, 12) {
		ll tmp = n;
		rep(j, i) tmp /= 10;
		tmp %= 10;
		if (tmp == 7) ++flag[0];
		if (tmp == 5) ++flag[1];
		if (tmp == 3) ++flag[2];
	}
	if (flag[0] == 0 || flag[1] == 0 || flag[2] == 0) return false;
	else return true;
}

ll dfs(ll n) {
	if (n > N) return 0;

	ll ret = 0;
	if (is_753(n)) ++ret;

	ret += dfs(n * 10 + 7);
	ret += dfs(n * 10 + 5);
	ret += dfs(n * 10 + 3);

	return ret;

}


int main() {
	ll N;
	cin >> N;
	vector<vector<ll>> member(101, vll(101, 0));	// i が j を約数として何個含むか

	fori(i, 1, 101) {
		ll tmp = i;
		while (1 < tmp) {
			fori(j, 2, 101) {
				if (tmp % j == 0) {
					++member[i][j];
					tmp /= j;
					break;
				}
			}
		}
	}

	vll yaku(101, 0);
	ll ans = 0;
	rep(i, N + 1) rep(j, 101) yaku[j] += member[i][j];

	rep(i, N + 1) {
		if (2 <= yaku[i]) {
			ll tmp = 0;
			rep(j, N + 1) if (4 <= yaku[j] && j != i) ++tmp;
			ans += tmp * (tmp - 1) / 2;
		}
	}
	rep(i, N + 1) {
		if (2 <= yaku[i]) {
			ll tmp = 0;
			rep(j, N + 1) if (24 <= yaku[j] && j != i) ++tmp;
			ans += tmp;
		}
	}
	rep(i, N + 1) {
		if (4 <= yaku[i]) {
			ll tmp = 0;
			rep(j, N + 1) if (14 <= yaku[j] && j != i) ++tmp;
			ans += tmp;
		}
	}
	rep(i, N + 1) if (74 <= yaku[i]) ++ans;

	cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v){stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modpow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isprime(ll n){if(n<2)return 0;if(!(n%2))return !(n-2);lll d=n-1,t,y;while(!(d%2))d>>=1;vl al={2,325,9375,28178,450775,9780504,1795265022};for(ll a:al){if(n<=a)break;t=d,y=modpow(a,t,n);while(t!=n-1&&y!=1&&y!=n-1)y=y*y%n,t<<=1;if(y!=n-1&&!(t%2))return 0;}return 1;}
void dout(double d){printf("%.12f\n",d);}
void YN(bool z){cout<<(z?"YES\n":"NO\n");}
void Yn(bool z){cout<<(z?"Yes\n":"No\n");}
void yn(bool z){cout<<(z?"yes\n":"no\n");}
const mt19937 rnd(unsigned(1357986421));
const int iinf = 1e9+6;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;

const int N = 1e5;
int n, p[10];

main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  int ans = 0;
  FOR(i, 0, n){
    cin >> p[i];
    ans += p[i];
  }
  sort(p, p+n);
  cout << ans-p[n-1]/2 << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);
int p = scan.nextInt();
int q = scan.nextInt();
int w = scan.nextInt();
int counter = 0;
for (int i = p; i <= q;  i ++ ) {
if ( w % i == 0) {
counter++;
}
}
System.out.println(counter);

}
}



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

using namespace std;

int main(){	
	string str = "";
	cin>>str;
	int n = str.length();
	string d= "dream";
	string dr = "dreamer";
	string e = "erase";
	string er = "eraser";
	int i = n-1;
	int flag=1;
	while(i >= 0){
		if(str[i] == 'm'){
			int j, k;
			for(j=0, k= d.length()-1; i-j >= 0 and j<d.length() ;j++)
			if(str[i-j] != d[k-j]){
				flag = 0;break;
			}
			if(j < d.length())flag = 0;
			if(!flag)break;
			i-=d.length();
		}
		else if(str[i] == 'e'){
			int j, k;
			for(j=0, k=e.length()-1; i-j>=0 and j<e.length(); j++){
				if(str[i-j] != e[k-j]){
					flag = 0;break;
				}
			}
			if(j < e.length())flag = 0;
			if(!flag)break;
			i-=e.length();
		}
		else if(str[i] == 'r'){
			int j, k;
			int f1=1, f2=1;
			for(j=0, k=dr.length()-1; i-j >= 0 and j < dr.length(); j++){
				if(str[i-j] != dr[k-j]){
					f1=0;break;
				}
			}
			if(j < dr.length())f1=0;
			if(f1){
				i-=dr.length();
				continue;
			}
			for(j=0, k=er.length()-1; i-j >=0 and j < er.length(); j++){
				if(str[i-j] != er[k-j]){
					f2 = 0;break;
				}	
			}
			if(j < er.length())f2=0;
			if(f2){
				i-=er.length();
				continue;
			}	
			flag=0;
			break;
		}
	}
	if(flag)cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	string s;
	cin>>s;
	ll ans=0;
	for(ll i=0;i<s.size();i++){
		char now=s[i];
		ll x=s[i]-'0';
		ans+=x;
	}
	if(ans%9==0){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
int n,a[200001],max1=0,max2=0,num1,num2;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]>max2)
		{
			if(a[i]>max1)
			{max1=a[i];num1=i;}
			else{max2=a[i];num2=i;}
		}
	}
	for(int i=0;i<n;i++)
	{
		if(i!=num1){cout<<max1<<endl;}
		else{cout<<max2<<endl;}
	}
	return 0;
}

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


int main(){
    int n; cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];

    sort(all(d),greater<int>());
    int ans=1;
    for(int i=0; i<n-1; i++){
        if(d[i] > d[i+1]){
            ans ++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
import java.util.*;

class Main{
	public static void main(String args[]) throws Exception{
		Scanner sc = new Scanner(System.in);
		long a[] = new long[3];
		for(int i = 0; i < 3; i++) a[i] = sc.nextLong();
		int K = sc.nextInt();
		Arrays.sort(a);
		for(int i = 1; i <= K; i++) a[2] *= 2;
		long ans = 0;
		for(int i = 0; i < 3; i++) ans += a[i];
		System.out.println(ans);
	}
}

Measured memory_bytes: 20564
#include<cstdio>
#include<cmath>
int main()
{
	int n,m;scanf("%d%d",&n,&m);
	int t=1;while(t<=m) t*=10;
	n=n*t+m;t=sqrt(n);
	if(t*t==n) printf("Yes");else printf("No");
	return 0;
}

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

const int MAX_H = 1001;
const int MAX_W = 1001;
const ll MOD = 1e+9 + 7;

ll dp[MAX_H][MAX_W];
char grid[MAX_H][MAX_W];

int main() {
    int H, W;
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) cin >> grid[i][j];
    }
    for (int i = 0; i < H; i++) {
        if (grid[i][0] == '.') dp[i][0] = 1;
        else break;
    }
    for (int i = 0; i < W; i++) {
        if (grid[0][i] == '.') dp[0][i] = 1;
        else break;
    }
    for (int i = 1; i < H; i++) {
        for (int j = 1; j < W; j++) {
            if (grid[i][j] == '.') {
                dp[i][j] += (dp[i - 1][j] + dp[i][j - 1]) % MOD;
            }
        }
    }
    cout << dp[H - 1][W - 1] << endl;
    return 0;
}

Measured memory_bytes: 9088
#include <iostream>
#include <algorithm>
const long long mod = 1e9 + 7;
using namespace std;

int main ()
{
  long long n, k, x, y, ans = 0;

  cin >> n >> k;

  for(long long i = k; i <= n + 1; ++i)
  {
      x = (i - 1) * i / 2;
      y = (n + 1) * n / 2 - (n - i) * (n - i + 1) / 2;
      ans += (y - x + 1);
      ans = ans % mod;
  }

  cout << ans << endl;

}


Measured memory_bytes: 3628
from collections import Counter
N = int(input())
S = Counter(input())
#print(S)
for _ in range(N-1):
    S &= Counter(input())

print("".join(sorted(S.elements())))
'''
sorted(S.elements())
Counter({'a': 2, 'c': 1})
['a', 'a', 'c']
'''

Measured memory_bytes: 3316
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"

long long int N, P, Q;


int main() {
	cin >> N >> P >> Q;
	vector<long long int>cs(N);
	for (int i = 0; i < N; ++i) {
		cin >> cs[i];
	}
	int amin = 0;
	int amax = N + 1;
	vector<long long int>totals(cs);
	for (int i = 0; i < cs.size(); ++i) {
		totals[i] = -totals[i] - i*P;
	}
	sort(totals.begin(), totals.end(), greater<long long int>());
	long long int ans = accumulate(cs.begin(), cs.end(), 0ll);
	long long int now = ans;
	for (int i = 0; i < totals.size(); ++i) {
		long long int plus = totals[i] + (Q+i*2) * P;
		now += plus;
		ans = max(ans, now);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 10748
// Created by Tanuj Jain
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int mod=1e9+7;
int dp[1005][1005];
bool vis[1005][1005];
int recursive(int row, int col, vector<vector<char>>&matrix)
{
	///mark the cell visited
	//cout<<row<<col<<endl;
	if(row<0 || col<0)
		return 0;
	if(matrix[row][col]=='#')
		return 0;
	if(row==0 && col==0)
		return dp[row][col]=1;

	//i do my work
	int left=0;
	int up=0;
	//if i already visited this cell return the ans from the dp table
	if(vis[row][col])
		return dp[row][col];
	//else find the answer form the children and mark the cell as visisted 
	else
	{
		vis[row][col]=true;
		//get the answers from childern and do the work;
		 left=recursive(row,col-1,matrix);
		 up=recursive(row-1,col,matrix);
	}
	return dp[row][col]=(left+up)%mod;
}
int main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	//#ifndef ONLINE_JUDGE
	//freopen("inputf.in","r",stdin);
	//freopen("outputf.in","w",stdout);
	//#endif

	int row,col;
	cin>>row>>col;
	vector<vector<char>>matrix(row,vector<char>(col));
	for(int i=0;i<row;i++)
		for(int j=0;j<col;j++)
			cin>>matrix[i][j];

	cout<<recursive(row-1,col-1,matrix)<<endl;
	//for(int i=0;i<row;i++)
	//{
	//	for(int j=0;j<col;j++)
	//		cout<<dp[i][j]<<" ";
	//	cout<<endl;
	//}

	
}

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

int main() {
  int n;
  cin >> n;
  
  if(n<=111)
    cout<<111<<endl;
  if(n<=222&&n>111)
    cout<<222<<endl;
  if(n<=333&&n>222)
    cout<<333<<endl;
  if(n<=444&&n>333)
    cout<<444<<endl;
  if(n<=555&&n>444)
    cout<<555<<endl;
  if(n<=666&&n>555)
    cout<<666<<endl;
  if(n<=777&&n>666)
    cout<<777<<endl;
  if(n<=888&&n>777)
    cout<<888<<endl;
  if(n<=999&&n>888)
    cout<<999<<endl;
    
    
}

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

int main() {
	int a, b;
	cin >> a >> b;
	bool ans = true;

	int res = b * 10;
	for(int i=0;i<10;i++) {
		if (res * 8 / 100 == a) {
			cout << res << endl;
			ans = false;
			break;
		}
		else {
			res++;
		}
	}
	if (ans) cout << "-1" << endl;

	return 0;
}

Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

int N;

signed main(){

    in(N);
    cout<<"ABC"<<N<<endl;

    return 0;
}


Measured memory_bytes: 632
H, W = map(int, input().split())
S = [input() for _ in range(H)]

d = [-1, 1]
for h in range(H):
    for w in range(W):
        if S[h][w] == '#':
            ls = []
            for i in range(2):
                for j in range(2):
                    hs = h + d[i]
                    ws = w + d[j]
                    if 0 <= hs < H and 0 <= ws < W:
                        ls.append(S[hs][w])
                        ls.append(S[h][ws])
            if '#' not in ls:
                print('No')
                exit()
print('Yes')

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

using namespace std;

int main()
{ int t;
  cin>>t;
  int flag=0;
  while(t--)
  { int a;
    cin>>a;
    if(a%2==0)
    { if(a%3!=0&&a%5!=0)
       {flag=1;
          break;
       }
    }

  }
  if(flag==1)
    cout<<"DENIED";
  else
    cout<<"APPROVED";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int n;
  cin >> n;
  for(int i = 1; i <= n; i++) {
    int r = 0;
    for(int x = 1; x < sqrt(i); x++) {
      for(int y = 1; y <= x; y++) {
        for(int z = 1; z <= y; z++) {
          int p = x * x + y * y + z * z + x * y + y * z + z * x;
          if(i < p) break;
          if(p == i) {
            if(x == y) {
              if(y == z) {
                r++;
              }
              else {
                r += 3;
              }
            }
            else if(y == z) {
              if(z == x) {
                r++;
              }
              else {
                r += 3;
              }
            }
            else if(z == x) {
              if(x == y) {
                r++;
              }
              else {
                r += 3;
              }
            }
            else {
              r += 6;
            }
          }
        }
      }
    }
  cout << r << endl;
  }
}


Measured memory_bytes: 3544
#include<iostream>

using namespace std;

int main(void)
{
	int x,y, a, b;
	cin >> x >> y;
	b = (y-2*x)/2;
	a = x-b;
//	if(y>=2*x && (y-2*x)%2==0 && 
	if(a>=0 && b>=0 && 2*a+4*b==y)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
	return 0;
}

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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const int inf = 1e8;


void solve()
{
  string c;
  cin >> c;
  if (c=="a"||c=="e"||c=="i"||c=="o"||c=="u") cout << "vowel" << endl;
  else cout << "consonant" << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdio>
#include <complex>

using namespace std;
typedef long long ll;
#define loop(i,a,b) for(ll i=(a); i<ll(b); i++)
#define rep(i,b) loop(i,0,b)

typedef vector<int> vi;
typedef complex<double> P;

int main(){
    int n;
    while (cin >> n, n + 1){
        P p(1, 0);
        rep(i, n - 1) p += p*P(0, 1) / abs(p);
        printf("%.100f\n%.100f\n", p.real(), p.imag());
    }
}

Measured memory_bytes: 1196
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());
	cout << A.back() - A.front() << endl;
	return 0;
}

Measured memory_bytes: 256
//### In The Name Of GOD ###

//%% Remember; (((He))) is The (((Accepter))) %%

// GOD IS GREATER ...

#include <bits/stdc++.h>

using namespace std;

typedef long long ll ;

const int MOD = 1000 * 1000 * 1000 + 7;
const int MAXN = 10000 + 10;

signed main() {
	int m, n;
	cin >> n >> m;
	int A[MAXN], B[MAXN];
	for(int i = 0; i < n; i++) cin >> A[i];
	for(int i = 0; i < m; i++) cin >> B[i];
	sort(A, A + n, greater<int>());
	sort(B, B + m, greater<int>());
	int x = 0, y = 0, ans = 1;
	for(int i = n * m; i >= 1; i--) {
		if(A[x] == i && B[y] == i) {
			x++;
		   	y++;
		}else if(A[x] == i) {
			x++;
			ans = (ll)ans * y % MOD;
		}else if(B[y] == i) {
			y++;
			ans = (ll)ans * x % MOD;
		}else {
			ans = (ll)ans * max(0, x * y - n * m + i) % MOD;
		}
	}
	ans *= (x == n);
	ans *= (y == m);
	cout << ans;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = list(map(int, input().split()))
lst = [list(map(int, input().split())) for _ in range(M)]

A.sort()
lst = sorted(lst, key=lambda x: x[1], reverse=True)

idx = 0
for b, c in lst:

    # 最大b枚数をcに置き換え
    for i in range(b):
        # 小さい値が見つる限り置き換え
        if idx + i > N - 1:
            print(sum(A))
            exit()

        if A[idx + i] < c:
            A[idx + i] = c
        else:
            print(sum(A))
            exit()

    idx += b
    if idx > N - 1:
        print(sum(A))
        exit()

print(sum(A))

Measured memory_bytes: 33728
#include <bits/stdc++.h>
using namespace std;
int mi=(-1000000);

int main() {
	int k,x; cin >> k >> x;
	if(x-k+1<mi) {
		for(int i=mi;i<mi+k;i++) cout << i;
		cout << endl;
		return 0;
	}
	for(int i=x-k+1;i<x+k;i++) cout << i << ' ';
	cout << endl;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n;
    cin >> n;

    vector<ll> p(n);
    rep (i, n) {
        cin >> p[i];
    }

    set<ll> s;
    for (ll i = 1; i < n-1; i++) {
        vector<ll> tmp;
        tmp.push_back(p[i-1]);
        tmp.push_back(p[i]);
        tmp.push_back(p[i+1]);
        sort(tmp.begin(), tmp.end());

        if (tmp[1] == p[i]) {
            s.insert(p[i]);
        } 
    }

    cout << s.size() << endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B=map(int,input().split())
import sys

if A>B:
    print (0)
    sys.exit()
    
if N==1:
    if A==B:
        print(1)
    else:
        print(0)
    sys.exit()

if N==2:
    print (1)
    sys.exit()

print (B*(N-2)-A*(N-2)+1)

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

void print( vector<int> &A, int N )
{
	for( int k = 0; k < N; k++ ) {
		cout << A[k];
		if( k < N - 1 ) {
			cout << " ";
		}
		else {
			cout << endl;
		}
	}
}

int sort( vector<int> &A, int N )
{
	int sw = 0;
	for( int i = 0; i < N; i++ ) {
		int minj = i;
		for( int j = i; j < N; j++ ) {
			if( A[j] < A[minj] ) {
				minj = j;
			}
		}
		if( i != minj ) {
			sw++;
		}
		swap( A[i], A[minj] );
	}
	return sw;
}

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

	int sw = sort( A, N );

	print( A, N );
	cout << sw << endl;

}



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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,j,N) for(int i = (N-1);i >= (j);i--)
#define ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

const int maxn = 1e5+5;

int main()
{
    LL N,M;
    cin >> N >> M;
    vector<LL> div;
    _rep(i,1,maxn){
        if(!(M%i)){
            div.push_back(i);
            div.push_back(M/i);
        }
    }

    sort(ALL(div));

    int ans = 0;
    _for(i,0,div.size()){
        if(!ans && div[i] >= N) ans = div[i];
    }

    cout << M/ans << endl;

    return 0;
}


Measured memory_bytes: 256
//
// Created by habibaraphat on 5/25/20.
//

#include <iostream>
#include <vector>

using namespace std;

int main(){
  int n;
  vector<int> a;

  cin>>n;
  for(int i=0; i<n; i++){
    int tmp;
    cin>>tmp;
    a.push_back(tmp);
  }
  vector<int> cost(n, 0);
  cost[1] = abs(a[0]- a[1]);
  for(int i=2; i<n; i++){
    cost[i] = min(cost[i-1]+abs(a[i] - a[i-1]), cost[i-2] + abs(a[i]-a[i-2]));
  }

  int res = cost.back();

  cout<<res<<endl;

  return 0;
}



Measured memory_bytes: 1144
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

enum PCNT = 10^^6;

bool[PCNT+1] PS;

void prime_init()
{
    PS[] = true;
    PS[0] = false;
    PS[1] = false;
    foreach (i; 2..PCNT+1) {
        if (PS[i]) {
            auto x = i*2;
            while (x <= PCNT) {
                PS[x] = false;
                x += i;
            }
        }
    }
}

void main()
{
    prime_init();
    long[] ps;
    foreach (i, p; PS) if (p) ps ~= i.to!long;

    auto N = readln.chomp.to!int;

    auto AS = new int[](10^^6+1);
    foreach (a; readln.split.to!(int[])) ++AS[a];

    auto F = new bool[](10^^6+1);
    int r;
    foreach (i, a; AS) {
        if (a == 0 || F[i]) continue;
        if (a == 1) ++r;
        void run(size_t i) {
            F[i] = true;
            foreach (p; ps) {
                if (i*p > 10^^6) break;
                if (!F[i*p]) run(i*p);
            }
        }
        run(i);
    }
    writeln(r);
}

Measured memory_bytes: 19532
#include<stdio.h>

int main(void){
	
	int n,i;
	long long a;
	long long sum=0,max=-10000000,min=100000000;
			
			scanf("%d",&n);
				for(i=0;i<n;i++){
					scanf("%lld",&a);
						sum = sum + a;
		
				if(a<min) min=a;
				if(a>max) max=a;
	}
	
			printf("%lld %lld %lld\n",min,max,sum);
	
return 0;
}

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

using namespace std;

 int main()
 {
    string s;
    cin>>s;
    int o=8-count(s.begin(),s.end(),'o');
    int x=15-s.size();
    if(x>=o)
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
return 0;
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <queue>
#include <set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF LLONG_MAX/2e5

void solve(ll index){
	ll l,r;
	cin >> l >> r;
	ll ans = 2018;
	forsn(i,l,r){
		forsn(j,i+1,r+1){
			ans = min(ans,(i*j)%2019);
			if(ans == 0){
				cout << ans << ln;
				return;
			}
		}
	}
	cout << ans << ln;
}

int main()
{
	ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    // cin >> t;
    forn(i,t) solve(i+1);
    return 0;
}

Measured memory_bytes: 256
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()
H = [0]+In.ints()

hasBigger = [False]*(N+1)
for i in range(M):
    a,b = In.ints()
    
    if H[a]>=H[b]:
        hasBigger[b]=True
    
    if H[b]>=H[a]:
        hasBigger[a]=True

Out.int(hasBigger.count(False)-1)






######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

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

using namespace std;

int main()

{
int A,B;
scanf("%d%d",&A,&B);

int ans,rd,area;

area=A*B;
rd=A*1+B*1-1;
ans=area-rd;
printf("%d\n",ans);
printf(" \n");

}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

int main(void){
	int n;
	cin >> n;
	vector<int> ary(n);
	for(auto &elem:ary) cin >> elem;
	sort(begin(ary),end(ary));
	const int ans = ary[n-1] - ary[0];
	cout << ans << endl;
	return 0;
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define E 2.71828182845905
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define debug(x) cout<<#x<<" is "<<x<<endl;
#define PI 3.14159265
#define mem(x) memset(x,0,sizeof(x));
using namespace std;

void sol() {
	int n;
	cin>>n;
	double p[n+1];
	rep(i,1,n+1)
	cin>>p[i];
	double dp[n+1][n+1];
	mem(dp);
	dp[1][1]=p[1];
	dp[1][0]=1-p[1];
	rep(i,2,n+1){
		rep(j,0,n+1){
			if(j-1>=0){
				dp[i][j]+=dp[i-1][j-1]*p[i];
			}
			dp[i][j]+=dp[i-1][j]*(1-p[i]);
		}
	}
	double ans=0;
	rep(i,n/2+1,n+1){
		ans+=dp[n][i];
	}
	cout<<setprecision(12)<<ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t=1;
 	//cin>>t;
 	while(t--){	
	sol();
 	}
}

Measured memory_bytes: 70656
from datetime import date, timedelta

a, b = map(int, input().split())
d1 = date(year=2018, month=1, day=1)
d2 = date(year=2018, month=a, day=b)

count = 0
while d1 <= d2:
    if d1.month == d1.day:
        count += 1
    d1 += timedelta(days=1)

print(count)


Measured memory_bytes: 3312
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;


int main(){
    cin.sync_with_stdio(0); cin.tie(0);
    LL n;
    cin >> n;
    vector<vector<LL> > a(n,vector<LL>(n));
    LL maxa = 0;
    set<LL> f;
    vector<int> pr;
    for(int j = 2; ; j++){
        if(pr.size() >= 1200) break;
        int ok = 1;
        for(int z = 2; z * z <= j; z++){
            if(j % z == 0) ok = 0;
        }
        if(ok){
            pr.push_back(j);
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if((i + j) % 2) {
                LL mult = (4*(i-j + 500) + 303) * (4 * (i+j) + 301);
                for(LL q = 1; ; q++){
                    if(f.find(mult * q) == f.end()){
                        a[i][j] = mult * q;
                        maxa = max(maxa, a[i][j]);
                        f.insert(a[i][j]);
                        break;
                    }
                }
            }
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if((i + j) % 2 == 0){
                vector<int> dx = {0, 1, 0, -1};
                vector<int> dy = {1, 0, -1, 0};
                LL mult = 1;
                for(int r = 0; r < 4; r++){
                    LL ni = i + dx[r];
                    LL nj = j + dy[r];
                    if(ni < 0 || nj < 0 || ni >= n || nj >= n) continue;
                    LL g = __gcd(mult, a[ni][nj]);
                    mult = mult / g * a[ni][nj];
                }
                for(LL q = 1; ; q++){
                    if(f.find(mult * q + 1) == f.end()){
                        a[i][j] = mult * q + 1;
                        maxa = max(maxa, a[i][j]);
                        f.insert(a[i][j]);
                        break;
                    }
                }
            }
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cout << a[i][j] << " ";
        }
        cout << '\n';
    }
    cout << '\n';
}

Measured memory_bytes: 16768