akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_mut, unused_macros, unused_variables, unused_assignments, non_snake_case, unused_imports, dead_code)]

use std::cmp::*;
use std::collections::*;

// [Rustで競技プログラミングの入力をスッキリ記述するマクロ - Qiita]
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 から拝借
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    // ABC128-C-Switches用に拡張
    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, $t);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Pythonからの移行組としては苦しすぎるのでライブラリ濫造
fn gcd(a:usize, b:usize) -> usize {
    if b == 0 {return a};
    return gcd(b, a % b);
}

// エントリーポイント
fn main() {
    input! {
        X : usize
    }
    let mut c = X / 11 * 2;
    if 0 != X % 11 {
        c += 1;
    }
    if 6 < X % 11 {
        c += 1;
    }
    println!("{}", c);
}


Measured memory_bytes: 4352
use proconio::input;

fn main() {
    input! {
        mut n: i128,
    }
    let mut name = Vec::new();
    loop {
        n -= 1;
        name.push(n % 26);
        n /= 26;
        if n == 0 { break }
    }
    for c in (0..name.len()).rev() {
        print!("{}", decoder(name[c]))
    }
    println!("");
}

fn decoder(input: i128) -> char {
    let a = 'a' as u8;
    (a + input as u8) as char
}

Measured memory_bytes: 2144
#include<stdio.h>
#define Max 10000
#define Oya -1

int setHeight(int);
void setDepth(int,int);
void print(int);
int getSibling(int);

typedef struct{
  int parent,left,right;
}Node;

Node T[Max];
int n, D[Max], H[Max];

void setDepth(int u, int d){
  if(u == Oya) return;
  D[u] = d;
  setDepth(T[u].left, d+1);
  setDepth(T[u].right, d+1);
}

int setHeight(int u){
  int h1 =0,h2=0;
  if(T[u].left != Oya){
    h1 = setHeight(T[u].left)+1;}
  if(T[u].right != Oya){
    h2 = setHeight(T[u].right)+1;}
  if(h1>h2){
    H[u] = h1;
    return H[u];}
  else{
    H[u] = h2;
    return H[u];}
}

int main(){

  int K,i,left,right,n,root=0;
    scanf("%d",&n);

    for(i = 0; i<n; i++){
      T[i].parent = Oya;
    }

    for(i=0; i<n; i++){
      scanf("%d %d %d", &K,&left,&right);
      T[K].left = left;
      T[K].right = right;
      if(left != Oya) T[left].parent = K;
      if(right != Oya) T[right].parent = K;
    }

    for(i=0; i<n; i++){
      if(T[i].parent == Oya) root = i;
    }

    setDepth(root,0);
    setHeight(root);

    for(i=0; i<n; i++) print(i);

    return 0;
	  
}

void print(int u){
  printf("node %d: ",u);
  printf("parent = %d, ", T[u].parent);
  printf("sibling = %d, ", getSibling(u));
  int deg = 0;
  if(T[u].left != Oya) deg++;
  if(T[u].right != Oya) deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == Oya){
    printf("root\n");
  }
  else if(T[u].left == Oya && T[u].right == Oya){
    printf("leaf\n");
  }
  else{
    printf("internal node\n");
  }
}

int getSibling(int u){
  if(T[u].parent == Oya) return Oya;
  if(T[T[u].parent].left != u && T[T[u].parent].left != Oya)
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != Oya)
    return T[T[u].parent].right;
  return Oya;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
using namespace std;
int main(){

int N, M;
cin >> N >> M;

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

vector<priority_queue<int>> way(N);
int A, B;
for(int i = 0; i < M; i++){
  cin >> A >> B;
  way[A-1].push(high[B-1]);
  way[B-1].push(high[A-1]);
}




  int count = 0;
  for(int i = 0; i < N; i++){
    if(way[i].empty() || high[i] > way[i].top()) count++;
  }
  
  cout << count << endl;
  
  
}



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


void solve(long long N, std::string S)
{
    long long ans=0;
    for(int i=0;i<N-2;i++)
    {
        if(S[i]=='A'&&S[i+1]=='B'&&S[i+2]=='C')
        {
            ans++;
            i+=2;
        }
    }
    cout<<ans<<endl;
}

int main()
{
    long long N;
    scanf("%lld",&N);
    std::string S;
    std::cin >> S;
    solve(N, S);
    return 0;
}


Measured memory_bytes: 256
#coding:utf-8
#DPの練習

n, m = map(int, input().split())

#壊れている階段とそうでない階段を判別するリスト
broken = [0] * (n+1)

#段ごとに何通りかを集計するためのリスト
dp = [0] * (n+1)
#0段目は必ず1通りしかない
dp[0] = 1


#壊れている階段をマークする
for i in range(m):
    broken[int(input())] = 1

#1段目から壊れている可能性があるので場合分け
if broken[1] == 1:
    dp[1] = 0
else:
    #1段目が無事な場合は1通り
    dp[1] = 1

#2段目以降
for i in range(2, n+1):
    if broken[i] == 1:
        #壊れていた場合次の段を確認する
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] = dp[i] % 1000000007

print(dp[n])



Measured memory_bytes: 7668
//Author : pakhandi
//
using namespace std;

#include <bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define PB push_back
#define SZ size
#define MP make_pair

#define IGNORE cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');

std::vector<pair<ll, ll> > vals;
ll matSize[2];
ll done[2];

