akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define reps(i,s,n) for(int (i) = (s); (i) < (n); ++(i))
#define rep(i,n) reps(i,0,n)
using ll = long long;
/*
a11 .... a1W
*/
int H,W;
char g[101][101];

int main(){
    cin >> H >> W;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> g[i][j];
        }
    }
    for(int i = 0; i < W+2; i++){
        cout << "#";
    }
    cout << endl;
    for(int i = 0; i < H; i++){
        cout << "#";
        for(int j = 0; j < W; j++){
            cout  << g[i][j] ;
        }
        cout << "#";
        cout << endl;
    }
    for(int i = 0; i < W+2; i++){
        cout << "#";
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s = br.readLine();
		StringBuilder sb = new StringBuilder();
		sb.append(s);
		
		StringBuilder sb1 = new StringBuilder();
		while(sb.length() > 0){
			sb.delete(sb.length()-1, sb.length());

			if (sb.length() % 2 == 1){ continue; }
			sb1.delete(0, sb1.length());
			sb1.append(sb.substring(sb.length()/2));
			sb1.append(sb.substring(0, sb.length()/2));

			if(sb.toString().equals(sb1.toString())){
				break;
			}
//			System.out.println(sb + " " + sb1);

		}


//		System.out.println(sb + " " + sb1);
		System.out.println(sb.length());
	return;
	}

}


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

int main() {
    int N; cin >> N;
    set<int> st;
    rep(i, N) {
        int a; cin >> a;
        st.insert(a);
    }
    cout << (st.size() == N ? "YES" : "NO") << '\n';
    return 0;
}

// overflow
// corner cases


Measured memory_bytes: 9600
#include<iostream>
#include<cstdio>
using namespace std;
int S[100000],n;
int binary(int key){
    
    int mid;
    int right = n;
    int left = 0;
        while(left < right){
            mid = (right + left)/2;
            if(S[mid] == key) return 1;
            else if(key < S[mid]) right = mid;
            else left = mid + 1;
        }
       return 0; 
}
    
int main(){
    int q,key;
    int count = 0;
    scanf("%d",&n);
    
    for(int i = 0; i < n; i++){
        scanf("%d",&S[i]);
    }
    scanf("%d",&q);
    
    for(int i = 0; i < q; i ++){
        scanf("%d",&key);
        if(binary(key)) count++;
        
    }
    printf("%d\n", count);
    
    return 0;
    
    
}


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

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!int).array;
    auto C = new int[](13);

    foreach (a; A)
        C[a] += 1;

    if (N >= 24 || C[0] > 0 || C[12] > 1 || C.map!(c => c >= 3).any) {
        writeln(0);
        return;
    }

    foreach (i; 0..12) {
        if (C[i] >= 2 && C[i+1] >= 2) {
            writeln(1);
            return;
        }
    }

    int ans = 0;

    foreach (i; 0..(1 << N)) {
        auto jikan = new int[](24);
        jikan[0] = 1;

        foreach (j; 0..N) {
            if (i & (1 << j)) {
                jikan[A[j]] += 1;
            } else {
                jikan[24-A[j]] += 1;
            }
        }

        int tmp = 1 << 29;

        foreach (j; 0..24) {
            foreach (k; 0..24) {
                if (j != k && jikan[j] && jikan[k]) {
                    int jisa = abs(j-k);
                    tmp = min(tmp, min(jisa, 24-jisa));
                } else if (j == k && jikan[j] >= 2) {
                    tmp = 0;
                }
            }
        }
        ans = max(ans, tmp);
    }

    ans.writeln;
}


Measured memory_bytes: 1276
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let (n, k): (usize, usize);
    input!(n, k);
    let v = input_vector::<String>();
    for z in n.. {
        let s = z.to_string().chars().collect::<Vec<_>>();
        let mut flag = true;
        for z in &s {
            for y in &v {
                if *z == y.chars().next().unwrap() {
                    flag = false;
                    break;
                }
            }
            if !flag {
                break;
            }
        }
        if flag {
            p(z);
            return;
        }
    }
}


