akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i, n) for (int i = 0; i < (n); i++)
int main()
{
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  rep(i, n)
  {
    cin >> p[i];
  }
  for (int i = 0; i <= x; i++)
  {
    for (int j = -1, k = 0; k < 2; j *= (-1), k++)
    {
      int a = x + i * j;
      bool exists = std::find(std::begin(p), std::end(p), a) != std::end(p);
      if (!exists)
      {
        cout << a << endl;
        return 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
const ll mod=1000000007;
const ll inf=(1LL<<60);
const double pi=acos(-1);
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
inline void pcas(int ca) {printf("Case %d: ",ca);}
const int maxn=2e5+10;
ll fac[maxn],inv[maxn];
void init()
{
    fac[0]=1;
    for(int i = 1; i <= maxn-10; ++i) fac[i]=fac[i-1]*i%mod;
    inv[maxn-10]=powmod(fac[maxn-10],mod-2);
    for(int i = maxn-11; i >= 0; --i) inv[i]=inv[i+1]*(i+1)%mod;
}
ll C(int x,int y)
{
    return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
    int h,w,a,b;
    init();
    scanf("%d%d%d%d",&h,&w,&a,&b);
    ll ret=C(h+w-2,h-1);
    rep(i,0,b-1) ret=(ret-C(i+h-a-1,h-a-1)*C(w-i+a-2,a-1)%mod+mod)%mod;
    cout<<ret<<endl;
    return 0;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll n,k;
  cin >> n >> k;
  double ans = 0.0;
  REP(i,n){
    ll d = i+1;
    ll t = 0;
    ll div = n;
    while(d<k){
      d *= 2;
      t = 1;
      div *= 2;
    }
    ans += 1.0/(double)div;
  }
  printf("%.10lf\n",ans);
  return 0;
}


Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))

def check(b):
    for i in range(len(b))[::-1]:
        if i+1 == b[i]:
            return i
    return -1

ans = []
for i in range(n):
    ind = check(b)
    if ind >= 0:
        ans.append(ind+1)
        b = b[:ind] + b[ind+1:]
    else:
        print(-1)
        exit()
for i in ans[::-1]:
    print(i)


Measured memory_bytes: 3064
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	cin >> N >> M >> K;
	cin >> L;
	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= M; j++) {
			for (int k = 0; k <= K; k++) {
				if (i * 500 + j * 100 + k * 50 == L) {
					R++;
				}
			}
		}
	}
	cout << R << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <map>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define ci(x) cin >>x
#define co(x) cout<<x<<endl
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a) {
 long long ans=1;
 while(a>1){
 ans*=a;
 ans%=1000000007;
     a--;
    }
    return ans;
     }
