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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin>>a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  int ans=0;
  for(int i=0; i<n; i++){
    if(i%2==0)
      ans+=a.at(i);
    else
      ans-=a.at(i);
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include<unordered_map>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int n;
	cin >> n;
	vector<int>imos(100004);
	rep(i, n) {
		int a;
		cin >> a;
		imos[a]++;
		imos[a + 3]--;
	}
	ll count = 0;
	ll ans = 0;
	rep(i, imos.size()) {
		count += imos[i];
		ans = max(ans, count);
	}
	cout << ans << endl;
}


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

int main(){
	ios_base::sync_with_stdio(false);

	unsigned int list[100000];
	int numOfList;

	cin >> numOfList;

	rep(i,numOfList)cin >> list[i]; 

	int val;
	int counter = 0;
	cin >> val;

	while(cin >> val){
		int high = numOfList - 1;
		int low = 0;
		int mid;

		while(low <= high){
			mid = (low + high) / 2;
			if(list[mid] < val){
				low = mid + 1;
			}else if(list[mid] > val){
				high = mid - 1;
			}else if(list[mid] == val){
				counter ++;
				break;
			}
		}
	}
	cout << counter << endl;




	return 0;
}

Measured memory_bytes: 1588
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<bool>    vecbool;
typedef vector<int>     vecint;
typedef vector<ll>      vecll;
typedef vector<string>  vecstr;
typedef vector<vecint>  vec2int;
typedef vector<vecbool> vec2bool;
int dx[4] {-1,+1, 0, 0};
int dy[4] { 0, 0,-1,+1};
void init(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
int main()
{
  init();
  string s; cin >> s;
  if(s[2] == s[3]&&s[4] == s[5]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


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

int main() {
	int k;
	char ch[100];
	cin>>k>>ch;
	if(strlen(ch) <=  k) cout<<ch<<endl;
	else {
		for(int i=0; i<k; i++) cout<<ch[i];
		cout<<"..."<<endl;
	}

	return 0;
}

Measured memory_bytes: 3608
while True:
    N,K,M = map(int,input().split())
    if N == 0: break
    li = list(range(1,N+1))
    i = M-1
    while len(li) > 1:
        li.pop(i)
        i = (i+K-1) % len(li)
    print(li[0])

Measured memory_bytes: 5924
while True:
  q = int(input())
  if q == -1:
    break
  x = q / 2
  end = q * 10 ** -5
  while abs(x ** 3 - q) >= end:
    x = (2 * x ** 3 + q) / (3 * x ** 2)
  print(f'{x:.6f}')


Measured memory_bytes: 5668
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
#define mod 1000000007
#define ALL(a) a.begin(),a.end()
 
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); }

bool IsPrime(ll num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            // 素数ではない
            return false;
        }
    }
    // 素数である
    return true;
}

