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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

#define MAX 200005

const int MOD = 1e9 + 7;

long long fact[MAX], inv[MAX];

long long inverse(long long a) {
    long long ret = 1;
    for (int b=MOD-2; b>0; b/=2) {
        if (b % 2) ret = ret * a % MOD;
        a = a * a % MOD;
    }
    return ret;
}

long long choose(int n, int k) {
    return fact[n] * inv[k] % MOD * inv[n-k] % MOD;
}

pair<int, int> a[3000];
long long dp[3000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    fact[0] = inv[0] = 1;
    for (int i=1; i<MAX; i++) {
        fact[i] = fact[i-1] * i % MOD;
        inv[i] = inverse(fact[i]);
    }

    int h, w, n;
    cin >> h >> w >> n;
    for (int i=0; i<n; i++)
        cin >> a[i].first >> a[i].second;

    sort(a, a + n);
    for (int i=0; i<n; i++) {
        dp[i] = choose(a[i].first + a[i].second - 2, a[i].first - 1);
        for (int j=0; j<i; j++)
            if (a[j].first <= a[i].first && a[j].second <= a[i].second) {
                dp[i] -= dp[j] * choose(a[i].first + a[i].second - a[j].first - a[j].second, a[i].first - a[j].first) % MOD;
                if (dp[i] < 0)
                    dp[i] += MOD;
            }
    }

    long long ret = choose(h + w - 2, h - 1);
    for (int i=0; i<n; i++) {
        ret -= dp[i] * choose(h + w - a[i].first - a[i].second, h - a[i].first) % MOD;
        if (ret < 0)
            ret += MOD;
    }

    cout << ret << "\n";

    return 0;
}


Measured memory_bytes: 6832
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c=0;
    scanf("%d %d",&a,&b);
    for(int i=a;i<=b;i++)
        if(i%10==i/10000&&i/10%10==i/1000%10)
            c++;
    printf("%d",c);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	int n, cou = 0;
	string s;
	cin >> n;
	cin >> s;
	for (int i = 0; i < n-2; ++i)
		if (s[i] == 'A')
			if (s[i + 1] == 'B')
				if (s[i + 2] == 'C')
					cou++;
	cout << cou << endl;
}

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

Measured memory_bytes: 256
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
  
n = int(input())
chk = True
result = 0

while chk:
  if is_prime(n):
    chk=False
    result =n
  n+=1
  
print(result)

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

ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}


int main() {
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;

  ll lcm = n * m / gcd(n, m);
  map<ll, char> mp;
  for (ll i = 0; i < n; ++i) {
    ll idx = i * lcm / n + 1;
    mp[idx] = s[(int)i];
  }

  for (ll i = 0; i < m; ++i) {
    ll idx = i * lcm / m + 1;
    auto it = mp.find(idx);
    if (it != mp.end() && mp[idx] != t[(int)i]) {
      puts("-1");
      return 0;
    }
  }
  cout << lcm << '\n';
  return 0;
}


Measured memory_bytes: 6144
#include<iostream>

