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

int main(void) {
    int n;
    string s;
    cin >> n >> s;
    int cnt,maxcnt = 0;

    map<int,int> mpb,mpa;
    for(int i=1;i<s.size()-1;i++) {
        mpb.clear();
        mpa.clear();
        for(int j=0;j<i;j++) {
            mpb[s[j]]++;
        }
        for(int k=i;k<s.size();k++) {
            mpa[s[k]]++;
        }

        cnt = 0;
        for(auto b:mpb) {
            for(auto a:mpa) {
                if(b.first == a.first) {
                    cnt++;
                    break;
                }
            }
        }

        if(maxcnt < cnt) {
            maxcnt = cnt;
        }
    }

    cout << maxcnt << endl;
    return 0;
}


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

int div_num(int n){
    int i,counter=0;
    for(i=1;i<=n;i++){
        if(n%i==0){
            counter++;
        }
    }
    return counter;
}

int main(void){
    int counter=0;
    int i,N;
    scanf("%d",&N);
    for(i=1;i<=N;i++){
        if(div_num(i)==8 && i%2 == 1){
            counter++;
        }
    }
    printf("%d\n",counter);
    return 0;
}

Measured memory_bytes: 128
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

my ($a, $b, $c, $d) = split / /, <STDIN>;
my $gcd = sub {
  my ($x, $y) = @_;
  
  while ($x>0 && $y>0) {
    if ($y > $x) {
      $y %= $x;
    } else {
      $x %= $y;
    }
  }
  return $x if $x>0;
  return $y if $y>0;
};
my $ans = $b - $a + 1;
my $e = 0;
if ($a<=$c) {
  $e = $c;
} else {
  $e = int ($a/$c) * $c;
  $e += $c if $e < $a;
}
$e = ($b - $b%$c - $e) / $c + 1;
$ans -= $e;
if ($a<=$d) {
  $e = $d;
} else {
  $e = int ($a/$d) * $d;
  $e += $d if $e < $a;
}
$e = ($b - $b%$d - $e) / $d + 1;
$ans -= $e;
my $f = $c * $d / $gcd->($c, $d);
if ($a<=$f) {
  $e = $f;
} else {
  $e = int ($a/$f) * $f;
  $e += $f if $e < $a;
}
$e = ($b - $b%$f - $e) / $f + 1;
$ans += $e;