Measured memory_bytes: 4352
from collections import deque
import sys
def main():
  a,b=map(int,sys.stdin.readline().split())
  e=[[]for i in range(a)]

  for i in range(a-1):
    c1,c2=map(int,sys.stdin.readline().split())
    e[c1-1].append(c2-1)
    e[c2-1].append(c1-1)

  g=[[]for i in range(a)]
  f=deque()
  f.append((0,-1))
  ans=[0 for _ in range(a)]
  for i in range(b):
    ten,p=map(int,input().split())
    ans[ten-1]+=p
  i=0
  while len(f)!=0:
    i,fr=f.popleft()
    for j in e[i]:
      if j==fr:
        continue
      else:
        ans[j]+=ans[i]
        f.append((j,i)) 
  print(*ans)
if __name__ == '__main__':  
  main()
    
  

  
  


Measured memory_bytes: 105236
n = int(input())
arr = list(map(int, input().split()))

dic = {}
for i in range(1,n+1):  
  S1 = sum(arr[:i])  
  S2 = sum(arr[i:])  
  dic[i] = abs(S1-S2)  
ans = sorted(dic.items(), key=lambda x:x[1])  

print(ans[0][1])  
  

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main(void) {
    int a[5];
    for (int i = 0; i < 6; i++) {
        cin >> a[i];
    }

    int num = 0;
    for (int i = 0; i < 5; i++)
    {
        for (int j = i+1; j < 5; j++) {

            if (abs(a[j] - a[i]) > a[5]) { num += 1; }
        }
    }
    if (num > 0) { cout << ":("; }
    else {
        cout << "Yay!";
    }

    system("pause");
    return 0;
}


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

int main() {
	vector<string> words;
	vector<vector<int> > pages;
	string word; int page;
	while(cin>>word>>page) {
		bool is_there = false; int word_place;
		for (int i = 0; i < words.size(); i++) {
			if (word == words[i]) {
				is_there = true;
				word_place = i;
			}
		}
		if (is_there) {
			pages[word_place].push_back(page);
		}
		else {
			words.push_back(word);
			vector<int>* x = new vector<int>;
			pages.push_back(*x);
			pages[pages.size() - 1].push_back(page);
		}
	}
	for (int i = 0; i < words.size() - 1; i++) {
		for (int j = 0; j < words.size() - 1; j++) {
			if (words[j] > words[j + 1]) {
				string tmp_w=words[j];
				words[j] = words[j + 1];
				words[j + 1] = tmp_w;
				vector<int> tmp_p=pages[j];
				pages[j] = pages[j + 1];
				pages[j + 1] = tmp_p;
			}
		}
	}
	for (int i = 0; i < words.size(); i++) {
		for (int j = 0; j < pages[i].size()-1; j++) {
			for (int c = 0; c < pages[i].size()-1; c++) {
				if (pages[i][c] > pages[i][c + 1]) {
					int tmp=pages[i][c];
					pages[i][c] = pages[i][c + 1];
					pages[i][c + 1] = tmp;
					}
			}
		}
	}
	for (int i = 0; i < words.size(); i++) {
		cout << words[i] << endl;
		for (int m = 0; m < pages[i].size(); m++) {
      if(pages[i].size()-1==m)cout<<pages[i][m];
			else cout << pages[i][m]<<' ';
		}
		cout << endl;
	}
}

Measured memory_bytes: 3080
N,A,B = map(int,input().split())

#A個のbとB個のrを並べる操作を10^100回行って前からN個数に何個bがあるか

times = A + B

quo = N // times
rem = N % times

if rem >= A:
    print(quo*A + A)
else:
    print(quo*A + rem)

Measured memory_bytes: 2940
a, b, c = gets.chomp.split(' ').map{|i| i.to_i }

if a == b
  if a != c
    puts 'Yes'
  else
    puts 'No'
  end
elsif b == c
  if a != c
    puts 'Yes'
  else
    puts 'No'
  end
elsif a == c
  if a != b
    puts 'Yes'
  else
    puts 'No'
  end
else
  puts 'No'
end


Measured memory_bytes: 1788
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

int main(){
    int n,d,x,c=0;
    cin >> n >> d >> x;
    vector<int>a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=0;;j++){
            if(j*a[i]+1<=d){
                c++;
            }else{
                break;
            }
        }
    }
    cout << c+x;
}

Measured memory_bytes: 256
def shred(num, base=10, reverse=True):
    digits = []
    while num != 0:
        digits.append(num % base)
        num /= base
        num = int(num)
    if not reverse:
        digits = [dig for dig in reversed(digits)]
    return digits

if __name__ == '__main__':
    N = int(input())
    if 7 in shred(N):
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 9124
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <queue>
#include <map>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;
typedef pair<int, double> P;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = { 0, 1, 0, -1 };