int main() {
string S;
  cin >>S;
  ll x=S.size();
  if(x%2!=0) {
cout<<"No"<<endl;
  }
else {
  bool ans=true;
rep(i,x/2) {
  if((S.at(2*i)=='h') &&(S.at(2*i+1)=='i')) {
continue;
  }
else {
ans=false;
  break;
}
}
  
  
  if(ans) {
cout<<"Yes"<<endl;
  }
else {
cout<<"No"<<endl;
}
}
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

int main(){
    int n;
    cin >> n;
    vector<double> v;
    rep(i, n){
        double x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    rep(i, n-1){
        double now = v[i] + v[i+1];
        v[i+1] = now / 2.0;
    }
    cout << v[n-1] << endl;
    return 0;
}

Measured memory_bytes: 3796
MOD = 10**9 + 7
n = int(input())
s = input().rstrip()
m = len(s)

dp = [[0] * (n + 3) for _ in range(n + 3)]
dp[0][0] = 1

for i in range(1, n + 1):
    dp[0][i] += dp[0][i-1]
    dp[0][i] %= MOD
    for j in range(i + 1):
        # Delete
        dp[j-1][i] += dp[j][i-1]
        # Add
        dp[j+1][i] += dp[j][i-1] * 2
        dp[j+1][i] %= MOD

div2 = pow(2, MOD-2, MOD)
ans = dp[m][n]
for i in range(m):
    ans *= div2
    ans %= MOD
print(ans)

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int x[5];
    rep(i,5) cin >> x[i];

    rep(i,5) {
        if(x[i] == 0) cout << i+1 << endl;
    }
}


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

int main(){
  int n, x, ans = 1;
  cin >> n >> x;
  vector<int> l(n);
  rep(i,n,0) cin >> l[i];
  int sum = 0;
  rep(i,n,0){
    sum += l[i];
    if(sum <= x) ans++;
    else break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int ans[1000]={0};
	int in_a;
	int x;
	int math[246913];
	int i;
	int j;
	int k;
	
	for(k=0;;k++){
		scanf("%d",&in_a);
		if(in_a==0){
			break;
		}
		
		for(i=in_a+1;i<=2*in_a;i++){
			x=0;
			for(j=2;j*j<=i;j++){
				if(i%j==0){
					x=1;
				}
			}
			
			if(x==0){
				ans[k]++;
			}
		}
		
		
	}
	ans[k]=-1;
	
	for(i=0;ans[i]!=-1;i++){
		printf("%d\n",ans[i]);
	}
	
	
	return 0;
}

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

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

    for(int i=0;i<S.length()-1;i++){
        if((S.at(i)=='A')&&(S.at(i+1)=='C')){
            ans="Yes";
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int P;
  int x,y,z;
  for(int i;i<N;i++){
    cin >> P;
    if(P<=A){
      x++;
    }
    else if(P<=B){
      y++;
    }
    else{
      z++;
    }
  }
  cout << min(x,min(y,z)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
const int MAX=2e5;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  int N; cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];
  ll ans=0;
  ll j=0;
  int XOR=a[0];
  rep(i,N){
    if(i>j){
      j=i;
      XOR=a[i];
    }
    while((XOR^a[j+1])==XOR+a[j+1]&&j<N-1){
      XOR+=a[j+1];
      j++;
    }
    ans+=j+1-i;
    XOR-=a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1152
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto a=readln.split.to!(int[]);

  int cur=-1, len=1;
  int need=0;
  foreach(e; a){
    if(cur==e) len++;
    else{
      need+=len/2;
      len=1;
      cur=e;
    }
  }  

  writeln(need+len/2);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define rep2(i,j,n) for(int j=i;j<n;j++)
#define rep3(i,j,n) for(int j=i;j<=n;j++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define sp(n) cout << fixed << setprecision(n)
typedef long long ll;
using namespace std;
int main(void){
    double t,x;cin>>t>>x;
    cout<<t/x<<endl;
}


Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');
var lines = [];
var reader = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout,
    terminal: false
});
reader.on('line', (line) => {
    lines.push(line);
});
reader.on('close', () => {
    let [lifeA, atkA, lifeB, AtkB] = lines[0].split(" ").map(e => parseInt(e));
    while(true){
        lifeB -= atkA;
        if (lifeB <= 0) {
            console.log( "Yes" );
            return;
        }
        lifeA -= AtkB;
        if (lifeA <= 0){
            console.log( "No" );
            return;
        }
    }
});

Measured memory_bytes: 30072
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

// Priority Queue
type Item struct {
	priority, value, index int
}

type PQ []*Item

func (pq PQ) Len() int {
	return len(pq)
}

func (pq PQ) Less(i, j int) bool {
	return pq[i].priority < pq[j].priority
}

func (pq PQ) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *PQ) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Item)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *PQ) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	item.index = -1
	*pq = old[0 : n-1]
	return item
}

// End Priority Queue

// Path
type Edge struct {
	to, cost int
}

type Path struct {
	edges []Edge
}

// Dijkstra
type Route struct {
	path []int
}

func Dijkstra(N, S int, path []Path) ([]int, []Route) {
	pq := make(PQ, 0)
	heap.Init(&pq)
	d := make([]int, N+1)
	r := make([]Route, N+1)
	// init
	for i := 0; i <= N; i++ {
		d[i] = math.MaxInt32
	}
	d[S] = 0
	r[S].path = []int{S}
	heap.Push(&pq, &Item{0, S, 0})
	for pq.Len() > 0 {
		item := heap.Pop(&pq).(*Item)
		v := item.value
		if d[v] < item.priority {
			continue
		}
		for _, e := range path[v].edges {
			if d[e.to] > d[v]+e.cost {
				d[e.to] = d[v] + e.cost
				r[e.to].path = append(r[v].path, e.to)
				heap.Push(&pq, &Item{d[e.to], e.to, 0})
			}
		}
	}
	return d, r

}

