akhauriyash/Code-Regression huggingface dataset:
// attr {{{
#![allow(
    dead_code,
    non_snake_case,
    unused_imports,
)]
// }}}

// use {{{
use std::fmt;
use std::io::{self,BufRead,Read,Write};
use std::str;
// }}}

const INF: i64 = 1_010_000_000_000_000_000;
const MOD: i64 = 1_000_000_007;
const EPS: f64 = 1e-9;

// util {{{
fn abs_diff(a: i64, b: i64) -> i64 {
    if a < b { b-a } else { a-b }
}

fn is_even(n: i64) -> bool { n % 2 == 0 }
fn is_odd (n: i64) -> bool { n % 2 != 0 }

fn div_ceil(a: i64, b: i64) -> i64 {
    let up = ((a<0) ^ (b>0)) && (a%b != 0);
    a/b + if up { 1 } else { 0 }
}

fn div_floor(a: i64, b: i64) -> i64 {
    let down = ((a>0) ^ (b>0)) && (a%b != 0);
    a/b - if down { 1 } else { 0 }
}

fn modulo(a: i64, b: i64) -> i64 {
    assert!(b > 0);
    let r = a % b;
    if r >= 0 { r } else { r+b }
}

fn chmax(xmax: &mut i64, x: i64) -> bool {
    if x > *xmax {
        *xmax = x;
        true
    }
    else {
        false
    }
}

fn chmin(xmin: &mut i64, x: i64) -> bool {
    if x < *xmin {
        *xmin = x;
        true
    }
    else {
        false
    }
}

fn _gcd(a: i64, b: i64) -> i64 {
    if b == 0 { a } else { _gcd(b, a%b) }
}

fn gcd(v: &[i64]) -> i64 {
    debug_assert!(v.len() >= 1);
    v.iter().fold(0, |a,&b| _gcd(a,b))
}

fn lcm(v: &[i64]) -> i64 {
    debug_assert!(v.len() >= 1);
    v.iter().fold(1, |a,&b| a / _gcd(a,b) * b)
}

fn _INPUT() -> String {
    let mut res = String::new();
    io::stdin().read_to_string(&mut res).expect("read_to_string()");
    res
}

struct Reader<'a> {
    input: &'a String,
    tokens: str::SplitWhitespace<'a>,
}

impl<'a> Reader<'a> {
    pub fn new(input: &'a String) -> Reader {
        Reader {
            input: input,
            tokens: input.split_whitespace(),
        }
    }

    pub fn RD<T>(&mut self) -> T
        where T: str::FromStr,
              <T as str::FromStr>::Err: fmt::Debug
    {
        self.tokens.next().unwrap().parse().unwrap()
    }

    pub fn RD_VEC<T>(&mut self, n: i64) -> Vec<T>
        where T: str::FromStr,
              <T as str::FromStr>::Err: fmt::Debug
    {
        let mut res: Vec<T> = Vec::with_capacity(n as usize);
        for _ in 0..n {
            res.push(self.RD());
        }
        res
    }
}
// }}}

fn main() {
    let input = _INPUT();
    let mut reader = Reader::new(&input);

    let N: i64 = reader.RD();
    let mut A: Vec<i64> = reader.RD_VEC(N);

    A.sort();
    A.dedup();
    let ans = A.len();

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


Measured memory_bytes: 4476
#include <iostream>
using namespace std;
int main(){
    int N;
    int A[200];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    int kisu=0;
    int kaisu=-1;
    while(kisu==0){
        kaisu++;
        for(int i=0;i<N;i++){
            if(A[i]%2==0){
                A[i]/=2;
            }else{
                kisu=1;
            }
        }
    }
    cout << kaisu;
}


Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#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,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, int> pii;
typedef pair<ll, ld> pld;
typedef pair<pii, int> ppiii;
typedef pair<pii, ll> ppiill;
typedef pair<pll, ll> ppllll;
typedef pair<pli, int> pplii;
typedef map<int, int> mii;
typedef deque<ll> dll;
typedef queue<ll> qll;
typedef priority_queue<ll> pqll;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqrll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<pll>> vvpll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define cin(x) cin >> x

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll X = 0;
    cin(X);

    //vll X(N);
    //REP(i,N) cin(X.at(i));

    ll y = 0;
    ll z = X / 100 + 1;

    REP(i,z){
        REP(j,z){
            REP(k,z){
                REP(l,z){
                    REP(m,z){
                        REP(n,z){
                            y = 100 *i +101 *j +102*k +103*l +104*m +105*n;
                            if(y == X){
                                cout << 1 << endl;
                                return 0;
                            }
                            if(y > X) break;

                        }
                    }
                }
            }

        }
    }




    //出力
    cout << 0 << endl;
    //REP(i,N) cout << ans.at(i) <<endl;
  return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    int n;
    cin >> n;
    // int dist[(int)1e5+2] = {};
    // int cumsum[(int)1e5+2] = {};
    int dist[n+2],cumsum[n+2];
    int a[n+2];
    for (int i=0; i<n+2; ++i)
    {
        dist[i]=cumsum[i]=a[i] = 0;
    }
    a[0] = 0;
    for (int i=0; i<n; ++i)
    {
        cin >> a[i+1];
        dist[i+1] = abs(a[i]-a[i+1]);
        cumsum[i+1] = cumsum[i] + dist[i+1];
    }
    a[n+1] = 0;
    cumsum[n+1] = cumsum[n] + abs(a[n]-a[0]);

    int ans = 0;
    for (int i=1; i<n+1; ++i)
    {
        int left = cumsum[i-1];
        int right = cumsum[n+1] - cumsum[i+1];

        ans = left + right + abs(a[i-1]-a[i+1]);
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2432
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		solve();
	}

	public static void solve() {
  		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int h = sc.nextInt();
		int w = sc.nextInt();
		sc.nextLine();
		String[] t = new String[h];
		for(int i = 0; i < h; i++){
			t[i] = sc.nextLine();
		}
		sc.close();

 		for(int i = 0; i < h+2; i++){
			if(i == 0 || i == h+1){
				for(int j = 0; j < w+2; j++){
					out.print("#");
				}
				out.println();
			}else{
				out.println("#" + t[i-1] + "#");
			}
		}
		out.flush();
	}

	static class Pair{
		int a,b;
		public Pair(int a, int b){
			this.a = a;
			this.b = b;
		}
	}
}