int main() {

	string s;
	cin >> s;
	int n = s.size();
	string ans;
	rep(i, n) {
		ans += 'x';
	}
	cout << ans << endl;

	return 0;
}

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

int main(){
    
    int a,b;
    
    rep(i,0,7){
        cin >> a >> b;
        cout << a-b << endl;
    }
    return 0;
}


Measured memory_bytes: 3136
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)
#include <cstdint> // int64_t, int_fast64_t

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

typedef std::int_fast64_t ll; // at least int64 > 9*10^18
typedef std::uint_fast64_t ull; // at least uint64

#define int ll

#define INF 10101010

struct FastIO
{
  FastIO() {
    std::cin.tie(0);
    std::ios_base::sync_with_stdio(0); 
  }
}fastio;

signed main() {
  int n,m,q;
  std::cin >> n >> m >> q;
  std::vector<std::vector<int> > trains(n,std::vector<int>(n,0));
  rep(i,m) {
    int l,r;
    std::cin >> l >> r;
    l--;r--;
    trains[l][r]++;
  }
  std::vector<std::vector<int> > train_sum(n,std::vector<int>(n,0));
  rep(l,n) for(int r=l;r<n;r++) {
    if(l<r) train_sum[l][r] = train_sum[l][r-1];
    for(int i=l;i<=r;i++) {
      train_sum[l][r] += trains[i][r];
    }
  }
  rep(i,q) {
    int l,r;
    std::cin >> l >> r;
    if(l==1&&r==n) {
      std::cout << m << ENDL;
      continue;
    }
    l--;r--;
    std::cout << train_sum[l][r] << ENDL;
  }
  return 0;
}

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

#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define lg long long
#define db double
#define lb(x) ((x)&-(x))
#define ft first
#define sd second

#define HII cerr<<"HI"<<endl
#define LLLINE cerr<<"@@@@@@@@@@@@@@@@@@@@"<<endl

template <class _T_>
void read(_T_& d){
	d=0;int f=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')f*=-1;
	for(;c>='0'&&c<='9';c=getchar())d=d*10+c-'0';
	d*=f;
}

/************************************************/
#define Md 1000000007
#define MN 200005
int n;
int a[MN],tot=0;
int pr[MN];
int dp[MN];
int tmp[MN];
int main(){
	read(n);
	for(int i=1,x;i<=n;++i){
		read(x);
		if(!tot||x!=a[tot])a[++tot]=x;
	}n=tot;
	dp[0]=tmp[0]=1;
	for(int i=1;i<=n;++i){
		dp[i]=pr[a[i]];
		tmp[i]=(dp[i]+tmp[i-1])%Md;
		pr[a[i]]=(pr[a[i]]+tmp[i-1])%Md;
	}
	printf("%d\n",tmp[n]);
	return 0;
}


Measured memory_bytes: 3328
sx, sy, tx, ty = list(map(int, input().split()))
ans = ''
x = tx-sx
y = ty-sy

ans += 'U'*(y) + 'R'*(x)
ans += 'D'*(y) + 'L'*(x)
ans += 'L'+ 'U'*(y+1) + 'R'*(x+1) + 'D'
ans += 'R'+ 'D'*(y+1) + 'L'*(x+1) + 'U'
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll         long long
#define PI         acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)