int main()
{
	int i, j;
	cin >> matSize[0] >> matSize[1];

	fl(i,0,matSize[0])
	{
		ll t;
		cin >> t;
		vals.PB(MP(t, 0LL));
	}

	fl(i,0,matSize[1])
	{
		ll t;
		cin >> t;
		vals.PB(MP(t, 1LL));
	}

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

	matSize[0]++;
	matSize[1]++;

	ll ans = 0;

	fl(i,0,vals.SZ())
	{
		pair<ll, ll> p = vals[i];

		// cout << p.first << " " << p.second << " " << matSize[p.second ^ 1] << " " << done[p.second ^ 1]; nline;

		ans += (p.first * (matSize[p.second ^ 1] - done[p.second ^ 1]) );
		done[p.second]++;
	}

	cout << ans;

	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 4592
/*
 * WelcomeToAtCoder.cpp
 *
 *  Created on: 2020/02/19
 *      Author: black
 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;

int main(){
	int N, K;
	string S;
	cin >> N >> K >> S;
	S[K-1] += 0x20;

	cout << S << endl;

	return 0;
}


Measured memory_bytes: 256
ptext_r = gets.chomp.reverse
kword_r = gets.chomp.reverse
pattern = Regexp.new(kword_r.split('').map{|c| "[\\?#{c}]" }.join(''))
result = ptext_r.sub(pattern, kword_r)
if Regexp.last_match then
  print result.reverse.gsub(/\?/, 'a')
else
  print 'UNRESTORABLE'
end

Measured memory_bytes: 1788
//Kaori Miyazono, did I reach you ?
//"I can't die because... I'm the one who will protect you." -Asuna Yuuki

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

const int N = 200200;

int n;
int a[N], b[N];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}	
	for(int i = 0; i < n; i++) {
		cin >> b[i];
	}
	long long int ans =  0;
	for(int bit = 29; bit >= 0; bit--) {
		int cur = (1 << bit);
		for(int i = 0; i < n; i++) {
			a[i] &= (2 * cur - 1);
		}
		for(int i = 0; i < n; i++) {
			b[i] &= (2 * cur - 1);
		}
		sort(a, a + n);
		reverse(a, a + n);
		sort(b, b + n);
		int A = cur;
		int B = 2 * cur;
		int C = B + A;
		int ai = 0;
		int bi = 0;
		int ci = 0;
		cur = 0;
		for(int i = 0; i < n; i++) {
			while(ai < n && a[i] + b[ai] < A) ai++;
			while(bi < n && a[i] + b[bi] < B) bi++;
			while(ci < n && a[i] + b[ci] < C) ci++;
			cur += (bi - ai) + (n - ci);
		}
		if (cur & 1) {
			ans |= (1 << bit);	
		}
	}
	cout << ans << endl;
   	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n)
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define ddvi vector<vector<int>>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	// ここに処理を記述

	ll N, K;

	cin >> N >> K;

	if(N < K){
		cout << min(N, abs(N - K)) << "\n";
		return 0;
	}
	else if(N == K){
		cout << "0" << "\n";
		return 0;
	}
	else{
		cout << min(N % K, abs((N % K) - K)) << "\n";
	}

	return 0;
}

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

int main(){

  string n;

  while(cin >> n){

    if(n == "#") break;

    string QWERTY[2] = {"yuiophjklnm","qwertasdfgzxcvb"};
    int judge[32] = {0};
    int cnt = 0, count = 0;

    for(int i = 0; i < (int)n.size(); i++){
      for(int j = 0; j < (int)QWERTY[0].size(); j++){
	if(n[i] == QWERTY[0][j]){
	  judge[i] = 1;
	  //cout << QWERTY[0][j];
	}
      }
      for(int j = 0; j < (int)QWERTY[1].size(); j++){
	if(n[i] == QWERTY[1][j]){
	  judge[i] = 2;
	  // cout << QWERTY[1][j];
	}
      }
    
    
    
    }

    cnt = judge[0];
    for(int k = 1; k < (int)n.size(); k++){
      if(cnt != judge[k]){
	cnt = judge[k];
	count++;
      }
    }
	    
    cout << count << endl;
    count = 0;


  } 

  return 0;
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
 
 
int main(){
  long long x;
  cin >> x;
  long long ans  = 0;
  long long sum = 100;
  while(sum < x){
    ans ++ ;
    sum += sum/100;
  }
  cout << ans  << endl;
  
}

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
using namespace std;

int main() {

	double R;
	cin >> R;

	double pi = 3.1415;

	cout << fixed;
	cout << setprecision(5) << 2.0 * pi * R << endl;

	return 0;
}


Measured memory_bytes: 3776
s = input()
n = len(s) - 1
ans = 0
for bit in range(2**n):
  a =s[0]
  for i in range(n):
    if (bit >> i) & 1:
      a += "+"
    a += s[i+1]
    # print(a)
  ans += sum(map(int,a.split("+")))

print(ans)



Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;

int main(){
	ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll n,m,ans=0;
	cin>>n>>m;
	priority_queue<ll,vector<ll>,greater<ll> > pq;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		pq.push(t);
	}
	int k=n-m;
	if(k>0){
		while(k--){
			ans+=pq.top();
			pq.pop();
		}		
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2420
void main() {
	(ri.to!real.sqrt.floor ^^ 2).to!int.writeln;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
        b: [i64; n],
    };
    let mut d = 0_i64;
    for (&a_i, &b_i) in a.iter().zip(b.iter()) {
        if a_i == b_i {
            continue;
        }
        if a_i < b_i {
            d += (b_i - a_i) / 2;
        } else {
            d += b_i - a_i;
        }
    }
    let ans = d >= 0;
    println!("{}", if ans { "Yes" } else { "No" });
}


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

typedef long long ll;
const int MAX_HW = 2000;

int main() {
  int H, W;
  static char grid[MAX_HW][MAX_HW] = {};
  std::vector<int> cols[MAX_HW], rows[MAX_HW];

  std::cin >> H >> W;
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      std::cin >> grid[i][j];
    }
  }

  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      if(grid[i][j] == '#') {
        rows[i].push_back(j);
        cols[j].push_back(i);
      }
    }
  }
  for(int i = 0; i < H; ++i) {
    rows[i].push_back(-1);
    rows[i].push_back(W);
    std::sort(rows[i].begin(), rows[i].end());
  }
  for(int j = 0; j < W; ++j) {
    cols[j].push_back(-1);
    cols[j].push_back(H);
    std::sort(cols[j].begin(), cols[j].end());
  }

  int ans = 0;
  for(int i = 0; i < H; ++i) {
    for(int j = 0; j < W; ++j) {
      if(grid[i][j] != '#') {
        int cnt = 0;
        auto p1 = std::lower_bound(rows[i].begin(), rows[i].end(), j);
        cnt += *p1 - *(p1 - 1) - 1;
        auto p2 = std::lower_bound(cols[j].begin(), cols[j].end(), i);
        cnt += *p2 - *(p2 - 1) - 1;
        ans = std::max(ans, cnt - 1);
      }
    }
  }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 38272
#include <iostream>
#include <vector>

using namespace std;

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

  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    while (i + 1 < n && a[i] == a[i + 1]) {
      ++i;
    }
    if (i + 1 < n && a[i] < a[i + 1]) {
      while (i + 1 < n && a[i] <= a[i + 1]) {
        ++i;
      }
    } else if (i + 1 < n && a[i + 1] < a[i]) {
      while (i + 1 < n && a[i + 1] <= a[i]) {
        ++i;
      }
    }
    ++ans;
  }
  cout << ans << endl;

  return 0;
}


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

// Macros
#define F      first
#define S      second
#define PB     push_back
#define MP     make_pair
#define ALL(c) c.begin(),c.end()

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = std::pair <int,int>;

// Random
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/* [a,b] */ template<class T> T rnd_IntType(T a, T b){ return uniform_int_distribution<T>(a, b)(rng); }
/* [a,b) */ template<class T> T rnd_RealType(T a, T b){ return uniform_real_distribution<T>(a,b)(rng); }

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m; ll y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const deque<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef LOCAL
	#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); d__f(_it, args); }
	void d__f(istream_iterator<string> it) {}
	template<typename Head, typename... Tail> void d__f(istream_iterator<string> it, Head H, Tail... T) { cerr << *it << " <=> [" << H << "]\n"; d__f(++it, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

const int mod = 998244353;

ll add(ll a, ll b) { return (a + b) % mod; }
ll sub(ll a, ll b) { return (a - b) % mod; }
ll mul(ll a, ll b) { return (a * b) % mod; }

signed main() {
	std::ios::sync_with_stdio(false); //Warning: Do NOT use C I/O now.
	std::cin.tie(nullptr); //Note: Comment out this line for interactive questions.
	// std::cout.setf(std::ios::fixed); std::cout.precision(20); //Note: To output decimals correctly.

	// int t; cin>>t;
	// for(int test_no = 1; test_no <= t; ++test_no){}

	int n;
	cin>>n;

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

	ll dp[n];
	dp[0] = 0;
	dp[1] = abs(h[0]-h[1]);

	for(int i=0; i<n; ++i){
		if(i!=n-1) dp[i+1] = min(dp[i+1], abs(h[i]-h[i+1])+dp[i]);
		if(i!=n-2) dp[i+2] = abs(h[i]-h[i+2])+dp[i];
	}

	cout<<dp[n-1];
}

Measured memory_bytes: 1792
//7-C

import java.util.Scanner;

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

        int r = sc.nextInt();//行
        int c = sc.nextInt();//列
        
        int[][] num = new int[r+1][c+1];//配列宣言 //ok
        
        //配列の中に整数代入
        for( int i = 0 ; i < r ; i++ ){
        	for ( int j = 0 ; j < c ; j++ ){
        		
        		num[i][j] = sc.nextInt();
        		
        		num[r][j] = num[r][j] + num[i][j];
        		num[i][c] = num[i][c] + num[i][j];
        		
        	}
        }
        
        //総合計入力
    	for ( int j = 0 ; j < c ; j++ ){
    		
    		num[r][c] = num[r][c] + num[r][j];
    		
    	}
        	
        
        //配列の中身と合計を出力
       for( int i = 0 ; i < r+1 ; i++ ){
        	for ( int j = 0 ; j < c+1 ; j++ ){
        		
        		if(j == 0){
        			System.out.print(num[i][j]);
        		}else{
        			System.out.print(" " + num[i][j]);
        		}
        		
        	}
        	System.out.println();
        }
    }
}

Measured memory_bytes: 41516
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i = l; i < (n); i++)
using namespace std;
using ll = long long;
int main() {
  int n;
  scanf("%d", &n);
  ll v[n+1][3] = {};
  rep(i,1,n+1) {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    v[i][0] = max(v[i-1][1]+b,v[i-1][2]+c);
    v[i][1] = max(v[i-1][0]+a,v[i-1][2]+c);
    v[i][2] = max(v[i-1][0]+a,v[i-1][1]+b);
  }
  ll ans = max(v[n][0],max(v[n][1],v[n][2]));
  printf("%lld\n", ans);
  return 0;
}

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