int main() {
	int current,remaining,start;
	std::cin >> current >> remaining;

	start = (current + remaining) % 24; //先週やった連番のやつ使いました　現在23時(current==23)　で2時間後(remaining==2)の場合　開始は1時から(start==1) に対応させた　(ただ足しただけだと25時になってしまう　これを24時間表記に直した)

	std::cout << start << std::endl;

	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000003;
#define MAX_X 1000010

struct mint {
    ll x;
    mint(ll x = 0) : x(x % MOD) {}
    mint& operator += (const mint a) {
        if ( (x += a.x) >= MOD) { x -= MOD; }
        return *this;
    }
    mint& operator -= (const mint a) {
        if ( (x += MOD - a.x) >= MOD) { x -= MOD; }
        return *this;
    }
    mint& operator *= (const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator + (const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator - (const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator * (const mint a) const {
        mint res(*this);
        return res *= a;
    }
};

// x の y 乗を求める O(log MOD)
ll modpow(ll x, ll y) {
    if (y == 0) return 1;
    ll res = modpow(x, y / 2);
    return res * res % MOD * (y & 1 ? x : 1) % MOD;
}
// x の逆元を求める O(logMOD)
ll modinv(ll x) { return modpow(x, MOD - 2); }
mint modinv(mint x) { return modpow(x.x, MOD - 2); }

ll Q;

vector<mint> fact;    // 階乗 i!

// 等差数列の積を求める O(log MOD)
// 初項 x, 公差 d, 第 n 項までを求める
// MOD は 10^6 程度までが限界
// fact には [0, mod] の階乗を事前計算したものを渡す
// 例) x = 3, d = 1, n = 4 -> 3 * 4 * 5 * 6 = 360
ll AriProMul(const vector<mint>& fact, ll x, ll d, ll n) {
    // 等差数列の積は d^n * ( (x/d + n - 1)! / (x/d - 1)! ) である
    mint x_d = mint(x) * mint(modinv(d));

    // d が 0 のときは例外 -> x^n になる
    if(d == 0) { return modpow(x, n); }

    // 剰余の関係上 MOD! 以上の階乗は 0 になる
    if(x_d.x + n - 1 >= MOD) { return 0; }

    mint ret = modpow(d, n);
    ret *= fact[ (x_d + n - 1).x ];
    ret *= modinv(fact[ (x_d - 1).x ]);

    return ret.x;
}

signed main()
{
    cin >> Q;

    // fact の作成
    fact.resize(MAX_X);
    fact[0] = 1;
    for(int i = 1; i < MAX_X; ++i) { fact[i] = fact[i-1] * i; }

    REP(i, Q) {
        ll x, d, n;
        cin >> x >> d >> n;
        ll ans = AriProMul(fact, x, d, n);
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 8704
//Built by Sabuj Jana(greenindia) from Jadavpur University,Kolkata,India 
// God is Great------------/////\\\\\\\--------------------------------
 #include <bits/stdc++.h>
 using namespace std;
 #define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
 #define endl "\n"
 #define INF LLONG_MAX
 #define pb push_back
 #define mp make_pair
 typedef vector<int> vi;
 typedef long long ll;
 
 	 
 int main() {
  
    crap;
                  
     int n,m;
     cin>>n>>m;
     
     int arr[m+1];
     memset(arr,0,sizeof(arr));
     int total=n;
     while(n--){
		 
		 int x;cin>>x;
		 while(x--){
			 
			 int y;cin>>y;
			 arr[y]++;
			 
		 }
		 
	 }
		 int cnt=0;
		 for(int i=1; i<=m; i++){
			 
			 //~ if(arr[i]==n)
				//~ cnt++;
			//~ cout<<arr[i]; 
			if(arr[i]==total)
				cnt++;
		 }
		 
		 cout<<cnt<<endl;
	       
      
    return 0;
 }



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
const ll INF = 1e18;
const long double EPS = 1e-10;

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

  vector<vector<bool>> e(n, vector<bool>(n, false));
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    e[a - 1][b - 1]= true;
    e[b - 1][a - 1]= true;
  }

  int ans = 0;
  vector<int> v(n);
  rep(i, n) v[i] = i;
  while (1) {
    if (v[0] != 0) break;
    bool flag = true;
    rep(i, n - 1) {
      if (!e[v[i]][v[i + 1]]) {
        flag = false;
        break;
      }
    }
    if (flag) ans++;
    next_permutation(v.begin(), v.end());
  }
  cout << ans << endl;



  
  return 0;
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };

    let n = sc.read();
    let a: Vec<usize> = sc.vec(n);
    if solve(a) {
        println!("Possible");
    } else {
        println!("Impossible");
    }
}

fn solve(a: Vec<usize>) -> bool {
    let max = *a.iter().max().unwrap();
    let mut count: Vec<usize> = vec![0; max + 1];

    for a in a.into_iter() {
        count[a] += 1;
    }

    for d in 0..(max + 1) {
        if d * 2 < max && count[d] > 0 {
            return false;
        }
        if d * 2 == max && count[d] != 1 {
            return false;
        }
        if d * 2 == max + 1 && count[d] != 2 {
            return false;
        }
        if d * 2 > max && count[d] < 2 {
            return false;
        }
    }

    true
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

int main(){

	char c;

	cin >> c;

	if(c == 'a' || c== 'i' || c == 'u' || c == 'e' || c == 'o')
		cout << "vowel" << endl;
	else
		cout << "consonant" << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 * @author      : omgursocute
 * @created     : 20/01/2020
 * @task        : A
 */

// ===== TEMPLATE STARTS HERE ===== //

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define FORa(i, a, b) for(ll i = (a); i <= (b); ++i)
#define FORb(i, a, b, c) for(ll i = (a); i <= (b); i += (c))
#define FORn(i, n) for(ll i = 0; i < (n); ++i)
#define FORra(i, a, b) for(ll i = (a); i >= (b); --i)
#define FORrb(i, a, b, c) for(ll i = (a); i >= (b); i -= (c))
#define FORrn(i, n) for(ll i = ((n)-1); i >= 0; --i)
#define NUMARGC(_1, _2, _3, _4, NAME, ...) NAME
#define FOR(...) NUMARGC(__VA_ARGS__, FORb, FORa, FORn)(__VA_ARGS__)
#define RFOR(...) NUMARGC(__VA_ARGS__, FORrb, FORra, FORrn)(__VA_ARGS__)

#define XFOR(i, x) for(__typeof((x).begin()) i = (x).begin(); i != (x).end(); ++i)
#define RXFOR(i, x) for(__typeof((x).rbegin()) i = (x).rbegin(); i != (x).rend(); ++i)

#define pll pair<ll, ll>
#define pii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define range(x, a, b) ((x).begin()+a), (x).begin()+b)
#define pb push_back

#define sqr(x) 1ll*(x)*(x)
#ifndef ONLINE_JUDGE
#define debug(x) cerr << '[' << #x << ']' << " = " << x << '\n'
#else
#define debug(x) "cute"
#endif

namespace io {
	void Speed() {
		ios::sync_with_stdio(false);
		cin.tie(NULL); cout.tie(NULL);
	}
#ifndef ONLINE_JUGDE
	void In(string s) {freopen(s.c_str(), "r", stdin);}
	void Out(string s) {freopen(s.c_str(), "w", stdout);}
	void setIO(string s) {In(s + ".inp"); Out(s + "out");}
#endif
}

// ======= TEMPLATE ENDS HERE ======= //

int main() {
	io::Speed();
	
	int a, b;
	cin >> a >> b;

	cout << ((a ^ b) ? "No" : "Yes");

	return 0;
}



Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
A = LIST()

n = len(set(A))

if (N-n)%2 == 0:
	print(n)
else:
	print(n-1)


Measured memory_bytes: 22308
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
#include <stack>
#include <bitset>

////多倍長整数, cpp_intで宣言
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//#pragma GCC target ("avx2")
//#pragma GCC optimization ("Ofast")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define repeat(i, n, m) for(int i = n; i < (m); ++i)
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printLdb(a) printf("%.50Lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define deg_to_rad(deg) (((deg)/360.0L)*2.0L*PI)
#define rad_to_deg(rad) (((rad)/2.0L/PI)*360.0L)
#define Please return
#define AC 0
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */
#define inf numeric_limits<double>::infinity();
#define linf numeric_limits<long double>::infinity()

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

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1e9 + 7;
constexpr ll mod = 998244353;
constexpr long double eps = 1e-6;
const long double PI = acosl(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}


double acot(double x) {
	return PI / 2 - atan(x);
}

ll LSB(ll n) { return (n & (-n)); }

template<typename T>
inline T chmin(T& a, const T& b) {
	if (a > b)a = b;
	return a;
}

template<typename T>
inline T chmax(T& a, const T& b) {
	if (a < b)a = b;
	return a;
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	string s;
	scans(s);
	int a = 0;
	for (const auto& aa : s)a += aa - '0';
	printyn(a % 9 == 0);

	Please AC;
}


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

using namespace std;

ll n , w , weight[111] , score[111] , dp[111][111111];

ll f(ll depth , ll gram) {
	// 현재 depth번쨰를 고를지 말지 생각하고 있고 weight만큼 사용했을때 나머지를 value 의 최대 
	if (gram > w) return -8e18;
	if (depth == n+1) return 0;
	if (dp[depth][gram] != 0) return dp[depth][gram];
		
	return dp[depth][gram] = max(f(depth+1 , gram+weight[depth])+score[depth] , f(depth+1 , gram));
}

int main() {
	scanf("%lld %lld" , &n , &w);
	for (int i = 1; i <= n; i++) scanf("%lld %lld" , &weight[i] , &score[i]);
	printf("%lld" , f(1 , 0));
	
	return 0;
}

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

int main(){
    vector<ll> a;
    ll sum=0;
    for(int i=0; i<5; i++){
        int x;  cin >> x;
        sum += x;
        if(x%10!=0) a.push_back(10-x%10);
    }
    
    if(!a.empty()){
        sort(a.begin(), a.end());
        for(int i=0; i<a.size()-1; i++) sum += a.at(i);
    }
    cout << sum << endl;
}

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

typedef long long ll;

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

    string S;
    int Q;

    cin >> S >> Q;

    vector<char> f;
    vector<char> b;

    bool re = false;

    for(int i = 0; i < Q; i++) {
        int T;
        cin >> T;

        if(T == 1) {
            re = !re;
        } else {
            int F;
            char C;
            cin >> F >> C;
            if(F == 1) {
                if(re) {
                    b.push_back(C);
                } else {
                    f.push_back(C);
                }
            } else {
                if(re) {
                    f.push_back(C);
                } else {
                    b.push_back(C);
                }
            }
        }
    }

    if(re) {
        for(int i = b.size() - 1; i >= 0; i--) {
            cout << b[i];
        }
        for(int i = S.length() - 1; i >= 0; i--) {
            cout << S[i];
        }
        for(int i = 0; i < f.size(); i++) {
            cout << f[i];
        }
    } else {
        for(int i = f.size() - 1; i >= 0; i--) {
            cout << f[i];
        }
        for(int i = 0; i < S.length(); i++) {
            cout << S[i];
        }
        for(int i = 0; i < b.size(); i++) {
            cout << b[i];
        }
    }

    cout << endl;
}

Measured memory_bytes: 976
class Stack<T>(size: Int) {

    private val elements = arrayOfNulls<Any?>(size)

    private var top = 0

    private fun isEmpty() = top == 0

    private fun isFull() = elements.size == top

    fun push(element: T) {
        if (isFull()) throw Exception("error")
        elements[top] = element
        top++
    }

    @Suppress("UNCHECKED_CAST")
    fun pop() : T {
        if (isEmpty()) throw Exception("error")
        val element = elements[top - 1]
        elements[top - 1] = null
        top--
        return element as T
    }
}

fun isNumber(num: String): Boolean {
    try {
        num.toInt()
    } catch (e: NumberFormatException) {
        return false
    }
    return true
}

fun calc(firstNumber: Int, secondNumber: Int, operator: String): Int {
    when (operator) {
        "+" -> return firstNumber + secondNumber
        "-" -> return firstNumber - secondNumber
        "*" -> return firstNumber * secondNumber
    }
    return 0
}

fun main(args: Array<String>) {
    val array = readLine()!!.split(" ")
    val stack = Stack<String>(array.size)

    array.forEach { item ->
        if (isNumber(item)) {
            stack.push(item)
        } else {
            val secondNumber = stack.pop()
            val firstNumber = stack.pop()
            val result = calc(firstNumber.toInt(), secondNumber.toInt(), item)
            stack.push(result.toString())
        }
    }
    println(stack.pop())
}


Measured memory_bytes: 33596
#include <stdio.h>
int main ()
{
	int a,b,c;
	scanf("%i%i",&a,&b);
	c=(a+b)/2;
	if((a+b)%2==0)
	{
		printf("%i",c);
	}
	else
	{
		printf("IMPOSSIBLE");
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;


typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<ld> vld;

#define fi first
#define se second

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const ll inf = ll(1e18);
const int MOD = (1e9 + 7);

int main() 
{

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
	#ifdef DEBUG_
		freopen("input.txt","r",stdin);
	#endif
	cout.setf(ios::fixed), cout.precision(20);
	ll t;
	cin >> t;
	cout<<t*t<<"\n";
	
	return 0;
}



Measured memory_bytes: 256
/*
▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐
TAYA
*/
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <cassert>
#include <iomanip>
#include <random>


using namespace std;



#define ll long long
#define ld double
#define null NULL
#define prev prev228
#define index index228
#define left left228
#define right right228
#define hash hash228
#define y1 y1228
#define y0 y0228
#define firn(i, n) for (int i = 0; i < (int)n; ++i)
#define forn(i, n) for (int i = 1; i <= (int)n; ++i)
#define int long long

template<typename T> inline void uin(T &a, T b) {
    if (b < a) a = b;
}

template<typename T> inline void uax(T &a, T b) {
    if (b > a) a = b;
}

signed main() {
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	vector<int> a;
	int kek;
	while (cin >> kek) a.push_back(kek);
	sort(a.begin(), a.end());
	cout << a.back() - a[0] << endl;
	return 0;
}



// kek













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

int main() {
    int n;
    cin >> n;
    double ans = 0;
    rep(i,n) {
        double a;
        cin >> a;
        ans += 1/a;
    }
    printf("%.10f",1/ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <set>
using namespace std;

int n;
int a[200];

int printa(){
    for(int i=0;i<n-1;i++)cout<<a[i]<<" ";
    cout<<a[n-1]<<endl;
    return 0;
}

int insertionsort(){
    for(int i=1;i<n;i++){
        int v=a[i];
        int j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        printa();
    }
    return 0;
}

int main(){
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    printa();
    insertionsort();
    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define LL       long long
#define PR       pair<LL, LL>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

LL sub[N], vis[N];
vector<int> g[N];

void dfs(int u) {
    vis[u] = 1;
    LL cnt = 0;
    for (auto v : g[u]) {
        if (!vis[v]) {
            dfs(v);
            cnt += sub[v];
            cnt++;
        }
    }
    sub[u] = cnt;
}

int main() {
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 2; i <= n; i++) {
        int u;
        cin >> u;
        g[u].push_back(i);
    }
//    for (int i = 1; i <= n; i++) {
//        if (!vis[i]) {
//            dfs(1);
//        }
//    }
    for (int i = 1; i <= n; i++) {
        cout << (int)g[i].size() << '\n';
    }
    return 0;
}


Measured memory_bytes: 16832
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

ll pow_mod(ll n, ll k, ll mod) {
    if(k == 0) {
        return 1;
    } else if(k % 2 == 1) {
        return pow_mod(n, k - 1, mod) * n % mod;
    } else {
        ll t = pow_mod(n, k / 2, mod);
        return t * t % mod;
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++) {
        a[i] = (ll)(s[i] - '0');
    }
    reverse(ALL(a));
    vector<int> sum(n + 1, 0);
    for(ll i = 0; i < n; i++) {
        sum[i + 1] = sum[i] + a[i] * pow_mod(10, i, p) % p;
        sum[i + 1] %= p;
    }
    map<ll, ll> mp;
    for(ll i = 0; i < n + 1; i++) {
        // cout << sum[i] << " ";
        mp[sum[i]]++;
    }
    // cout << endl;
    ll ans = 0;
    if(p == 2 || p == 5) {
        for(int i = 0; i < n; i++) {
            if(a[i] % p == 0) {
                ans += n - i;
            }
        }
        cout << ans << endl;
        return 0;
    }
    for(const auto &p : mp) {
        ans += (p.second - 1) * p.second / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3348
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n : usize,
    }

    let ans: usize = (1..=n).filter(|x| x % 3 != 0 && x%5 !=0 && x%15 != 0).sum();

    println!("{}", ans);

}

Measured memory_bytes: 2168
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int N,K;
double ans = 0.0;
int main(){
	cin >> N >> K;
	for(int i=1;i<=N;i++){
		double r=1.0/N;
		if(i>=K)r*=1.0;
		else{
			int  p=i;
			while(p<K){p*=2;r/=2;}
		}
		ans+=r;
	}
	printf("%.10f\n",ans);
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, M = map(int,input().split())
a = [int(i) for i in input().split()]
BC = [[int(i) for i in input().split()] for j in range(M)]

a.sort()
BC.sort(key=lambda x: x[1], reverse=True)

answer = 0
point = 0

for i in range(M):
    count = 0
    while count < BC[i][0] and point < N and a[point] < BC[i][1]:
        answer += BC[i][1]
        count += 1
        point += 1

while point < N:
    answer += a[point]
    point+=1

print(answer)



'''
A = [int(i) for i in a]
list_x = []
list_y = []
point = 0

for j in range(M):
    x, y = map(int, input().split())
    list_x.append(x)
    list_y.append(y)

for k in range(len(list_x)):
    if list_x[k] in A :
        point = A.index(list_x[k])
        if A[point] < list_y[k]:
            A[point] = list_y[k]
    else:
        pass

print(sum(A))
'''


Measured memory_bytes: 27088
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define MOD 1000000007
#define all(n) (n).begin(),(n).end()
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}
	
int main(){
	int n;
	string s;
	cin >>n;
	cin >> s;
	FOR(i,s.size()){
		s[i]='A'+((s[i]-'A')+n)%26;
	} 
	cout << s << endl;
}

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

int main(){
  int a, b ;
  char op ;

    cin >> a >> op >> b;
  while (1){

  if ( op == '-' )
    { cout << a-b <<endl;
      cin >> a >> op >> b;
  }else if ( op == '+' ) {
    cout << a+b <<endl;
    cin >> a >> op >> b;
  }else if ( op == '*' ) {
    cout << a*b <<endl;
    cin >> a >> op >> b;
  }else if ( op == '/' ) {
    cout << a/b <<endl;
    cin >> a >> op >> b;
  }else if ( op == '?') break ;

  }
  return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll N,M;
const ll MAX_N=100100;
ll par[MAX_N];
void init(ll n){
    for(ll i=0;i<n;i++) {
        par[i]=i;
    }
}

//根を求める
ll root(ll x){
    if(x==par[x]){
        return x;
    }else{
        return par[x] = root(par[x]);
    }
}
bool same(ll x,ll y){
    return root(x)==root(y);
}
void unite(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y) return;

    par[x] = y;
}




void solve() {
    ll i; string s;
    bool exit = false;
    cin >>N>>M;
    ll p[N];
    ll x[M];
    ll y[M];
    FOR(i,N){
        cin>>p[i];
        p[i]--;
    }
    FOR(i,M){
        cin>>x[i]>>y[i];
        x[i]--;
        y[i]--;
    }
    init(N);
    FOR(i,M)
        unite(x[i],y[i]);
    ll cnt = 0;
    FOR(i,N){
        if(same(i, p[i])){
            cnt++;
            continue;
        }
        if(i==p[i]) cnt++;
    }
    //FOR(i,N)
    //    cout<<p[i]<<endl;
    cout<<cnt<<endl;
    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 3328
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;

int main(){
  string s;
  cin>>s;
  int n=s.size();
  REP(i,n+1) REP(j,i+1){
    string t=s.substr(0,j)+s.substr(i);
    if(t=="keyence"){
      puts("YES");
      return 0;
    }
  }
  puts("NO");


  return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <array>
#include <assert.h>

namespace ABC178
{

  class D
  {
  public:
    D() = default;
    ~D() = default;


    static constexpr long long TH = 1000000007;
    void Run()
    {
      int S = {};
      std::cin >> S;

      long long A = 0;
      std::array<long long, 2001> nums = {};
      for (int i = 3; i <= S; ++i)
      {
        long long ptn = 1; // その数自身の数列はかならずある
        for (int j = 3; j < i; ++j)
        {          
          int rest = i - j;
          if (rest < 3)
          {
            break;
          }
          else
          {
            assert(nums[rest] != 0);
            if (nums[rest] != 0)
            {
              ptn += nums[rest];
            }
          }
        }

        ptn %= TH;
        nums[i] = ptn;
      }

      std::cout << nums[S] << std::endl;
    }
  };

}
int main()
{

  ABC178::D prob;
  prob.Run();

  return 0;
}




Measured memory_bytes: 3208
n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
a=[0]*n
for i in range(m):
    a[l[i][0]-1]+=1
    a[l[i][1]-1]+=1
for i in range(n):
    if a[i]%2==1:
        print('NO')
        break
else:
    print('YES')


Measured memory_bytes: 61016
#include<iostream>
#include<stdio.h>
#include<vector>
#include<ctype.h>
#include<string>
#include<cmath>
using namespace std;

int n;

int main(){
    cin>>n;
    int r,minv,maxv;
    cin>>r;
    minv=r;
    cin>>r;
    maxv=r-minv;
    if(minv>r)minv=r;
    
    for(int i=2;i<n;++i){
        cin>>r;
        if(r-minv>maxv)maxv=r-minv;
        if(minv>r)minv=r;
    }
    cout<<maxv<<endl;
    return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> s(n);
  int sum = 0;
  for(int i = 0; i < n; ++i) {
    cin >> s[i];
    sum += s[i];
  }

  if (sum % 10 != 0) {
    cout << sum << endl;
  } else {
    sort(s.begin(), s.end());
    for(int i = 0; i < n; ++i) {
      if (s[i] % 10 != 0) {
        cout << sum - s[i] << endl;
        return 0;
      }
    }
    cout << 0 << endl;
  }
  return 0;
}


Measured memory_bytes: 256
a=input()
b=int(a)
check_list=list()
for i in range(b):
    c=input()
    d=c.split()
    mark=d[0]
    if mark=="S":
        check_list.append(int(d[1]))
    elif mark=="H":
        check_list.append(int(d[1])+13)
    elif mark=="C":
        check_list.append(int(d[1])+26)
    elif mark=="D":
        check_list.append(int(d[1])+39)
for i in range(1,53):
    if i in check_list:
        pass
    elif not (i in check_list):
        if i<=13:
            print("S",i)
        elif 13<i<=26:
            print("H",i-13)
        elif 26<i<=39:
            print("C",i-26)
        else:
            print("D",i-39)



Measured memory_bytes: 5604
/*
author: rootn
*/

#include<bits/stdc++.h>
using namespace std;

#define X first
#define Y second
#define pb push_back
#define mp make_pair

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    double n, k;cin >> n >> k;
    double p = 1/n;
    double q = 0;
    for(int i = 1;i <= n;i++)
    {
        if(i < k)
        {
            int x = i;
            double value = 1;
            while(x < k){
                x*=2;value *= 1.0/2;
            }
            q += value;
        }else
            q += 1;
    }
    p = p*q;
    cout << setprecision(12) << p << endl;
}


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

long long gcd(long long x, long long y){
    if(y == 0) return x;
    return gcd(y, x % y);
}

int main(){
    long long n, a, b, c, d;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a >> b >> c >> d;
        if(a < b || b > d){
            cout << "No" << endl;
            continue;
        }
        if(b <= c + 1){
            cout << "Yes" << endl;
            continue;
        }
        long long g = gcd(b, d);
        if((a % g) + b - g > c){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()

void solve (int n)
{
    vi a(n);
    forn (i, n)
        cin >> a[i];

    sort(all(a));
    if (a.back() - a[0] > 1)
    {
        cout << "No" << endl;
        return;
    }

    if (a[0] == n - 1 && a.back() == n - 1)
    {
        cout << "Yes" << endl;
        return;
    }

    int gcats = count(all(a), a.back());
    int gcols = a.back() - (n - gcats);
    if (gcols < 0 || gcats < 2 * gcols || (gcats > 0 && gcols == 0))
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 640
import collections
import sys
sys.setrecursionlimit(10**5)
N, M = map(int, input().split())
G = [set() for i in range(N)]
L = [-1]*N


def solve(x, r):
    if L[x] >= 0:
        return(L[x])
    res = 0
    for z in G[x]:
        if r[z]:
            r[z] = False
            res = max(res, solve(z, r) + 1)
        else:
            res = max(res, L[z]+1)
    L[x] = res
    return(res)


for i in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1

    G[x].add(y)

r = [True]*N

for i in range(N):
    # print(L)
    if r[i]:
        L[i] = solve(i, r)
print(max(L))

# print(L)


Measured memory_bytes: 72140
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	vector<int>h(n);

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

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

	LL ans = INF2;

	for (int i = 0; i <= n - k; i++) {
		LL diff = abs(h[i] - h[i + k-1]);

		ans = min(ans, diff);

	}

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

Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	long long xo=0,a[n+5];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		xo=xo^a[i];
	}
	for(int i=0;i<n;i++)
	{
		long long x=a[i]^xo;
		cout<<x<<" ";
	}
	cout<<endl;
	return 0;
}


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

int main()
{
    int h,w,nx,ny;
    string s[50];

    int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
    int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

    cin >> h >> w;
    for (size_t i = 0; i < h; i++)
    {
        cin >> s[i];
    }
    
    int ans;

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            ans = 0;
            if(s[i][j] == '#')continue;
            for (int k = 0; k < 8; k++)
            {
                nx = j + dx[k];
                ny = i + dy[k];

                if(0 <= nx && nx <= w - 1 && 0 <= ny && ny <= h - 1)
                {
                    if(s[ny][nx] == '#')ans++;
                }
                s[i][j] = char(ans + '0');
            }
        }
            
    }
    
    for (size_t i = 0; i < h; i++)
    {
        cout << s[i] << endl;
    }
    
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		if (n<1200) System.out.println("ABC");
		else if(n<2800)System.out.println("ARC");
		else System.out.println("AGC");

	}
}


Measured memory_bytes: 20948
#include <stdio.h>
#include <iostream>
#include <string>
//#include <cmath>
#include <vector>
// #include <algorithm>
// #include <bits/stdc++.h>
using namespace std;

int main() {
  while (1) {
    int x, y;
    cin >> x >> y;

    for (int i=0; i<x; i++) {
      for (int j=0; j<y; j++) {
	if(i==0 || i==x-1 //top under
	   || j==0 ||j==y-1) {//left right
	  cout << "#";
	} else {//center
	  cout << ".";
	}
      }
      cout << endl;
    }

    if(x==0 || y==0) break;
    cout << endl;
  }

  return 0;
}



Measured memory_bytes: 3084
#coding:utf-8

I=raw_input()
n,k=map(int, I.split(" "))

def f(n):
    if n<3:return 0
    if n==3:return 2
    if n%2==0:return f(n-1)
    return f(n-1)+1

if f(n)>=k or k==1:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 2692
/*

I will just keep trying.I know can do it.And I will!!. 

 
   PPPPPPPP    UU      UU     CCCCCCCC    CCCCCCCC     HH     HH     UU      UU
   PP    PP    UU      UU     CC          CC           HH     HH     UU      UU
   PP    PP    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   PPPPPPPP    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   PP          UU      UU     CC          CC           HH     HH     UU      UU
   PP          UUUUUUUUUU     CCCCCCCC    CCCCCCCC     HH     HH     UUUUUUUUUU
  

*/
   
   
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define ford(i,a,b) for(int i=b;i>=a;i--)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define ff first
#define ss second
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
#define endl "\n"
#define mp make_pair
const ll inf = 1e18;
const ll mod = 1e9 + 7;
 
signed main()
{
 
    fast;
    int n;
    cin>>n;
    set<string> s;
    loop(i,n){
    	string str; cin >>str;
    	s.insert(str);
    }
    cout<<s.size()<<endl;
    return 0;
}

Measured memory_bytes: 19244
#include <stdio.h>
#include <math.h>

int main(void) {
	// your code goes here
    
    int i,k;
	int n,m;
	int a[100][100];
	int b[100];
	int c[100] = {0};
	
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		for(k=0;k<m;k++){
			scanf("%d",&a[i][k]);
		}
	}
	
	for(i=0;i<m;i++){
		scanf("%d",&b[i]);
	}
	
	for(i=0;i<n;i++){
		for(k=0;k<m;k++){
			c[i] = c[i] + b[k]*a[i][k];
		}
		printf("%d\n",c[i]);
	}
	
	
	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <ios>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
using namespace std;
typedef long long ll;
#define mp make_pair;
#define pb push_back;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){

  int N ,A, B, C, D;
  cin >> N >> A>> B>> C >> D;
  string S;
  cin >> S;

  
  int nx=1;
  int flag=0;
  for(auto i : S){
    if(nx>=A && nx <=C){
      if(i=='#'){
	flag++;
	if(flag==2){
	  cout << "No" << endl;
	  return 0;
	}
      }
      else{
	flag=0;
      }
    }
    nx++;
  }
  nx=1;
  flag=0;
  for(auto i : S){
    if(nx>=B && nx <=D){
      if(i=='#'){
	flag++;
	if(flag==2){
          cout << "No" << endl;
          return 0;
        }
      }
      else{
        flag=0;
      }
    }
    nx++;
  }



  if(C > D){
    nx=1;
    flag=0;
    for(auto i : S){
      if(nx>=max(B-1,A) && nx <= (D+1)){
	if(i=='.'){
	  flag++;
	  if(flag==3){
	    cout << "Yes" << endl;
	    return 0;
	  }
	}
	else{
	  flag=0;
	}
      }
      nx++;
    }
    cout << "No" << endl; 
    return 0;
  }
  else{
    cout << "Yes" << endl;
    return 0;
  }

}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  bool ok = false;
  srep(i,1,sz(s))if(s[i-1] != s[i])ok = true;
  puts(ok?"Yes":"No");
  return 0;
}

Measured memory_bytes: 256