say $ans;

Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();

		int n = s.length();
		for (int i = 0; i < n; i++) {
			System.out.print("x");
		}
		System.out.println();
	}
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    if(n==1){
        cout<<0<<endl;
        return 0;
    }
    int soinsu[n+1]={};
    for(int i=1;i<=n;i++){
        int I=i;
        for(int j=2;j<=sqrt(I);j++){
            while(I%j==0){
                soinsu[j]++;
                I/=j;
            }
        }
        if(I>1)soinsu[I]++;
    }
    vector<int>prm;
    for(int i=1;i<=n;i++)if(soinsu[i])prm.push_back(soinsu[i]+1);
    int x=0;
    for(int i=0;prm[i]>=75;i++)x++;
    for(int i=0;prm[i]>=15;i++){
        for(int j=0;prm[j]>=5;j++)if(i!=j)x++;
    }
    for(int i=0;prm[i]>=25;i++){
        for(int j=0;prm[j]>=3;j++)if(i!=j)x++;
    }
    for(int i=0;prm[i]>=5;i++){
        for(int j=i+1;prm[j]>=5;j++){
            for(int k=0;prm[k]>=3;k++)if(i!=j && j!=k && k!=i)x++;
        }
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
use std::cmp::*;

fn main() {
    loop {
        let v = read_vec::<i64>();
        let (n, w, d) = (v[0] as usize, v[1], v[2]);
        if n == 0 && w == 0 && d == 0 {
            return;
        }
        let mut cuts = vec![];
        for _ in 0..n {
            let v = read_vec::<i64>();
            let (p, s) = (v[0] as usize - 1, v[1]);
            cuts.push((p, s));
        }
        let mut cakes = vec![(w, d)];
        for (p, mut s) in cuts {
            let (wi, di) = cakes[p];
            s %= wi + di;
            cakes.remove(p);

            let cake_small;
            let cake_large;
            if s < wi {
                cake_small = (min(wi - s, s), di);
                cake_large = (max(wi - s, s), di);
            } else {
                cake_small = (wi, min(di + wi - s, s - wi));
                cake_large = (wi, max(di + wi - s, s - wi));
            }
            cakes.push(cake_small);
            cakes.push(cake_large);
        }
        cakes.sort_by_key(|&(w, d)| w * d);
        for (i, &(w, d)) in cakes.iter().enumerate() {
            if i == cakes.len() - 1 {
                println!("{}", w * d);
                break;
            }
            print!("{} ", w * d);
        }
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}



Measured memory_bytes: 5048
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<string>
using namespace std;

using ll = long long;

int main() {

	const int N = 10004;
	ll a[N], b[N];

	int n;
	cin >> n;

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

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

	ll sumA = 0LL, sumB = 0LL;

	for (int i = 0; i < n; i++) {
		if (a[i] - b[i] >= 0) {
			sumB += a[i] - b[i];
		}
		else {
			ll sum = b[i] - a[i];
			if (sum % 2) {
				sumA += sum + 1LL;
				sumB += 1LL;
			}
			else
				sumA += sum;
		}
	}

	if (sumA / 2LL < sumB)
		cout << "No";
	else
		cout << "Yes";

	return 0;
}

Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL T;
vector<LL> A, B, Z;
int idx[200011];

LL dp[100];

void MAIN() {
    scanf("%d%lld", &N, &T);
    REP (i, N) {
	LL a, b;
	scanf("%lld%lld", &a, &b);
	if (a == 0) {
	    Z.push_back(b);
	} else {
	    A.push_back(a);
	    B.push_back(b);
	}
    }

    int len = A.size();

    REP (i, len) idx[i] = i;
    sort(idx, idx+len, [&](int i, int j) {
	    return A[j]*(B[i]+1) < A[i]*(B[j]+1);
	    });

    memset(dp, 0x3f, sizeof dp);
    dp[0] = 0;
    REP (i_, len) {
	int i = idx[i_];
	LL a = A[i], b = B[i];
	for (int k=100; k--;) if (dp[k] <= T) {
	    LL g = dp[k]+1 + a*(dp[k]+1) + b;
	    if (g <= T) amin(dp[k+1], g);
	}
    }

    sort(Z.begin(), Z.end());
    int ans = 0;
    REP (k, 100) if (dp[k] <= T) {
	int cnt = k;
	LL t = dp[k];
	REP (i, Z.size()) {
	    LL g = t+1 + Z[i];
	    if (g <= T) { cnt++; t = g; }
	    else break;
	}
	amax(ans, cnt);
    }
    printf("%d\n", ans);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

int n,x[200005],y[200005];
vector<int> pp,pn,np,nn;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        pp.emplace_back(x[i]+y[i]);
        pn.emplace_back(x[i]-y[i]);
        np.emplace_back(-x[i]+y[i]);
        nn.emplace_back(-x[i]-y[i]);
    }
    sort(pp.begin(),pp.end());
    sort(pn.begin(),pn.end());
    sort(np.begin(),np.end());
    sort(nn.begin(),nn.end());
    cout<<max(max(pp.back()-pp.front(),pn.back()-pn.front()),max(np.back()-np.front(),nn.back()-nn.front()))<<endl;

    return 0;
}

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

int n,x;
set<int> t;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>x>>n;
    while(n--){
        int a;
        cin>>a;
        t.insert(a);
    }
    for(int i=0;;i++){
        if(t.find(x-i)==t.end()){
            cout<<x-i<<endl;
            return 0;
        }
        if(t.find(x+i)==t.end()){
            cout<<x+i<<endl;
            return 0;
        }
    }

    return 0;
}

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

int main(){
    long long N, ans=0;
    cin >> N;
    vector<string> s(N);
    vector<long long> flagment(N, 0);
	
    for(int i=0; i<N; i++){
	cin >> s[i];	
	sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());
    
    for(int i=0; i<N-1; i++){
	if(s[i] == s[i+1]){
	    flagment[i+1] += flagment[i] + 1;
	}
	ans += flagment[i+1];
    }
	
    
    
    cout << ans << endl;
}




Measured memory_bytes: 8064
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
int n;
struct par{
	char f;
	int s;
};

