akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

template<typename T1,typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 & a, T2 b) { if (a < b) a = b; }

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;
const long long kMod = 1000000007;

const long long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

template <class T>
void PrintVector(const vector<T> & v) {
  for (const auto & e: v) {
    cout << e << endl;
  }
}

template <class T>
void PrintVector(const vector<T> & v, int n) {
  rep(i, 0, n - 1) {
    cout << v[i] << endl;
  }
}

struct Food {
  long f0;
  long prod;

  Food(long f0, long prod): f0(f0), prod(prod) {}
};

int main(int argc, char const *argv[]) {
  long n, m, x, y, a, b;
  long ans = 0;
  cin >> n;

  ans = (n % 2 == 0) ? n / 2 - 1 : n / 2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(K: int, S: int):
    answer=0
    for i in range(K+1):
        for j in range(K+1):

            if 0<=S-i-j<=K:
                answer+=1
                    
    print(answer)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(K, S)

if __name__ == '__main__':
    main()


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

#define crap ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define CY cout<<"Yes\n"
#define CN cout<<"No\n"
#define MOD 1000000007
using namespace std;
using ll = long long;
vector<ll> dp(100005,-1);
ll gcd(ll a,ll b)
{
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// ll rec(vector<ll>v,int k,int l,ll ans,int i,int f1,int f2)
// {

//     if(l==k)
//         return ans;
//     if(f1==1)
//     {
//         if(i>=v.size())
//         return INT_MAX;
//     }

//     return min(rec(v,k,l+1,max(ans,v[i]),i+2),rec(v,k,l,ans,i+1));
// }
ll bs(vector<ll>v,ll n)
{
    ll c=0;
    bool s=1;
    while(s)
    {
        s=0;
        c++;
        for(int i=0;i<n-1;i++)
        {
            if(v[i]>v[i+1])
                {swap(v[i],v[i+1]);s=1;}
        }
    }
    return c;
}
void solve()
{
    char c; cin>>c;
    if(c>='a'&&c<='z')
        cout<<'a';
    else cout<<'A';
}
int main() {
    crap;
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    ll t;t=1;
 //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 3864
// Score: /300

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int> Xs(N);
	vector<int> Xss(N);
	for (int i = 0; i < N; ++i) {
		cin >> Xs[i];
		Xss[i] = Xs[i];
	}
	sort(Xss.begin(), Xss.end());
	int B1(Xss[N / 2 - 1]), B2(Xss[N / 2]);
	for (const auto &X : Xs) {
		cout << ((X <= B1) ? B2 : B1) << endl;
	}
}


Measured memory_bytes: 3712
#include<iostream>
#include<vector>
#include<string>
#include<unordered_map>
#define mod 1000000007
#define ll long long
using namespace std;

signed main() {
	string a;
	cin >> a;
	string b="";
	for (char c : a) {
		if (c == 'B') {
			if (b.length()) {
				string d="";
				for (int e = 0; e < b.length() - 1; e++)d += b[e];
				b = d;
			}
		}
		else b += c;
	}
	cout << b << endl;
}

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

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

    vector<ll> a(n, 0);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll cmin = LLONG_MAX;
    for (int bit = 0; bit < (1 << n); bit++)
    {
        if (__builtin_popcount(bit) < k)
        {
            continue;
        }

        vector<int> s(1, 0);
        for (int i = 0; i < n; i++)
        {
            if (bit & (1 << i))
            {
                s.push_back(i);
            }
        }

        vector<ll> b = a;
        ll c = 0;
        for (int is = 1; is < s.size(); is++)
        {
            ll m = LLONG_MIN;
            for (int i = s[is - 1]; i < s[is]; i++)
            {
                m = max(m, b[i]);
            }

            if (m >= b[s[is]])
            {
                c += (m + 1 - b[s[is]]);
                b[s[is]] = m + 1;
            }
        }

        cmin = min(cmin, c);
    }

    cout << cmin << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <string>
#include<cstdio>
#include<vector>
#include<queue>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define D(n,retu) REP(i,n)(cin>>retu[i])
#define MAX 922337203685477580
using namespace std;
typedef long long ll;

int main() {
	ll n,m,a,b,c;
	cin >> a>>b>>c;
	//cin>>m;
	//D(a,n);
	if (a + b <c) {
		cout << "dangerous" << endl;;
	}
	else if (b < c) { cout << "safe" << endl;; }
	else { cout << "delicious" << endl; }
	return 0;
}

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

int main() {
    int N, A[100];

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

    for (int i = 0; i < N; i++) {
      cout << A[N - i - 1];
      if (i != N - 1) cout << " ";
      else cout << "";

    }
    cout << endl;
    return 0;
}



Measured memory_bytes: 3040
x = int(input())
ans = 0
if x >= 400 and x <= 599:
    ans = 8
    print(ans)
if x >= 600 and x <= 799:
    ans = 7
    print(ans)
if x >= 800 and x <= 999:
    ans = 6
    print(ans)
if x >= 1000 and x <= 1199:
    ans = 5
    print(ans)
if x >= 1200 and x <= 1399:
    ans = 4
    print(ans)
if x >= 1400 and x <= 1599:
    ans = 3
    print(ans)
if x >= 1600 and x <= 1799:
    ans = 2
    print(ans)
if x >= 1800 and x <= 1999:
    ans = 1
    print(ans)

Measured memory_bytes: 9216
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(){
    ll n;
    cin >> n;
    vector<P> vp(n);
    ll a;
    for(ll i=0; i<n; i++){
        cin >> a;
        vp[i] = make_pair(a, i+1);
    }
    sort(vp.begin(), vp.end());
    for(ll i=0; i<n; i++){
        cout << vp[i].second;
        if(i == n-1){
            cout << endl;
        }else{
            cout << " ";
        }
    }   
    return 0;
}

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

int n, k;
vector<int> f[21][21];
char s[1 << 20 | 1];

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 0; i <= n; ++i) {
		scanf("%s", s);
		for (int j = 0; j <= i; ++j)
			f[i][j].resize(1 << i);
		for (int j = 0; j < 1 << i; ++j)
			if (s[j] == '1')
				f[i][0][j] = 1;
	}
	for (int i = n; i >= 0; --i) {
		for (int j = 0; j < i; ++j)
			for (int s = 0; s < 1 << i; ++s)
				if (f[i][j][s]) {
					int a = s & (1 << j) - 1, b = s >> j;
					f[j][j][a] += f[i][j][s];
					if (b != (1 << i - j) - 1) {
						int cnt = __builtin_ctz(~b);
						f[i - cnt][j + 1][b >> cnt << j | a] += f[i][j][s];
					}
					if (b) {
						int cnt = __builtin_ctz(b);
						f[i - cnt][j + 1][b >> cnt << j | a] += f[i][j][s];
					}
				}
		for (int s = 0; s < 1 << i; ++s)
			if (f[i][i][s] >= k) {
				for (int j = i - 1; j >= 0; --j)
					putchar("01"[s >> j & 1]);
				puts("");
				return 0;
			}
	}
}


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

