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

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

  int maxnum=1,num=0;

  for(int i=1;i<=N;i++) {
    int t=i,ma=0;
    for(int j=0;j<i;j++) {
      if(t%2==0) {
        ma++;
        t/=2;
      }
      else break;
    }
    if(ma>num) {
      maxnum=i;
      num=max(num,ma);
    }
  }
  cout << maxnum << endl;
}


Measured memory_bytes: 384
from heapq import heappop,heappush;import sys;input=sys.stdin.readline
x,y,z,k=map(int,input().split());a,b,c=list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))
q,h,l=[],[],0
for i in a:
  for j in b:heappush(q,-(i+j));l+=1
for _ in range(min(l,k)):
  t=heappop(q)
  for i in c:heappush(h,t-i)
for i in range(k):print(-heappop(h))

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

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(int argc, char const *argv[]) {
	int a,b;
	std::cin >> a >> b;
	int x = 0;
	for (size_t i = 0; i < b-a; i++) {
		x += i;
	}
	std::cout << x-a << '\n';
	return 0;
}


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

using namespace std;

const int MAXN = 120, MAXW = 1e5 + 20;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;

long long dp[MAXW];
int N, W, value[MAXN], weigth[MAXN];

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	cin >> N >> W;
	for(int i = 1; i <= N; i++) {
		cin >> weigth[i] >> value[i];
	}
	dp[0] = 0LL;
	for(int i = 1; i <= W; i++) {
		dp[i] = -INF;
	}
	for(int i = 1; i <= N; i++) {
		for(int j = W; j >= weigth[i]; j--) {
			dp[j] = max(dp[j], dp[j - weigth[i]] + value[i]);
		}
	}
	long long ans = 0LL;
	for(int i = 1; i <= W; i++) {
		ans = max(ans, dp[i]);
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
int main(void) {
	int t[5] = { 0 }, n[5] = { 0 },i,k[5];
	for (i = 1; i <= 4; i++) {
		scanf("%d %d", &t[i], &n[i]);
		switch(t[i]) {
		case 1:
			k[i] = 6000*n[i];
			break;
		case 2:
			k[i] = 4000 * n[i];
			break;
		case 3:
			k[i] = 3000 * n[i];
			break;
		case 4:
			k[i] = 2000 * n[i];
			break;
		}
	}
	for (i = 1; i <= 4; i++) {
		printf("%d\n", k[i]);
	}
	return 0;
}


Measured memory_bytes: 2040
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	ss := make([]int, n)
	for i := range ss {
		fmt.Scan(&ss[i])
	}

	sort.Ints(ss)
	var sum, d int
	for _, s := range ss {
		if d == 0 && s%10 != 0 {
			d = s
		}
		sum += s
	}

	if sum%10 == 0 {
		if d == 0 {
			fmt.Println(0)
		} else {
			fmt.Println(sum - d)
		}
	} else {
		fmt.Println(sum)
	}
}

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

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

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}


Measured memory_bytes: 1844
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
    map<string, int> mp;
    int N;
    cin >> N;
    while (N > 0) {
        string st = "";
        cin >> st;
        mp[st]++;
        N--;
    }

    int max_counts = 0;
    for (const auto &a : mp) {
        max_counts = max(a.second, max_counts);
    }
    for (const auto &a : mp) {
        if (a.second == max_counts) {
            cout << a.first << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    sort(all(vec),greater<int>());
    int a=0;
    int b=0;
    REP(i,n){
        if(!(i%2)){
            a+=vec[i];
        }else{
            b+=vec[i];
        }
    }
    cout<<a-b<<endl;
    return 0;
}

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

void solve(){
    int H, A;
    cin >> H >> A;
    int cnt = 0;
    while(H>0){
        H -= A;
        cnt ++;
    }
    cout << cnt << endl;
}

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

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

int main() {
    int64_t N, K;
    cin >> N >> K;
    int64_t ans = 1;
    int64_t pow = K;
    while (pow <= N) {
        pow *= K;
        ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NM = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, M) = (NM[0], NM[1]);

        var l = 0;
        var r = N - 1;

        for (int i = 0; i < M; i++)
        {
            var LR = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            var (L, R) = (LR[0] - 1, LR[1] - 1);

            l = Math.Max(l, L);
            r = Math.Min(r, R);
        }

        var ans = r - l + 1;
        if (ans < 0)
            ans = 0;

        WriteLine(ans);
    }
}


Measured memory_bytes: 46452
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val h1, h2 = sc.nextInt
    val k1, k2 = sc.nextInt
    val a, b, c, d = sc.nextInt
    val hiroshi = h1 * a + h1 / 10 * c + h2 * b + h2 / 20 * d
    val kenjiro = k1 * a + k1 / 10 * c + k2 * b + k2 / 20 * d
    if (hiroshi == kenjiro)
      (println("even"))
    else if (hiroshi > kenjiro)
      (println("hiroshi"))
    else
      (println("kenjiro"))

  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 45032
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a[1000],i,l,j;
  float k;
  
  cin>>n;
  for(i=0;i<n;i++)
  {
    cin>>a[i];
  }
  
  
 sort(a,a+n);
 k=a[0];
  for(i=1;i<n;i++)
  {
   
      k=(float)(k+a[i])/2;
  }
  cout<<k<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