par a[100001];
par b[100001];
void merge(int left, int mid, int right){
	int i;
	int j;
	int k;
	int n1=mid-left;
	int n2=right-mid;
	par L[50002];
	par R[50002];
	rep(i, n1) L[i]=a[left+i];
	rep(i, n2) R[i] = a[mid+i];
	L[n1].s = 2e9;
	R[n2].s = 2e9;
	for(i=0, j=0, k=left;k<right;k++){
		if(L[i].s<=R[j].s){
			a[k] = L[i];
			i++;
		}else{
			a[k] = R[j];
			j++;
		}
	}
}
void mergesort(int left, int right){
	if(left+1<right){
		int mid = (left+right)/2;
		mergesort(left, mid);//bunkatsu(recursion)
		mergesort(mid, right);
		merge(left, mid, right);
	}
}
int partition(int p, int r){
	int i = p-1;
	int j;
	for(j=p;j<r;j++){
		if(b[j].s<=b[r].s){
			i++;
			swap(b[i], b[j]);
		}
	}
	swap(b[i+1], b[r]);
	return i+1;
}
void quicksort(int p, int r){
	if(p<r){
		int q = partition(p, r);
		quicksort(p, q-1);
		quicksort(q+1, r);
	}
}
int main(){
	int i;
	cin >> n;
	bool stable = true;
	rep(i, n){
		cin >> a[i].f >> a[i].s;
		b[i] = a[i];
	}
	mergesort(0, n);
	quicksort(0, n-1);
	rep(i, n){
		if(a[i].f!=b[i].f){
			stable = false;
			break;

		}
	}

	if(stable)printf("Stable\n");
	else printf("Not stable\n");
	rep(i, n) printf("%c %d\n", b[i].f, b[i].s);
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D)
    cout << "Left" << endl;
  else if (A + B == C + D)
    cout << "Balanced" << endl;
  else
    cout << "Right" << endl;
}

Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int T = sc.nextInt();
		int A = sc.nextInt();
		double min = 10000;
		int ans = 0;
		
		for(int i = 0; i < N; i++){
			double m = Math.abs((T - sc.nextInt() * 0.006) - A);
			if(m < min){
				min = m;
				ans = i + 1;
			}
		}
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 23892
#include <stdio.h>

#define NOT_FOUND -1
#define MAX 10001

int n, q;
int A[MAX];

/* ??????????????¢??¢?´¢ */
int linearSearch(int key) {
  int i;
  for (i = 0; i < n; i++) {
    if (A[i] == key)
      return i;
  }
  return NOT_FOUND;
}

/* ???????????¨???????????¢??¢?´¢??§,??????????????°????????????????????? */
int linearSearch_b(int key) {
  int i = 0;
  A[n] = key;
  while (A[i] != key)
    i++;
  if (i == n)
    return NOT_FOUND;
  else
    return i;
}