use proconio::marker::Chars;

fn pow(mut x: u64, mut y: u64, z: u64) -> u64 {
    let mut r = 1;
    while y > 0 {
        if y & 1 == 1 {
            r = r * x % z;
        }
        x = x * x % z;
        y >>= 1;
    }
    r
}

#[fastout]
fn main() {
    const M: u64 = 1_000_000_007;
    input! {
        k: u64,
        s: Chars,
    }
    let n = s.len() as u64;
    let mut f = vec![1_u64];
    for i in 0_u64..2000000 {
        f.push(f[i as usize] * (i + 1) % M);
    }
    fn c(n: u64, r: u64, f: &Vec<u64>) -> u64 {
        f[n as usize] * pow(f[r as usize], M - 2, M) % M * pow(f[(n - r) as usize], M - 2, M) % M
    }
    fn h(n: u64, r: u64, f: &Vec<u64>) -> u64 {
        c(n + r - 1, r, f)
    }
    let mut t = 0;
    for i in 0..=k {
        t += h(n, i, &f) * pow(25, i, M) % M * pow(26, k - i, M) % M;
        t %= M;
    }
    println!("{}", t);
}


Measured memory_bytes: 22636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <math.h>
#define llong long long
#define pb(a) push_back(a)
#define SORT(strVec) sort(strVec.begin(), strVec.end());
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;

int main(){
  int N,K;
  cin>>N>>K;
  llong KK =pow(K-1,N-1);
  long long ans =K*KK;
  cout<<ans<<endl;
}

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

using namespace std;
using ll = long long;
const int F = 26;
const int def = 1e6;


int n;
vector<int> c(F);
vector<vector<int>> a;


void init() {
    cin >> n;
    a.resize(n, vector<int>(F));
    for(int i = 0; i < F; i++)cin >> c[i];
    for(int i = 0; i < n; i++)for(int j = 0; j < F; j++)cin >> a[i][j];
}