int main(){
    ll n;
    cin >> n;
    ll l[n];
    for (ll i = 0; i < n; i++) {
        cin >> l[i];
    }
    sort(l, l+n, greater<int>());

    ll ans = 0;
    for (ll i = 0; i < n; i++){
        for (ll j = i+1; j < n; j++){
            for (ll k = j+1; k < n; k++){
                ll a = l[i];
                ll b = l[j];
                ll c = l[k];
                if (a < (b+c) && b < (a+c) && c < (a+b)){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vvec<int> g(N);
    for(int i=0;i<N-1;i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    int K;
    cin >> K;
    int inf = 1e9;
    vec<int> A(N,inf);
    for(int i=0;i<K;i++){
        int a,b;
        cin >> a >> b;
        a--;
        A[a] = b;
    }
    vec<int> L(N,-inf),R(N,inf);
    vec<int> sign(N,-1);
    bool ok = true;
    {
        auto dfs = [&](auto&& self,int cur,int par)->void{
            if(A[cur]!=inf){
                L[cur] = R[cur] = A[cur];
                sign[cur] = A[cur]%2;
            }
            for(auto& to:g[cur]) if(to!=par){
                self(self,to,cur);
                L[cur] = max(L[cur],L[to]-1);
                R[cur] = min(R[cur],R[to]+1);
                if(sign[to]!=-1){
                    if(sign[cur]==-1) sign[cur] = 1-sign[to];
                    else if(sign[cur]!=1-sign[to]) ok = false;
                }
            }
            ok &= R[cur]>=L[cur];
        };
        dfs(dfs,0,-1);
        //for(int i=0;i<N;i++) cerr << sign[i] << (i!=N-1? " ":"\n");
    }
    if(!ok){
        cout << "No\n";
        return 0;
    }
    {
        auto dfs = [&](auto&& self,int cur,int par,int pnum)->void{
            if(A[cur]==inf){
                if(L[cur]<=pnum+1 && pnum+1<=R[cur]) A[cur] = pnum+1;
                else A[cur] = pnum-1;
            }
            for(auto& to:g[cur]) if(to!=par){
                self(self,to,cur,A[cur]);
            }
        };
        dfs(dfs,0,-1,L[0]-1);
    }
    cout << "Yes\n";
    for(int i=0;i<N;i++) cout << A[i] << "\n";
}

Measured memory_bytes: 14080
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int r[52]={};
    REP(i,m){
        int tmp1,tmp2;
        scanf("%d%d",&tmp1,&tmp2);
        tmp1--,tmp2--;
        r[tmp1]++;
        r[tmp2]++;
    }

    REP(i,n){
        printf("%d\n",r[i]);
    }
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

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

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

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	long long int a, b, c;
	cin >> a >> b >> c;
	long long int x, y;
	cin >> x >> y;
	long long int ans = 0;
	if (2 * c < a + b) {
		if (x > y) {
			ans = ans + 2 * c * y;
			ans = min(ans + (x - y) * a, ans + 2 * c * (x - y));
		}
		else {
			ans = ans + 2 * c * x;
			ans = min(ans + (y - x) * b, ans + 2 * c * (y - x));
		}
	}
	else {
		int s = min(x, y);
		ans = ans +  s* (a + b);
		if (x > y) {
			ans = min(ans + (x - y) * a, ans + 2 * c * (x - y));
		}
		else {
			ans = min(ans + (y - x) * b, ans + 2 * c * (y - x));
		}
	}
	cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}


signed main(){
  string str;
  cin>>str;
  
  cout<<str.substr(0,str.size()-8)<<endl;;
  
  return 0;
}


Measured memory_bytes: 256
// Last Change: 06/27/2019 17:47:41.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

namespace NS {
void LoopUntilZeroInpput() {
  int hogegegege = 0;
  while (cin >> hogegegege && hogegegege != 0) {
  }
}
} // namespace NS

bool Boin(char ipt) {
  if (ipt == 'a' or ipt == 'i' or ipt == 'u' or ipt == 'e' or ipt == 'o') {
    return true;
  } else {
    return false;
  }
}

int Solve(const int n) {
  vector<string> s(n);
  vector<string> res(n, "");

  list<int> ls;
  map<string, int> mp;

  for (auto &&e : s) {
    cin >> e;
  }

  for (int i = 0; i < n; ++i) {
    res[i] += s[i][0];

    for (size_t j = 1; j < s[i].size(); ++j) {
      if (Boin(s[i][j - 1])) {
        res[i] += s[i][j];
      }
    }

    ++mp[res[i]];
    if (mp[res[i]] > 1) {
      return -1;
    }

    ls.push_back(i);
  }

  int k = 0;
  while (!ls.empty()) {
    vector<int> val(26, 0);
    for (auto itr = ls.begin(), last = ls.end(); itr != last; ++itr) {
      ++val[res[*itr][k] - 'a'];
    }
    for (auto itr = ls.begin(); itr != ls.end();) {
      if (k + 1 == res[*itr].size()) {
        itr = ls.erase(itr);
      } else if (val[res[*itr][k] - 'a'] == 1) {
        itr = ls.erase(itr);
      } else {
        ++itr;
      }
    }
    ++k;
  }

  return k;
}

int main() {
  int n;
  while (cin >> n and n != 0) {
    cout << Solve(n) << endl;
  }
}




Measured memory_bytes: 3204
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int k;
    int s;
    int cnt = 0;
    cin >> k >> s;
    for (int i = 0; i <= k; i++){
        for(int j = 0; j <= k; j++){
            int z = s - i - j;
            if (z >= 0 && z <= k) cnt++;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cassert>
#include<iostream>
#include<algorithm>

using namespace std;

#define Whats(x) cout<<#x<<" is "<<(x)<<endl
#define DivHim() cout<<">>>>>>>>>>>>>>>"<<endl
#define DivHer() cout<<"<<<<<<<<<<<<<<<"<<endl
#define Oops() cout<<"!!!!!!!!!!!!!!!"<<endl

template<typename T> bool GetMin(T &a,T b)
{
	return ((a<=b)?false:(a=b,true));
}

template<typename T> bool GetMax(T &a,T b)
{
	return ((a>=b)?false:(a=b,true));
}

/*
	 -<Unlimited Blade Works>-
 */

const int N=1e5+10;
const int INF=0x3f3f3f3f;

int n,cnt[2][N],ans;

int main()
{
	scanf("%d",&n);
	for(int i=1,a;i<=n;++i)
	{
		scanf("%d",&a);
		++cnt[i&1][a];
	}
	for(int i=N-1,mx=0;i>=1;--i)
	{
		GetMax(ans,cnt[1][i]+mx);
		GetMax(mx,cnt[0][i]);
	}
	for(int i=N-1,mx=0;i>=1;--i)
	{
		GetMax(ans,cnt[0][i]+mx);
		GetMax(mx,cnt[1][i]);
	}
	printf("%d",n-ans);
	return 0;
}

Measured memory_bytes: 1024
use std::io::stdin;
use std::str::FromStr;
use std::cmp::max;

fn main(){
    let n: usize = get_one();
    let vs: Vec<usize> = get_vec();
    let mut cnts1 = vec![0;100_001];
    let mut cnts2 = vec![0;100_001];

    let mut i: usize = 0;
    while i < n {
        cnts1[vs[i]] += 1;
        cnts2[vs[i+1]] += 1;
        i += 2;
    }

    let m1 = max_idx(&cnts1);
    let m2 = max_idx(&cnts2);

    if m1 != m2 {
        let ans = n as i64 - cnts1.iter().fold(&0, max) - cnts2.iter().fold(&0, max);
        println!("{}", ans);
    } else {
        cnts1.sort();
        cnts2.sort();
        let a = max(cnts1[(cnts1.len()-2) as usize], cnts2[(cnts2.len()-2) as usize]);
        let ans = n as i64 - cnts1.iter().fold(&0, max).clone() as i64 - a as i64;
        println!("{}", ans);
    }
}

fn max_idx(v: &Vec<i64>) -> usize{
    let mut ret = 0;
    let mut mx = 0;
    for i in 0..v.len() {
        if v[i] > mx {
            ret = i;
            mx = v[i];
        }
    }
    ret
}

#[allow(dead_code)]
fn get_line() -> String {
    let mut s = String::new();
    match stdin().read_line(&mut s){
        Ok(_) => {s.trim().to_string()}
        Err(_) => String::new()
    }
}

#[allow(dead_code)]
fn get_vec<T: std::str::FromStr>() -> Vec<T> {
    let line = get_line();
    line.split_whitespace().filter_map(|x| x.parse().ok()).collect()
}

#[allow(dead_code)]
fn get_one<T: FromStr + Copy>() -> T {
    let v = get_vec();
    v[0]
}

#[allow(dead_code)]
fn get_pair<T: FromStr + Copy>() -> (T, T) {
    let v = get_vec();
    (v[0], v[1])
}

#[allow(dead_code)]
fn get_triple<T: FromStr + Copy>() -> (T, T, T) {
    let v = get_vec();
    (v[0], v[1], v[2])
}

#[allow(dead_code)]
fn get_chars() -> Vec<char> {
    get_line().chars().collect()
}


Measured memory_bytes: 6396
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>

using namespace std;
int H,W,K,ans;
char mp[10][10];
int sm[10];
int smm[10];
void dfs2(int o,int x){
    if(o==W+1){
        ans+=(x==K);
        return;
    }
    dfs2(o+1,x);
    dfs2(o+1,x+sm[o]);
}
void dfs1(int o){
    if(o==H+1){
        dfs2(1,0);
        return;
    }
    dfs1(o+1);
    for(int i=1;i<=W;i++)
        sm[i]+=(mp[o][i]=='#');
    dfs1(o+1);
    for(int i=1;i<=W;i++)
        sm[i]-=(mp[o][i]=='#');
}
int main(){
    scanf("%d %d %d",&H,&W,&K);
    for(int i=1;i<=H;i++)
        for(int j=1;j<=W;j++)
            scanf(" %c",&mp[i][j]);
    dfs1(1);
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1736
from collections import Counter
import bisect


def make_divisors(n):
    divisors = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)

    # divisors.sort()
    return divisors


if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    negA = []
    idx_negA = []
    for i, a in enumerate(A):
        negA.append(i - a)
        idx_negA.append(i)

    cnt_negA = Counter(negA)
    negA_keys = sorted(cnt_negA.keys())
    ans = 0
    for i in range(N):
        if i + A[i] in cnt_negA:
            ans += cnt_negA[i + A[i]]
    print(ans)


Measured memory_bytes: 50884
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) v.erase(unique(ALL(v)), v.end())

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}


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

  int N,M;
  while(cin >> N >> M){
    vector<LLI> A(N); cin >> A;
    sort(RALL(A));

    vector<pair<int,LLI>> BC(M);

    REP(i,M){
      LLI b,c; cin >> b >> c;
      BC[i] = {b,c};
    }

    sort(ALL(BC), [](const pair<int,LLI> &a, const pair<int,LLI> &b){return a.snd > b.snd;});

    LLI ans = 0;

    for(auto &p : BC){
      int b = p.fst;
      LLI c = p.snd;

      REP(i,b){
	if(A.empty() or A.back()>=c) break;
	A.pop_back();
	ans += c;
      }
    }

    ans += accumulate(ALL(A), 0LL);
    

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


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

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

	if(a % 2 == 0 || b % 2 == 0){
		cout << "Even" << endl;
	}

	else{
		cout << "Odd" << endl;
	}
}

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

typedef long long int ll;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vll> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vpl;
typedef unordered_set<ll> usl;
typedef set<ll> sl;
typedef unordered_map<ll, ll> uml;
typedef map<ll, ll> ml;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

#define all(v) v.begin() , v.end()
#define ceil(a, b) (a + b - 1) / b
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll inf = 1e9 + 7;
const double pie = 3.14159265358979323846;
const char nl = '\n';
const char spc = ' ';

template<typename Type>
istream &operator>>(istream &in, vector<Type> &v)
{
    ll n = v.size();
    for (int i = 0; i < n; i++)
        in >> v[i];
    return in;
}

template<typename Type>
ostream &operator<<(ostream &out, vector<Type> &v)
{
    for (auto value : v)
        out << value << ' ';
    out << nl;
    return out;
}

bool isPrime (ll n)
{
    if (n < 4)
        return true;
    if (n % 2 == 0)
        return false;
    ll i = 3;
    while (i * i <= n)
    {
        if (n % i == 0)
            return false;
        i += 2;
    }
    return true;
}

void solve ()
{
    ll n, W;
    cin >> n >> W;
    vll wt(n + 1), val(n + 1);
    for (ll i = 1; i <= n; ++i)
        cin >> wt[i] >> val[i];
    vvl dp(n + 1, vll(W + 1, 0));
    for (ll i = 1; i <= n; ++i)
    {
        ll wi = wt[i], vi = val[i];
        for (ll w = 1; w <= W; ++w)
        {
            if (wi <= w)
                dp[i][w] = max (vi + dp[i - 1][w - wi], dp[i - 1][w]);
            else
                dp[i][w] = dp[i - 1][w];
        }
    }
    cout << dp[n][W] << nl;
}

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

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

Measured memory_bytes: 83144
#include <bits/stdc++.h>
using namespace std;
int b;
double bio[305][305][305];
double f(int p, int d, int t)
{
	if(p < 0 || d < 0 || t < 0)
	{
		return 0;
	}
	if(p == 0 && d == 0 && t == 0)
	{
		return bio[0][0][0] = 0;
	}
	if(bio[p][d][t] != -1)
	{
		return bio[p][d][t];
	}
	int u = p+d+t;
	return bio[p][d][t] = (double)p/u * (1+f(p-1, d, t)) + (double)d/u * (1+f(p+1, d-1, t)) + (double)t/u * (1+f(p, d+1, t-1)) + (double)(b-u)/u;
}
int main()
{
	for(int i = 0; i < 305; i++)
	{
		for(int j = 0; j < 305; j++)
		{
			for(int k = 0; k < 305; k++)
			{
				bio[i][j][k] = -1;
			}
		}
	}
	cin >> b;
    int n;
    int z[3];
    z[0] = 0;
    z[1] = 0;
    z[2] = 0;
    for(int i = 0; i < b; i++)
    {
    	cin >> n;
    	n--;
    	z[n]++;
	}
	cout << fixed << setprecision(20) << f(z[0], z[1], z[2]) << endl;
}



Measured memory_bytes: 221952
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

T = read().rstrip().decode()

T

def f(n, r, l, z):
    # 長さnの1が座標 r から l へと移動する。
    # z回立ち止まることが許されている。
    # 獲得スコアの最大値は？
    if n % 2 == 0:
        move = r - l + z
        return (move + 1) * (n // 2)
    if r == l and r % 2 == 0:
        # ev, od, ev, od, evで固定
        k = (n - 1) // 2
        move = r - l + z
        return (move + 1) * k
    # 各地点に1回ずつ立ち寄りつつ、奇数のところでz回足踏みできる
    ev = (r // 2) - ((l - 1) // 2)
    od = (r - l + 1) - ev
    od += z
    k = (n - 1) // 2
    return ev * k + od * (k + 1)

Z = T.count('0')
one = 0
to = 0
answer = 0
for i, x in enumerate(T, 1):
    if x == '0':
        if one:
            answer += f(one, i - 1, to, Z)
            one = 0
        Z -= 1
        continue
    to += 1
    one += 1
if one:
    answer += f(one, i, to, Z)

def f(n):
    # '1' * n から減らしたときのスコア
    # ただし、最初は除く
    ret = 0
    for i in range(0, n, 2):
        ret += (n - i)
    ret -= (n + 1) // 2
    return ret

n = T.count('1')
answer += f(n)
print(answer)

Measured memory_bytes: 9348
#include <iostream>

using namespace std;

const int maxk=1e5+10;

const int maxn=1e2+10;

bool dp[maxk];

int a[maxn];

int main()
{
    int n,k,g;

    cin>>n>>k;

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

    dp[0]=0;
    for(int i=1;i<=k;i++)
    {
        g=0;
        for(int j=0;j<n;j++)
        {
            if(i-a[j]>-1)
            {
                if(dp[i-a[j]]==0)
                    g++;
            }
        }
        if(g>0)
            dp[i]=1;
        else dp[i]=0;
      //  cout<<dp[i]<<" ";
    }
    if(dp[k]==0)
        cout<<"Second";
    else cout<<"First";
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, start, stop) for (int i = start; i < stop; i++)
#define FORR(i, start, stop) for (int i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<int>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<int>());
#define REMOVE(v,n) remove(vector<int> v,v+v.size(),int n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ll long long
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<int> vint;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }

//vector< vector<int> > v (size1, vector<int>(size2) );

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H,W,D;
    cin>>H>>W>>D;
    vector< vector<LP> > hash(D, vector<LP>(H*W/D+1) );
    FOR(i,0,D)
        FOR(j,0,H*W/D+1)
            hash[i][j]={-1,-1};
    
    ll a;
    LP pl;
    FOR(i,0,H){
        FOR(j,0,W){
            cin>>a;
            pl=make_pair(i+1,j+1);
            hash[a%D][a/D]=pl;
        }
    }

    vector< vector<ll> > ans(D, vector<ll>(H*W/D+1));

    FOR(i,0,D){
        FOR(j,0,H*W/D+1){
            if(j==0)ans[i][j]=0;
            else if(hash[i][j].first!=-1){
                ans[i][j]=ans[i][j-1]+abs(hash[i][j].first-hash[i][j-1].first)+abs(hash[i][j].second-hash[i][j-1].second);
            }
        }

    }

    ll Q,L,R;
    cin>>Q;
    FOR(i,0,Q){
        cin>>L>>R;
        cout<<ans[L%D][R/D]-ans[L%D][L/D]<<endl;
    }

}

Measured memory_bytes: 11776
N = gets.to_i

xyh = []

hmax = 0

N.times do |i|
  xyh[i] = gets.split.map(&:to_i)

  if xyh[i][2] > hmax
    hmax = xyh[i][2]
  end
end

ans_cx = 0
ans_cy = 0
ans_h = 0

catch(:break_loop) do
  for hh in hmax..hmax+200 do
    for cx in 0..100 do
      for cy in 0..100 do
        for i in 0..N-1 do
          break if xyh[i][2] != [hh-(xyh[i][0]-cx).abs-(xyh[i][1]-cy).abs, 0].max
          next if i != N-1
          ans_cx = cx
          ans_cy = cy
          ans_h = hh
          throw:break_loop
        end
      end
    end
  end
end
puts "#{ans_cx} #{ans_cy} #{ans_h}"


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

#define mp make_pair
#define pb push_back
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repn(i, n) for(int i = 1; i < n; ++i)
#define repm(i, n, m)  for(int i = n; i < m; ++i)
#define Repm(i, n, m)  for(int i = n; i <= m; ++i)
#define mod 1000000000+7


int main(){
    string a, b; cin >> a >> b;
    int n = stoi(a+b);
    Repm(i, 1, 100100){
        if(i*i == n){cout << "Yes" << endl;  return 0;}
    }
    cout << "No" << endl;  return 0;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int p = Integer.parseInt(sc.next());
    int q = Integer.parseInt(sc.next());
    int r = Integer.parseInt(sc.next());
    int ans = 0;
    
    int a = p+q;
	int b = q+r;
	int c = r+p;
    
    int d = Math.min(a, b);
    int e = Math.min(b, c);
    ans = Math.min(d, e);
    
    System.out.println(ans);
  }
}


Measured memory_bytes: 23636
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<iterator>
#include<stack>
#include<queue>
#include<utility>
#include<functional>
#include<bitset>
#include<numeric>
#include<cstring>
using namespace std;

int n, w;
vector< long long > value( 110 ), weight( 110 ), ans;
long long dp[ 100005 ][ 110 ];

long long solve( int w, int n )
{
	if( w < 0 )
	{
		return -1e9;
	}
	if( n == 0 )
	{
		return 0;
	}
	if( dp[ w ][ n ] != -1 )
	{
		return dp[ w ][ n ];
	}
	dp[ w ][ n ] = max( value[ n ] + solve( w - weight[ n ], n - 1 ), solve( w, n - 1 ) );
	return dp[ w ][ n ];
}
		
int main( void )
{
	ios :: sync_with_stdio( 0 );
	cin.tie( 0 );
	
	memset( dp, -1, sizeof( dp ) );	
	cin >> n >> w;
	for( int i = 1; i <= n; ++i )
	{
		cin >> weight[ i ] >> value[ i ];		
	}
	cout << solve( w, n ) << "\n";
	return 0;
}


Measured memory_bytes: 86272
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

template <typename T>
using V = vector<T>;
using ll = long long;
#define FOR(i, a, b) for (ll i = (a); i <= (b); ++i)

class BIT {
public:
    // 要素数N、値vで初期化
    BIT(ll N, ll v) : V_NUM(N) {
        data.resize(N);
        fill(data.begin(), data.end(), v);
    }

    // [1, i]の総和を求める
    ll query(ll i) {
        ll ret = 0;
        while (i > 0) {
            ret += data[i];
            i -= (i & -i);
        }
        return ret;
    }

    // data[i]にv可算
    void update(ll i, ll v) {
        while (i < V_NUM) {
            data[i] += v;
            i += (i & -i);
        }
    }

    ll V_NUM;
    V<ll> data;
};

// swapでfrom->toに変えるのに必要な回数を求める
ll bubble(string from, string to) {
    ll N = from.size();
    
    // まずは文字列から数列に変換する
    
    // fromでの各文字のindexを突っ込む
    queue<ll> cidx[26];
    FOR(i, 0, N - 1) {
        cidx[from[i] - 'a'].push(i);
    }

    // from[i] -> to[idx[i]]
    V<ll> idx(N);
    FOR(i, 0, N - 1) {
        idx[i] = cidx[to[i] - 'a'].front();
        cidx[to[i] - 'a'].pop();
    }
    
    // 求めた数列の転倒数を求める

    // N要素のBITを構築
    BIT bit(N + 1, 0);

    ll ans = 0;
    FOR(i, 0, N - 1) {
        // N - idx[i]以下の要素数を加える
        ans += bit.query(N - idx[i]);
        
        // N - idx[i]を追加
        bit.update(N - idx[i], 1);
    }

    return ans;
}

int main() {
    string S;
    cin >> S;

    // S中の各文字の数を数える
    V<ll> cnt(26, 0);
    for (char c : S) {
        cnt[c - 'a']++;
    }

    ll oddcnt = 0;
    FOR(i, 0, 25) {
        oddcnt += cnt[i] % 2;
    }

    // 回文判定
    if (oddcnt > 1) {
        cout << -1 << endl;
        return 0;
    }

    // 回文の前半分を構築する
    // 各文字について、Sの頭から順に半分ずつ拾っていけばいい
    string pre;
    V<ll> appear(26, 0);
    for (char c : S) {
        if (appear[c - 'a'] < cnt[c - 'a'] / 2) {
            pre.push_back(c);
            appear[c - 'a']++;
        }
    }

    string to = pre;
    
    // |S|が奇数の場合、真ん中の文字を付ける
    FOR(i, 0, 25) {
        if (cnt[i] % 2 > 0) {
            to.push_back(i + 'a');
        }
    }

    // 前半をひっくり返してくっつける
    reverse(pre.begin(), pre.end());
    to += pre;

    cout << bubble(S, to) << endl;

    return 0;
}

Measured memory_bytes: 6020
/*																													   
 Templatka c++ Kacper Fis																							   																											   //
*/																													  
#include <functional>																							   
#include <bits/stdc++.h>																							   
																													   
using namespace std; 																								   
																													   
const int INF = 1000000001;																						   
const float PI = 3.14;	
const int mod = 1e9+7;																							   
typedef long long LL;																								   
																													   
typedef vector<int> vi;																								   
typedef list<int> li;																								   
typedef queue<int> qi; 																								   
typedef pair<int,int> ii; 																							   
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'															   
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford			   
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra																													   																				   list<int>::iterator it;																								   
																				   
vector<ii>::iterator iter;																							   
																													   																				   
#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}							   
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}						   
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)													   
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);											   
#define pb(x) push_back(x) 																							   
#define pf(x) push_front(x)																							   
#define mp(x, y) make_pair(x, y)                                                                                       
///////////////////////////////////////////////GLOBAL DEFINITIONS//////////////////////////////////////////////////////


