akhauriyash/Code-Regression huggingface dataset:
/*
数直線上にいるAさんとBさんとCさんがトランシーバーで会話をしようとしています。 Aさんは a [m] 地点、Bさんは b [m] 地点、Cさんは c [m] 地点にいます。 二人の人間は、距離が d [m] 以内のとき直接会話が出来ます。 AさんとCさんが直接的、あるいは間接的に会話ができるか判定してください。 ただしAさんとCさんが間接的に会話ができるとは、AさんとBさんが直接会話でき、かつBさんとCさんが直接会話できることを指します。

制約
1 ≤ a,b,c ≤ 100
1 ≤ d ≤ 100
入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。

a b c d
出力
会話できるなら Yes を, できないなら No を出力せよ。
*/

#include <stdio.h>
#include <stdlib.h>
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(abs(a-c)<=d)
	printf("Yes");
	else if(abs(a-b)<=d&&abs(b-c)<=d)
	printf("Yes");
	else
	printf("No");
	return 0;
}

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

int main() {
	int cnt = 0,n,a;
	map<int,bool> mp;
	cin>>n;
	for(int i = 0;i<n;i++) {
		cin>>a;
		if(mp[a]) {
			mp[a] = 0;
			cnt--;
		} else {
			mp[a] = 1;
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 4864
#include <iostream>

using namespace std;

int main(void) {
  long long int n, m;
  cin >> n >> m;

  long long int cc = m / 2;
  if(n >= cc) {
    cout << cc << endl;
  }
  else {
    long long int c = cc - n;
    cout << n + c / 2 << endl;
  }
}

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

int main(){
  int N, sum, c; cin >> N;
  vector<int> a(N); vector<int> b(N);
  
  sum = 0;
  for(int i = 0; i < N ; i++){
    cin >> a.at(i);
  }
  
  for(int i = N; i > 0; i--){
    int x = N / i;
    for(int j = 1; j < x + 1; j++){
      sum += b.at(i * j - 1);
    }
     if(sum % 2 != a.at(i - 1))
       b.at(i - 1) = 1;

    sum = 0;
  } 
      int count = 0;
      for(int i = 0; i < b.size(); i++){
        if(b.at(i) == 1)
          count++;
      }
  cout << count<< endl;
  
  for(int i = 0; i < b.size(); i++){
    if(b.at(i) == 1)
    cout << i + 1 << " ";
  		}
	cout << endl;
}      

Measured memory_bytes: 2432
#include<stdio.h>

int main(){
  long long n,x,m,sum=0,point=0;
  long long ans=0;
  scanf("%lld %lld %lld",&n,&x,&m);
  
  long long amari[m+1];
  long long damage[m+1][2];
  
  for(long long i=0;i<m;i++){
    damage[i][1]=0;
  }
  
  amari[0]=0;
  amari[1]=x;
  
  for(long long i=2;i<=2*m;i++){
    amari[i]=(amari[i-1]*amari[i-1])%m;
    damage[amari[i]][1]+=1;
    if(damage[amari[i]][1]>1){
      point = i-1;
      break;
    }else{
      damage[amari[i]][2]=i;
    }
  }
  
  for(long long i=damage[amari[point+1]][2];i<=point;i++){
    sum+=amari[i];
  }
  
  long long dist = point - damage[amari[point+1]][2]+1;
  
  for(long long i=1;i<=damage[amari[point+1]][2]-1;i++){
    ans+=amari[i];
  }
  
  n = n - damage[amari[point+1]][2] + 1;
  
  ans+=sum*((n-n%dist)/dist);
  
  for(long long i=damage[amari[point+1]][2];i<=damage[amari[point+1]][2]+(n%dist)-1;i++){
    ans+=amari[i];
  }
  
  printf("%lld",ans);
  return 0;
}

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

#define int long long
const int INF = 1e9;

signed main() {
  int n, k;
  cin >> n >> k;

  int o;
  for ( int i = 0; i < n; i++ ) {
    int a;
    cin >> a;
    if ( a == 1 ) o = i;    
  }

  int ans = INF;
  for ( int i = 0; i < n; i++ ) {
    if ( i+k-1 >= n ) break;
    if ( i > o ) break;    
    if ( i+k-1 >= o ) {
      int a = 0, b = 0;
      if ( i ) a = (i-1)/(k-1)+1;
      if ( i+k-1 < n-1 ) b = (n-(i+k)-1)/(k-1)+1;
      ans = min(ans, a+b + 1);      
    }
  }

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


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a[5];
	
	for(int i=0;i<5;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+5);
	
	printf("%d %d %d %d %d\n",a[4],a[3],a[2],a[1],a[0]);
	
	return 0;
}

Measured memory_bytes: 1040
#include<bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a; i<=b; ++i)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using vl=vector<ll>;
using vp=vector<pll>;
const ll INF=1e18;
const ll MOD=998244353;

struct node{
    ll val;
    node(ll val=0):val(val){}
    void updt(node& a,node& b){
        val=(a.val+b.val)%MOD;
    }
};
struct seg{
    ll base;
    vector<node> v;
    seg(ll n,ll* arr=NULL){
        base=1;
        while(base<n) base<<=1;
        v.resize(base<<1);
        if(arr==NULL) return;
        FOR(i,1,n) v[base+i-1]=arr[i];
        for(ll i=base-1; i; --i){
            v[i].updt(v[i<<1],v[i<<1|1]);
        }
    }
    void updt(ll idx,ll val){
        idx+=base-1;
        (v[idx].val+=val)%MOD;
        while(idx){
            idx>>=1;
            v[idx].updt(v[idx<<1],v[idx<<1|1]);
        }
    }
    ll query(ll l,ll r){return query(l,r,1,base,1);}
    ll query(ll l,ll r,ll s,ll e,ll vi){
        if(l<=s && e<=r) return v[vi].val;
        if(r<s || e<l) return 0;
        ll m=s+e>>1;
        ll lval=query(l,r,s,m,vi<<1);
        ll rval=query(l,r,m+1,e,vi<<1|1);
        return (lval+rval)%MOD;
    }
};

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,k;
    cin>>n>>k;
    vp lr;
    FOR(i,1,k){
        ll a,b;
        cin>>a>>b;
        lr.eb(a,b);
    }
    seg tree(n+5);
    tree.updt(1,1);
    FOR(i,2,n){
        for(pll& p:lr){
            tree.updt(i,tree.query(i-p.se,i-p.fi));
        }
    }
    cout<<tree.query(n,n);
    return 0;
}

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

int main() {
    set<int> q;
    vector<int> q2;
    for(int i = 2; i <= 100000; i++) {
        int j;
        for(j = 2; j < i; j++) {
            if(i % j == 0) break;
        }
        if(j == i) {
            q.insert(j);
            if(j % 2 == 1) {
                auto it = q.find((j + 1) / 2);
                if(it != q.end()) {
                    q2.push_back(j);
                }
            }
        }
    }
    /*
    int size = q2.size();
    auto itr = q2.begin();
    for(int i = 0; i < size; i++) {
        cout << *itr << endl;
        itr++;
    }
    */

    int qi;
    cin >> qi;
    for(int i = 0; i < qi; i++) {
        int l, r;
        cin >> l >> r;
        int cnt = 0;
        vector<int>::iterator iter = q2.begin();
        int size = q2.size();
        for(int j = 0; j < size; j++) {
            if(*iter >= l && *iter <= r) cnt++;
            if(*iter >= r) break;
            iter++;
        }
        cout << cnt << endl;
    }

    return 0;
}


Measured memory_bytes: 1152
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  ll n1 = abs(n - k * (n / k));
  ll n2 = abs(n1 - k);

  cout << (n1 > n2 ? n2 : n1);

  return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

int main() {
	string a, b;
	cin >> a >> b;
	for (int i = 0; i <= a.length() - b.length(); ++i) {
		bool same = false;
		for (int j = 0; j < b.length(); ++j) {
			if (a[i + j] != b[j] && b[j] != '_') { same = 1; }
		}
		if (!same) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  vector<int> v(m),b(m),a(n);
  for(int i=0;i<m;i++) cin>>v.at(i)>>b.at(i);
  for(int i=0;i<n;i++) a.at(i)=0;
  for(int i=0;i<m;i++){
    a.at(v.at(i)-1)++;
    a.at(b.at(i)-1)++;
  }
  for(int i=0;i<n;i++){
    cout<<a.at(i)<<endl;
  }
}


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

const int MAX_SIZE = 50;
char A[MAX_SIZE][MAX_SIZE];
char B[MAX_SIZE][MAX_SIZE];

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

  for (int y = 0; y < N; y++) {
    for (int x = 0; x < N; x++) {
      cin >> A[y][x];
    }
  }
  for (int y = 0; y < M; y++) {
    for (int x = 0; x < M; x++) {
      cin >> B[y][x];
    }
  }

  bool exist = false;
  for (int dy = 0; dy < N; dy++) {
    for (int dx = 0; dx < N; dx++) {
      // テンプレート画像が収まらない場合、判定を行わない
      if (dy + M - 1 >= N || dx + M - 1 >= N) continue;

      bool match = true;
      for (int y = 0; y < M; y++) {
        for (int x = 0; x < M; x++) {
          if (A[dy + y][dx + x] != B[y][x]) match = false;
        }
      }
      if (match) exist = true;
    }
  }

  printf("%s", exist ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
import math
from fractions import Fraction
n = int(input())

pt = [0] * n
pa = [0] * n

for i in range(n):
  t, a = map(int, input().split())
  if i == 0:
    pt[0] = t
    pa[0] = a
  else:
    tmp = math.ceil(max(Fraction(pt[i-1], t), Fraction(pa[i-1], a)))
    pt[i]=tmp*t
    pa[i]=tmp*a

print(int(pt[-1] + pa[-1]))      

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int x, y;
	cin >> x >> y;

	cout << (x + y/2) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	map<int,int>ma;
	int a,b,c;
	cin>>a>>b>>c;
	ma[a]=ma[b]=ma[c]=1;
	cout<<ma.size()<<endl;
}
/*int main(){
	int n,m,s;
	while(cin>>n>>m>>s,n+m+s){
		vvi in(n,vi(3));
		rep(i,n)rep(j,3)cin>>in[i][j];
		vvp area(n);
		rep(i,n)rep(j,n){
			
		}
	}
}//*/












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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  int ca=c-a;
  if(ca<0)ca*=-1;
  int cb=c-b;
  if(cb<0)cb*=-1;
  int ba=b-a;
  if(ba<0)ba*=-1;
  
  if(ca<=d){
    cout << "Yes" << endl;
    return 0;
  }
  else if(cb<=d && ba<=d){
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}


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

int dig_sum(int n) {
	int sum = 0;
	while (n > 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

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

	int d = dig_sum(N);
	if (N % d == 0)
		cout << "Yes\n";
	else
		cout << "No\n";

	return 0;
}


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

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

	for(int p=0; p < q; p++){
		int num;
		int count = 0;
		cin >> num;

		while(num / 10 != 0){
			int n, m, maxNum = 0;
			for(int d = 10; num / d != 0; d *= 10){
				maxNum = max(maxNum, (num/d) * (num % d));
			}
			num = maxNum;
			count++;
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 1164
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
from math import cos,sin,tan,sqrt
import cmath as cma
import copy as cp
import sys
import re
sys.setrecursionlimit(10**7)
EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf
MOD = 10**9 + 7

def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def adj(n): return [[] for _ in range(n)]

n = iinput()
a = iarr()
amax = max(a)

# ふるって生き残ったやつがTrue
dp = [1 for i in range(amax+1)]
for num in a:
    for i in range(2, amax//num + 1):
        tmp = num * i
        if dp[tmp]: dp[tmp] = 0

# カウンター
cnt = col.Counter(a)

# 生き残っていて、かつ、１回だけ登場するやつ
ans = 0
for key,val in cnt.items():
    if dp[key] and val==1: ans += 1

print(ans)


Measured memory_bytes: 72676
#include "stdio.h"

int pt[10000][3];
int grade[10000];//A0 B1 C2 D3 F4
int cnt=0;
int i;
int main(void){
	while(1){
		scanf("%d %d %d",&pt[cnt][0],&pt[cnt][1],&pt[cnt][2]);
		if((pt[cnt][0]==-1)&(pt[cnt][1]==-1)&(pt[cnt][2]==-1)) break;
		cnt++;
	}//3人ならcnt3
	for(i=0;i<cnt;i++){
	int goukei=pt[i][0]+pt[i][1];
		if((pt[i][0]==-1)||(pt[i][1]==-1)) grade[i]=4;
		else{
			
			if(goukei>=80) grade[i]=0;
			if((goukei>=65)&(goukei<80)) grade[i]=1;
			if((goukei>=50)&(goukei<65)) grade[i]=2;
			if((goukei>=30)&(goukei<50)){
			if(pt[i][2]>=50) grade[i]=2;
			else grade[i]=3;
			}
			if(goukei<30) grade[i]=4;
		}
		printf("%c\n", "ABCDF"[grade[i]]); 
	}
	
	return 0;
}

Measured memory_bytes: 604
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

const double BASE = 100;

int main(){

	int n,year,id,type,max_id;
	double r,max_rate,tmp;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		scanf("%d",&year);

		max_rate = 0;

		for(int i = 0; i < n; i++){
			scanf("%d %lf %d",&id,&r,&type);
			if(type == 1){
				tmp = BASE*((100+year*r)/100);
				if(tmp > max_rate){
					max_rate = tmp;
					max_id = id;
				}
			}else{
				tmp = BASE*pow(((100+r)/100),year);
				if(tmp > max_rate){
					max_rate = tmp;
					max_id = id;
				}
			}
		}
		printf("%d\n",max_id);
	}
    return 0;
}

Measured memory_bytes: 2784
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
#define int long long
signed main(){
    int A, B, C;
    cin >> A >> B >> C;
    if(A == B && B == C)cout << "No";
    else if(A != B && B != C && A != C)cout << "No";
    else cout << "Yes";
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

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

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

    ll ans = 0;
    if(n%2 == 1){
        ans = b[(n+1)/2-1]-a[(n+1)/2-1]+1;
    } else {
        ll asum = (a[(n/2)-1]+a[(n/2)]);
        ll bsum = (b[(n/2)-1]+b[(n/2)]);
        ll aa = asum/2;
        ll bb = bsum/2;
        ans = (bb-aa)*2 + 1;
        if(asum%2 == 1){
            ans -= 1;
        }
        if(bsum%2 == 1){
            ans += 1;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 6408
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>


void sort(int* rep) {
	int temp;
	for (int i = 0; i < 2; i++) {
		if (rep[i] > rep[i + 1]) {
			temp = rep[i];
			rep[i] = rep[i + 1];
			rep[i + 1] = temp;
			i = -1;
		}
	}
}

int main() {
	
	int a[3];

	std::cin >> a[0] >> a[1] >> a[2];

	sort(a);

	printf("%d %d %d\n", a[0], a[1], a[2]);

	//system("pause");
	return 0;
}


Measured memory_bytes: 3156
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>

#define labs

int cost(int a, int b, int c, int l[], int n, int flags[])
{
    int x = 0, y = 0, z = 0;
    int i;
    int mp_cost = 0;

    for (i = 0; i < n; i++) {
        if (flags[i] == 1) {
            if (x != 0) {mp_cost += 10;}
            x += l[i];
        }
        if (flags[i] == 2) {
            if (y != 0) {mp_cost += 10;}
            y += l[i];
        }
        if (flags[i] == 3) {
            if (z != 0) {mp_cost += 10;}
            z += l[i];
        }
    }

    if (x == 0 || y == 0 || z == 0) {return -1;}

    mp_cost += abs(x - a);
    mp_cost += abs(y - b);
    mp_cost += abs(z - c);

    return mp_cost;
}

int main(int argc, char *argv[])
{
    int n, a, b, c;
    int l[8];
    int flags[8];
    int i, j;
    int ans;
    int cost_r;

    scanf("%d %d %d %d", &n, &a, &b, &c);

    for (i = 0; i < n; i++) {
        scanf("%d", &l[i]);
    }

    ans = INT_MAX;

    j = 1 << (n * 2);
    for (i = 0; i < j; i++) {
        flags[0] =  i      & 0x03;
        flags[1] = (i>>2)  & 0x03;
        flags[2] = (i>>4)  & 0x03;
        flags[3] = (i>>6)  & 0x03;
        flags[4] = (i>>8)  & 0x03;
        flags[5] = (i>>10) & 0x03;
        flags[6] = (i>>12) & 0x03;
        flags[7] = (i>>14) & 0x03;

        cost_r = cost(a, b, c, l, n, flags);
        if (cost_r == -1) {continue;}
        if (cost_r < ans) {ans = cost_r;}
    }

    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 128
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
	  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
	   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
		   # #  # # #                   # #      ###### #    # #    # #      #####
	  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
	   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LL i = 0; i < (n); i++)
#define FOR(in) for(LL i=1; i <= (n); i++)
#define pb push_back
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 
 
LL concate(LL a, LL b)
{
	ostringstream os;
	os <<a <<b;
	istringstream is(os.str());
	LL c;
	is>> c;
	return c;
}
 
LL binpow(LL a, LL b, LL c)
{
	a %= c;
	LL res = 1 ;
	while(b > 0){
		if(b & 1)
		res = res * a % c ;
		a = a * a % c ;
		b >>= 1;
		//cout<<res<<endl;
	}
	return res;
}
 
LL check(char vowel)
{
	return vowel=='a' || vowel=='e' || vowel=='i' || vowel=='o' || vowel=='u';
}
LL mod = 1e9+7;
 
 
int main()
{
	//LL q,t;
	//cin>>t;
	//while(t--)
	//{
	    LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
		LL aa[1000];
		LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
		LL ma=0, mi=100000000;
		LL mid=0, temp=0, stop=0, start=0;
		double pi= 3.141592653589793;
		double d1=0.0, d2, d3, d4;
		VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
		VS vs, vs1, vs2, vs3, vs4;
		VP vp, vp1,vp2;
		char ch, ch1, ch2[1001];
		string str, str1, str2, str3, str4, str5;
		pair<LL, LL> pa;
		list<LL> li, li1;
		map<LL, LL> mp, mp1;
		set<LL> st;
		map<LL ,LL> :: iterator imll;
		VLL :: iterator ivll;
		set<LL> :: iterator isll;
		VP :: iterator ivp;
 

		cin>>n;
		if(n<=1000)cout<<1000-n<<endl;
		else 
		{
			if(n%1000==0)cout<<0<<endl;
			else cout<<1000-(n%1000)<<endl;
		}
		
	//}
	exit()
 
 
}


Measured memory_bytes: 3612
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
// using namespace std;

// using ll=long long;
// template<class T> using V = vector<T>;
// template<class T, class U> using P = pair<T, U>;
// using vll = V<ll>;
// using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
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; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;

int n;
std::vector<int> a, b;

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cin >> n;
    a.resize(n), b.resize(n);
    for (int i = 0; i < n; i++) std::cin >> a[i];
    for (int i = 0; i < n; i++) std::cin >> b[i];

    int ans = 1e9;
    for (int state = 0; state < (1 << n); state++) {
        std::vector< std::pair<int, int> > odd, even, tmp;
        for (int i = 0; i < n; i++) {
            if ((state >> i) & 1) {  // a
                if (i & 1) odd.emplace_back(a[i], i);
                else even.emplace_back(a[i], i);
            } else {  // b
                if (i & 1) even.emplace_back(b[i], i);
                else odd.emplace_back(b[i], i);
            }
        }
            
        if (odd.size() != n / 2) continue;

        sort(ALL(odd)); sort(ALL(even));

        tmp.clear();
        for (int i = 0; i < n / 2; i++) {
            tmp.emplace_back(even[i]);
            tmp.emplace_back(odd[i]);
        }
        if (n & 1) tmp.emplace_back(even.back());

        // for (int i = 0; i < n; i++) std::cout << tmp[i].first << ' ' << tmp[i].second << '\n';
        // std::cout << '\n';

        bool is_valid = true;
        for (int i = 1; i < n; i++) if (tmp[i].first < tmp[i - 1].first) {
            is_valid = false;
            break;
        }
        if (!is_valid) continue;

        int tmpa = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (tmp[i].second > tmp[j].second) tmpa++;
            }
        }
        chmin(ans, tmpa);
    }
    if (ans == 1e9) ans = -1;
    std::cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define ins insert
#define aer(v) (v).erase((v).begin(),(v).end()) 

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

double a,b;

main(){
	cin>>a>>b;
	printf("%.8lf",a/b);
}


Measured memory_bytes: 256
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {long long int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


LL N;
int ret = 0;
char V[] = {'3', '5', '7'};


int all_used(string S) {
	int flag_used = 1;
	for (int j = 0; j < 3; j++) {
		int f = 0;
		for (int k = 0; k < SZ(S); k++) {
			if (S[k] == V[j]) {
				f = 1;
				break;
			}
		}
		if (f == 0) {
			return 0;
		}
	}
	return 1;
}


void dfs(int i, int size, string S) {
	//cout << "i:" << i << ", size:" << size << endl;
	if (i == size) {
		//cout << toInt(S) << endl;
		if (toInt(S) <= N && all_used(S) == 1) {
			ret++;
		}
	} else {
		for (int j = 0; j < 3; j++) {
			dfs(i + 1, size, S + V[j]);
		}
	}
}


int main() {
	cin >> N;

	for (int b = 3; b <= 10; b++) {
		dfs(1, b, "");
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int n,i,j,l,a=0;
	int ar[4][13]={{0}};
	char s,kaigyokun=0;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++)
	{
		scanf("%c",&kaigyokun);
		scanf("%c %d", &s, &l);
		
		if(s == 'S') a = 0;
		else if (s == 'H') a = 1;
		else if (s == 'C') a = 2;
		else if (s == 'D') a = 3;
		
		ar[a][l-1] = 1;
	}
	
	for(i = 0; i < 4; i++)
	{
		for(j = 0; j < 13; j++)
		{
			if((ar[i][j]) != 1)
			{
				if(i == 0) s = 'S';
				else if (i == 1) s = 'H';
				else if (i == 2) s = 'C';
				else if (i == 3) s = 'D';
				
				printf("%c %d\n", s, j+1 );
			}
		}
	}
	
	return 0;
}



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

int main() {
  int A,B,C;
  cin >>A>>B>>C;
  if (C>=(A-B)){
    cout<<C-A+B<<endl;
  }
  if (C<(A-B)){
    cout <<0<<endl;
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

int main() {
	
	ll N;
	cin>>N;
	ll ans=1;
	while(N>0){
		ans*=N;
		ans%=MOD;
      N--;
	}
	ce(ans)
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll arr[59];
ll prr[109];
map<ll,ll>mp;
vector<ll>pr;
int main()
{
   ll i,j,k,l,p,q,r,s,t,n,m;
   string str;
   cin>>str;
   if(str[2]==str[3]&&str[4]==str[5])
     cout<<"Yes"<<'\n';
    else
    cout<<"No"<<'\n';  
   	
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::{Chars, Usize1};
use std::iter::Iterator;
use std::collections::*;
use std::cmp::*;
use itertools::Itertools;

#[allow(unused_macros)]
macro_rules! max {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      max($x,max!($($xs)+))
    };
  }
  
  #[allow(unused_macros)]
  macro_rules! min {
    ($x:expr) => {
      $x
    };
    ($x:expr, $($xs:tt)+) => {
      min($x,min!($($xs)+))
    };
  }

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    input! {
    a: i64,
    b: i64,
    c: i64,
    d: i64,
    }

    let mut ans = 0;
    if b * d > a * c {
      ans = b * d;
    }else{
      ans = a * c;
    }

    if ans < a * d {
      ans = a * d
    }

    if ans < b * c{
      ans = b * c
    }

     println!("{}", ans);
}


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

using namespace std;
const long long INF = 1e0 + 1;
const int mxN = 1e5 + 1;

int main(){
	vector<vector<int> > v(mxN,vector<int> (3,0));
	vector<vector<long long> > dp(mxN,vector<long long> (3,0));
	int n;
	
	cin>>n;
	
	for(int i = 0 ; i<n; i++){
		for(int j = 0; j < 3; j++){
			int x; 
			cin>>x;
			v[i][j] = x;
		}
	}
	
	dp[0][0] = v[0][0];
	dp[0][1] = v[0][1];
	dp[0][2] = v[0][2];
	
	
	for(int i = 1 ; i < n; i++){
		for(int j = 0 ; j < 3 ; j++){
			for(int activity = 0; activity < 3 ; activity ++){
				if (j != activity){
					dp[i][j] = max(dp[i][j], v[i][j] + dp[i-1][activity]);
				}
			}
		}
	}
	
	long long ans_temp = max(dp[n-1][0],dp[n-1][1]);
	long long ans = max(ans_temp,dp[n-1][2]);
	
	cout<<ans;
}
	
	
	


Measured memory_bytes: 13900
// failed to generate code

#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}
typedef vector<long long> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique((c).begin(), (c).end()), (c).end());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;


int main() {
	int N, K;
	VI H;
	cin >> N >> K;
	H.resize(N);

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

	SORT(H);

	LL min_d = 1e10;
	REP(i, N - K + 1) {
		LL d = H[i + K - 1] - H[i];
		if (d < min_d) {
			min_d = d;
		}
	}

	cout << min_d << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<cmath>
#include<queue>
#include<bits/stdc++.h>
using namespace std;

//long  s[112345];
priority_queue<int> q;
int main()
{
	int i,n,m;
 	cin>>n>>m;
 	int k;
	for(i=0;i<n;i++){
		cin>>k;
		q.push(k); 
	}
	for(i=1;i<=m;i++){
		k=q.top() ;
		k/=2;
		q.pop() ;
		q.push(k); 
	}
	long long ss=0;
	while(!q.empty() ){
		ss+=q.top() ;
		q.pop();
	}
	cout<<ss<<endl;
	return 0;
}

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

#define pb push_back
#define sz(X) ((int)(X).size())
#define all(X) (X).begin(),(X).end()
#define ll long long
#define pi pair<int,int>
const int N=3e5+5,MOD=1e9+7;

using namespace std;

ll n,x;
string a;
int ans;
int main()
{
	//freopen("tst.txt","r",stdin);
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>n;
	ll mn = 1e18;
	for(int i=0;i<5;i++)cin>>x,mn=min(mn,x);
	cout<<n/mn+4+((n%mn)>0)<<"\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> class sumBIT
{
private:
  int S;
public:
  T *bit;
  sumBIT(int S0){
    S=S0;
    bit=(T *)calloc(sizeof(T),1<<S);
  }
  void add(int i,T k){
    int p=i+1;
    while(p<1<<S){
      bit[p]+=k;
      p+=p&-p;
    }
  }
  T sum(int p){
    T ret=0;
    while(p>0){
      ret+=bit[p];
      p-=p&-p;
    }
    return ret;
  }
  T rag(int a,int b){
    return sum(b)-sum(a);
  }
};

double mid(int n,vector<double> &a,vector<double> &b,vector<double> &c)
{
  vector<pair<double,double> > P(n);
  for(int i=0;i<n;i++){
    P[i]=make_pair(-a[i]/b[i],c[i]/b[i]);
  }
  sort(P.begin(),P.end());
  double L=-1e9,R=1e9;
  long long m2=((long long)n*(n-1)/2+1)/2;
  sumBIT<int> bit(17);
  for(int t=0;t<80;t++){
    for(int x=0;x<1<<17;x++){
      bit.bit[x]=0;
    }
    double M=(R+L)/2;
    vector<pair<double,int> > P2(n);
    long long cnt=0;
    for(int i=0;i<n;i++){
      P2[i]=make_pair(M*P[i].first+P[i].second,i);
    }
    sort(P2.begin(),P2.end());
    for(int i=0;i<n;i++){
      int j=P2[i].second;
      cnt+=bit.sum(j);
      bit.add(j,1);
    }
    //printf("%lf %lld\n",M,cnt);
    if(cnt>=m2){
      R=M;
    }
    else{
      L=M;
    }
  }
  return (R+L)/2;
}

int main()
{
  int n;
  scanf("%d",&n);
  vector<double> a(n),b(n),c(n);
  for(int i=0;i<n;i++){
    scanf("%lf%lf%lf",&(a[i]),&(b[i]),&(c[i]));
  }
  printf("%.10lf %.10lf\n",mid(n,a,b,c),mid(n,b,a,c));
  return 0;
}


Measured memory_bytes: 4192
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String str1 = sc.next();
		String str2 = sc.next();

		if(str1.charAt(0) == str2.charAt(2) && str1.charAt(1) == str2.charAt(1) && str1.charAt(2) == str2.charAt(0))
			System.out.println("YES");
		else
			System.out.println("NO");
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

}


Measured memory_bytes: 21460
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto K = RD;

	writeln(N - K + 1);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
#084-D
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
B=[1]*(10**5+2)
B[0]=0
B[1]=0
for i in range(2,10**5+2):
    if B[i]==1:
        for j in range(i+i,10**5+2,i):
            B[j]=0
J=[0]*(10**5+1)
for i in range(1,10**5+1,2):
    if B[i]*B[(i+1)//2]==1:
        J[i]=1
for i in range(1,10**5+1):
    J[i]+=J[i-1]
q=I()
for i in range(q):
    l,r=IL()
    print(J[r]-J[l-1])

Measured memory_bytes: 7156
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define cint(d) scanf("%d", &d)
#define cint2(a, b) scanf("%d %d", &a, &b)
#define cint3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define cint4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
 
#define clong(d) scanf("%lld", &d)
#define clong2(a, b) scanf("%lld %lld", &a, &b)
#define clong3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define clong4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
 
#define foreach(v, c) for(__typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define revforeach(v, c) for(__typeof( (c).rbegin()) v = (c).rbegin();  v != (c).rend(); ++v)
#define ALL(v) (v).begin(), (v).end()
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
 
typedef long long int slong;
typedef pair<int, int> pii;
typedef pair<slong, slong> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
#ifdef VSP4 
    #include "debug.h"    
#else
    #define debug(args...)                  // Just strip off all debug tokens
#endif
 
const int MOD = 1e5 + 1;
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODADDSET(d) if ((d) >= MOD) d -= MOD;
#define MODADDWHILESET(d) while ((d) >= MOD) d -= MOD;
 
const int MAXN = 2e6;
const int SQRTN = 550;
const int LOGN = 60;
const int INT_INFINITY = 1001001001;
const int LIMIT = 1e5;
 
const slong LONG_INFINITY = 1001001001001001001ll;
const slong LONG_LIMIT = 800100100100101ll;
 
typedef complex<long double> base;
const long double PI = acos(-1);

int n;
int arr[MAXN+5];
 
int main()
{
	#ifdef VSP4
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	clock_t begin = clock();
	
	int t, i, j, x, y, u, v;
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cint(n);
	
	slong ans = LONG_INFINITY;
	slong total = 0;
	slong curr = 0;
	
	for (i = 1; i <= n; i++)
	{
		cint(arr[i]);
		total += arr[i];
	}
	
	for (i = 1; i < n; i++)
	{
		curr += arr[i];
		ans = min(ans, abs(curr - (total - curr)));
	}
	
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
w, h, n = map(int, input().split()) 
xya = [list(map(int, input().split())) for _ in range(n)]
lx = 0
rx = w
dy = 0
uy = h

for i in xya:
  if i[2] == 1:
    if lx < i[0]:
      lx = i[0]
  elif i[2] == 2:
    if rx >i[0]:
      rx = i[0]
  elif i[2] == 3:
    if dy < i[1]:
      dy = i[1]
  else:
    if uy > i[1]:
      uy = i[1]
if lx >= rx or uy < dy:
  print(0)
else:
  print((rx -lx) * (uy -dy))  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
  int A,B;
  string S;
  cin >> A >> B >> S;
  rep(i, A+B+1){
  if(i==A&&S[i]!='-'){
  cout <<"No" << endl;
    return 0;
  }
  if (i!=A&&S[i]=='-'){
  cout <<"No" << endl;
    return 0;
  }
    
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
from collections import deque

H, W = map(int, input().split())
data = deque()

for y in range(H):
    for x, v in enumerate(input()):
        if v == '#':
            data.append((y, x))

ans = [[-1 for _ in range(W)] for __ in range(H)]

for v in data:
    ans[v[0]][v[1]] = 0

"""
BFSまとめ

0. 
現在位置、履歴、アクション数の3要素が必要.
処理をLIFOでなく、FIFOでやる
そのため、collection.dequeを使う
更にソートしつつ、FIFOしたい場合は、heapqを使う

1. 
更新する, アクション数を加算する

2. 
条件を一致しているか、履歴に入っていないかを確認

3. 
popをループ
"""

d = 0
while len(data):
    y, x = data.popleft()
    d = ans[y][x]

    for i, j in ((-1, 0), (1, 0), (0, -1), (0, 1)):
        new_y = y + i
        new_x = x + j
        if new_y < 0 or H <= new_y or new_x < 0 or W <= new_x:
            continue
        if ans[new_y][new_x] == -1:
            ans[new_y][new_x] = d + 1
            data.append((new_y, new_x))

print(max([a for aa in ans for a in aa]))

Measured memory_bytes: 122460
#include <bits/stdc++.h>
using namespace std;
using Int = int_fast64_t;

Int gcd(Int x, Int y){
	while(x % y != 0){
		Int r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	Int k; cin >> k;
	Int ans = 0;
	for(Int i=1; i<=k; ++i)
		for(Int j=1; j<=k; ++j)
			for(Int l=1; l<=k; ++l)
				ans += gcd(gcd(i, j), l);
	cout << ans << "\n";
}


Measured memory_bytes: 3648
/*
            _ _  ___            __ _ _  _       _     
 _   _  ___| | |/ _ \__      __/ _| | || |  ___| |__  
| | | |/ _ \ | | | | \ \ /\ / / |_| | || |_/ __| '_ \ 
| |_| |  __/ | | |_| |\ V  V /|  _| |__   _\__ \ | | |
 \__, |\___|_|_|\___/  \_/\_/ |_| |_|  |_| |___/_| |_|
 |___/                 

*/

#include <bits/stdc++.h>
using namespace std;
#define sz(x) (ll)(x).size()
#define trav(x) for(auto it: x)
#define all(x) x.begin(), x.end()
#define stp fixed<<setprecision(20)
#define db(x) cout<<#x<<": "<<x<<endl
#define tc ll tt; cin>>tt; while(tt--)
#define For(i, st, en) for(ll i=st; i<en; i++)
#define rFor(i, st, en) for(ll i=st; i>=en; i--)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define printv(x) For(i, 0, sz(x)){cout<<x[i]<<" ";} cout<<endl;
#define print2v(x) For(i, 0, sz(x)){For(j, 0, sz(x[0])){cout<<x[i][j]<<" ";} cout<<endl;}
#define ll long long
#define int long long
#define F first
#define S second
#define pb push_back
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector< vector<int> > vvi;
typedef vector< pair<int, int> > vpi;
#define endl '\n'
#define MAXN 300005
#define MOD 1000000007
#define INF 1000000000000000007


signed main(){
	fast
	int n; cin>>n;
	vi a(n), c(n);
	int ans=0;
	For(i, 0, n){
		cin>>a[i];
	}
	int temp;
	For(i, 0, n){
		cin>>temp;
		ans+=temp;
	}
	For(i, 1, n){
		cin>>c[i];
	}
	// db(ans);
	// printv(c);
	For(i, 0, n-1){
		if(a[i]+1==a[i+1]){
			ans+=c[a[i]];
		}
	}
	cout<<ans<<endl;

    return 0;
}
    



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 998244353;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int mod_pow(int x,int y) {
    int res = 1;
    while(y > 0) {
        if(y%2) {
            res = res*x%mod;
        }
        x = x*x%mod;
        y/=2;
    }
    return res;
}
int fac[200005], finv[200005], inv[200005];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 200005; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
signed main() {
    COMinit();
    int N,M,K;
    cin >> N >> M >> K;
    int ans = 0;
    for(int i = 0; i <= K; i++) {
        ans += M*mod_pow(M-1,N-i-1)%mod*COM(N-1,i)%mod;
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8320
# 入力
N = int(input())
witness = [[-1] * N for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        witness[i][x - 1] = y

# 正直者の組を作り判定
ans = 0
for i in range(1, 2 ** N + 1):
    honest = [0] * N
    for j in range(N):
        if int(str(format(i, 'b')).zfill(N)[j]) == 1:
            honest[j] = 1

    is_correct = True
    for j in range(N):
        if honest[j] == 1:
            for k in range(N):
                if witness[j][k] == -1:
                    pass
                elif witness[j][k] != honest[k]:
                    is_correct = False
    if is_correct:
        ans = max(ans, sum(honest))

print(ans)


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

int main(){
  int n;

  while(cin>>n){
    vector<int> lunch,din,mid;
    if(!n)
      break;

    for(int i=0;i<n;++i){
      string s1,s2; cin>>s1>>s2;
      string sub(s1.substr(3));
      int ok = 0;
      int t1,t2;
      t1=stoi(sub);
      t2=stoi(s2); 
      if(t1>t2)
        t2+=60;
      if(abs(t2-t1)<=8)
        ok=1;

      if("00:00"<=s1&&s1<="00:59")
        s1.replace(s1.begin(),s1.begin()+2,"24");
      else if("01:00"<=s1&&s1<="01:59")
        s1.replace(s1.begin(),s1.begin()+2,"25");

      if("11:00"<=s1&&s1<="14:59"){
        lunch.push_back(ok);
      }
      else if("18:00"<=s1&&s1<="20:59"){
        din.push_back(ok);
      }
      else if("21:00"<=s1&&s1<="25:59"){
        mid.push_back(ok);
      }
    }
    // output
    if(lunch.size())
      cout<<"lunch "<<100*accumulate(lunch.begin(),lunch.end(),0)/lunch.size()<<endl;
    else
      cout<<"lunch no guest\n";
    if(din.size())
      cout<<"dinner "<<100*accumulate(din.begin(),din.end(),0)/din.size()<<endl;
    else
      cout<<"dinner no guest\n";
    if(mid.size())
      cout<<"midnight "<<100*accumulate(mid.begin(),mid.end(),0)/mid.size()<<endl;
    else
      cout<<"midnight no guest\n";

  }
  return EXIT_SUCCESS;
}

Measured memory_bytes: 1244