vector<int> calc(int rng) {
    vector<int> last(F, -1);
    vector<int> ans;
    for(int i = 0; i < n; i++){ 
        vector<int> cur = a[i];
        for(int j = 0; j < F; j++)cur[j] += (i - last[j] + rng) * c[j];
        int ind =  max_element(cur.begin(), cur.end()) - cur.begin();
        last[ind] = i;
        ans.emplace_back(ind);
    }
    return ans;
}

int chack(vector<int> p) {
    int sum = 0;
    vector<int> last(F, -1);
    for(int i = 0; i < n; i++) {
        sum += a[i][p[i]];
        last[p[i]] = i;
        for(int j = 0; j < F; j++)sum -= (i - last[j]) * c[j];
    }
    return sum;
}


int main()
{
    init();


    vector<int> ans;
    int M = 3 * 1e4, nax = -1e9;
    for(int I = 1; I <= M; I++) {
        int sed = rand() % M * ((rand() % 2)? 1 : -1);
        vector<int> cur = calc(sed);
        int k = chack(cur);
        if(k > nax) {
            nax = k;
            ans = cur;
        }
    }

    for(auto i : ans)cout << i + 1 << endl;
}

/*
satisfaction: 424801
score: 1424801
*/

Measured memory_bytes: 3696
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

int main(){
  ll i,j,N,x,ans=0,maxN=100;
  cin>>N;
  vec v(maxN,0),p(maxN,1);
  rep(i,N){
    cin>>x;
    j=0;
    while(x){
      v[j]+=x%2;
      x/=2;
      j++;
    }
  }
  rep1(i,maxN){
    p[i]=p[i-1]*2%mod;
  }
  rep(i,maxN){
    ans=(ans+v[i]*(N-v[i])%mod*p[i]%mod)%mod;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long n,a,b,num = 0;
    scanf("%lld %lld %lld",&n,&a,&b);
    if(n == 1)
    {
        if(a == b)
            num = 1;
        else
            num = 0;
    }
    else
    {
        if(a == b)
            num = 1;
        else
            num = (n - 2) * (b - a) + 1;
    }
    if(a > b)
        num = 0;
    printf("%lld\n",num);
    return 0;
}


Measured memory_bytes: 128
#[allow(dead_code)]
fn scan<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn scan_split<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_split_with<T: std::str::FromStr>(ch: char) -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split(ch)
        .map(|t| t.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn scan_lines<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| scan::<T>()).collect()
}

#[allow(unused_macros)]
macro_rules! scan_as_tuple {
    ( $t:ty ) => {
        (scan::<$t>(),)
    };
    ( $( $t:ty ),* ) => {
        {
            let mut s = String::new();
            std::io::stdin().read_line(&mut s).ok();
            let v = s.trim().split_whitespace();
            let mut it = v;
            let ret = ( $(it.next().unwrap().parse::<$t>().ok().unwrap()),* );
            assert!(it.next() == None, "not all tokens consumed");
            ret
        }
    };
}

fn main() {
    let n = scan::<i32>();
    println!("{}", n*800-n/15*200);
}

Measured memory_bytes: 4352
W=["dream", "dreamer", "erase", "eraser"]
word=input()
while True:
    if word=="":
        print("YES")
        exit()

    ok = False
    for w in W:
        if word[-len(w):] == w:
            word = word[:-len(w)]
            ok = True
            break

    if not ok:
        print("NO")
        exit()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

ll n,k;
ll a[101];
ll dp[100005];

ll f(ll x){
	ll &r=dp[x];
	if(r>=0)return r;
	if(x==0){
		r=0; return r;
	}
	r=0;
	fore(i,0,n){
		if(x-a[i]>=0&&f(x-a[i])==0){
			r=1; return r;
		}
	}
	return r;
}

