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

int n;
int num[102];
long long int memo[22][200];
int ans;

long long int solve(long long int now,int cnt){
  //if(cnt == n-1 )cout<<now<<endl;
  if(now < 0 || now > 20)return 0;
  if(memo[now][cnt] != -1)return memo[now][cnt];
  if(cnt == n-1 && ans == now)return 1;
  if(cnt == n-1 && ans != now)return 0;
  return memo[now][cnt] = solve(now + num[cnt] ,cnt + 1) + solve(now - num[cnt],cnt + 1);
}
int main(){
  cin>>n;
  memset(memo,-1,sizeof(memo));
  for(int i = 0;i < n;i++){
    cin >> num[i];
  }
  ans = num[n-1];
  cout << solve(num[0],1) << endl;
}

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

using namespace std;

using ll = long long;

const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main () {
  cin.tie(0);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int mi = a[0], ma = a[n-1];
  int pos = 0, neg = 0;
  vector<int> posv, negv;
  for(int i=1;i<n-1;++i) {
    if(a[i] > 0) {
      pos++;
      posv.push_back(a[i]);
    } else {
      neg++;
      negv.push_back(a[i]);
    }
  }

  int poss = posv.size(), negs = negv.size();
  vector<pair<int, int>> ans;
  for(int i=0;i<poss;++i) {
    ans.push_back({mi, posv[i]});
    mi -= posv[i];
  }
  ans.push_back({ma, mi});
  ma -= mi;
  for(int i=0;i<negs;++i) {
    ans.push_back({ma, negv[i]});
    ma -= negv[i];
  }

  cout << ma << endl;
  for(int i=0;i<(int)(ans.size());++i) {
    cout << ans[i].first << " " << ans[i].second << endl;
  }
}


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

using namespace std;

#define pb push_back
#define ff first
#define ss second

typedef pair<int,int> pii;
typedef long long ll;

const int MAX_N = 200;
 
int arr[MAX_N], ans[MAX_N];
vector< pii > rec;

int main()
{
	int n;
	scanf("%d", &n );
	for( int i = 1; i <= n; ++ i )
	{
		scanf("%d", arr + i );
		if( arr[i] > i ) return ! printf("-1\n");
	}

	for( int it = 1; it <= n; ++ it )
	{
		int mx = -1, pos  = 0, cn = 0, id = 0;
		for( int i = 1; i <= n; ++ i )
		{
			if( arr[i] > -1 ) ++cn;	
			if( arr[i] > mx ) mx = arr[i], pos = cn, id = i;
		}
		arr[id] = -1;
		rec.pb( { n - it - pos + mx + 1, mx } );
	}
	reverse( rec.begin(), rec.end() );

	for( int i = 0; i < n; ++ i )
	{
		int del = 0;
		for( int j = i + 1; j < n; ++ j )
			del += ( rec[j].ff <= rec[i].ff + del );
		ans[rec[i].ff + del] = rec[i].ss;
	}
	
	for( int i = 1; i <= n; ++ i ) 	
		printf("%d\n", ans[i]);
	
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    char s[25];
    for(int p=0;p<26;p++)
    {
        scanf("%s",&s[p]);
    }
    int q=0;
    while(s[q] !=NULL)
      q++;
    int x=0;
    for(int r=0;r<q-1;r++)
    {
        for(int t=r+1;t<q;t++)
        {
            if(s[r]==s[t])
            {
                x++;
            }
        }
    }
    if(x==0)
      printf("yes");
    else
      printf("no");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    IOS

    int a,b;
    cin >> a >> b;
    if(b == 1)cout << 0;
    else if(a >= b)cout << 1;
    else cout << (b-a)/(a-1) + bool((b-a)%(a-1)) + 1;







    return 0;
}


Measured memory_bytes: 3652
l = {}
aac = 0
awa = 0
n, m = map(int, input().split())
for _ in range(m):
  pi, si = input().split()
  pi = int(pi)
  ac, wa = l.get(pi, (False, 0))
  if si == 'AC' or ac:
    l[pi] = (True, wa)
  else:
    l[pi] = (False, wa + 1)

for iac,iwa in l.values():
  if iac:
    aac += 1
    awa += iwa

print("%d %d" % (aac, awa))


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

double dist(double x1,double x2,double y1,double y2){
  double dx=x1-x2,dy=y1-y2;
  return sqrt(dx*dx+dy*dy);
}