///////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])																					 
{ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);                  												       
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	int H, W, h, w;
	cin >> H >> W >> h >> w;
	int area = H * W;
	//cout << "area1: " << area << endl;
	area -= (h * W);
	//cout << "area2: " << area << endl;
	area -= (H * w);
	//cout << "area3: " << area << endl;
	int r1 = (H - h);
	int r2 = (W - w);
	area += ((H - r1) * (W - r2));
	
	cout << area << '\n';
	
	
	
	
	
	
	
	
						
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int N; cin >> N;
  vector <ll> D(N);
  for (int i = 0; i < N; i++){
    cin >> D[i];
  }
  
  ll ans = 0;
  for (int i = 0; i < N - 1; i++){
    for (int j = i + 1; j < N; j++){
      ans += D[i] * D[j];
    }
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;


int f(ll a) {
    int x = log10(a);
    return x + 1;
}

int main() {
    ll n;
    cin >> n;

    int res = 12;
    for (ll i = 1; i * i <= n; i++) if(n % i == 0){
        ll a = i, b = n / i;
        int cur = max(f(a), f(b));
        if(cur < res) res = cur;
    }
    cout << res << endl;
}

Measured memory_bytes: 256
from decimal import *
class Fry:
    def __init__(self,a1,m1,a2,m2,a3,m3):
        self.a1 = a1
        self.m1 = m1
        self.a2 = a2
        self.m2 = m2
        self.a3 = a3
        self.m3 = m3

    def euc(self,m,n):
        if n==0:
            return(m)
        else:
            r = m % n
            return(self.euc(n,r))

    def test(self,a,m):
        n = 0
        x = 1
        while True:
            x1 = (a * x) % m
            n += 1
            if x1 == 1:
                break
            else:
                x = x1
        return(n)

    def mv(self):
        n1 = Decimal(self.test(self.a1,self.m1))
        n2 = Decimal(self.test(self.a2,self.m2))
        n3 = Decimal(self.test(self.a3,self.m3))
        m1 = n1*n2/self.euc(n1,n2)
        m2 = m1*n3/self.euc(m1,n3)

        return(m2)

while True:
    a1,m1,a2,m2,a3,m3 = list(map(int, input().strip().split()))
    if a1==m1==a2==m2==a3==m3==0:
        break
    fry = Fry(a1,m1,a2,m2,a3,m3)
    print(fry.mv())

Measured memory_bytes: 9948
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main()
        {
            for (int i = 1; i > 0; i++)
            {
                int x = int.Parse(Console.ReadLine());
                if (x == 0) break;
                else Console.WriteLine("Case {0}: {1}", i, x);
            }

        }
    }
}