int main() {
  int N, D;
  cin >> N >> D;
  vector<vector<int>> X(N, vector<int>(D));
  for (int i=0; i<N; i++) {
    for (int j=0; j<D; j++) {
      cin >> X[i][j];
    }
  }
  
  int S;
  int C=0;
  int SS;
  for (int i=0; i<N-1; i++) {
    for (int j=i+1; j<N; j++) {
      S=0;
      for (int k=0; k<D; k++) {
        S+=(X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
      }
      SS=sqrt(S);
      if (S==SS*SS) {
        C++;
      }
    }
  }
  cout << C << endl;
}


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

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


int main(void){

	int N; cin >> N;
	int A; cin >> A;

	int tmp = N % 500;
	if(tmp <= A){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
A,B,K=input().split(" ")
A=int(A)
B=int(B)
K=int(K)

m=min(A,B)
c=0
for i in range(0,m):
	j=m-i
	#print(j,c)
	if(A%j==0 and B%j==0):
		c+=1
	if(c==K):
		print(j)
		exit()









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

using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl
#define HYPP(x) hypot(x.first,x.second)

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;



int main() {
	int N;
	cin >> N;
	map<lli, int> m;
	for (int i = 0; i < N; i++) {
		lli A;
		cin >> A;
		m[A]++;
	}
	multiset<lli> s;
	for (auto val : m) {
		if (val.second >= 2) {
			s.insert(val.first);
			if (val.second >= 4) s.insert(val.first);
		}
	}
	if (s.size() < 2) {
		cout << 0 << endl;
	}
	else {
		auto l2 = s.end(), l1 = s.end();
		advance(l2, -2);
		advance(l1, -1);
		cout << (*l2) * (*l1) << endl;
	}
	return 0;
}


Measured memory_bytes: 6528
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int res = i * 1.08;
    if (res == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  string t(s);
  reverse(t.begin(), t.end());
  int cnt = 0;
  for (int i = 0; i < s.size(); ++i) {
    cnt += (s[i] != t[i]);
  }
  cout << cnt / 2 << endl;
}

Measured memory_bytes: 256
/*
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineering College
    Date:12/06/2020
*/
#include<bits/stdc++.h>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define ff first
#define ss string 
#define se second
#define alt(v) v.begin(),v.end()
#define pb emplace_back
#define mp make_pair
#define fab(i,a,b) for(ll i=(a);i<(b);i++)
#define fba(i,a,b) for(ll i=(b);i>=(a);i--)
// ll mod=1000000007;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

const int N=1e5+5;
int dp[N][2];
int a[105][2];
int n,w;
bool test=0;
void solve()
{
    cin>>n>>w;
    memset(dp,0,sizeof(dp));
    for(int i=0;i<n;i++)
    cin>>a[i][0]>>a[i][1];
    
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j>=a[i][0])
                dp[j][1]=max(dp[j][1],a[i][1]+dp[j-a[i][0]][0]);
            else
                dp[j][1]=dp[j][0];
        }
        for(int j=1;j<=w;j++)
        dp[j][0]=dp[j][1];
        
    }
    cout<<dp[w][0];
}







signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin.exceptions(cin.failbit);
//     #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// 	#endif
    int t=1;
    if(test)
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	int A[] = new int[N];
	int B[] = new int[N];
	int C[] = new int[N];
	
	sc.nextLine();
	for (int i=0; i<N; i++){
	  A[i] = sc.nextInt();
	}
    sc.nextLine();
	for (int i=0; i<N; i++){
	  B[i] = sc.nextInt();
	}
	sc.nextLine();
	for (int i=0; i<N-1; i++){
	  C[i] = sc.nextInt();
	}
	
    int cuisine = A[0];
	int SatisfacationP = B[cuisine-1];
    
	for (int i=1; i<N; i++){
	  cuisine = A[i];
	  SatisfacationP += B[cuisine-1];
	  if((A[i-1] + 1) == A[i]){
	    SatisfacationP += C[cuisine-2];
      }
	}
    
    System.out.println(SatisfacationP);
  }
}

Measured memory_bytes: 22100
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

#define int long long

signed main()
{
    int N;
    scanf("%lld", &N);

    // the number of plus
    int np = 0;
    vector<int> v(N);
    int sum = 0;
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &v[i]);
        if (v[i] >= 0)
            np++;
        v[i] = abs(v[i]);
        sum += v[i];
    }

    int ans;
    if ((N - np) % 2 == 0)
    {
        ans = sum;
    }
    else
    {
        sort(v.begin(), v.end());
        ans = sum - 2 * v[0];
    }

    printf("%lld\n", ans);
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
      using namespace std;
      #include <ext/pb_ds/assoc_container.hpp>
      #include <ext/pb_ds/tree_policy.hpp>
      using namespace __gnu_pbds;
      #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
      #define ll long long
      #define int long long
      #define ld long double
      #define pb push_back
      #define f(i,a,b) for(int i=a;i<b;i++)
      #define fd(i,a,b) for(int i=a-1;i>=b;i--)
      #define pf push_front
      #define ppf pop_front
      #define ppb pop_back
      #define fi first
      #define se second
      #define take(a,n) f(i,0,n)cin>>a[i];
      #define show(a,n) f(i,0,n){cout<<a[i]<<" ";}
      #define ashow(a)  for(auto i:a)cout<<i<<" ";
      #define khtm     cout<<endl;
      #define all(s) s.begin(),s.end()
      #define len(a) a.length()
      #define INF 1e18
      #define MAXN 2000009
      #define PMOD 998244353
      const double pi=3.14159265358979323;
      const int mod=1e9+7;
      void btao(int n){
        if(n)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
      }
      bool isPrime(int n) 
  { 
      // Corner cases 
      if (n <= 1) 
          return false; 
      if (n <= 3) 
          return true; 
    
      // This is checked so that we can skip 
      // middle five numbers in below loop 
      if (n % 2 == 0 || n % 3 == 0) 
          return false; 
    
      for (int i = 5; i * i <= n; i = i + 6) 
          if (n % i == 0 || n % (i + 2) == 0) 
              return false; 
    
      return true; 
  } 
  int spf[MAXN];
  void sieve()
        {
            spf[1] = 1;
            for (int i=2; i<MAXN; i++)
                spf[i] = i;
            for (int i=4; i<MAXN; i+=2)
                spf[i] = 2;
            for (int i=3; i*i<MAXN; i++)
            {
                if (spf[i] == i)
                {
                    for (int j=i*i; j<MAXN; j+=i)
                        if (spf[j]==j)
                            spf[j] = i;
                }
            }
        }
 
  int lcm(int a,int b){
      return a*b/__gcd(a,b);
  }
  
  // string s;
       signed main() {

          ios_base::sync_with_stdio(false);
          cin.tie(NULL);  
          cout.tie(0);  
       // -------------------------------------Code starts here--------------------------------------------------------------------- 
      int t=1;
      //cin>>t;
      while(t--)
      {
        

            int x=0,y=0;
          int mx=0,mi=INF,mn=INF;
            int tb,ta,tm=0;
            int n,m;
            // int a,b;
            cin>>n;
            if(n%1000)cout<<1000-n%1000<<endl;
            else cout<<0<<endl;

            


                    }
   }

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