Measured memory_bytes: 22228
n,m = map(int,input().split())
L = []
for i in range(m):
    L.append(list(map(int,input().split()))[1:])
p = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    #tmp=np.array([i>>s&1 for s in range(n)])
    #if q==[sum(tmp[array(i)-1])%2for i in L]:
    #    ans+=1
    flag = True   
    a = format(i,"b").zfill(n)#[::-1]
    for j in range(m):
        sw = 0
        for k in range(len(L[j])):
            if a[L[j][k] -1] == "1":
                sw +=1
        if sw%2 != p[j]:
            flag = False
            break
    if flag:
        ans +=1
print(ans)

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

#define f first
#define s second
#define pb push_back

#define left(x) ((x) << 1)
#define right(x) ((x) << 1 | 1)
#define mid(x, y) ((x) + (y) >> 1)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;

const int maxk = 20;
const int maxn = 1e5 + 17;

int N, K, R;
int in[maxn];

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> N;
    for (int i = 1; i <= N; i++) cin >> in[i];
    for (int i = 2; i <= N; i++) if (in[i] == in[i - 1]) in[i] = 0, R++;

    cout << R << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

def main():
    s = input().strip()
    a = s[0] ; b = None
    c = 1 ; d = 0

    for i in range(1, 4):
        if s[i] == a:
            c += 1

        elif b == None:
            b = s[i]
            d += 1

        elif s[i] == b:
            d += 1

    if c == 2 and d == 2:
        print('Yes')
    else:
        print('No')

main()

Measured memory_bytes: 9072
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

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

    int start, end;
    for(start=0; start<s.length(); start++) if(s[start] == 'A') break;
    for(end=s.length()-1; end>-1; end--) if(s[end] == 'Z') break;

    cout << end - start + 1 << endl;

    return 0;
}


Measured memory_bytes: 640
#! /usr/bin/env python3
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

if N == 0:
    acc = A[0]
    if acc == 1:
        print(1)
    else:
        print(-1)
    sys.exit()

inf = 1 << 60

bound = [0] * (N+1)
bound[0] = 1
flag = True
for i in range(1, N+1):
    bound[i] = min(inf, (bound[i-1] - A[i-1]) * 2)
    if bound[i] < A[i]:
        flag = False

if not flag:
    print(-1)
    sys.exit()

nodes = [0] * (N+2)
for i in range(N, -1, -1):
    acc = min(bound[i], nodes[i+1] + A[i])
    nodes[i] = acc

print(sum(nodes))


Measured memory_bytes: 645228
#define STRLEN 15
#define N 1046527
#include <stdio.h>
#include <string.h>

char dict[N][STRLEN];

//将字母转化为数字
int lton(char c) {
    if (c == 'A') {
        return 1;
    }
    else if (c == 'C') {
        return 2;
    }
    else if (c == 'G') {
        return 3;
    }
    else if (c == 'T') {
        return 4;
    }    
    else {
        return -1;
    }
}

long long getKey(char str[]) {
    long long sum = 0;
    int p = 1;
    for (int i = 0; i < strlen(str); i++) {
        sum += p * lton(str[i]);
        p *= 5;
    }
    return sum;
}

int h1(long long key) {
    return key % N;
}

//这里为什么要模 N-1 呢
int h2(long long key) {
    return 1 + (key % (N - 1));
}

int h(long long key, int i) {
    return (h1(key) + i * h2(key)) % N;
}

int insert(char str[]) {
    long long key = getKey(str);
    int i = 0;
    while (1) {
        int hash = h(key, i);
        if (strlen(dict[hash]) == 0) {
            strcpy(dict[hash], str);
            return 0;
        }
        i++;
    }
    return 0;
}

int find(char str[]) {
    int i = 0;
    long long key = getKey(str);
    while (1) {
        int hash = h(key, i);
        if (strcmp(dict[hash], str) == 0) {
            return 1;
        }
        else if (strlen(dict[hash]) == 0) {
            return 0;
        }
        i++;
    }
    return 0;
}