int main() {
  scanf("%d", &n);
  int j;
  for (j = 0; j < n; j++) {
    scanf("%d", A + j);
  }
  scanf("%d", &q);
  int key, count = 0;
  while (q--) {
    scanf("%d", &key);
    if (linearSearch_b(key) != NOT_FOUND)
      count++;
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vvi g;
vi dp;
ll dfs(int i){
    if(dp[i]!=-1)return dp[i];
    ll res=0;
    for(ll x:g[i])chmax(res,dfs(x)+1);
    dp[i]=res;
    return res;
}
int main(){
    ll n,m;cin>>n>>m;
    g=vvi(n);
    rep(i,m){
        ll a,b;cin>>a>>b;a--;b--;
        g[a].pb(b);
    }
    dp=vi(n,-1);
    ll ans=0;
    rep(i,n)chmax(ans,dfs(i));
    out(ans);
}


Measured memory_bytes: 8576
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
//#define _LIBCPP_DEBUG 0
//#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define all(a) (a).begin(),(a),end()
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)	

int max(int a, int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main(void) {
	int n, m;
	int a[110];

	cin >> n >> m;
	rep(i, n) {
		cin >> a[i];
	}

	bool can = false;
	int cnt = 0;
	int sum = 0;
	rep(i, n) {
		sum += a[i];
	}
	rep(i, n) {
		if (a[i]*4 * m >= sum ){
			cnt++;
		}
		if (cnt == m) {
			can = true;
			break;
		}
	}
	cout << (can ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3140
N = int(input())
S = str(input())

black = [0]
white = [0]

for i in range(N):
    if S[i] == '#':  # 黒のパターン
        black.append(black[-1]+1)
        white.append(white[-1])
    else:
        black.append(black[-1])
        white.append(white[-1]+1)

ans = N

for i in range(N+1):
    ans = min(ans, black[i] + (white[-1]-white[i]))
    # iを起点にして、その点を含んだ左側にある黒の数 + その点より右側にある白の数

print(ans)


Measured memory_bytes: 12792
n=int(input())
t,a=map(int,input().split())
t*=1000;a*=1000
h=list(map(int,input().split()))
m=10**17
ans=1
for i in range(n):
  l=abs(t-h[i]*6-a)
  if m>l:
    m=l
    ans=i+1
print(ans)

Measured memory_bytes: 3060
S = list(input())
ACGT = []
lentemp = 0
while len(S)>0:
    s = S.pop(0)

    if s == "A" or s == "C" or s == "G" or s == "T":
        lentemp += 1

    else:
        ACGT.append(lentemp)
        lentemp = 0
ACGT.append(lentemp)

print(max(ACGT))



Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    string s; cin>>s;

    vint sumE(N+1),sumW(N+1);
    REP(i,N){
        sumE[i+1]=sumE[i]+(s[i]=='E');
        sumW[i+1]=sumW[i]+(s[i]=='W');
    }
    
    int ans=N;
    REP(i,N){
        int w=sumW[i];
        int e=sumE[N]-sumE[i+1];
        ans=min(ans,w+e);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 5380
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef vector<xy_t> polygon;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

int calc(int w){
	int res = 1150;
	if(w <= 10) return res;
	if(w <= 20){
		res += (w - 10) * 125;
		return res;
	}
	if(w <= 30){
		res += 1250 + (w - 20) * 140;
		return res;
	}
	res += 2650 + (w - 30) * 160;
	return res;
}

int main(){
	int w;
	while(cin >> w && w != -1){
		cout << 4280 - calc(w) << endl;
	}
	return 0;
}

Measured memory_bytes: 0
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")
           
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
           
using namespace std;
using namespace __gnu_pbds;
           
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
           
using matrix = vector<vector<ll>>;
template<typename T>
using kawaii_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
           
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
//#define int long long;
           
void FAST_IO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.setf(ios::fixed);
    //cout.precision(20);
    #ifndef _offline
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif
}

signed main() {
    FAST_IO();
    int n;
    cin >> n;
    cout << (n - 1) / 2 << '\n';
}


Measured memory_bytes: 256
I=lambda:map(int,input().split())
n,k=I()
l=[[a-1,i]for i,a in enumerate(I(),1)]
for a,_ in l:
  if a<0:
    print(-1)
    exit()
l.sort(reverse=1)
r=[i for _,i in l]
b=r[-1]
for i in range(k):
  for t in l:
    if t[1]==b:continue
    if not t[0]:
      print(-1)
      exit()
    t[0]-=1
    r.append(t[1])
  l.sort(reverse=1)
  b=r[-1]
print(len(r))
print(*r)

Measured memory_bytes: 40848
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int m, k;
vector<int> ans;
int main(){
    cin >> m >> k;
    if(m == 0){
        if(k != 0){
            cout << -1 << endl;
            return 0;
        }else{
            cout << "0 0" << endl;
            return 0;
        }
    }
    if(m == 1){
        if(k != 0){
            cout << -1 << endl;
            return 0;
        }else{
            cout << "1 0 0 1" << endl;
            return 0;
        }
    }
    if(k >= pow(2, m)){
        cout << -1 << endl;
        return 0;
    }
    for(int i = pow(2, m) - 1;i >= 0;i--){
        if(i != k)ans.emplace_back(i);
    }
    ans.emplace_back(k);
    int num = 0;
    for(int i = 0;i <= pow(2, m) - 1;i++){
        if(i != k){
            ans.emplace_back(i);
            num ^= i;
        }
    }
    if(k != num){
        cout << -1 << endl;
        return 0;
    }
    ans.emplace_back(k);
    REP(i, pow(2, m + 1)){
        if(i)cout << " ";
        cout << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 2932
#include <cstdio>
#include <algorithm>
#include <vector>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define mp(a, b) make_pair(a, b)

using namespace std;

typedef long long LL;
const int N = 100010;

LL x[N], x0[N], r[N][62], fx[N], cx0[N];

int main()
{
	int n, m;
	LL k;
	scanf("%d", &n);
	Rep(i, n) scanf("%lld", &x[i]);
	Rep(i, n - 1) x0[i] = i, cx0[i] = x[i + 1] - x[i];
	scanf("%d%lld", &m, &k);
	Rep(i, m) {
		int a;
		scanf("%d", &a);
		//printf("%d<-->%d\n", a, a - 1);
		swap(x0[a], x0[a - 1]);
	}
	Rep(i, n - 1) r[i][0] = x0[i];
	Rep(j, 60) Rep(i, n - 1) r[i][j] = r[r[i][j - 1]][j - 1];
	Rep(i, n - 1) fx[i] = i;
	for (int i = 60; i >= 0; i --) if (k >= (1ll << i)) {
		k -= (1ll << i);
		Rep(j, n - 1) fx[j] = r[fx[j]][i];
	}
	LL sum = x[1];
	printf("%lld\n", sum);
	Rep(i, n - 1) {
		sum += cx0[fx[i]];
		printf("%lld\n", sum);
	}
	
	return 0;
}

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

//odd odd 
//odd even 
//even even 
int main(){
  int h,w; cin>>h>>w;
  vector<int> num(26,0);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      char c; cin>>c;
      num[c-'a']++;
    }
  }
  int c1=0,c2=0,c4=0;
  for(int i=0;i<26;i++){
    if(num[i]%4==1){
      c1++; num[i]--;
    }
    if(num[i]%4==2){
      c2+=2; num[i]-=2;
    }
    if(num[i]%4==0) c4+=num[i];
  }
  if(h%2==1 && w%2==1){
    if(c1==1){
      if(h*w+1-h-w<=c4){
        c4-=h*w+1-h-w;
        c2+=c4;
        if(c2==h+w-2){
          cout<<"Yes"<<endl;
          return 0;
        }
      }
    }
    cout<<"No"<<endl;
    return 0;
  }else if(h%2==1){
    if(h*w-w<=c4){
      c4-=h*w-w;
      c2+=c4;
      if(c2==w){
        cout<<"Yes"<<endl;
        return 0;
      }
    }cout<<"No"<<endl;
    return 0;
  }else if(w%2==1){
    if(h*w-h<=c4){
      c4-=h*w-h;
      c2+=c4;
      if(c2==h){
        cout<<"Yes"<<endl;
        return 0;
      }
    }cout<<"No"<<endl;
    return 0;
  }else{
    if(c4==h*w){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}

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

int main()
{
	long long l, r;
	cin >> l >> r;

	long long ret = 0;
	long long m = 2019;
	if (r - l < 2018) {
		for (long long i = l; i <= r - 1; ++i) {
			for (long long j = i + 1; j <= r; ++j) {
				m = min(m, i * j % 2019);
			}
		}
		ret = m;
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#define int long long
#define iris 1000000007
using namespace std;

int arr[100010];

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	char c;
	cin>>c;
	c++;
	cout<<c<<'\n';
	
	return 0;
}


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

int int_part(double x){
	return floor(x);
}

double frac_part(double x){
	double num;
	num = x - floor(x);
	return num;
}

int main () {
	int N, D;
	cin>>N>>D;
	int count = 0;
	for (int i=0;i<N;i=i+1){
		long int X, Y;
		cin>>X>>Y;
		double db;
		db = sqrt(X*X + Y*Y);
		if(int_part(db) < D){
			count = count +1;
		}
		else if(int_part(db) == D){
			if(!(frac_part(db) > 0)) {
				count = count+1;
			}
		}
	}
	cout<<count;
	return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define bg begin()
#define en end()
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define pr_arr(name, a, b) \
  for (int i = (a); i < (b); i++) { \
    for (int j = (a); j < (b); j++) {\
      if (j > (a)) printf(" "); \
      printf("%2lld", name[i][j]); \
    }\
    printf("\n");\
  }\

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

int N;

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

    if (N % 2 == 0) printf("%d\n", N / 2 - 1);
    else printf("%d\n", N / 2);

	return 0;
}


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

using namespace std;

int main()
{
    int n,k,count=0;
    cin>>n>>k;
    int a[n],i;
    for(i=0;i<n;i++)
     {cin>>a[i];
     }
    sort(a,a+n);
    int j=0;
    while(k--)
     {count+=a[j];
      j++;
     }
     cout<<count;

    

    return 0;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Set<String> dictionary = new HashSet<>();

        Scanner inp = new Scanner(System.in);
        int total = inp.nextInt();

        for (int k = 0; k < total; k++) {
            String command = inp.next();
            String letter = inp.next();

            switch (command) {
                case "insert":
                    dictionary.add(letter);
                    break;
                case "find":
                    if (dictionary.contains(letter)) {
                        System.out.println("yes");
                    } else {
                        System.out.println("no");
                    }

                    break;
                default:
                    break;
            }
        }
    }
}



Measured memory_bytes: 253480
using System;

namespace TaxRate
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            double price = N / 1.08;
            int price2 = (int)price;
            if (price == price2)
            {
                Console.WriteLine(price2);
            }
            else if ((int)((price2 + 1) * 1.08) == N)
            {
                Console.WriteLine(price2 + 1);
            }
            else
            {
                Console.WriteLine(":(");
            }
        }
    }
}


Measured memory_bytes: 13140
void main() {
	auto S = rs;
	import std.regex;
	auto reg = ctRegex!("^A?KIHA?BA?RA?$");
	if(S.match(reg)) writeln("YES");
	else writeln("NO");
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}


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

using namespace std;
int n,m;
int main() {
  cin >> n >> m;
  double a = (1 << m);
  double p = 1;
  double sum = 0;
  int i = 1;
  int k = 100000;
  while(k--) {
    sum += (100 * (n - m) + 1900 * m) * i * p / a;
    // cout << sum<<endl;
    p *= (a - 1) / a;
    i++;
  }
  cout << sum << endl;
}
    


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int H, W, x, y;
    
    while(1){
        
        scanf("%d %d", &H, &W);
        
        if(H==0 && W==0){
            break;
        }
        
        for(y=1; y<=H; y++){
            for(x=1; x<=W; x++){
                if((x==1) || (x==W) || (y==1) || (y==H)){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 572
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <fstream>
#include <iomanip>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  ll i = 0;
  for (auto x : v){os << " [" << i++ << "]" << x; if (i % 5 == 0) os << std::endl;}
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 5 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll A, B, C;
  std::cin >> A >> B >> C;

  if (A == B) print(C);
  else if (B == C) print(A);
  else print(B);

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P; typedef pair<Int,Int> Pl;
const int mod = 1e9+7;
#define END {cout<<ans<<'\n'; return 0;}
#define ALL(v) (v).begin(),(v).end()
#define Pr(type) priority_queue<type>
#define gPr(type) priority_queue<type,vector<type>,greater<type>>
#define V(type) vector<type>
#define rep(i,n) for(int i=0; i<n; i++)
#define rer(i,st,en) for(int i=st; i<en; i++)
#define gnr(i,l,r) for(int i=int(r)-1; i>=int(l); i--)
#define eb emplace_back
#define pri1(a) cout<<(a)<<'\n'
#define pri2(a,n) rep(i,n-1)cout<<a[i]<<' '; cout<<a[n-1]<<'\n'
#define prip(p) cout<<p.first<<' '<<p.second<<'\n'
template<class T> inline bool cmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool cmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

Int n,m,_,x,y,q;
string s,sb;
bool ok;
char ch;

Int dp[1010][1<<13];

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T smi(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) cmin(ret,data[k]);
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

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

  cin>>n>>m; Int a[m],b,c[m]={}; 
  rep(i,m){
    cin>>a[i]>>b;
    rep(j,b){cin>>x; c[i]+=1<<(x-1);}
  }
  fill(dp[0],dp[1002],1e18);
  rep(i,m+1)dp[i][0]=0;
  rep(i,m){
    rep(j,1<<n){
      if(j&c[i]){
        x=(j^c[i])&j;
        cmin(dp[i+1][j],min(dp[i][j],dp[i][x]+a[i]));
      }else cmin(dp[i+1][j],dp[i][j]);
      //cout<<(dp[i+1][j]==1e18?-1:dp[i+1][j])<<' ';
    }
    //cout<<'\n';
  }
  cout<<(dp[m][(1<<n)-1]==1e18?-1:dp[m][(1<<n)-1])<<'\n';
}

Measured memory_bytes: 64512
#include<bits/stdc++.h>
using namespace std;
int main() {
	char c;
	cin >> c;

	if (c == 'a'| c == 'e' | c == 'i' | c == 'o' | c == 'u'  ) {
		cout << "vowel" << endl;
	}
	else
	{
		cout << "consonant" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 5;


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a, b;
    cin >> a >> b;
    cout << a * b;

    return 0;

}


Measured memory_bytes: 3636
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)

def calc(xs):
    used = [False] * len(xs)
    ans = 0
    for i in range(len(xs)-1):
        #print(used)
        j = 0
        for k in range(xs[i]):
            #print(k)
            if not used[k]:
                j+=1
        #print(i, xs[i], j, len(xs)-i-1, (j-1))
        ans += factorial(len(xs)-i-1) * (j-1)
        used[xs[i]-1] = True
    return ans

words = lambda t : list(map(t, input().split()))
n = int(input())
a = words(int)
b = words(int)
#print(calc(b))
print(abs(calc(b) - calc(a)))


Measured memory_bytes: 3064
a = []
s = int(input())
a.append(s)
i = 1

while 1 == 1:
  if s % 2 == 1:
    a_ = 3 * s + 1
    
  else:
    a_ = s / 2
  
  i += 1
  if a_ in a:
    print(i)
    break
  
  a.append(a_)
  s = a_
  


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

int main() {
    string s, t;
    cin>>s >>t;
    int ans=0;
    rep(i,s.size()){
        if(s[i]!=t[i]) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int N, M;
vector<int> G[100001];
int in[100001];

int d[100001];
int ans[100001];
void solve(){
	int p = 0;
	reps(i, N){
		if(in[i] == 0){
			p = i;
			break;
		}
	}
	queue<int> q;
	q.push(p);
	while(!q.empty()){
		int n = q.front(); q.pop();
		rep(i, G[n].size()){
			int to = G[n][i];
			if(in[to] > 1)
				in[to]--;
			else{
				ans[to] = n;
				q.push(to);
			}
		}
	}
	reps(i, N){
		cout << ans[i] << endl;
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> M;
	rep(i, N - 1 + M) {
		int a, b;
		cin >> a >> b;
		G[a].pub(b);
		in[b]++;
	}
	solve();
	return 0;
}


Measured memory_bytes: 7040
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
N = ri()
d = [ri_() for i in range(N)]
d.sort(key=itemgetter(1))
sm = 0
for di in d:
    sm += di[0]
    if sm > di[1]:
        print('No')
        exit()
print('Yes')

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

int main() {

	ll a, v, b, w, t; cin >> a >> v >> b >> w >> t;
	string ans = "NO";
	if(v <= w){}
	else {
		ll dist = abs(a - b);
		if (dist <= (v - w) * t) {
			ans = "YES";
		}
	}	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <complex>

#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define rtr(c, i) for (typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); --i)
#define contains(c, x) ((c).find(x) != (c).end())
#define Contains(c, x) (find(all(c), x) != (c).end())
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, (n))
#define To_String to_string< char,std::char_traits<char>,std::allocator<char> >

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	int n, a[21];
	while (cin >> n, n) {
		int sum = 0;
		rep(i, n) {
			cin >> a[i];
			sum += a[i];
		}
		int res = 1000000000;
		rep(i, (1<<n)) {
			int A = 0;
			rep(j, n) if (i & (1 << j)) A += a[j];
			if (res > abs(sum - 2 * A)) res = abs(sum - 2 * A);
			//res = min(res, abs(A - (sum - A)));
		}
		cout << res << endl;
	}
	return 0;
}

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

#define FOR(i,a,b) for (lli i=(a);i<(b);i++)
#define RFOR(i,a,b) for (lli i=(b)-1;i>=(a);i--)
#define REP(i,n) for (lli i=0;i<(n);i++)
#define RREP(i,n) for (lli i=(n)-1;i>=0;i--)
#define ALL(a) (a).begin(),(a).end()
const int INF = INT_MAX/3;
const double EPS = 1e-14;

template<typename U, typename T>
void chmin(U &x, T y) { x = min(x, y); }

template<typename U, typename T>
void chmax(U &x, T y) { x = max(x, y); }

typedef long long int lli;

lli gcd(lli x, lli y) {
  return (y == 0 ? x : gcd(y, x % y));
}

int main() {
  cout << fixed << setprecision(12);
  lli T;
  cin >> T;
  REP(i, T) {
    lli h, w;
    cin >> h >> w;
    lli g = gcd(h, w);
    h /= g, w /= g;
    lli x, y;
    if ((h + w) % 2 == 1) {
      x = 1, y = 1;
    } else {
      lli p = w * h;
      x = p / 2;
      y = p - x;
    }
    cout << y << " " << x << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    string s;
    int i;
    cin>>s;
    ll n=s.length();
    //cout<<s<<n;
    int ans=1;
    rep(i,(n-1)/2){
        if(s[i]!=s[n-i-1]) ans=0;
    }
    rep(i,n/4){
        if(s[i]!=s[(n-3)/2-i]) ans=0;
    }
    rep(i,n/4){
        if(s[(n+1)/2+i]!=s[n-i-1]) ans=0;
    }
    if(ans==1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <queue>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
const int INF = 100000000;

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    REP(i, n){
        cin >> h[i];
    }

    int count = 0;
    REP(i, n){
        if(h[i] >= k){
            count++;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 640
#include <list>
#include <utility>
#include <iostream>
#include <queue>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <map>
#include <cstring>
#include <set>
#include <string>
using namespace std;
#define INF 1000000007LL
typedef long long ll;

int n,m;
int a[300001];
int cnt[300001];
int len[300001];

int main(void){
	scanf("%d%d",&n,&m);
	int res=n;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		len[a[i]]++;
		if(a[i]-len[a[i]]+1>=1)cnt[a[i]-len[a[i]]+1]++;
		if(cnt[a[i]-len[a[i]]+1]==1)res--;
	}
	for(int i=0;i<m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		x--;
		if(a[x]-len[a[x]]+1>=1)cnt[a[x]-len[a[x]]+1]--;
		if(a[x]-len[a[x]]+1>=1 && cnt[a[x]-len[a[x]]+1]==0)res++;	
		len[a[x]]--;
		a[x]=y;
		len[a[x]]++;
		if(a[x]-len[a[x]]+1>=1)cnt[a[x]-len[a[x]]+1]++;
		if(cnt[a[x]-len[a[x]]+1]==1)res--;
		printf("%d\n",res);
	}
	return 0;
}

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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2e18
#define endl "\n"
#define llevel 20
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}

int _runtimeTerror_()
{
	ll x;
	cin>>x;
	cout<<(x/500)*1000+((x%500)/5)*5<<endl;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define pill pair<int, int>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
const LL INF = 1e18 + 10;
LL n, h, N, w;
LL Gcd(LL a, LL b) {
	return b == 0 ? a : Gcd(b, a % b);
}

int main(){
	cin >> n;
	for(LL i = 1; i <= 3500; ++i) {
		for(LL j = 1; j <= 3500; ++j) {
			LL a = j + i, b = i * j;
			if(a * n >= 4LL * b)	continue;
			LL c = 4LL * b - a * n, d = n * b;
			if(c / Gcd(c, d) == 1) {
				printf("%lld %lld %lld\n", i, j, d / Gcd(c, d));
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN,'%d%d',$H,$W);
for ($i=1; $i <=$W+2 ; $i++) {
  // code...
  echo '#';
}
echo "\n";
for ($i=1; $i <=$H ; $i++) {
  // code...
  echo '#';
  echo trim(fgets(STDIN));
  echo '#';
  echo "\n";
}
for ($i=1; $i <=$W+2 ; $i++) {
  // code...
  echo '#';
}
echo "\n";
 ?>


Measured memory_bytes: 3576
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
#include <iostream>
using namespace std;


int main()
{
    vector<int> A(3);
    for (int i = 0; i < 3; i++) {
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<int>());
    
    cout << A[0] * 10 + A[1] + A[2] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for (int i=s;i<=t;i++)
#define pi acos(-1)
#define FOR(i,s,t) for (int i = s; i < t; i++)
typedef long long LL;
typedef long double LD;
typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef pair<PII, PII> PPP;
typedef pair<PII, int> PPI;
typedef pair<LL, PII> PLP;
typedef pair<double, PII> PDP;
#define repp(i,s,t) for (int i=s;i>=t;i--)
template<class T> T sqr(T x) {return x*x;}
#define debug(x) cerr<<#x"="<<(x)<<endl;
#define pb(x) push_back(x);
#define ori(x) x-'a'
#define y0 AERGAEWFAWERAw
#define y1 ASDFAEWRWERWERW
#define x0 gggsdfsfsfdf
#define x1 SAFREWRREWR
int a[400000], b[400000], f[400000];
int main() {
	int n;
	scanf("%d",&n);
	int ans = 0;
	rep(i,1,n) scanf("%d",&a[i]);
	rep(i,1,n) {
		b[a[i]] = i;
		f[i] = 1;
		if (b[a[i]-1]) f[i] = f[b[a[i]-1]] + 1;
		ans = max(ans, f[i]);
	}
	cout << n - ans << endl;
}



Measured memory_bytes: 3584
#include<iostream>

using namespace std;

int main () {
  int N,t,i;
  int a[100001];
  
  cin >> N;
  
  for(i=1;i<=N;i++){
     cin >> t;
     a[t] = i;
  }
  
  for(i=1;i<=N;i++){
     if(i==1){
        cout << a[i];
     }else{
        cout << ' ' << a[i];
    }
  }
  
  return 0;
}

Measured memory_bytes: 1152
"use strict";
function main(input) {
    const line = input.split("\n");
    let arr = line[0].split(" ");
    const N = parseInt(arr[0]);
    const M = parseInt(arr[1]);
    const A = line[1].split(" ").map(Number);
    const accum = A.reduce((Ai, x) => Ai + x);
    console.log(N < accum ? -1 : N - accum);
    return;
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30604
import sys
input = sys.stdin.readline

mod = 998244353

N, S = map(int, input().split())
A = list(map(int, input().split()))

dp = [[0]*(S+1) for _ in range(N+1)]
dp[0][0] = 1
for i, a in enumerate(A):
    dp[i+1][0] = i+2
    for s in range(1, S+1):
        if s-a >= 0:
            dp[i+1][s] = (dp[i][s] + dp[i][s-a]) % mod
        else:
            dp[i+1][s] = dp[i][s]

ans = 0
for r in range(N+1):
    ans = (ans + dp[r][S]) % mod

print(ans)


Measured memory_bytes: 112220