inline void ConvIntToChar(int a, int s[]) {
  for (int i = 0; i < 3; ++i) {
    s[i] = a % 10;
    a /= 10;
  }
}

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

  int S[N];
  char c;
  for (int i = 0; i < N; ++i) {
    cin >> c;
    S[i] = c - '0';
    //cout << S[i] << endl;
  }

  int cnt = 0;
  int s[3];
  for (int i = 0; i < 1000; ++i) {
    int p1 = -1;
    int p2 = -1;
    int p3 = -1;
    ConvIntToChar(i, s);
    //cout << s[2];
    //cout << s[1];
    //cout << s[0] << ":";
    for (int j = 0; j < N; ++j) {
      if (S[j] == s[2]) {
        p1 = j;
        //cout << "\t" << s[2] << " found at pos " << p1 << endl;
        break;
      }
    }
    if (p1 < 0) {
      //cout << cnt << endl;
      continue;
    }

    for (int j = p1 + 1; j < N; ++j) {
      if (S[j] == s[1]) {
        p2 = j;
        //cout << "\t\t" << s[1] << " found at pos " << p2 << endl;
        break;
      }
    }
    if (p2 < 0) {
      //cout << cnt << endl;
      continue;
    }
    for (int j = p2 + 1; j < N; ++j) {
      if (S[j] == s[0]) {
         //cout << "\t\t\t" << s[0] << " found at pos " << j << endl;
         cnt++;
         break;
      }
    }
    //cout << cnt << endl;
  } // end for
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <sstream>
#include <stack>
#include <iomanip>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
typedef vector<int> vi;
#define fi first
#define se second
#define fe first
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define Edg int M=0,fst[SZ],vb[SZ],nxt[SZ];void ad_de(int a,int b){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;}void adde(int a,int b){ad_de(a,b);ad_de(b,a);}
#define Edgc int M=0,fst[SZ],vb[SZ],nxt[SZ],vc[SZ];void ad_de(int a,int b,int c){++M;nxt[M]=fst[a];fst[a]=M;vb[M]=b;vc[M]=c;}void adde(int a,int b,int c){ad_de(a,b,c);ad_de(b,a,c);}
#define es(x,e) (int e=fst[x];e;e=nxt[e])
#define esb(x,e,b) (int e=fst[x],b=vb[e];e;e=nxt[e],b=vb[e])
int n,m,c2[2333333],ed[55],red[55];
ll f[2333333];
#define ff(i) (((i)&1)==bool((i)&2))
const int MOD=1e9+7;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,a,b;i<=m;++i)
	{
		scanf("%d%d",&a,&b);--a;--b;
		ed[a]|=1<<b; red[b]|=1<<a;
	}
	for(int i=1;i<(1<<n);++i) c2[i]=c2[i>>1]+(i&1);
	for(int i=0;i<(1<<n);++i) c2[i]=1<<c2[i];
	for(int i=0;i<(1<<n);++i)
	{
		if(!ff(i)) continue;
		f[i]=1;
		for(int g=i;g;g=(g-1)&i) if(g!=i&&ff(g))
		{
			int s=g^i; ll aa=1;
			for(int j=0;j<n;++j) if(g&(1<<j))
			{
				int d=ed[j]&s,d2=red[j]&s;
				aa*=c2[d]-1; aa%=MOD;
				aa*=c2[d2]; aa%=MOD;
			}
			(f[i]+=aa*f[g])%=MOD;
		}
	}
	ll ans=1;
	for(int i=1;i<=m;++i) ans=ans*2%MOD;
	ans=ans-f[(1<<n)-1];
	ans=(ans%MOD+MOD)%MOD;
	printf("%d\n",int(ans));
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main()
{
  int n,a,b,c,d; cin >> n >> a >> b >> c >> d;
  int x = abs(a - b); // aからの距離だけ考えれば良い

  bool f = false;
  int l = (n - 1) * c, u = (n - 1) * d;
  rep(i, (n + 1) / 2){
    if(l <= x and x <= u) f = true;
    l -= c + d;
    u -= c + d;
  }

  if(f) cout << "YES\n";
  else cout << "NO\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; i++){
        int in;
        cin >> in;
        if(in % 2 == 1){
            ans++;
        }
    }
    if(ans % 2 == 0){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n=int(input())

k=str(n)
ans=0

for i in range(1,len(k),2):
  s="9"
  s*=i
  ans+=int(s)-int(s)//10
    
if(len(k)%2==1):
	m=pow(10,len(k)-1)
	ans+=n-m+1

print(ans)

Measured memory_bytes: 38384
#include <stdio.h>
#include <algorithm>
#define MN 100005
typedef long long LL;
int n,tmin,a[MN],d[MN]; LL r[MN];
bool cmp(int x,int y){return a[x]!=a[y]?a[x]>a[y]:x>y;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),d[i]=i;
	std::sort(d+1,d+1+n,cmp); tmin=d[1];
	for(int i=1;i<=n;i++){
		int j=i;
		while(a[d[j+1]]==a[d[i]])j++;
		tmin=std::min(tmin,d[j]);
		r[tmin]+=1ll*j*(a[d[i]]-a[d[j+1]]);
		i=j;
	}
	for(int i=1;i<=n;i++)
		printf("%lld\n",r[i]);
}

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