int main(){FIN;
	cin>>n>>k;
	fore(i,0,n)cin>>a[i];
	mset(dp,-1);
	if(f(k))cout<<"First";
	else cout<<"Second";
	return 0;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (1000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> s[m];
  rep(i,m){
    int k;
    cin >> k;
    rep(j,k){
      int ss=0;
      cin >> ss;
      ss--;
      s[i].push_back(ss);
    }
  }
  int p[11];
  rep(i,m){
    cin >> p[i];
  }

  int ans = 0;
  rep(bit,1<<n){
    int ok = 0;
    rep(i,m){
      int cnt = 0;
      rep(j,s[i].size()){
        if(bit & (1<<s[i][j])){
          cnt++;
        }
      }
      if(cnt%2==p[i]){
        ok++;
      }
    }

    if(ok == m){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main(){
	int k;
	cin >> k;
	int a, b;
	cin >> a >> b;
	rep2(i,a,b+1){
		if(i%k==0){
			cout << "OK" << endl;
			return 0;
		}
	}
	cout << "NG" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for (int i = (a); i <= (b); ++i)
#define REPD(i,a,b) for (int i = (a); i >= (b); --i)
#define FORI(i,n) REP(i,1,n)
#define FOR(i,n) REP(i,0,int(n)-1)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define SZ(x) int((x).size())
#define DBG(v) cerr << #v << " = " << (v) << endl;
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define fi first
#define se second

int main() {
	int a,b,c;
	scanf("%d%d%d", &a, &b, &c);
	if (a%2==0 || b%2==0 || c%2==0) {
		printf("0\n");
		return 0;
	}
	if (a>b) swap(a,b);
	if (a>c) swap(a,c);
	if (b>c) swap(b,c);
	printf("%lld\n", 1LL*a*b);
	return 0;
}


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

int main() {
    ll n;
    cin >> n;
    if(floor(sqrt(n)) * float(sqrt(n)) == n) { //nが平方数の場合
        cout << (ll)(sqrt(n) * 2 - 2) << endl;
        return 0;
    }
    for(int i = floor(sqrt(n)); i >= 1; i--) { //nが平方数でないときはしらみつぶし(10^6程度で終わるはず)
        if(i * (n / i) == n) {
            cout << (ll)((i - 1) + ((n / i) - 1)) << endl;
            return 0;
        }
        continue;
    }
}


Measured memory_bytes: 3740
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)

template<class I, class BiOp = I (*) (I, I)>
class SegTree {
private:
  int n;
  std::vector<I> dat;
  BiOp op;
  I e;

public:
  SegTree(int n_, BiOp op, I e) : op(op), e(e) {
    n = 1;
    while (n < n_) n *= 2;
    dat.resize(2 * n - 1, e);
  }

  void update(int k, I v) {
    k += n - 1;
    dat[k] += v;
    while (k > 0) {
      k = (k - 1) / 2;
      dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]);
    }
  }

  // return op[a..b)
  // k: node id, [l, r): node interval
  I query(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r == -1) r = n;
    if (r <= a || b <= l) return e;
    if (a <= l && r <= b) return dat[k];
    I vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
    I vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
    return op(vl, vr);
  }

  void print() {
    int j = 2;
    for (int i = 0; i < 2 * n - 1; i++) {
      cout << dat[i];
      if (i == j - 2) {
        cout << endl;
        j *= 2;
      }
      else {
        cout << " ";
      }
    }
  }
};

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

  int n, q;
  cin >> n >> q;
  SegTree<int> seg(n, [](int a, int b){ return a + b; }, 0);

  rep(i, q) {
    int t, x, y;
    cin >> t >> x >> y;
    x--;
    if (t == 0) {
      seg.update(x, y);
    }
    else {
      cout << seg.query(x, y) << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n,j) for (int i = n; j<=i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;
typedef pair<ll,ll> P;

ll gcd(ll a, ll b){
  if (a%b == 0){
    return(b);
   }
  else{
    return(gcd(b, a%b));
  }
}

int main(){
  ll N,ans;cin>>N;
  vector<ll> vec(N),L(N),R(N);
  REP(i,0,N){cin>>vec[i];}
  L[0]=vec[0];R[N-1]=vec[N-1];
  REP(i,0,N-1){L[i+1]=gcd(L[i],vec[i+1]);}
  RREP(i,N-1,1){R[i-1]=gcd(R[i],vec[i-1]);}
  ans=max(R[1],L[N-2]);
  REP(i,1,N-1){ans=max(ans,gcd(L[i-1],R[i+1]));}
  print(ans)
}


Measured memory_bytes: 2560
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(V) sort((V).begin(),(V).end())
#define pb push_back
#define endl '\n'
#define int long long

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// 変数定義
int n,sum=0;
//

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i,1,n) {
    sum += i;
  }
  cout << sum << endl;
}

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

bool ok(vector<int> p,vector<int> q){
  bool res = true;
  rep(i,23){
    if(p.at(i) + q.at(i) == 2){
      res = false;
      break;
    }
  }
  return res;
}
 
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  vector<vector<int>> b(n,vector<int>(23,0));
  rep(i,n){
    rep(j,23){
      if(a.at(i) >> j & 1) b.at(i).at(j) = 1;
    }
  } 
  
  ll ans = 0;
  int j = -1;
  vector<int> now(23,0);
  rep(i,n){
    while(j < n-1){
      if(ok(now,b.at(j+1))){
        rep(k,23){
          if(b.at(j+1).at(k) == 1) now.at(k) = 1;
        }
        j ++;
      }else{
        break;
      }
    }
    ans += j-i+1;
    rep(k,23){
      if(b.at(i).at(k) == 1) now.at(k) = 0;
    }    
  }
  cout << ans << endl;    

  return 0;
}