H, W = map(int, input().split())
A, B = [None] * H, [None] * H
for i in range(H):
    A[i] = list(map(int, input().split()))
for i in range(H):
    B[i] = list(map(int, input().split()))
C = [[abs(A[i][j] - B[i][j]) for j in range(W)] for i in range(H)]
M = 80*(80+80)
dp = [[0 for j in range(W+1)] for i in range(H+1)]
dp[0][1] = 1
dp[1][0] = 1
for i in range(1, H+1):
    for j in range(1, W+1):
        d = C[i-1][j-1]
        if d != 0:
            x = int(bin((dp[i-1][j]&(2**d-1))+2**d)[::-1][:d], 2)<<1
            y = int(bin((dp[i][j-1]&(2**d-1))+2**d)[::-1][:d], 2)<<1
        else:
            x=y=0
        #print(bin(dp[i-1][j]), bin(dp[i-1][j]+(2**10)))
        dp[i][j] = (dp[i-1][j] >> d) | (dp[i-1][j] << d) | (dp[i][j-1] >> d) | (dp[i][j-1] << d) | x | y
        #print(i, j, d, bin(dp[i][j]))

for i, v in enumerate(bin(dp[H][W])[::-1]):
    if v == '1':
        print(i)
        break


Measured memory_bytes: 49368
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,a,b,ans=0;
    cin >> n >> a >> b;
    for(int i=1;i<=n;i++){
        int c = i%10+(i/10)%10+(i/100)%10+(i/1000)%10+(i/10000)%10;
        if(a <= c && c <= b){
            ans+= i;
        }
    }
    cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <unordered_map>
#include <queue>

int n,k;
std::unordered_map<int,long long> data;
int main(){
  std::cin>>n>>k;
  for(int i=0;i<n;++i){
    int temp;
    std::cin>>temp;
    ++data[temp];
  }
  
  if(data.size()<=k)
    std::cout<<"0"<<std::endl;
  else{
    std::priority_queue<int,std::vector<int>,std::greater<int>> que;
    for(auto&& p:data)
      que.push(p.second);
    long long ans=0;
    for(size_t i=0,count=data.size()-k;i<count;++i){
      auto value=que.top();
      ans+=value;
      que.pop();
    }
    std::cout<<ans<<std::endl;
  }
  return 0;
}


Measured memory_bytes: 10312
n = gets.chomp.to_i
n.times do
  a, b, c = gets.chomp.split
  a = a.to_i
  b = b.to_i
  c = c.to_i
  if a**2+b**2 == c**2
    puts "YES"
  elsif a**2+c**2 == b**2
    puts "YES"
  elsif b**2+c**2 == a**2
    puts "YES"
  else
    puts "NO"
  end
end




Measured memory_bytes: 6872
A, B = map(int, input().split())
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    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 == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)

Measured memory_bytes: 3064
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 500000
ll MOD=1e9+7;
vec mem(20,-1);
main(){
    int n=in();
    ll x=in();
    vector<ll> b,l,r,t;
    rep(i,n){
        b.pb(in());
        l.pb(in());
        r.pb(in());
        t.pb(l[i]*b[i]+(r[i])*(x-b[i]));
    }
    vec ind;
    rep(i,n)ind.pb(i);
    sort(all(ind),[&](int y,int z){
        return t[y]>t[z];
    });
    //cout<<t[0]<<" "<<t[1]<<endl;
    ll left=-1,right=110000000000ll;
    while(left<right-1){
        ll mid=(left+right)/2;
        ll mm=mid;
        ll tmp=0;
        rep(i,n){
            tmp-=b[i]*l[i];
        }
        int now=0;
        bool flag=false;
        while(mid>=x){
            tmp+=t[ind[now]];
            if(tmp>=0){
                flag=true;break;
            }
            mid-=x;
            now++;
        }
        if(flag){
            right=mm;continue;
        }
        ll MAX=0;
        ll T=1e11;
        rep2(j,0,now-1){
            int i=ind[j];
            if(mid>=b[i]){
                T=min(T,(x-mid)*r[i]);
            }
            else{
                T=min(T,(x-b[i])*r[i]+(b[i]-mid)*l[i]);
            }
        }
        rep2(j,now,n-1){
            int i=ind[j];
            if(mid>=b[i]){
                MAX=max(MAX,b[i]*l[i]+(mid-b[i])*r[i]);
            }
            else{
                MAX=max(MAX,l[i]*mid);
            }
            MAX=max(MAX,t[i]-T);
        }
        tmp+=MAX;
        if(tmp>=0)right=mm;
        else left=mm;
    }
    cout<<right;
}



Measured memory_bytes: 4308
import sys
import sys
import bisect
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def combination(n, r):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        return reduce(mul, range(n, n - r, -1)) // reduce(mul, range(1, r + 1))


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    for i in range(k):
        if n - k + 1 >= i + 1 and k - 1 >= i:
            print(combination(n - k + 1, i + 1) % mod * combination(k-1, i) % mod)
        else:
            print(0)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 70744
n = int(input())
s = input()
s = list(s)