int main() {
  double n;	cin >> n;
  vector<double>	x(n),y(n);
  for(int i=0;i<n;i++)	cin >> x[i] >> y[i];
  
  vector<int>	junretu(n);
  for(int i=0;i<n;i++)	junretu[i]=i;
  
  double c=0,sum=0;
  do{
    for(int i=0;i<n-1;i++){
      int x1=x[junretu[i]];
      int x2=x[junretu[i+1]];
      int y1=y[junretu[i]];
      int y2=y[junretu[i+1]];
      sum+=dist(x1,x2,y1,y2);
    }
    c++;
  }while(next_permutation(junretu.begin(),junretu.end()));
  printf("%.10f",sum/c);
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char s;
	bool c=0,f=0;
	while(cin>>s)
	{
		if(s=='C')c=1;
		if(s=='F'&&c==1)f=1;
	}
	if(f==1)cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: usize,
        m: usize,
    }
    input!{
        mut abm: [[usize; 2]; n],
    }
    abm.sort();
    let mut ret: usize = 0;
    let mut left: usize = m;
    for i in 0..n {
	if abm[i][1] < left {
	    ret += abm[i][0] * abm[i][1];
	    left -= abm[i][1];
	} else {
	    ret += abm[i][0] * left;
	    break;
	}
    }
    println!("{}", ret);
}


Measured memory_bytes: 9896
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int A = s[0];
            int B = s[1];
            int T = s[2];
            int ans = 0;
            for (int i = 1; i <= T; i++)
            {
                if (i % A == 0)
                {
                    ans += B;
                }
            }

            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13268
import collections

def gcd(a,b):
 if b==0:
   return a
 else:
   return gcd(b,a%b)

k=int(input())
cnt=collections.defaultdict(int)
for i in range(1,k+1): #すべての(a,b)の組についてgcd(a,b)を求め、その値の個数を数える
 for j in range(1,k+1):
   cnt[gcd(i,j)]+=1
ans=0
for i in range(1,k+1): #すべてのcについて、上で求めたgcd(a,b)のあり得る値とのgcdを求め、答えに足し合わせる
 for key in cnt.keys():
   ans+=gcd(i,key)*cnt[key]
print(ans)

Measured memory_bytes: 9416
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long

const int maxn=1e5+5;

int k;
int n,m;
int c[maxn];
bool bo[maxn];
int a[maxn],ans[maxn];

int read() {
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return x*f;
}

signed main() {
	n=read();
	for(int i=1;i<=n;i++)
		a[i]=read(),c[i]=i;
	m=read();scanf("%lld",&k);
	for(int i=1;i<=m;i++) {
		int x=read();
		swap(c[x],c[x+1]);
	}
	for(int i=1;i<=n;i++)
		if(!bo[i]) {
			int u=i,cnt=0,step,goal;
			while(!bo[c[u]])
				bo[c[u]]=1,cnt++,u=c[u];
			step=k%cnt,goal=u=i;
			for(int j=1;j<=step;j++)
				goal=c[goal];
		    for(int j=1;j<=cnt;j++)
				ans[u]=goal,u=c[u],goal=c[goal];
		}
	for(int i=2;i<=n;i++) {
		int x=ans[i];
		ans[i]=a[x]-a[x-1];
	}
	ans[1]=a[1];
	for(int i=1;i<=n;i++)
		ans[i]+=ans[i-1],printf("%.1lf\n",(double)ans[i]);
	return 0;
}


Measured memory_bytes: 3840
#include <iostream>

using namespace std;