int main(){
    int n, flg=1;
    cin >> n;
    int a[n];
    FOR(i,0,n){
        cin >> a[i];
        if(a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0){
            flg=0;
            break;
        }
    }
    if(flg==1) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<pair<unsigned long, unsigned long>> v(N);
    for(auto& i : v){
        cin >> i.first >> i.second;
        i.first += 1000000000;
        i.first += i.second;
        (i.second *= -2) += i.first;
    }
    sort(v.begin(), v.end());
    unsigned long utan{0}, ans{0};
    for(const auto& i : v)if(i.second >= utan){
        ++ans;
        utan = i.first;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

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

int n;
vector<P> ran; 

bool compare_by_b(pair<int, int> a,pair<int, int>b){
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

int main(){
    cin >> n;
    int x,l;
    rep(i,n){
        cin >> x >> l;
        ran.push_back(make_pair(x-l,x+l));
    }
    sort(ran.begin(),ran.end(),compare_by_b);

    int ans = 1;
    int cur = ran[0].second;

    for(int i=1; i<ran.size();i++){
        if(ran[i].first < cur) continue;
        ans++;
        cur  = ran[i].second;
    }

    cout << ans << endl;

}

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

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

    int answer = 0;
    for (int i = a; i <= b; i++)
    {
        if(c%i==0)
            answer++;
    }

    cout << answer << endl;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"

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

    int m, n;
    cin >> n >> m;
    vector<int> height(n + 1, 0);
    for(int i = 1; i <= n; i++)
        cin >> height[i];
    vector<vector<int> > graph(n + 1);
    for(int i = 0; i < m; i++){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++){
        int k = graph[i].size();
        int j = 0;
        for(; j < k; j++){
            if(height[i] <= height[graph[i][j]])
                break;
        }
        if(j == k)
            cnt++;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 8748
#include <stdio.h>
int main(void)
{
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a+b > c+d)
  {
    printf("Left\n");
  }
  else if(a+b < c+d){
    printf("Right\n");
  }
  else
  {
    printf("Balanced\n");
  }
  return 0;
}


Measured memory_bytes: 128
import java.util.NoSuchElementException

fun main(args: Array<String>) = FastScanner().run {
    val n = nextLong()
    val a = nextLong()
    val b = nextLong()
    val ret = if (n == 1L && a == b) 1 else if (a > b || n < 2) 0 else {
        (b - a) * (n - 2) + 1
    }
    println(ret)
}

class FastScanner {
    private val printable = 33..126
    val `in` = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0
    fun hasNextByte(): Boolean {
        if (ptr < buflen) {
            return true
        } else {
            ptr = 0
            buflen = `in`.read(buffer)
            if (buflen <= 0) {
                return false
            }
        }
        return true
    }
    fun readByte(): Byte {
        return if (hasNextByte()) buffer[ptr++] else return -1
    }
    fun hasNext(): Boolean {
        while (hasNextByte() && buffer[ptr] !in printable) ptr++
        return hasNextByte()
    }
    fun next(): String {
        if (!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while (b in printable) {
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }
    fun nextLong(): Long {
        if (!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
        if (b !in '0'.toByte()..'9'.toByte()) {
            throw NumberFormatException()
        }
        while (true) {
            if (b in '0'.toByte()..'9'.toByte()) {
                n *= 10
                n += b - '0'.toByte()
            } else if (b == (-1).toByte() || b !in printable) {
                return if (minus) -n else n
            } else {
                throw NumberFormatException()
            }
            b = readByte()
        }
    }
    fun nextInt(): Int {
        val nl = nextLong()
        if (nl !in Integer.MIN_VALUE..Integer.MAX_VALUE) throw NumberFormatException()
        return nl.toInt()
    }
    fun nextDouble(): Double {
        return next().toDouble()
    }
}

Measured memory_bytes: 31392
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<queue>
#include<list>
#include<stdio.h>
#include<stdlib.h>
#include<map>
#include<cstdio>
#include <iomanip>

#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

typedef long long ll;

using namespace std;

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

	int ans = 0;

	int prev = 0;

	cin >> prev;

	int cnt = 1;
	for (int i = 1; i < n; ++i) {
		
		int buf;
		cin >> buf;

		if (buf == prev) {
			++cnt;
		}
		else {
			ans += cnt / 2;
			cnt = 1;
			prev = buf;
		}

	}

	if (cnt > 0) {
		ans += cnt / 2;
	}

	cout << ans << endl;
}

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

#define MAX 2000000
#define INFTY (1<<30)

int H,A[MAX+1];

void maxheapify(int i) {

  int l,r,ls;
  int a;
  l = 2*i;
  r = 2*i+1;
  
  if(l<=H && A[l]>A[i]) ls = l;
  else ls = i;
  if(r<=H && A[r]>A[ls]) ls = r;
  
  if(ls != i) {
    a = A[i]; A[i] = A[ls]; A[ls] = a;
    maxheapify(ls);
  }
}

int extract() {
    int maxv;
  if(H<1) return -INFTY;
  maxv = A[1];
  A[1] = A[H--];
  maxheapify(1);
  return maxv;

}

void increase(int i,int key) {
  int r;
  if(key<A[i]) return;
  A[i] = key;
  while(i>1 && A[i/2] < A[i]) {
    r = A[i];
    A[i] = A[i/2];
    A[i/2] = r;
    i = i/2;
  }

}

void insert(int key) {
  H++;
  A[H] = -INFTY;
  increase(H,key);
  
}

int main() {
  int key;
  char com[10];

  while(1) {
    scanf("%s",com);

    if(com[0] == 'e' && com[1] == 'n') break;
    if(com[0] == 'i') {
      scanf("%d",&key);
      insert(key);
    } else {
      printf("%d\n",extract());
    }
  }

  return 0;

}



Measured memory_bytes: 5608
#!/usr/bin python3
# -*- coding: utf-8 -*-

from bisect import bisect_left, bisect_right


n = int(input())
s = list(input())
q = int(input())

al = 'abcdefghijklmnopqrstuvwxyz'
dicq = {i:[] for i in al}
for i, si in enumerate(s):
    dicq[si].append(i)

def q1(iq, cq):
    #print(iq,cq,s[iq],dicq[s[iq]],bisect_left(dicq[s[iq]], iq))
    dicq[s[iq]].pop(bisect_left(dicq[s[iq]], iq))   #更新前から削除
    s[iq] = cq
    dicq[cq].insert(bisect_left(dicq[cq], iq), iq)   #更新後に追加

def q2(l, r):
    ret = 0
    for ai in al:
        if len(dicq[ai])==0: continue
        li = bisect_left(dicq[ai], l)
        ri = bisect_right(dicq[ai], r)
        if li != ri:
            ret += 1
        elif li == len(dicq[ai]): continue
        elif dicq[ai][li] == l:
            ret += 1
    #    print(l,r,ai,dicq[ai],li,ri,ret)
    print(ret)

for i in range(q):
    fg, x, y = input().split()
    if fg == '1':
        q1(int(x)-1, y)
    else:
        q2(int(x)-1, int(y)-1)


Measured memory_bytes: 34852
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		boolean canBuy = false;

		for (int i=0; (i*4)<=N ;i++){
			int remain = N -(i*4);
			if (remain % 7 == 0){
				canBuy = true;
				break;
			}
		}
		if (canBuy){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23764
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


int main(){
    int n; cin >> n;
    cout << (n-1)/2 << "\n";
    return 0;
}


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

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

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; }

#define MAXTBL 120000
char tbl[MAXTBL];

int main(int argc, char **argv)
{
    // cout << boost::format("lcm(%d,%d)=%d\n") % a % b % lcm(a,b);
    // cout << boost::format("gcd(%d,%d)=%d\n") % a % b % gcd(a,b);

    ll x;
    cin >> x;
    tbl[0] = 1;
    tbl[1] = 1;
    for (ll i = 2; i < MAXTBL; i++)
    {
        if (tbl[i] == 0)
        {
            for (ll j = 2; i * j < MAXTBL; j++)
            {
                tbl[i * j] = 1;
            }
        }
    }
    for (ll i = x; i < MAXTBL; i++)
    {
        if (tbl[i] == 0)
        {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(10**9)
S=list(map(int,input()))
N=len(S)
P=2019
num = [0] * P
num[0] = 1
now, ans = 0, 0
_10 = 1
for i in range(N-1, -1, -1):
    now = (now + S[i] * _10) % P
    _10 *= 10
    _10 %= P
    ans += num[now]
    num[now] += 1

print(ans)

Measured memory_bytes: 10672
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int cookingtime[5];
	int i, min, flag, sum;
	sum = 0;
	min = 10000;
	for (i = 0; i < 5; i++)
	{
		cin >> cookingtime[i];
	}
	for (i = 0; i < 5; i++)
	{
		if ((cookingtime[i] - 1) % 10 < min)
		{
			min = (cookingtime[i] - 1) % 10;
			flag = i;
		}
	}
	for (i = 0; i < 5; i++)
	{
		if (i == flag)
		{
			sum += cookingtime[i];
		}
		else if (cookingtime[i] % 10 != 0)
		{
			sum += cookingtime[i] - (cookingtime[i] % 10) + 10;
		}
		else
		{
			sum += cookingtime[i];
		}
	}
	cout << sum;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int hum[4][3][10];
    for(int b=0;b<4;b++){
    for(int f=0;f<3;f++){
        for(int side=0;side<10;side++){
            hum[b][f][side]=0;
        }
    }
    }
    int n,b,f,side,ninzu;
    cin>>n;
    ninzu=0;
    for(int all=0;all<n;all++){
            cin>>b>>f>>side>>ninzu;
            if(b==1){
                hum[0][f-1][side-1]+=ninzu;
            }if(b==2){
                hum[1][f-1][side-1]+=ninzu;
            }if(b==3){
                hum[2][f-1][side-1]+=ninzu;
            }if(b==4){
                hum[3][f-1][side-1]+=ninzu;
            }
    }
    for(int b=0;b<4;b++){   
    for(int f=0;f<3;f++){
        for(int side=0;side<10;side++){
        cout<<" "<<hum[b][f][side];
        }cout<<endl;
    }
    if(b==3){
        break;
    }for(int s=0;s<20;s++){
        cout<<"#";
    }cout<<endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define deb(x) cout << #x << "=" << x << endl;
const int N = 1e5+7;
int h[N], dp[N];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    int n; cin >> n;
    for (int i = 0; i < n; i++) cin >> h[i];
    dp[1]=abs(h[1]-h[0]);
    for (int i = 2; i < n; i++) {
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
using P=pair<int, int>;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;



int main(){
    fast_io

    int n, k;
    cin>>n>>k;
    vector<int> p(n);
    rep(i,n) cin>>p[i];
    sort(p.begin(), p.end());
    int sum=0;
    rep(i,k){
        sum+=p[i];
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
 
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed(x) fixed<<setprecision(x)
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
bool inLine(int x,int y,int mx,int my){return (x>=0&&y>=0&&x<mx&&y<my);}
const lol inf=(1LL<<62);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,1,-1,-1};
const int dy[]={0,1,0,-1,1,-1,1,-1};
lol n,m,k;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >>n;
  vector<bool> ans(n+1,0);
  ans[0]=true;
  for(int i=4;i<=n;i+=4) ans[i]=true;
  for(int i=0;i<=n-7;i++){
    if(ans[i]) ans[i+7]=true;
  }
  if(ans[n]) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}

Measured memory_bytes: 3660
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,m,x,y;
	while(cin>>n>>m){
		cin>>x>>y;
		cout<<(n-x)*(m-y)<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
#include<stdio.h>
using namespace std;

int main() {
	int room[4][3][10] = { { {} } };
	int n;
	int block, floor, number, people;
	char c;



	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> block >> floor >> number >> people;
		
		room[block - 1][floor - 1][number - 1] += people;
		
	}
	



	for (int i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 10; k++) {

				cout<<" "<<room[i][j][k];

			}
			cout << endl;
		}
		if (i != 3) {
			cout << "####################" << endl;
		}
		
	}
	return 0;
}




Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vll = vector<ll> ;
#define all(v) v.begin(),v.end()
 
int d[55][55];
int d_tmp[55][55];
 
void warshall_floyd(int n){
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        d_tmp[j][k] = min(d_tmp[j][k], d_tmp[j][i] + d_tmp[i][k]);
}
 
int main(){
  int N,M;cin>>N>>M;
  int ans=0;
  vll a(M),b(M);
  rep(i,N)rep(j,N){
    d[i][j]=1;
    if(i==j)d[i][j]=0;
  }
  rep(i,M){
    cin>>a[i]>>b[i];a[i]=a[i]-1,b[i]=b[i]-1;
    d[a[i]][b[i]]=0,d[b[i]][a[i]]=0;
  }
  rep(i,M){
    rep(k,N)rep(j,N)d_tmp[k][j]=d[k][j];
    d_tmp[a[i]][b[i]]=1,d_tmp[b[i]][a[i]]=1;
    warshall_floyd(N);
    bool flag=false;
    rep(i,N)rep(j,N){
      if(d_tmp[i][j]>0) flag=true;
    }
    if(flag) ans++;
    d[a[i]][b[i]]=0,d[b[i]][a[i]]=0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC115A
{
    class Program
    {
        static void Main(string[] args)
        {
            int D;
            D = int.Parse(Console.ReadLine());
            if(D==25)
            {
                Console.WriteLine("Christmas");
            }
            if(D==24)
            {
                Console.WriteLine("Christmas Eve");
            }
            if(D==23)
            {
                Console.WriteLine("Christmas Eve Eve");
            }
            if(D==22)
            {
                Console.WriteLine("Christmas Eve Eve Eve");
            }
            else
            {
                Console.WriteLine(" ");
            }
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
#include <vector>
using namespace std;
#define ff first
#define ss second
#define mp(x, y) make_pair(x, y)
#define pb(x) emplace_back(x)
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

typedef long long ll;
typedef vector<int> V;
typedef pair<int, int> pii;

char s[200010];
vector<char> l, r;
int main()
{
    int q, rev = 0, n;
    scanf("%s%d", s + 1, &q);
    n = strlen(s + 1);
    while (q--) {
        int op, x;
        scanf("%d", &op);
        char tmp[5];
        if (op == 1)
            rev ^= 1;
        else {
            scanf("%d%s", &x, tmp + 1);
            if (x == 1) {
                if (rev)
                    r.push_back(tmp[1]);
                else
                    l.push_back(tmp[1]);
            } else {
                if (rev)
                    l.push_back(tmp[1]);
                else
                    r.push_back(tmp[1]);
            }
        }
    }
    reverse(l.begin(), l.end());
    if (rev) {
        reverse(s + 1, s + 1 + n);
        reverse(l.begin(), l.end());
        reverse(r.begin(), r.end());
        for (auto i : r)
            printf("%c", i);
        printf("%s", s + 1);
        for (auto i : l)
            printf("%c", i);
    } else {
        for (auto i : l)
            printf("%c", i);
        printf("%s", s + 1);
        for (auto i : r)
            printf("%c", i);
    }
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

int main(){
    int N;
    cin >> N;
    long long int num[N];

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

    long long int mn=INT64_MAX,count=0;

    for (int i = 0; i < N; i++){
        if(mn<num[i]){ //最小値よりも当値が高い=条件を満たしていない
            count++;
            //cout << "!" << mn << ',';
            //cout << "change,";
        }
        else{
            mn=num[i];
        }
    }

    cout << N-count;
    
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(){
  int A,B,C;
  scanf("%d %d %d",&A,&B,&C);
  if(A==B){
    printf("%d",C);
  }else if(A==C){
    printf("%d",B);
  }else{
    printf("%d",A);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define line cout << "----------" << endl;


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
void Yay(bool condition){

    if(condition){
        p("Yay!");
    }else{
        p(":(");
    }
    return;
}

//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,ans,a,b,c,d,e,g,h,w,i,j,k,q;
ll s,t;
ll x[300005],y[300005],z[100005];
ll dp[5505][5505];


int main(){
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x[i];
	}
	for(i=1;i<n-1;i++){
		if(x[i-1] < x[i] && x[i] < x[i+1])ans++;
		if(x[i-1] > x[i] && x[i] > x[i+1])ans++;
	}
	p(ans);
	

	return 0;
}


Measured memory_bytes: 14592
import java.io.*;
import java.util.*;

public class Main {
  private static String solve(String s) {
    return String.format("%c%d%c", s.charAt(0), s.length() - 2, s.charAt(s.length() - 1));
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    String s = reader.next();
    out.println(solve(s));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21332
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    cin>>n>>m>>k;
    for(i=n;i<=m;i++)
    {
        if(i%k==0)
            x++;
    }
    cout<<x<<endl;
    return 0;
}



Measured memory_bytes: 3588
#include<stdio.h>
#include<string.h>


int main(){
   int i=0;
  char s[200001];
   long long a=0,d=1LL,x=0,count[2019]={1LL};
    i=scanf("%s",s);
    i=strlen(s);
   while(i--){
           x=(x+(s[i]-'0')*d)%2019;
            a+=count[x]++;
               d=d*10%2019;
               }
        printf("%lld\n",a);
               return 0;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007
typedef long long ll;

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

    for(int i=1;i<=n;i+=2){
        for(int j=1;j<=i;j++) {
            if(i%j==0){
                cnt++;
            }
        }

        if(cnt==8){
            ans++;
        }
        cnt=0;
    }
    cout<<ans<<endl;
}


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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
    for (auto v : (V))                                                         \
        cout << v << ' ';
const int MOD = 1000000007;
/* cout << fixed << setprecision(10) << decimal << endl; */

int main() {
    /* code */
    ll N, M;
    cin >> N >> M;
    vector<ll> H(N);
    REP(i, N) { cin >> H[i]; }
    using AB = pair<ll, ll>;

    vector<bool> Ans(N, true);
    REP(i, M) {
        int A, B;
        cin >> A >> B;
        A--;
        B--;
        //
        if (H[A] > H[B]) {
            // firstのほうが高い → secondはだめは展望台
            Ans[B] = false;
        } else if (H[A] < H[B]) {
            Ans[A] = false;
        } else {
            Ans[A] = false;
            Ans[B] = false;
        }
    }
    int res = 0;
    REP(i, N) {
        if (Ans[i])
            res++;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 4048
#include <cstdio>
int K,S,res;
int main()
{
    scanf("%d%d",&K,&S);
    for (int i=0;i<=K;++i)
        for (int j=0;j<=K;++j) {
            if (i+j>S||S-i-j>K)
                continue;
            ++res;
        }
    printf("%d\n",res);
    return 0;
}


Measured memory_bytes: 128
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#define l(x) (x<<1)
#define r(x) ((x<<1)|1)
#define IL inline
#define reg register
#define LL long long
#define N 200010
#define INF 0x3f3f3f3f
using namespace std;

int n,i,j;
int ans=INF;
set <int> S[N*4];

struct Data{
	int x,y;
	char c;
}a[N];

IL int Abs(int x){return (x<0)?-x:x;}
IL void Swap(int &a,int &b){a^=b^=a^=b;}
IL int Min(int a,int b){return (a<b)?a:b;}
IL int Max(int a,int b){return (a>b)?a:b;}

IL int read(){
	int p=0,f=1;	char	c=getchar();
	while (c<48||c>57)	{if (c=='-')	f=-1;	c=getchar();}
	while (c>=48&&c<=57)	p=(p<<1)+(p<<3)+c-48,c=getchar();
	return p*f;
}

int main(){
	#ifdef __Marvolo
	freopen("zht.in","r",stdin);
	freopen("zht.out","w",stdout);
	#endif
	n=read();
	for (i=1;i<=n;i++){
		a[i].x=read();	a[i].y=read();	a[i].c=getchar();
	}
	if (n==1){
		puts("SAFE");
		return 0;
	}

	for (i=1;i<=n;i++)
		if (a[i].c=='U')	S[a[i].x+a[i].y].insert(a[i].x);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='R'){
			if (!S[a[i].x+a[i].y].size())	continue;
			j=*(--S[a[i].x+a[i].y].end());
			if (j<a[i].x)	continue;
			j=*S[a[i].x+a[i].y].upper_bound(a[i].x);
			ans=Min(ans,j-a[i].x);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//U--R

	for (i=1;i<=n;i++)
		if (a[i].c=='D')	S[a[i].x+a[i].y].insert(a[i].x);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='L'){
			if (!S[a[i].x+a[i].y].size())	continue;
			j=*S[a[i].x+a[i].y].begin();
			if (j>a[i].x)	continue;
			j=*(--S[a[i].x+a[i].y].upper_bound(a[i].x));
			ans=Min(ans,a[i].x-j);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//D--L


	for (i=1;i<=n;i++)
		if (a[i].c=='R')	S[a[i].y-a[i].x+N].insert(a[i].x);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='D'){
			if (!S[a[i].y-a[i].x+N].size())	continue;
			j=*S[a[i].y-a[i].x+N].begin();
			if (j>a[i].x)	continue;
			j=*(--S[a[i].y-a[i].x+N].upper_bound(a[i].x));
			ans=Min(ans,a[i].x-j);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//D--R
	

	for (i=1;i<=n;i++)
		if (a[i].c=='L')	S[a[i].y-a[i].x+N].insert(a[i].x);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='U'){
			if (!S[a[i].y-a[i].x+N].size())	continue;
			j=*(--S[a[i].y-a[i].x+N].end());
			if (j<a[i].x)	continue;
			j=*S[a[i].y-a[i].x+N].upper_bound(a[i].x);
			ans=Min(ans,j-a[i].x);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//D--R
	if (ans!=INF)	ans*=2;


	for (i=1;i<=n;i++)
		if (a[i].c=='R')	S[a[i].y].insert(a[i].x);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='L'){
			if (!S[a[i].y].size())	continue;
			j=*S[a[i].y].begin();
			if (j>a[i].x)	continue;
			j=*(--S[a[i].y].upper_bound(a[i].x));
			ans=Min(ans,a[i].x-j);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//L--R

	for (i=1;i<=n;i++)
		if (a[i].c=='U')	S[a[i].x].insert(a[i].y);
	
	for (i=1;i<=n;i++){
		if (a[i].c=='D'){
			if (!S[a[i].x].size())	continue;
			j=*S[a[i].x].begin();
			if (j>a[i].y)	continue;
			j=*(--S[a[i].x].upper_bound(a[i].y));
			ans=Min(ans,a[i].y-j);
		}
	}
	for (i=0;i<4*N;i++)	S[i].clear();
	//U--D

	if (ans==INF)	puts("SAFE");
	else cout<<ans*5<<endl;	
	return 0;
}

Measured memory_bytes: 52552