Measured memory_bytes: 27648
#include<stdio.h>
#include<stdlib.h>
  
int main(void)
{
  int i=0;
  int stack[100];
  char s[100];
   
  while(scanf("%s", s) != EOF){
    if(s[0] == '+'){
      stack[i-2] += stack[i-1];
      i--;
    }
    else if(s[0] == '-'){
      stack[i-2] -= stack[i-1];
      i--;
    }
    else if(s[0] == '*'){
      stack[i-2] *= stack[i-1];
      i--;
    }
    else{
      stack[i++] = atoi(s);
    }
  }
 
  printf("%d\n", stack[0]);
  return 0;
}

Measured memory_bytes: 548
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位

int main(void){
    ll n;
    cin >> n;
    ll a[n];
    bool ok = true;
    ll MAX = 0;
    for(ll i = 0; i < n; i++){
        cin >> a[i];
        if(i!=0 && a[i]-a[i-1]>=2)
            ok = false;
        MAX = max(MAX, a[i]);
    }
    if(a[0]!=0) ok = false;
    if(ok==false)
        cout << -1 << endl;
    else if(ok==true){
        ll ans = 0;
        for(ll i = 1; i < n; i++){
            if(a[i]>a[i-1]) ans++;
            else if(a[i]==a[i-1]) ans+=a[i];
            else if(a[i]!=0) ans+= a[i];
           // cout << i << " " << ans << endl;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("1 10 100");
            //Yes
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("4");
            WillReturn.Add("1 2 3 4");
            //No
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("3");
            WillReturn.Add("1 4 1");
            //Yes
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("2");
            WillReturn.Add("1 1");
            //No
        }
        else if (InputPattern == "Input5") {
            WillReturn.Add("6");
            WillReturn.Add("2 7 1 8 2 8");
            //Yes
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        int Cnt0 = 0; //2を因数に持たない数のカウント
        int Cnt2 = 0; //2を因数に持つ数のカウント
        int Cnt4 = 0; //4を因数に持つ数のカウント

        foreach (int EachInt in AArr) {
            if (EachInt % 4 == 0) Cnt4++;
            else if (EachInt % 2 == 0) Cnt2++;
            else Cnt0++;
        }

        int PrevInsuu = 0;
        bool IsOK = true;
        for (int I = 0; I <= AArr.GetUpperBound(0); I++) {
            if (I == 0) { //1個目の値
                if (Cnt0 > 0) { Cnt0--; PrevInsuu = 0; }
                else if (Cnt2 > 0) { Cnt2--; PrevInsuu = 2; }
                else { Cnt4--; PrevInsuu = 4; }
            }
            else { //2個目以降の値
                if (PrevInsuu == 0) {
                    if (Cnt4 > 0) { Cnt4--; PrevInsuu = 4; }
                    else { IsOK = false; break; }
                }
                else if (PrevInsuu == 2) {
                    if (Cnt2 > 0) { Cnt2--; PrevInsuu = 2; }
                    else if (Cnt4 > 0) { Cnt4--; PrevInsuu = 4; }
                    else { IsOK = false; break; }
                }
                else if (PrevInsuu == 4) {
                    if (Cnt0 > 0) { Cnt0--; PrevInsuu = 0; }
                    else if (Cnt2 > 0) { Cnt2--; PrevInsuu = 2; }
                    else if (Cnt4 > 0) { Cnt4--; PrevInsuu = 4; }
                    else { IsOK = false; break; }
                }
            }
        }
        Console.WriteLine(IsOK ? "Yes" : "No");
    }
}


Measured memory_bytes: 21728
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        public static void Main(string[] args) {

            int k = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            Console.WriteLine((s.Length > k) ? s.Substring(0, k) + "..." : s);
        }
    }
}