int main()
{
    int N, answer, currentyaku;
    answer = 0;
    cin >> N;
    for (int i = 1; i <= N; i = i + 2)
    {
        currentyaku = 0;
        for (int j = 1; j <= N; j = j + 2)
        {
            if (i % j == 0)
            {
                currentyaku++;
            }
        }
        if (currentyaku == 8)
        {
            answer++;
        }
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<algorithm>
int main()
{
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    sort(arr,arr+n);
    int sum=0;
    for(int i=0;i<k;i++)
    sum=sum+arr[i];
    cout<<sum<<endl;
    return 0;
}

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

int const MAXP = 1e5+3;

bool p[MAXP+1];

int main() {
  std::fill_n(p, MAXP+1, true);
  for(int i = 2; i < MAXP; ++i) if(p[i]) {
    for(int j = i*2; j < MAXP; j += i) p[j] = false;
  }
  int X; std::cin >> X; while(!p[X]) ++X;
  std::cout << X << std::endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007

int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);

    	long long n,i,j,k,count=0,ans=0,l,r,x,y,mx=0,sum=0,a,b,c,d;
        cin>>a>>b>>c>>d;

        while(count==0)
        {
            c=c-b;
            if(c<=0)
            {
                cout<<"Yes"; return 0;
            }
            a=a-d;
            if(a<=0)
            {
                cout<<"No"; return 0;
            }
        }
	return 0;
}

Measured memory_bytes: 3664
# @author 

import sys

class OMatching:
    def solve(self):
        from collections import defaultdict

        def numberOfSetBits(i):
            i = i - ((i >> 1) & 0x55555555)
            i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
            return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24

        MOD = 10 ** 9 + 7

        n = int(input())
        a = []
        for i in range(n):
            a.append([int(_) for _ in input().split()])


        dp = [[0] * ((1 << n) + 1) for _ in range(n + 1)]
        dp[0][0] = 1
        by_1 = defaultdict(list)
        for j in range(1 << n):
            by_1[numberOfSetBits(j)].append(j)
        # for j in range(1 << n):
        #     by_1[bin(j).count('1')].append(j)

        for i in range(1, n + 1):
            for j in by_1[i - 1]:
                for k in range(n):
                    if (j >> k) & 1 or a[i - 1][k] == 0:
                        continue
                    dp[i][j | (1 << k)] += dp[i - 1][j]
                    dp[i][j | (1 << k)] %= MOD

        # [print(item) for item in dp]

        print(sum(dp[n]))

solver = OMatching()
input = sys.stdin.readline

solver.solve()


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

int main() {
    int t_health, t_attack, a_health, a_attack;
    cin >> t_health >> t_attack >> a_health >> a_attack;
    while (1) {
        a_health -= t_attack;
        if (a_health <= 0) {
            cout << "Yes" << endl;
            break;
        }
        t_health -= a_attack;
        if (t_health <= 0) {
            cout << "No" << endl;
            break;
        }
    }
}

Measured memory_bytes: 3620
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int n, w, wi, vi;
    cin >> n >> w;
    
    vector<int> dp(w+1);
    for (int i = 0; i < n; ++i) {
        cin >> wi >> vi;
        for (int j = w; j >= wi; --j) {
            dp[j] = max(dp[j], dp[j - wi] + vi);
        }
    }
    
    cout << dp[w] << "\n";
    
    return 0;
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
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;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int imos[5000][5000];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    // 0:w, 1:b
    for(int i = 0; i < N; i++) {
        int x, y;
        char c;
        cin >> x >> y >> c;
        if(c == 'B') {
            x += K;
        }
        for(int j = 0; j < 2; j++) {
            for(int k = 0; k < 2; k++) {
                imos[(x % (2 * K)) + 2 * j * K][(y % (2 * K)) + 2 * k * K]++;
            }
        }
    }
    for(int i = 0; i < 5000; i++) {
        for(int j = 1; j < 5000; j++) {
            imos[i][j] += imos[i][j - 1];
        }
    }
    for(int i = 1; i < 5000; i++) {
        for(int j = 0; j < 5000; j++) {
            imos[i][j] += imos[i - 1][j];
        }
    }
    int ans = 0;
    for(int i = 0; i < 2 * K; i++) {
        for(int j = 0; j < 2 * K; j++) {
            chmax(ans,
                  (imos[i + K][j + K] - imos[i][j + K] - imos[i + K][j] +
                   imos[i][j]) +
                      (imos[i + 2 * K][j + 2 * K] - imos[i + K][j + 2 * K] -
                       imos[i + 2 * K][j + K] + imos[i + K][j + K]));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 101316
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(long long X){
    cout<<(LL)ceil((-1+sqrt(1+8*X))/2)<<endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
// 2011/05/21 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

const int MAX = 1*0+2*1+3*2+4*3*5*4+6*5+7*6+8*7+9*8+10*9;

int cnt[10][MAX+1];

void prm(int k[10], int r, int& sum)
{
	if(r>=10)
		return;

	for(int i=r; i<10; i++){
		int tmp = k[i];
		k[i] = k[r];
		k[r] = tmp;
		sum += (r+1)*k[r];
		cnt[r][sum]++;
		prm(k, r+1, sum);
		sum -= (r+1)*k[r];
		k[r] = k[i];
		k[i] = tmp;
	}
}

int main()
{
	int k[10];
	for(int i=0; i<10; i++)
		k[i] = i;

	int sum = 0;
	prm(k, 0, sum);

	while(!cin.eof()){
		string str;
		getline(cin, str);
		if(str.empty())
			continue;

		istringstream ist(str);
		int n, s;
		ist >> n >> s;

		if(s>MAX)
			cout << 0 << endl;
		else
			cout << cnt[n-1][s] << endl;
	}

	return 0;
}

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

using namespace std;

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void debug_out() {
    cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H), debug_out(T...);
}

int main() {
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
#define debug(...) 3
    fastIO;
#endif
    int n;
    cin>>n;
    vector<ll> v(n);
    map<ll,ll> mp;
    ll total=0;
    forn(i,n)cin>>v[i],mp[v[i]]++;
    for(auto x:mp) {
        total+=((x.S-1)*(x.S))/2;
    }
    ll ans=0;
    forn(i,n) {
        ll x=max(mp[v[i]]-1,0ll);
        cout<<total-x<<endl;
    }
    return 0;
}


Measured memory_bytes: 12700
#include <iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if((a==1 && b==1 && c==0)||(a==0 && b==0 && c==1)){
        cout<<"Open"<<endl;
    }
    else{
        cout<<"Close"<<endl;
    }
    return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;

int main() {
	ll N, K;
	cin >> N >> K;

	vector <ll> x(N);
	vector <ll> y(N);
	for (int ii = 0; ii < N; ++ii){
		cin >> x[ii] >> y[ii];
	}

	ll ans = -1;
	for (int ii = 0; ii < N-1; ++ii){
		for (int jj = ii+1; jj < N; ++jj){
			for (int kk = 0; kk < N-1; ++kk){
				for (int nn = kk+1; nn < N; ++nn){
					ll x1 = x[ii];
					ll x2 = x[jj];
					ll y1 = y[kk];
					ll y2 = y[nn];
					ll minX = min(x1, x2);
					ll maxX = max(x1, x2);
					ll minY = min(y1, y2);
					ll maxY = max(y1, y2);

					//範囲内の点数を数える
					ll cnt = 0;
					for (int mm = 0; mm < N; ++mm){
						if ( x[mm]<minX || x[mm]>maxX || y[mm]<minY || y[mm]>maxY ){
						} else {
							cnt++;
						}
						if (cnt >= K){
							if (ans == -1){
								ans = (maxX-minX)*(maxY-minY);
							} else {
								ans = min(ans, (maxX-minX)*(maxY-minY));	
							}
							break;
						}
					}
				}
			}
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<cmath>
//#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int maxn = 1e6;

bool vis[maxn];
vector<int> Prms(maxn);

void seive(int n) //sqrt(n)
{
    int m = sqrt(n+0.5);
    for(int i = 2; i <= m; i++){
        if(!vis[i])
        for(int j = i*i; j <= n; j += i){
            vis[j] = true;
        }
    }
    Prms.clear();
    for(int i = 2; i <= n; i++)
        if(!vis[i])
        Prms.push_back(i);
}

//#define LOCAL
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    seive(maxn);
    int n;
    while(~scanf("%d",&n)){
        int ans = upper_bound(Prms.begin(),Prms.end(),n)-Prms.begin();
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 5940
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		sc.close();

		if (N == M) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 24020
#include <stdio.h>

int main()
{
    int A[100], i, j, k, N;
    int minj, count = 0;

    scanf("%d", &N);
    for (i = 0; i < N; i++)
        scanf("%d", &A[i]);

    for (i = 0; i <= N - 1; i++)
    {
        minj = i;
        for (j = i; j <= N - 1; j++)
        {
            if (A[j] < A[minj])
            {
                minj = j;
            }
        }
        if (A[i] > A[minj])
            count++;
        k = A[i];
        A[i] = A[minj];
        A[minj] = k;
    }

    for (i = 0; i < N; i++)
    {
        if (i)
            printf(" ");
        printf("%d", A[i]);
    }
    printf("\n%d\n", count);

    return 0;
}


Measured memory_bytes: 2052
n,a,b = [int(x) for x in input().split()]
mod = 10**9 + 7
def comb(x,y):
    child = 1
    mother = 1
    for i in range(y):
        child = child * (x-i)%mod
        mother = mother * (i+1)%mod
    return child * pow(mother,mod-2,mod) % mod
ans = pow(2,n,mod) - 1
ans -= comb(n,a)
ans %= mod
ans -= comb(n,b)
ans %= mod
print(ans)

Measured memory_bytes: 3064
from math import floor

def divisor(n):
    left = [1]
    right = [n]
    sup = floor(pow(n,1/2))
    for p in range(2,sup+1):
        if n % p == 0:
            left.append(p)
            right.append(n//p)
    res = left + right[::-1]
    return res
        
N = int(input())

div = divisor(N)
ans = 0

for d in div:
    if d != 1 and N // (d-1) == N % (d-1):
        ans += (d-1)

print(ans)

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

using namespace std;

const int N = 12;

char s[N];
long long ans = 0;

int main() {
  scanf("%s", s);
  int n = strlen(s);
  int len = 1<<(n-1);
  ans = 0;
  for (int i = 0; i < len; i++) {
    long long now = 0;
    for (int j = 0; j < n; j++) {
      now = now * 10 + s[j] - '0';
      if (i & (1<<j)) {
        ans += now;
        now = 0;
      }
    }
    ans += now;
  }
  printf("%lld\n", ans);

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <typeinfo>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <tuple>
#define REP(i,n) for(int i=0;i<n;i++)
typedef long long int ll;
using namespace std;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;

int main()
{

    ll n;
    double x[100]={};
    double y[100]={};
    
    cin>>n;
    REP(i,n){cin>>x[i];}
    REP(i,n){cin>>y[i];}
    
    for(int i=1;i<4;i++)
    {
        double ans(0);
        REP(j,n)
        {
            ans+= pow(max(x[j]-y[j],-x[j]+y[j]),i);
        }
        ans = pow(ans,1/(double)i);
        printf("%f\n",ans);
    }
    
    ll p(0);
    REP(i,n)
    {
        if(p<max(x[i]-y[i],-x[i]+y[i]))
        {
            p=max(x[i]-y[i],-x[i]+y[i]);
        }
    }
  
    cout<<p<<endl;
                  
    
    return 0;
}

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

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define REPR(i,a) for(int i = a; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;

int gcd(int a, int b){ return b ? gcd(b, a % b) : a; }
template<typename A> void psn(A a){ cout << a << endl; }
template<typename A, typename... B> void psn(A a, B... b){ cout << a << ' '; psn(b...); }

int main(void) {

    int r;
    
    cin >> r;
    
    psn(r * r);

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include <fstream>
#include<math.h>
#include <numeric>
#include<algorithm>
#include <stdlib.h>
# include <map>

using namespace std;

int main(){
    int s,cnt;
    map<int ,bool> m;
    cin >> s;
    bool flag = true;
    cnt = 1;
    m[s] = true;
    while(flag){
        if (s%2 == 0){
            s = s/2;
            if(m.find(s) != m.end()){
                flag = false;
            }
        }
        else{
            s = 3*s + 1;
            if(m.find(s) != m.end()){
                flag = false;
            }
        }
        cnt += 1;
        m[s] = true;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
n = gets.to_i
ss = n.times.map { gets.chomp }

max = 0
counts = ss.each_with_object(Hash.new(0)) do |s, h|
  h[s] += 1
  max = h[s] if h[s] >= max
end

puts counts.select { |_, v| v == max }.keys.sort


Measured memory_bytes: 53608
i = input().split()

a,b,k = list(map(int, i))

v = []

if a > b:
    for i in range(1,b + 1):
        if b%i == 0 and a%i == 0:
            v.append(i) 
else:
    for i in range(1,a + 1):
        if b%i == 0 and a%i == 0:
            v.append(i) 

v.reverse()

try:
    print(v[k-1])
except:
    pass

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l;
    cin >> n >> l;
    int s = 0;
    for(int i = 1; i <= n; ++i){
        s += l + i-1;
    }
    int smal = 1000000;
    for(int i = 1; i <= n; ++i){
        if(abs(l + i - 1) < abs(smal) ){
            smal = l + i - 1;
        }
    }
    cout << s - smal << '\n';
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;

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

    vector<int> A(N), B(N), C(N-1);
    rep(i, N){cin >> A[i];}
    rep(i, N){cin >> B[i];}
    rep(i, N-1){cin >> C[i];}

    int sum=0;
    rep(i, N){
        sum += B[A[i] - 1];
        if(A[i] + 1 == A[i+1]) sum += C[A[i] - 1];
    }
    cout << sum << 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);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int result = A-B*2;
		if(result>0){
			System.out.println(result);
		}else{
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 21844
def main():
    N = int(input())
    S = input()
    ans = 0
    for i in range(1, N):
        s1 = set(S[:i])
        s2 = set(S[i:])
        tmp = 0
        for c in s1:
            if c in s2:
                tmp += 1
        ans = max(ans, tmp)
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 40432
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, i, j, res, w, h, x;
    int[][] f, sum;

    n = sc.nextInt();
    f = new int[n][n];
    for(i = 0;i < n;i++)for(j = 0;j < n;j++)f[i][j] = sc.nextInt();
    sum = new int[++n][n];

    sum[1][1] = f[0][0];
    for(j = 2;j < n;j++)sum[1][j] = sum[1][j - 1] + f[0][j - 1];
    for(i = 2;i < n;i++)sum[i][1] = sum[i - 1][1] + f[i - 1][0];
    for(i = 2;i < n;i++)for(j = 2;j < n;j++)
      sum[i][j] = f[i - 1][j - 1] + sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1];

    res = f[0][0];
    for(h = 0;h < n;h++)for(i = 1;i < n - h;i++)
    for(w = 0;w < n;w++)for(j = 1;j < n - w;j++){
      x = sum[i + h][j + w] - sum[i - 1][j + w] - sum[i + h][j - 1] + sum[i - 1][j - 1];
      if(res < x)res = x;
    }
    out.println(res);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 40608
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int test)
{
  int a, b, c, d;
  string s;
  cin >> n >> a >> b >> c >> d >> s;
  bool ok = true, f = true;
  for (int i = a; i < c; ++i) {
    ok &= s[i] != s[i - 1] || s[i] != '#';
  }
  for (int i = b; i < d; ++i) {
    ok &= s[i] != s[i - 1] || s[i] != '#';
  }
  if (c > d) {
    f = false;
    for (int i = b - 1; i < d; ++i) {
      f |= s[i - 1] == s[i] && s[i] == s[i + 1] && s[i + 1] == '.';
    }
  }
  if (ok && f) {
    cout << "Yes\n";
  }
  else {
    cout << "No\n";
  }
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 592
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <math.h>
#include <queue>
#include <set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pl;
typedef pair<int, int> pi;
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 = 1<<30;

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n,-1){}

    int root(int x){
        if(par[x] < 0) return x;
        return par[x] = root(par[x]);
    }

    bool unite(int x, int y){
        int rx = root(x), ry = root(y);
        if(rx == ry) return false;
        if(size(rx) < size(ry)) swap(rx, ry);
        par[rx] += par[ry];
        par[ry] = rx;
        return true;
    }

    bool isSame(int x, int y){
        return root(x) == root(y);
    }

    int size(int x){
        return -par[root(x)];
    }
};

int main(){
	int n, m;
	cin >> n >> m;
	vector<int> P(n);
	UnionFind uf(n+1);
	for (int i = 0; i < n; i++) cin >> P[i];
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		uf.unite(x, y);
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if(uf.isSame(P[i], P[P[i]-1])) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> V(N), C(N);

    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> C[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        if (V[i] > C[i]) {
            ans += V[i] - C[i];
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(void){
    int n,k;
    cin >> n >> k;
    string  S;
    cin >> S;
    
    if(S[k-1] == 'A') {
        S[k-1] ='a';
    }
    else if (S[k-1] == 'B') {
        S[k-1] = 'b';
    }
    else if (S[k-1] == 'C'){
        S[k-1] = 'c';
    }
    cout << S << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define N 200005

using namespace std;
typedef pair<int,int> Pair;
typedef long long ll;

const long double Pi = 3.14159265358979323846l;
const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
    int res = 1;
    while (y) {
        if (y & 1) res = mul(res, x);
        x = mul(x, x), y >>= 1;
    } return res;
}

template <class T> inline T input() {
    T x; char ch; while (!isdigit(ch = getchar()));
    for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
    return x;
}

template <class T> inline void chkmin(T &x, T &y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T &y) { x = x > y ? x : y; }

struct {
    inline operator int () { return input<int>(); }
    inline operator long long () { return input<long long>(); }
    template <class T> inline void operator () (T &x) { x = *this; }
    template<class T, class ...A> inline void operator () (T &x, A &...a)
    { x = *this; this -> operator ()(a...); }
} read;

int n, x, y;
int c[N], w[N];
int col_min[N], cnt[N], mina, minb, tot;
int fac[N], ifac[N];
bool pd_col[N];

void init() {
    ifac[0] = fac[0] = 1;
    for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
    ifac[N - 1] = inv(fac[N - 1]);
    for (int i = N - 2; i; --i) ifac[i] = mul(ifac[i + 1], i + 1);
}

int C(int x, int y) {
    if (x < y || y < 0) return 0;
    return mul(fac[x], mul(ifac[y], ifac[x - y]));
}

int main() {
    init();
    read(n, x, y);
    memset(col_min, 0x3f, sizeof col_min);
    mina = minb = inf;

    for (int i = 1; i <= n; ++i) {
        read(c[i], w[i]);
        chkmin(col_min[c[i]], w[i]);
    }
    for (int c = 1; c <= n; ++c) {
        if (col_min[c] < mina) minb = mina, mina = col_min[c];
        else if (col_min[c] < minb) minb = col_min[c];
    }

    if (mina + minb > y) return puts("1"), 0;
    for (int c = 1; c <= n; ++c)
        if (col_min[c] + mina > y)
            pd_col[c] = true;

    for (int i = 1; i <= n; ++i) {
        if (pd_col[c[i]]) continue;
        if (col_min[c[i]] + w[i] <= x) ++cnt[c[i]], ++tot;
        else if ((col_min[c[i]] == mina ? minb : mina) + w[i] <= y) ++cnt[c[i]], ++tot;
    }

    int ans = 1;
    for (int c = 1; c <= n; ++c)
        ans = mul(ans, C(tot, cnt[c])), tot -= cnt[c];
    printf("%d\n", ans);
    return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll H, W;
    cin >> H >> W;

    ll N;
    cin >> N;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    vector<vector<ll>> ans(H, vector<ll>(W, -1));

    ll total = 0;

    REP(i, N){
        REP(j, A[i]){
            ll h = total/W;
            ll w = total%W;
            // cout << total << " " << h << " " << w << endl;
            if(h%2 == 1){
                w = W-w-1;
            }
            // cout << total << " " << h << " " << w << endl;
            ans[h][w] = i+1;
            total++;
        }
    }

    REP(i, H){
        REP(j, W){
            if(j == W-1){
                cout << ans[i][j] << endl;
            }
            else{
                cout << ans[i][j] << " ";
            }
        }
    }
    return 0;
}

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

void fnBubbleSort(vector<int> &rvnSort, int &rnSortCnt)
{
  int nSorting = 0;
  bool bSorting = true;

  while (bSorting)
  {
    bSorting = false;
    for (int i = rvnSort.size() - 1; i > nSorting; i--)
    {
      if (rvnSort[i] < rvnSort[i - 1])
      {
        bSorting = true;
        swap(rvnSort[i], rvnSort[i - 1]);
        rnSortCnt++;
      }
    }
    nSorting++;
  }
}

void fnOutput(const vector<int> &cnrvnSort, int nSortCnt)
{
  for (int i = 0; i < cnrvnSort.size(); i++)
  {
    if (i) cout << " ";
    cout << cnrvnSort[i];
  }
  cout << endl;
  cout << nSortCnt << endl;
}
    
int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  int nSortCnt = 0;
  vector<int> vnSort;
  int nMaxSiz;
  
  cin >> nMaxSiz;
  for (int i = 0; i < nMaxSiz; i++)
  {
    int nNum;
    cin >> nNum;
    vnSort.push_back(nNum);
  }

  fnBubbleSort(vnSort, nSortCnt);
  fnOutput(vnSort, nSortCnt);

  return 0;
}

Measured memory_bytes: 1220
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int maxn=100010;
void read(int &k){
	k=0; int f=1; char c=getchar();
	while (c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while ('0'<=c&&c<='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main(){
    char s[100];
    scanf("%s",s); 
    int n=strlen(s);
    for (int i=0;i<n;i++){
    	if (s[i]=='A'&&s[i+1]=='C'){
    		printf("Yes");
    		return 0;
    	}
    }
    printf("No");
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
}

long long fifth(long long x) {
    long long t = x;
    x *= x;
    x *= x;
    return x*t;
}

void solve() {
    int n; scanf("%d", &n);
    for (long long a = -4000; a <= 4000; ++a) {
        for (long long b = -4000; b <= 4000; ++b) {
            if (fifth(b)-fifth(a) == n) {
                printf("%d %d\n", b, a);
                return;
            }
        }
    }
}

int main() {
    init();
    int t = 1; //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3860
#include <stdio.h>

double x[200010];
long long int y[200010];
int count2[200010],count5[200010];
long long int size[110][110];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%lf",&x[i]);
	for(int i=1;i<=a;i++) y[i] = (long long int)(x[i]*1000000000+0.5);
	for(int i=1;i<=a;i++)
	{
		long long int k = y[i];
		while(k%2==0) count2[i]++,k/=2;
		while(k%5==0) count5[i]++,k/=5;
		size[count2[i]][count5[i]]++;
	}
	
	long long int ans = 0;
	for(int i=0;i<=60;i++)
	{
		for(int j=0;j<=60;j++)
		{
			for(int i2=0;i2<=60;i2++)
			{
				for(int j2=0;j2<=60;j2++)
				{
					if(i+i2>=18 && j+j2>=18)
					{
						if(i==i2&&j==j2)
						{
							ans += size[i][j]*size[i2][j2];
							ans -= size[i][j];
						}
						else ans += size[i][j]*size[i2][j2];
					}
				}
			}
		}
	}
	printf("%lld",ans/2);
}

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

int isPrime(int x)
{
    int i = 3;
    
    if ( x == 2 ) {
        return 1;
    }
    
    if ( ( x < 2 ) || ( x % 2 == 0 ) ) {
        return 0;
    }
    
    while ( i <= sqrt((double)x) ) {
        if ( x % i == 0 ) {
            return 0;
        }
        i += 2;
    } 
    return 1;    
}

int main(void)
{
    int n;
    int x;
    int cnt;
    int i;

    scanf("%d", &n);

    cnt = 0;
    
    for ( i = 0; i < n; i++ ) {
        scanf("%d", &x);
        if ( isPrime(x) == 1 ) {
            cnt++;
        }
    }
    
    printf("%d\n", cnt);
    
    return 0;
}


Measured memory_bytes: 2052
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int tmp,n;
    cin>>tmp;
    int k=tmp;
    n=(1LL<<tmp);
    multiset<int>s;
    f(i,1,n)
    {
        cin>>tmp;
        tmp=-tmp;
        s.insert(tmp);
    }
    vector<int>vec;
    vec.pb(*s.begin());
    s.erase(*s.begin());
    for(int i=1;i<=k;i++)
    {
          vector<int>nw;
          for(auto x:vec)
          {
               if(s.upper_bound(x)==s.end())
               {
                   cout<<"No"<<endl;
                   return 0;
               }
               nw.pb(*(s.upper_bound(x)));
               s.erase(s.upper_bound(x));
          }
          for(auto x:nw)
          {
              vec.pb(x);
          }
          sort(vec.begin(),vec.end());
    }
    cout<<"Yes"<<endl;
    return 0;

}




































Measured memory_bytes: 18192
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)

using namespace std;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main()
{
  string s,t;
  cin>>s>>t;
  string s2 = s + s + s;
  int n = s.size();
  vector<vecint> nxt_idx(3*n+1, vecint(26, -1));
  for (int i = 3*n-1; i >= 0; --i) {
    nxt_idx[i] = nxt_idx[i+1];
    nxt_idx[i][s2[i]-'a'] = i;
  }
  int m = t.size();
  ll cnt = 0;
  bool ok = true;
  REP(i,m) {
    if (nxt_idx[cnt%n][t[i]-'a'] < 0) {
      ok = false;
      break;
    }
    cnt += nxt_idx[cnt%n][t[i]-'a'] - cnt%n;
    ++cnt;
  }
  if (ok) {
    cout<<cnt<<endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}


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

int main() {
	int n,count=0;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++)
	{
	    cin>>a[i];
	}
	for(int i=1;i<=n;i++)
	{
	    if(i%2!=0 && a[i]%2!=0)
	    {
	        count++;
	    }
	}
	cout<<count;
	return 0;
}


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

string s;
stack<char> c;
int ans;

int main()
{
    cin >> s;
    for (int i = 0; s[i]; i++)
    {
        if (!c.empty() && s[i] != c.top())
        {
            c.pop();
            ans += 2;
        }
        else
        {
            c.push(s[i]);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 512
#                         author:  kagemeka 
#                         created: 2019-11-06 12:47:30(JST)
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    ab = sys.stdin.readline().split()
    n = int(''.join(ab))
    print('Yes' if math.floor(n ** 0.5) ** 2 == n else 'No')


if __name__ == "__main__":
    # execute only if run as a script
    main()


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

int MOD=1000000007;

int main() {
  long long N,X,L,ans=0;
  cin >> N;
  pair<long long, long long> P[N+10];
  for(int i=0; i<N; i++) {
    cin >> X >> L;
    P[i].first=X+L;
    P[i].second=X-L;
  }
  sort(P,P+N);
  long long t=-MOD;
  for(int i=0; i<N; i++) {
    if(t<=P[i].second) {
      ans++;
      t = P[i].first;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<iostream>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>

using namespace std;

int keta(int a){
    int count=0;
    while(a!=0){
        a/=10;
        count++;
    }
    return count;
}


int main(){
    int n,k;
    long long int m=1000000000;
    cin>>n>>k;
    vector<long long int> h(n);
    for(int i=0;i<n;i++){
        cin>>h.at(i);
    }
    sort(h.begin(),h.end(),greater<int>());
    for(int i=0;i<=n-k;i++){
        m=min(m,h.at(i)-h.at(i+k-1));
    }
    cout<<m<<endl;
    return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

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

int main(){
    int n;
    cin >> n;
    vi a(n), b(n);
    rep(i, n) cin >> a[i];
    b[0] = a[0];
    rep1(i, n-1) b[i] = gcd(b[i-1], a[i]);
    set<int> c1;
    c1.insert(0);
    rep1(i, n-1) {
        set<int> t;
        swap(c1, t);
        c1.insert(b[i-1]);
        for (int j : t) c1.insert(gcd(j, a[i]));
    }
    int ans = 0;
    for (int i : c1) ans = max(ans, i);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define SORT(v) sort(v.begin(),v.end())
#define fori(i,a,b) for(ll i=a;i<b;i++)
#define M 1000000007
#define deb(x) cout<< #x << " " << x << endl;

double pi=3.14159265358979323846;

typedef pair<int,int> pii;
typedef pair<long long int, long long int>pll;
typedef vector<int>vi;
typedef vector<long long int>vl;
#define MAXN 10000001

int main ()
{
    ll T;
    T=1;
    //cin>>T;
    while(T--)
    {
   
   int x,y;
   cin>>x>>y;
    	int z=(4*x-y),a=y-2*x; 
    	if(z>=0&&z%2==0&&a>=0&&a%2==0)cout<<"Yes"<<endl;
    	else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3584
#include<cstdio>

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

Measured memory_bytes: 2772