count = 0
while len(s) > 2:
    if s[0] == "A" and s[1] =="B" and s[2] == "C":
        count += 1
        del s[0:2]
    else:
        del s[0]

print(count)


Measured memory_bytes: 9060
#include<stdio.h>
/*????????? partition sort ??????*/
#define MAX 100000
int partition(int *, int , int);
main()
{
  int i,n,p,r,q=0;
  int A[MAX];

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

  r = n-1;
  p = 0;

  if(p<r)
    {
      q = partition(A,p,r);
    }
  for(i=0;i<n;i++)
    {
      if(i == q)printf("[%d]",A[i]);
      else printf("%d",A[i]);
      if(i!=n-1)printf(" ");
    }
  printf("\n");
  return 0;

}

int partition( int *a,int p, int r)
{
  int x,i,j,ex;

  x = a[r];
  i = p-1;

  for(j=p;j<r;j++)
    {
      if(a[j]<=x)
	{
	  i = i+1;
	  ex = a[i];
	  a[i] = a[j];
	  a[j] = ex;
	}
    }
  ex = a[i+1];
  a[i+1] = a[r];
  a[r] = ex;
  

  return i+1;
}

Measured memory_bytes: 996
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			float L = Float.parseFloat(sc.next());
			float ippen = L / 3;
			float ans = ippen * ippen * ippen;
			System.out.println(ans);

		} finally

		{
			sc.close();
		}
	}

}


Measured memory_bytes: 21844
#include "stdio.h"
#include <vector>

using namespace std;

vector<int> miti[100];

int mflg[100];

int saiki(int a)
{
	if(mflg[a] != 0)
	{
		return 0;
	}
	int max = 0;
	mflg[a] = 1;
	for(int i = 0; i < miti[a].size(); i++)
	{
		int w = saiki(miti[a][i]);
		if(max < w)
		{
			max = w;
		}
	}
	mflg[a] = 0;
	return max + 1;
}

int main()
{
	while(1)
	{
		int n;
		scanf("%d",&n);
		if(n == 0)
		{
			break;
		}
		for(int i = 0; i < n; i++)
		{
			int a,b;
			scanf("%d %d",&a,&b);
			a--;
			b--;
			miti[a].push_back(b);
			miti[b].push_back(a);
		}
		int max = 0;
		for(int i = 0; i < 100; i++)
		{
			for(int ii = 0; ii < 100; ii++)
			{
				mflg[ii] = 0;
			}
			int w = saiki(i);
			if(max < w)
			{
				max = w;
			}
		}
		printf("%d\n",max);
		for(int i = 0; i < 100; i++)
		{
			miti[i].clear();
		}
	}
	return 0;
}

Measured memory_bytes: 1056
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
        }
        base = base * base;
        y = y >> 1;
    }
    return ans;
}

int main()
{
    fastinput;
    LL n,i,j,k,t,temp,tc,a,b;
    vector<LL> v;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>j;
        v.pb(j);
    }

    sort(all(v));
    LL sum=0;
    for(i=0;i<k;i++)
    {
        sum+=v[i];
    }
    cout<<sum<<endl;
    

    return 0;
}



Measured memory_bytes: 3656
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node{
	int key;
	Node *next,*prev;
};

Node *nil;

Node* listSearch(int key){
	Node *cur = nil ->next;
	while(cur != nil && cur -> key != key){
		cur = cur -> next;
	}
	return cur;
}

void init(){
	nil = (Node *)malloc(sizeof(Node));
	nil -> next = nil;
	nil -> prev = nil;
}

void printList(){
	Node *cur = nil -> next;
	int isf = 0;
	while(1){
		if(cur == nil)break;
		if(isf++ > 0)printf(" ");
		printf("%d",cur -> key);
		cur = cur -> next;
	}
	printf("\n");
}

void deleteNode(Node *t){
	if(t == nil)return;
	t -> prev -> next = t -> next;
	t -> next -> prev = t -> prev;
	free(t);
}

void deleteFirst(){
	deleteNode(nil -> next);
}

void deleteLast(){
	deleteNode(nil -> prev);
}

void deleteKey(int key){
	
	deleteNode(listSearch(key));
}

void insert(int key){
	Node *x = (Node *)malloc(sizeof(Node));
	x -> key = key;
	
	x -> next = nil -> next;
	nil -> next -> prev = x;
	nil -> next = x;
	x -> prev = nil;
}

int main(){
	int key,n,i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for(i = 0;i < n;i++){
		scanf("%s%d",com,&key);
		if(com[0] == 'i'){insert(key);np++;size++;}
		else if (com[0] == 'd'){
			if(strlen(com) > 6){
				if(com[6] == 'F')deleteFirst();
				else if(com[6] == 'L')deleteLast();
			}else{
				deleteKey(key);nd++;
			}
			size--;
		}
	}
	printList();
	
	return 0;
}
	