string S;
int main(){
    cin >> S;
    map<char,int> m;
    for(char c:S) m[c]++;
    bool ok = true;
    if(m.size()!=2) ok = false;
    for(auto x:m) if(x.second!=2) ok = false;
    cout << (ok? "Yes":"No") << endl;
}

Measured memory_bytes: 256
# coding:utf-8
import numpy as np
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = np.zeros(n, dtype=int)
h = np.array(h)

def main():
    #今判明しているtable
    for i in range(1,n):
        start = max(0, i-k)
        dp[i] = min(dp[start: i] + np.abs(h[i] - h[start:i]))
    
    print(dp[n-1])

if __name__ == '__main__' :
    main()

Measured memory_bytes: 22772
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
#define fast ios::sync_with_stdio(false);
#define pi 3.14159265358979323846264338327950288419716939937510
#define pb push_back
#define max 10000002
typedef long long ll;
using namespace std;
int main()
{


        ll n;
         scanf("%lld",&n);
         ll a[max]={0};
        for(int i=1;i<=n;i++)
        {
            for(int j=1;i*j<=n;j++)
                {
                    a[i*j]++;
                }
        }

      ll ans=0;
      for(int i=1;i<=n;i++)
        ans+=a[i]*i;

      printf("%lld",ans);

return 0;

}


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

int main(){
  cin >> n;
  int a[n];
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }
  sort(a,a+n);
  cout << (a[n/2] - a[n/2 - 1]) << endl;
}

Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

ll n;
ll a[100001], b[100000];