Measured memory_bytes: 19968
#include <iostream>
#include <algorithm>
#include <ostream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstring>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using ll = long long;

template <typename T, typename U>
std::ostream &operator<<(std::ostream &out, std::pair<T, U> p)
{
  out << "(" << p.first << ", " << p.second << ")";
  return out;
}

template <typename T>
std::ostream &operator<<(std::ostream &out, std::vector<T> v)
{
  out << "[";
  for (int i = 0; i < v.size(); ++i)
  {
    out << v[i] << (i == (v.size() - 1) ? "" : ", ");
  }
  out << "]";
  return out;
}

int main()
{
  int n, k;
  std::string s;

  std::cin >> n >> k;
  std::cin >> s;

  std::vector<std::pair<int, int>> zeros; // [l, r)

  int l = -1;
  for (int i = 0; i < n; ++i)
  {
    if (s[i] == '0')
    {
      if (l == -1)
      {
        l = i;
      }
    }
    else
    {
      if (l != -1)
      {
        zeros.push_back(std::make_pair(l, i));
        l = -1;
      }
    }
  }

  if (l != -1)
  {
    zeros.push_back(std::make_pair(l, n));
  }

  if (zeros.size() == 0)
  {
    std::cout << n << std::endl;
    return 0;
  }

  int ans = (zeros.size() == 0 ? n : -int(1e9));
  //std::cerr << zeros << std::endl;

  for (int i = 0; i < n; ++i)
  {
    int l = 0, r = zeros.size(), m;

    while (r - l > 1)
    {
      m = (l + r) / 2;

      if (i <= zeros[m].second - 1)
      {
        r = m;
      }
      else
      {
        l = m;
      }
    }

    if (l == 0 and i <= zeros[l].second - 1)
    {
      r = l;
    }

    //std::cerr << "i = " << i << ", r = " << r << std::endl;
    // r が一番近い位置なはず
    int tmp = (r == zeros.size() ? n - i : (r + k >= zeros.size() ? n : zeros[r + k].first) - i);
    //std::cerr << "tmp = " << tmp << std::endl;
    ans = std::max(ans, tmp);
  }

  std::cout << ans << std::endl;

  return 0;
}

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