Measured memory_bytes: 33936
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int h, w;
	cin >> h >> w;
	string s[h];
	ll map[h][w][2];
	REP(i, h) REP(j, w) map[i][j][0] = map[i][j][1] = -1;
	REP(i, h) cin >> s[i];
	REP(i, h){
		REP(j, w){
			if (s[i][j] == '#') continue;
			if (j > 0 and map[i][j-1][0] != -1) map[i][j][0] = map[i][j-1][0];
			else {
				int k = 0;
				while (s[i][j+k] != '#' and j + k < w){
					k++;
				}
				map[i][j][0] = k;
			}
		}
	}
	REP(i, w){
		REP(j, h){
			if (s[j][i] == '#') continue;
			if (j > 0 and map[j-1][i][1] != -1) map[j][i][1] = map[j-1][i][1];
			else {
				int k = 0;
				while (s[j+k][i] != '#' and j + k < h){
					k++;
				}
				map[j][i][1] = k;
			}
		}
	}


	ll ans = 1;
	REP(i, h){
		REP(j, w){
			ans = max(ans, map[i][j][0] + map[i][j][1] - 1);
		}
	}

	cout << ans << endl;






}


Measured memory_bytes: 66816
#include<iostream>

using namespace std;


int main(){
  int a,b,i,j;
  cin >> a >> b;
   while(a!=0 || b!=0){
    j=0;
    for(i=1;i<=3000;i++){
      if(i>=a && i<=b && i%4==0){
	if( (i%100==0 && i%400==0)  || i%100!=0 ){
	  j++;
	  cout << i << endl;
	}
      }
    }
    if(j==0){
      cout << "NA" <<endl;
    }
    
    cin >> a >> b;
    if(a==0&&b==0)
      break;

    cout << endl;
  } 

}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
const int maxn=500005;
int n, pre;
char s[maxn];
int dp[maxn];

int main()
{
    while(~scanf("%d%s", &n, s+1)){
        memset(dp, 0, sizeof(dp));
        for(int i=3;i<=n;i++){
            dp[i]=dp[i-1];
            if(s[i]=='0')pre=0;
            if(s[i]=='1'&&s[i-1]=='0'&&s[i-2]=='1'){
                int j=i-2;
                while(s[j]=='1'&&j){
                    dp[i]=max(dp[i], dp[j-1]+i-j-1);    //当前101作为末端
                    j--;
                }
                pre=i;
            }
            if(s[i]=='1'&&pre){
                dp[i]=max(dp[i], dp[pre-3]+i-pre+1);    //上一个101作为前端
            }
        }
        printf("%d\n", dp[n]);
    }
	return 0;
}


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

int main()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	for (auto& days : a) cin >> days;
	for (auto days : a) {
		n -= days;
	}
	if (n < 0) puts("-1");
	else cout << n << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
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;}

ll d[100005] ; ll f[100005];
ll e[100005] ;
ll sum[100005] ;
int main(){
  rep(i,100005){
      d[i]=0 ;
      e[i]=0 ;
      f[i]=0 ;
  } 
  rep2(i,2,100003){
      if(d[i]!=0) continue ;
      f[i]=87 ;
      for(ll j=1 ; i*j<=100000;j++){
          d[i*j]++ ;
      }
  }
  rep(i,49999){
      ll a= 2*i+1 ;
      if(f[i+1]==87&&f[a]==87) e[a]++ ;

  }
  sum[0]=e[0] ;
  rep(i,100002){
      sum[i+1]= sum[i]+e[i+1] ;
  }
  ll q ;cin>> q ;
  while(q--){
    ll x,y ;
    cin>>x>>y ;
    cout<< sum[y]-sum[x-1] <<endl ;
  }
 return 0 ; 
}

Measured memory_bytes: 6768
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("no-stack-protector")
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC pop_options
//#pragma GCC target("popcnt")
//#pragma GCC target("sse4")
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rng(a) a.begin(),a.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for (int i = 0; i < n; i++)
#define per(i, n) for (int i = n - 1; i > -1; i--)
#define rer(i, x, n) for (int i = x; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef long double ld;














#define int long long
signed main(){
    int n;
    cin >> n;
    map <int,int> mp;
    int a[n];
    for (int i = 0; i < n; i++){cin >> a[i]; mp[a[i]]++;}
    int ans = 0;
    for (auto x : mp) ans += x.se * (x.se - 1) / 2;
    for (int i = 0; i < n; i++){
        int t = mp[a[i]];
        int ans1 = ans - t * (t - 1) / 2 + (t - 1) * (t - 2) / 2;
        cout << ans1 << endl;
    }



}


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

int main(){
    int n;
    cin >> n;
    set<int> st;
    for(int i=0;i<n;++i){
        int a;
        cin >> a;
        if(st.count(a)){
            st.erase(a);
        }else{
            st.insert(a);
        }
    }
    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    ll a, b, x;
    cin >> a >> b >> x;
    if(a == 0) cout << b/x + 1 << endl;
    else cout << (b/x)-((a-1)/x) << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, k, i, j, x;
	cin >> n >> k;
	vector<bool> valid(10, true);
	for (i = 0; i < k; i++) {
		cin >> x;
		valid[x] = false;
	}

	do {
		bool ok = true;
		x = n;
		while (x > 0) {
			if (!valid[x % 10]) {
				ok = false; break;
			}
			x /= 10;
		}
		if (ok) break;

		n++;
	} while (1);
	cout << n << "\n";

	return 0;
}


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

int dp[100];