Measured memory_bytes: 27336
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int a,b,c,d;
  a=N/1000;
  b=(N/100)%10;
  c=(N/10)%10;
  d=N%10;
  if ((a==b&&b==c) || (b==c&&c==d)){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}



Measured memory_bytes: 256
local n = io.read("*n")
local red, blue = {}, {}
for i = 1, n do
  red[i] = {}
  red[i].x, red[i].y = io.read("*n", "*n")
end
for i = 1, n do
  blue[i] = {}
  blue[i].x, blue[i].y = io.read("*n", "*n")
  blue[i].used = false
end
table.sort(red, function(s, t) return s.x > t.x end)
table.sort(blue, function(s, t) return s.y < t.y end)

local cnt = 0
for i = 1, n do
  local rx, ry = red[i].x, red[i].y
  for j = 1, n do
    if rx < blue[j].x and ry < blue[j].y and not blue[j].used then
      cnt = cnt + 1
      blue[j].used = true
      break
    end
  end
end
print(cnt)


Measured memory_bytes: 760
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<min(a,b)+min(c,d)<<NL;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout) 
using namespace std;

int n;

int main(){
	//IO("input.txt", "output.txt");
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	cout << (n * (1 + n)) / 2 << "\n";
 	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;

int main(){
    int N,K;
    cin >> N >> K;
    LL a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    LL sum=0;
    LL cum[N];
    for(int i=0;i<N;i++){
        sum+=max(a[i],0LL);
        cum[i]=sum;
    }
    sum=0;
    for(int i=0;i<K;i++){
        sum+=a[i];
    }
    LL ans=max(0LL,sum)+cum[N-1]-cum[K];
    for(int i=1;i<N-K+1;i++){
        sum=sum+a[i+K-1]-a[i-1];
        ans=max(ans,max(0LL,sum)+cum[i-1]+cum[N-1]-cum[i+K-1]);
    }
    if(N==1||N==K) ans=max(sum,0LL);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>
#include <math.h>
int main() {
    int d, r, a, b;
    double f;
    scanf("%d %d", &a, &b);
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    printf("%d %d %f", d, r, f);
    printf("\n");
    return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

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

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

void Main() {
	int H, W, A, B; cin >> H >> W >> A >> B;
	
	vvint ans(H, vint(W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cout << ((i < B) ^ (j < A));
		}
		cout << el;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


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

using namespace std;

#define TRACE(x) x
#define WATCH(x) TRACE( cout << #x" = " << x << endl)
#define PRINT(x) TRACE(printf(x))
#define WATCHR(a, b) TRACE( for(auto c = a; c != b;) cout << *(c++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end()); } )

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int) (v).size()
#define rep(i,a,b) for(int (i) = (a); (i) < (b); ++(i))
#define pb push_back
#define mp make_pair

using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

constexpr int inf = 0x3f3f3f3f;
constexpr ll MOD = 1000000007LL;
constexpr double tol = 1e-8;

void buff() { ios::sync_with_stdio( false ); cin.tie(nullptr); }
constexpr int ms = 1e5 + 13;

vector< int > g[ms];
long long dp[ms][2];

void solve( int root, int parent )
{
    for(int i = 0; i < 2; ++i) dp[root][i] = 1LL;
    
    for( const int& x : g[ root ] )
    {
        if( x != parent )
        {
            solve(x, root);
            dp[root][0] = ( dp[root][0] * ( ( dp[x][0] + dp[x][1] ) % MOD ) ) % MOD;
            dp[root][1] = ( dp[root][1] * dp[x][0] ) % MOD;
        }
    }
}


int main() 
{
    buff();
    int n;
    cin >> 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 );
    }
    solve(0, -1);

    cout << ( dp[0][0] + dp[0][1] ) % MOD << '\n';

    return 0;
}



Measured memory_bytes: 12800
import numpy as np
from collections import Counter as C

n=int(input())
a = list(input().split())
a = [int(i) for i in a]
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]
bc=np.array(bc).T
b=bc[0]
c=bc[1]

d=C(a)
d2={}
for k,v in d.items():
  d2[k]=k*v

#print(d)
ans=sum(a)
for i in range(q):
  d[c[i]]+=d[b[i]]
  ans+=(c[i]-b[i])*d[b[i]]
  d[b[i]]=0
  print(ans)


Measured memory_bytes: 50900
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

set<string> dic;
vector<pair<pair<string,string>, int>> G;

int main(){
  int N;
  string s[SIZE];

  cin >> N;

  for (int i=0; i<N; i++) {
    cin >> s[i];

    dic.insert(s[i]);
  }

  for (int i=0; i<N; i++) {
    int M = s[i].size();
    for (int m=1; m<M; m++) {
      string a = s[i].substr(0, m);
      string b = s[i].substr(m, M-m);
      G.push_back({{a, b}, b.size()});
    }

    for (int l=0; l<M; l++) {
      for (int m=l+1; m<M; m++) {
        string a = s[i].substr(l, m-l);
        string b = s[i].substr(m, M-m);
        string c = s[i].substr(l, M-l);
        if (dic.find(a) != dic.end())
          G.push_back({{c, b}, 0});
      }
    }
  }

  sort(G.begin(), G.end());

  debug(G);

  priority_queue<pair<int, string>> pq;

  for (int i=0; i<N; i++) {
    for (int j=0; j<N; j++) {
      if (s[i].size() <= s[j].size()) continue;
      int Mi = s[i].size();
      int Mj = s[j].size();

      if (s[i].substr(0, Mj) == s[j]) {
        pq.push({-Mi, s[i].substr(Mj, Mi-Mj)});
      }
    }
  }

  set<string> visited;

  while (pq.size()) {
    auto p = pq.top();
    pq.pop();

    if (visited.find(p.second) != visited.end()) {
      continue;
    }

    visited.insert(p.second);

    if (dic.find(p.second) != dic.end()) {
      printf("%d\n", -p.first);
      return 0;
    }

    pair<pair<string,string>,int> key = {{p.second, ""}, 0};
    auto it = lower_bound(G.begin(), G.end(), key);

    while(it != G.end() && it->first.first == p.second) {
      pq.push({p.first - it->second, it->first.second});
      it++;
    }
  }

  puts("0");

  return 0;
}



Measured memory_bytes: 6432
#include<stdio.h>
int main(void){
    int a,b,c,p;
    while(1){
        scanf("%d%d%d",&a,&b,&c);
        if (a==-1&&b==-1&&c==-1){break;}
        p=a+b;
        if(a==-1&&b>=0){printf("F\n");}
        else if(b==-1&&a>=0){printf("F\n");}
        else if(p>=80){printf("A\n");}
        else if(p>=65&&p<85){printf("B\n");}
        else if(p>=50&&p<65){printf("C\n");}
        else if(p>=30&&p<50&&c<50){printf("D\n");}
        else if(p>=30&&p<50&&c>=50){printf("C\n");}
        else if(p<30){printf("F\n");}
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

int main(){
  
  ll n,k;
  cin >> n >> k;
  ll x = n/k;
  if(k%2 == 1){
    cout << x*x*x << endl;
    return 0;
  }
  ll y = n / (k/2);
  ll even = y/2;
  ll odd = y - even;
  cout << even*even*even + odd*odd*odd << endl;
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n, k, l;
int main(){
    cin >> k >> n;
    vector <int> v(n);
    for(int i = 0; i < n; i ++) 
        cin >> v[i];
    v.push_back(v[0] + k);
    for(int i = 0; i < n; i ++)
        l = max(l, v[i + 1] - v[i]);
    cout << k - l; 
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;


int main(){
    ll N; cin >> N;
    unordered_map<ll, bool> M, taboo;

    vector<ll> V(N);
    for(int i = 0; i < N; i++) {
        cin >> V[i];
        if(!M[V[i]])M[V[i]] = true;
        else taboo[V[i]] = true;
    }
    ll cnt = 0;
    for(int i = 0; i < N; i++){
        ll x = V[i];
        if(taboo[x]) continue;
        bool flag = true;
        for(int j = 1; j * j <= x; j++){
            if(x % j == 0){
                int k = x/j;
                //cout << x << " " << j << " " << k << endl;

                if((j != x && M[j] == true) || (k != x && M[k] == true)) {
                    flag = false;
                    break;
                }
            }
        }
        if(flag) cnt++;
    }
    cout << cnt << endl;

}


Measured memory_bytes: 40704
#include<stdio.h>
int main(){
  int n,p,min=200001,ans=0;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%d",&p);
    if(min>p){
      min=p;
      ans++;
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
N = int(input())
a = list(map(int, input().split()))

color = []
rainbow = 0

for i in range(N):
    if 1 <= a[i] <= 399:
        color.append('gray')
    elif 400 <= a[i] <= 799:
        color.append('brown')
    elif 800 <= a[i] <= 1199:
        color.append('green')
    elif 1200 <= a[i] <= 1599:
        color.append('sky')
    elif 1600 <= a[i] <= 1999:
        color.append('blue')
    elif 2000 <= a[i] <= 2399:
        color.append('yellow')
    elif 2400 <= a[i] <= 2799:
        color.append('orange')
    elif 2800 <= a[i] <= 3199:
        color.append('red')
    else:
        rainbow += 1
        color.append('all')

if len(set(color)) == 1 and rainbow > 0:
    mini = 1
elif rainbow == 0:
    mini = len(set(color))
else:
    mini = max(1, len(set(color))-1)

if rainbow > 1:
    maxi = len(set(color)) + rainbow - 1
else:
    maxi = len(set(color))

print(mini, maxi)

Measured memory_bytes: 9296
package main

import (
	"fmt"
	"math"
)

// mathパッケージのmaxはfloat型しかないためintように書き捨ての関数を作っておく
func max(lhs, rhs int64) int64 {
	return int64(math.Max(float64(lhs), float64(rhs)))
}

func main() {
	var (
		N, M int
	)
	fmt.Scanf("%d %d", &N, &M)
	values, weights := make([]int64, N), make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d %d", &values[i], &weights[i])
	}
	dp := make([][]int64, N+1)
	for i := 0; i < N+1; i++ {
		dp[i] = make([]int64, M+1)
	}
	for i := 1; i <= N; i++ {
		for j := 0; j <= M; j++ {
			dp[i][j] = dp[i-1][j]
			if j >= weights[i-1] && dp[i][j] < dp[i-1][j-weights[i-1]]+values[i-1] {
				dp[i][j] = dp[i-1][j-weights[i-1]] + values[i-1]
			}
		}
	}
	fmt.Println(dp[N][M])
}



Measured memory_bytes: 9668
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626
#define mod llint(1e9+7)

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(llint a, llint b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗をmodで割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, (llint)b / 2);
	tmp *= tmp;
	tmp %= mod;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= mod;
	}
	return tmp;
}

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

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

int main()
{
    int n,a;
    int i,j,k;
    cin >> n >> a;
    vector<int> x(n);
    for(i = 0;i < n;++i){
        cin >> x.at(i);
    }
    vector<vector<vector<long long>>> dp(n+1,vector<vector<long long>>(n+1,vector<long long>(n*a+1,0)));
    for(i = 0;i <= n;++i){
        for(j = 0;j <= n;++j){
            for(k = 0;k <= n*a;++k){
                if(i == 0 && j == 0 && k == 0){
                    dp.at(i).at(j).at(k) = 1;
                }else if(i >= 1 && k < x.at(i-1)){
                    dp.at(i).at(j).at(k) = dp.at(i-1).at(j).at(k);
                }else if(i >= 1 && j >= 1 && k >= x.at(i-1)){
                    dp.at(i).at(j).at(k) = dp.at(i-1).at(j).at(k) + dp.at(i-1).at(j-1).at(k-x.at(i-1));
                }else{
                    dp.at(i).at(j).at(k) = 0;
                }
            }
        }
    }
    long long ans = 0;
    for(i = 1;i <= n;++i){
        ans += dp.at(n).at(i).at(i*a);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 52224
#include <iostream>
#include <string>



int main(void){
	int num;
	std::cin >> num;

	std::string event;
	int out = 0, runner = 0, point = 0;
	for(int i = 0; i < num; ++i){
		while(out < 3){
			std:: cin >> event;

			if(event == "OUT"){
				++out;		
			}else if(event == "HIT"){
				if(runner == 3){
					++point;
				}else{
					++runner;
				}
			}else if(event == "HOMERUN"){
				point += runner + 1;
				runner = 0;
			}
		}
		std::cout << point << std::endl;
		out = 0, runner = 0, point = 0;
	}

	return 0;
}

Measured memory_bytes: 1208
n, k = map(int, input().split())
p_n = [int(i) for i in input().split()]

def expected(x):
    return (x+1)/2

def test3():
    e_n = list(map(expected, p_n))
    s_n = []
    for i, e in enumerate(e_n):
        if i == 0:
            s_n.append(e)
            continue
        s_n.append(s_n[i-1] + e)
    result = []
    result.append(s_n[k-1])
    for i in range(len(s_n)):
        if i+k >= n:
            continue
        result.append(s_n[i+k]-s_n[i])
    print(max(result))      
test3()

Measured memory_bytes: 28804