func main() {
	sc.Split(bufio.ScanWords)
	N, M := getInt(), getInt()
	path := make([]Path, N+1)

	for i := 0; i < M; i++ {
		f, t := getInt(), getInt()
		path[f].edges = append(path[f].edges, Edge{t, 1})
		path[t].edges = append(path[t].edges, Edge{f, 1})
	}

	_, r := Dijkstra(N, 1, path)

	out("Yes")
	for i := 2; i <= N; i++ {
		l := len(r[i].path)
		out(r[i].path[l-2])
	}
}


Measured memory_bytes: 28120
#include <stdio.h>

int main() {
	int N, A, B;
	int sum;
	int i;
	int n, n10, n100, n1000, n10000;
	int num[10000];
	int number = 0;
	int sumNum = 0;

	scanf("%d", &N);
	scanf("%d", &A);
	scanf("%d", &B);

	for (i=1; i<=N; i++) {
		n10000 = i / 10000;
		n1000 = (i % 10000) / 1000;
		n100 = (i % 1000) / 100;
		n10 = (i % 100) / 10;
		n = (i % 10);

		sum = n10000 + n1000 + n100 + n10 + n;

		if (A <= sum && sum <= B) {
			num[number] = i;
			number++;
		}
	}

	for (i=0; i<number; i++) {
		sumNum = sumNum + num[i];
	}

	printf("%d\n", sumNum);
}


Measured memory_bytes: 256
from collections import Counter
n, m = map(int, input().split())
a = Counter(list(map(int, input().split())))
 
for _ in range(m):
  b, c = map(int, input().split())
  if c in a:
    a[c] += b
  else:
    a[c] = b
 
a = sorted(a.items(), key=lambda x:x[0])
now = 0
ans = 0 
 
while n > now:
  tmp = a.pop()
  if now + tmp[1] <= n:
    now += tmp[1]
    ans += tmp[1] * tmp[0]
  else:
    ans += tmp[0] * (n-now)
    now = n
 
print(ans)