int main() {
    char com[9], str[STRLEN];
    int n = 0;
    // 初始化
    for (int i = 0; i < N; i++) {
        dict[i][0] = '\0';
    }
    scanf("%d", &n);
    for (int i = 0 ; i < n; i++) {
        scanf("%s %s", com, str);
        if (com[0] == 'i') {
            insert(str);
        }
        else {
            if (find(str)) {
                printf("yes\n");
            }
            else {
                printf("no\n");
            }
        }
    }
    return 0;
}


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

map<int,long long int> dp[111][111];

int main() {
    int N, S;
    while (cin >> N >> S, N || S) {
        for (int i = 0; i < 111; i++)
            for (int j = 0; j < 111; j++) dp[i][j].clear();
        dp[0][0][0] = 1;
        for (int i = 0; i <= 100; i++) {
            for (int j = 0; j <= N; j++) {
                for (auto k : dp[i][j]) {
                    dp[i + 1][j + 1][k.first + i] += k.second;
                    dp[i + 1][j][k.first] += k.second;
                }
            }
        }

        cout << dp[101][N][S] << endl;
    }

    return 0;
}

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

using namespace std;

int64_t N;

int main()
{
  cin >> N;
  for (int64_t h = 1; h <= 3500; h++) {
    for (int64_t n = h; n <= 3500; n++) {
      if (4*h*n - n*N - h*N == 0 || (n*h*N)%(4*h*n-n*N-h*N) != 0) continue;
      int64_t w = n * h * N / (4*h*n - n*N - h*N);
      if (w > 0) {
        cout << h << " " << n << " " << w << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;


long long N;


int main()
{

	cin >> N;
	long long ans = -1;

	long long n = N;
	long long a = 1;
	while (a*a<=N) {
		if (n%a == 0) {
			long long b = N / a;
			long long t = b + a - 2;
			if (ans == -1 || t < ans) {
				ans = t;
			}
		}

		a++;
	}

	cout << ans << endl;

	return 0;


}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var buff []byte

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buff, bufio.MaxScanTokenSize*1024)
	log.SetFlags(log.Lshortfile)
}

func main() {
	n := nextInt()
	m := nextInt()
	a := nextInts(m)
	fmt.Println(max(-1, n-sum(a)))
}

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

func nextFloat64() float64 {
	sc.Scan()
	f, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}
	return f
}

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

func nextInts(n int) (r []int) {
	r = make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var MAX = math.MaxInt32

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type Pairs []Pair

func (p Pairs) Len() int {
	return len(p)
}
func (p Pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p Pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 1872
#include <cstdio>
#include <algorithm>
using std::sort;
 
const int MAXN =200000;
 
void new_exclude(int *a,int N)
{
	int i,b[MAXN];
	for(i=0;i<N;i++)
		b[i]=a[i];
	sort(b,b+N);
	
	for(i=0;i<N;i++){
		if(a[i]<b[N/2])
			printf("%d\n",b[N/2]);
		else
			printf("%d\n",b[N/2-1]);
	}
 
}
 
 
int main(void)
{
	
	int i,N,a[MAXN];
	scanf("%d",&N);
	for(i=0;i<N;i++)
		scanf("%d",a+i);
 
	new_exclude(a,N);
	return 0;
 
}
 
 

Measured memory_bytes: 3712
/*---Bismillahir Rahmanir Rahim---*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define sz(x) (int)x.size()
#define ff first
#define ss second
#define pii pair<int, int>
using namespace std; 

int fact(int n){
	if (n<=1) return 1;
	return  n*fact(n-1);
}

inline void solve()
{
	int mn=1000000,ans=0,n;
	cin >> n ; 
	while (n--) {
		int  a; cin >> a;
		if (a<=mn) ans++;
		mn = min(mn,a);
	}
	cout << ans << endl ; 
}

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

/*
5
4 2 5 1 3

*/


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

using namespace std;

int main(){
    long long n,m;
    cin >> n >> m;
    vector<long long> a(n);
    for(long long i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<pair<long long, long long>> b(m);
    for(long long i = 0; i < m; i++){
        long long x,y;
        cin >> x >> y;
        b[i].second = x;
        b[i].first = -y;
    }

    sort(a.begin(),a.end(),greater<long long>());
    sort(b.begin(),b.end());

    vector<long long> sum;
    long long j = 0;
    long long i = 0;
    while(sum.size() < n){
        if(a[i] > -b[j].first){
            sum.push_back(a[i]);
            i++;
            continue;
        }
        if(b[j].second > 0){
            sum.push_back(-b[j].first);
            b[j].second--;
            continue;
        }
        j++;
    }

    long long ans = 0;
    for(long long i = 0; i < sum.size(); i++){
        ans += sum[i];
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int inf = 1 << 30;
const int M = 10;

int main ()
{
    int n;
    cin >> n;
    //vector<int> vi;
    //vector<vi> vvi;
	vvi a = vvi(n,vi(M));
	vvi b = vvi(n,vi(M+1));
	for (int i = 0;i < n;i++)
        for (int j = 0;j < M;j++)
            cin >> a[i][j];
	for (int i = 0;i < n;i++)
        for (int j = 0;j <= M;j++)
            cin >> b[i][j];
	ll res = -inf;
	for(int i = 1;i < (1<<M);i++) {
		ll tmp = 0;
		for(int j = 0;j < n;j++) {
			int cnt=0;
			for (int k = 0;k < M;k++)
                if ((i&1<<k)&&a[j][k])
                    cnt++;
			tmp += b[j][cnt];
		}
		res = max(res,tmp);
	}
	cout << res << endl;
}


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



int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
#ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  freopen("out", "w", stdout);
#endif

  int k;
  cin >> k;
  int mod = 7;
  for (int i = 0; i < k * 3; ++i) {
    if (mod % k == 0) {
      cout << i + 1;
      return 0;
    }
    mod = (10 * mod) % k;
    mod = (mod + 7) % k;
  }
  cout << -1;
  return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>

using namespace std;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))

int main()
{
	int n;
	cin >> n;
	vector<int> t(n + 1);
	vector<int> x(n + 1);
	vector<int> y(n + 1);
	t[0] = x[0] = y[0] = 0;
	rep(i, 1, n)
	{
		cin >> t[i] >> x[i] >> y[i];
	}
	rep(i, 0, n - 1)
	{
		if (t[i + 1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) || (t[i + 1] - t[i]) % 2 != (abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])) % 2)
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 1408
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	n, a, b := nextInt(), nextInt(), nextInt()
	ans1 := min(a, b)
	ans2 := max(a+b-n, 0)
	fmt.Println(ans1, ans2)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
inline int read(int &x){
	char c=getchar();bool f=0;x=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return x;
}
inline void write(int x){
	if(x<0) putchar('-'),write(-x);
	else{if(x>9) write(x/10);putchar('0'+x%10);}
}
const int N=2e3+5;
int ans,n,a[N];
signed main(){
	read(n);
	for(int i=1;i<=n;i++)
		read(a[i]);
	sort(a+1,a+1+n);
	for(int i=1;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			int k=lower_bound(a+j+1,a+1+n,a[i]+a[j])-a-1;
//			printf("%d %d %d\n",i,j,k);
			if(k<=n) ans+=k-j;
		}
	}
	write(ans);
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
signed main(){
    fastio
    int n ;
    cin >> n ;
    map<int,int> mp ;
    for(int i = 2; i < n + 1; i++){
        int x = i ;
        for(int j = 2; j * j <= x; j++){
            while ( x % j == 0 ){
                mp[j]++;
                x /= j ;
            }
        }
        if ( x > 1 ) mp[x]++;
    }
    debug() << imie(mp) ;
    int ans = 0; 
    for(auto &p : mp){
        if ( p.second >= 74 ) ans++ ;
    }
    for(auto p : {make_pair(2, 24) , make_pair(4, 14)}){
        for(auto &c : mp){
            if ( c.second >= p.first ){
                for(auto &k : mp){
                    if ( c.first == k.first ) continue ;
                    if ( k.second >= p.second ) {
                        ans++;
                    }
                }
            }
        }
    }
    debug() << imie(ans) ;
    int cnt = 0 ;
    for(auto &a : mp){
        for(auto &b : mp){
            if ( a.first == b.first ) continue ;
            for(auto &c : mp){
                if ( a.first == c.first || b.first == c.first ) continue ;
                if ( a.second >= 2 && b.second >= 4 && c.second >= 4 ) {
                    debug() << imie(a) imie(b) imie(c) ;
                    cnt++ ;
                }
            }
        }
    }
    ans += cnt / 2;
    cout << ans << endl;
    return 0; 
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
#define ALL(x) (x).begin(), (x).end()
LL POW(LL a,LL p,LL M){ if(!p) return 1LL;LL T = POW(a,p/2,M);T = T*T%M; if(p&1) T=T*(a%M)%M; return T; }
LL SQRT(LL a) { LL b = (LL)sqrtl(((double)a)+0.5); while(b*b<a) ++b; while(b*b>a) --b; return (b*b==a)?b:-1; }
//endl
//<------------------------edits---------------------------------------------->
const LL MOD = 1e9+7;//998244353
// #define LOCAL LDD
#define int LL
LL op;
int fg(string g){
  int cnt = 0;
  while(g.length()>1){
    cnt++;
    int x = g.back()-'0';g.pop_back();
    int y = g.back()-'0';g.pop_back();
    x += y;
    if(x/10>0){
      g += '0' + x/10;
      x %= 10;
    }
    g += '0' + x%10;  
  }
  return cnt;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);cout << fixed;
#ifdef LOCAL
  freopen("input.txt", "rt", stdin);
#endif
  int m;cin >> m;
  LL d[10];
  memset(d,0,sizeof(d));
  for(int i=0;i<m;i++){
    LL nd,cc;
    cin >> nd >> cc;
    d[nd] += cc;
  }  
  op = 0;
  string ff;
  for(int i=0;i<10;i++){
    if(i==0){
      op += d[i];
      continue;
    }
    ff = "";
    for(int j=0;j<10;j++) ff += '0' + i;
    LL ht = fg(ff);
    while(d[i]>=10){
      op += (d[i]/10)*ht;
      d[i] = d[i]/10 + d[i]%10;
    }
  }
  ff = "";
  for(int i=1;i<10;i++) while(d[i]--) ff += '0' + i;
  op += fg(ff);
  cout << op << endl;
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  return 0;
}

Measured memory_bytes: 256
import math

def distance(x , y): 
    return math.sqrt( math.pow(x, 2) + math.pow(y, 2) * 1.0) 

try:
    n, d = map(int, input().split() )
    ans = 0
    for _ in range(0, n):
        x, y = map(int, input().split() )
        dist = distance(x,y);
        if( dist <= d):
            ans += 1
    print(ans)
except:
    pass

Measured memory_bytes: 9252
#include<stdio.h>
#define N 10000
#define M 110

int main(void){
  int i,num,j,k,l;
  int n;
  int array[M],arraydigit,swp;
  int ans[N];
  
  for(i=0;;i++){
    ans[i]=0;

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

    for(j=0;j<n;j++)
      scanf("%d",&array[j]);

    for(j=n-1;j>0;j--){
      for(k=0;k<j;k++){
        if(array[k]>array[k+1]){
          ans[i]++;
          swp=array[k];
          array[k]=array[k+1];
          array[k+1]=swp;
        }
      }
    }
  }

  num=i;

  for(i=0;i<num;i++)
    printf("%d\n",ans[i]);

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#define N 100
#define M 10000

using namespace std;

int Dijkstra(vector< vector<int> > data, int s, int g){
  vector<bool> is_reached(data.size(), false);
  vector<int> ans(data.size(), M);
  ans[s] = 0;

  int i, j;
  i = s;
  while(i != g){
    is_reached[i] = true;
    for(j=0; j<data[i].size(); ++j){
      ans[j] = min(ans[j], ans[i] + data[i][j]);
    }
    for(i=-1, j=0; j<is_reached.size(); ++j){
      if(!is_reached[j] && (i < 0 || ans[i] > ans[j])) i = j;
    }
  }
  return ans[g];
}

int main(){
  int n, m, a, b, c, t;
  int p, q, r;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;
    vector< vector<int> > cost(m, vector<int>(m, M));
    vector< vector<int> > time(m, vector<int>(m, M));

    for(int i=0; i<n; ++i){
      cin >> a >> b >> c >> t;
      --a;
      --b;
      cost[a][b] = c;
      cost[b][a] = c;
      time[a][b] = t;
      time[b][a] = t;
    }
    cin >> n;
    for(int i=0; i<n; ++i){
      cin >> p >> q >> r;
      --p;
      --q;
      if(r == 0) cout << Dijkstra(cost, p, q) << endl;
      else cout << Dijkstra(time, p, q) << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1348
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,a[200005],x;
int main()
{
  cin>>n;
  for(int i=2;i<=n;i++) 
  {
  	 cin>>x;
  	 a[x]++;
  }
  for(int i=1;i<=n;i++) 
  {
  	cout<<a[i]<<endl;
  }

return 0;
}


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

int main(){
    int n; cin >> n;
    ll s[n+1];
    s[0] = 0;
    for(int i = 1; i <= n; i++){
        ll a; cin >> a;
        s[i] = s[i-1] + a;
    }
    sort(s, s+n+1);
    ll ans = 0, c = 1;
    for(int i = 0; i < n+1; i++){
        if(s[i] == s[i+1]) c++;
        else {ans += c*(c-1)/2; c = 1;}
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
package main
  
import (
    "fmt"
)

func main() {
    var a, b, c, d int
    fmt.Scan(&a, &b, &c, &d)
    lcm := clcm(c, d)
    anum := calc(a-1, c) + calc(a-1, d) - calc(a-1, lcm)
    bnum := calc(b, c) + calc(b, d) - calc(b, lcm)
    fmt.Println((b - a + 1) - (bnum - anum))
}

func calc(a, b int) int {
    return int(a / b)
}

func clcm(a, b int) int {
    x := a * b
    if a < b {
        a, b = b, a
    }
    r := a % b
    for r != 0 {
        a = b
        b = r
        r = a % b
    }
    return x / b
}


Measured memory_bytes: 512
def dgsm(n):
    ans=0
    while n>0:
        ans+=n%10
        n//=10
    return(ans)
n=input()
if len(n)==1:
    print(n)
    exit()
ans=True
for i in range(1,len(n)):
    if n[i]!="9":
        ans=False
if ans:
    print(int(n[0])+(len(n)-1)*9 )
    exit()
print((len(n)-1)*9+int(n[0])-1)

Measured memory_bytes: 3064
#define _CRT_SECURE_NO_WARNINGS 1

#include <set>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int maxn = 2e5 + 7;

char s[maxn];

int main() {
	int n;
	sd(n);
	scanf("%s",s);
	int len = strlen(s);
	int numr = 0 , numw = 0;
	rep(i,0,len-1) {
		if(s[i] == 'R') numr++;
		else numw++;
	}
	int ans = numr;
	rep(i,0,numr-1) {
		if(s[i] == 'R') ans--;
	}
	pd(ans);
	return 0;
}

Measured memory_bytes: 3968
#include <iostream>
#include <cstring>
using namespace std;
int N, A[20], x[20][20], y[20][20];

int main(){
    cin >> N;
    for (int i = 1; i <= N; i++){
        cin >> A[i];
        for (int j = 1; j <= A[i]; j++){
            cin >> x[i][j] >> y[i][j];
        }
    }
    int ans = 0;
    for (int bits = 0; bits < (1 << N); bits++){
        int res = 0;
        bool ok = true;
        for (int i = 1; i <= N; i++){
            if (bits & (1<<(i-1))){
                res ++;
                for (int j = 1; j <= A[i]; j++){
                    if (((bits>>(x[i][j]-1))&1)^y[i][j]) ok = false;
                }
            }
        }
//        cout << res << " " << bits << " " << ok << endl;
        if (ok) ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
fn read() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let n: usize = read().trim().parse().unwrap();
    let s: Vec<char> = read().trim().chars().collect();
    let mut cnt = s[1..].iter().filter(|&&x| x == 'E').count();
    let mut ans = cnt;
    for i in 1..n {
        if s[i - 1] == 'W' {
            cnt += 1;
        }
        if s[i] == 'E' {
            cnt -= 1;
        }
        ans = std::cmp::min(ans, cnt);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import scala.io.StdIn.readLine

case class Model(a: Int, b: Int) {
  require(1 <= a && a <= 3)
  require(1 <= b && b <= 3)

  private val ab = a * b

  def isExist: Boolean =
    (1 to 3) exists (c => (c * ab) % 2 == 1)
}

object Main extends App {

  val input = readLine.split(" ").map(_.toInt)
  if(Model(input(0), input(1)).isExist)
    println("Yes")
  else
    println("No")

}


Measured memory_bytes: 25428
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MAX 100
int min(int,int);
int p[MAX+1]={},m[MAX+1][MAX+1]={};

int min(int n1,int n2){
  if(n1>n2) return n2;
  else return n1;
}

int main()
{
  int n,l,i,j,k;
  
  scanf("%d",&n);
  
  for(i=1;i<=n;i++){
    scanf("%d %d",&p[i-1],&p[i]);
  }
  
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(k=i;k<=j-1;k++){
	m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  
  printf("%d\n",m[1][n]);
  
  return 0;
}

Measured memory_bytes: 2708
//#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<string>
#include<cstdlib>
#include<bitset>
#include<sstream>
#include<queue>
#include<stack>
#include<list>
#include<limits>
#include<iomanip>

using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pt;
typedef pair<ll,ll> pll;

#define Max 1000001
#define intinf 2147483647
#define longlonginf 9223372036854775807
#define MOD 998244353
#define MOD2 1000000007
#define fastio ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define vint vector<int>
#define vll vector<long long>
#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define F(i,n) for(int i = 0;i<n;i++)
#define Fr(i,l,r) for(int i = l;i <= r;i++)
#define rF(i,n) for(int i = n-1;i>=0;i--)


//#define min(a,b) a>b?b:a
//#define max(a,b) a>b?a:b
#define all(arr) arr.begin(),arr.end()
//#define sort(vec) sort(vec.begin(),vec.end())
//#define reverse(vec) reverse(vec.begin(),vec.end())


ll Lpow(ll a,ll b)
{
    ll ans = 1;
    while(b > 0)
    {
        if(b%2)
            ans = (ans*a);
        a = (a*a);
        b = b/2;
    }
    return ans;
}

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

ll dp[105][100005];

signed main()
{
    fastio;
    
    int n,W;
    cin >> n >> W;
    
    
    vector<int> w(n+1);
    vector<int> v(n+1);
    
    for(int i = 1;i<=n;i++)
    {
        cin >> w[i] >> v[i];
    }
    
    for(int i = 1;i<=n;i++)
    {
        for(int j = 0;j<=W;j++)
        {
            if(j >= w[i])
                dp[i][j] = max(dp[i-1][j - w[i]] + v[i],dp[i-1][j]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    
    cout << dp[n][W] << endl;
    
    return 0;
}


Measured memory_bytes: 79360
N, M = map(int,input().split())

class ID:
    def __init__(self,p,y,i):
        self.p = p
        self.y = y
        self.i = i
        self.ID1 = None
        self.ID2 = None

    def ID(self):
        for i in range(1,7):
            if self.ID1 < 10**i:
                self.ID1 = "0"*(6-i) + str(self.ID1)
                break
        for i in range(1,7):
            if int(self.ID2) < 10**i:
                self.ID2 = "0"*(6-i) + str(self.ID2)
                break
        
        return self.ID1 + self.ID2

cities = []
for i in range(0,M):
    P,Y = map(int,input().split())
    cities.append(ID(P,Y,i))
cities.sort(key = lambda x: x.y)
counter = [-1]

for i in range(0,N):
    counter.append(1)

for c in cities:
    c.ID1 = c.p
    c.ID2 = counter[c.p]
    counter[c.p] = counter[c.p] + 1

cities.sort(key = lambda x: x.i)

for i in range(0,M):
    print(cities[i].ID())


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

int main()
{
  string S;
  cin >> S;
  bool ans = true;
  int N = S.size();
  int half_N = N / 2;

  rep(i, N / 2) {
    if (S.at(i) != S.at(N - i - 1)) {
      ans = false;
      break;
    }
  }
  rep(i, half_N / 2) {
    if (S.at(i) != S.at(half_N - i - 1)) {
      ans = false;
      break;
    }
  }
  reverse(S.begin(), S.end());
  rep(i, half_N / 2) {
    if (S.at(i) != S.at(half_N - i - 1)) {
      ans = false;
      break;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll max_N = 1e6 + 50, INF = 1e15, MOD = 1e9 + 7;
ll N, K, heights[max_N], min_cost[max_N];

int main()
{
    cin >> N >> K;
    for (int i = 0; i < N; ++i)
        cin >> heights[i];
    for (int i = 1; i < N; ++i)
    {
        min_cost[i] = INF;
        for ( int j = i - K ; j < i; ++j)
        {
            if (j < 0) 
                continue;
            min_cost[i] = min(min_cost[i], abs(heights[i] - heights[j]) + min_cost[j]);
        }
    }
    cout << min_cost[N-1] << "\n";
    return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;

  if (A + B >= A - B && A + B >= A * B){
    cout << A + B << endl;
  }
  else if (A - B >= A + B && A - B >= A * B)
  {
    cout << A - B << endl;
  }
  else
  {
    cout << A * B << endl;
  }
  
  
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << el;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

int main() {
	ll N, K; cin >> N >> K;
	vll A(N); cin >> A;

	sort(begin(A), end(A));
	
	ll ng = -LLINF, ok = LLINF;
	while (llabs(ng - ok) > 1) {
		ll X = (ng + ok) / 2;
		ll cnt = 0;
		//cout << X << endl;
		for (int i = 0; i < N - 1; i++) {
			if (A[i] < 0) {
				ll aa = -A[i];
				ll xx = llabs(X);
				ll num;

				if (X < 0) num = (xx + aa - 1) / aa;
				else if (X == 0) num = 0;
				else num = xx / aa;

				if (X != 0) num *= -(X / xx);
				cnt += N - (lower_bound(begin(A) + i + 1, end(A), num) - begin(A));
			} else if (A[i] > 0) {
				if (X > 0) {
					ll num = X / A[i];
					cnt += (--upper_bound(begin(A) + i + 1, end(A), num) - begin(A)) - i;
				}
			} else {
				if (X >= 0) {
					cnt += N - i - 1;
				}
			}
			if (X == -12) cout << i << " " << cnt << endl;
		}
		if (cnt >= K) ok = X;
		else ng = X;
		//cout << cnt << endl;
	}
	cout << ok << endl;
	return (0);
}


Measured memory_bytes: 1792
//ABC93B
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
using namespace std;
int main(void){
    long A, B;
    int K;
    set<long>st;
    cin >> A >> B >> K;
    rep(i, K){
        if(A+i<=B) st.insert(A+i);
    } 
    rep(i, K){
        if(B-i>= A) st.insert(B-i);
    }
    for(auto itr= st.begin(); itr !=st.end(); itr++) cout << *itr << endl;
}

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

int main(int argc, char const *argv[]) {
    string S;
    string A = "keyence";
    std::cin >> S;

    auto r = search(S.begin(), S.end(), A.begin(), A.end());
    if (r==S.begin()||r==S.end()-7){
        std::cout << "YES" << '\n';
        return 0;
    }
    int nm;
    for (size_t i = 0; i < S.size(); i++) {
        if(S[i]!=A[i]){
            nm=i;
            break;
        }
    }
    r = search(S.end()-(7-nm), S.end(), A.begin()+nm, A.end());
    if(r!=S.end()){
        std::cout << "YES" << '\n';
        return 0;
    }
    std::cout << "NO" << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <cmath>

using namespace std;

using point = pair<float, float>;

inline float distance(point &a, point &b) { return sqrt(pow(a.first - b.first, 2) + pow(a.second - b.second, 2)); }

float closestSplit(point x[], int n, float sigma)
{
    float xbar = x[n/2].first, d = sigma;
    point sy[n];
    int j = 0;
    for (int i = 0; i < n; ++i)
        if (abs(xbar - x[i].first) <= sigma)
            sy[j++] = x[i];
    sort(sy, sy+j, [] (point &a, point &b)
    {
        return a.second < b.second;
    });
    for (int i = 0; i < j; ++i)
        for (int k = 1; k < 8 && i+k < j; ++k)
            d = min(d, distance(sy[i], sy[i+k]));
    return d;
}

float closestPairDistance(point x[], int n)
{
    if (n < 4)
    {
        float d = numeric_limits<float>::max();
        for (int i = 0; i < n; ++i)
            for (int j = i+1; j < n; ++j)
                d = min(d, distance(x[i], x[j]));
        return d;
    }
    float sigma = min(closestPairDistance(x, n/2), closestPairDistance(x + n/2, n - n/2));
    return closestSplit(x, n, sigma);
}

int main()
{
    int n;
    scanf("%d", &n);
    point x[n];
    for (int i = 0; i < n; ++i)
        scanf("%f %f", &x[i].first, &x[i].second);
    sort(x, x+n, [] (point &a, point &b)
    {
        return a.first < b.first;
    });
    cout << setprecision(8) << showpoint << fixed << closestPairDistance(x, n) << endl;
}



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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }
const ll MOD = 1e9+7;
#define pii pair<int,int>
#define pll pair<ll,ll>


int main(){
    ll N,K; cin>>N>>K;
    ll a[N+1];
    ll visit[N+1];
    for(int i=1;i<=N;++i){
        cin >> a[i];
    }
    FILL(visit,N+1,-1);
    
    int idx_cur = 1;
    int num = 0;
    int idx_start_r;
    int num_start_r;
    int num_end_r;
    while(1){
        if(visit[idx_cur]<0){
            visit[idx_cur] = num;
            idx_cur = a[idx_cur];
            ++num;
        }else{
            idx_start_r = idx_cur;
            num_start_r = visit[idx_cur];
            num_end_r = num;
            break;
        }
    }
    ll ans;
    if(K<=num_end_r){
        ans = 1;
        ll count = 0;
        while(count<K){
            ans = a[ans];
            ++count;
        }
    }else{
        K -= num_start_r;
        K %= (num_end_r-num_start_r);
        ans = idx_start_r;
        ll count = 0;
        while(count<K){
            ans = a[ans];
            ++count;
        }
        
    }
    cout << ans << "\n";
}


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


int main(){
  string s;
  int sum=0;
  cin>>s;
  for(int i=0;i*2<s.length();i++){
    if(s[i]!=s[s.length()-1-i]) sum++;
  }
  cout<<sum<<endl;

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int a,b,c=0;
    cin>>a>>b;
    for(int i=a;i<=b;i++){
        int m1,m2,m3,m4;
        m1=i/10000;
        m2=i/1000-m1*10;
        m3=(i%100)/10;
        m4=i%10;
        if(m1==m4&&m2==m3){
            c=c+1;
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define thekingisborn ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ld  long double
#define f first
#define se second
#define pb push_back
#define maxn 200005
#define mod 1000000007
#define pi 3.14159265359

using namespace std;

typedef pair<int,int>pii;
typedef pair<ll,ll>pll;

/*ll power(ll a,ll n)
{
    if(n == 1)return a%mod;
    if(n == 0)return 1;
    a = a%mod;
    if(n&1)return ((a%mod)*(power((a*a)%mod,n>>1))%mod)%mod;
    return power((a*a)%mod,n>>1)%mod;
}
ll gcd(ll a,ll b)
{
    if(a%b == 0)return b;
    return gcd(b,a%b);
}*/
/*int root(int x)
{
    while(par[x] != x)
    x = par[x];
    return x;
}
void dsu(int x,int y)
{
  if(root(x) == root(y))return;
  par[root(y)] = root(x);
  return;
}
void dfs(int x)
{
    done[x] = true;
    for(int i=0;i<int(adj[x].size());++i)
    {
        int y = adj[x][i];
        if(!done1[y])
        dfs(y);
    }
}*/
ll n;
vector<ll>v(3*maxn);

int main()
{
    thekingisborn;
    /*cin >> n;
    for(int i=0;i<(1<<n);++i)
    cin >> v[i];*/
    string s;
    cin >> s;
    int w;
    cin >> w;
    for(int i=0;i<int(s.size());i = i+w)
    cout << s[i];
    return 0;
}


Measured memory_bytes: 4992
import java.util.*;

public class Main {
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[2*n];
        for(int i = 0; i < arr.length; ++i)
            arr[i] = sc.nextInt();
        
        Arrays.sort(arr);
        int sum = 0;
        
        for(int i = 0; i < arr.length; i += 2)
            sum += Math.min(arr[i], arr[i+1]);
        System.out.println(sum);
    }
}

Measured memory_bytes: 35812
N = int(input())
D = list(map(int, input().split()))

count = [0]*(max(D)+1)
ans = 1

for i in range(N):
    count[D[i]] += 1

if count[0] != 1 or D[0] != 0:
  print(0)
  exit()
 
for i in range(1,max(D)+1):
    ans *= count[i-1]**count[i]
    ans %= 998244353
print(ans)


Measured memory_bytes: 13892
def gcd(a,b):
    if b>a:
        a,b=b,a
    while b:
        a,b=b, a%b
    return a

def cul(n,x):
    l=len(x)
    b=[x[i] for i in range(l)]
    b.pop(n)
    tmp=b[0]
    for i in range(1,l-1):
        tmp=gcd(tmp,b[i])
    return tmp

import sys
p=50
N=int(input())
a=list(map(int,input().split()))
if N<=p:
    ans=0
    
    for i in range(N):
        tmp=cul(i,a)        
        if tmp>ans: ans=tmp
    print(ans)
    sys.exit()

ans=0
for i in range(p):
    s=cul(i,a[:p])
    if s>ans: ans=s

print(ans)


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

int main() {
	int N;
	string S, T;
	cin >> N;
	cin >> S >> T;

	string ans = "";
	rep(i, N) {
		ans += S[i];
		ans += T[i];
	}

	cout << ans << endl;

}

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

using namespace std;

int main() {
  size_t H, A;
  cin >> H >> A;
  if (H % A == 0) {
    cout << H / A << endl;
  } else {
    cout << H / A + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
int main(){
  i64 L,R;
  cin >> L >> R;
  i64 ans = 2020;
  const i64 Mod = 2019;
  const i64 R_max = i64(2*1e9);
  for(i64 l = L; l < min({R,L+2019,R_max}); l++){
    for(i64 r = l+1; r <= min({R,L+2019,R_max}); r++){
      ans = min(ans, (l*r)%Mod);
    }
  }
  cout << ans << endl;
}

  


Measured memory_bytes: 256