int main() {
    cin >> n;
    rep(i,n+1) cin >> a[i];
    rep(i,n) cin >> b[i];
    ll ans = 0;
    rep(i,n) {
        if (a[i] >= b[i]) {
            ans += b[i];
            continue;
        }
        ans += a[i];
        b[i] -= a[i];
        if (a[i+1] >= b[i]) {
            ans += b[i];
            a[i+1] -= b[i];
        } else {
            ans += a[i+1];
            a[i+1] = 0;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
using namespace std;
const int INF=0x3f3f3f3f,maxn=0;
long long a,n,m,k;
int main()
{
	cin>>n>>m>>k;
	a=m*k;
	if(a<n)
	{
		cout<<"No";
	}
	else
		cout<<"Yes";
	return 0;
}


Measured memory_bytes: 3628
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Data.List
import Control.Monad
import Control.Arrow
import qualified Data.IntMap as IM
import qualified Data.IntSet as IS
import Data.Maybe
import qualified Data.Sequence as Seq
import Data.Foldable

r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine

data FB = Front | Back deriving Show

qread :: Int -> Bool -> IO [Maybe (FB,Char)]
qread 0 rev = return $ if rev then [Nothing] else []
qread n rev = do
    query <- words <$> getLine
    if read (head query) == 1
        then qread (n-1) (not rev)
        else let ["2",x,c] = query
            in do
                rc <- qread (n-1) rev
                return $ Just (rd (read x,rev),head c):rc

rd (1,False) = Front
rd (2,False) = Back
rd (1,True ) = Back
rd (2,True ) = Front

main :: IO ()
main = do
    s <- getLine
    q <- readLn
    qs <- qread q False
    putStrLn $ toList $ solve qs (Seq.fromList s)

solve :: [Maybe (FB,Char)] -> Seq.Seq Char -> Seq.Seq Char
solve []    sq = sq
solve [Nothing] sq = Seq.reverse sq
solve (Just (Front,c):xs) sq = solve xs (c Seq.<| sq)
solve (Just (Back,c):xs) sq = solve xs (sq Seq.|> c)




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

using namespace std;

#define endl "\n"
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fastio { ios_base::sync_with_stdio(false), cin.tie(NULL); }
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define for1(i, n) for(int i = 1; i <= (int)(n); i++)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)

#ifdef RICARDO
//Header here
	#include "E:\\Code\\dbg.h"
#else
	#define bug(...) "RICARDO MILOS"
#endif


template<class T> bool mini(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool maxi(T &a, T b) { return a < b ? (a = b, true) : false; }

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

//=================================================CODE=================================================//

signed main()
{	
	fastio;
	cout.precision(10);
	cout << fixed;
#ifdef RICARDO		
	freopen("i", "r", stdin);
#endif
	string s, t; cin >> s >> t;
	vi prefs(s.size()), preft(t.size());
	prefs[0] = s[0] - 'A' + 1;
	for1(i, s.size() - 1) prefs[i] = prefs[i - 1] + (s[i] - 'A' + 1);
	preft[0] = t[0] - 'A' + 1;
	for1(i, t.size() - 1) preft[i] = preft[i - 1] + (t[i] - 'A' + 1);

	int q; cin >> q; while(q--) {
		int a, b, c, d; cin >> a >> b >> c >> d;
		a--, b--, c--, d--;
		int cnts = prefs[b] - (a ? prefs[a - 1] : 0);
		int cntt = preft[d] - (c ? preft[c - 1] : 0);

		int delt = cnts - cntt;
		cout << (delt % 3 ? "NO" : "YES") << endl;
	}
#ifdef RICARDO
	cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define vec vector<int>
using namespace std;
int main()
{
    int N, A, B, count1 = 0, count2 = 0, count3 = 0;

    cin >> N >> A >> B;
    vec P(N);
    rep(i, N)
    {
        cin >> P[i];
        if (A >= P[i])
        {
            count1++;
        }
        else if (A + 1 <= P[i] && B >= P[i])
        {
            count2++;
        }
        else if (B + 1 <= P[i])
        {
            count3++;
        }
    }
    cout << min(count1, min(count2, count3)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll a,b,c,d,e,f,i,j,k,l,m,n;
  	double ans=-1,tmp;
  	cin>>a>>b>>c>>d>>e>>f;
  
  	for(i=0;100*a*i<=f;i++){
		for(j=0;100*a*i+100*b*j<=f;j++){
			for(k=0;100*a*i+100*b*j+c*k<=f;k++){
				for(l=0;100*a*i+100*b*j+c*k+d*l<=f&&i+j+k+l!=0;l++){
                  	tmp=100*(c*k+d*l)/(double)(100*a*i+100*b*j+c*k+d*l);
					if(ans<tmp&&tmp<=100*e/(double)(100+e)){
                      	ans=tmp;
                      	m=100*a*i+100*b*j;
                      	n=c*k+d*l;
                    }
                }
            }
        }
    }
  
  	cout<<m+n<<' '<<n<<endl;
}

Measured memory_bytes: 256
N=int(input())
a=input().split()
a_int = [int(i) for i in a]

count=0
while 1:
    k=0
    for i in a_int:
        k = k + i%2
    if k == 0:
        a_int = [i/2 for i in a_int]
        count=count+1
    else:
        print(count)
        break


Measured memory_bytes: 9256
<?php
fscanf(STDIN,"%d %d %d",$n,$a,$b);

$num = [];
for($i=1; $i<=$n; $i++){
    if($i<10){
        if($a<=$i && $i<=$b){
            $num[] = $i;
        }
    }else{
        $sum = [];
        $sum = str_split($i);
        $check = array_sum($sum);
        
        if($a<=$check && $check<=$b){
            $num[] = $i;
        }
    }
}
echo array_sum($num);
?>

Measured memory_bytes: 4604
#include<bits/stdc++.h>
using namespace std;
int a[100010],d[100010],b[100010],n;
long long t,tt;
void sol(int l,int r)
{
	if(l>=r) return ;
	int mid=(l+r)/2,p,q,x,i;
	sol(l,mid);
	sol(mid+1,r);
	p=l;
	q=mid+1;
	x=l;
	while(p<=mid&&q<=r)
	{
		if(d[p]<d[q]) b[x++]=d[p++];
		else
		{
			t+=(p-l);
			b[x++]=d[q++];
		}
	}
	while(p<=mid) b[x++]=d[p++];
	while(q<=r)
	{
		t+=(p-l);
		b[x++]=d[q++];
	}
	for(i=l; i<=r; i++)
		d[i]=b[i];
}
bool check(int x)
{
	t=0;
	int i;
	for(i=1; i<=n; i++)
		if(a[i]<=x) d[i]=1;
		else d[i]=-1;
	for(i=1; i<=n; i++)
		d[i]+=d[i-1];
	sol(0,n);
	return t>=(tt/2+1);
}
int main()
{
	int i,l=1e9,r=-1e9,mid;
	tt=0;
	scanf("%d",&n);
	for(i=1; i<=n; i++)
	{
		scanf("%d",&a[i]);
		l=min(l,a[i]);
		r=max(r,a[i]);
		tt+=i;
	}
	while(l<r)
	{
		mid=(l+r)/2;
		if(check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%d",r);
	return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
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; }

const long long MOD = 1e9+7;
long long n, k;
vector<long long> dp(100100, 0);

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while(n > 0) {
        if(n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    cin >> n >> k;
    long long ans = 0;
    for(int i = k; i > 0; --i) {
        int check = i;
        long long cnt = k/i;
        long long indata = modpow(cnt, n, MOD);
        int now = 2;
        while(now*check <= k) {
            indata -= dp.at(now*check);
            indata %= MOD;
            if(indata < 0) indata += MOD;
            now++;
        }
        dp.at(check) = indata;
        ans += (indata*i) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3904
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e10;
template<typename T> void cmax(T &a, T b) {a = max(a, b);}
template<typename T> void cmin(T &a, T b) {a = min(a, b);}


signed main(){

  int a,b;
  cin>>a>>b;
  if(a+b==15){
    cout<<'+'<<endl;
  }else if(a*b==15){
    cout<<'*'<<endl;
  }else{
    cout<<'x'<<endl;
  }

  return 0;
}


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

using namespace std;
typedef long long ll;

ll N, A, B, C, D;

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

    cin >> N >> A >> B >> C >> D;

    if(B < A){
        swap(A, B);
    }
    ll d = B - A;
    if(d > D * N){
        cout << "NO" << endl;
        return 0;
    }

    for(int i = 0; i <= N; ++i){
        ll a1 = A - i * C;
        ll a2 = A - i * D;
        ll m = N - 1 - i;
        ll b1 = a1 + m * D;
        ll b2 = a2 + m * C;
        if(b1 >= B && B >= b2){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
open Scanf

let () =
  let n = read_int () in
  let dic = Hashtbl.create n in
  let f c a =
    if c = "insert" then Hashtbl.add dic a true
    else if
      try Hashtbl.find dic a with _ -> false then print_endline "yes"
    else print_endline "no" in
  let rec loop x =
    if x = 0 then ()
    else let (c, a) = sscanf (read_line ()) "%s %s" (fun x y -> (x, y)) in
         f c a ; loop (x-1)
  in loop n

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

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

i64 lcm(i64 a,i64 b){
	return a/gcd(a,b)*b;
}

void solve(){
    i64 N;
    cin >> N;

    using point=pair<i64,i64>;
    vector<point> xy(N);
    rep(i,0,N) cin >> xy[i].first >> xy[i].second;

    i64 ans=1,mod=998244353;
    
    rep(i,0,N) ans=ans*2%mod;
    ans=((ans-(N+1))%mod+mod)%mod;

    auto is_on_same_line=[&](point &p,point &q,point &r){
        i64 dx1=q.first-p.first,dy1=q.second-p.second,
            dx2=r.first-q.first,dy2=r.second-q.second;
        if(dx1==0) return dx2==0;
        if(dx2==0) return dx1==0;
        
        if(dx1<0){
            dx1*=-1;
            dy1*=-1;
        }
        if(dx2<0){
            dx2*=-1;
            dy2*=-1;
        }
        i64 dx_lcm=lcm(dx1,dx2);
        return dx_lcm/dx1*dy1==dx_lcm/dx2*dy2;
    };

    set<pair<point,point>> normalized;
    
    rep(i,0,N){
        rep(j,i+1,N){
            vector<point> ps={xy[i],xy[j]};
            
            rep(k,0,N) if(k!=i and k!=j and is_on_same_line(xy[i],xy[j],xy[k])) ps.push_back(xy[k]);
            
            sort(ps.begin(),ps.end());
            
            if(normalized.find(make_pair(ps[0],ps[1]))!=normalized.end()) continue;
            normalized.insert(make_pair(ps[0],ps[1]));

            i64 s=1;
            rep(k,0,ps.size()) s=s*2%mod;
            s-=ps.size()+1;
            
            ans=((ans-s)%mod+mod)%mod;
        }
    }

    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

int main() {
  int a, b;	cin >> a >> b;
  rep(i,1001)
    if (a==i*8/100 && b==i/10) {
      cout << i << endl;
      return 0;
    }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a, b;
  
  scanf("%d%d", &a, &b);
  int max_con = 1, count=0;
  
  while(max_con < b)
  {
    max_con += a;
    max_con--;
    count++;
  }
  
  printf("%d", count);
    
  return 0;
}

Measured memory_bytes: 128
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;

int main(){    
  int N;
  cin >> N;
  int W[N],minn=10000,SA,sum=0,sum1=0,sum2=0;
  for(int i=0;i<N;i++){
    cin >> W[i];
    sum += W[i];
  }

  for(int i=0;i<N-1;i++){
    sum1 += W[i];
    sum2 = sum - sum1;
    SA = abs(sum1-sum2);
    minn = min(minn,SA);
  }
  
  cout << minn << endl;
}


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

int main(){
    int n;
    cin >> n;
    string s=to_string(n);

    if(s[0]=='7' || s[1]=='7' || s[2]=='7') cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3688
import math

def isPalindrome(s):
    n = len(s)
    flag = True
    for i in range(n):
        if i < math.floor(n/2):
            if s[i] == s[n - i - 1]:
                continue
            else:
                flag = False
    return flag


s = str(input())
n = len(s)
if n < 3:
    print('No')
medium = math.floor(n/2)
if isPalindrome(s) and isPalindrome(s[0:medium]) and isPalindrome(s[medium+1:n]):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064