Measured memory_bytes: 42648
// ABC073 D-joisino's travel ワーシャルフロイド
// https://atcoder.jp/contests/abc073/tasks/abc073_d
// はまりポイント１　next_permutationは、sort(r.begin(),r.end());　してから使う
// はまりポイント２　『 cost[i][j] = INT_MAX; 』はまずい INT_MAX + INT_MAX = -2
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r;
    for(int i = 0; i < R; i++) {
        int temp;
        cin >> temp;
        r.push_back(temp);
    }
    int cost[N + 1][N + 1];
    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            if(i == j) {
                cost[i][j] = 0;
            } else {
                cost[i][j] = INT_MAX/2;
            }
        }
    }
    for(int i = 0; i < M; i++) {
        int A, B, C;
        cin >> A >> B >> C;
        cost[A][B] = C;
        cost[B][A] = C;
    }
    for(int k = 1; k <= N; ++k) {
        for(int i = 1; i <= N; ++i) {
            for(int j = 1; j <= N; ++j) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    int min = INT_MAX;
    sort(r.begin(),r.end());
    do {
        int tempcost = 0;
        for(int i = 1; i < r.size(); i++) {
            tempcost += cost[r[i - 1]][r[i]];
        }
        if(tempcost < min)
            min = tempcost;
    } while(next_permutation(r.begin(), r.end()));
    cout << min << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
	//code
	int n,a,b,c,d,f;string s;
	cin>>n>>a>>b>>c>>d>>s;
	if(s[a-1]=='#'||s[b-1]=='#'||s[c-1]=='#'||s[d-1]=='#'||c==d)
	{
	    cout<<"No"<<endl;
	    return 0;
	}
	if(c<=b||d>c)
	{
	    f=0;
	   for(int i=b-1;i<d;)
	   {
	       if(i+1==d-1||i+2==d-1)
	       {
	           f=1;
	           break;
	       }
	       else if(s[i+1]=='#'&&s[i+2]=='#')
	       {
	           f=0;
	           break;
	       }
	       else if(s[i+2]!='#')
	       i+=2;
	       else
	       i++;
	   }
	   if(f==1)
	   {
	       for(int i=a-1;i<c;)
	       {
	       if(i+1==c-1||i+2==c-1)
	       {
	           f=1;
	           break;
	       }
	       else if(s[i+1]=='#'&&s[i+2]=='#')
	       {
	           f=0;
	           break;
	       }
	       else if(s[i+2]!='#')
	       i+=2;
	       else
	       i++;
	       }
	       if(f==1)
	       cout<<"Yes"<<endl;
	       else
	       cout<<"No"<<endl;
	   }
	   else
	   cout<<"No"<<endl;
	}
	else
	{
	    f=0;
	    for(int i=b-1;i<d;i++)
	    {
	        if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.')
	        {f=1;break;}
	    }
	    if(f==1){
	    int t=c+d;
	    c=min(c,d);
	    d=t-c;
	    for(int i=b-1;i<c;)
	   {
	       if(i+1==c-1||i+2==c-1)
	       {
	           f=1;
	           break;
	       }
	       else if(s[i+1]=='#'&&s[i+2]=='#')
	       {
	           f=0;
	           break;
	       }
	       else if(s[i+2]!='#')
	       i+=2;
	       else
	       i++;
	   }
	   if(f==1)
	   {
	       for(int i=c-1;i<d;)
	       {
	       if(i+1==d-1||i+2==d-1)
	       {
	           f=1;
	           break;
	       }
	       else if(s[i+1]=='#'&&s[i+2]=='#')
	       {
	           f=0;
	           break;
	       }
	       else if(s[i+2]!='#')
	       i+=2;
	       else
	       i++;
	       }
	       if(f==1)
	       {
	           for(int i=a-1;i<b;)
	           {
	       if(i+1==b-1||i+2==b-1)
	       {
	           f=1;
	           break;
	       }
	       else if(s[i+1]=='#'&&s[i+2]=='#')
	       {
	           f=0;
	           break;
	       }
	       else if(s[i+2]!='#')
	       i+=2;
	       else
	       i++;
	       }
	       if(f==1)
	       cout<<"Yes"<<endl;
	       else
	       cout<<"No"<<endl;
	       }
	       else
	       cout<<"No"<<endl;
	   }
	   else
	   cout<<"No"<<endl;
	}else
	    cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <queue>
#include <tuple>
#include <algorithm>
#include <limits>
#include <map>
#include <cmath>

using namespace std;
using lli = long long int;

//int main(void) {
//	lli N,ans = 0;
//	cin >> N;
//
//	if (N == 1) {
//		cout << "0" << endl;
//		return 0;
//	}
//
//	for (lli i = 1; i <= sqrt(N); i++) {
//		lli m = (N - i) / i;
//
//		if (N % m == N / m) {
//			ans += m;
//		}
//
//	}
//
//	cout << ans << endl;
//
//	return 0;
//}
//
//int main(void) {
//
//	lli N,ans = 0;
//	cin >> N;
//
//	lli a = 0, b = 0, ab = 0;
//
//	for (int i = 0; i < N; i++) {
//		string str;
//		cin >> str;
//
//		if (str[0] == 'B' && str[str.size() - 1] == 'A') ab++;
//		else if (str[0] == 'B') b++;
//		else if (str[str.size() - 1] == 'A') a++;
//		for (int j = 0; j < str.size() - 1; j++) {
//			if (str[j] == 'A' && str[j + 1] == 'B') {
//				ans++;
//			}
//		}
//	}
//
//	cout << ans + min(a, b) + ((a == 0 && b == 0 && ab > 0) ? ab - 1 : ab) << endl;
//
//	return 0;
//}
//
//int main(void) {
//
//	lli r, g, b, n, ans = 0;
//	cin >> r >> g >> b >> n;
//
//	for (int i = 0; i <= n; i++) {
//		for (int j = 0; j <= n; j++) {
//			if ((n - r * i - g * j) >= 0 && (n - r * i - g * j) % b == 0) {
//				ans++;
//				cout << r << " " << g << " " << (n - r * i - g * j) / b << endl;
//			}
//		}
//	}
//
//	cout << ans << endl;
//
//	return 0;
//}

int main(void) {

	lli N, K; 
	cin >> N >> K;

	cout << N - K + 1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define VAR(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    VAR(int, N, K);
    vector<i64> x(N);
    read(x);

    i64 ans = LINF;
    for (int i = 0; i + K <= N; ++i) {
        const i64 left = x[i];
        const i64 right = x[i + K - 1];

        if (left <= 0 && 0 <= right) {
            chmin(ans, min(2 * abs(left) + abs(right), abs(left) + 2 * abs(right)));
        }
        else if (0 <= left && left <= right) {
            chmin(ans, right);
        } else if (left <= right && right <= 0) {
            chmin(ans, abs(left));
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args)
	{
		FastReader in = new FastReader();
		if(in.nextInt() == 1)
		{
			System.out.println("Hello World");
		}
		else
		{
			int a = in.nextInt();
			int b = in.nextInt();
			System.out.println((a+b));
		}
	}
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 

	
}


Measured memory_bytes: 22996
inf = 10**15
mod = 10**9+7
a,b = map(int, input().split())
import fractions

f=fractions.gcd(a,b)           #最大公約数

def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

arr = factorization(f)
print(len(arr)+1)

Measured memory_bytes: 64108
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
v(int) adj[100001];
int vis[100001]={0};
void dfs(int i){
    if(vis[i]) return;
    vis[i]=true;
    for(auto x:adj[i]) dfs(x);
}
int main() {
    int n,m;
    cin>>n>>m;
    rep(i,m){
        int a,b;
        cin>>a>>b;
        a--;b--;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int c=0;
    rep(i,n){
        if(!vis[i]) {
            dfs(i),c++;
        }
    }
    cout<<c-1<<endl;
    return 0;
}


Measured memory_bytes: 10012
#include <stdio.h>
#include <stdlib.h>
typedef long long ll;

int dsc(const void *a, const void *b)
{
  return *(int *)b - *(int *)a;
}

int
main(int argc, char *argv[])
{
  int n, a[100000];
  scanf("%d", &n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);

  qsort(a, n, sizeof(int), dsc);

  int i = 0;
  while(i < n){
    if(a[i] == a[i + 1]) break;
    i++;
  }
  int x = 0;
  if(i <= n - 4){
    x = a[i];
  }
  i += 2;
  while(i < n){
    if(a[i] == a[i + 1]) break;
    i++;
  }
  int y = 0;
  if(i <= n - 2){
    y = a[i];
  }
  printf("%lld\n", (ll)x * (ll)y);

  return 0;
}


Measured memory_bytes: 892
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<ld,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int sx,sy,tx,ty,N;
int X[1009], Y[1009], R[1009];
ld G[1009][1009];

ld dijkstra(int s,int t) {
    
    vector<ld> d(N,LLINF);
    vector<bool> visited(N,false);
    int u = s;
    d[u] = 0;
    
    while(u!=t){
        
        ld minv = LLINF;
        visited[u] = true;
        
        for(int i=0; i<N; i++){
            if( d[i]>d[u]+G[u][i] ){
                d[i] = d[u]+G[u][i];
            }
        }
        
        for(int i=0; i<N; i++){
            if( !visited[i] && d[i]<minv ) {
                u = i;
                minv = d[i];
            }
        }
    }
    return d[N-1];
}

ld dif(ld a,ld b){
    return abs(a-b);
}

ld calc(int i,int j){
    ld d=sqrt(pow(dif(X[i],X[j]),2)+pow(dif(Y[i],Y[j]),2));
    d-=R[i]+R[j];
    if(d<0) d=0;
    return d;
}

int main() {
    
    cin>>sx>>sy>>tx>>ty>>N;
    rep1(i,N) cin>>X[i]>>Y[i]>>R[i];
    N+=2;
    X[0]=sx, Y[0]=sy, X[N-1]=tx, Y[N-1]=ty;
    
    rep(i,N)for(int j=i+1;j<N;j++){
        ld d=calc(i,j);
        G[i][j]=G[j][i]=d;
    }
    
    ld ans=dijkstra(0,N-1);
    printf("%.10llf\n",ans);
}

Measured memory_bytes: 16128
#include <iostream>
#include <cmath>
#include <iomanip>
int main() {
    double a, b, c, pi = M_PI;
    std::cin >> a >> b >> c;
    c = c * pi / 180;
    std::cout << std::fixed << std::setprecision(6)
        << a / 2 * b * std::sin(c) << std::endl
        << a + b + std::sqrt(a * a + b * b - 2 * a * b * std::cos(c)) << std::endl
        << b * std::sin(c) << std::endl;
}



Measured memory_bytes: 3500
/**
*    author:  Dooloper
*    created: 05.07.2020 21:53:30
**/

#include <bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int,int>;
using ll = long long;

const int mod = 1000000007;
class mint {
    long long x;
public:
    mint(long long x=0) : x((x%mod+mod)%mod) {}
    mint operator-() const { 
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(mod-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  
  int n,k;
  cin >> n >> k;
  vector<int> s,t;
  vector<int> a(n);
  rep(i,n){
    cin >> a[i];
    if(a[i] < 0) t.push_back(a[i]);
    else s.push_back(a[i]);
  }

  int S = s.size();
  int T = t.size();

  bool ok = false;

  if(S > 0){
    if(n == k) ok = (T%2 == 0);
    else ok = true;
  }else{
    ok = (k%2 == 0);
  }

  mint ans = 1;

  if(!ok){
    sort(a.begin(),a.end(),[](int x, int y){
      return abs(x) < abs(y);
    });
    rep(i,k) ans *= a[i];
  }else{
    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());
    if(k%2 == 1){
      ans *= s.back();
      s.pop_back();
    }
    vector<ll> p;
    while(s.size() >= 2){
      ll x = s.back();s.pop_back();
      x *= s.back();s.pop_back();
      p.push_back(x);
    }
    while(t.size() >= 2){
      ll x = t.back();t.pop_back();
      x *= t.back();t.pop_back();
      p.push_back(x);
    }
    sort(p.rbegin(),p.rend());
    rep(i,k/2) ans *= p[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 6380
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
      }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

string str;
signed main(){
  cin >> str;
  int n = str.size();
  rep(i,8){
    int x = i, y = 7-i;
    string s = str.substr(0, x) + str.substr(n-y, y);
    // cout << str.substr(0, x) << " " << str.substr(n-y, y) << endl;
    if(s == "keyence"){
      printf("YES\n");
      return 0;
    }
  }
  printf("NO\n");
  return 0;
}






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

int c[27], s[366][27], t[366], last[27], bestT[366];
int main()
{
    int D; cin>>D;
    for(int i=1; i<=26; ++i) cin>>c[i];
    for(int i=1; i<=D; ++i)
        for(int j=1; j<=26; ++j)
            cin>>s[i][j];

    auto calc_score=[&](){
        long score=0;
        for(int i=1; i<=26; ++i) last[i]=0;
        for(int d=1; d<=D; ++d) {
            score+=s[d][t[d]];
            last[t[d]]=d;
            for(int i=1; i<=26; ++i) score-=c[i]*(d-last[i]);
        }
        return score;
    };

    for(int i=1; i<=D; ++i) {
        long bestscore=-(1L<<60), typ=1;
        for(int j=1; j<=26; ++j) {
            t[i]=j;
            auto score=calc_score();
            t[i]=0;
            if (bestscore<score) {
                bestscore=score;
                typ=j;
            }
        }
        t[i]=typ;
    }

    mt19937 engine;
    uniform_int_distribution<> rndT(1, 26), rndD(1, 365);
    uniform_real_distribution<> rndS(0.0, 1.0);
    auto bestscore=calc_score();
    memcpy(bestT, t, sizeof(t));

    const double cool=0.999;
    double temp=10000;
    for(int A=100000; A--; ) {
        int d=rndD(engine);
        int q=rndT(engine);
        int x=t[d];
        t[d]=q;
        auto score=calc_score();
        auto sa=exp((score-bestscore)/temp)>rndS(engine);
        if (sa or bestscore<score) {
            if (bestscore<score) {
                bestscore=score;
                memcpy(bestT, t, sizeof(t));
            }
        }
        else {
            t[d]=x;
        }
        temp*=cool;
    }
    for(int i=1; i<=D; ++i) cout<<bestT[i]<<endl;
}


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

int main()
{
	int d, w, h, n, r[10000];
	while (cin >> d >> w >> h >> n && d != 0)
	{
		for (int i = 0; i < n; i++)
			cin >> r[i];
		int c0 = d*d + w*w;
		int c1 = d*d + h*h;
		int c2 = w*w + h*h;
		for (int i = 0; i < n; i++)
		{
			int p = 4 * r[i] * r[i];
			if (c0 < p || c1 < p || c2 < p)
				cout << "OK" << endl;
			else
				cout << "NA" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}

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

    int P[M];
    int X[M];
    int Y[M];
    int index[M];
    int idbef[M]; //about P
    int idaft[M]; //about order
    int yearstack[N];
    FOR(i,M){
        cin >> P[i] >> Y[i];
        index[i]=i;
        X[i]=Y[i];
        
    }
    FOR(i,N){
        yearstack[i]=0;
    }

    quicksort(X,0,M-1,index);



    FOR(i,M){
        idbef[index[i]]=P[index[i]];
        yearstack[P[index[i]]-1]++;
        idaft[index[i]]=yearstack[P[index[i]]-1];
    }
    
    FOR(i,M){
        
        cout <<setfill('0') << setw(6)<<idbef[i]<<setfill('0')<<setw(6)<<idaft[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 4224
#include<iostream>
#include<vector>
using namespace std;
long long int kai(long long int n){
    if(n <=0)return 1;
    return n*kai(n-1);

}

int main(void){
   long long int n;
   cin>>n;
   cout<< kai(n)<<endl;
return 0;
}


Measured memory_bytes: 3088
H,W = map(int,input().split())
S = [list(input()) for _ in range(H)]
INF=10001
dp = [[INF]*W for _ in range(H)]
dp[0][0] = 0 if S[0][0] == "." else 1
 
for i in range(H):
  for j in range(W):
    m,n=INF,INF
    if i != 0:
      m = dp[i-1][j] + (S[i-1][j] == "." and S[i][j] == "#")
    if j != 0:
      n = dp[i][j-1] + (S[i][j-1] == "." and S[i][j] == "#")
 
    dp[i][j] = min(m, n, dp[i][j])
  
print(dp[H-1][W-1])

Measured memory_bytes: 74380
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n, m, k;
  cin >> n >> m >> k;
  vector<ll> a(n), b(m), c(n+1, 0), d(m+1, 0);
  REP(i, n) cin >> a[i], c[i+1] = a[i] + c[i];
  REP(i, m) cin >> b[i], d[i+1] = b[i] + d[i];
  ll ans = 0;
  REP(i, n+1){
    ll t = k-c[i];
    if(t < 0) continue;
    ll p = max(upper_bound(ALL(d), t)-d.begin()-1ll, 0ll);
    chmax(ans, i+p);
  }
  cout << ans << endl;
  return 0;
}

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

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

  vector<ll> l(n);
  rep(i, n) cin >> l[i];

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for(int k = j+1; k < n; k++) {
        if (l[i] < l[j] && l[j] < l[k] && l[k] - l[j] < l[i]) {
          ans++;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main(void){
  int n,i,b;
  int card[4][13]={{}};
  cin >> n;
  char a;
  for(i = 0;i < n;i++) {
    cin >> a >> b;
    switch(a){
    case 'S':
      card[0][b - 1]=1;
      break;
    case 'H':
      card[1][b - 1]=1;
      break;
    case 'C':
      card[2][b - 1]=1;
      break;
    case 'D':
      card[3][b - 1]=1;
      break;
    }
  }
  for(i = 0;i < 52;i++) {
    switch(i / 13){
    case 0:
      if(card[0][i % 13]==0) cout << "S " << i + 1 << endl;
      break;
    case 1:
      if(card[1][i % 13]==0) cout << "H " << i % 13 + 1 << endl;
      break;
    case 2:
      if(card[2][i % 13]==0) cout << "C " << i % 13 + 1 << endl;
      break;
    case 3:
      if(card[3][i % 13]==0) cout << "D " << i % 13 + 1 << endl;
      break;
    }
  }

  return 0;
}



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


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


void solve() {
	int n; cin >> n;
	int k; cin >> k;
	int c = 0;
	rep(i, n) {
		int h; cin >> h;
		if (h >= k) c++;
	}
	cout << c << endl;
}

int main() {


	solve();


	return 0;
}

Measured memory_bytes: 256
#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 rep(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define trav(a, x) for(auto& a : x)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) static_cast<int>(x.size())
#define mp make_pair
#define fi first
#define se second

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

void buff() { ios::sync_with_stdio(false); cin.tie(nullptr); }

constexpr ll MOD = 1e9 + 7;

inline ll pow_mod(ll a, ll b, ll mod = MOD) {
    ll res = 1; a %= mod; assert(b >= 0);
    for(;b;b>>=1) {
        if(b & 1) res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

template<typename T> inline void remin(T& x, const T& y) { x = min(x, y); }
template<typename T> inline void remax(T& x, const T& y) { x = max(x, y); }

template<typename T> ostream& operator<<(ostream &os, const vector<T>& v) {
    os << "{"; string sep; for(const auto& x : v) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename T, size_t size> ostream& operator<<(ostream& os, const array<T, size>& arr) {
    os << "{"; string sep; for(const auto& x : arr) os << sep << x, sep = ", "; return os << "}"; 
}

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { 
    return os << '(' << p.first << ", " << p.second << ')'; 
}

int main() {
    buff();
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll res = a * c;
    remax(res, a * d);
    remax(res, b * c);
    remax(res, b * d);
    cout << res << endl;
    return 0;
}



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

int main() {
    int n, s, alice=0 ,bob=0;
    vector <int> a;
    //vector<int>::iterator ita = a.begin();

    cin >> n ;
    for(int i=0;i<n;i++){
        cin >> s;
        a.push_back(s);
    }

    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    for(int i=0; i<n; i++){
        if(i%2==0){
            alice += a.at(i);
        }else{
            bob += a.at(i);
        }
    }



    cout << alice-bob << endl;
}


Measured memory_bytes: 256
N = int(input())

S = []
for i in range(N):
    S.append(int(input()))
    
score = sum(S)

not_mod10 = list(filter(lambda x:x%10!=0,S))

if score%10==0 and len(not_mod10)>0: score -= min(not_mod10)
    
if score%10==0:
    print(score%10)
else:
    print(score)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define mod 1000000007
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const double PI = acos(-1.0);

vector<int> bfs(int n, vector<vector<int>> &adj)
{
    vector<bool> vis(n + 1, false);
    vector<int> ans(n + 1, -1);
    vis[1] = false;
    queue<pii> q;
    q.push({1, 1});
    while(!q.empty())
    {
        pii u = q.front();
        q.pop();
        vis[u.ff] = true;
        ans[u.ff] = u.ss;
        for(int v : adj[u.ff])
        {
            if(!vis[v])
            {
                q.push({v, u.ff});
                vis[v] = true;
            }
        }
    }
    return ans;
}

void cp()
{
    int n, m;
    cin >> n >> m;
    vector<vector<int>> adj(n + 1);
    for(int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    vector<int> ans = bfs(n, adj);
    for(int i = 2; i <= n; i++)
    {
        if(ans[i] == -1)
        {
            cout << "No";
            return;
        }
    }
    cout << "Yes\n";
    for(int i = 2; i <= n; i++)
    {
        cout << ans[i] << endl;
    }
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 10532
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main(void){
  ll a,b;
  cin >> a >> b;
  cout << a * b / gcd(a,b) << endl;
  return 0;
}


Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
def cal(d)
  min=INF
  N.times do|i|
      (i+1).upto(N) do|j|
          val=min((d[i]-d[j]).abs,24-(d[i]-d[j]).abs)
          min=val if min>val
      end
  end
  return min
end
d=get_i.sort
d.unshift(0)
N.times do|i|
    if i.even?
        d[i]=24-d[i]
    end
end
v1=cal(d)
N.times do|i|
    d[i]=24-d[i]
end
v2=cal(d)
puts max(v1,v2)

Measured memory_bytes: 14356
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n;
int a[200100];
int main(){
	cin>>n;
	REP(i,n)cin>>a[i];
	int t=0;
	for(int i=0;i<n;i++){
		if(a[i]==t+1){
			t++;
		}
	}
	if(t==0)cout<<-1<<endl;
	else cout<<(n-t)<<endl;
	return 0;
}

Measured memory_bytes: 1024