#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout << d << endl;
#define coutd(d) cout << std::setprecision(10) << d << endl;
#define cinline(n) getline(cin, n);
#define replace_all(s, b, a) replace(s.begin(), s.end(), b, a);
#define PI (acos(-1))
// #define int long long

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

int n, m;
vi A(1005);
vi B(1005);
int C[1005][20];  // C[m][n]

void input(){
  cin >> n >> m;
  reps(i, m){
    cin >> A[i] >> B[i];
    reps(j, B[i]) cin >> C[i][j];
  }
}

void solve(){
  vi dp(5000, INF); // 2^n つまり 2^12 == 4096 通りのコストを格納するため 5000
  dp[0] = 0;
  for(int item = 1; item <= m; item++){
    int now = 0; // 開けることができる宝箱
    for(int j = 1; j <= B[item]; j++){
      // 1bit目を1番目の宝箱と対応させるために、c[item][j]に格納される開けることができる宝箱の番号から1を引いている
      now |= (1 << (C[item][j] - 1));
    }
    for(int bits = 0; bits < (1 << n); bits++){
      chmin(dp[bits | now], dp[bits] + A[item]);
    }
  }
  if(dp[(1 << n) - 1] == INF) dp[(1 << n) - 1] = -1; // (1 << n) - 1 で2進表記でn桁全て1となる
  cout << dp[(1 << n) - 1] << endl;
}