//最大公約数
int gcd(int x, int y){
  if(x % y == 0) return 1;
  return gcd(y, x % y);
}
//最小公倍数
int lcm(int x, int y){
  return x * y / gcd(x, y);
}
//フィボナッチ数列
//配列dpを-1で初期化する
int fib(int n){
  if(n == 0 || n == 1) return dp[n] = 1;
  if(dp[n] != -1) return dp[n];
  return dp[n] = fib(n - 1) + fib(n - 2);
}
//階乗計算(factorial)
int fact(int n){
  if(n = 1) return 1;
  return n * fact(n - 1);
}
//累乗計算(Exponentiation)
//x**y
ll expo(ll x, ll y){
  ll ans = 1;
  rep(i, y){
    ans *= x;
  }
  return ans;
}
//桁数
int keta(ll x){
  if(x == 0) return 1;
  int res = 0;
  while(x){
    x /= 10;
    res++;
  }
  return res;
}



int main(){
  ll h;
  cin >> h;
  ll count = 0;

  ll ans = 1;
  while(h / 2 != 0){
    count++;
    h /= 2;
  }
  ans = expo(2, count+1) -1;
  
  cout << ans << endl;
}


/*





















*/


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#define INF 1e6
int n;
int p[45],t[45];
int dp[41][5];

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=1;i<=n;i++){
			scanf("%d %d",&p[i],&t[i]);
		}
		for(int i=0;i<=n;i++){
			for(int j=0;j<=3;j++){
				dp[i][j]=INF;
			}
		}
		dp[0][0]=0;
		for(int i=0;i<n;i++){
			for(int j=0;j<=3;j++){
				if(dp[i][j]!=INF){
					if(t[i]+abs(p[i+1]-p[i])*(j+1)<=t[i+1]){
						dp[i+1][j+1]=std::min(dp[i+1][j+1],dp[i][j]+abs(p[i+1]-p[i]));
					}
					if(t[i]+p[i]*(j+1)+p[i+1]<=t[i+1]){
						dp[i+1][1]=std::min(dp[i+1][1],dp[i][j]+p[i+1]+p[i]);
					}
				}
			}
		}
		if(dp[n][1]==INF && dp[n][2]==INF && dp[n][3]==INF){
			for(int i=1;i<=n;i++){
				int j;
				for(j=0;j<=3;j++){
					if(dp[i][j]!=INF)break;
				}
				if(j==4){
					printf("NG %d\n",i);
					break;
				}
			}
		}else{
			int res=INF;
			for(int i=1;i<=3;i++){
				res=std::min(res,dp[n][i]+p[n]);
			}
			printf("OK %d\n",res);
		}
	}
	return 0;
}

Measured memory_bytes: 1028
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int A = sc.nextInt();
        if(H%A == 0){
            System.out.println(H/A);
        } else {
            System.out.println((H/A)+1);
        }
    }
}

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

using namespace std;

class Node{
//ノードはポインタでもっておこう
public:
  ///ノードの番号
  int num;
  //そのノードの親
  //rootの場合はnullptr
  Node* p=nullptr;
  //そのノードの子
  //葉でなければ少なくとも一つ持つ
  Node* l=nullptr;Node* r=nullptr;
};

//参照とかポインタとか気をつけよ(統一する)
//関数内はスタックに保存される
//xは根のNode
//書き換えたいときはポインタ使え、しね
void insert(Node* &root,int k){
  //見ているNode、そのNodeの親を、それぞれx,yで管理する
  //newで確保するとポインタはスタック領域にあるので破棄されるけどnewで確保した領域はヒープ領域にあるから残ってる
  //つまり、その領域をvectorにあげれば良い
  Node* z= new Node;z->num=k;
  Node* y=nullptr;
  Node* x=root;

  while(x!=nullptr){
    y=x;
    if(z->num<x->num){
      x=x->l;
    }else{
      x=x->r;
    }
  }

  if(y==nullptr){
    root=z;
  }else{
    z->p=y;
    if(z->num<y->num){
      y->l=z;
    }else{
      y->r=z;
    }
  }
}

void pre_calc(Node* &n,vector<int>& v){
  if(n==nullptr) return;
  v.push_back(n->num);
  pre_calc(n->l,v);
  pre_calc(n->r,v);
}

void in_calc(Node* &n,vector<int>& v){
  if(n==nullptr) return;
  in_calc(n->l,v);
  v.push_back(n->num);
  in_calc(n->r,v);
}

void tree_print(Node* N){
  vector<int> vin;vector<int> vre;
  //v[0]はrootNode、vin,vreは出力したいものを入れておく
  in_calc(N,vin);
  pre_calc(N,vre);
  int le=vin.size();
  //printするところ
  for(int i=0;i<le;i++){
    cout << " " << vin[i];
  }
  cout << endl;
  for(int i=0;i<le;i++){
    cout << " " << vre[i];
  }
  cout << endl;
}


//根がx
bool find(Node* x,int k){
  while(x!=nullptr){
    if(x->num==k)return true;
    else if(x->num>k) x=x->l;
    else x=x->r;
  }
  return false;
}