signed main() {
  
  input();
  solve();
  
}

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

using namespace std;

typedef long long ll;

int main(){
	string S;
	cin >> S;
	string ans = "Good";

	for (int i = 0; i < 3; i++)
	{
		if (S[i] == S[i+1])
		{
			ans = "Bad";
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

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

char num[25];

main()
{
	scanf("%s",num);
	int len=strlen(num);
	int ans=(len-1)*9+num[0]-'0';
	for(int i=1;i<len;i++)
	{
		if(num[i]!='9')
		{
			ans--;
			break;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	//string duck;
	//getline(cin,duck);
	//if (duck == "ABC")
	//	cout << "ARC";
	//else cout << "ABC";

	int n, k = 0;
	cin >> n >> k;
	int *arr = new int[n];

	for (int i = 0; i < n; i++)
	{
		arr[i] = 0;
	}

	for (int i = 0; i < k; i++) 
	{
		int duck;
		cin >> duck;
		for (int j = 0; j < duck; j++) 
		{
			int a = 0;
			cin >> a;
			arr[a - 1] += 1;
		}
	}

	int ans = 0;
	
	for (int i = 0; i < n; i++)
	{
		if (arr[i] == 0)
			ans += 1;
	}
	cout << ans;


    return 0;
}


Measured memory_bytes: 3640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author KY2001
 */

#include <fstream>
#include <iostream>

#include "bits/stdc++.h"
#define int long long
#define For(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define Max(x) *max_element(ALL(x))
#define Min(x) *min_element(ALL(x))
#define Lower_bound(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define Upper_bound(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define itn int
#define Endl endl

using namespace std;
using ll = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}

class AStationAndBus {
public:
  void solve(std::istream &cin, std::ostream &cout) {
    string S;
    cin >> S;
    if (S[0] != S[1] || S[1] != S[2]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
};

signed main() {
  AStationAndBus solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

const int MAX_D=365;
const int MAX_type=26;
const int BeamWidth=100;

int D;
int c[MAX_D+5];
int s[MAX_D+5][MAX_type+5];

struct State{
    vector<int> contest;
    vector<int> last;
    int day;
    int score;

    State(){
        //cout<<"hoge"<<endl;
        day=0;
        score=0;
        for(int i=0;i<MAX_type+5;++i)last.push_back(0);
        //fill(last.begin(),last.end(),0);
        //cout<<last[0]<<endl;
    }

    void update(int type){
        contest.push_back(type);
        last[type]=day;
        score+=s[day][type];
        for(int i=0;i<MAX_type;++i){
            score-=c[i]*(day-last[i]);
        }
        day++;
    }

    State nextState(State now,int type){
        State next;
        next=now;
        next.update(type);
        return next;
    }
};

bool operator< (const State &state1, const State &state2){
    return state1.score < state2.score;
};

bool operator> (const State &state1, const State &state2){
    return state1.score > state2.score;
};

State beamsearch(){
    int D_=D;
    priority_queue<State, vector<State>, greater<State> > nowpq;
    //priority_queue<State> nowpq;
    for(int type=0;type<MAX_type;++type){
        State s;
        //cout<<s.score<<endl;
        //cout<<s.nextState(s,type).contest[0]<<endl;
        nowpq.push(s.nextState(s,type));
    }
    while(nowpq.size()>BeamWidth)nowpq.pop();
    D_--;
    while(D_--){
        //cout<<D<<endl;
        priority_queue<State, vector<State>, greater<State> > nextpq;
        //priority_queue<State> nextpq;
        while(nowpq.size()){
            State now=nowpq.top();
            nowpq.pop();
            for(int type=0;type<MAX_type;++type){
                nextpq.push(now.nextState(now,type));
            }
        }
        while(nextpq.size()>BeamWidth)nextpq.pop();
        nowpq=nextpq;
    }
    while(nowpq.size()>1)nowpq.pop();
    State ret=nowpq.top();
    return ret;
}

void input(){
    cin>>D;
    for(int i=0;i<MAX_type;++i)cin>>c[i];
    for(int i=0;i<D;++i){
        //cout<<D<<endl;
        for(int j=0;j<MAX_type;++j){
            cin>>s[i][j];
        }
    }
}

signed main(){
    input();
    auto res=beamsearch();
    if(res.contest.size()!=D)cout<<0/0<<endl;
    for(auto u:res.contest){
        cout<<u+1<<endl;
    }
    //cout<<"score is "<<res.score<<endl;
    //for(int i=0;i<MAX_type;++i)cout<<res.last[i]<<endl;
    //int score=0;
}

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

int main() {
  int N, M;
  cin >> N;
  int *T, *P, *X;
  T = new (nothrow) int[N];
  for (int i = 0; i < N; i++) {
    cin >> T[i];
  }

  cin >> M;
  P = new (nothrow) int[M];
  X = new (nothrow) int[M];
  for (int i = 0; i < M; i++) {
    cin >> P[i] >> X[i];
  }

  for (int i = 0; i < M; i++) {
    int total_time = 0;
    int originalT = T[P[i]-1];
    // printf("P[%d]=%d\n", i, P[i]);
    T[P[i]-1] = X[i];
    // printf("T[%d]=%d\n", i, T[i]);
    for (int j = 0; j < N; j++) {
      total_time += T[j];
    }
    T[P[i]-1] = originalT;
    cout << total_time;
    if (i != M-1) {
      cout << endl;
    }
  }

  return 0;
}

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

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

  map<string, int> m;
  rep(i, n) ++m[s[i]];

  int e = 0;
  vector<string> str;
  for (auto itr = m.begin(); itr != m.end(); ++itr) e = max(e, itr->second);
  for (auto itr = m.begin(); itr != m.end(); ++itr) if (itr->second == e) str.push_back(itr->first);
  sort(str.begin(), str.end());
  rep(i, str.size()) cout << str[i] << endl;
  return 0;
}

Measured memory_bytes: 33548
N=int(input())
def dfs(str):
  if int(str)>N:
    return 0
  if all(str.count(base)>0 for base in '753'):
    ans=1
  else:
    ans=0
  for base in '753':
    ans+=dfs(str+base)
  return ans
print(dfs('0'))

Measured memory_bytes: 2940
n=int(input())
def prime(n):
  dic={}
  f=2
  m=n
  while f*f<=m:
    r=0
    while n%f==0:
      n//=f
      r+=1
    if r>0:
      dic[f]=r
    f+=1
  if n!=1:
    dic[n]=1
  return dic

def counter(dic):
  ans=0
  for val in dic.values():
    i=1
    while i*(i+3)/2<val:
      i+=1
    ans+=i
  return ans

print(counter(prime(n)))

Measured memory_bytes: 9188
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    double n,m,d;
    cin>>n>>m>>d;
    double ans;
    if(d==0){
        ans=(m-1)*(2*d/(pow(n,2))+((n-2*d)/(pow(n,2))));
    }else{
        ans=(m-1)*(2*(n-d))/(n*n);
    }
    
    printf("%.10f\n",ans);
}

Measured memory_bytes: 3760
#include<stdio.h>
#define H 2000000
int h;

void maxHeapify(int *A,int i){
	int temp;
	int l,r,largest;
	l = 2*i;
	r = 2*i+1;

	if(l<=h && A[l] > A[i]) largest = l;
	else largest = i;
	if(r<=h && A[r]>A[largest]){ largest = r; }
	if(largest != i){
		temp = A[i];
		A[i] = A[largest];
		A[largest] = temp;
		maxHeapify(A,largest);
	} 
}

void buildMaxHeap(int *A){
	int i;
	for(i=h/2; i>=1; i--){ maxHeapify(A,i); }
}

int main(){
	int heap[H+1];
	int i;

	scanf("%d",&h);
	for(i=1; i<=h; i++){ scanf("%d",&heap[i]); }
	buildMaxHeap(heap);

	for(i=1; i<=h; i++){ printf(" %d",heap[i]); }
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 3816