//xは根(再帰で必要)
//yがnullptrの時の操作
void Tree_delete(Node* &root,int k){
  Node* x=root;
  while(x!=nullptr){
    if(x->num==k)break;
    else if(k<x->num) x=x->l;
    else x=x->r;
  }
  Node* y=x->p;
  if(x->l==nullptr and x->r==nullptr){
    if(y==nullptr){
      root=nullptr;
    }else if(y->l==x){
      y->l=nullptr;
    }else{
      y->r=nullptr;
    }
    delete x;
  }else if(x->l==nullptr){
    if(y==nullptr){
      root=x->r;
      root->p=nullptr;
    }else if(y->l==x){
      y->l=x->r;
      x->r->p=y;
    }else{
      y->r=x->r;
      x->r->p=y;
    }
    delete x;
  }else if(x->r==nullptr){
    if(y==nullptr){
      root=x->l;
      root->p=nullptr;
    }else if(y->l==x){
      y->l=x->l;
      x->l->p=y;
    }else{
      y->r=x->l;
      x->l->p=y;
    }
    delete x;
  }else{
    //まずは次に大きい要素を探索する
    Node* z=x->r;
    while(z->l!=nullptr){
      z=z->l;
    }
    x->num=z->num;
    Tree_delete(z,z->num);
  }
}


int main(){
  Node* N=nullptr;
  int n;cin >> n;
  for(int i=0;i<n;i++){
    string s;cin >> s;
    if(s=="insert"){
      int z;cin >> z;
      insert(N,z);
    }else if(s=="print"){
      tree_print(N);
    }else if(s=="find"){
      int k;cin>>k;
      //cout << find(v,k) << endl;
      if(find(N,k)) cout << "yes" << endl;
      else cout << "no" << endl;
    }else{
      int k;cin>>k;
      Tree_delete(N,k);
    }
  }
}



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

using namespace std;

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

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    char b;
    cin >> b;
    if (b == 'A') cout << "T";
    else if (b == 'C') cout << "G";
    else if (b == 'G') cout << "C";
    else cout << "A";
    cout << endl;
    
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	int l,a,b,c,d;
	cin >> l >> a >> b >> c >> d;
	cout << l-max(a/c+(a%c==0?0:1),b/d+(b%d==0?0:1)) << endl;
	return 0;
}

Measured memory_bytes: 1164
import bisect
import copy
import heapq
import sys
import itertools
import math
from functools import lru_cache
from collections import deque
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7 

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]


def main():
    A, B, C = read_values()
    K = int(input())

    t = 0
    while A >= B:
        B *= 2
        t += 1
    while B >= C:
        C *= 2
        t += 1
    
    print("Yes" if t <= K else "No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 9772
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] p = new int[n];
    for(int i = 0;i<n;i++)p[i]=sc.nextInt();
    double ki = 0.0;
    for(int i = 0;i<k;i++){
      ki += (double)(p[i]+1)/2;
    }
    double kita = ki;
    for(int i = k;i<n;i++){
      ki += (double)(p[i]+1)/2-(double)(p[i-k]+1)/2;
      kita = Math.max(ki,kita);
    }
    System.out.println(kita);
  }
}



Measured memory_bytes: 61244
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<array>
#include<string>
#include<numeric>
#include<set>
#include<unordered_map>
typedef long long ll;
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    if(y%2==1) cout<<"No\n";
    else if(y/x==3) cout<<"Yes\n";
    else if(x*2==y) cout<<"Yes\n";
    else if(x*2==(y-2)) cout<<"Yes\n";
    else if(x*4==(y+2)) cout<<"Yes\n";
    else if(x*4==y) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char C;
  cin >> C;
  if(C=='a'){
    cout << "b" << endl;
  }
  else if(C == 'b'){
    cout << "c" << endl;
  }
    else if(C == 'c'){
    cout << "d" << endl;
  }
    else if(C == 'd'){
    cout << "e" << endl;
  }
    else if(C == 'e'){
    cout << "f" << endl;
  }
    else if(C == 'f'){
    cout << "g" << endl;
  }
    else if(C == 'g'){
    cout << "h" << endl;
  }
    else if(C == 'h'){
    cout << "i" << endl;
  }
    else if(C == 'i'){
    cout << "j" << endl;
  }
    else if(C == 'j'){
    cout << "k" << endl;
  }
    else if(C == 'k'){
    cout << "l" << endl;
  }
    else if(C == 'l'){
    cout << "m" << endl;
  }
    else if(C == 'm'){
    cout << "n" << endl;
  }
    else if(C == 'n'){
    cout << "o" << endl;
  }
    else if(C == 'o'){
    cout << "p" << endl;
  }
    else if(C == 'p'){
    cout << "q" << endl;
  }
    else if(C == 'q'){
    cout << "r" << endl;
  }
    else if(C == 'r'){
    cout << "s" << endl;
  }
    else if(C == 's'){
    cout << "t" << endl;
  }
    else if(C == 't'){
    cout << "u" << endl;
  }
    else if(C == 'u'){
    cout << "v" << endl;
  }
    else if(C == 'v'){
    cout << "w" << endl;
  }
    else if(C == 'w'){
    cout << "x" << endl;
  }
    else if(C == 'x'){
    cout << "y" << endl;
  }
    else if(C == 'y'){
    cout << "z" << endl;
  }
}

Measured memory_bytes: 256
using System;

namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a = int.Parse(input[0]);
            var b = int.Parse(input[1]);
            var c = int.Parse(input[2]);

            var count = 0;

            for (int i = a; i <= b; i++)
                if (c % i == 0) count++;

            Console.WriteLine(count);
        }
    }
}



Measured memory_bytes: 17928
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,m,a,b,c,e=-10000000000000000;
  cin>>n>>m;
  vector<vector<ll>> v(8,vector<ll>(n));
  int d[8][3]={{1,1,1},{1,1,-1},{1,-1,1},{-1,1,1},{1,-1,-1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};
  for(int i=0;i<n;i++){
    cin>>a>>b>>c;
    for(int j=0;j<8;j++){
      v[j][i]=a*d[j][0]+b*d[j][1]+c*d[j][2];
    }
  }
  for(int i=0;i<8;i++){
    sort(v[i].begin(),v[i].end(),greater<ll>());
    ll f=0;
    for(int j=0;j<m;j++){
      f+=v[i][j];
    }
    e=max(e,f);
  }
  cout<<e;
}

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

int solve(int x, int y) {
  if (y > 0) {
    if (x > y) return solve(-x, y) + 1;
    if (x >= 0) return y - x;
    if (x > -y) return solve(-x, y) + 1;
    return -y - x + 1;
  }else if (y == 0) {
    if (x < 0) return -x;
    return 1 + solve(-x, y);
  }else {
    if (x > -y) return solve(-x, y) + 1;
    if (x >= 0) return -y - x + 1;
    if (x > y) return solve(-x, y) + 1;
    return y - x;
  }
}

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);
  int x, y; cin >> x >> y;
  cout << solve(x, y) << endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String[] vowel = {"a", "i" , "u" , "e" , "o"};
        for(String a : vowel){
            if(c.equals(a)){
                System.out.println("vowel");
                return;
            }
            
        }
        System.out.println("consonant");
        }        
    }



Measured memory_bytes: 21844
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <numeric>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;

#define INF 1e9
#define MOD 1000000007;//1e9+7

void solve() {
    int N;
    cin >> N;
    rep(i, N) {
        int A;
        cin >> A;
        if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0) {
            cout << "DENIED";
            return;
        }
    }
    cout << "APPROVED";
}

int main() {
    solve();
    return 0;
}

Measured memory_bytes: 256
n=int(input())
import bisect
L=[]
for i in range(n):
    x,l=map(int,input().split())
    a=x-l+0.1
    b=x+l-0.1
    L.append((b,a))
L=sorted(L)
rob=1
bottom=L[0][0]
for i in range(1,n):
    if L[i][1]>bottom:
        rob += 1
        bottom=L[i][0]
print(rob)

Measured memory_bytes: 16220
#include <iostream>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    bool isInRectangle = false;
    if(y + r <= H && y - r >= 0){
        if(x - r >= 0 && x + r <= W){
            isInRectangle = true;
        }
    }
    if(isInRectangle){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }
}



Measured memory_bytes: 3156
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>
#include <stack>
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define ktya(x) sort(all(x))
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define SIZE 200105
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD = 1000000007;
//ll MOD=998244353;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
ll dp[114514]={0};
ll sum[114514]={0};

int N,K;

int main(){
	cin>>N>>K;
	cout<<N-K+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (ll i=0; i < (n); ++i)
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; }
template<class T> inline bool change(T& a, T b) { if (a != b) { a = b; return 1; } return 0; }
using namespace std;

int main(){
    int n; cin >>n;
    vector<int> a(n);
    rep(i,n){cin >> a[i];}
    int ans=0;
    rep(i,n){
        if(i%2==0 && a[i]%2==1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
//
//  header_useful.h
//  c++_acm
//
//  Created by 李弘辰 on 2019/7/23.
//  Copyright  2019 李弘辰. All rights reserved.
//

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <utility> // pair
#include <map>
#include <unordered_map>
#include <iostream>
#include <sstream>
#include <algorithm> // sort
#include <string>
#include <stack>
#include <queue>
#include <fstream>
#include <bitset>


using namespace std;

#define ll long long
#define lll __int128
#define uchar unsigned char
#define ushort unsigned short
#define uint unsigned int
#define ulong unsigned long
#define ull unsigned long long

#define INT_INF 0x7fffffff

#define pi acos(-1)

#define mx(a,b) (a) > (b) ? (a) : (b)
#define mn(a,b) (a) < (b) ? (a) : (b)
#define mem(a,b) memset(a,b,sizeof(a))
#define fre(a) freopen(a,"r",stdin)

#define cio ios::sync_with_stdio(false); // Do not use it with "scanf" and other c input!
#define pb push_back
#define rep(i,a,b) for (int i = a;i <= b;i ++)
#define pre(i,a,b) for (int i = a;i >= b;i --)
#define REP(i,a,b) for (int i = a;i < b;i ++)

#define read(a,s,n) rep(i,s,n) scanf("%d",a + i);
#define READ(a,s,n) REP(i,s,n) scanf("%d",a + i);

#define read_ll(a,s,n) rep(i,s,n) scanf("%lld",a + i);
#define READ_ll(a,s,n) REP(i,s,n) scanf("%lld",a + i);

#define _T_(T) int T;scanf("%d",&T);while (T --)
#define __T _T_(TTESTCASES)
#define _E_(T) while (~T)

#define Tprint(a,s,e) {int f=1;REP(i,s,e){if(f)f=0;else printf(" ");printf("%d",a[i]);}}


#define endl '\n'

#define itn int
#define iny int
#define nit int
#define inr int
#define mian main
#define iman main
#define mina main
#define mian main
#define ednl endl
#define fro for
#define fir for
#define reutrn return
#define retunr return
#define reutnr return


/* header_useful_h */


const int MAXN = 5e5 + 10;

int a[MAXN];
int rt[MAXN];
int lc[MAXN * 40],rc[MAXN * 40],cnt;
ll sum[MAXN * 40];

map<int,int> vis;

void update(int &u, int x, int y, int p, ll v)
{
    sum[cnt] = sum[u] + v;
    lc[cnt] = lc[u];
    rc[cnt] = rc[u];
    u = cnt;
    cnt ++;
    
    if(x == y) return;
    int m = (x + y) >> 1;
    if(p <= m) update(lc[u],x,m,p,v);
    else update(rc[u],m + 1,y,p,v);
}

ll query(int u, int x, int y, int ql, int qr)
{
    if(ql <= x && y <= qr) return sum[u];
    int m = (x+y) >> 1;
    ll ans = 0;
    if(ql <= m) ans += query(lc[u],x,m,ql,qr);
    if(qr > m) ans += query(rc[u],m + 1,y,ql,qr);
    return ans;
}

int n,q;
int t;

void init()
{
    rep(i,1,n) {
        rt[i] = rt[i - 1];
        if(vis.find(a[i])!=vis.end())
        {
            t = rt[i - 1];
            update(t,1,n,vis[a[i]],-1);
            rt[i] = t;
            update(rt[i],1,n,i,1);
        } else {
            rt[i] = rt[i-1];
            update(rt[i],1,n,i,1);
        }
        vis[a[i]] = i;
    }
}

void sve()
{
    int l,r;
    while (q --){
        scanf("%d%d",&l,&r);
        printf("%lld\n",query(rt[r],1,n,l,r));
    }
}

int main(){
    
    cnt = 1;
    scanf("%d%d",&n,&q);
    rep(i,1,n) scanf("%d",a + i);
    init();
    sve();
    return 0;
    
}


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

#define d(x) cerr << #x ":" << x << endl;
#define dd(x, y) cerr << "(" #x "," #y "):(" << x << "," << y << ")" << endl
#define rep(i, n) for (int i = (int)(0); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define dump(v)                  \
    cerr << #v ":[ ";            \
    for (auto macro_vi : v) {    \
        cerr << macro_vi << " "; \
    }                            \
    cerr << "]" << endl;
#define ddump(v)                           \
    cerr << #v ":" << endl;                \
    for (auto macro_row : v) {             \
        cerr << "[";                       \
        for (auto macro__vi : macro_row) { \
            cerr << macro__vi << " ";      \
        }                                  \
        cerr << "]" << endl;               \
    }
using lint       = long long;
const int INF    = 1e9;
const lint LINF  = 1e18;
const double EPS = 1e-10;

int main() {
    lint a, b, c, d;
    cin >> a >> b >> c >> d;

    lint ma = -LINF;

    ma = max(ma, a * c);
    ma = max(ma, a * d);
    ma = max(ma, b * c);
    ma = max(ma, b * d);

    cout << ma << endl;

    return 0;
}

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

int main(){
  queue<string> s0;
  queue<int> s1;
  int n,q;
  cin >> n >> q;
  for(int i=0;i<n;i++){
    string word;
    int k;
    cin >> word >> k;
    s0.push(word);
    s1.push(k);
  }
  int t = 0;
  while(! s1.empty()){
    int k = s1.front();
    string word = s0.front();
    s0.pop();
    s1.pop();
    if(k>q){
      k -= q;
      s0.push(word);
      s1.push(k);
      t += q;
    }else{
      t += k;
      cout << word <<" " << t << endl;
    }
  }
}

Measured memory_bytes: 5716
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp;

fn main() {
    input!{
        h: usize,
        w: usize,
        ss: [chars; h],
    }

    let dirs = [
        (1, 0),
        (-1, 0),
        (0, 1),
        (0, -1),
    ];

    for i in 0..h {
        for j in 0..w {
            if ss[i][j] == '#' {
                let mut ok = false;
                for &(dx, dy) in dirs.iter() {
                    let ni = i as i32 + dx;
                    let nj = j as i32 + dy;
                    if ni >= 0 && ni < h as i32 && nj >= 0 && nj < w as i32 {
                        if ss[ni as usize][nj as usize] == '#' {
                            ok = true;
                            break;
                        }
                    }
                }
                if !ok {
                    println!("{}", "No");
                    return;
                }
            }
        }
    }
    println!("{}", "Yes");
}


Measured memory_bytes: 4352
import java.util.*;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if (a < 6) {
			System.out.println(0);
		} else if (a < 13) {
			System.out.println(b / 2);
		} else {
			System.out.println(b);
		}
	}
}

Measured memory_bytes: 22484